aider-ce 0.88.20__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 +34 -0
- aider/analytics.py +258 -0
- aider/args.py +1056 -0
- aider/args_formatter.py +228 -0
- aider/change_tracker.py +133 -0
- aider/coders/__init__.py +36 -0
- aider/coders/agent_coder.py +2166 -0
- aider/coders/agent_prompts.py +104 -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 +3613 -0
- aider/coders/base_prompts.py +87 -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 +175 -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 +9 -0
- aider/coders/editor_editblock_prompts.py +21 -0
- aider/coders/editor_whole_coder.py +9 -0
- aider/coders/editor_whole_prompts.py +12 -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 +159 -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 +65 -0
- aider/commands.py +2173 -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 +115 -0
- aider/format_settings.py +26 -0
- aider/gui.py +545 -0
- aider/help.py +163 -0
- aider/help_pats.py +19 -0
- aider/helpers/__init__.py +9 -0
- aider/helpers/similarity.py +98 -0
- aider/history.py +180 -0
- aider/io.py +1608 -0
- aider/linter.py +304 -0
- aider/llm.py +55 -0
- aider/main.py +1415 -0
- aider/mcp/__init__.py +174 -0
- aider/mcp/server.py +149 -0
- aider/mdstream.py +243 -0
- aider/models.py +1313 -0
- aider/onboarding.py +429 -0
- aider/openrouter.py +129 -0
- aider/prompts.py +56 -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/clojure-tags.scm +7 -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/matlab-tags.scm +10 -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 +24 -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/fortran-tags.scm +15 -0
- aider/queries/tree-sitter-languages/go-tags.scm +30 -0
- aider/queries/tree-sitter-languages/haskell-tags.scm +3 -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/julia-tags.scm +60 -0
- aider/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
- aider/queries/tree-sitter-languages/matlab-tags.scm +10 -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/queries/tree-sitter-languages/zig-tags.scm +3 -0
- aider/reasoning_tags.py +82 -0
- aider/repo.py +621 -0
- aider/repomap.py +1174 -0
- aider/report.py +260 -0
- aider/resources/__init__.py +3 -0
- aider/resources/model-metadata.json +776 -0
- aider/resources/model-settings.yml +2068 -0
- aider/run_cmd.py +133 -0
- aider/scrape.py +293 -0
- aider/sendchat.py +242 -0
- aider/sessions.py +256 -0
- aider/special.py +203 -0
- aider/tools/__init__.py +72 -0
- aider/tools/command.py +105 -0
- aider/tools/command_interactive.py +122 -0
- aider/tools/delete_block.py +182 -0
- aider/tools/delete_line.py +155 -0
- aider/tools/delete_lines.py +184 -0
- aider/tools/extract_lines.py +341 -0
- aider/tools/finished.py +48 -0
- aider/tools/git_branch.py +129 -0
- aider/tools/git_diff.py +60 -0
- aider/tools/git_log.py +57 -0
- aider/tools/git_remote.py +53 -0
- aider/tools/git_show.py +51 -0
- aider/tools/git_status.py +46 -0
- aider/tools/grep.py +256 -0
- aider/tools/indent_lines.py +221 -0
- aider/tools/insert_block.py +288 -0
- aider/tools/list_changes.py +86 -0
- aider/tools/ls.py +93 -0
- aider/tools/make_editable.py +85 -0
- aider/tools/make_readonly.py +69 -0
- aider/tools/remove.py +91 -0
- aider/tools/replace_all.py +126 -0
- aider/tools/replace_line.py +173 -0
- aider/tools/replace_lines.py +217 -0
- aider/tools/replace_text.py +187 -0
- aider/tools/show_numbered_context.py +147 -0
- aider/tools/tool_utils.py +313 -0
- aider/tools/undo_change.py +95 -0
- aider/tools/update_todo_list.py +156 -0
- aider/tools/view.py +57 -0
- aider/tools/view_files_matching.py +141 -0
- aider/tools/view_files_with_symbol.py +129 -0
- aider/urls.py +17 -0
- aider/utils.py +456 -0
- aider/versioncheck.py +113 -0
- aider/voice.py +205 -0
- aider/waiting.py +38 -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 +2261 -0
- aider/website/docs/config/agent-mode.md +194 -0
- aider/website/docs/config/aider_conf.md +548 -0
- aider/website/docs/config/api-keys.md +90 -0
- aider/website/docs/config/dotenv.md +493 -0
- aider/website/docs/config/editor.md +127 -0
- aider/website/docs/config/mcp.md +95 -0
- aider/website/docs/config/model-aliases.md +104 -0
- aider/website/docs/config/options.md +890 -0
- aider/website/docs/config/reasoning.md +210 -0
- aider/website/docs/config.md +44 -0
- aider/website/docs/faq.md +384 -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 +111 -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 +117 -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 +127 -0
- aider/website/docs/more/edit-formats.md +116 -0
- aider/website/docs/more/infinite-output.md +165 -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/sessions.md +203 -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 +133 -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 +102 -0
- aider/website/share/index.md +101 -0
- aider_ce-0.88.20.dist-info/METADATA +187 -0
- aider_ce-0.88.20.dist-info/RECORD +279 -0
- aider_ce-0.88.20.dist-info/WHEEL +5 -0
- aider_ce-0.88.20.dist-info/entry_points.txt +2 -0
- aider_ce-0.88.20.dist-info/licenses/LICENSE.txt +202 -0
- aider_ce-0.88.20.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
parent: Usage
|
|
3
|
+
nav_order: 800
|
|
4
|
+
description: Tell aider to follow your coding conventions when it works on your code.
|
|
5
|
+
---
|
|
6
|
+
# Specifying coding conventions
|
|
7
|
+
|
|
8
|
+
Sometimes you want GPT to be aware of certain coding guidelines,
|
|
9
|
+
like whether to provide type hints, which libraries or packages
|
|
10
|
+
to prefer, etc.
|
|
11
|
+
|
|
12
|
+
The easiest way to do that with aider is to simply create
|
|
13
|
+
a small markdown file and include it in the chat.
|
|
14
|
+
|
|
15
|
+
For example, say we want our python code to:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
- Prefer httpx over requests for making http requests.
|
|
19
|
+
- Use types everywhere possible.
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
We would simply create a file like `CONVENTIONS.md` with those lines
|
|
23
|
+
and then we can add it to the aider chat, along with the file(s)
|
|
24
|
+
that we want to edit.
|
|
25
|
+
|
|
26
|
+
It's best to load the conventions file with `/read CONVENTIONS.md`
|
|
27
|
+
or `aider --read CONVENTIONS.md`.
|
|
28
|
+
This way it is marked as read-only, and cached if prompt caching
|
|
29
|
+
is enabled.
|
|
30
|
+
|
|
31
|
+
## Community contributed conventions
|
|
32
|
+
|
|
33
|
+
You can check the [aider conventions repository](https://github.com/Aider-AI/conventions)
|
|
34
|
+
to find or contribute conventions files.
|
|
35
|
+
|
|
36
|
+
## Always load conventions
|
|
37
|
+
|
|
38
|
+
You can also configure aider to always load your conventions file
|
|
39
|
+
in the [`.aider.conf.yml` config file](https://aider.chat/docs/config/aider_conf.html):
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
# alone
|
|
44
|
+
read: CONVENTIONS.md
|
|
45
|
+
|
|
46
|
+
# multiple files
|
|
47
|
+
read: [CONVENTIONS.md, anotherfile.txt]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Example
|
|
52
|
+
|
|
53
|
+
See below for an example of how the conventions can affect the code
|
|
54
|
+
that aider writes.
|
|
55
|
+
|
|
56
|
+
<div class="chat-transcript" markdown="1">
|
|
57
|
+
> $ aider --read CONVENTIONS.md useragent.py
|
|
58
|
+
>
|
|
59
|
+
> Aider v0.24.2-dev
|
|
60
|
+
> Added CONVENTIONS.md to the chat.
|
|
61
|
+
> Added useragent.py to the chat.
|
|
62
|
+
|
|
63
|
+
#### write a function that uses httpbin to check the user agent on the request. return the ua.
|
|
64
|
+
|
|
65
|
+
To fulfill your request, I will:
|
|
66
|
+
|
|
67
|
+
1. Add an import for `httpx`.
|
|
68
|
+
2. Write a function named `check_user_agent` that makes a GET request to `httpbin.org/user-agent` and returns the user agent string.
|
|
69
|
+
|
|
70
|
+
Here is the diff for the `useragent.py` file:
|
|
71
|
+
|
|
72
|
+
```diff
|
|
73
|
+
--- useragent.py
|
|
74
|
+
+++ useragent.py
|
|
75
|
+
@@ ... @@
|
|
76
|
+
+import httpx
|
|
77
|
+
+
|
|
78
|
+
+def check_user_agent() -> str:
|
|
79
|
+
+ response = httpx.get('https://httpbin.org/user-agent')
|
|
80
|
+
+ return response.json()['user-agent']
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
This function uses `httpx` to make a GET request to `httpbin.org/user-agent`, which returns a JSON response containing the user agent of the HTTP client. The function then extracts the user agent string from the JSON response and returns it.
|
|
84
|
+
|
|
85
|
+
> Applied edit to useragent.py
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
GPT correctly used `httpx` and provided type hints.
|
|
89
|
+
See below for the transcript of this same
|
|
90
|
+
coding task conducted *without*
|
|
91
|
+
using `CONVENTIONS.md`.
|
|
92
|
+
In this case, GPT used `requests` and skipped types,
|
|
93
|
+
which is perhaps more typical in small python scripts.
|
|
94
|
+
|
|
95
|
+
<div class="chat-transcript" markdown="1">
|
|
96
|
+
> $ aider useragent.py
|
|
97
|
+
>
|
|
98
|
+
> Aider v0.24.2-dev
|
|
99
|
+
> Added useragent.py to the chat.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
#### write a function that uses httpbin to check the user agent on the request. return the ua.
|
|
103
|
+
|
|
104
|
+
```diff
|
|
105
|
+
--- /dev/null
|
|
106
|
+
+++ useragent.py
|
|
107
|
+
@@ ... @@
|
|
108
|
+
+import requests
|
|
109
|
+
+
|
|
110
|
+
+def check_user_agent():
|
|
111
|
+
+ response = requests.get('https://httpbin.org/user-agent')
|
|
112
|
+
+ user_agent = response.json().get('user-agent')
|
|
113
|
+
+ return user_agent
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
> Applied edit to useragent.py
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Copy/paste with web chat
|
|
3
|
+
#highlight_image: /assets/browser.jpg
|
|
4
|
+
parent: Usage
|
|
5
|
+
nav_order: 850
|
|
6
|
+
description: Aider works with LLM web chat UIs
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Copy/paste with web chat
|
|
10
|
+
|
|
11
|
+
<div class="video-container">
|
|
12
|
+
<video controls loop poster="/assets/copypaste.jpg">
|
|
13
|
+
<source src="/assets/copypaste.mp4" type="video/mp4">
|
|
14
|
+
<a href="/assets/copypaste.mp4">Aider browser UI demo video</a>
|
|
15
|
+
</video>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
.video-container {
|
|
20
|
+
position: relative;
|
|
21
|
+
padding-bottom: 66.34%; /* 2160 / 3256 = 0.6634 */
|
|
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
|
+
## Working with an LLM web chat
|
|
36
|
+
|
|
37
|
+
[Aider can connect to most LLMs via API](https://aider.chat/docs/llms.html) and works best that way.
|
|
38
|
+
But there are times when you may want to work with an LLM via its web chat interface:
|
|
39
|
+
|
|
40
|
+
- Workplace policies may limit your LLM usage to a proprietary web chat system.
|
|
41
|
+
- The web chat LLM may have access to unique context or may have been specially fine tuned for your task.
|
|
42
|
+
- It may be cost prohibitive to use some models via API.
|
|
43
|
+
- There may not be an API available.
|
|
44
|
+
|
|
45
|
+
Aider has features for working with an LLM via its web chat interface.
|
|
46
|
+
This allows you to use the web chat LLM as the "big brain code architect"
|
|
47
|
+
while running aider with a smaller, cheaper LLM to actually make changes
|
|
48
|
+
to your local files.
|
|
49
|
+
|
|
50
|
+
For this "file editor" part of the process
|
|
51
|
+
you can run aider with many open source, free or very inexpensive LLMs.
|
|
52
|
+
For example, the demo video above shows aider using DeepSeek to apply the changes
|
|
53
|
+
that o1-preview is suggesting in the web chat.
|
|
54
|
+
|
|
55
|
+
### Copy aider's code context to your clipboard, paste into the web UI
|
|
56
|
+
|
|
57
|
+
The `/copy-context <instructions>` command can be used in chat to copy aider's code context to your clipboard.
|
|
58
|
+
It will include:
|
|
59
|
+
|
|
60
|
+
- All the files which have been added to the chat via `/add`.
|
|
61
|
+
- Any read only files which have been added via `/read`.
|
|
62
|
+
- Aider's [repository map](https://aider.chat/docs/repomap.html) that brings in code context related to the above files from elsewhere in your git repo.
|
|
63
|
+
- Some instructions to the LLM that ask it to output change instructions concisely.
|
|
64
|
+
- If you include `<instructions>`, they will be copied too.
|
|
65
|
+
|
|
66
|
+
You can paste the context into your browser, and start interacting with the LLM web chat to
|
|
67
|
+
ask for code changes.
|
|
68
|
+
|
|
69
|
+
### Paste the LLM's reply back into aider to edit your files
|
|
70
|
+
|
|
71
|
+
Once the LLM has replied, you can use the "copy response" button in the web UI to copy
|
|
72
|
+
the LLM's response.
|
|
73
|
+
Back in aider, you can run `/paste` and aider will edit your files
|
|
74
|
+
to implement the changes suggested by the LLM.
|
|
75
|
+
|
|
76
|
+
You can use a cheap, efficient model like GPT-4o Mini, DeepSeek or Qwen to do these edits.
|
|
77
|
+
This works best if you run aider with `--edit-format editor-diff` or `--edit-format editor-whole`.
|
|
78
|
+
|
|
79
|
+
### Copy/paste mode
|
|
80
|
+
|
|
81
|
+
Aider has a `--copy-paste` mode that streamlines this entire process:
|
|
82
|
+
|
|
83
|
+
- Whenever you `/add` or `/read` files, aider will automatically copy the entire, updated
|
|
84
|
+
code context to your clipboard.
|
|
85
|
+
You'll see "Copied code context to clipboard" whenever this happens.
|
|
86
|
+
- When you copy the LLM reply to your clipboard outside aider, aider will automatically notice
|
|
87
|
+
and load it into the aider chat.
|
|
88
|
+
Just press ENTER to send the message
|
|
89
|
+
and aider will apply the LLMs changes to your local files.
|
|
90
|
+
- Aider will automatically select the best edit format for this copy/paste functionality.
|
|
91
|
+
Depending on the LLM you have aider use, it will be either `editor-whole` or `editor-diff`.
|
|
92
|
+
|
|
93
|
+
## Terms of service
|
|
94
|
+
|
|
95
|
+
Be sure to review the Terms Of Service of any LLM web chat service you use with
|
|
96
|
+
these features.
|
|
97
|
+
These features are not intended to be used in violation of any service's Terms Of Service (TOS).
|
|
98
|
+
|
|
99
|
+
Aider's web chat features have been designed to be compliant with the
|
|
100
|
+
terms of service of most LLM web chats.
|
|
101
|
+
|
|
102
|
+
There are 4 copy/paste steps involved when coding with an LLM web chat:
|
|
103
|
+
|
|
104
|
+
1. Copy code and context from aider.
|
|
105
|
+
2. Paste the code and context into the LLM web chat.
|
|
106
|
+
3. Copy the reply from the LLM web chat.
|
|
107
|
+
4. Paste the LLM reply into aider.
|
|
108
|
+
|
|
109
|
+
Most LLM web chat TOS prohibit automating steps (2) and (3) where code
|
|
110
|
+
is copied from and pasted into the web chat.
|
|
111
|
+
Aider's `--copy-paste` mode leaves those as 100% manual steps for the user to complete.
|
|
112
|
+
It simply streamlines steps (1) and (4) that are interactions with aider,
|
|
113
|
+
and which should not be under the scope of an LLM web chat TOS.
|
|
114
|
+
|
|
115
|
+
If you are concerned that
|
|
116
|
+
the automatic interactions with aider in steps (1) and (4) may be problematic with respect to
|
|
117
|
+
your LLM web chat provider's TOS, you can forego `--copy-paste` mode.
|
|
118
|
+
Instead, manually use the `/copy-context` and `/paste` commands if that
|
|
119
|
+
will keep you in compliance.
|
|
120
|
+
|
|
121
|
+
Again, do not use these features in violation of any service's Terms Of Service.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
parent: Usage
|
|
3
|
+
nav_order: 700
|
|
4
|
+
description: Add images and web pages to the aider coding chat.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Images & web pages
|
|
8
|
+
|
|
9
|
+
You can add images and URLs to the aider chat.
|
|
10
|
+
|
|
11
|
+
## Images
|
|
12
|
+
|
|
13
|
+
Aider supports working with image files for many vision-capable models
|
|
14
|
+
like GPT-4o and Claude 3.7 Sonnet.
|
|
15
|
+
Adding images to a chat can be helpful in many situations:
|
|
16
|
+
|
|
17
|
+
- Add screenshots of web pages or UIs that you want aider to build or modify.
|
|
18
|
+
- Show aider a mockup of a UI you want to build.
|
|
19
|
+
- Screenshot an error message that is otherwise hard to copy & paste as text.
|
|
20
|
+
- Etc.
|
|
21
|
+
|
|
22
|
+
You can add images to the chat just like you would
|
|
23
|
+
add any other file:
|
|
24
|
+
|
|
25
|
+
- Use `/add <image-filename>` from within the chat
|
|
26
|
+
- Use `/paste` to paste an image from your clipboard into the chat.
|
|
27
|
+
- Launch aider with image filenames on the command line: `aider <image-filename>` along with any other command line arguments you need.
|
|
28
|
+
|
|
29
|
+
## Web pages
|
|
30
|
+
|
|
31
|
+
Aider can scrape the text from URLs and add it to the chat.
|
|
32
|
+
This can be helpful to:
|
|
33
|
+
|
|
34
|
+
- Include documentation pages for less popular APIs.
|
|
35
|
+
- Include the latest docs for libraries or packages that are newer than the model's training cutoff date.
|
|
36
|
+
- Etc.
|
|
37
|
+
|
|
38
|
+
To add URLs to the chat:
|
|
39
|
+
|
|
40
|
+
- Use `/web <url>`
|
|
41
|
+
- Just paste the URL into the chat and aider will ask if you want to add it.
|
|
42
|
+
|
|
43
|
+
You can also scrape web pages from the command line to see the markdown version that aider produces:
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
python -m aider.scrape https://aider.chat/docs/usage/tips.html
|
|
48
|
+
```
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
parent: Usage
|
|
3
|
+
nav_order: 900
|
|
4
|
+
description: Automatically fix linting and testing errors.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Linting and testing
|
|
8
|
+
|
|
9
|
+
Aider can automatically lint and test your code
|
|
10
|
+
every time it makes changes.
|
|
11
|
+
This helps identify and repair any problems introduced
|
|
12
|
+
by the AI edits.
|
|
13
|
+
|
|
14
|
+
## Linting
|
|
15
|
+
|
|
16
|
+
Aider comes with built in linters for
|
|
17
|
+
[most popular languages](/docs/languages.html)
|
|
18
|
+
and will automatically lint code in these languages.
|
|
19
|
+
|
|
20
|
+
Or you can specify your favorite linter
|
|
21
|
+
with the `--lint-cmd <cmd>` switch.
|
|
22
|
+
The lint command should accept the filenames
|
|
23
|
+
of the files to lint.
|
|
24
|
+
If there are linting errors, aider expects the
|
|
25
|
+
command to print them on stdout/stderr
|
|
26
|
+
and return a non-zero exit code.
|
|
27
|
+
This is how most linters normally operate.
|
|
28
|
+
|
|
29
|
+
By default, aider will lint any files which it edits.
|
|
30
|
+
You can disable this with the `--no-auto-lint` switch.
|
|
31
|
+
|
|
32
|
+
### Per-language linters
|
|
33
|
+
|
|
34
|
+
To specify different linters based on the code language, use `--lint "language: cmd"`.
|
|
35
|
+
|
|
36
|
+
### Code formatting "linters"
|
|
37
|
+
|
|
38
|
+
Many people use code formatters as linters, to format and pretty their code.
|
|
39
|
+
These tools sometimes return non-zero exit codes if they make changes, which will
|
|
40
|
+
confuse aider into thinking there's an actual lint error that needs to be fixed.
|
|
41
|
+
|
|
42
|
+
You can use formatters by wrapping them in a shell script like this and setting
|
|
43
|
+
the script as your linter.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
#!/bin/bash
|
|
47
|
+
|
|
48
|
+
# Run it twice.
|
|
49
|
+
#
|
|
50
|
+
# First attempt may reformat/modify files, and therefore exit with non-zero status.
|
|
51
|
+
#
|
|
52
|
+
# Second attempt will not do anything and exit 0 unless there's a real problem beyond
|
|
53
|
+
# the code formatting that was completed.
|
|
54
|
+
|
|
55
|
+
pre-commit run --files "$@" >/dev/null \
|
|
56
|
+
|| pre-commit run --files "$@"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Testing
|
|
60
|
+
|
|
61
|
+
You can run tests with `/test <test-command>`.
|
|
62
|
+
Aider will run the test command without any arguments.
|
|
63
|
+
If there are test errors, aider expects the
|
|
64
|
+
command to print them on stdout/stderr
|
|
65
|
+
and return a non-zero exit code.
|
|
66
|
+
|
|
67
|
+
Aider will try and fix any errors
|
|
68
|
+
if the command returns a non-zero exit code.
|
|
69
|
+
|
|
70
|
+
You can configure aider to run your test suite
|
|
71
|
+
after each time the AI edits your code
|
|
72
|
+
using the `--test-cmd <test-command>` and
|
|
73
|
+
`--auto-test` switch.
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Compiled languages
|
|
78
|
+
|
|
79
|
+
If you want to have aider compile code after each edit, you
|
|
80
|
+
can use the lint and test commands to achieve this.
|
|
81
|
+
|
|
82
|
+
- You might want to recompile each file which was modified
|
|
83
|
+
to check for compile errors.
|
|
84
|
+
To do this,
|
|
85
|
+
provide a `--lint-cmd` which both lints and compiles the file.
|
|
86
|
+
You could create a small shell script for this.
|
|
87
|
+
- You might want to rebuild the entire project after files
|
|
88
|
+
are edited to check for build errors.
|
|
89
|
+
To do this,
|
|
90
|
+
provide a `--test-cmd` which both builds and tests the project.
|
|
91
|
+
You could create a small shell script for this.
|
|
92
|
+
Or you may be able to do something as simple as
|
|
93
|
+
`--test-cmd "dotnet build && dotnet test"`.
|
|
94
|
+
|
|
95
|
+
## Manually running code
|
|
96
|
+
|
|
97
|
+
You can use the `/run` command in the chat to run your code
|
|
98
|
+
and optionally share the output with aider.
|
|
99
|
+
This can be useful to share error messages or to show aider
|
|
100
|
+
the code's output before asking for changes or corrections.
|
|
101
|
+
|
|
102
|
+
<div class="chat-transcript" markdown="1">
|
|
103
|
+
> Aider v0.43.5-dev
|
|
104
|
+
|
|
105
|
+
#### /run python myscript.py
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
Traceback (most recent call last):
|
|
109
|
+
File "myscript.py", line 22, in \<module\
|
|
110
|
+
raise ValueError("something bad happened")
|
|
111
|
+
ValueError: something bad happened
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
> Add the output to the chat? y
|
|
115
|
+
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
parent: Usage
|
|
3
|
+
nav_order: 60
|
|
4
|
+
description: Using the code, architect, ask and help chat modes.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Chat modes
|
|
8
|
+
|
|
9
|
+
Aider has a few different chat modes:
|
|
10
|
+
|
|
11
|
+
- `code` - Aider will make changes to your code to satisfy your requests.
|
|
12
|
+
- `ask` - Aider will discuss your code and answer questions about it, but never make changes.
|
|
13
|
+
- `architect` - Like code mode, aider will change your files. An architect model will propose changes and an editor model will translate that proposal into specific file edits.
|
|
14
|
+
- `help` - Aider will answer questions about aider: usage, configuration, troubleshooting, etc.
|
|
15
|
+
|
|
16
|
+
By default, aider starts in "code" mode. As you are talking, you can
|
|
17
|
+
send individual messages in a specific mode using
|
|
18
|
+
`/code`, `/architect`, `/ask`, and `/help` commands:
|
|
19
|
+
Using these `/`-commands applies just to that particular message.
|
|
20
|
+
Your next message will go back to the active mode (usually "code" mode by default).
|
|
21
|
+
|
|
22
|
+
You can switch the active mode in a sticky way
|
|
23
|
+
with the `/chat-mode <mode>` command:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
/chat-mode code
|
|
27
|
+
/chat-mode architect
|
|
28
|
+
/chat-mode ask
|
|
29
|
+
/chat-mode help
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Or you can switch between coding modes using these commands without arguments:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
/code
|
|
36
|
+
/architect
|
|
37
|
+
/ask
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or you can launch aider in one of the modes with the `--chat-mode <mode>` switch.
|
|
41
|
+
There is also a special shortcut `--architect` to launch in `--chat-mode architect`.
|
|
42
|
+
|
|
43
|
+
The aider prompt will indicate the active mode:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
> This is code mode.
|
|
47
|
+
ask> This is ask mode.
|
|
48
|
+
architect> This is architect mode.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
## Ask/code workflow
|
|
53
|
+
|
|
54
|
+
A recommended workflow is to bounce back and forth between `/ask` and `/code` modes.
|
|
55
|
+
|
|
56
|
+
Use ask mode to discuss what you want to do, get suggestions or options from aider
|
|
57
|
+
and provide feedback on the approach.
|
|
58
|
+
Once aider understands the mission, switch to code mode to have it start editing
|
|
59
|
+
your files.
|
|
60
|
+
All the conversation and decision making from ask mode will
|
|
61
|
+
help ensure that the correct code changes are performed.
|
|
62
|
+
|
|
63
|
+
You can be very terse when you finally switch from ask to code mode.
|
|
64
|
+
Saying something as simple as "go ahead" in code mode will
|
|
65
|
+
have aider execute on the plan you've been discussing.
|
|
66
|
+
|
|
67
|
+
Here's an example with two ask mode messages to agree on the plan,
|
|
68
|
+
followed by two terse code mode messages to edit the code.
|
|
69
|
+
|
|
70
|
+
````
|
|
71
|
+
─────────────────────────────────────────────────────────────────────────────────────
|
|
72
|
+
Aider v0.79.0
|
|
73
|
+
Model: gemini/gemini-2.5-pro-exp-03-25 with diff-fenced edit format
|
|
74
|
+
|
|
75
|
+
> /ask What's the best thing to print if we're making a quick little demo program?
|
|
76
|
+
|
|
77
|
+
It sounds like you'd like to write a "Hello, world!" program. That's a very
|
|
78
|
+
popular phrase to use for small demo programs.
|
|
79
|
+
|
|
80
|
+
> /ask Yes, that's the idea. What are some more creative options?
|
|
81
|
+
|
|
82
|
+
1. "Greetings, Earthlings!"
|
|
83
|
+
2. "Beep boop, I am a computer!"
|
|
84
|
+
3. "To code, or not to code, that is the question."
|
|
85
|
+
4. "I think, therefore I print."
|
|
86
|
+
5. "01001000 01101001!" (Binary for "Hi!")
|
|
87
|
+
|
|
88
|
+
> do 4
|
|
89
|
+
|
|
90
|
+
hello.py
|
|
91
|
+
>>>>>>> SEARCH
|
|
92
|
+
=======
|
|
93
|
+
def main():
|
|
94
|
+
print("I think, therefore I print.")
|
|
95
|
+
<<<<<<< REPLACE
|
|
96
|
+
|
|
97
|
+
> ALL CAPS!
|
|
98
|
+
|
|
99
|
+
hello.py
|
|
100
|
+
>>>>>>> SEARCH
|
|
101
|
+
print("I think, therefore I print.")
|
|
102
|
+
=======
|
|
103
|
+
print("I THINK, THEREFORE I PRINT!")
|
|
104
|
+
<<<<<<< REPLACE
|
|
105
|
+
|
|
106
|
+
````
|
|
107
|
+
|
|
108
|
+
You can think of this ask/code workflow as a more fluid version of
|
|
109
|
+
architect mode, but working just with one model the whole time.
|
|
110
|
+
|
|
111
|
+
## Architect mode and the editor model
|
|
112
|
+
|
|
113
|
+
When you are in architect mode, aider sends your requests to two models:
|
|
114
|
+
|
|
115
|
+
1. First, it sends your request to the main model which will act as an architect
|
|
116
|
+
to propose how to solve your coding request.
|
|
117
|
+
The main model is configured with `/model` or `--model`.
|
|
118
|
+
|
|
119
|
+
2. Aider then sends another request to an "editor model",
|
|
120
|
+
asking it to turn the architect's proposal into specific file editing instructions.
|
|
121
|
+
Aider has built in defaults to select an editor model based on your main model.
|
|
122
|
+
Or, you can choose a specific editor model with `--editor-model <model>`.
|
|
123
|
+
|
|
124
|
+
Certain LLMs aren't able to propose coding solutions *and*
|
|
125
|
+
specify detailed file edits all in one go.
|
|
126
|
+
For these models, architect mode can produce better results than code mode
|
|
127
|
+
by pairing them
|
|
128
|
+
with an editor model that is responsible for generating the file editing instructions.
|
|
129
|
+
But this uses two LLM requests,
|
|
130
|
+
which can take longer and increase costs.
|
|
131
|
+
|
|
132
|
+
Architect mode is especially useful with OpenAI's o1 models, which are strong at
|
|
133
|
+
reasoning but less capable at editing files.
|
|
134
|
+
Pairing an o1 architect with an editor model like GPT-4o or Sonnet will
|
|
135
|
+
give the best results.
|
|
136
|
+
|
|
137
|
+
But architect mode can also be helpful when you use the same model
|
|
138
|
+
as both the architect and the editor.
|
|
139
|
+
Allowing the model two requests to solve the problem and edit the files
|
|
140
|
+
can sometimes provide better results.
|
|
141
|
+
|
|
142
|
+
The editor model uses one of aider's edit formats to let the LLM
|
|
143
|
+
edit source files.
|
|
144
|
+
Aider will pick a suitable edit format by default,
|
|
145
|
+
but you can customize it with `--editor-edit-format <format>`.
|
|
146
|
+
The
|
|
147
|
+
["editor-diff" and "editor-whole" edit formats](/docs/more/edit-formats.html#editor-diff-and-editor-whole)
|
|
148
|
+
are the recommended edit formats when using architect mode.
|
|
149
|
+
See this article on
|
|
150
|
+
[aider's architect/editor mode](/2024/09/26/architect.html)
|
|
151
|
+
for more details.
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
## Examples
|
|
155
|
+
|
|
156
|
+
<div class="chat-transcript" markdown="1">
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
> Aider v0.47.1-dev
|
|
160
|
+
> Models: claude-3-5-sonnet-20240620 with diff edit format
|
|
161
|
+
> Git repo: .git with 298 files
|
|
162
|
+
> Repo-map: using 1024 tokens
|
|
163
|
+
> Use /help to see in-chat commands, run with --help to see cmd line args
|
|
164
|
+
|
|
165
|
+
#### /ask What is this repo?
|
|
166
|
+
|
|
167
|
+
This is collection of python functions that compute various math functions.
|
|
168
|
+
|
|
169
|
+
#### /help How do I use aider with ollama?
|
|
170
|
+
|
|
171
|
+
Run `aider --model ollama/<ollama-model>`.
|
|
172
|
+
See these docs for more info: https://aider.chat/docs/llms/ollama.html
|
|
173
|
+
|
|
174
|
+
#### /code Add a function to calculate the factorial of a number
|
|
175
|
+
|
|
176
|
+
Certainly! I'll add a function to calculate the factorial of a number. Here's the change:
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
def factorial(n):
|
|
180
|
+
if n == 0 or n == 1:
|
|
181
|
+
return 1
|
|
182
|
+
else:
|
|
183
|
+
return n * factorial(n - 1)
|
|
184
|
+
|
|
185
|
+
# Example usage
|
|
186
|
+
print(factorial(5)) # Output: 120
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
This function uses recursion to calculate the factorial. It's been added to your code.
|
|
190
|
+
|
|
191
|
+
#### /architect Can we make this simpler?
|
|
192
|
+
|
|
193
|
+
Yes, you could replace the `factorial()` function with a call to the `math.factorial()`
|
|
194
|
+
builtin.
|
|
195
|
+
This way you don't have to maintain a custom factorial implementation,
|
|
196
|
+
and the builtin function is well optimized.
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
<<<<<<< SEARCH
|
|
200
|
+
def factorial(n):
|
|
201
|
+
if n == 0 or n == 1:
|
|
202
|
+
return 1
|
|
203
|
+
else:
|
|
204
|
+
return n * factorial(n - 1)
|
|
205
|
+
=======
|
|
206
|
+
from math import factorial
|
|
207
|
+
>>>>>>> REPLACE
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
</div>
|
|
211
|
+
|