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
|
@@ -18,3 +18,9 @@
|
|
|
18
18
|
type: (type_identifier) @name.reference.class) @reference.class
|
|
19
19
|
|
|
20
20
|
(superclass (type_identifier) @name.reference.class) @reference.class
|
|
21
|
+
|
|
22
|
+
(import_declaration
|
|
23
|
+
(scoped_identifier) @name.reference.import) @reference.import
|
|
24
|
+
|
|
25
|
+
(import_declaration
|
|
26
|
+
(identifier) @name.reference.import) @reference.import
|
|
@@ -86,3 +86,11 @@
|
|
|
86
86
|
|
|
87
87
|
(new_expression
|
|
88
88
|
constructor: (_) @name.reference.class) @reference.class
|
|
89
|
+
|
|
90
|
+
(import_statement
|
|
91
|
+
source: (string (string_fragment) @name.reference.import)) @reference.import
|
|
92
|
+
|
|
93
|
+
(call_expression
|
|
94
|
+
function: (identifier) @import_func
|
|
95
|
+
arguments: (arguments (string (string_fragment) @name.reference.import))
|
|
96
|
+
(#eq? @import_func "require")) @reference.import
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
(identifier) @name.reference.export) @reference.export
|
|
55
55
|
|
|
56
56
|
(using_statement
|
|
57
|
-
(identifier) @name.reference.
|
|
57
|
+
(identifier) @name.reference.import) @reference.import
|
|
58
58
|
|
|
59
59
|
(import_statement
|
|
60
|
-
(identifier) @name.reference.
|
|
60
|
+
(identifier) @name.reference.import) @reference.import
|
|
@@ -24,3 +24,9 @@
|
|
|
24
24
|
|
|
25
25
|
(member_call_expression
|
|
26
26
|
name: (name) @name.reference.call) @reference.call
|
|
27
|
+
|
|
28
|
+
(namespace_use_declaration
|
|
29
|
+
(namespace_use_clause (qualified_name) @name.reference.import)) @reference.import
|
|
30
|
+
|
|
31
|
+
(require_expression (string) @name.reference.import) @reference.import
|
|
32
|
+
(include_expression (string) @name.reference.import) @reference.import
|
|
@@ -10,3 +10,13 @@
|
|
|
10
10
|
(attribute
|
|
11
11
|
attribute: (identifier) @name.reference.call)
|
|
12
12
|
]) @reference.call
|
|
13
|
+
|
|
14
|
+
(import_statement
|
|
15
|
+
name: (dotted_name) @name.reference.import) @reference.import
|
|
16
|
+
|
|
17
|
+
(import_statement
|
|
18
|
+
name: (aliased_import
|
|
19
|
+
name: (dotted_name) @name.reference.import)) @reference.import
|
|
20
|
+
|
|
21
|
+
(import_from_statement
|
|
22
|
+
module_name: (dotted_name) @name.reference.import) @reference.import
|
|
@@ -62,3 +62,8 @@
|
|
|
62
62
|
(#is-not? local)
|
|
63
63
|
(#not-match? @name.reference.call "^(lambda|load|require|require_relative|__FILE__|__LINE__)$")
|
|
64
64
|
)
|
|
65
|
+
|
|
66
|
+
(call
|
|
67
|
+
method: (identifier) @import_method
|
|
68
|
+
arguments: (argument_list (string (string_content) @name.reference.import))
|
|
69
|
+
(#match? @import_method "^(require|require_relative|load)$")) @reference.import
|
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
(FnProto
|
|
2
|
-
(
|
|
3
|
-
|
|
1
|
+
(FnProto
|
|
2
|
+
(IDENTIFIER) @name.definition.function) @definition.function
|
|
3
|
+
|
|
4
|
+
(VarDecl
|
|
5
|
+
"const"
|
|
6
|
+
(IDENTIFIER) @name.definition.constant) @definition.constant
|
|
7
|
+
|
|
8
|
+
(VarDecl
|
|
9
|
+
"var"
|
|
10
|
+
(IDENTIFIER) @name.definition.variable) @definition.variable
|
|
11
|
+
|
|
12
|
+
(
|
|
13
|
+
(SuffixExpr
|
|
14
|
+
(BUILTINIDENTIFIER) @func
|
|
15
|
+
(FnCallArguments
|
|
16
|
+
(ErrorUnionExpr
|
|
17
|
+
(SuffixExpr
|
|
18
|
+
(STRINGLITERALSINGLE) @name.reference.import)))) @reference.import
|
|
19
|
+
(#eq? @func "@import")
|
|
20
|
+
)
|
aider/repomap.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import math
|
|
2
2
|
import os
|
|
3
|
+
import re
|
|
3
4
|
import shutil
|
|
4
5
|
import sqlite3
|
|
5
6
|
import sys
|
|
@@ -23,7 +24,7 @@ from aider.helpers.similarity import (
|
|
|
23
24
|
normalize_vector,
|
|
24
25
|
)
|
|
25
26
|
from aider.special import filter_important_files
|
|
26
|
-
from aider.tools.
|
|
27
|
+
from aider.tools.utils.helpers import ToolError
|
|
27
28
|
|
|
28
29
|
# tree_sitter is throwing a FutureWarning
|
|
29
30
|
warnings.simplefilter("ignore", category=FutureWarning)
|
|
@@ -75,9 +76,9 @@ Tag = TagBase
|
|
|
75
76
|
SQLITE_ERRORS = (sqlite3.OperationalError, sqlite3.DatabaseError, OSError)
|
|
76
77
|
|
|
77
78
|
|
|
78
|
-
CACHE_VERSION =
|
|
79
|
+
CACHE_VERSION = 6
|
|
79
80
|
if USING_TSL_PACK:
|
|
80
|
-
CACHE_VERSION =
|
|
81
|
+
CACHE_VERSION = 8
|
|
81
82
|
|
|
82
83
|
UPDATING_REPO_MAP_MESSAGE = "Updating repo map"
|
|
83
84
|
|
|
@@ -156,10 +157,12 @@ class RepoMap:
|
|
|
156
157
|
max_code_line_length=100,
|
|
157
158
|
repo_root=None,
|
|
158
159
|
use_memory_cache=False,
|
|
160
|
+
use_enhanced_map=False,
|
|
159
161
|
):
|
|
160
162
|
self.io = io
|
|
161
163
|
self.verbose = verbose
|
|
162
164
|
self.refresh = refresh
|
|
165
|
+
self.use_enhanced_map = use_enhanced_map
|
|
163
166
|
|
|
164
167
|
self.map_cache_dir = map_cache_dir
|
|
165
168
|
# Prefer an explicit repo root (eg per-test repo), fallback to CWD
|
|
@@ -195,6 +198,7 @@ class RepoMap:
|
|
|
195
198
|
self._mentioned_ident_similarity = 0.8
|
|
196
199
|
|
|
197
200
|
if self.verbose:
|
|
201
|
+
self.io.tool_output(f"RepoMap loaded entries from tags cache: {len(self.TAGS_CACHE)}")
|
|
198
202
|
self.io.tool_output(
|
|
199
203
|
f"RepoMap initialized with map_mul_no_files: {self.map_mul_no_files}"
|
|
200
204
|
)
|
|
@@ -465,6 +469,33 @@ class RepoMap:
|
|
|
465
469
|
distance = len(p1) + len(p2) - (2 * common_count)
|
|
466
470
|
return distance
|
|
467
471
|
|
|
472
|
+
def check_import_match(self, definer, imports):
|
|
473
|
+
definer_path = Path(definer)
|
|
474
|
+
definer_parts = list(definer_path.parts)
|
|
475
|
+
if not definer_parts:
|
|
476
|
+
return False
|
|
477
|
+
|
|
478
|
+
# Remove extension from last part
|
|
479
|
+
definer_parts[-1] = os.path.splitext(definer_parts[-1])[0]
|
|
480
|
+
|
|
481
|
+
for imp in imports:
|
|
482
|
+
imp_parts = [p for p in re.split(r"[.\\/]", imp) if p]
|
|
483
|
+
if len(imp_parts) > len(definer_parts):
|
|
484
|
+
continue
|
|
485
|
+
|
|
486
|
+
# Check for sub-sequence match
|
|
487
|
+
# Check for sub-sequence match
|
|
488
|
+
for i in range(len(definer_parts) - len(imp_parts) + 1):
|
|
489
|
+
if definer_parts[i : i + len(imp_parts)] == imp_parts:
|
|
490
|
+
# Allow if it's a suffix match (standard aliasing)
|
|
491
|
+
if i + len(imp_parts) == len(definer_parts):
|
|
492
|
+
return True
|
|
493
|
+
|
|
494
|
+
# Allow partial/middle match if enough specificity (>= 2 parts)
|
|
495
|
+
if len(imp_parts) >= 2:
|
|
496
|
+
return True
|
|
497
|
+
return False
|
|
498
|
+
|
|
468
499
|
def get_tags_raw(self, fname, rel_fname):
|
|
469
500
|
lang = filename_to_lang(fname)
|
|
470
501
|
if not lang:
|
|
@@ -474,7 +505,8 @@ class RepoMap:
|
|
|
474
505
|
language = get_language(lang)
|
|
475
506
|
parser = get_parser(lang)
|
|
476
507
|
except Exception as err:
|
|
477
|
-
|
|
508
|
+
if self.verbose:
|
|
509
|
+
print(f"Skipping file {fname}: {err}")
|
|
478
510
|
return
|
|
479
511
|
|
|
480
512
|
query_scm = get_scm_fname(lang)
|
|
@@ -572,6 +604,8 @@ class RepoMap:
|
|
|
572
604
|
defines = defaultdict(set)
|
|
573
605
|
references = defaultdict(list)
|
|
574
606
|
definitions = defaultdict(set)
|
|
607
|
+
file_imports = defaultdict(set)
|
|
608
|
+
import_ast_mode = False
|
|
575
609
|
|
|
576
610
|
personalization = dict()
|
|
577
611
|
|
|
@@ -660,10 +694,13 @@ class RepoMap:
|
|
|
660
694
|
elif tag.kind == "ref":
|
|
661
695
|
references[tag.name].append(rel_fname)
|
|
662
696
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
697
|
+
if tag.specific_kind == "import":
|
|
698
|
+
file_imports[rel_fname].add(tag.name)
|
|
699
|
+
|
|
700
|
+
self.io.profile("Process Files")
|
|
701
|
+
|
|
702
|
+
if self.use_enhanced_map and len(file_imports) > 0:
|
|
703
|
+
import_ast_mode = True
|
|
667
704
|
|
|
668
705
|
if not references:
|
|
669
706
|
references = dict((k, list(v)) for k, v in defines.items())
|
|
@@ -723,7 +760,19 @@ class RepoMap:
|
|
|
723
760
|
ext_mul = round(math.log2(unique_file_refs * total_refs**2 + 1))
|
|
724
761
|
|
|
725
762
|
for referencer, num_refs in Counter(references[ident]).items():
|
|
726
|
-
|
|
763
|
+
relevant_definers = [] if import_ast_mode else definers
|
|
764
|
+
|
|
765
|
+
if import_ast_mode:
|
|
766
|
+
if referencer in file_imports:
|
|
767
|
+
matches = [
|
|
768
|
+
d
|
|
769
|
+
for d in definers
|
|
770
|
+
if self.check_import_match(d, file_imports[referencer])
|
|
771
|
+
]
|
|
772
|
+
if matches:
|
|
773
|
+
relevant_definers = matches
|
|
774
|
+
|
|
775
|
+
for definer in relevant_definers:
|
|
727
776
|
# dump(referencer, definer, num_refs, mul)
|
|
728
777
|
|
|
729
778
|
# Only add edge if file extensions match
|
|
@@ -743,7 +792,9 @@ class RepoMap:
|
|
|
743
792
|
# num_refs = math.sqrt(num_refs)
|
|
744
793
|
path_distance = self.shared_path_components(referencer, definer)
|
|
745
794
|
weight = num_refs * use_mul * 2 ** (-1 * path_distance)
|
|
746
|
-
G.add_edge(referencer, definer, weight=weight, ident=ident)
|
|
795
|
+
G.add_edge(referencer, definer, weight=weight, key=ident, ident=ident)
|
|
796
|
+
|
|
797
|
+
self.io.profile("Build Graph")
|
|
747
798
|
|
|
748
799
|
if not references:
|
|
749
800
|
pass
|
|
@@ -762,6 +813,8 @@ class RepoMap:
|
|
|
762
813
|
except ZeroDivisionError:
|
|
763
814
|
return []
|
|
764
815
|
|
|
816
|
+
self.io.profile("PageRank")
|
|
817
|
+
|
|
765
818
|
# distribute the rank from each source node, across all of its out edges
|
|
766
819
|
ranked_definitions = defaultdict(float)
|
|
767
820
|
for src in G.nodes:
|
|
@@ -776,12 +829,13 @@ class RepoMap:
|
|
|
776
829
|
ident = data["ident"]
|
|
777
830
|
ranked_definitions[(dst, ident)] += data["rank"]
|
|
778
831
|
|
|
832
|
+
self.io.profile("Distribute Rank")
|
|
833
|
+
|
|
779
834
|
ranked_tags = []
|
|
780
835
|
ranked_definitions = sorted(
|
|
781
836
|
ranked_definitions.items(), reverse=True, key=lambda x: (x[1], x[0])
|
|
782
837
|
)
|
|
783
838
|
|
|
784
|
-
# dump(ranked_definitions)
|
|
785
839
|
# with open('defs.txt', 'w') as out_file:
|
|
786
840
|
# import pprint
|
|
787
841
|
# printer = pprint.PrettyPrinter(indent=2, stream=out_file)
|
|
@@ -884,6 +938,8 @@ class RepoMap:
|
|
|
884
938
|
mentioned_fnames=None,
|
|
885
939
|
mentioned_idents=None,
|
|
886
940
|
):
|
|
941
|
+
self.io.profile("Start Rank Tags Map Uncached", start=True)
|
|
942
|
+
|
|
887
943
|
if not other_fnames:
|
|
888
944
|
other_fnames = list()
|
|
889
945
|
if not max_map_tokens:
|
|
@@ -899,6 +955,8 @@ class RepoMap:
|
|
|
899
955
|
chat_fnames, other_fnames, mentioned_fnames, mentioned_idents, True
|
|
900
956
|
)
|
|
901
957
|
|
|
958
|
+
self.io.profile("Finish Getting Ranked Tags")
|
|
959
|
+
|
|
902
960
|
other_rel_fnames = sorted(set(self.get_rel_fname(fname) for fname in other_fnames))
|
|
903
961
|
special_fnames = filter_important_files(other_rel_fnames)
|
|
904
962
|
ranked_tags_fnames = set(tag[0] for tag in ranked_tags)
|
|
@@ -947,6 +1005,8 @@ class RepoMap:
|
|
|
947
1005
|
|
|
948
1006
|
middle = int((lower_bound + upper_bound) // 2)
|
|
949
1007
|
|
|
1008
|
+
self.io.profile("Calculate Best Tree")
|
|
1009
|
+
|
|
950
1010
|
return best_tree
|
|
951
1011
|
|
|
952
1012
|
tree_cache = dict()
|