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.
Files changed (279) hide show
  1. aider/__init__.py +20 -0
  2. aider/__main__.py +4 -0
  3. aider/_version.py +34 -0
  4. aider/analytics.py +258 -0
  5. aider/args.py +1056 -0
  6. aider/args_formatter.py +228 -0
  7. aider/change_tracker.py +133 -0
  8. aider/coders/__init__.py +36 -0
  9. aider/coders/agent_coder.py +2166 -0
  10. aider/coders/agent_prompts.py +104 -0
  11. aider/coders/architect_coder.py +48 -0
  12. aider/coders/architect_prompts.py +40 -0
  13. aider/coders/ask_coder.py +9 -0
  14. aider/coders/ask_prompts.py +35 -0
  15. aider/coders/base_coder.py +3613 -0
  16. aider/coders/base_prompts.py +87 -0
  17. aider/coders/chat_chunks.py +64 -0
  18. aider/coders/context_coder.py +53 -0
  19. aider/coders/context_prompts.py +75 -0
  20. aider/coders/editblock_coder.py +657 -0
  21. aider/coders/editblock_fenced_coder.py +10 -0
  22. aider/coders/editblock_fenced_prompts.py +143 -0
  23. aider/coders/editblock_func_coder.py +141 -0
  24. aider/coders/editblock_func_prompts.py +27 -0
  25. aider/coders/editblock_prompts.py +175 -0
  26. aider/coders/editor_diff_fenced_coder.py +9 -0
  27. aider/coders/editor_diff_fenced_prompts.py +11 -0
  28. aider/coders/editor_editblock_coder.py +9 -0
  29. aider/coders/editor_editblock_prompts.py +21 -0
  30. aider/coders/editor_whole_coder.py +9 -0
  31. aider/coders/editor_whole_prompts.py +12 -0
  32. aider/coders/help_coder.py +16 -0
  33. aider/coders/help_prompts.py +46 -0
  34. aider/coders/patch_coder.py +706 -0
  35. aider/coders/patch_prompts.py +159 -0
  36. aider/coders/search_replace.py +757 -0
  37. aider/coders/shell.py +37 -0
  38. aider/coders/single_wholefile_func_coder.py +102 -0
  39. aider/coders/single_wholefile_func_prompts.py +27 -0
  40. aider/coders/udiff_coder.py +429 -0
  41. aider/coders/udiff_prompts.py +115 -0
  42. aider/coders/udiff_simple.py +14 -0
  43. aider/coders/udiff_simple_prompts.py +25 -0
  44. aider/coders/wholefile_coder.py +144 -0
  45. aider/coders/wholefile_func_coder.py +134 -0
  46. aider/coders/wholefile_func_prompts.py +27 -0
  47. aider/coders/wholefile_prompts.py +65 -0
  48. aider/commands.py +2173 -0
  49. aider/copypaste.py +72 -0
  50. aider/deprecated.py +126 -0
  51. aider/diffs.py +128 -0
  52. aider/dump.py +29 -0
  53. aider/editor.py +147 -0
  54. aider/exceptions.py +115 -0
  55. aider/format_settings.py +26 -0
  56. aider/gui.py +545 -0
  57. aider/help.py +163 -0
  58. aider/help_pats.py +19 -0
  59. aider/helpers/__init__.py +9 -0
  60. aider/helpers/similarity.py +98 -0
  61. aider/history.py +180 -0
  62. aider/io.py +1608 -0
  63. aider/linter.py +304 -0
  64. aider/llm.py +55 -0
  65. aider/main.py +1415 -0
  66. aider/mcp/__init__.py +174 -0
  67. aider/mcp/server.py +149 -0
  68. aider/mdstream.py +243 -0
  69. aider/models.py +1313 -0
  70. aider/onboarding.py +429 -0
  71. aider/openrouter.py +129 -0
  72. aider/prompts.py +56 -0
  73. aider/queries/tree-sitter-language-pack/README.md +7 -0
  74. aider/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
  75. aider/queries/tree-sitter-language-pack/c-tags.scm +9 -0
  76. aider/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
  77. aider/queries/tree-sitter-language-pack/clojure-tags.scm +7 -0
  78. aider/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
  79. aider/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
  80. aider/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
  81. aider/queries/tree-sitter-language-pack/d-tags.scm +26 -0
  82. aider/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
  83. aider/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
  84. aider/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
  85. aider/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
  86. aider/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
  87. aider/queries/tree-sitter-language-pack/go-tags.scm +42 -0
  88. aider/queries/tree-sitter-language-pack/java-tags.scm +20 -0
  89. aider/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
  90. aider/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
  91. aider/queries/tree-sitter-language-pack/matlab-tags.scm +10 -0
  92. aider/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
  93. aider/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
  94. aider/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
  95. aider/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
  96. aider/queries/tree-sitter-language-pack/python-tags.scm +14 -0
  97. aider/queries/tree-sitter-language-pack/r-tags.scm +21 -0
  98. aider/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
  99. aider/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
  100. aider/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
  101. aider/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
  102. aider/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
  103. aider/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
  104. aider/queries/tree-sitter-languages/README.md +24 -0
  105. aider/queries/tree-sitter-languages/c-tags.scm +9 -0
  106. aider/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
  107. aider/queries/tree-sitter-languages/cpp-tags.scm +15 -0
  108. aider/queries/tree-sitter-languages/dart-tags.scm +91 -0
  109. aider/queries/tree-sitter-languages/elisp-tags.scm +8 -0
  110. aider/queries/tree-sitter-languages/elixir-tags.scm +54 -0
  111. aider/queries/tree-sitter-languages/elm-tags.scm +19 -0
  112. aider/queries/tree-sitter-languages/fortran-tags.scm +15 -0
  113. aider/queries/tree-sitter-languages/go-tags.scm +30 -0
  114. aider/queries/tree-sitter-languages/haskell-tags.scm +3 -0
  115. aider/queries/tree-sitter-languages/hcl-tags.scm +77 -0
  116. aider/queries/tree-sitter-languages/java-tags.scm +20 -0
  117. aider/queries/tree-sitter-languages/javascript-tags.scm +88 -0
  118. aider/queries/tree-sitter-languages/julia-tags.scm +60 -0
  119. aider/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
  120. aider/queries/tree-sitter-languages/matlab-tags.scm +10 -0
  121. aider/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
  122. aider/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
  123. aider/queries/tree-sitter-languages/php-tags.scm +26 -0
  124. aider/queries/tree-sitter-languages/python-tags.scm +12 -0
  125. aider/queries/tree-sitter-languages/ql-tags.scm +26 -0
  126. aider/queries/tree-sitter-languages/ruby-tags.scm +64 -0
  127. aider/queries/tree-sitter-languages/rust-tags.scm +60 -0
  128. aider/queries/tree-sitter-languages/scala-tags.scm +65 -0
  129. aider/queries/tree-sitter-languages/typescript-tags.scm +41 -0
  130. aider/queries/tree-sitter-languages/zig-tags.scm +3 -0
  131. aider/reasoning_tags.py +82 -0
  132. aider/repo.py +621 -0
  133. aider/repomap.py +1174 -0
  134. aider/report.py +260 -0
  135. aider/resources/__init__.py +3 -0
  136. aider/resources/model-metadata.json +776 -0
  137. aider/resources/model-settings.yml +2068 -0
  138. aider/run_cmd.py +133 -0
  139. aider/scrape.py +293 -0
  140. aider/sendchat.py +242 -0
  141. aider/sessions.py +256 -0
  142. aider/special.py +203 -0
  143. aider/tools/__init__.py +72 -0
  144. aider/tools/command.py +105 -0
  145. aider/tools/command_interactive.py +122 -0
  146. aider/tools/delete_block.py +182 -0
  147. aider/tools/delete_line.py +155 -0
  148. aider/tools/delete_lines.py +184 -0
  149. aider/tools/extract_lines.py +341 -0
  150. aider/tools/finished.py +48 -0
  151. aider/tools/git_branch.py +129 -0
  152. aider/tools/git_diff.py +60 -0
  153. aider/tools/git_log.py +57 -0
  154. aider/tools/git_remote.py +53 -0
  155. aider/tools/git_show.py +51 -0
  156. aider/tools/git_status.py +46 -0
  157. aider/tools/grep.py +256 -0
  158. aider/tools/indent_lines.py +221 -0
  159. aider/tools/insert_block.py +288 -0
  160. aider/tools/list_changes.py +86 -0
  161. aider/tools/ls.py +93 -0
  162. aider/tools/make_editable.py +85 -0
  163. aider/tools/make_readonly.py +69 -0
  164. aider/tools/remove.py +91 -0
  165. aider/tools/replace_all.py +126 -0
  166. aider/tools/replace_line.py +173 -0
  167. aider/tools/replace_lines.py +217 -0
  168. aider/tools/replace_text.py +187 -0
  169. aider/tools/show_numbered_context.py +147 -0
  170. aider/tools/tool_utils.py +313 -0
  171. aider/tools/undo_change.py +95 -0
  172. aider/tools/update_todo_list.py +156 -0
  173. aider/tools/view.py +57 -0
  174. aider/tools/view_files_matching.py +141 -0
  175. aider/tools/view_files_with_symbol.py +129 -0
  176. aider/urls.py +17 -0
  177. aider/utils.py +456 -0
  178. aider/versioncheck.py +113 -0
  179. aider/voice.py +205 -0
  180. aider/waiting.py +38 -0
  181. aider/watch.py +318 -0
  182. aider/watch_prompts.py +12 -0
  183. aider/website/Gemfile +8 -0
  184. aider/website/_includes/blame.md +162 -0
  185. aider/website/_includes/get-started.md +22 -0
  186. aider/website/_includes/help-tip.md +5 -0
  187. aider/website/_includes/help.md +24 -0
  188. aider/website/_includes/install.md +5 -0
  189. aider/website/_includes/keys.md +4 -0
  190. aider/website/_includes/model-warnings.md +67 -0
  191. aider/website/_includes/multi-line.md +22 -0
  192. aider/website/_includes/python-m-aider.md +5 -0
  193. aider/website/_includes/recording.css +228 -0
  194. aider/website/_includes/recording.md +34 -0
  195. aider/website/_includes/replit-pipx.md +9 -0
  196. aider/website/_includes/works-best.md +1 -0
  197. aider/website/_sass/custom/custom.scss +103 -0
  198. aider/website/docs/config/adv-model-settings.md +2261 -0
  199. aider/website/docs/config/agent-mode.md +194 -0
  200. aider/website/docs/config/aider_conf.md +548 -0
  201. aider/website/docs/config/api-keys.md +90 -0
  202. aider/website/docs/config/dotenv.md +493 -0
  203. aider/website/docs/config/editor.md +127 -0
  204. aider/website/docs/config/mcp.md +95 -0
  205. aider/website/docs/config/model-aliases.md +104 -0
  206. aider/website/docs/config/options.md +890 -0
  207. aider/website/docs/config/reasoning.md +210 -0
  208. aider/website/docs/config.md +44 -0
  209. aider/website/docs/faq.md +384 -0
  210. aider/website/docs/git.md +76 -0
  211. aider/website/docs/index.md +47 -0
  212. aider/website/docs/install/codespaces.md +39 -0
  213. aider/website/docs/install/docker.md +57 -0
  214. aider/website/docs/install/optional.md +100 -0
  215. aider/website/docs/install/replit.md +8 -0
  216. aider/website/docs/install.md +115 -0
  217. aider/website/docs/languages.md +264 -0
  218. aider/website/docs/legal/contributor-agreement.md +111 -0
  219. aider/website/docs/legal/privacy.md +104 -0
  220. aider/website/docs/llms/anthropic.md +77 -0
  221. aider/website/docs/llms/azure.md +48 -0
  222. aider/website/docs/llms/bedrock.md +132 -0
  223. aider/website/docs/llms/cohere.md +34 -0
  224. aider/website/docs/llms/deepseek.md +32 -0
  225. aider/website/docs/llms/gemini.md +49 -0
  226. aider/website/docs/llms/github.md +111 -0
  227. aider/website/docs/llms/groq.md +36 -0
  228. aider/website/docs/llms/lm-studio.md +39 -0
  229. aider/website/docs/llms/ollama.md +75 -0
  230. aider/website/docs/llms/openai-compat.md +39 -0
  231. aider/website/docs/llms/openai.md +58 -0
  232. aider/website/docs/llms/openrouter.md +78 -0
  233. aider/website/docs/llms/other.md +117 -0
  234. aider/website/docs/llms/vertex.md +50 -0
  235. aider/website/docs/llms/warnings.md +10 -0
  236. aider/website/docs/llms/xai.md +53 -0
  237. aider/website/docs/llms.md +54 -0
  238. aider/website/docs/more/analytics.md +127 -0
  239. aider/website/docs/more/edit-formats.md +116 -0
  240. aider/website/docs/more/infinite-output.md +165 -0
  241. aider/website/docs/more-info.md +8 -0
  242. aider/website/docs/recordings/auto-accept-architect.md +31 -0
  243. aider/website/docs/recordings/dont-drop-original-read-files.md +35 -0
  244. aider/website/docs/recordings/index.md +21 -0
  245. aider/website/docs/recordings/model-accepts-settings.md +69 -0
  246. aider/website/docs/recordings/tree-sitter-language-pack.md +80 -0
  247. aider/website/docs/repomap.md +112 -0
  248. aider/website/docs/scripting.md +100 -0
  249. aider/website/docs/sessions.md +203 -0
  250. aider/website/docs/troubleshooting/aider-not-found.md +24 -0
  251. aider/website/docs/troubleshooting/edit-errors.md +76 -0
  252. aider/website/docs/troubleshooting/imports.md +62 -0
  253. aider/website/docs/troubleshooting/models-and-keys.md +54 -0
  254. aider/website/docs/troubleshooting/support.md +79 -0
  255. aider/website/docs/troubleshooting/token-limits.md +96 -0
  256. aider/website/docs/troubleshooting/warnings.md +12 -0
  257. aider/website/docs/troubleshooting.md +11 -0
  258. aider/website/docs/usage/browser.md +57 -0
  259. aider/website/docs/usage/caching.md +49 -0
  260. aider/website/docs/usage/commands.md +133 -0
  261. aider/website/docs/usage/conventions.md +119 -0
  262. aider/website/docs/usage/copypaste.md +121 -0
  263. aider/website/docs/usage/images-urls.md +48 -0
  264. aider/website/docs/usage/lint-test.md +118 -0
  265. aider/website/docs/usage/modes.md +211 -0
  266. aider/website/docs/usage/not-code.md +179 -0
  267. aider/website/docs/usage/notifications.md +87 -0
  268. aider/website/docs/usage/tips.md +79 -0
  269. aider/website/docs/usage/tutorials.md +30 -0
  270. aider/website/docs/usage/voice.md +121 -0
  271. aider/website/docs/usage/watch.md +294 -0
  272. aider/website/docs/usage.md +102 -0
  273. aider/website/share/index.md +101 -0
  274. aider_ce-0.88.20.dist-info/METADATA +187 -0
  275. aider_ce-0.88.20.dist-info/RECORD +279 -0
  276. aider_ce-0.88.20.dist-info/WHEEL +5 -0
  277. aider_ce-0.88.20.dist-info/entry_points.txt +2 -0
  278. aider_ce-0.88.20.dist-info/licenses/LICENSE.txt +202 -0
  279. aider_ce-0.88.20.dist-info/top_level.txt +1 -0
