refactor(agent-core): use ripgrep for Glob tool#1068
Open
7Sageer wants to merge 3 commits into
Open
Conversation
🦋 Changeset detectedLatest commit: a1db703 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Glob now shares Grep's ripgrep subprocess plumbing: it respects .gitignore by default, supports brace patterns natively, adds an include_ignored option, and returns only files.
b8c6f0d to
2e42894
Compare
- Run rg with cwd pinned to the search root so glob patterns containing a slash (e.g. src/**/*.ts) match under an absolute search root. - Keep include_dirs as a deprecated, ignored parameter so older calls are not rejected by parameter validation. - Surface stdout truncation and drop half-written trailing paths when the rg output buffer is capped. - Document that a bare pattern (e.g. *.ts) matches recursively, and sync user docs, the explore profile prompt, and the TUI summary to the new files-only / gitignore behavior. - Add real-ripgrep integration tests covering sort order, recursion, brace patterns, and the absolute-search-root case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
No related issue — this closes a robustness and consistency gap in the Glob tool.
Problem
The Glob tool previously relied on a hand-rolled directory walker that silently swallowed filesystem errors (missing or unreadable directories), so "no matches" and "the walk failed" were indistinguishable. It also did not respect
.gitignore, listed directories mixed with files, and duplicated concerns that the Grep tool already handled well through ripgrep.What changed
.gitignoreby default and adds aninclude_ignoredoption to surface ignored files.*.{ts,tsx}) are now handled natively by ripgrep.Reviewer notes
Grepripgrep execution model:rgis resolved locally and executed through the current Kaos. Remote/SSH Kaos behavior is intentionally aligned withGrepand is not changed by this PR.kaos.glob()→rg --filessubstitution. The old brace expansion code is removed, butGlobnow explicitly handles ripgrep root validation, timeout/abort/truncation, sensitive-file post-filtering, path relativization, and traversal warnings. The shared ripgrep subprocess plumbing was also moved fromGrepintorun-rg.ts.Globbehavior rather than a regression.Globuses ripgrep's mtime sorting, ripgrep still enumerates and sorts the full result set before the cap is applied. This matches the current tradeoff and is not addressed here.include_dirsis kept only as a deprecated, ignored parameter so older calls are not rejected by schema validation.Globcall when ripgrep already produced complete paths; the tool returns those paths with a warning instead.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.