diff --git a/aider/coder.py b/aider/coder.py index 32bb7d9c1..89845fe73 100755 --- a/aider/coder.py +++ b/aider/coder.py @@ -45,14 +45,14 @@ class Coder: self.main_model = main_model if main_model == "gpt-3.5-turbo": self.console.print( - f"[red bold]This tool will almost certainly fail to work with {main_model}" + f"[red]This tool will almost certainly fail to work with {main_model}" ) self.set_repo(fnames) if not self.repo: self.console.print( - "[red bold]No suitable git repo, will not automatically commit edits." + "[red]No suitable git repo, will not automatically commit edits." ) self.find_common_root() @@ -62,7 +62,7 @@ class Coder: def find_common_root(self): common_prefix = os.path.commonpath(list(self.abs_fnames)) self.root = os.path.dirname(common_prefix) - self.console.print(f"[red]Common root directory: {self.root}") + self.console.print(f"[bright_black]Common root directory: {self.root}") def set_repo(self, cmd_line_fnames): if not cmd_line_fnames: @@ -73,7 +73,7 @@ class Coder: repo_paths = [] for fname in abs_fnames: if not fname.exists(): - self.console.print(f"[red]Creating {fname}") + self.console.print(f"[bright_black]Creating {fname}") fname.touch() try: repo_path = git.Repo(fname, search_parent_directories=True).git_dir @@ -83,10 +83,10 @@ class Coder: num_repos = len(set(repo_paths)) if num_repos == 0: - self.console.print("[red bold]Files are not in a git repo.") + self.console.print("[red]Files are not in a git repo.") return if num_repos > 1: - self.console.print("[red bold]Files are in different git repos.") + self.console.print("[red]Files are in different git repos.") return # https://github.com/gitpython-developers/GitPython/issues/427 @@ -98,7 +98,7 @@ class Coder: for fname in abs_fnames: if fname.is_dir(): continue - self.console.print(f"[red]Loading {fname}") + self.console.print(f"[bright_black]Loading {fname}") fname = fname.resolve() self.abs_fnames.add(str(fname)) @@ -109,20 +109,24 @@ class Coder: new_files.append(relative_fname) if new_files: - self.console.print(f"[red]Files not tracked in {repo.git_dir}:") + self.console.print(f"[bright_black]Files not tracked in {repo.git_dir}:") for fn in new_files: - self.console.print(f"[red] {fn}") - if Confirm.ask("[red bold]Add them?", console=self.console, default="y"): + self.console.print(f"[bright_black] {fn}") + if Confirm.ask( + "[bright_black]Add them?", console=self.console, default="y" + ): for relative_fname in new_files: repo.git.add(relative_fname) - self.console.print(f"[red]Added {relative_fname} to the git repo") + self.console.print( + f"[bright_black]Added {relative_fname} to the git repo" + ) show_files = ", ".join(new_files) commit_message = ( f"Initial commit: Added new files to the git repo: {show_files}" ) repo.git.commit("-m", commit_message, "--no-verify") self.console.print( - f"[red]Committed new files with message: {commit_message}" + f"[bright_black]Committed new files with message: {commit_message}" ) else: self.console.print("[red]Skipped adding new files to the git repo.") @@ -183,7 +187,7 @@ class Coder: self.num_control_c += 1 if self.num_control_c >= 2: break - self.console.print("[bold red]^C again to quit") + self.console.print("[red]^C again to quit") except EOFError: return @@ -264,7 +268,7 @@ class Coder: message=commit_message, ) else: - self.console.print("[red bold]No changes found in tracked files.") + self.console.print("[red]Warning: no changes found in tracked files.") saved_message = prompts.files_content_gpt_no_edits self.done_messages += self.cur_messages @@ -355,11 +359,9 @@ class Coder: if full_path not in self.abs_fnames: if not Path(full_path).exists(): - question = f"[red]Allow creation of new file {path}?" + question = f"[bright_black]Allow creation of new file {path}?" else: - question = ( - f"[red]Allow edits to {path} which was not previously provided?" - ) + question = f"[bright_black]Allow edits to {path} which was not previously provided?" if not Confirm.ask(question, console=self.console, default="y"): self.console.print(f"[red]Skipping edit to {path}") continue @@ -368,13 +370,15 @@ class Coder: self.abs_fnames.add(full_path) if self.repo and Confirm.ask( - f"[red]Add {path} to git?", console=self.console, default="y" + f"[bright_black]Add {path} to git?", + console=self.console, + default="y", ): self.repo.git.add(full_path) edited.add(path) if utils.do_replace(full_path, original, updated): - self.console.print(f"[red]Applied edit to {path}") + self.console.print(f"[bright_black]Applied edit to {path}") else: self.console.print(f"[red]Failed to apply edit to {path}") @@ -449,11 +453,13 @@ class Coder: if ask: self.last_modified = self.get_last_modified() - self.console.print("[red]Files have uncommitted changes.\n") - self.console.print(f"[red]Suggested commit message:\n{commit_message}\n") + self.console.print("[bright_black]Files have uncommitted changes.\n") + self.console.print( + f"[bright_black]Suggested commit message:\n{commit_message}\n" + ) res = Prompt.ask( - "[red]Commit before the chat proceeds? \[y/n/commit message]", # noqa: W605 + "[bright_black]Commit before the chat proceeds? \[y/n/commit message]", # noqa: W605 console=self.console, default="y", ).strip() @@ -470,7 +476,7 @@ class Coder: full_commit_message = commit_message + "\n\n" + context repo.git.commit("-m", full_commit_message, "--no-verify") commit_hash = repo.head.commit.hexsha[:7] - self.console.print(f"[red]{commit_hash} {commit_message}") + self.console.print(f"[bright_black]{commit_hash} {commit_message}") self.last_modified = self.get_last_modified() diff --git a/aider/commands.py b/aider/commands.py index 131f04902..6748caaeb 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -86,7 +86,7 @@ class Commands: ) self.coder.repo.git.commit("-m", commit_message, "--no-verify") commit_hash = self.coder.repo.head.commit.hexsha[:7] - self.console.print(f"[red]{commit_hash} {commit_message}") + self.console.print(f"[bright_black]{commit_hash} {commit_message}") return self.coder.commit() @@ -108,7 +108,7 @@ class Commands: return self.coder.repo.git.reset("--hard", "HEAD~1") self.console.print( - f"[red]{last_commit.message.strip()}\n" + f"[bright_black]{last_commit.message.strip()}\n" f"The above commit {self.coder.last_aider_commit_hash} " "was reset and removed from git.\n" ) @@ -151,12 +151,16 @@ class Commands: matched_files = [file for file in files if word in file] if not matched_files: if self.coder.repo is not None: - create_file = Confirm.ask(f"[red]No files matched '{word}'. Do you want to create the file and add it to git?") + create_file = Confirm.ask( + f"[bright_black]No files matched '{word}'. Do you want to create the file and add it to git?" + ) else: - create_file = Confirm.ask(f"[red]No files matched '{word}'. Do you want to create the file?") + create_file = Confirm.ask( + f"[bright_black]No files matched '{word}'. Do you want to create the file?" + ) if create_file: - with open(os.path.join(self.coder.root, word), 'w') as new_file: + with open(os.path.join(self.coder.root, word), "w") as new_file: pass matched_files = [word] if self.coder.repo is not None: @@ -171,7 +175,9 @@ class Commands: ) if abs_file_path not in self.coder.abs_fnames: self.coder.abs_fnames.add(abs_file_path) - self.console.print(f"[red]Added {matched_file} to the chat") + self.console.print( + f"[bright_black]Added {matched_file} to the chat" + ) added_fnames.append(matched_file) else: self.console.print(f"[red]{matched_file} is already in the chat") @@ -204,7 +210,9 @@ class Commands: for matched_file in matched_files: relative_fname = os.path.relpath(matched_file, self.coder.root) self.coder.abs_fnames.remove(matched_file) - self.console.print(f"[red]Removed {relative_fname} from the chat") + self.console.print( + f"[bright_black]Removed {relative_fname} from the chat" + ) def cmd_ls(self, args): "List files and show their chat status" @@ -221,11 +229,11 @@ class Commands: other_files.append(file) if chat_files: - self.console.print("[red]Files in chat:\n") + self.console.print("[bright_black]Files in chat:\n") for file in chat_files: - self.console.print(f"[red] {file}") + self.console.print(f"[bright_black] {file}") if other_files: - self.console.print("\n[red]Repo files not in the chat:\n") + self.console.print("\n[bright_black]Repo files not in the chat:\n") for file in other_files: - self.console.print(f"[red] {file}") + self.console.print(f"[bright_black] {file}")