-
Notifications
You must be signed in to change notification settings - Fork 371
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
Add .clineignore support #490
base: main
Are you sure you want to change the base?
Conversation
- Implemented `loadClineIgnoreFile` to read and return contents of `.clineignore`. - Created `shouldIgnorePath` function to determine if a file path should be ignored based on patterns in the ignore file. - Added tests for `shouldIgnorePath` covering exact matches, wildcards, directory patterns, comments, and negation patterns. - Introduced new files: `src/utils/cline-ignore.ts` and `src/utils/__tests__/cline-ignore.test.ts`. Enhance cline-ignore utility with additional functions and documentation - Added `parseIgnorePatterns` function to streamline parsing of .clineignore file. - Implemented `loadIgnorePatterns` to load patterns and provide an evaluation function. - Introduced `filterIgnoredPaths` for batch filtering of file paths based on ignore patterns. - Improved documentation with JSDoc comments for better clarity on function usage.
|
// Escape special characters | ||
.replace(/[.+^${}()|[\]\\]/g, "\\$&") | ||
// Convert wildcard * to regex pattern | ||
.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.
Consider adding support for the '?' wildcard in glob patterns by replacing it with '.' in the regex.
Amazing - I've been wanting this! Will take a close look later today. Thanks so much for your contributions. We've come a long way since first pulling in the sounds PR 😁 |
Thank you so much for checking it out! I recently revisited Roo-Code after a while and was really impressed with how much it has improved. There’s one aspect of this Pull Request that I’m still on the fence about: I’ve been excluding any files that match .clineignore from the Current Working Directory listing. But I’m starting to think this might not be the best approach. Perhaps it would be better not to exclude them entirely, and instead leverage the .clineignore content directly within the systemPrompt. Also, please feel free to modify my Pull Request however you see fit—I’m more than happy for you to make any changes you think are best. |
One thing I'm thinking about is that we should probably prevent writing to files in the .clineignore as well. I have a somewhat related task on my plate to restrict which files tools can access (for instance architect should only be able to write *.md files, a tester role maybe should only be able to write *.test.ts files, etc). Let me think a bit about the best place to put that logic - the .clineignore check may fit nicely there as well. |
That's a great point! It definitely makes sense to prevent writing to the .clineignore file. Additionally, the idea that access can vary by role offers an interesting perspective on viewing development as an organic process. |
I think I’m getting close - will try to share something with you tonight my time! |
This is the approach I'm playing around with, but for some reason can't get the project to build. #572 |
why not call the file .rooignore? 🦘 |
Overview
This PR introduces support for .clineignore files, allowing users to specify which files should be ignored during Cline operations.
Changes
Implementation Details
Testing
Added comprehensive test suite covering:
Impact
This change improves user control over which files are processed by Cline, making the tool more efficient and customizable.
Scenarios