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.
Files changed (113) hide show
  1. aider/__init__.py +1 -1
  2. aider/_version.py +2 -2
  3. aider/args.py +63 -43
  4. aider/coders/agent_coder.py +331 -79
  5. aider/coders/agent_prompts.py +3 -15
  6. aider/coders/architect_coder.py +21 -5
  7. aider/coders/base_coder.py +661 -413
  8. aider/coders/base_prompts.py +6 -3
  9. aider/coders/chat_chunks.py +39 -17
  10. aider/commands.py +79 -15
  11. aider/diffs.py +10 -9
  12. aider/exceptions.py +1 -1
  13. aider/helpers/coroutines.py +8 -0
  14. aider/helpers/requests.py +45 -0
  15. aider/history.py +5 -0
  16. aider/io.py +179 -25
  17. aider/main.py +86 -35
  18. aider/models.py +16 -8
  19. aider/queries/tree-sitter-language-pack/c-tags.scm +3 -0
  20. aider/queries/tree-sitter-language-pack/clojure-tags.scm +5 -0
  21. aider/queries/tree-sitter-language-pack/commonlisp-tags.scm +5 -0
  22. aider/queries/tree-sitter-language-pack/cpp-tags.scm +3 -0
  23. aider/queries/tree-sitter-language-pack/csharp-tags.scm +6 -0
  24. aider/queries/tree-sitter-language-pack/dart-tags.scm +5 -0
  25. aider/queries/tree-sitter-language-pack/elixir-tags.scm +5 -0
  26. aider/queries/tree-sitter-language-pack/elm-tags.scm +3 -0
  27. aider/queries/tree-sitter-language-pack/go-tags.scm +7 -0
  28. aider/queries/tree-sitter-language-pack/java-tags.scm +6 -0
  29. aider/queries/tree-sitter-language-pack/javascript-tags.scm +8 -0
  30. aider/queries/tree-sitter-language-pack/lua-tags.scm +5 -0
  31. aider/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +3 -0
  32. aider/queries/tree-sitter-language-pack/python-tags.scm +10 -0
  33. aider/queries/tree-sitter-language-pack/r-tags.scm +6 -0
  34. aider/queries/tree-sitter-language-pack/ruby-tags.scm +5 -0
  35. aider/queries/tree-sitter-language-pack/rust-tags.scm +3 -0
  36. aider/queries/tree-sitter-language-pack/solidity-tags.scm +1 -1
  37. aider/queries/tree-sitter-language-pack/swift-tags.scm +4 -1
  38. aider/queries/tree-sitter-languages/c-tags.scm +3 -0
  39. aider/queries/tree-sitter-languages/c_sharp-tags.scm +6 -0
  40. aider/queries/tree-sitter-languages/cpp-tags.scm +3 -0
  41. aider/queries/tree-sitter-languages/dart-tags.scm +2 -1
  42. aider/queries/tree-sitter-languages/elixir-tags.scm +5 -0
  43. aider/queries/tree-sitter-languages/elm-tags.scm +3 -0
  44. aider/queries/tree-sitter-languages/fortran-tags.scm +3 -0
  45. aider/queries/tree-sitter-languages/go-tags.scm +6 -0
  46. aider/queries/tree-sitter-languages/haskell-tags.scm +2 -0
  47. aider/queries/tree-sitter-languages/java-tags.scm +6 -0
  48. aider/queries/tree-sitter-languages/javascript-tags.scm +8 -0
  49. aider/queries/tree-sitter-languages/julia-tags.scm +2 -2
  50. aider/queries/tree-sitter-languages/kotlin-tags.scm +3 -0
  51. aider/queries/tree-sitter-languages/ocaml_interface-tags.scm +6 -0
  52. aider/queries/tree-sitter-languages/php-tags.scm +6 -0
  53. aider/queries/tree-sitter-languages/python-tags.scm +10 -0
  54. aider/queries/tree-sitter-languages/ruby-tags.scm +5 -0
  55. aider/queries/tree-sitter-languages/rust-tags.scm +3 -0
  56. aider/queries/tree-sitter-languages/scala-tags.scm +2 -3
  57. aider/queries/tree-sitter-languages/typescript-tags.scm +3 -0
  58. aider/queries/tree-sitter-languages/zig-tags.scm +20 -3
  59. aider/repomap.py +71 -11
  60. aider/resources/model-metadata.json +27335 -635
  61. aider/resources/model-settings.yml +190 -0
  62. aider/scrape.py +2 -0
  63. aider/tools/__init__.py +2 -0
  64. aider/tools/command.py +84 -94
  65. aider/tools/command_interactive.py +95 -110
  66. aider/tools/delete_block.py +131 -159
  67. aider/tools/delete_line.py +97 -132
  68. aider/tools/delete_lines.py +120 -160
  69. aider/tools/extract_lines.py +288 -312
  70. aider/tools/finished.py +30 -43
  71. aider/tools/git_branch.py +107 -109
  72. aider/tools/git_diff.py +44 -56
  73. aider/tools/git_log.py +39 -53
  74. aider/tools/git_remote.py +37 -51
  75. aider/tools/git_show.py +33 -47
  76. aider/tools/git_status.py +30 -44
  77. aider/tools/grep.py +214 -242
  78. aider/tools/indent_lines.py +175 -201
  79. aider/tools/insert_block.py +220 -253
  80. aider/tools/list_changes.py +65 -80
  81. aider/tools/ls.py +64 -80
  82. aider/tools/make_editable.py +57 -73
  83. aider/tools/make_readonly.py +50 -66
  84. aider/tools/remove.py +64 -80
  85. aider/tools/replace_all.py +96 -109
  86. aider/tools/replace_line.py +118 -156
  87. aider/tools/replace_lines.py +160 -197
  88. aider/tools/replace_text.py +159 -160
  89. aider/tools/show_numbered_context.py +115 -141
  90. aider/tools/thinking.py +52 -0
  91. aider/tools/undo_change.py +78 -91
  92. aider/tools/update_todo_list.py +130 -138
  93. aider/tools/utils/base_tool.py +64 -0
  94. aider/tools/utils/output.py +118 -0
  95. aider/tools/view.py +38 -54
  96. aider/tools/view_files_matching.py +131 -134
  97. aider/tools/view_files_with_symbol.py +108 -120
  98. aider/urls.py +1 -1
  99. aider/versioncheck.py +4 -3
  100. aider/website/docs/config/adv-model-settings.md +237 -0
  101. aider/website/docs/config/agent-mode.md +36 -3
  102. aider/website/docs/config/model-aliases.md +2 -1
  103. aider/website/docs/faq.md +6 -11
  104. aider/website/docs/languages.md +2 -2
  105. aider/website/docs/more/infinite-output.md +27 -0
  106. {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/METADATA +112 -70
  107. {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/RECORD +112 -107
  108. aider_ce-0.88.38.dist-info/entry_points.txt +6 -0
  109. aider_ce-0.88.20.dist-info/entry_points.txt +0 -2
  110. /aider/tools/{tool_utils.py → utils/helpers.py} +0 -0
  111. {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/WHEEL +0 -0
  112. {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/licenses/LICENSE.txt +0 -0
  113. {aider_ce-0.88.20.dist-info → aider_ce-0.88.38.dist-info}/top_level.txt +0 -0
@@ -17,3 +17,6 @@
17
17
  (module_declaration
18
18
  (upper_case_qid (upper_case_identifier)) @name.definition.module
19
19
  ) @definition.module
20
+
21
+ (import_clause
22
+ (upper_case_qid) @name.reference.import) @reference.import
@@ -12,4 +12,7 @@
12
12
 
13
13
  (module_procedure_statement
14
14
  name: (name) @name.definition.function) @definition.function
15
+
16
+ (use_statement
17
+ (name) @name.reference.import) @reference.import
15
18
 
@@ -28,3 +28,9 @@
28
28
  name: (type_identifier) @name.definition.type) @definition.type
29
29
 
30
30
  (type_identifier) @name.reference.type @reference.type
31
+
32
+ (import_spec
33
+ path: [
34
+ (interpreted_string_literal)
35
+ (raw_string_literal)
36
+ ] @name.reference.import) @reference.import
@@ -1,3 +1,5 @@
1
1
  (function (variable) @name.definition.function)
2
2
  (bind (variable) @name.definition.function)
3
3
  (signature (variable) @name.definition.type)
4
+
5
+ (import) @name.reference.import @reference.import
@@ -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.module) @reference.module
57
+ (identifier) @name.reference.import) @reference.import
58
58
 
59
59
  (import_statement
60
- (identifier) @name.reference.module) @reference.module
60
+ (identifier) @name.reference.import) @reference.import
@@ -25,3 +25,6 @@
25
25
  (constructor_invocation
26
26
  (user_type) @name.reference.type)
