diff --git a/aider/__init__.py b/aider/__init__.py index 6c97ffd850c..defa2fac775 100644 --- a/aider/__init__.py +++ b/aider/__init__.py @@ -1,6 +1,6 @@ from packaging import version -__version__ = "0.88.19.dev" +__version__ = "0.88.20.dev" safe_version = __version__ try: diff --git a/aider/commands.py b/aider/commands.py index c54e5f7be68..75a6a72cd53 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -1257,9 +1257,9 @@ async def cmd_exit(self, args): except Exception: sys.exit() - def cmd_quit(self, args): + async def cmd_quit(self, args): "Exit the application" - self.cmd_exit(args) + await self.cmd_exit(args) def cmd_context_management(self, args=""): "Toggle context management for large files" diff --git a/aider/helpers/similarity.py b/aider/helpers/similarity.py index 4f725d7aeae..37e43b640ca 100644 --- a/aider/helpers/similarity.py +++ b/aider/helpers/similarity.py @@ -79,7 +79,7 @@ def create_bigram_vector(texts): chars = np.array(list(text_lower)) # Create bigrams by combining consecutive characters - bigrams = np.core.defchararray.add(chars[:-1], chars[1:]) + bigrams = np.char.add(chars[:-1], chars[1:]) # Filter only alphabetic bigrams mask = np.array([bg.isalpha() for bg in bigrams]) diff --git a/aider/io.py b/aider/io.py index 03f7c36dee2..574da1d4982 100644 --- a/aider/io.py +++ b/aider/io.py @@ -154,6 +154,8 @@ def __init__( self.command_completions = dict() if commands: self.command_names = self.commands.get_commands() + else: + self.command_names = [] for rel_fname in addable_rel_fnames: self.words.add(rel_fname) diff --git a/aider/main.py b/aider/main.py index 11813bea7fc..bfb161457a0 100644 --- a/aider/main.py +++ b/aider/main.py @@ -37,7 +37,7 @@ from aider.models import ModelSettings from aider.onboarding import offer_openrouter_oauth, select_default_model from aider.repo import ANY_GIT_ERROR, GitRepo -from aider.report import report_uncaught_exceptions +from aider.report import report_uncaught_exceptions, set_args_error_data from aider.versioncheck import check_version, install_from_main_branch, install_upgrade from aider.watch import FileWatcher @@ -576,6 +576,7 @@ async def main_async(argv=None, input=None, output=None, force_git_root=None, re # Parse again to include any arguments that might have been defined in .env args = parser.parse_args(argv) + set_args_error_data(args) if args.debug: global log_file diff --git a/aider/report.py b/aider/report.py index 0f5f613ef4d..ce0d3be23e8 100644 --- a/aider/report.py +++ b/aider/report.py @@ -10,6 +10,9 @@ from aider.urls import github_issues from aider.versioncheck import VERSION_CHECK_FNAME +# Global variable to store resolved args data for error reporting +resolved_args_data = None + FENCE = "`" * 3 @@ -34,6 +37,54 @@ def get_git_info(): return "Git information unavailable" +def format_args_for_reporting(args): + """ + Format args data for error reporting, removing sensitive keys and collapsing MCP servers. + """ + if not args: + return "No args data available" + + # Create a copy of the args namespace as a dictionary + args_dict = vars(args).copy() + + # Remove any keys containing "key" (case insensitive) + keys_to_remove = [key for key in args_dict.keys() if "key" in key.lower()] + for key in keys_to_remove: + args_dict.pop(key, None) + + # Handle mcp_servers - collapse into just a list of server names + if "mcp_servers" in args_dict: + mcp_servers = args_dict["mcp_servers"] + if isinstance(mcp_servers, str): + try: + import json + + config = json.loads(mcp_servers) + if "mcpServers" in config: + server_names = list(config["mcpServers"].keys()) + args_dict["mcp_servers"] = server_names + except (json.JSONDecodeError, AttributeError): + # If parsing fails, keep the original value + pass + + # Format the output line by line + lines = ["Configuration:"] + for key, value in sorted(args_dict.items()): + lines.append(f"{key}: {value}") + + return "\n".join(lines) + + +def get_args_error_data(): + global resolved_args_data + return resolved_args_data + + +def set_args_error_data(args): + global resolved_args_data + resolved_args_data = args + + def report_github_issue(issue_text, title=None, confirm=True): """ Compose a URL to open a new GitHub issue with the given text prefilled, @@ -50,9 +101,18 @@ def report_github_issue(issue_text, title=None, confirm=True): python_info = get_python_info() + "\n" os_info = get_os_info() + "\n" git_info = get_git_info() + "\n" + args_info = format_args_for_reporting(get_args_error_data()) + "\n" system_info = ( - version_info + python_version + platform_info + python_info + os_info + git_info + "\n" + version_info + + python_version + + platform_info + + python_info + + os_info + + git_info + + "\n" + + args_info + + "\n" ) issue_text = system_info + issue_text diff --git a/aider/versioncheck.py b/aider/versioncheck.py index 119c96911fb..7c0a73a2f42 100644 --- a/aider/versioncheck.py +++ b/aider/versioncheck.py @@ -32,7 +32,7 @@ async def install_upgrade(io, latest_version=None): """ if latest_version: - new_ver_text = f"Newer aider version v{latest_version} is available." + new_ver_text = f"Newer aider-ce version v{latest_version} is available." else: new_ver_text = "Install latest version of aider?" @@ -50,7 +50,7 @@ async def install_upgrade(io, latest_version=None): io, None, new_ver_text, - ["aider-chat"], + ["aider-ce"], self_update=True, )