chatmcp-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aider/__init__.py +20 -0
- aider/__main__.py +4 -0
- aider/_version.py +21 -0
- aider/analytics.py +250 -0
- aider/args.py +926 -0
- aider/args_formatter.py +228 -0
- aider/coders/__init__.py +34 -0
- aider/coders/architect_coder.py +48 -0
- aider/coders/architect_prompts.py +40 -0
- aider/coders/ask_coder.py +9 -0
- aider/coders/ask_prompts.py +35 -0
- aider/coders/base_coder.py +2483 -0
- aider/coders/base_prompts.py +60 -0
- aider/coders/chat_chunks.py +64 -0
- aider/coders/context_coder.py +53 -0
- aider/coders/context_prompts.py +75 -0
- aider/coders/editblock_coder.py +657 -0
- aider/coders/editblock_fenced_coder.py +10 -0
- aider/coders/editblock_fenced_prompts.py +143 -0
- aider/coders/editblock_func_coder.py +141 -0
- aider/coders/editblock_func_prompts.py +27 -0
- aider/coders/editblock_prompts.py +174 -0
- aider/coders/editor_diff_fenced_coder.py +9 -0
- aider/coders/editor_diff_fenced_prompts.py +11 -0
- aider/coders/editor_editblock_coder.py +8 -0
- aider/coders/editor_editblock_prompts.py +18 -0
- aider/coders/editor_whole_coder.py +8 -0
- aider/coders/editor_whole_prompts.py +10 -0
- aider/coders/help_coder.py +16 -0
- aider/coders/help_prompts.py +46 -0
- aider/coders/patch_coder.py +706 -0
- aider/coders/patch_prompts.py +161 -0
- aider/coders/search_replace.py +757 -0
- aider/coders/shell.py +37 -0
- aider/coders/single_wholefile_func_coder.py +102 -0
- aider/coders/single_wholefile_func_prompts.py +27 -0
- aider/coders/udiff_coder.py +429 -0
- aider/coders/udiff_prompts.py +115 -0
- aider/coders/udiff_simple.py +14 -0
- aider/coders/udiff_simple_prompts.py +25 -0
- aider/coders/wholefile_coder.py +144 -0
- aider/coders/wholefile_func_coder.py +134 -0
- aider/coders/wholefile_func_prompts.py +27 -0
- aider/coders/wholefile_prompts.py +67 -0
- aider/commands.py +1665 -0
- aider/copypaste.py +72 -0
- aider/deprecated.py +126 -0
- aider/diffs.py +128 -0
- aider/dump.py +29 -0
- aider/editor.py +147 -0
- aider/exceptions.py +107 -0
- aider/format_settings.py +26 -0
- aider/gui.py +545 -0
- aider/help.py +163 -0
- aider/help_pats.py +19 -0
- aider/history.py +143 -0
- aider/io.py +1175 -0
- aider/linter.py +304 -0
- aider/llm.py +47 -0
- aider/main.py +1267 -0
- aider/mdstream.py +243 -0
- aider/models.py +1286 -0
- aider/onboarding.py +428 -0
- aider/openrouter.py +128 -0
- aider/prompts.py +64 -0
- aider/queries/tree-sitter-language-pack/README.md +7 -0
- aider/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/c-tags.scm +9 -0
- aider/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
- aider/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
- aider/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
- aider/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
- aider/queries/tree-sitter-language-pack/d-tags.scm +26 -0
- aider/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
- aider/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
- aider/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
- aider/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
- aider/queries/tree-sitter-language-pack/go-tags.scm +42 -0
- aider/queries/tree-sitter-language-pack/java-tags.scm +20 -0
- aider/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
- aider/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
- aider/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
- aider/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
- aider/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
- aider/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/python-tags.scm +14 -0
- aider/queries/tree-sitter-language-pack/r-tags.scm +21 -0
- aider/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
- aider/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
- aider/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
- aider/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
- aider/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
- aider/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
- aider/queries/tree-sitter-languages/README.md +23 -0
- aider/queries/tree-sitter-languages/c-tags.scm +9 -0
- aider/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
- aider/queries/tree-sitter-languages/cpp-tags.scm +15 -0
- aider/queries/tree-sitter-languages/dart-tags.scm +91 -0
- aider/queries/tree-sitter-languages/elisp-tags.scm +8 -0
- aider/queries/tree-sitter-languages/elixir-tags.scm +54 -0
- aider/queries/tree-sitter-languages/elm-tags.scm +19 -0
- aider/queries/tree-sitter-languages/go-tags.scm +30 -0
- aider/queries/tree-sitter-languages/hcl-tags.scm +77 -0
- aider/queries/tree-sitter-languages/java-tags.scm +20 -0
- aider/queries/tree-sitter-languages/javascript-tags.scm +88 -0
- aider/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
- aider/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
- aider/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
- aider/queries/tree-sitter-languages/php-tags.scm +26 -0
- aider/queries/tree-sitter-languages/python-tags.scm +12 -0
- aider/queries/tree-sitter-languages/ql-tags.scm +26 -0
- aider/queries/tree-sitter-languages/ruby-tags.scm +64 -0
- aider/queries/tree-sitter-languages/rust-tags.scm +60 -0
- aider/queries/tree-sitter-languages/scala-tags.scm +65 -0
- aider/queries/tree-sitter-languages/typescript-tags.scm +41 -0
- aider/reasoning_tags.py +82 -0
- aider/repo.py +623 -0
- aider/repomap.py +847 -0
- aider/report.py +200 -0
- aider/resources/__init__.py +3 -0
- aider/resources/model-metadata.json +468 -0
- aider/resources/model-settings.yml +1767 -0
- aider/run_cmd.py +132 -0
- aider/scrape.py +284 -0
- aider/sendchat.py +61 -0
- aider/special.py +203 -0
- aider/urls.py +17 -0
- aider/utils.py +338 -0
- aider/versioncheck.py +113 -0
- aider/voice.py +187 -0
- aider/waiting.py +221 -0
- aider/watch.py +318 -0
- aider/watch_prompts.py +12 -0
- aider/website/Gemfile +8 -0
- aider/website/_includes/blame.md +162 -0
- aider/website/_includes/get-started.md +22 -0
- aider/website/_includes/help-tip.md +5 -0
- aider/website/_includes/help.md +24 -0
- aider/website/_includes/install.md +5 -0
- aider/website/_includes/keys.md +4 -0
- aider/website/_includes/model-warnings.md +67 -0
- aider/website/_includes/multi-line.md +22 -0
- aider/website/_includes/python-m-aider.md +5 -0
- aider/website/_includes/recording.css +228 -0
- aider/website/_includes/recording.md +34 -0
- aider/website/_includes/replit-pipx.md +9 -0
- aider/website/_includes/works-best.md +1 -0
- aider/website/_sass/custom/custom.scss +103 -0
- aider/website/docs/config/adv-model-settings.md +1881 -0
- aider/website/docs/config/aider_conf.md +527 -0
- aider/website/docs/config/api-keys.md +90 -0
- aider/website/docs/config/dotenv.md +478 -0
- aider/website/docs/config/editor.md +127 -0
- aider/website/docs/config/model-aliases.md +103 -0
- aider/website/docs/config/options.md +843 -0
- aider/website/docs/config/reasoning.md +209 -0
- aider/website/docs/config.md +44 -0
- aider/website/docs/faq.md +378 -0
- aider/website/docs/git.md +76 -0
- aider/website/docs/index.md +47 -0
- aider/website/docs/install/codespaces.md +39 -0
- aider/website/docs/install/docker.md +57 -0
- aider/website/docs/install/optional.md +100 -0
- aider/website/docs/install/replit.md +8 -0
- aider/website/docs/install.md +115 -0
- aider/website/docs/languages.md +264 -0
- aider/website/docs/legal/contributor-agreement.md +111 -0
- aider/website/docs/legal/privacy.md +104 -0
- aider/website/docs/llms/anthropic.md +77 -0
- aider/website/docs/llms/azure.md +48 -0
- aider/website/docs/llms/bedrock.md +132 -0
- aider/website/docs/llms/cohere.md +34 -0
- aider/website/docs/llms/deepseek.md +32 -0
- aider/website/docs/llms/gemini.md +49 -0
- aider/website/docs/llms/github.md +105 -0
- aider/website/docs/llms/groq.md +36 -0
- aider/website/docs/llms/lm-studio.md +39 -0
- aider/website/docs/llms/ollama.md +75 -0
- aider/website/docs/llms/openai-compat.md +39 -0
- aider/website/docs/llms/openai.md +58 -0
- aider/website/docs/llms/openrouter.md +78 -0
- aider/website/docs/llms/other.md +103 -0
- aider/website/docs/llms/vertex.md +50 -0
- aider/website/docs/llms/warnings.md +10 -0
- aider/website/docs/llms/xai.md +53 -0
- aider/website/docs/llms.md +54 -0
- aider/website/docs/more/analytics.md +122 -0
- aider/website/docs/more/edit-formats.md +116 -0
- aider/website/docs/more/infinite-output.md +137 -0
- aider/website/docs/more-info.md +8 -0
- aider/website/docs/recordings/auto-accept-architect.md +31 -0
- aider/website/docs/recordings/dont-drop-original-read-files.md +35 -0
- aider/website/docs/recordings/index.md +21 -0
- aider/website/docs/recordings/model-accepts-settings.md +69 -0
- aider/website/docs/recordings/tree-sitter-language-pack.md +80 -0
- aider/website/docs/repomap.md +112 -0
- aider/website/docs/scripting.md +100 -0
- aider/website/docs/troubleshooting/aider-not-found.md +24 -0
- aider/website/docs/troubleshooting/edit-errors.md +76 -0
- aider/website/docs/troubleshooting/imports.md +62 -0
- aider/website/docs/troubleshooting/models-and-keys.md +54 -0
- aider/website/docs/troubleshooting/support.md +79 -0
- aider/website/docs/troubleshooting/token-limits.md +96 -0
- aider/website/docs/troubleshooting/warnings.md +12 -0
- aider/website/docs/troubleshooting.md +11 -0
- aider/website/docs/usage/browser.md +57 -0
- aider/website/docs/usage/caching.md +49 -0
- aider/website/docs/usage/commands.md +132 -0
- aider/website/docs/usage/conventions.md +119 -0
- aider/website/docs/usage/copypaste.md +121 -0
- aider/website/docs/usage/images-urls.md +48 -0
- aider/website/docs/usage/lint-test.md +118 -0
- aider/website/docs/usage/modes.md +211 -0
- aider/website/docs/usage/not-code.md +179 -0
- aider/website/docs/usage/notifications.md +87 -0
- aider/website/docs/usage/tips.md +79 -0
- aider/website/docs/usage/tutorials.md +30 -0
- aider/website/docs/usage/voice.md +121 -0
- aider/website/docs/usage/watch.md +294 -0
- aider/website/docs/usage.md +92 -0
- aider/website/share/index.md +101 -0
- chatmcp_cli-0.1.0.dist-info/METADATA +502 -0
- chatmcp_cli-0.1.0.dist-info/RECORD +228 -0
- chatmcp_cli-0.1.0.dist-info/WHEEL +5 -0
- chatmcp_cli-0.1.0.dist-info/entry_points.txt +3 -0
- chatmcp_cli-0.1.0.dist-info/licenses/LICENSE.txt +202 -0
- chatmcp_cli-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,79 @@
|
|
1
|
+
---
|
2
|
+
parent: Usage
|
3
|
+
nav_order: 25
|
4
|
+
description: Tips for AI pair programming with aider.
|
5
|
+
---
|
6
|
+
|
7
|
+
# Tips
|
8
|
+
|
9
|
+
## Just add the files that need to be changed to the chat
|
10
|
+
|
11
|
+
Take a moment and think about which files will need to be changed.
|
12
|
+
Aider can often figure out which files to edit all by itself, but the most efficient approach is for you to add the files to the chat.
|
13
|
+
|
14
|
+
## Don't add lots of files to the chat
|
15
|
+
|
16
|
+
Just add the files you think need to be edited.
|
17
|
+
Too much irrelevant code will distract and confuse the LLM.
|
18
|
+
Aider uses a [map of your entire git repo](https://aider.chat/docs/repomap.html)
|
19
|
+
so is usually aware of relevant classes/functions/methods elsewhere in your code base.
|
20
|
+
It's ok to add 1-2 highly relevant files that don't need to be edited,
|
21
|
+
but be selective.
|
22
|
+
|
23
|
+
## Break your goal down into bite sized steps
|
24
|
+
|
25
|
+
Do them one at a time.
|
26
|
+
Adjust the files added to the chat as you go: `/drop` files that don't need any more changes, `/add` files that need changes for the next step.
|
27
|
+
|
28
|
+
## For complex changes, discuss a plan first
|
29
|
+
|
30
|
+
Use the [`/ask` command](modes.html) to make a plan with aider.
|
31
|
+
Once you are happy with the approach, just say "go ahead" without the `/ask` prefix.
|
32
|
+
|
33
|
+
## If aider gets stuck
|
34
|
+
|
35
|
+
- Use `/clear` to discard the chat history and make a fresh start.
|
36
|
+
- Can you `/drop` any extra files?
|
37
|
+
- Use `/ask` to discuss a plan before aider starts editing code.
|
38
|
+
- Use the [`/model` command](commands.html) to switch to a different model and try again. Switching between GPT-4o and Sonnet will often get past problems.
|
39
|
+
- If aider is hopelessly stuck,
|
40
|
+
just code the next step yourself and try having aider code some more after that.
|
41
|
+
Take turns and pair program with aider.
|
42
|
+
|
43
|
+
## Creating new files
|
44
|
+
|
45
|
+
If you want aider to create a new file, add it to the repository first with `/add <file>`.
|
46
|
+
This way aider knows this file exists and will write to it.
|
47
|
+
Otherwise, aider might write the changes to an existing file.
|
48
|
+
This can happen even if you ask for a new file, as LLMs tend to focus a lot
|
49
|
+
on the existing information in their contexts.
|
50
|
+
|
51
|
+
## Fixing bugs and errors
|
52
|
+
|
53
|
+
If your code is throwing an error,
|
54
|
+
use the [`/run` command](commands.html)
|
55
|
+
to share the error output with the aider.
|
56
|
+
Or just paste the errors into the chat. Let the aider figure out how to fix the bug.
|
57
|
+
|
58
|
+
If test are failing, use the [`/test` command](lint-test.html)
|
59
|
+
to run tests and
|
60
|
+
share the error output with the aider.
|
61
|
+
|
62
|
+
## Providing docs
|
63
|
+
|
64
|
+
LLMs know about a lot of standard tools and libraries, but may get some of the fine details wrong about API versions and function arguments.
|
65
|
+
|
66
|
+
You can provide up-to-date documentation in a few ways:
|
67
|
+
|
68
|
+
- Paste doc snippets into the chat.
|
69
|
+
- Include a URL to docs in your chat message
|
70
|
+
and aider will scrape and read it. For example: `Add a submit button like this https://ui.shadcn.com/docs/components/button`.
|
71
|
+
- Use the [`/read` command](commands.html) to read doc files into the chat from anywhere on your filesystem.
|
72
|
+
- If you have coding conventions or standing instructions you want aider to follow, consider using a [conventions file](conventions.html).
|
73
|
+
|
74
|
+
## Interrupting & inputting
|
75
|
+
|
76
|
+
Use Control-C to interrupt aider if it isn't providing a useful response. The partial response remains in the conversation, so you can refer to it when you reply with more information or direction.
|
77
|
+
|
78
|
+
{% include multi-line.md %}
|
79
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
parent: Usage
|
3
|
+
nav_order: 75
|
4
|
+
description: Intro and tutorial videos made by aider users.
|
5
|
+
---
|
6
|
+
|
7
|
+
# Tutorial videos
|
8
|
+
|
9
|
+
Here are some tutorial videos made by aider users:
|
10
|
+
|
11
|
+
- [Using Architect/Editor mode](https://www.youtube.com/watch?v=OPXslklVBZc) -- AICodeKing
|
12
|
+
- [Using aider to incrementally build a non-trivial app](https://youtu.be/QlUt06XLbJE) -- IndyDevDan
|
13
|
+
- [Aider and Replit on mobile with your voice](https://x.com/itsPaulAi/status/1830987090617831810) -- Paul Couvert
|
14
|
+
- [Aider is the OG AI Coding King (Mermaid Diagram AI Agent)](https://www.youtube.com/watch?v=ag-KxYS8Vuw) -- IndyDevDan
|
15
|
+
- [Installing aider in replit and making a Trello clone](https://x.com/itspaulai/status/1828834199597633724) -- Paul Couvert
|
16
|
+
- [Step-by-Step Development Environment Setup for AI-Assisted Coding](https://www.youtube.com/watch?v=DnBVgfe6ZQM) -- Coding the Future With AI
|
17
|
+
- [Generate FULL-STACK Apps with Claude 3.5 Sonnet](https://youtu.be/sKeIZGW8xzg) -- AICodeKing
|
18
|
+
- [Creating Games with AI from Start-To-End](https://youtu.be/sOd2YYZFMUs) -- AICodeKing
|
19
|
+
- [Claude 3.5 and aider: Use AI Assistants to Build AI Apps](https://youtu.be/0hIisJ3xAdU) -- Coding the Future With AI
|
20
|
+
- [Develop a Full-stack App Without Writing ANY Code](https://youtu.be/dzOWn8TI738) -- WorldofAI
|
21
|
+
- [Generate Games with AI (w/ Local LLMs)](https://youtu.be/DjVJpGzQbSA) -- AICodeKing
|
22
|
+
- [Aider tips and Example use](https://www.youtube.com/watch?v=OsChkvGGDgw) -- techfren
|
23
|
+
- [Aider and Claude 3.5: Develop a Full-stack App Without Writing ANY Code!](https://www.youtube.com/watch?v=BtAqHsySdSY) -- Coding the Future With AI
|
24
|
+
- [Generate application with just one prompt using Aider](https://www.youtube.com/watch?v=Y-_0VkMUiPc&t=78s) -- AICodeKing
|
25
|
+
- [Aider : the production ready AI coding assistant you've been waiting for](https://www.youtube.com/watch?v=zddJofosJuM) -- Learn Code With JV
|
26
|
+
- [Holy Grail: FREE Coding Assistant That Can Build From EXISTING CODE BASE](https://www.youtube.com/watch?v=df8afeb1FY8) -- Matthew Berman
|
27
|
+
- [Aider: This AI Coder Can Create AND Update Git Codebases](https://www.youtube.com/watch?v=EqLyFT78Sig) -- Ian Wootten
|
28
|
+
|
29
|
+
Thanks to all these great creators for taking the time
|
30
|
+
to share their experiences coding with aider!
|
@@ -0,0 +1,121 @@
|
|
1
|
+
---
|
2
|
+
parent: Usage
|
3
|
+
nav_order: 100
|
4
|
+
description: Speak with aider about your code!
|
5
|
+
---
|
6
|
+
|
7
|
+
# Voice-to-code with aider
|
8
|
+
|
9
|
+
Speak with aider about your code! Request new features, test cases or bug fixes using your voice and let aider do the work of editing the files in your local git repo. As with all of aider's capabilities, you can use voice-to-code with an existing repo or to start a new project.
|
10
|
+
|
11
|
+
Voice support fits quite naturally into aider's AI pair programming
|
12
|
+
chat interface. Now you can fluidly switch between voice and text chat
|
13
|
+
when you ask aider to edit your code.
|
14
|
+
|
15
|
+
## How to use voice-to-code
|
16
|
+
|
17
|
+
Use the in-chat `/voice` command to start recording,
|
18
|
+
and press `ENTER` when you're done speaking.
|
19
|
+
Your voice coding instructions will be transcribed,
|
20
|
+
as if you had typed them into
|
21
|
+
the aider chat session.
|
22
|
+
|
23
|
+
See the [installation instructions](https://aider.chat/docs/install/optional.html#enable-voice-coding) for
|
24
|
+
information on how to enable the `/voice` command.
|
25
|
+
|
26
|
+
<br/>
|
27
|
+
<div class="chat-transcript" markdown="1">
|
28
|
+
|
29
|
+
> Aider v0.11.2-dev
|
30
|
+
> Added app.py to the chat.
|
31
|
+
|
32
|
+
#### /voice
|
33
|
+
|
34
|
+
<blockquote>
|
35
|
+
<div class="recording-line">
|
36
|
+
<p style="display: inline;">Recording, press ENTER when done... <span id="timer">3.5</span>sec</p>
|
37
|
+
<div id="progress-bar">
|
38
|
+
<div id="progress"></div>
|
39
|
+
</div>
|
40
|
+
</div>
|
41
|
+
</blockquote>
|
42
|
+
|
43
|
+
<style>
|
44
|
+
.recording-line > * {
|
45
|
+
display: inline-block;
|
46
|
+
vertical-align: middle;
|
47
|
+
}
|
48
|
+
#progress-bar {
|
49
|
+
width: 100px;
|
50
|
+
height: 20px;
|
51
|
+
background-color: #333;
|
52
|
+
margin-left: 10px;
|
53
|
+
}
|
54
|
+
#progress {
|
55
|
+
height: 100%;
|
56
|
+
background-color: #f0f0f0;
|
57
|
+
animation: progress 3s infinite;
|
58
|
+
}
|
59
|
+
@keyframes progress {
|
60
|
+
0% { width: 10%; }
|
61
|
+
20% { width: 90%; }
|
62
|
+
50% { width: 30%; }
|
63
|
+
60% { width: 90%; }
|
64
|
+
80% { width: 20%; }
|
65
|
+
100% { width: 10%; }
|
66
|
+
|
67
|
+
}
|
68
|
+
</style>
|
69
|
+
|
70
|
+
<script>
|
71
|
+
window.onload = function() {
|
72
|
+
var counter = 0;
|
73
|
+
var timer = document.getElementById('timer');
|
74
|
+
setInterval(function() {
|
75
|
+
counter = (counter + 0.1) % 9;
|
76
|
+
timer.textContent = counter.toFixed(1);
|
77
|
+
}, 100);
|
78
|
+
}
|
79
|
+
</script>
|
80
|
+
|
81
|
+
<div style="display: inline-block; position: relative; width: 200px; background-color: #f0f0f0; border-radius: 10px; padding: 10px; color: #333; font-family: 'Comic Sans MS', 'Comic Sans', 'Marker Felt', sans-serif;">
|
82
|
+
<span style="position: absolute; top: 0; left: 50%; transform: translate(-50%, -100%); width: 0; height: 0; border-left: 10px solid transparent; border-right: 10px solid transparent; border-bottom: 10px solid #f0f0f0;"></span>
|
83
|
+
“ add a factorial endpoint that uses math factorial ”
|
84
|
+
</div>
|
85
|
+
|
86
|
+
#### Add a factorial endpoint that uses math.factorial.
|
87
|
+
|
88
|
+
To add a factorial endpoint to the Flask application, we need to modify the `app.py` file.
|
89
|
+
|
90
|
+
Here are the steps:
|
91
|
+
|
92
|
+
1. Add a new route `/fact/<int:x>` to the Flask application.
|
93
|
+
2. In the function for this route, call `math.factorial(x)` and return the result as a string.
|
94
|
+
|
95
|
+
Here is the *edit block* for these changes:
|
96
|
+
|
97
|
+
```python
|
98
|
+
app.py
|
99
|
+
<<<<<<< HEAD
|
100
|
+
if __name__ == '__main__':
|
101
|
+
print("Starting...")
|
102
|
+
app.run()
|
103
|
+
=======
|
104
|
+
@app.route('/fact/<int:x>')
|
105
|
+
def factorial(x):
|
106
|
+
result = math.factorial(x)
|
107
|
+
return str(result)
|
108
|
+
|
109
|
+
if __name__ == '__main__':
|
110
|
+
print("Starting...")
|
111
|
+
app.run()
|
112
|
+
>>>>>>> updated
|
113
|
+
```
|
114
|
+
|
115
|
+
> Applied edit to app.py
|
116
|
+
> Commit ef9e3e7 aider: Add a factorial endpoint that uses math.factorial.
|
117
|
+
|
118
|
+
</div>
|
119
|
+
<br/>
|
120
|
+
<br/>
|
121
|
+
<br/>
|
@@ -0,0 +1,294 @@
|
|
1
|
+
---
|
2
|
+
title: Aider in your IDE
|
3
|
+
#highlight_image: /assets/browser.jpg
|
4
|
+
parent: Usage
|
5
|
+
nav_order: 750
|
6
|
+
description: Aider can watch your files and respond to AI comments you add in your favorite IDE or text editor.
|
7
|
+
---
|
8
|
+
|
9
|
+
# Aider in your IDE
|
10
|
+
|
11
|
+
<div class="video-container">
|
12
|
+
<video controls loop poster="/assets/watch.jpg">
|
13
|
+
<source src="/assets/watch.mp4" type="video/mp4">
|
14
|
+
<a href="/assets/watch.mp4">Aider browser UI demo video</a>
|
15
|
+
</video>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<style>
|
19
|
+
.video-container {
|
20
|
+
position: relative;
|
21
|
+
padding-bottom: 102.7%; /1.027 */
|
22
|
+
height: 0;
|
23
|
+
overflow: hidden;
|
24
|
+
}
|
25
|
+
|
26
|
+
.video-container video {
|
27
|
+
position: absolute;
|
28
|
+
top: 0;
|
29
|
+
left: 0;
|
30
|
+
width: 100%;
|
31
|
+
height: 100%;
|
32
|
+
}
|
33
|
+
</style>
|
34
|
+
|
35
|
+
## AI comments
|
36
|
+
|
37
|
+
If you run aider with `--watch-files`, it will watch all files in your repo
|
38
|
+
and look for any AI coding instructions you add using your favorite IDE or text editor.
|
39
|
+
|
40
|
+
Specifically, aider looks for one-liner comments (# ... or // ...) that either start or end with `AI`, `AI!` or `AI?` like these:
|
41
|
+
|
42
|
+
```python
|
43
|
+
# Make a snake game. AI!
|
44
|
+
# What is the purpose of this method AI?
|
45
|
+
```
|
46
|
+
|
47
|
+
Or in `//` comment languages...
|
48
|
+
|
49
|
+
```js
|
50
|
+
// Write a protein folding prediction engine. AI!
|
51
|
+
```
|
52
|
+
|
53
|
+
Aider will take note of all the comments that start or end with `AI`.
|
54
|
+
Comments that include `AI!` with an exclamation point or `AI?` with a question
|
55
|
+
mark are special.
|
56
|
+
They trigger aider to take action to collect *all* the AI comments and use them
|
57
|
+
as your instructions.
|
58
|
+
|
59
|
+
- `AI!` triggers aider to make changes to your code.
|
60
|
+
- `AI?` triggers aider to answer your question.
|
61
|
+
|
62
|
+
See the demo video above that shows aider working with AI comments in VSCode.
|
63
|
+
|
64
|
+
|
65
|
+
## Example
|
66
|
+
|
67
|
+
For example, if you included this AI comment in your code:
|
68
|
+
|
69
|
+
```js
|
70
|
+
function factorial(n) // Implement this. AI!
|
71
|
+
```
|
72
|
+
|
73
|
+
Then aider would update the file and implement the function:
|
74
|
+
|
75
|
+
```js
|
76
|
+
function factorial(n) {
|
77
|
+
if (n === 0 || n === 1) {
|
78
|
+
return 1;
|
79
|
+
} else {
|
80
|
+
return n * factorial(n - 1);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
```
|
84
|
+
|
85
|
+
## Comment styles
|
86
|
+
|
87
|
+
Aider only watches for these types of **one-liner** comments:
|
88
|
+
|
89
|
+
```
|
90
|
+
# Python and bash style
|
91
|
+
// Javascript style
|
92
|
+
-- SQL style
|
93
|
+
```
|
94
|
+
|
95
|
+
Aider will look for those comment types in all files.
|
96
|
+
You can use them into any code file you're editing, even if they aren't the
|
97
|
+
correct comment syntax for that language.
|
98
|
+
|
99
|
+
## Multiple uses
|
100
|
+
|
101
|
+
This capability is quite flexible and powerful, and can be used in many ways.
|
102
|
+
|
103
|
+
### In-context instructions
|
104
|
+
|
105
|
+
You can add an AI comment in the function you want changed,
|
106
|
+
explaining the change request in-context right where you want the changes.
|
107
|
+
|
108
|
+
```javascript
|
109
|
+
app.get('/sqrt/:n', (req, res) => {
|
110
|
+
const n = parseFloat(req.params.n);
|
111
|
+
|
112
|
+
// Add error handling for NaN and less than zero. AI!
|
113
|
+
|
114
|
+
const result = math.sqrt(n);
|
115
|
+
res.json({ result: result });
|
116
|
+
});
|
117
|
+
```
|
118
|
+
|
119
|
+
### Multiple comments
|
120
|
+
|
121
|
+
You can add multiple `AI` comments without the `!`,
|
122
|
+
before triggering aider with a final `AI!`.
|
123
|
+
Also keep in mind that you can spread the AI comments across
|
124
|
+
multiple files, if you want to coordinate changes in multiple places.
|
125
|
+
Just use `AI!` last, to trigger aider.
|
126
|
+
|
127
|
+
```python
|
128
|
+
@app.route('/factorial/<int:n>')
|
129
|
+
def factorial(n):
|
130
|
+
if n < 0:
|
131
|
+
return jsonify(error="Factorial is not defined for negative numbers"), 400
|
132
|
+
|
133
|
+
# AI: Refactor this code...
|
134
|
+
|
135
|
+
result = 1
|
136
|
+
for i in range(1, n + 1):
|
137
|
+
result *= i
|
138
|
+
|
139
|
+
# ... into to a compute_factorial() function. AI!
|
140
|
+
|
141
|
+
return jsonify(result=result)
|
142
|
+
```
|
143
|
+
|
144
|
+
### Long form instructions
|
145
|
+
|
146
|
+
You can add a block of comments, with longer instructions.
|
147
|
+
Just be sure to start or end one of the lines with `AI` or `AI!` to draw
|
148
|
+
aider's attention to the block.
|
149
|
+
|
150
|
+
```python
|
151
|
+
# Make these changes: AI!
|
152
|
+
# - Add a proper main() function
|
153
|
+
# - Use Click to process cmd line args
|
154
|
+
# - Accept --host and --port args
|
155
|
+
# - Print a welcome message that includes the listening url
|
156
|
+
|
157
|
+
if __name__ == "__main__":
|
158
|
+
app.run(debug=True)
|
159
|
+
```
|
160
|
+
|
161
|
+
### Add a file to the aider chat
|
162
|
+
|
163
|
+
Rather than using `/add` to add a file inside the aider chat, you can
|
164
|
+
simply put an `#AI` comment in it and save the file.
|
165
|
+
You can undo/remove the comment immediately if you like, the file
|
166
|
+
will still be added to the aider chat.
|
167
|
+
|
168
|
+
## Also use aider chat in the terminal
|
169
|
+
|
170
|
+
It can be really helpful to get a change started with AI comments.
|
171
|
+
But sometimes you want to build on or refine those changes.
|
172
|
+
You can of course continue to do that with AI comments,
|
173
|
+
but it can sometimes be effective to switch over to the aider terminal chat.
|
174
|
+
The chat has the history of the AI comments you just made,
|
175
|
+
so you can continue on naturally from there.
|
176
|
+
|
177
|
+
You can also use the normal aider chat in your terminal to work with
|
178
|
+
many of aider's more advanced features:
|
179
|
+
|
180
|
+
- Use `/undo` to revert changes you don't like. Although you may also be able to use your IDE's undo function to step back in the file history.
|
181
|
+
- Use [chat modes](https://aider.chat/docs/usage/modes.html) to ask questions or get help.
|
182
|
+
- Manage the chat context with `/tokens`, `/clear`, `/drop`, `/reset`.
|
183
|
+
Adding an AI comment will add the file to the chat.
|
184
|
+
Periodically, you may want remove extra context that is no longer needed.
|
185
|
+
- [Fix lint and test errors](https://aider.chat/docs/usage/lint-test.html).
|
186
|
+
- Run shell commands.
|
187
|
+
- Etc.
|
188
|
+
|
189
|
+
|
190
|
+
## You can be lazy
|
191
|
+
|
192
|
+
The examples above all show AI
|
193
|
+
comments with full sentences, proper capitalization, punctuation, etc.
|
194
|
+
This was done to help explain how AI comments work, but is not needed in practice.
|
195
|
+
|
196
|
+
Most LLMs are perfectly capable of dealing with ambiguity and
|
197
|
+
inferring implied intent.
|
198
|
+
This often allows you to be quite lazy with your AI comments.
|
199
|
+
In particular, you can start and end comments with lowercase `ai` and `ai!`,
|
200
|
+
but you can also be much more terse with the request itself.
|
201
|
+
Below are simpler versions of some of the examples given above.
|
202
|
+
|
203
|
+
When the context clearly implies the needed action, `ai!` might be all you
|
204
|
+
need. For example, to implement a factorial function
|
205
|
+
in a program full of other math functions either of these
|
206
|
+
approaches would probably work:
|
207
|
+
|
208
|
+
```js
|
209
|
+
function factorial(n) // ai!
|
210
|
+
```
|
211
|
+
|
212
|
+
Or...
|
213
|
+
|
214
|
+
```js
|
215
|
+
// add factorial() ai!
|
216
|
+
```
|
217
|
+
|
218
|
+
Rather than a long, explicit comment like "Add error handling for NaN and less than zero,"
|
219
|
+
you can let aider infer more about the request.
|
220
|
+
This simpler comment may be sufficient:
|
221
|
+
|
222
|
+
```javascript
|
223
|
+
app.get('/sqrt/:n', (req, res) => {
|
224
|
+
const n = parseFloat(req.params.n);
|
225
|
+
|
226
|
+
// add error handling ai!
|
227
|
+
|
228
|
+
const result = math.sqrt(n);
|
229
|
+
res.json({ result: result });
|
230
|
+
});
|
231
|
+
```
|
232
|
+
|
233
|
+
Similarly, this refactor probably could have been requested with fewer words, like this:
|
234
|
+
|
235
|
+
```python
|
236
|
+
@app.route('/factorial/<int:n>')
|
237
|
+
def factorial(n):
|
238
|
+
if n < 0:
|
239
|
+
return jsonify(error="Factorial is not defined for negative numbers"), 400
|
240
|
+
|
241
|
+
# ai refactor...
|
242
|
+
|
243
|
+
result = 1
|
244
|
+
for i in range(1, n + 1):
|
245
|
+
result *= i
|
246
|
+
|
247
|
+
# ... to compute_factorial() ai!
|
248
|
+
|
249
|
+
return jsonify(result=result)
|
250
|
+
```
|
251
|
+
|
252
|
+
As you use aider with your chosen LLM, you can develop a sense for how
|
253
|
+
explicit you need to make your AI comments.
|
254
|
+
|
255
|
+
## Behind the scenes
|
256
|
+
|
257
|
+
Aider sends your AI comments to the LLM with the
|
258
|
+
[repo map](https://aider.chat/docs/repomap.html)
|
259
|
+
and all the other code context you've added to the chat.
|
260
|
+
|
261
|
+
It also pulls out and highlights the AI comments with specific context, showing the LLM
|
262
|
+
exactly how they fit into the code base.
|
263
|
+
|
264
|
+
```
|
265
|
+
The "AI" comments below marked with █ can be found in the code files I've shared with you.
|
266
|
+
They contain your instructions.
|
267
|
+
Make the requested changes.
|
268
|
+
Be sure to remove all these "AI" comments from the code!
|
269
|
+
|
270
|
+
todo_app.py:
|
271
|
+
⋮...
|
272
|
+
│class TodoList:
|
273
|
+
⋮...
|
274
|
+
│ def __init__(self):
|
275
|
+
│ """Initialize an empty todo list"""
|
276
|
+
⋮...
|
277
|
+
│
|
278
|
+
│ def list_tasks(self):
|
279
|
+
│ """Display all tasks"""
|
280
|
+
█ # Implement this. AI!
|
281
|
+
│
|
282
|
+
│def main():
|
283
|
+
│ todo = TodoList()
|
284
|
+
│
|
285
|
+
⋮...
|
286
|
+
```
|
287
|
+
|
288
|
+
--------
|
289
|
+
|
290
|
+
#### Credits
|
291
|
+
|
292
|
+
*This feature was inspired by
|
293
|
+
the way [Override](https://github.com/oi-overide) watches for file changes
|
294
|
+
to find prompts embedded within `//> a specific set of delimiters <//`.*
|
@@ -0,0 +1,92 @@
|
|
1
|
+
---
|
2
|
+
nav_order: 30
|
3
|
+
has_children: true
|
4
|
+
description: How to use aider to pair program with AI and edit code in your local git repo.
|
5
|
+
---
|
6
|
+
|
7
|
+
# Usage
|
8
|
+
|
9
|
+
Run `aider` with the source code files you want to edit.
|
10
|
+
These files will be "added to the chat session", so that
|
11
|
+
aider can see their
|
12
|
+
contents and edit them for you.
|
13
|
+
They can be existing files or the name of files you want
|
14
|
+
aider to create for you.
|
15
|
+
|
16
|
+
```
|
17
|
+
aider <file1> <file2> ...
|
18
|
+
```
|
19
|
+
|
20
|
+
At the aider `>` prompt, ask for code changes and aider
|
21
|
+
will edit those files to accomplish your request.
|
22
|
+
|
23
|
+
|
24
|
+
```
|
25
|
+
$ aider factorial.py
|
26
|
+
|
27
|
+
Aider v0.37.1-dev
|
28
|
+
Models: gpt-4o with diff edit format, weak model gpt-3.5-turbo
|
29
|
+
Git repo: .git with 258 files
|
30
|
+
Repo-map: using 1024 tokens
|
31
|
+
Use /help to see in-chat commands, run with --help to see cmd line args
|
32
|
+
───────────────────────────────────────────────────────────────────────
|
33
|
+
> Make a program that asks for a number and prints its factorial
|
34
|
+
|
35
|
+
...
|
36
|
+
```
|
37
|
+
|
38
|
+
{% include help-tip.md %}
|
39
|
+
|
40
|
+
## Adding files
|
41
|
+
|
42
|
+
To edit files, you need to "add them to the chat".
|
43
|
+
Do this
|
44
|
+
by naming them on the aider command line.
|
45
|
+
Or, you can use the in-chat
|
46
|
+
`/add` command to add files.
|
47
|
+
|
48
|
+
|
49
|
+
Only add the files that need to be edited for your task.
|
50
|
+
Don't add a bunch of extra files.
|
51
|
+
If you add too many files, the LLM can get overwhelmed
|
52
|
+
and confused (and it costs more tokens).
|
53
|
+
Aider will automatically
|
54
|
+
pull in content from related files so that it can
|
55
|
+
[understand the rest of your code base](https://aider.chat/docs/repomap.html).
|
56
|
+
|
57
|
+
You can use aider without adding any files,
|
58
|
+
and it will try to figure out which files need to be edited based
|
59
|
+
on your requests.
|
60
|
+
|
61
|
+
{: .tip }
|
62
|
+
You'll get the best results if you think about which files need to be
|
63
|
+
edited. Add **just** those files to the chat. Aider will include
|
64
|
+
relevant context from the rest of your repo.
|
65
|
+
|
66
|
+
## LLMs
|
67
|
+
|
68
|
+
{% include works-best.md %}
|
69
|
+
|
70
|
+
```
|
71
|
+
# o3-mini
|
72
|
+
$ aider --model o3-mini --api-key openai=<key>
|
73
|
+
|
74
|
+
# Claude 3.7 Sonnet
|
75
|
+
$ aider --model sonnet --api-key anthropic=<key>
|
76
|
+
```
|
77
|
+
|
78
|
+
Or you can run `aider --model XXX` to launch aider with
|
79
|
+
another model.
|
80
|
+
During your chat you can switch models with the in-chat
|
81
|
+
`/model` command.
|
82
|
+
|
83
|
+
## Making changes
|
84
|
+
|
85
|
+
Ask aider to make changes to your code.
|
86
|
+
It will show you some diffs of the changes it is making to
|
87
|
+
complete you request.
|
88
|
+
[Aider will git commit all of its changes](/docs/git.html),
|
89
|
+
so they are easy to track and undo.
|
90
|
+
|
91
|
+
You can always use the `/undo` command to undo AI changes that you don't
|
92
|
+
like.
|