27
27
  ]) @reference.type
28
+
29
+ (import_header
30
+ (identifier) @name.reference.import) @reference.import
@@ -96,3 +96,9 @@
96
96
  ) @definition.function
97
97
  (#strip! @doc "^\\(\\*+\\s*|\\s*\\*+\\)$")
98
98
  )
99
+
100
+ (open_statement
101
+ (module_path) @name.reference.import) @reference.import
102
+
103
+ (include_statement
104
+ (module_path) @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
@@ -58,3 +58,6 @@
58
58
  (impl_item
59
59
  type: (type_identifier) @name.reference.implementation
60
60
  !trait) @reference.implementation
61
+
62
+ (use_declaration
63
+ argument: (_) @name.reference.import) @reference.import
@@ -60,6 +60,5 @@
60
60
  (extends_clause
61
61
  (type_identifier) @name.reference.class) @reference.class
62
62
 
63
- (extends_clause
64
- (generic_type
65
- (type_identifier) @name.reference.class)) @reference.class
63
+ (import_declaration
64
+ (identifier) @name.reference.import) @reference.import
@@ -39,3 +39,6 @@
39
39
 
40
40
  (enum_declaration
41
41
  name: (identifier) @name.definition.enum) @definition.enum
42
+
43
+ (import_statement
44
+ source: (string (string_fragment) @name.reference.import)) @reference.import
@@ -1,3 +1,20 @@
1
- (FnProto) @name.definition.function
2
- (VarDecl "const" @name.definition.constant)
3
- (VarDecl "var" @name.definition.variable)
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.tool_utils import ToolError
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 = 5
79
+ CACHE_VERSION = 6
79
80
  if USING_TSL_PACK:
80
- CACHE_VERSION = 7
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
- print(f"Skipping file {fname}: {err}")
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
- # dump(defines)
665
- # dump(references)
666
- # dump(personalization)
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
- for definer in definers:
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()