From a07492b90a9772bacdad0cfc5fc26b52cfb11907 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Wed, 12 Jun 2024 11:30:26 -0700 Subject: [PATCH] moved --vim to Other Settings --- aider/args.py | 12 +-- aider/coders/editblock_prompts.py | 138 +-------------------------- website/assets/sample.aider.conf.yml | 6 +- website/docs/aider_conf.md | 6 +- website/docs/options.md | 16 ++-- website/docs/usage.md | 20 ++++ 6 files changed, 45 insertions(+), 153 deletions(-) diff --git a/aider/args.py b/aider/args.py index 4fc956062a6..52d5253ff70 100644 --- a/aider/args.py +++ b/aider/args.py @@ -20,12 +20,6 @@ def get_parser(default_config_files, git_root): auto_env_var_prefix="AIDER_", ) group = parser.add_argument_group("Main") - group.add_argument( - "--vim", - action="store_true", - help="Use VI editing mode in the terminal (default: False)", - default=False, - ) group.add_argument( "files", metavar="FILE", @@ -369,6 +363,12 @@ def get_parser(default_config_files, git_root): ########## group = parser.add_argument_group("Other Settings") + group.add_argument( + "--vim", + action="store_true", + help="Use VI editing mode in the terminal (default: False)", + default=False, + ) group.add_argument( "--voice-language", metavar="VOICE_LANGUAGE", diff --git a/aider/coders/editblock_prompts.py b/aider/coders/editblock_prompts.py index 44e44df9220..be556b31fbe 100644 --- a/aider/coders/editblock_prompts.py +++ b/aider/coders/editblock_prompts.py @@ -4,140 +4,12 @@ class EditBlockPrompts(CoderPrompts): - main_system = """Act as an expert software developer. -Always use best practices when coding. -Respect and use existing conventions, libraries, etc that are already present in the code base. -{lazy_prompt} -Take requests for changes to the supplied code. -If the request is ambiguous, ask questions. + main_system = """Act as a software expert and answer user questions about how to use the aider program. +You never write code, just answer questions. -Always reply to the user in the same language they are using. - -Once you understand the request you MUST: -1. Decide if you need to propose *SEARCH/REPLACE* edits to any files that haven't been added to the chat. You can create new files without asking. But if you need to propose edits to existing files not already added to the chat, you *MUST* tell the user their full path names and ask them to *add the files to the chat*. End your reply and wait for their approval. You can keep asking if you then decide you need to edit more files. -2. Think step-by-step and explain the needed changes with a numbered list of short sentences. -3. Describe each change with a *SEARCH/REPLACE block* per the examples below. All changes to files must use this *SEARCH/REPLACE block* format. ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! - -All changes to files must use the *SEARCH/REPLACE block* format. +Decide if you need to see any files that haven't been added to the chat. If so, you *MUST* tell the user their full path names and ask them to *add the files to the chat*. End your reply and wait for their approval. You can keep asking if you then decide you need to see more files. """ - example_messages = [ - dict( - role="user", - content="Change get_factorial() to use math.factorial", - ), - dict( - role="assistant", - content="""To make this change we need to modify `mathweb/flask/app.py` to: - -1. Import the math package. -2. Remove the existing factorial() function. -3. Update get_factorial() to call math.factorial instead. - -Here are the *SEARCH/REPLACE* blocks: - -mathweb/flask/app.py -{fence[0]}python -<<<<<<< SEARCH -from flask import Flask -======= -import math -from flask import Flask ->>>>>>> REPLACE -{fence[1]} - -mathweb/flask/app.py -{fence[0]}python -<<<<<<< SEARCH -def factorial(n): - "compute factorial" - - if n == 0: - return 1 - else: - return n * factorial(n-1) - -======= ->>>>>>> REPLACE -{fence[1]} - -mathweb/flask/app.py -{fence[0]}python -<<<<<<< SEARCH - return str(factorial(n)) -======= - return str(math.factorial(n)) ->>>>>>> REPLACE -{fence[1]} -""", - ), - dict( - role="user", - content="Refactor hello() into its own file.", - ), - dict( - role="assistant", - content="""To make this change we need to modify `main.py` and make a new file `hello.py`: - -1. Make a new hello.py file with hello() in it. -2. Remove hello() from main.py and replace it with an import. - -Here are the *SEARCH/REPLACE* blocks: - -hello.py -{fence[0]}python -<<<<<<< SEARCH -======= -def hello(): - "print a greeting" + example_messages = [] - print("hello") ->>>>>>> REPLACE -{fence[1]} - -main.py -{fence[0]}python -<<<<<<< SEARCH -def hello(): - "print a greeting" - - print("hello") -======= -from hello import hello ->>>>>>> REPLACE -{fence[1]} -""", - ), - ] - - system_reminder = """# *SEARCH/REPLACE block* Rules: - -Every *SEARCH/REPLACE block* must use this format: -1. The file path alone on a line, verbatim. No bold asterisks, no quotes around it, no escaping of characters, etc. -2. The opening fence and code language, eg: {fence[0]}python -3. The start of search block: <<<<<<< SEARCH -4. A contiguous chunk of lines to search for in the existing source code -5. The dividing line: ======= -6. The lines to replace into the source code -7. The end of the replace block: >>>>>>> REPLACE -8. The closing fence: {fence[1]} - -Every *SEARCH* section must *EXACTLY MATCH* the existing source code, character for character, including all comments, docstrings, etc. - -*SEARCH/REPLACE* blocks will replace *all* matching occurrences. -Include enough lines to make the SEARCH blocks unique. - -Include *ALL* the code being searched and replaced! - -Only create *SEARCH/REPLACE* blocks for files that the user has added to the chat! - -To move code within a file, use 2 *SEARCH/REPLACE* blocks: 1 to delete it from its current location, 1 to insert it in the new location. - -If you want to put code in a new file, use a *SEARCH/REPLACE block* with: -- A new file path, including dir name if needed -- An empty `SEARCH` section -- The new file's contents in the `REPLACE` section - -{lazy_prompt} -ONLY EVER RETURN CODE IN A *SEARCH/REPLACE BLOCK*! -""" + system_reminder = "" diff --git a/website/assets/sample.aider.conf.yml b/website/assets/sample.aider.conf.yml index a4ecb092804..78b81609d26 100644 --- a/website/assets/sample.aider.conf.yml +++ b/website/assets/sample.aider.conf.yml @@ -12,9 +12,6 @@ ####### # Main: -## Use VI editing mode in the terminal (default: False) -#vim: false - ## Specify the OpenAI API key #openai-api-key: @@ -177,6 +174,9 @@ ################# # Other Settings: +## Use VI editing mode in the terminal (default: False) +#vim: false + ## Specify the language for voice using ISO 639-1 code (default: auto) #voice-language: en diff --git a/website/docs/aider_conf.md b/website/docs/aider_conf.md index 344ebc5341e..e6024338c8b 100644 --- a/website/docs/aider_conf.md +++ b/website/docs/aider_conf.md @@ -38,9 +38,6 @@ cog.outl("```") ####### # Main: -## Use VI editing mode in the terminal (default: False) -#vim: false - ## Specify the OpenAI API key #openai-api-key: @@ -203,6 +200,9 @@ cog.outl("```") ################# # Other Settings: +## Use VI editing mode in the terminal (default: False) +#vim: false + ## Specify the language for voice using ISO 639-1 code (default: auto) #voice-language: en diff --git a/website/docs/options.md b/website/docs/options.md index 2183782d59e..a192227cd49 100644 --- a/website/docs/options.md +++ b/website/docs/options.md @@ -14,8 +14,8 @@ from aider.args import get_md_help cog.out(get_md_help()) ]]]--> ``` -usage: aider [-h] [--vim] [--openai-api-key] [--anthropic-api-key] - [--model] [--opus] [--sonnet] [--4] [--4o] [--4-turbo] +usage: aider [-h] [--openai-api-key] [--anthropic-api-key] [--model] + [--opus] [--sonnet] [--4] [--4o] [--4-turbo] [--35turbo] [--models] [--openai-api-base] [--openai-api-type] [--openai-api-version] [--openai-api-deployment-id] [--openai-organization-id] @@ -35,7 +35,7 @@ usage: aider [-h] [--vim] [--openai-api-key] [--anthropic-api-key] [--dry-run | --no-dry-run] [--commit] [--lint] [--lint-cmd] [--auto-lint | --no-auto-lint] [--test-cmd] [--auto-test | --no-auto-test] [--test] - [--voice-language] [--version] [--check-update] + [--vim] [--voice-language] [--version] [--check-update] [--skip-check-update] [--apply] [--yes] [-v] [--show-repo-map] [--show-prompts] [--message] [--message-file] [--encoding] [-c] [--gui] @@ -52,11 +52,6 @@ Aliases: ## Main: -### `--vim` -Use VI editing mode in the terminal (default: False) -Default: False -Environment variable: `AIDER_VIM` - ### `--openai-api-key OPENAI_API_KEY` Specify the OpenAI API key Environment variable: `OPENAI_API_KEY` @@ -331,6 +326,11 @@ Environment variable: `AIDER_TEST` ## Other Settings: +### `--vim` +Use VI editing mode in the terminal (default: False) +Default: False +Environment variable: `AIDER_VIM` + ### `--voice-language VOICE_LANGUAGE` Specify the language for voice using ISO 639-1 code (default: auto) Default: en diff --git a/website/docs/usage.md b/website/docs/usage.md index e0406fe2d06..7451f9b2a63 100644 --- a/website/docs/usage.md +++ b/website/docs/usage.md @@ -10,11 +10,31 @@ Run `aider` with the source code files you want to edit. These files will be "added to the chat session", so that aider can see their contents and edit them for you. +They can be existing files or the name of files you want +aider to create for you. ``` aider ... ``` +At the aider `>` prompt, ask for code changes and aider +will edit those files to accomplish your request. + + +``` +$ aider factorial.py + +Aider v0.37.1-dev +Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo +Git repo: .git with 258 files +Repo-map: using 1024 tokens +Use /help to see in-chat commands, run with --help to see cmd line args +─────────────────────────────────────────────────────────────────────── +>`Make a program that asks for a number and prints its factorial + +... +``` + ## Adding files Just add the files that the aider will need to *edit*.