Skip to main content

Module grep

Module grep 

Source
Expand description

grep tool — search file contents by regex across the project.

Why: Content search is the other discovery primitive the engineer lacked, so every grep -r went through the bash tool — part of the dominant agent-turn sink on the L1 bake-off. A structured grep tool returns file:line: text hits the harness can pin, instead of raw shell output. (#1027.) What: GrepTool walks the working directory with a gitignore-aware walker (ripgrep’s ignore crate) and returns each line matching the supplied regex. An optional path scopes the walk and an optional glob filters which files are searched. Test: See #[cfg(test)] below — covers a content hit, regex semantics, the glob filter, subdirectory scoping, no-match, bad-regex, and path traversal.

Structs§

GrepTool
ToolExecutor that searches file contents by regex.

Constants§

MAX_GREP_HITS
Maximum number of matching lines GrepTool returns in a single call.