-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: add symlink support to list_files tool (#4654) #4859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add --follow flag to ripgrep args in buildRipgrepArgs function - Enable traversal of symbolic links when listing files - Add comprehensive unit tests for symlink flag inclusion - Add E2E test case for symlink functionality - Aligns with existing patterns in file-search.ts and ShadowCheckpointService.ts Fixes #4654
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issue #4654 by adding symlink support to the list_files tool using ripgrep's "--follow" flag so that symbolic links are traversed during file listing.
- Added "--follow" to the ripgrep arguments in buildRipgrepArgs.
- Introduced unit tests validating flag inclusion for both recursive and non-recursive modes.
- Extended an E2E test to verify that symlinked files and directories are correctly listed.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/services/glob/list-files.ts | Updated buildRipgrepArgs to include the "--follow" flag for symlink traversal. |
| src/services/glob/tests/list-files.spec.ts | Added unit tests to confirm the "--follow" flag is present when invoking the tool. |
| apps/vscode-e2e/src/suite/tools/list-files.test.ts | Extended E2E tests to verify that symlinked files and directories are detected. |
Comments suppressed due to low confidence (1)
src/services/glob/list-files.ts:96
- Consider adding an inline comment indicating that the "--follow" flag enables symlink traversal to help maintain clarity for future maintainers.
const args = ["--files", "--hidden", "--follow"]
hannesrudolph
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! I've reviewed the changes and the implementation looks solid.
Summary
This PR successfully addresses issue #4654 by adding symlink support to the list_files tool through a minimal, targeted fix - adding the --follow flag to ripgrep arguments in the buildRipgrepArgs() function.
What I liked
✅ Minimal and surgical fix: The change is exactly what's needed - just adding "--follow" to the base ripgrep arguments array. No unnecessary complexity.
✅ Consistency with existing patterns: I verified that this aligns with how --follow is already used in file-search.ts and ShadowCheckpointService.ts, maintaining consistency across the codebase.
✅ Comprehensive test coverage:
- Unit tests properly verify the
--followflag is included for both recursive and non-recursive modes - E2E test validates actual symlink functionality with filesystem operations
- Tests gracefully handle platforms that don't support symlinks
✅ Backward compatibility: The change doesn't introduce any breaking changes - existing functionality remains intact while adding the new capability.
Technical correctness
The implementation correctly adds the --follow flag to the base arguments array, ensuring it's applied in both recursive and non-recursive modes. This enables ripgrep to traverse symbolic links when listing files, which directly addresses the issue reported by Josh.
Overall assessment
This is a well-crafted PR that demonstrates good engineering practices:
- Clear problem identification and targeted solution
- Proper test coverage at multiple levels
- Consistency with existing codebase patterns
- No unnecessary changes or scope creep
The PR successfully enables the list_files tool to detect symlinked files and directories, resolving the user's use case of organizing multiple codebases using symlinks for integration tasks.
Great work! 🎉
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, LGTM
Description
Fixes #4654
Adds symlink support to the
list_filestool by including the--followflag in ripgrep arguments. This enables Roo to see and traverse symbolic links when listing files, resolving the issue where symlinked files and folders were not being detected.Changes Made
buildRipgrepArgs(): Added"--follow"flag to base ripgrep arguments arraysrc/services/glob/__tests__/list-files.spec.tswith tests for both recursive and non-recursive modesapps/vscode-e2e/src/suite/tools/list-files.test.tswith symlink functionality test casefile-search.tsandShadowCheckpointService.tswhich already use--followTesting
--followflag inclusion for both recursive and non-recursive modesVerification of Acceptance Criteria
--followflag inbuildRipgrepArgsfunction"--follow"to base ripgrep argumentslist_filestool now follows symbolic linksChecklist
Technical Details
The fix was minimal and surgical - adding a single
"--follow"argument to the ripgrep command construction in thebuildRipgrepArgsfunction. This enables the underlying ripgrep tool to traverse symbolic links when listing files.Before:
const args = ["--files", "--hidden"]After:
const args = ["--files", "--hidden", "--follow"]This resolves Josh's use case of organizing multiple codebases using symlinks for integration tasks, as mentioned in the original issue.
Important
Adds symlink support to
list_filestool by including--followflag inbuildRipgrepArgs()and updates tests.--followflag tobuildRipgrepArgs()inlist-files.tsto enable symlink traversal.list_filestool now detects symlinked files and directories.list-files.spec.tsto verify--followflag inclusion for recursive and non-recursive modes.list-files.test.tsto validate symlink functionality.--followinfile-search.tsandShadowCheckpointService.ts.This description was created by
for a232e5a. You can customize this summary. It will automatically update as commits are pushed.