aider-ce 0.88.20__py3-none-any.whl → 0.88.38__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 +1 -1
- aider/_version.py +2 -2
- aider/args.py +63 -43
- aider/coders/agent_coder.py +331 -79
- aider/coders/agent_prompts.py +3 -15
- aider/coders/architect_coder.py +21 -5
- aider/coders/base_coder.py +661 -413
- aider/coders/base_prompts.py +6 -3
- aider/coders/chat_chunks.py +39 -17
- aider/commands.py +79 -15
- aider/diffs.py +10 -9
- aider/exceptions.py +1 -1
- aider/helpers/coroutines.py +8 -0
- aider/helpers/requests.py +45 -0
- aider/history.py +5 -0
- aider/io.py +179 -25
- aider/main.py +86 -35
- aider/models.py +16 -8
- aider/queries/tree-sitter-language-pack/c-tags.scm +3 -0
- aider/queries/tree-sitter-language-pack/clojure-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/commonlisp-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/cpp-tags.scm +3 -0
- aider/queries/tree-sitter-language-pack/csharp-tags.scm +6 -0
- aider/queries/tree-sitter-language-pack/dart-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/elixir-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/elm-tags.scm +3 -0
- aider/queries/tree-sitter-language-pack/go-tags.scm +7 -0
- aider/queries/tree-sitter-language-pack/java-tags.scm +6 -0
- aider/queries/tree-sitter-language-pack/javascript-tags.scm +8 -0
- aider/queries/tree-sitter-language-pack/lua-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +3 -0
- aider/queries/tree-sitter-language-pack/python-tags.scm +10 -0
- aider/queries/tree-sitter-language-pack/r-tags.scm +6 -0
- aider/queries/tree-sitter-language-pack/ruby-tags.scm +5 -0
- aider/queries/tree-sitter-language-pack/rust-tags.scm +3 -0
- aider/queries/tree-sitter-language-pack/solidity-tags.scm +1 -1
- aider/queries/tree-sitter-language-pack/swift-tags.scm +4 -1
- aider/queries/tree-sitter-languages/c-tags.scm +3 -0
- aider/queries/tree-sitter-languages/c_sharp-tags.scm +6 -0
- aider/queries/tree-sitter-languages/cpp-tags.scm +3 -0
- aider/queries/tree-sitter-languages/dart-tags.scm +2 -1
- aider/queries/tree-sitter-languages/elixir-tags.scm +5 -0
- aider/queries/tree-sitter-languages/elm-tags.scm +3 -0
- aider/queries/tree-sitter-languages/fortran-tags.scm +3 -0
- aider/queries/tree-sitter-languages/go-tags.scm +6 -0
- aider/queries/tree-sitter-languages/haskell-tags.scm +2 -0
- aider/queries/tree-sitter-languages/java-tags.scm +6 -0
- aider/queries/tree-sitter-languages/javascript-tags.scm +8 -0
- aider/queries/tree-sitter-languages/julia-tags.scm +2 -2
- aider/queries/tree-sitter-languages/kotlin-tags.scm +3 -0
- aider/queries/tree-sitter-languages/ocaml_interface-tags.scm +6 -0
- aider/queries/tree-sitter-languages/php-tags.scm +6 -0
- aider/queries/tree-sitter-languages/python-tags.scm +10 -0
- aider/queries/tree-sitter-languages/ruby-tags.scm +5 -0
- aider/queries/tree-sitter-languages/rust-tags.scm +3 -0
- aider/queries/tree-sitter-languages/scala-tags.scm +2 -3
- aider/queries/tree-sitter-languages/typescript-tags.scm +3 -0
- aider/queries/tree-sitter-languages/zig-tags.scm +20 -3
- aider/repomap.py +71 -11
- aider/resources/model-metadata.json +27335 -635
- aider/resources/model-settings.yml +190 -0
- aider/scrape.py +2 -0
- aider/tools/__init__.py +2 -0
- aider/tools/command.py +84 -94
- aider/tools/command_interactive.py +95 -110
- aider/tools/delete_block.py +131 -159
- aider/tools/delete_line.py +97 -132
- aider/tools/delete_lines.py +120 -160
- aider/tools/extract_lines.py +288 -312
- aider/tools/finished.py +30 -43
- aider/tools/git_branch.py +107 -109
- aider/tools/git_diff.py +44 -56
- aider/tools/git_log.py +39 -53
- aider/tools/git_remote.py +37 -51
- aider/tools/git_show.py +33 -47
- aider/tools/git_status.py +30 -44
- aider/tools/grep.py +214 -242
- aider/tools/indent_lines.py +175 -201
- aider/tools/insert_block.py +220 -253
- aider/tools/list_changes.py +65 -80
- aider/tools/ls.py +64 -80
- aider/tools/make_editable.py +57 -73
- aider/tools/make_readonly.py +50 -66
- aider/tools/remove.py +64 -80
- aider/tools/replace_all.py +96 -109
- aider/tools/replace_line.py +118 -156
- aider/tools/replace_lines.py +160 -197
- aider/tools/replace_text.py +159 -160
- aider/tools/show_numbered_context.py +115 -141
- aider/tools/thinking.py +52 -0
- aider/tools/undo_change.py +78 -91
- aider/tools/update_todo_list.py +130 -138
- aider/tools/utils/base_tool.py +64 -0
- aider/tools/utils/output.py +118 -0
- aider/tools/view.py +38 -54
- aider/tools/view_files_matching.py +131 -134
- aider/tools/view_files_with_symbol.py +108 -120
- aider/urls.py +1 -1
- aider/versioncheck.py +4 -3
- aider/website/docs/config/adv-model-settings.md +237 -0
- aider/website/docs/config/agent-mode.md +36 -3
- aider/website/docs/config/model-aliases.md +2 -1
- aider/website/docs/faq.md +6 -11
- aider/website/docs/languages.md +2 -2
- aider/website/docs/more/infinite-output.md +27 -0
- {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/METADATA +112 -70
- {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/RECORD +112 -107
- aider_ce-0.88.38.dist-info/entry_points.txt +6 -0
- aider_ce-0.88.20.dist-info/entry_points.txt +0 -2
- /aider/tools/{tool_utils.py → utils/helpers.py} +0 -0
- {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/WHEEL +0 -0
- {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/licenses/LICENSE.txt +0 -0
- {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/top_level.txt +0 -0
|
@@ -1381,6 +1381,14 @@
|
|
|
1381
1381
|
use_repo_map: true
|
|
1382
1382
|
weak_model_name: openrouter/google/gemini-2.0-flash-001
|
|
1383
1383
|
|
|
1384
|
+
- name: gemini/gemini-3-pro-preview
|
|
1385
|
+
overeager: true
|
|
1386
|
+
edit_format: diff-fenced
|
|
1387
|
+
use_repo_map: true
|
|
1388
|
+
weak_model_name: gemini/gemini-2.5-flash
|
|
1389
|
+
use_temperature: false
|
|
1390
|
+
accepts_settings: ["reasoning_effort", "thinking_tokens"]
|
|
1391
|
+
|
|
1384
1392
|
- name: gemini/gemini-2.5-pro-preview-05-06
|
|
1385
1393
|
overeager: true
|
|
1386
1394
|
edit_format: diff-fenced
|
|
@@ -1465,6 +1473,21 @@
|
|
|
1465
1473
|
weak_model_name: openrouter/google/gemini-2.5-flash
|
|
1466
1474
|
accepts_settings: ["thinking_tokens"]
|
|
1467
1475
|
|
|
1476
|
+
- name: vertex_ai/gemini-3-pro-preview
|
|
1477
|
+
edit_format: diff-fenced
|
|
1478
|
+
use_repo_map: true
|
|
1479
|
+
weak_model_name: vertex_ai/gemini-2.5-flash
|
|
1480
|
+
overeager: true
|
|
1481
|
+
editor_model_name: vertex_ai/gemini-2.5-flash
|
|
1482
|
+
accepts_settings: ["thinking_tokens"]
|
|
1483
|
+
|
|
1484
|
+
- name: openrouter/google/gemini-3-pro-preview
|
|
1485
|
+
overeager: true
|
|
1486
|
+
edit_format: diff-fenced
|
|
1487
|
+
use_repo_map: true
|
|
1488
|
+
weak_model_name: openrouter/google/gemini-2.5-flash
|
|
1489
|
+
accepts_settings: ["thinking_tokens"]
|
|
1490
|
+
|
|
1468
1491
|
#- name: openrouter/qwen/qwen3-235b-a22b
|
|
1469
1492
|
# system_prompt_prefix: "/no_think"
|
|
1470
1493
|
# use_temperature: 0.7
|
|
@@ -1834,6 +1857,21 @@
|
|
|
1834
1857
|
accepts_settings: ["thinking_tokens"]
|
|
1835
1858
|
|
|
1836
1859
|
# GPT-5 family
|
|
1860
|
+
- name: gpt-5.1
|
|
1861
|
+
edit_format: diff
|
|
1862
|
+
weak_model_name: gpt-5-nano
|
|
1863
|
+
use_repo_map: true
|
|
1864
|
+
use_temperature: false
|
|
1865
|
+
accepts_settings: ["reasoning_effort"]
|
|
1866
|
+
overeager: true
|
|
1867
|
+
|
|
1868
|
+
- name: gpt-5.1-2025-11-13
|
|
1869
|
+
edit_format: diff
|
|
1870
|
+
weak_model_name: gpt-5-nano-2025-08-07
|
|
1871
|
+
use_repo_map: true
|
|
1872
|
+
use_temperature: false
|
|
1873
|
+
accepts_settings: ["reasoning_effort"]
|
|
1874
|
+
|
|
1837
1875
|
- name: gpt-5
|
|
1838
1876
|
edit_format: diff
|
|
1839
1877
|
weak_model_name: gpt-5-nano
|
|
@@ -1842,6 +1880,18 @@
|
|
|
1842
1880
|
accepts_settings: ["reasoning_effort"]
|
|
1843
1881
|
overeager: true
|
|
1844
1882
|
|
|
1883
|
+
- name: gpt-5-pro
|
|
1884
|
+
streaming: false
|
|
1885
|
+
edit_format: diff
|
|
1886
|
+
weak_model_name: gpt-5-mini
|
|
1887
|
+
use_repo_map: true
|
|
1888
|
+
editor_model_name: gpt-5
|
|
1889
|
+
editor_edit_format: editor-diff
|
|
1890
|
+
system_prompt_prefix: "Formatting re-enabled. "
|
|
1891
|
+
accepts_settings: ["reasoning_effort"]
|
|
1892
|
+
examples_as_sys_msg: true
|
|
1893
|
+
use_temperature: false
|
|
1894
|
+
|
|
1845
1895
|
- name: gpt-5-2025-08-07
|
|
1846
1896
|
edit_format: diff
|
|
1847
1897
|
weak_model_name: gpt-5-nano-2025-08-07
|
|
@@ -1891,6 +1941,20 @@
|
|
|
1891
1941
|
use_temperature: false
|
|
1892
1942
|
accepts_settings: ["reasoning_effort"]
|
|
1893
1943
|
|
|
1944
|
+
- name: gpt-5.1-chat
|
|
1945
|
+
edit_format: diff
|
|
1946
|
+
weak_model_name: gpt-5-nano
|
|
1947
|
+
use_repo_map: true
|
|
1948
|
+
use_temperature: false
|
|
1949
|
+
accepts_settings: ["reasoning_effort"]
|
|
1950
|
+
|
|
1951
|
+
- name: gpt-5.1-chat-latest
|
|
1952
|
+
edit_format: diff
|
|
1953
|
+
weak_model_name: gpt-5-nano
|
|
1954
|
+
use_repo_map: true
|
|
1955
|
+
use_temperature: false
|
|
1956
|
+
accepts_settings: ["reasoning_effort"]
|
|
1957
|
+
|
|
1894
1958
|
- name: gpt-5-codex
|
|
1895
1959
|
edit_format: diff
|
|
1896
1960
|
weak_model_name: gpt-5-nano
|
|
@@ -1898,6 +1962,13 @@
|
|
|
1898
1962
|
use_temperature: false
|
|
1899
1963
|
accepts_settings: ["reasoning_effort"]
|
|
1900
1964
|
|
|
1965
|
+
- name: gpt-5.1-codex
|
|
1966
|
+
edit_format: diff
|
|
1967
|
+
weak_model_name: gpt-5-nano
|
|
1968
|
+
use_repo_map: true
|
|
1969
|
+
use_temperature: false
|
|
1970
|
+
accepts_settings: ["reasoning_effort"]
|
|
1971
|
+
|
|
1901
1972
|
- name: azure/gpt-5
|
|
1902
1973
|
edit_format: diff
|
|
1903
1974
|
weak_model_name: azure/gpt-5-nano
|
|
@@ -1905,6 +1976,18 @@
|
|
|
1905
1976
|
use_temperature: false
|
|
1906
1977
|
accepts_settings: ["reasoning_effort"]
|
|
1907
1978
|
|
|
1979
|
+
- name: azure/gpt-5-pro
|
|
1980
|
+
streaming: false
|
|
1981
|
+
edit_format: diff
|
|
1982
|
+
weak_model_name: azure/gpt-5-mini
|
|
1983
|
+
use_repo_map: true
|
|
1984
|
+
editor_model_name: azure/gpt-5
|
|
1985
|
+
editor_edit_format: editor-diff
|
|
1986
|
+
system_prompt_prefix: "Formatting re-enabled. "
|
|
1987
|
+
accepts_settings: ["reasoning_effort"]
|
|
1988
|
+
examples_as_sys_msg: true
|
|
1989
|
+
use_temperature: false
|
|
1990
|
+
|
|
1908
1991
|
- name: azure/gpt-5-2025-08-07
|
|
1909
1992
|
edit_format: diff
|
|
1910
1993
|
weak_model_name: azure/gpt-5-nano-2025-08-07
|
|
@@ -1912,6 +1995,20 @@
|
|
|
1912
1995
|
use_temperature: false
|
|
1913
1996
|
accepts_settings: ["reasoning_effort"]
|
|
1914
1997
|
|
|
1998
|
+
- name: azure/gpt-5.1
|
|
1999
|
+
edit_format: diff
|
|
2000
|
+
weak_model_name: azure/gpt-5-nano
|
|
2001
|
+
use_repo_map: true
|
|
2002
|
+
use_temperature: false
|
|
2003
|
+
accepts_settings: ["reasoning_effort"]
|
|
2004
|
+
|
|
2005
|
+
- name: azure/gpt-5.1-2025-11-13
|
|
2006
|
+
edit_format: diff
|
|
2007
|
+
weak_model_name: azure/gpt-5-nano-2025-08-07
|
|
2008
|
+
use_repo_map: true
|
|
2009
|
+
use_temperature: false
|
|
2010
|
+
accepts_settings: ["reasoning_effort"]
|
|
2011
|
+
|
|
1915
2012
|
- name: azure/gpt-5-mini
|
|
1916
2013
|
edit_format: diff
|
|
1917
2014
|
weak_model_name: azure/gpt-5-nano
|
|
@@ -1954,6 +2051,20 @@
|
|
|
1954
2051
|
use_temperature: false
|
|
1955
2052
|
accepts_settings: ["reasoning_effort"]
|
|
1956
2053
|
|
|
2054
|
+
- name: azure/gpt-5.1-chat
|
|
2055
|
+
edit_format: diff
|
|
2056
|
+
weak_model_name: azure/gpt-5-nano
|
|
2057
|
+
use_repo_map: true
|
|
2058
|
+
use_temperature: false
|
|
2059
|
+
accepts_settings: ["reasoning_effort"]
|
|
2060
|
+
|
|
2061
|
+
- name: azure/gpt-5.1-chat-latest
|
|
2062
|
+
edit_format: diff
|
|
2063
|
+
weak_model_name: azure/gpt-5-nano
|
|
2064
|
+
use_repo_map: true
|
|
2065
|
+
use_temperature: false
|
|
2066
|
+
accepts_settings: ["reasoning_effort"]
|
|
2067
|
+
|
|
1957
2068
|
- name: openai/gpt-5
|
|
1958
2069
|
edit_format: diff
|
|
1959
2070
|
weak_model_name: openai/gpt-5-nano
|
|
@@ -1961,6 +2072,18 @@
|
|
|
1961
2072
|
use_temperature: false
|
|
1962
2073
|
accepts_settings: ["reasoning_effort"]
|
|
1963
2074
|
|
|
2075
|
+
- name: openai/gpt-5-pro
|
|
2076
|
+
streaming: false
|
|
2077
|
+
edit_format: diff
|
|
2078
|
+
weak_model_name: openai/gpt-5-mini
|
|
2079
|
+
use_repo_map: true
|
|
2080
|
+
editor_model_name: openai/gpt-5
|
|
2081
|
+
editor_edit_format: editor-diff
|
|
2082
|
+
system_prompt_prefix: "Formatting re-enabled. "
|
|
2083
|
+
accepts_settings: ["reasoning_effort"]
|
|
2084
|
+
examples_as_sys_msg: true
|
|
2085
|
+
use_temperature: false
|
|
2086
|
+
|
|
1964
2087
|
- name: openai/gpt-5-2025-08-07
|
|
1965
2088
|
edit_format: diff
|
|
1966
2089
|
weak_model_name: openai/gpt-5-nano-2025-08-07
|
|
@@ -1968,6 +2091,20 @@
|
|
|
1968
2091
|
use_temperature: false
|
|
1969
2092
|
accepts_settings: ["reasoning_effort"]
|
|
1970
2093
|
|
|
2094
|
+
- name: openai/gpt-5.1
|
|
2095
|
+
edit_format: diff
|
|
2096
|
+
weak_model_name: openai/gpt-5-nano
|
|
2097
|
+
use_repo_map: true
|
|
2098
|
+
use_temperature: false
|
|
2099
|
+
accepts_settings: ["reasoning_effort"]
|
|
2100
|
+
|
|
2101
|
+
- name: openai/gpt-5.1-2025-11-13
|
|
2102
|
+
edit_format: diff
|
|
2103
|
+
weak_model_name: openai/gpt-5-nano-2025-08-07
|
|
2104
|
+
use_repo_map: true
|
|
2105
|
+
use_temperature: false
|
|
2106
|
+
accepts_settings: ["reasoning_effort"]
|
|
2107
|
+
|
|
1971
2108
|
- name: openai/gpt-5-mini
|
|
1972
2109
|
edit_format: diff
|
|
1973
2110
|
weak_model_name: openai/gpt-5-nano
|
|
@@ -2010,6 +2147,20 @@
|
|
|
2010
2147
|
use_temperature: false
|
|
2011
2148
|
accepts_settings: ["reasoning_effort"]
|
|
2012
2149
|
|
|
2150
|
+
- name: openai/gpt-5.1-chat
|
|
2151
|
+
edit_format: diff
|
|
2152
|
+
weak_model_name: openai/gpt-5-nano
|
|
2153
|
+
use_repo_map: true
|
|
2154
|
+
use_temperature: false
|
|
2155
|
+
accepts_settings: ["reasoning_effort"]
|
|
2156
|
+
|
|
2157
|
+
- name: openai/gpt-5.1-chat-latest
|
|
2158
|
+
edit_format: diff
|
|
2159
|
+
weak_model_name: openai/gpt-5-nano
|
|
2160
|
+
use_repo_map: true
|
|
2161
|
+
use_temperature: false
|
|
2162
|
+
accepts_settings: ["reasoning_effort"]
|
|
2163
|
+
|
|
2013
2164
|
- name: openrouter/openai/gpt-5
|
|
2014
2165
|
edit_format: diff
|
|
2015
2166
|
weak_model_name: openrouter/openai/gpt-5-nano
|
|
@@ -2017,6 +2168,18 @@
|
|
|
2017
2168
|
use_temperature: false
|
|
2018
2169
|
accepts_settings: ["reasoning_effort"]
|
|
2019
2170
|
|
|
2171
|
+
- name: openrouter/openai/gpt-5-pro
|
|
2172
|
+
streaming: false
|
|
2173
|
+
edit_format: diff
|
|
2174
|
+
weak_model_name: openrouter/openai/gpt-5-mini
|
|
2175
|
+
use_repo_map: true
|
|
2176
|
+
editor_model_name: openrouter/openai/gpt-5
|
|
2177
|
+
editor_edit_format: editor-diff
|
|
2178
|
+
system_prompt_prefix: "Formatting re-enabled. "
|
|
2179
|
+
accepts_settings: ["reasoning_effort"]
|
|
2180
|
+
examples_as_sys_msg: true
|
|
2181
|
+
use_temperature: false
|
|
2182
|
+
|
|
2020
2183
|
- name: openrouter/openai/gpt-5-2025-08-07
|
|
2021
2184
|
edit_format: diff
|
|
2022
2185
|
weak_model_name: openrouter/openai/gpt-5-nano-2025-08-07
|
|
@@ -2024,6 +2187,20 @@
|
|
|
2024
2187
|
use_temperature: false
|
|
2025
2188
|
accepts_settings: ["reasoning_effort"]
|
|
2026
2189
|
|
|
2190
|
+
- name: openrouter/openai/gpt-5.1
|
|
2191
|
+
edit_format: diff
|
|
2192
|
+
weak_model_name: openrouter/openai/gpt-5-nano
|
|
2193
|
+
use_repo_map: true
|
|
2194
|
+
use_temperature: false
|
|
2195
|
+
accepts_settings: ["reasoning_effort"]
|
|
2196
|
+
|
|
2197
|
+
- name: openrouter/openai/gpt-5.1-2025-11-13
|
|
2198
|
+
edit_format: diff
|
|
2199
|
+
weak_model_name: openrouter/openai/gpt-5-nano-2025-08-07
|
|
2200
|
+
use_repo_map: true
|
|
2201
|
+
use_temperature: false
|
|
2202
|
+
accepts_settings: ["reasoning_effort"]
|
|
2203
|
+
|
|
2027
2204
|
- name: openrouter/openai/gpt-5-mini
|
|
2028
2205
|
edit_format: diff
|
|
2029
2206
|
weak_model_name: openrouter/openai/gpt-5-nano
|
|
@@ -2066,3 +2243,16 @@
|
|
|
2066
2243
|
use_temperature: false
|
|
2067
2244
|
accepts_settings: ["reasoning_effort"]
|
|
2068
2245
|
|
|
2246
|
+
- name: openrouter/openai/gpt-5.1-chat
|
|
2247
|
+
edit_format: diff
|
|
2248
|
+
weak_model_name: openrouter/openai/gpt-5-nano
|
|
2249
|
+
use_repo_map: true
|
|
2250
|
+
use_temperature: false
|
|
2251
|
+
accepts_settings: ["reasoning_effort"]
|
|
2252
|
+
|
|
2253
|
+
- name: openrouter/openai/gpt-5.1-chat-latest
|
|
2254
|
+
edit_format: diff
|
|
2255
|
+
weak_model_name: openrouter/openai/gpt-5-nano
|
|
2256
|
+
use_repo_map: true
|
|
2257
|
+
use_temperature: false
|
|
2258
|
+
accepts_settings: ["reasoning_effort"]
|
aider/scrape.py
CHANGED
aider/tools/__init__.py
CHANGED
|
@@ -29,6 +29,7 @@ from . import (
|
|
|
29
29
|
replace_lines,
|
|
30
30
|
replace_text,
|
|
31
31
|
show_numbered_context,
|
|
32
|
+
thinking,
|
|
32
33
|
undo_change,
|
|
33
34
|
update_todo_list,
|
|
34
35
|
view,
|
|
@@ -64,6 +65,7 @@ TOOL_MODULES = [
|
|
|
64
65
|
replace_lines,
|
|
65
66
|
replace_text,
|
|
66
67
|
show_numbered_context,
|
|
68
|
+
thinking,
|
|
67
69
|
undo_change,
|
|
68
70
|
update_todo_list,
|
|
69
71
|
view,
|
aider/tools/command.py
CHANGED
|
@@ -1,105 +1,95 @@
|
|
|
1
1
|
# Import necessary functions
|
|
2
2
|
from aider.run_cmd import run_cmd_subprocess
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
from aider.tools.utils.base_tool import BaseTool
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Tool(BaseTool):
|
|
7
|
+
NORM_NAME = "command"
|
|
8
|
+
SCHEMA = {
|
|
9
|
+
"type": "function",
|
|
10
|
+
"function": {
|
|
11
|
+
"name": "Command",
|
|
12
|
+
"description": "Execute a shell command.",
|
|
13
|
+
"parameters": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"command_string": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "The shell command to execute.",
|
|
19
|
+
},
|
|
15
20
|
},
|
|
21
|
+
"required": ["command_string"],
|
|
16
22
|
},
|
|
17
|
-
"required": ["command_string"],
|
|
18
23
|
},
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@classmethod
|
|
27
|
+
async def execute(cls, coder, command_string):
|
|
28
|
+
"""
|
|
29
|
+
Execute a non-interactive shell command after user confirmation.
|
|
30
|
+
"""
|
|
31
|
+
try:
|
|
32
|
+
# Ask for confirmation before executing.
|
|
33
|
+
# allow_never=True enables the 'Always' option.
|
|
34
|
+
# confirm_ask handles remembering the 'Always' choice based on the subject.
|
|
35
|
+
if command_string and getattr(coder.args, "command_prefix", None):
|
|
36
|
+
command_prefix = getattr(coder.args, "command_prefix", None)
|
|
37
|
+
command_string = f"{command_prefix} {command_string}"
|
|
38
|
+
|
|
39
|
+
confirmed = (
|
|
40
|
+
True
|
|
41
|
+
if coder.skip_cli_confirmations
|
|
42
|
+
else await coder.io.confirm_ask(
|
|
43
|
+
"Allow execution of this command?",
|
|
44
|
+
subject=command_string,
|
|
45
|
+
explicit_yes_required=True, # Require explicit 'yes' or 'always'
|
|
46
|
+
allow_never=True, # Enable the 'Always' option
|
|
47
|
+
group_response="Command Tool",
|
|
48
|
+
)
|
|
44
49
|
)
|
|
45
|
-
)
|
|
46
|
-
|
|
47
|
-
await coder.io.recreate_input()
|
|
48
|
-
|
|
49
|
-
if not confirmed:
|
|
50
|
-
# This happens if the user explicitly says 'no' this time.
|
|
51
|
-
# If 'Always' was chosen previously, confirm_ask returns True directly.
|
|
52
|
-
coder.io.tool_output(f"Skipped execution of shell command: {command_string}")
|
|
53
|
-
return "Shell command execution skipped by user."
|
|
54
50
|
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
if not confirmed:
|
|
52
|
+
# This happens if the user explicitly says 'no' this time.
|
|
53
|
+
# If 'Always' was chosen previously, confirm_ask returns True directly.
|
|
54
|
+
coder.io.tool_output(f"Skipped execution of shell command: {command_string}")
|
|
55
|
+
return "Shell command execution skipped by user."
|
|
57
56
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
command_string, verbose=coder.verbose, cwd=coder.root # Execute in the project root
|
|
61
|
-
)
|
|
57
|
+
# Proceed with execution if confirmed is True
|
|
58
|
+
coder.io.tool_output(f"⚙️ Executing non-interactive shell command: {command_string}")
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
# Truncate and add a clear message using the constant value
|
|
69
|
-
output_content = (
|
|
70
|
-
output_content[:output_limit]
|
|
71
|
-
+ f"\n... (output truncated at {output_limit} characters, based on"
|
|
72
|
-
" large_file_token_threshold)"
|
|
60
|
+
# Use run_cmd_subprocess for non-interactive execution
|
|
61
|
+
exit_status, combined_output = run_cmd_subprocess(
|
|
62
|
+
command_string,
|
|
63
|
+
verbose=coder.verbose,
|
|
64
|
+
cwd=coder.root, # Execute in the project root
|
|
73
65
|
)
|
|
74
66
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
else:
|
|
105
|
-
return "Error: Missing 'command_string' parameter for Command"
|
|
67
|
+
# Format the output for the result message, include more content
|
|
68
|
+
output_content = combined_output or ""
|
|
69
|
+
# Use the existing token threshold constant as the character limit for truncation
|
|
70
|
+
output_limit = coder.large_file_token_threshold
|
|
71
|
+
if len(output_content) > output_limit:
|
|
72
|
+
# Truncate and add a clear message using the constant value
|
|
73
|
+
output_content = (
|
|
74
|
+
output_content[:output_limit]
|
|
75
|
+
+ f"\n... (output truncated at {output_limit} characters, based on"
|
|
76
|
+
" large_file_token_threshold)"
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
if exit_status == 0:
|
|
80
|
+
return (
|
|
81
|
+
f"Shell command executed successfully (exit code 0). Output:\n{output_content}"
|
|
82
|
+
)
|
|
83
|
+
else:
|
|
84
|
+
return (
|
|
85
|
+
f"Shell command failed with exit code {exit_status}. Output:\n{output_content}"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
except Exception as e:
|
|
89
|
+
coder.io.tool_error(
|
|
90
|
+
f"Error executing non-interactive shell command '{command_string}': {str(e)}"
|
|
91
|
+
)
|
|
92
|
+
# Optionally include traceback for debugging if verbose
|
|
93
|
+
# if coder.verbose:
|
|
94
|
+
# coder.io.tool_error(traceback.format_exc())
|
|
95
|
+
return f"Error executing command: {str(e)}"
|