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
Copy file name to clipboardExpand all lines: backend/src/tools/definitions/tool/code-search.ts
+16-1Lines changed: 16 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -19,11 +19,18 @@ Use cases:
19
19
20
20
The pattern supports regular expressions and will search recursively through all files in the project by default. Some tips:
21
21
- Be as constraining in the pattern as possible to limit the number of files returned, e.g. if searching for the definition of a function, use "(function foo|const foo)" or "def foo" instead of merely "foo".
22
+
- Use Rust-style regex, not grep-style, PCRE, RE2 or JavaScript regex - you must always escape special characters like { and }
23
+
- Be as constraining as possible to limit results, e.g. use "(function foo|const foo)" or "def foo" instead of merely "foo"
24
+
- Add context to your search with surrounding terms (e.g., "function handleAuth" rather than just "handleAuth")
22
25
- Use word boundaries (\\b) to match whole words only
26
+
- Use the cwd parameter to narrow your search to specific directories
27
+
- For case-sensitive searches like constants (e.g., ERROR vs error), omit the "-i" flag
23
28
- Searches file content and filenames
24
29
- Automatically ignores binary files, hidden files, and files in .gitignore
25
30
26
-
Advanced ripgrep flags (use the flags parameter):
31
+
32
+
ADVANCED RIPGREP FLAGS (use the flags parameter):
33
+
27
34
- Case sensitivity: "-i" for case-insensitive search
28
35
- File type filtering: "-t ts" (TypeScript), "-t js" (JavaScript), "-t py" (Python), etc.
29
36
- Exclude file types: "--type-not test" to exclude test files
.describe(`Maximum number of results to return. Defaults to 30.`),
33
+
.default(15)
34
+
.describe(
35
+
`Maximum number of results to return per file. Defaults to 15. There is also a global limit of 250 results across all files.`,
36
+
),
35
37
})
36
38
.describe(
37
39
`Search for string patterns in the project's files. This tool uses ripgrep (rg), a fast line-oriented search tool. Use this tool only when read_files is not sufficient to find the files you need.`,
0 commit comments