finished --show-repo-map

This commit is contained in:
Paul Gauthier 2023-07-12 13:46:27 -07:00
parent a10b08e8de
commit f78977cd5b

View file

@ -244,12 +244,6 @@ def main(args=None, input=None, output=None):
########## ##########
other_group = parser.add_argument_group("Other Settings") other_group = parser.add_argument_group("Other Settings")
other_group.add_argument(
"--show-map",
action="store_true",
help="Print the repo map and exit",
default=False,
)
other_group.add_argument( other_group.add_argument(
"--version", "--version",
action="version", action="version",
@ -274,6 +268,12 @@ def main(args=None, input=None, output=None):
help="Enable verbose output", help="Enable verbose output",
default=False, default=False,
) )
other_group.add_argument(
"--show-repo-map",
action="store_true",
help="Print the repo map and exit (debug)",
default=False,
)
other_group.add_argument( other_group.add_argument(
"--message", "--message",
"--msg", "--msg",
@ -369,29 +369,31 @@ def main(args=None, input=None, output=None):
setattr(openai, mod_key, val) setattr(openai, mod_key, val)
io.tool_output(f"Setting openai.{mod_key}={val}") io.tool_output(f"Setting openai.{mod_key}={val}")
if args.show_map: coder = Coder.create(
repo_map = RepoMap(map_tokens=args.map_tokens, root=git_root, main_model=main_model, io=io, verbose=args.verbose) main_model,
print(repo_map) args.edit_format,
sys.exit(0) io,
else: ##
coder = Coder.create( fnames=args.files,
main_model, pretty=args.pretty,
args.edit_format, show_diffs=args.show_diffs,
io, auto_commits=args.auto_commits,
## dirty_commits=args.dirty_commits,
fnames=args.files, dry_run=args.dry_run,
pretty=args.pretty, map_tokens=args.map_tokens,
show_diffs=args.show_diffs, verbose=args.verbose,
auto_commits=args.auto_commits, assistant_output_color=args.assistant_output_color,
dirty_commits=args.dirty_commits, code_theme=args.code_theme,
dry_run=args.dry_run, stream=args.stream,
map_tokens=args.map_tokens, use_git=args.git,
verbose=args.verbose, )
assistant_output_color=args.assistant_output_color,
code_theme=args.code_theme, if args.show_repo_map:
stream=args.stream, other_files = set(coder.get_all_abs_files()) - set(coder.abs_fnames)
use_git=args.git, if coder.repo_map:
) repo_content = coder.repo_map.get_repo_map(coder.abs_fnames, other_files)
print(repo_content)
return
if args.dirty_commits: if args.dirty_commits:
coder.commit(ask=True, which="repo_files") coder.commit(ask=True, which="repo_files")