ripgrep matches --glob patterns against paths relative to the process
cwd, not the search root. Passing the absolute workspace path while the
agent runs elsewhere made the exclusion globs (!**/node_modules/** and
friends) match the workspace's own ancestors, so a workspace located
under e.g. .../node_modules/ silently excluded itself: rg exited 1 with
no output.
Run rg with cwd anchored to the search base and '.' as the target so
only directories inside the workspace can match, and resolve rg's now
relative output paths against that base before relativizing to the
workspace root.
Regression-tested with a workspace nested under node_modules; the
existing glob/escape/ignore tests are unchanged.
`_parse_rg` split ripgrep output on ":" positionally, so a Windows
absolute path like `C:\ws\a.py:12:def f()` parsed as file="C", line=0,
with the real line number swallowed into the matched text. Every grep
match on Windows (when `rg` is on PATH) came back corrupted.
Pass `--with-filename --null` so ripgrep always prints the path and
NUL-separates it from `line:text`, then split the path off on the NUL
byte — a byte that cannot appear in a path — before parsing. `--null`
defeats the drive-letter colon; `--with-filename` keeps the format
universal so a single-file target isn't silently dropped. Portable:
harmless on Linux/macOS, correct everywhere.
Adds a platform-independent regression test that feeds a NUL-delimited
drive-letter line through `_parse_rg` directly, since CI runs on Linux
without `rg` and never exercises this code path otherwise.
Closes#17
Imported from andrewyng/aisuite@1b4bbf303e
(contents of its platform/ directory, hoisted to the repo root).
Development history prior to this commit lives in that repository.
Co-authored-by: Devika <devikaverma11@gmail.com>