You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description="""The search query to find in the codebase. When ripgrep is available, this will be passed as a ripgrep pattern. For regex searches, set use_regex=True.
121
123
Ripgrep is the preferred method.""",
122
124
)
123
-
file_extensions: Optional[list[str]]=Field(default=None, description="Optional list of file extensions to search (e.g. ['.py', '.ts'])")
125
+
file_extensions: list[str]|None=Field(default=None, description="Optional list of file extensions to search (e.g. ['.py', '.ts'])")
124
126
page: int=Field(default=1, description="Page number to return (1-based, default: 1)")
125
127
files_per_page: int=Field(default=10, description="Number of files to return per page (default: 10)")
126
128
use_regex: bool=Field(default=False, description="Whether to treat query as a regex pattern (default: False)")
"""Input for replacement editing across the entire codebase."""
881
+
882
+
file_pattern: str=Field(
883
+
default="*",
884
+
description=("Glob pattern to match files that should be edited. Supports all Python glob syntax including wildcards (*, ?, **)"),
885
+
)
886
+
pattern: str=Field(
887
+
...,
888
+
description=(
889
+
"Regular expression pattern to match text that should be replaced. "
890
+
"Supports all Python regex syntax including capture groups (\\1, \\2, etc). "
891
+
"The pattern is compiled with re.MULTILINE flag by default."
892
+
),
893
+
)
894
+
replacement: str=Field(
895
+
...,
896
+
description=(
897
+
"Text to replace matched patterns with. Can reference regex capture groups using \\1, \\2, etc. If using regex groups in pattern, make sure to preserve them in replacement if needed."
898
+
),
899
+
)
900
+
count: int|None=Field(
901
+
default=None,
902
+
description=(
903
+
"Maximum number of replacements to make. "
904
+
"Use None to replace all occurrences (default), or specify a number to limit replacements. "
905
+
"Useful when you only want to replace the first N occurrences."
906
+
),
907
+
)
908
+
909
+
910
+
classGlobalReplacementEditTool(BaseTool):
911
+
"""Tool for regex-based replacement editing of files across the entire codebase.
912
+
913
+
Use this to make a change across an entire codebase if you have a regex pattern that matches the text you want to replace and are trying to edit a large number of files.
914
+
"""
915
+
916
+
name: ClassVar[str] ="global_replace"
917
+
description: ClassVar[str] ="Replace text in the entire codebase using regex pattern matching."
@@ -905,7 +965,7 @@ class ReplacementEditInput(BaseModel):
905
965
"Default is -1 (end of file)."
906
966
),
907
967
)
908
-
count: Optional[int]=Field(
968
+
count: int|None=Field(
909
969
default=None,
910
970
description=(
911
971
"Maximum number of replacements to make. "
@@ -933,7 +993,7 @@ def _run(
933
993
replacement: str,
934
994
start: int=1,
935
995
end: int=-1,
936
-
count: Optional[int]=None,
996
+
count: int|None=None,
937
997
) ->str:
938
998
result=replacement_edit(
939
999
self.codebase,
@@ -997,7 +1057,7 @@ class ReflectionInput(BaseModel):
997
1057
context_summary: str=Field(..., description="Summary of the current context and problem being solved")
998
1058
findings_so_far: str=Field(..., description="Key information and insights gathered so far")
999
1059
current_challenges: str=Field(default="", description="Current obstacles or questions that need to be addressed")
1000
-
reflection_focus: Optional[str]=Field(default=None, description="Optional specific aspect to focus reflection on (e.g., 'architecture', 'performance', 'next steps')")
1060
+
reflection_focus: str|None=Field(default=None, description="Optional specific aspect to focus reflection on (e.g., 'architecture', 'performance', 'next steps')")
0 commit comments