-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: add .rooindexignore support for selective code indexing #8572
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
- Created RooIndexIgnoreController to handle .rooindexignore files - Updated DirectoryScanner to use RooIndexIgnoreController for filtering - Updated FileWatcher to check both .rooignore and .rooindexignore - Added comprehensive tests for RooIndexIgnoreController - Allows excluding files/folders from indexing while keeping them accessible Fixes #8570
| } | ||
|
|
||
| // Convert real path to relative for .rooindexignore checking | ||
| const relativePath = path.relative(this.cwd, realPath).toPosix() |
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.
The call to .toPosix() on the string returned by path.relative(...) is non‐standard. Consider replacing it with a conversion that works reliably (e.g. relativePath.replace(/\\/g, '/')) or using path.posix.relative(...) to ensure consistent POSIX paths on all platforms.
| const relativePath = path.relative(this.cwd, realPath).toPosix() | |
| const relativePath = path.relative(this.cwd, realPath).replace(/\\/g, '/') |
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.
Performing self-review: the machine now critiques the machine that wrote the machine.
| } | ||
|
|
||
| // Convert real path to relative for .rooindexignore checking | ||
| const relativePath = path.relative(this.cwd, realPath).toPosix() |
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.
[P0] Non-existent String.toPosix() will throw at runtime on Node. Normalize to POSIX before passing to ignore().
| const relativePath = path.relative(this.cwd, realPath).toPosix() | |
| const relativePath = path.relative(this.cwd, realPath).split(path.sep).join("/") |
| const allowedPaths = ignoreController.filterPaths(filePaths) | ||
|
|
||
| // Filter paths using .rooindexignore (for indexing exclusions) | ||
| const indexablePaths = indexIgnoreController.filterPaths(allowedPaths) |
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.
[P1] Resource leak: RooIndexIgnoreController sets up a file watcher in its constructor; scanDirectory creates one per run and never disposes it. Dispose after filtering to avoid accumulating watchers during repeated scans.
| const indexablePaths = indexIgnoreController.filterPaths(allowedPaths) | |
| const indexablePaths = indexIgnoreController.filterPaths(allowedPaths) | |
| indexIgnoreController.dispose() |
| * Initializes the file watcher | ||
| */ | ||
| async initialize(): Promise<void> { | ||
| // Initialize the index ignore controller |
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.
[P2] Lifecycle: FileWatcher initializes a RooIndexIgnoreController but dispose() does not release it. Consider calling indexIgnoreController.dispose() in FileWatcher.dispose() so the .rooindexignore watcher is torn down with the watcher.
Summary
This PR implements support for a new
.rooindexignorefile that allows users to exclude specific folders and files from code indexing while keeping them accessible for other Roo operations.Problem Solved
Fixes #8570 - Users with large projects can now exclude certain directories from indexing without blocking Roo's access to those files for other operations.
Implementation Details
RooIndexIgnoreControllerclass to handle.rooindexignorefilesDirectoryScannerto filter paths using the new controllerFileWatcherto check both.rooignore(for access) and.rooindexignore(for indexing)RooIgnoreControllerfor consistencyKey Features
.rooindexignoreonly affects code indexing, not file access.gitignore.rooindexignorefileTesting
Usage Example
Create a
.rooindexignorefile in your project root:Review Confidence
Internal review showed 95% confidence with PROCEED recommendation. The implementation follows existing patterns and includes robust error handling.
Feedback and guidance are welcome!
Important
Adds
.rooindexignoresupport to exclude files from indexing, implemented viaRooIndexIgnoreController, with comprehensive testing and integration into existing infrastructure..rooindexignorefile support to exclude files from indexing, not access.RooIndexIgnoreControllerclass handles.rooindexignorelogic.FileWatcherandDirectoryScannerto filter indexing paths.RooIndexIgnoreControllerwith 100% coverage.service-factory.tsto createRooIndexIgnoreControllerinstances.file-watcher.tsandscanner.tsto incorporate new controller.This description was created by
for 8d4c145. You can customize this summary. It will automatically update as commits are pushed.