cecli-dev 0.93.1__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.
- cecli/__init__.py +20 -0
- cecli/__main__.py +4 -0
- cecli/_version.py +34 -0
- cecli/args.py +1092 -0
- cecli/args_formatter.py +228 -0
- cecli/change_tracker.py +133 -0
- cecli/coders/__init__.py +38 -0
- cecli/coders/agent_coder.py +1872 -0
- cecli/coders/architect_coder.py +63 -0
- cecli/coders/ask_coder.py +8 -0
- cecli/coders/base_coder.py +3993 -0
- cecli/coders/chat_chunks.py +116 -0
- cecli/coders/context_coder.py +52 -0
- cecli/coders/copypaste_coder.py +269 -0
- cecli/coders/editblock_coder.py +656 -0
- cecli/coders/editblock_fenced_coder.py +9 -0
- cecli/coders/editblock_func_coder.py +140 -0
- cecli/coders/editor_diff_fenced_coder.py +8 -0
- cecli/coders/editor_editblock_coder.py +8 -0
- cecli/coders/editor_whole_coder.py +8 -0
- cecli/coders/help_coder.py +15 -0
- cecli/coders/patch_coder.py +705 -0
- cecli/coders/search_replace.py +757 -0
- cecli/coders/shell.py +37 -0
- cecli/coders/single_wholefile_func_coder.py +101 -0
- cecli/coders/udiff_coder.py +428 -0
- cecli/coders/udiff_simple.py +12 -0
- cecli/coders/wholefile_coder.py +143 -0
- cecli/coders/wholefile_func_coder.py +133 -0
- cecli/commands/__init__.py +192 -0
- cecli/commands/add.py +226 -0
- cecli/commands/agent.py +51 -0
- cecli/commands/architect.py +46 -0
- cecli/commands/ask.py +44 -0
- cecli/commands/chat_mode.py +0 -0
- cecli/commands/clear.py +37 -0
- cecli/commands/code.py +46 -0
- cecli/commands/command_prefix.py +44 -0
- cecli/commands/commit.py +52 -0
- cecli/commands/context.py +47 -0
- cecli/commands/context_blocks.py +124 -0
- cecli/commands/context_management.py +51 -0
- cecli/commands/copy.py +62 -0
- cecli/commands/copy_context.py +81 -0
- cecli/commands/core.py +287 -0
- cecli/commands/diff.py +68 -0
- cecli/commands/drop.py +217 -0
- cecli/commands/editor.py +78 -0
- cecli/commands/exit.py +55 -0
- cecli/commands/git.py +57 -0
- cecli/commands/help.py +140 -0
- cecli/commands/history_search.py +40 -0
- cecli/commands/lint.py +109 -0
- cecli/commands/list_sessions.py +56 -0
- cecli/commands/load.py +85 -0
- cecli/commands/load_session.py +48 -0
- cecli/commands/load_skill.py +68 -0
- cecli/commands/ls.py +75 -0
- cecli/commands/map.py +37 -0
- cecli/commands/map_refresh.py +35 -0
- cecli/commands/model.py +118 -0
- cecli/commands/models.py +41 -0
- cecli/commands/multiline_mode.py +38 -0
- cecli/commands/paste.py +91 -0
- cecli/commands/quit.py +32 -0
- cecli/commands/read_only.py +267 -0
- cecli/commands/read_only_stub.py +270 -0
- cecli/commands/reasoning_effort.py +70 -0
- cecli/commands/remove_skill.py +68 -0
- cecli/commands/report.py +40 -0
- cecli/commands/reset.py +88 -0
- cecli/commands/run.py +99 -0
- cecli/commands/save.py +49 -0
- cecli/commands/save_session.py +43 -0
- cecli/commands/settings.py +69 -0
- cecli/commands/test.py +58 -0
- cecli/commands/think_tokens.py +74 -0
- cecli/commands/tokens.py +207 -0
- cecli/commands/undo.py +145 -0
- cecli/commands/utils/__init__.py +0 -0
- cecli/commands/utils/base_command.py +131 -0
- cecli/commands/utils/helpers.py +142 -0
- cecli/commands/utils/registry.py +53 -0
- cecli/commands/utils/save_load_manager.py +98 -0
- cecli/commands/voice.py +78 -0
- cecli/commands/weak_model.py +123 -0
- cecli/commands/web.py +87 -0
- cecli/deprecated_args.py +185 -0
- cecli/diffs.py +129 -0
- cecli/dump.py +29 -0
- cecli/editor.py +147 -0
- cecli/exceptions.py +115 -0
- cecli/format_settings.py +26 -0
- cecli/help.py +119 -0
- cecli/help_pats.py +19 -0
- cecli/helpers/__init__.py +9 -0
- cecli/helpers/copypaste.py +123 -0
- cecli/helpers/coroutines.py +8 -0
- cecli/helpers/file_searcher.py +142 -0
- cecli/helpers/model_providers.py +552 -0
- cecli/helpers/plugin_manager.py +81 -0
- cecli/helpers/profiler.py +162 -0
- cecli/helpers/requests.py +77 -0
- cecli/helpers/similarity.py +98 -0
- cecli/helpers/skills.py +577 -0
- cecli/history.py +186 -0
- cecli/io.py +1782 -0
- cecli/linter.py +304 -0
- cecli/llm.py +101 -0
- cecli/main.py +1280 -0
- cecli/mcp/__init__.py +154 -0
- cecli/mcp/oauth.py +250 -0
- cecli/mcp/server.py +278 -0
- cecli/mdstream.py +243 -0
- cecli/models.py +1255 -0
- cecli/onboarding.py +301 -0
- cecli/prompts/__init__.py +0 -0
- cecli/prompts/agent.yml +71 -0
- cecli/prompts/architect.yml +35 -0
- cecli/prompts/ask.yml +31 -0
- cecli/prompts/base.yml +99 -0
- cecli/prompts/context.yml +60 -0
- cecli/prompts/copypaste.yml +5 -0
- cecli/prompts/editblock.yml +143 -0
- cecli/prompts/editblock_fenced.yml +106 -0
- cecli/prompts/editblock_func.yml +25 -0
- cecli/prompts/editor_diff_fenced.yml +115 -0
- cecli/prompts/editor_editblock.yml +121 -0
- cecli/prompts/editor_whole.yml +46 -0
- cecli/prompts/help.yml +37 -0
- cecli/prompts/patch.yml +110 -0
- cecli/prompts/single_wholefile_func.yml +24 -0
- cecli/prompts/udiff.yml +106 -0
- cecli/prompts/udiff_simple.yml +13 -0
- cecli/prompts/utils/__init__.py +0 -0
- cecli/prompts/utils/prompt_registry.py +167 -0
- cecli/prompts/utils/system.py +56 -0
- cecli/prompts/wholefile.yml +50 -0
- cecli/prompts/wholefile_func.yml +24 -0
- cecli/queries/tree-sitter-language-pack/README.md +7 -0
- cecli/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
- cecli/queries/tree-sitter-language-pack/c-tags.scm +12 -0
- cecli/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
- cecli/queries/tree-sitter-language-pack/clojure-tags.scm +12 -0
- cecli/queries/tree-sitter-language-pack/commonlisp-tags.scm +127 -0
- cecli/queries/tree-sitter-language-pack/cpp-tags.scm +18 -0
- cecli/queries/tree-sitter-language-pack/csharp-tags.scm +32 -0
- cecli/queries/tree-sitter-language-pack/d-tags.scm +26 -0
- cecli/queries/tree-sitter-language-pack/dart-tags.scm +97 -0
- cecli/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
- cecli/queries/tree-sitter-language-pack/elixir-tags.scm +59 -0
- cecli/queries/tree-sitter-language-pack/elm-tags.scm +22 -0
- cecli/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
- cecli/queries/tree-sitter-language-pack/go-tags.scm +49 -0
- cecli/queries/tree-sitter-language-pack/java-tags.scm +26 -0
- cecli/queries/tree-sitter-language-pack/javascript-tags.scm +96 -0
- cecli/queries/tree-sitter-language-pack/lua-tags.scm +39 -0
- cecli/queries/tree-sitter-language-pack/matlab-tags.scm +10 -0
- cecli/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
- cecli/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +101 -0
- cecli/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
- cecli/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
- cecli/queries/tree-sitter-language-pack/python-tags.scm +24 -0
- cecli/queries/tree-sitter-language-pack/r-tags.scm +27 -0
- cecli/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
- cecli/queries/tree-sitter-language-pack/ruby-tags.scm +69 -0
- cecli/queries/tree-sitter-language-pack/rust-tags.scm +63 -0
- cecli/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
- cecli/queries/tree-sitter-language-pack/swift-tags.scm +54 -0
- cecli/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
- cecli/queries/tree-sitter-languages/README.md +24 -0
- cecli/queries/tree-sitter-languages/c-tags.scm +12 -0
- cecli/queries/tree-sitter-languages/c_sharp-tags.scm +52 -0
- cecli/queries/tree-sitter-languages/cpp-tags.scm +18 -0
- cecli/queries/tree-sitter-languages/dart-tags.scm +92 -0
- cecli/queries/tree-sitter-languages/elisp-tags.scm +8 -0
- cecli/queries/tree-sitter-languages/elixir-tags.scm +59 -0
- cecli/queries/tree-sitter-languages/elm-tags.scm +22 -0
- cecli/queries/tree-sitter-languages/fortran-tags.scm +18 -0
- cecli/queries/tree-sitter-languages/go-tags.scm +36 -0
- cecli/queries/tree-sitter-languages/haskell-tags.scm +5 -0
- cecli/queries/tree-sitter-languages/hcl-tags.scm +77 -0
- cecli/queries/tree-sitter-languages/java-tags.scm +26 -0
- cecli/queries/tree-sitter-languages/javascript-tags.scm +96 -0
- cecli/queries/tree-sitter-languages/julia-tags.scm +60 -0
- cecli/queries/tree-sitter-languages/kotlin-tags.scm +30 -0
- cecli/queries/tree-sitter-languages/matlab-tags.scm +10 -0
- cecli/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
- cecli/queries/tree-sitter-languages/ocaml_interface-tags.scm +104 -0
- cecli/queries/tree-sitter-languages/php-tags.scm +32 -0
- cecli/queries/tree-sitter-languages/python-tags.scm +22 -0
- cecli/queries/tree-sitter-languages/ql-tags.scm +26 -0
- cecli/queries/tree-sitter-languages/ruby-tags.scm +69 -0
- cecli/queries/tree-sitter-languages/rust-tags.scm +63 -0
- cecli/queries/tree-sitter-languages/scala-tags.scm +64 -0
- cecli/queries/tree-sitter-languages/typescript-tags.scm +44 -0
- cecli/queries/tree-sitter-languages/zig-tags.scm +20 -0
- cecli/reasoning_tags.py +82 -0
- cecli/repo.py +626 -0
- cecli/repomap.py +1368 -0
- cecli/report.py +260 -0
- cecli/resources/__init__.py +3 -0
- cecli/resources/model-metadata.json +25751 -0
- cecli/resources/model-settings.yml +2394 -0
- cecli/resources/providers.json +67 -0
- cecli/run_cmd.py +143 -0
- cecli/scrape.py +295 -0
- cecli/sendchat.py +250 -0
- cecli/sessions.py +281 -0
- cecli/special.py +203 -0
- cecli/tools/__init__.py +72 -0
- cecli/tools/command.py +103 -0
- cecli/tools/command_interactive.py +113 -0
- cecli/tools/context_manager.py +175 -0
- cecli/tools/delete_block.py +154 -0
- cecli/tools/delete_line.py +120 -0
- cecli/tools/delete_lines.py +144 -0
- cecli/tools/extract_lines.py +281 -0
- cecli/tools/finished.py +35 -0
- cecli/tools/git_branch.py +132 -0
- cecli/tools/git_diff.py +49 -0
- cecli/tools/git_log.py +43 -0
- cecli/tools/git_remote.py +39 -0
- cecli/tools/git_show.py +37 -0
- cecli/tools/git_status.py +32 -0
- cecli/tools/grep.py +242 -0
- cecli/tools/indent_lines.py +195 -0
- cecli/tools/insert_block.py +263 -0
- cecli/tools/list_changes.py +71 -0
- cecli/tools/load_skill.py +51 -0
- cecli/tools/ls.py +77 -0
- cecli/tools/remove_skill.py +51 -0
- cecli/tools/replace_all.py +113 -0
- cecli/tools/replace_line.py +135 -0
- cecli/tools/replace_lines.py +180 -0
- cecli/tools/replace_text.py +186 -0
- cecli/tools/show_numbered_context.py +137 -0
- cecli/tools/thinking.py +52 -0
- cecli/tools/undo_change.py +82 -0
- cecli/tools/update_todo_list.py +148 -0
- cecli/tools/utils/base_tool.py +64 -0
- cecli/tools/utils/helpers.py +359 -0
- cecli/tools/utils/output.py +119 -0
- cecli/tools/utils/registry.py +145 -0
- cecli/tools/view_files_matching.py +138 -0
- cecli/tools/view_files_with_symbol.py +117 -0
- cecli/tui/__init__.py +83 -0
- cecli/tui/app.py +971 -0
- cecli/tui/io.py +566 -0
- cecli/tui/styles.tcss +117 -0
- cecli/tui/widgets/__init__.py +19 -0
- cecli/tui/widgets/completion_bar.py +331 -0
- cecli/tui/widgets/file_list.py +76 -0
- cecli/tui/widgets/footer.py +165 -0
- cecli/tui/widgets/input_area.py +320 -0
- cecli/tui/widgets/key_hints.py +16 -0
- cecli/tui/widgets/output.py +354 -0
- cecli/tui/widgets/status_bar.py +279 -0
- cecli/tui/worker.py +160 -0
- cecli/urls.py +16 -0
- cecli/utils.py +499 -0
- cecli/versioncheck.py +90 -0
- cecli/voice.py +90 -0
- cecli/waiting.py +38 -0
- cecli/watch.py +316 -0
- cecli/watch_prompts.py +12 -0
- cecli/website/Gemfile +8 -0
- cecli/website/_includes/blame.md +162 -0
- cecli/website/_includes/get-started.md +22 -0
- cecli/website/_includes/help-tip.md +5 -0
- cecli/website/_includes/help.md +24 -0
- cecli/website/_includes/install.md +5 -0
- cecli/website/_includes/keys.md +4 -0
- cecli/website/_includes/model-warnings.md +67 -0
- cecli/website/_includes/multi-line.md +22 -0
- cecli/website/_includes/python-m-aider.md +5 -0
- cecli/website/_includes/recording.css +228 -0
- cecli/website/_includes/recording.md +34 -0
- cecli/website/_includes/replit-pipx.md +9 -0
- cecli/website/_includes/works-best.md +1 -0
- cecli/website/_sass/custom/custom.scss +103 -0
- cecli/website/docs/config/adv-model-settings.md +2498 -0
- cecli/website/docs/config/agent-mode.md +320 -0
- cecli/website/docs/config/aider_conf.md +548 -0
- cecli/website/docs/config/api-keys.md +90 -0
- cecli/website/docs/config/custom-commands.md +187 -0
- cecli/website/docs/config/dotenv.md +493 -0
- cecli/website/docs/config/editor.md +127 -0
- cecli/website/docs/config/mcp.md +210 -0
- cecli/website/docs/config/model-aliases.md +173 -0
- cecli/website/docs/config/options.md +890 -0
- cecli/website/docs/config/reasoning.md +210 -0
- cecli/website/docs/config/skills.md +172 -0
- cecli/website/docs/config/tui.md +126 -0
- cecli/website/docs/config.md +44 -0
- cecli/website/docs/faq.md +379 -0
- cecli/website/docs/git.md +76 -0
- cecli/website/docs/index.md +47 -0
- cecli/website/docs/install/codespaces.md +39 -0
- cecli/website/docs/install/docker.md +48 -0
- cecli/website/docs/install/optional.md +100 -0
- cecli/website/docs/install/replit.md +8 -0
- cecli/website/docs/install.md +115 -0
- cecli/website/docs/languages.md +264 -0
- cecli/website/docs/legal/contributor-agreement.md +111 -0
- cecli/website/docs/legal/privacy.md +104 -0
- cecli/website/docs/llms/anthropic.md +77 -0
- cecli/website/docs/llms/azure.md +48 -0
- cecli/website/docs/llms/bedrock.md +132 -0
- cecli/website/docs/llms/cohere.md +34 -0
- cecli/website/docs/llms/deepseek.md +32 -0
- cecli/website/docs/llms/gemini.md +49 -0
- cecli/website/docs/llms/github.md +111 -0
- cecli/website/docs/llms/groq.md +36 -0
- cecli/website/docs/llms/lm-studio.md +39 -0
- cecli/website/docs/llms/ollama.md +75 -0
- cecli/website/docs/llms/openai-compat.md +39 -0
- cecli/website/docs/llms/openai.md +58 -0
- cecli/website/docs/llms/openrouter.md +78 -0
- cecli/website/docs/llms/other.md +117 -0
- cecli/website/docs/llms/vertex.md +50 -0
- cecli/website/docs/llms/warnings.md +10 -0
- cecli/website/docs/llms/xai.md +53 -0
- cecli/website/docs/llms.md +54 -0
- cecli/website/docs/more/analytics.md +127 -0
- cecli/website/docs/more/edit-formats.md +116 -0
- cecli/website/docs/more/infinite-output.md +192 -0
- cecli/website/docs/more-info.md +8 -0
- cecli/website/docs/recordings/auto-accept-architect.md +31 -0
- cecli/website/docs/recordings/dont-drop-original-read-files.md +35 -0
- cecli/website/docs/recordings/index.md +21 -0
- cecli/website/docs/recordings/model-accepts-settings.md +69 -0
- cecli/website/docs/recordings/tree-sitter-language-pack.md +80 -0
- cecli/website/docs/repomap.md +112 -0
- cecli/website/docs/scripting.md +100 -0
- cecli/website/docs/sessions.md +213 -0
- cecli/website/docs/troubleshooting/aider-not-found.md +24 -0
- cecli/website/docs/troubleshooting/edit-errors.md +76 -0
- cecli/website/docs/troubleshooting/imports.md +62 -0
- cecli/website/docs/troubleshooting/models-and-keys.md +54 -0
- cecli/website/docs/troubleshooting/support.md +79 -0
- cecli/website/docs/troubleshooting/token-limits.md +96 -0
- cecli/website/docs/troubleshooting/warnings.md +12 -0
- cecli/website/docs/troubleshooting.md +11 -0
- cecli/website/docs/usage/browser.md +57 -0
- cecli/website/docs/usage/caching.md +49 -0
- cecli/website/docs/usage/commands.md +133 -0
- cecli/website/docs/usage/conventions.md +119 -0
- cecli/website/docs/usage/copypaste.md +136 -0
- cecli/website/docs/usage/images-urls.md +48 -0
- cecli/website/docs/usage/lint-test.md +118 -0
- cecli/website/docs/usage/modes.md +211 -0
- cecli/website/docs/usage/not-code.md +179 -0
- cecli/website/docs/usage/notifications.md +87 -0
- cecli/website/docs/usage/tips.md +79 -0
- cecli/website/docs/usage/tutorials.md +30 -0
- cecli/website/docs/usage/voice.md +121 -0
- cecli/website/docs/usage/watch.md +294 -0
- cecli/website/docs/usage.md +102 -0
- cecli/website/share/index.md +101 -0
- cecli_dev-0.93.1.dist-info/METADATA +549 -0
- cecli_dev-0.93.1.dist-info/RECORD +366 -0
- cecli_dev-0.93.1.dist-info/WHEEL +5 -0
- cecli_dev-0.93.1.dist-info/entry_points.txt +4 -0
- cecli_dev-0.93.1.dist-info/licenses/LICENSE.txt +202 -0
- cecli_dev-0.93.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Prompt caching
|
|
3
|
+
highlight_image: /assets/prompt-caching.jpg
|
|
4
|
+
parent: Usage
|
|
5
|
+
nav_order: 750
|
|
6
|
+
description: Aider supports prompt caching for cost savings and faster coding.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Prompt caching
|
|
10
|
+
|
|
11
|
+
Aider supports prompt caching for cost savings and faster coding.
|
|
12
|
+
Currently Anthropic provides caching for Sonnet and Haiku,
|
|
13
|
+
and DeepSeek provides caching for Chat.
|
|
14
|
+
|
|
15
|
+
Aider organizes the chat history to try and cache:
|
|
16
|
+
|
|
17
|
+
- The system prompt.
|
|
18
|
+
- Read only files added with `--read` or `/read-only`.
|
|
19
|
+
- The repository map.
|
|
20
|
+
- The editable files that have been added to the chat.
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Run aider with `--cache-prompts` or add that setting to your
|
|
28
|
+
[configuration files](/docs/config.html).
|
|
29
|
+
|
|
30
|
+
Due to limitations in the provider APIs, caching statistics and costs
|
|
31
|
+
are not available when streaming responses.
|
|
32
|
+
To turn off streaming, use `--no-stream`.
|
|
33
|
+
|
|
34
|
+
When caching is enabled, it will be noted for the main model when aider launches:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Main model: claude-3-5-sonnet-20240620 with diff edit format, prompt cache, infinite output
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Preventing cache expiration
|
|
41
|
+
|
|
42
|
+
Aider can ping the provider to keep your prompt cache warm and prevent
|
|
43
|
+
it from expiring.
|
|
44
|
+
By default, Anthropic keeps your cache for 5 minutes.
|
|
45
|
+
Use `--cache-keepalive-pings N` to tell aider to ping
|
|
46
|
+
every 5 minutes to keep the cache warm.
|
|
47
|
+
Aider will ping up to `N` times over a period of `N*5` minutes
|
|
48
|
+
after each message you send.
|
|
49
|
+
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
parent: Usage
|
|
3
|
+
nav_order: 50
|
|
4
|
+
description: Control aider with in-chat commands like /add, /model, etc.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# In-chat commands
|
|
8
|
+
{: .no_toc }
|
|
9
|
+
|
|
10
|
+
- TOC
|
|
11
|
+
{:toc}
|
|
12
|
+
|
|
13
|
+
## Slash commands
|
|
14
|
+
|
|
15
|
+
Aider supports commands from within the chat, which all start with `/`.
|
|
16
|
+
|
|
17
|
+
<!--[[[cog
|
|
18
|
+
from aider.commands import get_help_md
|
|
19
|
+
cog.out(get_help_md())
|
|
20
|
+
]]]-->
|
|
21
|
+
|
|
22
|
+
|Command|Description|
|
|
23
|
+
|:------|:----------|
|
|
24
|
+
| **/add** | Add files to the chat so aider can edit them or review them in detail |
|
|
25
|
+
| **/architect** | Enter architect/editor mode using 2 different models. If no prompt provided, switches to architect/editor mode. |
|
|
26
|
+
| **/ask** | Ask questions about the code base without editing any files. If no prompt provided, switches to ask mode. |
|
|
27
|
+
| **/chat-mode** | Switch to a new chat mode |
|
|
28
|
+
| **/clear** | Clear the chat history |
|
|
29
|
+
| **/code** | Ask for changes to your code. If no prompt provided, switches to code mode. |
|
|
30
|
+
| **/commit** | Commit edits to the repo made outside the chat (commit message optional) |
|
|
31
|
+
| **/context** | Enter context mode to see surrounding code context. If no prompt provided, switches to context mode. |
|
|
32
|
+
| **/copy** | Copy the last assistant message to the clipboard |
|
|
33
|
+
| **/copy-context** | Copy the current chat context as markdown, suitable to paste into a web UI |
|
|
34
|
+
| **/diff** | Display the diff of changes since the last message |
|
|
35
|
+
| **/drop** | Remove files from the chat session to free up context space |
|
|
36
|
+
| **/edit** | Alias for /editor: Open an editor to write a prompt |
|
|
37
|
+
| **/editor** | Open an editor to write a prompt |
|
|
38
|
+
| **/editor-model** | Switch the Editor Model to a new LLM |
|
|
39
|
+
| **/exit** | Exit the application |
|
|
40
|
+
| **/git** | Run a git command (output excluded from chat) |
|
|
41
|
+
| **/help** | Ask questions about aider |
|
|
42
|
+
| **/history-search** | Fuzzy search your command history and paste the selected command into the chat. |
|
|
43
|
+
| **/lint** | Lint and fix in-chat files or all dirty files if none in chat |
|
|
44
|
+
| **/load** | Load and execute commands from a file |
|
|
45
|
+
| **/ls** | List all known files and indicate which are included in the chat session |
|
|
46
|
+
| **/map** | Print out the current repository map |
|
|
47
|
+
| **/map-refresh** | Force a refresh of the repository map |
|
|
48
|
+
| **/model** | Switch the Main Model to a new LLM |
|
|
49
|
+
| **/models** | Search the list of available models |
|
|
50
|
+
| **/multiline-mode** | Toggle multiline mode (swaps behavior of Enter and Meta+Enter) |
|
|
51
|
+
| **/paste** | Paste image/text from the clipboard into the chat. Optionally provide a name for the image. |
|
|
52
|
+
| **/quit** | Exit the application |
|
|
53
|
+
| **/read-only** | Add files to the chat that are for reference only, or turn added files to read-only |
|
|
54
|
+
| **/reasoning-effort** | Set the reasoning effort level (values: number or low/medium/high depending on model) |
|
|
55
|
+
| **/report** | Report a problem by opening a GitHub Issue |
|
|
56
|
+
| **/reset** | Drop all files and clear the chat history |
|
|
57
|
+
| **/run** | Run a shell command and optionally add the output to the chat (alias: !) |
|
|
58
|
+
| **/save** | Save commands to a file that can reconstruct the current chat session's files |
|
|
59
|
+
| **/settings** | Print out the current settings |
|
|
60
|
+
| **/test** | Run a shell command and add the output to the chat on non-zero exit code |
|
|
61
|
+
| **/think-tokens** | Set the thinking token budget, eg: 8096, 8k, 10.5k, 0.5M, or 0 to disable. |
|
|
62
|
+
| **/tokens** | Report on the number of tokens used by the current chat context |
|
|
63
|
+
| **/undo** | Undo the last git commit if it was done by aider |
|
|
64
|
+
| **/voice** | Record and transcribe voice input |
|
|
65
|
+
| **/weak-model** | Switch the Weak Model to a new LLM |
|
|
66
|
+
| **/web** | Scrape a webpage, convert to markdown and send in a message |
|
|
67
|
+
|
|
68
|
+
<!--[[[end]]]-->
|
|
69
|
+
|
|
70
|
+
{: .tip }
|
|
71
|
+
You can easily re-send commands or messages.
|
|
72
|
+
Use the up arrow ⬆ to scroll back
|
|
73
|
+
or CONTROL-R to search your message history.
|
|
74
|
+
|
|
75
|
+
## Entering multi-line chat messages
|
|
76
|
+
|
|
77
|
+
{% include multi-line.md %}
|
|
78
|
+
|
|
79
|
+
## Interrupting with CONTROL-C
|
|
80
|
+
|
|
81
|
+
It's always safe to 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 to the LLM with more information or direction.
|
|
82
|
+
|
|
83
|
+
## Keybindings
|
|
84
|
+
|
|
85
|
+
The interactive prompt is built with [prompt-toolkit](https://github.com/prompt-toolkit/python-prompt-toolkit) which provides emacs and vi keybindings.
|
|
86
|
+
|
|
87
|
+
### Emacs
|
|
88
|
+
|
|
89
|
+
- `Up Arrow` : Move up one line in the current message.
|
|
90
|
+
- `Down Arrow` : Move down one line in the current message.
|
|
91
|
+
- `Ctrl-Up` : Scroll back through previously sent messages.
|
|
92
|
+
- `Ctrl-Down` : Scroll forward through previously sent messages.
|
|
93
|
+
- `Ctrl-A` : Move cursor to the start of the line.
|
|
94
|
+
- `Ctrl-B` : Move cursor back one character.
|
|
95
|
+
- `Ctrl-D` : Delete the character under the cursor.
|
|
96
|
+
- `Ctrl-E` : Move cursor to the end of the line.
|
|
97
|
+
- `Ctrl-F` : Move cursor forward one character.
|
|
98
|
+
- `Ctrl-K` : Delete from the cursor to the end of the line.
|
|
99
|
+
- `Ctrl-L` : Clear the screen.
|
|
100
|
+
- `Ctrl-N` : Move down to the next history entry.
|
|
101
|
+
- `Ctrl-P` : Move up to the previous history entry.
|
|
102
|
+
- `Ctrl-R` : Reverse search in command history.
|
|
103
|
+
- `Ctrl-X Ctrl-E` : Open the current input in an external editor
|
|
104
|
+
- `Ctrl-Y` : Paste (yank) text that was previously cut.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
### Vi
|
|
108
|
+
|
|
109
|
+
To use vi/vim keybindings, run aider with the `--vim` switch.
|
|
110
|
+
|
|
111
|
+
- `Up Arrow` : Move up one line in the current message.
|
|
112
|
+
- `Down Arrow` : Move down one line in the current message.
|
|
113
|
+
- `Ctrl-Up` : Scroll back through previously sent messages.
|
|
114
|
+
- `Ctrl-Down` : Scroll forward through previously sent messages.
|
|
115
|
+
- `Esc` : Switch to command mode.
|
|
116
|
+
- `i` : Switch to insert mode.
|
|
117
|
+
- `a` : Move cursor one character to the right and switch to insert mode.
|
|
118
|
+
- `A` : Move cursor to the end of the line and switch to insert mode.
|
|
119
|
+
- `I` : Move cursor to the beginning of the line and switch to insert mode.
|
|
120
|
+
- `h` : Move cursor one character to the left.
|
|
121
|
+
- `j` : Move cursor down one line.
|
|
122
|
+
- `k` : Move cursor up one line.
|
|
123
|
+
- `l` : Move cursor one character to the right.
|
|
124
|
+
- `w` : Move cursor forward one word.
|
|
125
|
+
- `b` : Move cursor backward one word.
|
|
126
|
+
- `0` : Move cursor to the beginning of the line.
|
|
127
|
+
- `$` : Move cursor to the end of the line.
|
|
128
|
+
- `x` : Delete the character under the cursor.
|
|
129
|
+
- `dd` : Delete the current line.
|
|
130
|
+
- `u` : Undo the last change.
|
|
131
|
+
- `Ctrl-R` : Redo the last undone change.
|
|
132
|
+
|
|
133
|
+
|
|
@@ -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,136 @@
|
|
|
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
|
+
### No API access? Use `cp:model`
|
|
94
|
+
|
|
95
|
+
If your only access to an LLM is via a web chat (no API keys, no local models), you can run aider with a model name prefixed by cp:. This performs the entire workflow via copy/paste without making any API calls.
|
|
96
|
+
|
|
97
|
+
#### What cp: does
|
|
98
|
+
|
|
99
|
+
- Activates CopyPasteCoder, which never sends requests to any LLM API.
|
|
100
|
+
- Uses the same copy/paste workflow described above
|
|
101
|
+
|
|
102
|
+
#### Token and cost tracking
|
|
103
|
+
|
|
104
|
+
- Aider uses the text after cp: as the "model name" for local token counting and cost estimation.
|
|
105
|
+
- If the label matches a known model in aider's pricing tables, aider will estimate tokens/costs using that model's rates; otherwise, costs may show as unknown or zero.
|
|
106
|
+
- With flat-rate web chat plans, you can treat any "estimated cost" displayed by aider as your "savings" versus if you had called an API model.
|
|
107
|
+
|
|
108
|
+
## Terms of service
|
|
109
|
+
|
|
110
|
+
Be sure to review the Terms Of Service of any LLM web chat service you use with
|
|
111
|
+
these features.
|
|
112
|
+
These features are not intended to be used in violation of any service's Terms Of Service (TOS).
|
|
113
|
+
|
|
114
|
+
Aider's web chat features have been designed to be compliant with the
|
|
115
|
+
terms of service of most LLM web chats.
|
|
116
|
+
|
|
117
|
+
There are 4 copy/paste steps involved when coding with an LLM web chat:
|
|
118
|
+
|
|
119
|
+
1. Copy code and context from aider.
|
|
120
|
+
2. Paste the code and context into the LLM web chat.
|
|
121
|
+
3. Copy the reply from the LLM web chat.
|
|
122
|
+
4. Paste the LLM reply into aider.
|
|
123
|
+
|
|
124
|
+
Most LLM web chat TOS prohibit automating steps (2) and (3) where code
|
|
125
|
+
is copied from and pasted into the web chat.
|
|
126
|
+
Aider's `--copy-paste` mode leaves those as 100% manual steps for the user to complete.
|
|
127
|
+
It simply streamlines steps (1) and (4) that are interactions with aider,
|
|
128
|
+
and which should not be under the scope of an LLM web chat TOS.
|
|
129
|
+
|
|
130
|
+
If you are concerned that
|
|
131
|
+
the automatic interactions with aider in steps (1) and (4) may be problematic with respect to
|
|
132
|
+
your LLM web chat provider's TOS, you can forego `--copy-paste` mode.
|
|
133
|
+
Instead, manually use the `/copy-context` and `/paste` commands if that
|
|
134
|
+
will keep you in compliance.
|
|
135
|
+
|
|
136
|
+
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
|
+
|