aider/args.py ADDED
@@ -0,0 +1,1056 @@
1
+ #!/usr/bin/env python
2
+
3
+ import argparse
4
+ import os
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ import configargparse
9
+ import shtab
10
+
11
+ from aider import __version__
12
+ from aider.args_formatter import (
13
+ DotEnvFormatter,
14
+ MarkdownHelpFormatter,
15
+ YamlHelpFormatter,
16
+ )
17
+ from aider.deprecated import add_deprecated_model_args
18
+
19
+ from .dump import dump # noqa: F401
20
+
21
+
22
+ def resolve_aiderignore_path(path_str, git_root=None):
23
+ path = Path(path_str)
24
+ if path.is_absolute():
25
+ return str(path)
26
+ elif git_root:
27
+ return str(Path(git_root) / path)
28
+ return str(path)
29
+
30
+
31
+ def default_env_file(git_root):
32
+ return os.path.join(git_root, ".env") if git_root else ".env"
33
+
34
+
35
+ def get_parser(default_config_files, git_root):
36
+ parser = configargparse.ArgumentParser(
37
+ description="aider is AI pair programming in your terminal",
38
+ add_config_file_help=True,
39
+ default_config_files=default_config_files,
40
+ config_file_parser_class=configargparse.YAMLConfigFileParser,
41
+ auto_env_var_prefix="AIDER_",
42
+ )
43
+ # List of valid edit formats for argparse validation & shtab completion.
44
+ # Dynamically gather them from the registered coder classes so the list
45
+ # stays in sync if new formats are added.
46
+ from aider import coders as _aider_coders
47
+
48
+ edit_format_choices = sorted(
49
+ {
50
+ c.edit_format
51
+ for c in _aider_coders.__all__
52
+ if hasattr(c, "edit_format") and c.edit_format is not None
53
+ }
54
+ )
55
+ group = parser.add_argument_group("Main model")
56
+ group.add_argument(
57
+ "files", metavar="FILE", nargs="*", help="files to edit with an LLM (optional)"
58
+ ).complete = shtab.FILE
59
+ group.add_argument(
60
+ "--model",
61
+ metavar="MODEL",
62
+ default=None,
63
+ help="Specify the model to use for the main chat",
64
+ )
65
+
66
+ ##########
67
+ group = parser.add_argument_group("API Keys and settings")
68
+ group.add_argument(
69
+ "--openai-api-key",
70
+ help="Specify the OpenAI API key",
71
+ )
72
+ group.add_argument(
73
+ "--anthropic-api-key",
74
+ help="Specify the Anthropic API key",
75
+ )
76
+ group.add_argument(
77
+ "--openai-api-base",
78
+ help="Specify the api base url",
79
+ )
80
+ group.add_argument(
81
+ "--openai-api-type",
82
+ help="(deprecated, use --set-env OPENAI_API_TYPE=<value>)",
83
+ )
84
+ group.add_argument(
85
+ "--openai-api-version",
86
+ help="(deprecated, use --set-env OPENAI_API_VERSION=<value>)",
87
+ )
88
+ group.add_argument(
89
+ "--openai-api-deployment-id",
90
+ help="(deprecated, use --set-env OPENAI_API_DEPLOYMENT_ID=<value>)",
91
+ )
92
+ group.add_argument(
93
+ "--openai-organization-id",
94
+ help="(deprecated, use --set-env OPENAI_ORGANIZATION=<value>)",
95
+ )
96
+ group.add_argument(
97
+ "--set-env",
98
+ action="append",
99
+ metavar="ENV_VAR_NAME=value",
100
+ help="Set an environment variable (to control API settings, can be used multiple times)",
101
+ default=[],
102
+ )
103
+ group.add_argument(
104
+ "--api-key",
105
+ action="append",
106
+ metavar="PROVIDER=KEY",
107
+ help=(
108
+ "Set an API key for a provider (eg: --api-key provider=<key> sets"
109
+ " PROVIDER_API_KEY=<key>)"
110
+ ),
111
+ default=[],
112
+ )
113
+ group = parser.add_argument_group("Model settings")
114
+ group.add_argument(
115
+ "--list-models",
116
+ "--models",
117
+ metavar="MODEL",
118
+ help="List known models which match the (partial) MODEL name",
119
+ )
120
+ group.add_argument(
121
+ "--model-settings-file",
122
+ metavar="MODEL_SETTINGS_FILE",
123
+ default=".aider.model.settings.yml",
124
+ help="Specify a file with aider model settings for unknown models",
125
+ ).complete = shtab.FILE
126
+ group.add_argument(
127
+ "--model-metadata-file",
128
+ metavar="MODEL_METADATA_FILE",
129
+ default=".aider.model.metadata.json",
130
+ help="Specify a file with context window and costs for unknown models",
131
+ ).complete = shtab.FILE
132
+ group.add_argument(
133
+ "--alias",
134
+ action="append",
135
+ metavar="ALIAS:MODEL",
136
+ help="Add a model alias (can be used multiple times)",
137
+ )
138
+ group.add_argument(
139
+ "--reasoning-effort",
140
+ type=str,
141
+ help="Set the reasoning_effort API parameter (default: not set)",
142
+ )
143
+ group.add_argument(
144
+ "--thinking-tokens",
145
+ type=str,
146
+ help=(
147
+ "Set the thinking token budget for models that support it. Use 0 to disable. (default:"
148
+ " not set)"
149
+ ),
150
+ )
151
+ group.add_argument(
152
+ "--verify-ssl",
153
+ action=argparse.BooleanOptionalAction,
154
+ default=True,
155
+ help="Verify the SSL cert when connecting to models (default: True)",
156
+ )
157
+ group.add_argument(
158
+ "--timeout",
159
+ type=float,
160
+ default=None,
161
+ help="Timeout in seconds for API calls (default: None)",
162
+ )
163
+ group.add_argument(
164
+ "--edit-format",
165
+ "--chat-mode",
166
+ metavar="EDIT_FORMAT",
167
+ choices=edit_format_choices,
168
+ default=None,
169
+ help="Specify what edit format the LLM should use (default depends on model)",
170
+ )
171
+ group.add_argument(
172
+ "--architect",
173
+ action="store_const",
174
+ dest="edit_format",
175
+ const="architect",
176
+ help="Use architect edit format for the main chat",
177
+ )
178
+ group.add_argument(
179
+ "--agent",
180
+ action="store_const",
181
+ dest="edit_format",
182
+ const="agent",
183
+ help="Use agent edit format for the main chat (autonomous file management)",
184
+ )
185
+ group.add_argument(
186
+ "--auto-accept-architect",
187
+ action=argparse.BooleanOptionalAction,
188
+ default=True,
189
+ help="Enable/disable automatic acceptance of architect changes (default: True)",
190
+ )
191
+ group.add_argument(
192
+ "--weak-model",
193
+ metavar="WEAK_MODEL",
194
+ default=None,
195
+ help=(
196
+ "Specify the model to use for commit messages and chat history summarization (default"
197
+ " depends on --model)"
198
+ ),
199
+ )
200
+ group.add_argument(
201
+ "--editor-model",
202
+ metavar="EDITOR_MODEL",
203
+ default=None,
204
+ help="Specify the model to use for editor tasks (default depends on --model)",
205
+ )
206
+ group.add_argument(
207
+ "--editor-edit-format",
208
+ metavar="EDITOR_EDIT_FORMAT",
209
+ choices=edit_format_choices,
210
+ default=None,
211
+ help="Specify the edit format for the editor model (default: depends on editor model)",
212
+ )
213
+ group.add_argument(
214
+ "--show-model-warnings",
215
+ action=argparse.BooleanOptionalAction,
216
+ default=True,
217
+ help="Only work with models that have meta-data available (default: True)",
218
+ )
219
+ group.add_argument(
220
+ "--check-model-accepts-settings",
221
+ action=argparse.BooleanOptionalAction,
222
+ default=True,
223
+ help=(
224
+ "Check if model accepts settings like reasoning_effort/thinking_tokens (default: True)"
225
+ ),
226
+ )
227
+ group.add_argument(
228
+ "--max-chat-history-tokens",
229
+ type=int,
230
+ default=None,
231
+ help=(
232
+ "Soft limit on tokens for chat history, after which summarization begins."
233
+ " If unspecified, defaults to the model's max_chat_history_tokens."
234
+ ),
235
+ )
236
+
237
+ ##########
238
+ group = parser.add_argument_group("Context Compaction")
239
+ group.add_argument(
240
+ "--enable-context-compaction",
241
+ action=argparse.BooleanOptionalAction,
242
+ default=False,
243
+ help="Enable automatic compaction of chat history to conserve tokens (default: False)",
244
+ )
245
+ group.add_argument(
246
+ "--context-compaction-max-tokens",
247
+ type=int,
248
+ default=None,
249
+ help=(
250
+ "The maximum number of tokens in the conversation before context compaction is"
251
+ " triggered. (default: 80%% of model's context window)"
252
+ ),
253
+ )
254
+ group.add_argument(
255
+ "--context-compaction-summary-tokens",
256
+ type=int,
257
+ default=4096,
258
+ help="The target maximum number of tokens for the generated summary. (default: 4096)",
259
+ )
260
+
261
+ ##########
262
+ group = parser.add_argument_group("Cache settings")
263
+ group.add_argument(
264
+ "--cache-prompts",
265
+ action=argparse.BooleanOptionalAction,
266
+ default=False,
267
+ help="Enable caching of prompts (default: False)",
268
+ )
269
+ group.add_argument(
270
+ "--cache-keepalive-pings",
271
+ type=int,
272
+ default=0,
273
+ help="Number of times to ping at 5min intervals to keep prompt cache warm (default: 0)",
274
+ )
275
+
276
+ ##########
277
+ group = parser.add_argument_group("Repomap settings")
278
+ group.add_argument(
279
+ "--map-tokens",
280
+ type=int,
281
+ default=None,
282
+ help="Suggested number of tokens to use for repo map, use 0 to disable",
283
+ )
284
+ group.add_argument(
285
+ "--map-refresh",
286
+ choices=["auto", "always", "files", "manual"],
287
+ default="auto",
288
+ help=(
289
+ "Control how often the repo map is refreshed. Options: auto, always, files, manual"
290
+ " (default: auto)"
291
+ ),
292
+ )
293
+ group.add_argument(
294
+ "--map-multiplier-no-files",
295
+ type=float,
296
+ default=2,
297
+ help="Multiplier for map tokens when no files are specified (default: 2)",
298
+ )
299
+ group.add_argument(
300
+ "--map-max-line-length",
301
+ type=int,
302
+ default=100,
303
+ help=(
304
+ "Maximum line length for the repo map code. Prevents sending crazy long lines of"
305
+ " minified JS files etc. (default: 100)"
306
+ ),
307
+ )
308
+ group.add_argument(
309
+ "--map-cache-dir",
310
+ metavar="MAP_CACHE_DIR",
311
+ dest="map_cache_dir",
312
+ default=".",
313
+ help=(
314
+ "Directory for the repository map cache .aider.tags.cache.v3"
315
+ " (default: current directory)"
316
+ ),
317
+ )
318
+ group.add_argument(
319
+ "--map-memory-cache",
320
+ action="store_true",
321
+ help="Store repo map in memory (default: False)",
322
+ default=False,
323
+ )
324
+ ##########
325
+ group = parser.add_argument_group("History Files")
326
+ default_input_history_file = (
327
+ os.path.join(git_root, ".aider.input.history") if git_root else ".aider.input.history"
328
+ )
329
+ default_chat_history_file = (
330
+ os.path.join(git_root, ".aider.chat.history.md") if git_root else ".aider.chat.history.md"
331
+ )
332
+ group.add_argument(
333
+ "--input-history-file",
334
+ metavar="INPUT_HISTORY_FILE",
335
+ default=default_input_history_file,
336
+ help=f"Specify the chat input history file (default: {default_input_history_file})",
337
+ ).complete = shtab.FILE
338
+ group.add_argument(
339
+ "--chat-history-file",
340
+ metavar="CHAT_HISTORY_FILE",
341
+ default=default_chat_history_file,
342
+ help=f"Specify the chat history file (default: {default_chat_history_file})",
343
+ ).complete = shtab.FILE
344
+ group.add_argument(
345
+ "--restore-chat-history",
346
+ action=argparse.BooleanOptionalAction,
347
+ default=False,
348
+ help="Restore the previous chat history messages (default: False)",
349
+ )
350
+ group.add_argument(
351
+ "--llm-history-file",
352
+ metavar="LLM_HISTORY_FILE",
353
+ default=None,
354
+ help="Log the conversation with the LLM to this file (for example, .aider.llm.history)",
355
+ ).complete = shtab.FILE
356
+
357
+ ##########
358
+ group = parser.add_argument_group("Output settings")
359
+ group.add_argument(
360
+ "--dark-mode",
361
+ action="store_true",
362
+ help="Use colors suitable for a dark terminal background (default: False)",
363
+ default=False,
364
+ )
365
+ group.add_argument(
366
+ "--light-mode",
367
+ action="store_true",
368
+ help="Use colors suitable for a light terminal background (default: False)",
369
+ default=False,
370
+ )
371
+ group.add_argument(
372
+ "--pretty",
373
+ action=argparse.BooleanOptionalAction,
374
+ default=True,
375
+ help="Enable/disable pretty, colorized output (default: True)",
376
+ )
377
+ group.add_argument(
378
+ "--stream",
379
+ action=argparse.BooleanOptionalAction,
380
+ default=True,
381
+ help="Enable/disable streaming responses (default: True)",
382
+ )
383
+ group.add_argument(
384
+ "--user-input-color",
385
+ default="#00cc00",
386
+ help="Set the color for user input (default: #00cc00)",
387
+ )
388
+ group.add_argument(
389
+ "--tool-output-color",
390
+ default=None,
391
+ help="Set the color for tool output (default: None)",
392
+ )
393
+ group.add_argument(
394
+ "--tool-error-color",
395
+ default="#FF2222",
396
+ help="Set the color for tool error messages (default: #FF2222)",
397
+ )
398
+ group.add_argument(
399
+ "--tool-warning-color",
400
+ default="#FFA500",
401
+ help="Set the color for tool warning messages (default: #FFA500)",
402
+ )
403
+ group.add_argument(
404
+ "--assistant-output-color",
405
+ default="#0088ff",
406
+ help="Set the color for assistant output (default: #0088ff)",
407
+ )
408
+ group.add_argument(
409
+ "--completion-menu-color",
410
+ metavar="COLOR",
411
+ default=None,
412
+ help="Set the color for the completion menu (default: terminal's default text color)",
413
+ )
414
+ group.add_argument(
415
+ "--completion-menu-bg-color",
416
+ metavar="COLOR",
417
+ default=None,
418
+ help=(
419
+ "Set the background color for the completion menu (default: terminal's default"
420
+ " background color)"
421
+ ),
422
+ )
423
+ group.add_argument(
424
+ "--completion-menu-current-color",
425
+ metavar="COLOR",
426
+ default=None,
427
+ help=(
428
+ "Set the color for the current item in the completion menu (default: terminal's default"
429
+ " background color)"
430
+ ),
431
+ )
432
+ group.add_argument(
433
+ "--completion-menu-current-bg-color",
434
+ metavar="COLOR",
435
+ default=None,
436
+ help=(
437
+ "Set the background color for the current item in the completion menu (default:"
438
+ " terminal's default text color)"
439
+ ),
440
+ )
441
+ group.add_argument(
442
+ "--code-theme",
443
+ default="default",
444
+ help=(
445
+ "Set the markdown code theme (default: default, other options include monokai,"
446
+ " solarized-dark, solarized-light, or a Pygments builtin style,"
447
+ " see https://pygments.org/styles for available themes)"
448
+ ),
449
+ )
450
+ group.add_argument(
451
+ "--show-diffs",
452
+ action="store_true",
453
+ help="Show diffs when committing changes (default: False)",
454
+ default=False,
455
+ )
456
+
457
+ ##########
458
+ group = parser.add_argument_group("Git settings")
459
+ group.add_argument(
460
+ "--git",
461
+ action=argparse.BooleanOptionalAction,
462
+ default=True,
463
+ help="Enable/disable looking for a git repo (default: True)",
464
+ )
465
+ group.add_argument(
466
+ "--gitignore",
467
+ action=argparse.BooleanOptionalAction,
468
+ default=True,
469
+ help="Enable/disable adding .aider* to .gitignore (default: True)",
470
+ )
471
+ group.add_argument(
472
+ "--add-gitignore-files",
473
+ action=argparse.BooleanOptionalAction,
474
+ default=False,
475
+ help="Enable/disable the addition of files listed in .gitignore to Aider's editing scope.",
476
+ )
477
+ default_aiderignore_file = (
478
+ os.path.join(git_root, ".aiderignore") if git_root else ".aiderignore"
479
+ )
480
+
481
+ group.add_argument(
482
+ "--aiderignore",
483
+ metavar="AIDERIGNORE",
484
+ type=lambda path_str: resolve_aiderignore_path(path_str, git_root),
485
+ default=default_aiderignore_file,
486
+ help="Specify the aider ignore file (default: .aiderignore in git root)",
487
+ ).complete = shtab.FILE
488
+ group.add_argument(
489
+ "--subtree-only",
490
+ action="store_true",
491
+ help="Only consider files in the current subtree of the git repository",
492
+ default=False,
493
+ )
494
+ group.add_argument(
495
+ "--auto-commits",
496
+ action=argparse.BooleanOptionalAction,
497
+ default=True,
498
+ help="Enable/disable auto commit of LLM changes (default: True)",
499
+ )
500
+ group.add_argument(
501
+ "--dirty-commits",
502
+ action=argparse.BooleanOptionalAction,
503
+ default=True,
504
+ help="Enable/disable commits when repo is found dirty (default: True)",
505
+ )
506
+ group.add_argument(
507
+ "--attribute-author",
508
+ action=argparse.BooleanOptionalAction,
509
+ default=None,
510
+ help=(
511
+ "Attribute aider code changes in the git author name (default: True). If explicitly set"
512
+ " to True, overrides --attribute-co-authored-by precedence."
513
+ ),
514
+ )
515
+ group.add_argument(
516
+ "--attribute-committer",
517
+ action=argparse.BooleanOptionalAction,
518
+ default=None,
519
+ help=(
520
+ "Attribute aider commits in the git committer name (default: True). If explicitly set"
521
+ " to True, overrides --attribute-co-authored-by precedence for aider edits."
522
+ ),
523
+ )
524
+ group.add_argument(
525
+ "--attribute-commit-message-author",
526
+ action=argparse.BooleanOptionalAction,
527
+ default=False,
528
+ help="Prefix commit messages with 'aider: ' if aider authored the changes (default: False)",
529
+ )
530
+ group.add_argument(
531
+ "--attribute-commit-message-committer",
532
+ action=argparse.BooleanOptionalAction,
533
+ default=False,
534
+ help="Prefix all commit messages with 'aider: ' (default: False)",
535
+ )
536
+ group.add_argument(
537
+ "--attribute-co-authored-by",
538
+ action=argparse.BooleanOptionalAction,
539
+ default=True,
540
+ help=(
541
+ "Attribute aider edits using the Co-authored-by trailer in the commit message"
542
+ " (default: True). If True, this takes precedence over default --attribute-author and"
543
+ " --attribute-committer behavior unless they are explicitly set to True."
544
+ ),
545
+ )
546
+ group.add_argument(
547
+ "--git-commit-verify",
548
+ action=argparse.BooleanOptionalAction,
549
+ default=False,
550
+ help="Enable/disable git pre-commit hooks with --no-verify (default: False)",
551
+ )
552
+ group.add_argument(
553
+ "--commit",
554
+ action="store_true",
555
+ help="Commit all pending changes with a suitable commit message, then exit",
556
+ default=False,
557
+ )
558
+ group.add_argument(
559
+ "--commit-prompt",
560
+ metavar="PROMPT",
561
+ help="Specify a custom prompt for generating commit messages",
562
+ )
563
+ group.add_argument(
564
+ "--dry-run",
565
+ action=argparse.BooleanOptionalAction,
566
+ default=False,
567
+ help="Perform a dry run without modifying files (default: False)",
568
+ )
569
+ group.add_argument(
570
+ "--skip-sanity-check-repo",
571
+ action="store_true",
572
+ help="Skip the sanity check for the git repository (default: False)",
573
+ default=False,
574
+ )
575
+ group.add_argument(
576
+ "--watch-files",
577
+ action=argparse.BooleanOptionalAction,
578
+ default=False,
579
+ help="Enable/disable watching files for ai coding comments (default: False)",
580
+ )
581
+ group = parser.add_argument_group("Fixing and committing")
582
+ group.add_argument(
583
+ "--lint",
584
+ action="store_true",
585
+ help="Lint and fix provided files, or dirty files if none provided",
586
+ default=False,
587
+ )
588
+ group.add_argument(
589
+ "--lint-cmd",
590
+ action="append",
591
+ help=(
592
+ 'Specify lint commands to run for different languages, eg: "python: flake8'
593
+ ' --select=..." (can be used multiple times)'
594
+ ),
595
+ default=[],
596
+ )
597
+ group.add_argument(
598
+ "--auto-lint",
599
+ action=argparse.BooleanOptionalAction,
600
+ default=True,
601
+ help="Enable/disable automatic linting after changes (default: True)",
602
+ )
603
+ group.add_argument(
604
+ "--test-cmd",
605
+ help="Specify command to run tests",
606
+ default=[],
607
+ )
608
+ group.add_argument(
609
+ "--auto-test",
610
+ action=argparse.BooleanOptionalAction,
611
+ default=False,
612
+ help="Enable/disable automatic testing after changes (default: False)",
613
+ )
614
+ group.add_argument(
615
+ "--test",
616
+ action="store_true",
617
+ help="Run tests, fix problems found and then exit",
618
+ default=False,
619
+ )
620
+
621
+ ##########
622
+ group = parser.add_argument_group("Analytics")
623
+ group.add_argument(
624
+ "--analytics",
625
+ action=argparse.BooleanOptionalAction,
626
+ default=None,
627
+ help="Enable/disable analytics for current session (default: random)",
628
+ )
629
+ group.add_argument(
630
+ "--analytics-log",
631
+ metavar="ANALYTICS_LOG_FILE",
632
+ help="Specify a file to log analytics events",
633
+ ).complete = shtab.FILE
634
+ group.add_argument(
635
+ "--analytics-disable",
636
+ action="store_true",
637
+ help="Permanently disable analytics",
638
+ default=False,
639
+ )
640
+ group.add_argument(
641
+ "--analytics-posthog-host",
642
+ metavar="ANALYTICS_POSTHOG_HOST",
643
+ help="Send analytics to custom PostHog instance",
644
+ )
645
+ group.add_argument(
646
+ "--analytics-posthog-project-api-key",
647
+ metavar="ANALYTICS_POSTHOG_PROJECT_API_KEY",
648
+ help="Send analytics to custom PostHog project",
649
+ )
650
+
651
+ #########
652
+ group = parser.add_argument_group("Upgrading")
653
+ group.add_argument(
654
+ "--just-check-update",
655
+ action="store_true",
656
+ help="Check for updates and return status in the exit code",
657
+ default=False,
658
+ )
659
+ group.add_argument(
660
+ "--check-update",
661
+ action=argparse.BooleanOptionalAction,
662
+ help="Check for new aider versions on launch",
663
+ default=True,
664
+ )
665
+ group.add_argument(
666
+ "--show-release-notes",
667
+ action=argparse.BooleanOptionalAction,
668
+ help="Show release notes on first run of new version (default: None, ask user)",
669
+ default=None,
670
+ )
671
+ group.add_argument(
672
+ "--install-main-branch",
673
+ action="store_true",
674
+ help="Install the latest version from the main branch",
675
+ default=False,
676
+ )
677
+ group.add_argument(
678
+ "--upgrade",
679
+ "--update",
680
+ action="store_true",
681
+ help="Upgrade aider to the latest version from PyPI",
682
+ default=False,
683
+ )
684
+ group.add_argument(
685
+ "--version",
686
+ action="version",
687
+ version=f"%(prog)s {__version__}",
688
+ help="Show the version number and exit",
689
+ )
690
+
691
+ ##########
692
+ group = parser.add_argument_group("Modes")
693
+ group.add_argument(
694
+ "--message",
695
+ "--msg",
696
+ "-m",
697
+ metavar="COMMAND",
698
+ help=(
699
+ "Specify a single message to send the LLM, process reply then exit (disables chat mode)"
700
+ ),
701
+ )
702
+ group.add_argument(
703
+ "--message-file",
704
+ "-f",
705
+ metavar="MESSAGE_FILE",
706
+ help=(
707
+ "Specify a file containing the message to send the LLM, process reply, then exit"
708
+ " (disables chat mode)"
709
+ ),
710
+ ).complete = shtab.FILE
711
+ group.add_argument(
712
+ "--gui",
713
+ "--browser",
714
+ action=argparse.BooleanOptionalAction,
715
+ help="Run aider in your browser (default: False)",
716
+ default=False,
717
+ )
718
+ group.add_argument(
719
+ "--copy-paste",
720
+ action=argparse.BooleanOptionalAction,
721
+ default=False,
722
+ help="Enable automatic copy/paste of chat between aider and web UI (default: False)",
723
+ )
724
+ group.add_argument(
725
+ "--apply",
726
+ metavar="FILE",
727
+ help="Apply the changes from the given file instead of running the chat (debug)",
728
+ ).complete = shtab.FILE
729
+ group.add_argument(
730
+ "--apply-clipboard-edits",
731
+ action="store_true",
732
+ help="Apply clipboard contents as edits using the main model's editor format",
733
+ default=False,
734
+ )
735
+ group.add_argument(
736
+ "--exit",
737
+ action="store_true",
738
+ help="Do all startup activities then exit before accepting user input (debug)",
739
+ default=False,
740
+ )
741
+ group.add_argument(
742
+ "--show-repo-map",
743
+ action="store_true",
744
+ help="Print the repo map and exit (debug)",
745
+ default=False,
746
+ )
747
+ group.add_argument(
748
+ "--show-prompts",
749
+ action="store_true",
750
+ help="Print the system prompts and exit (debug)",
751
+ default=False,
752
+ )
753
+ group.add_argument(
754
+ "--linear-output",
755
+ action="store_true",
756
+ help=(
757
+ "Run input and output sequentially instead of us simultaneous streams (default: False)"
758
+ ),
759
+ default=False,
760
+ )
761
+ group.add_argument(
762
+ "--debug",
763
+ action="store_true",
764
+ help="Turn on verbose debugging (default: False)",
765
+ default=False,
766
+ )
767
+ ##########
768
+ group = parser.add_argument_group("Voice settings")
769
+ group.add_argument(
770
+ "--voice-format",
771
+ metavar="VOICE_FORMAT",
772
+ default="wav",
773
+ choices=["wav", "mp3", "webm"],
774
+ help="Audio format for voice recording (default: wav). webm and mp3 require ffmpeg",
775
+ )
776
+ group.add_argument(
777
+ "--voice-language",
778
+ metavar="VOICE_LANGUAGE",
779
+ default="en",
780
+ help="Specify the language for voice using ISO 639-1 code (default: auto)",
781
+ )
782
+ group.add_argument(
783
+ "--voice-input-device",
784
+ metavar="VOICE_INPUT_DEVICE",
785
+ default=None,
786
+ help="Specify the input device name for voice recording",
787
+ )
788
+
789
+ ######
790
+ group = parser.add_argument_group("Other settings")
791
+ group.add_argument(
792
+ "--preserve-todo-list",
793
+ action="store_true",
794
+ help="Preserve the existing .aider.todo.txt file on startup (default: False)",
795
+ default=False,
796
+ )
797
+ group.add_argument(
798
+ "--auto-save",
799
+ action=argparse.BooleanOptionalAction,
800
+ default=False,
801
+ help="Enable/disable automatic saving of sessions as 'auto-save' (default: False)",
802
+ )
803
+ group.add_argument(
804
+ "--auto-load",
805
+ action=argparse.BooleanOptionalAction,
806
+ default=False,
807
+ help="Enable/disable automatic loading of 'auto-save' session on startup (default: False)",
808
+ )
809
+ group.add_argument(
810
+ "--disable-playwright",
811
+ action="store_true",
812
+ help="Never prompt for or attempt to install Playwright for web scraping (default: False).",
813
+ default=False,
814
+ )
815
+ group.add_argument(
816
+ "--file",
817
+ action="append",
818
+ metavar="FILE",
819
+ help="specify a file to edit (can be used multiple times, glob patterns supported)",
820
+ ).complete = shtab.FILE
821
+ group.add_argument(
822
+ "--read",
823
+ action="append",
824
+ metavar="FILE",
825
+ help="specify a read-only file (can be used multiple times, glob patterns supported)",
826
+ ).complete = shtab.FILE
827
+ group.add_argument(
828
+ "--vim",
829
+ action="store_true",
830
+ help="Use VI editing mode in the terminal (default: False)",
831
+ default=False,
832
+ )
833
+ group.add_argument(
834
+ "--chat-language",
835
+ metavar="CHAT_LANGUAGE",
836
+ default=None,
837
+ help="Specify the language to use in the chat (default: None, uses system settings)",
838
+ )
839
+ group.add_argument(
840
+ "--commit-language",
841
+ metavar="COMMIT_LANGUAGE",
842
+ default=None,
843
+ help="Specify the language to use in the commit message (default: None, user language)",
844
+ )
845
+ group.add_argument(
846
+ "--yes-always",
847
+ action="store_true",
848
+ help="Always say yes to every confirmation",
849
+ default=None,
850
+ )
851
+ group.add_argument(
852
+ "-v",
853
+ "--verbose",
854
+ action="store_true",
855
+ help="Enable verbose output",
856
+ default=False,
857
+ )
858
+ group.add_argument(
859
+ "--load",
860
+ metavar="LOAD_FILE",
861
+ help="Load and execute /commands from a file on launch",
862
+ ).complete = shtab.FILE
863
+ group.add_argument(
864
+ "--encoding",
865
+ default="utf-8",
866
+ help="Specify the encoding for input and output (default: utf-8)",
867
+ )
868
+ group.add_argument(
869
+ "--line-endings",
870
+ choices=["platform", "lf", "crlf"],
871
+ default="platform",
872
+ help="Line endings to use when writing files (default: platform)",
873
+ )
874
+ group.add_argument(
875
+ "--mcp-servers",
876
+ metavar="MCP_CONFIG_JSON",
877
+ help="Specify MCP server configurations as a JSON string",
878
+ default=None,
879
+ )
880
+ group.add_argument(
881
+ "--mcp-servers-file",
882
+ metavar="MCP_CONFIG_FILE",
883
+ help="Specify a file path with MCP server configurations",
884
+ default=None,
885
+ )
886
+ group.add_argument(
887
+ "--mcp-transport",
888
+ metavar="MCP_TRANSPORT",
889
+ help="Specify the transport for MCP servers (default: stdio)",
890
+ default="stdio",
891
+ choices=["stdio", "http"],
892
+ )
893
+ group.add_argument(
894
+ "-c",
895
+ "--config",
896
+ is_config_file=True,
897
+ metavar="CONFIG_FILE",
898
+ help=(
899
+ "Specify the config file (default: search for .aider.conf.yml in git root, cwd"
900
+ " or home directory)"
901
+ ),
902
+ ).complete = shtab.FILE
903
+ group.add_argument(
904
+ "--agent-config",
905
+ metavar="AGENT_CONFIG_JSON",
906
+ help="Specify Agent Mode configuration as a JSON string",
907
+ default=None,
908
+ )
909
+ # This is a duplicate of the argument in the preparser and is a no-op by this time of
910
+ # argument parsing, but it's here so that the help is displayed as expected.
911
+ group.add_argument(
912
+ "--env-file",
913
+ metavar="ENV_FILE",
914
+ default=default_env_file(git_root),
915
+ help="Specify the .env file to load (default: .env in git root)",
916
+ ).complete = shtab.FILE
917
+ group.add_argument(
918
+ "--suggest-shell-commands",
919
+ action=argparse.BooleanOptionalAction,
920
+ default=True,
921
+ help="Enable/disable suggesting shell commands (default: True)",
922
+ )
923
+ group.add_argument(
924
+ "--fancy-input",
925
+ action=argparse.BooleanOptionalAction,
926
+ default=True,
927
+ help="Enable/disable fancy input with history and completion (default: True)",
928
+ )
929
+ group.add_argument(
930
+ "--multiline",
931
+ action=argparse.BooleanOptionalAction,
932
+ default=False,
933
+ help="Enable/disable multi-line input mode with Meta-Enter to submit (default: False)",
934
+ )
935
+ group.add_argument(
936
+ "--notifications",
937
+ action=argparse.BooleanOptionalAction,
938
+ default=False,
939
+ help=(
940
+ "Enable/disable terminal bell notifications when LLM responses are ready (default:"
941
+ " False)"
942
+ ),
943
+ )
944
+ group.add_argument(
945
+ "--notifications-command",
946
+ metavar="COMMAND",
947
+ default=None,
948
+ help=(
949
+ "Specify a command to run for notifications instead of the terminal bell. If not"
950
+ " specified, a default command for your OS may be used."
951
+ ),
952
+ )
953
+ group.add_argument(
954
+ "--detect-urls",
955
+ action=argparse.BooleanOptionalAction,
956
+ default=True,
957
+ help="Enable/disable detection and offering to add URLs to chat (default: True)",
958
+ )
959
+ group.add_argument(
960
+ "--editor",
961
+ help="Specify which editor to use for the /editor command",
962
+ )
963
+
964
+ supported_shells_list = sorted(list(shtab.SUPPORTED_SHELLS))
965
+ group.add_argument(
966
+ "--shell-completions",
967
+ metavar="SHELL",
968
+ choices=supported_shells_list,
969
+ help=(
970
+ "Print shell completion script for the specified SHELL and exit. Supported shells:"
971
+ f" {', '.join(supported_shells_list)}. Example: aider --shell-completions bash"
972
+ ),
973
+ )
974
+
975
+ ##########
976
+ group = parser.add_argument_group("Deprecated model settings")
977
+ # Add deprecated model shortcut arguments
978
+ add_deprecated_model_args(parser, group)
979
+
980
+ return parser
981
+
982
+
983
+ def get_md_help():
984
+ os.environ["COLUMNS"] = "70"
985
+ sys.argv = ["aider"]
986
+ parser = get_parser([], None)
987
+
988
+ # This instantiates all the action.env_var values
989
+ parser.parse_known_args()
990
+
991
+ parser.formatter_class = MarkdownHelpFormatter
992
+
993
+ return argparse.ArgumentParser.format_help(parser)
994
+
995
+
996
+ def get_sample_yaml():
997
+ os.environ["COLUMNS"] = "100"
998
+ sys.argv = ["aider"]
999
+ parser = get_parser([], None)
1000
+
1001
+ # This instantiates all the action.env_var values
1002
+ parser.parse_known_args()
1003
+
1004
+ parser.formatter_class = YamlHelpFormatter
1005
+
1006
+ return argparse.ArgumentParser.format_help(parser)
1007
+
1008
+
1009
+ def get_sample_dotenv():
1010
+ os.environ["COLUMNS"] = "120"
1011
+ sys.argv = ["aider"]
1012
+ parser = get_parser([], None)
1013
+
1014
+ # This instantiates all the action.env_var values
1015
+ parser.parse_known_args()
1016
+
1017
+ parser.formatter_class = DotEnvFormatter
1018
+
1019
+ return argparse.ArgumentParser.format_help(parser)
1020
+
1021
+
1022
+ def main():
1023
+ if len(sys.argv) > 1:
1024
+ command = sys.argv[1]
1025
+ else:
1026
+ command = "yaml" # Default to yaml if no command is given
1027
+
1028
+ if command == "md":
1029
+ print(get_md_help())
1030
+ elif command == "dotenv":
1031
+ print(get_sample_dotenv())
1032
+ elif command == "yaml":
1033
+ print(get_sample_yaml())
1034
+ elif command == "completion":
1035
+ if len(sys.argv) > 2:
1036
+ shell = sys.argv[2]
1037
+ if shell not in shtab.SUPPORTED_SHELLS:
1038
+ print(f"Error: Unsupported shell '{shell}'.", file=sys.stderr)
1039
+ print(f"Supported shells are: {', '.join(shtab.SUPPORTED_SHELLS)}", file=sys.stderr)
1040
+ sys.exit(1)
1041
+ parser = get_parser([], None)
1042
+ parser.prog = "aider" # Set the program name on the parser
1043
+ print(shtab.complete(parser, shell=shell))
1044
+ else:
1045
+ print("Error: Please specify a shell for completion.", file=sys.stderr)
1046
+ print(f"Usage: python {sys.argv[0]} completion <shell_name>", file=sys.stderr)
1047
+ print(f"Supported shells are: {', '.join(shtab.SUPPORTED_SHELLS)}", file=sys.stderr)
1048
+ sys.exit(1)
1049
+ else:
1050
+ # Default to YAML for any other unrecognized argument, or if 'yaml' was explicitly passed
1051
+ print(get_sample_yaml())
1052
+
1053
+
1054
+ if __name__ == "__main__":
1055
+ status = main()
1056
+ sys.exit(status)