Skip to content
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 support for a .rooignore file #1367

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add support for a .rooignore file #1367

wants to merge 1 commit into from

Conversation

mrubens
Copy link
Collaborator

@mrubens mrubens commented Mar 4, 2025

Context

We need to support a .rooignore file so users can control which files the LLMs can access.

Implementation

This is very lightly adapted from the upstream Cline implementation.

Screenshots

Screenshot 2025-03-04 at 1 08 32 AM

How to Test

Populate a .rooignore file, and then ask Roo to read/write files that it's not allowed.


Important

Adds .rooignore file support to control LLM file access, with RooIgnoreController managing ignore patterns and integrated into system prompts and file operations.

  • Behavior:
    • Introduces .rooignore file support to restrict LLM file access.
    • RooIgnoreController class in RooIgnoreController.ts manages ignore patterns and file access validation.
    • Updates Cline.ts to initialize and use RooIgnoreController for file access checks.
    • Integrates .rooignore instructions into system prompts in system.ts and ClineProvider.ts.
  • Tests:
    • Adds tests for RooIgnoreController in RooIgnoreController.test.ts and RooIgnoreController.security.test.ts.
    • Mocks RooIgnoreController in __mocks__/RooIgnoreController.ts.
    • Updates responses-rooignore.test.ts to test response formatting with .rooignore.
  • Misc:
    • Updates regexSearchFiles in ripgrep/index.ts and parseSourceCodeForDefinitionsTopLevel in tree-sitter/index.ts to use RooIgnoreController for filtering results.
    • Adds rooignore_error to ClineSay in ExtensionMessage.ts.

This description was created by Ellipsis for 0fc0ae9. It will automatically update as commits are pushed.

@mrubens mrubens requested a review from cte as a code owner March 4, 2025 06:11
Copy link

changeset-bot bot commented Mar 4, 2025

⚠️ No Changeset found

Latest commit: 0fc0ae9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Mar 4, 2025
Copy link

ellipsis-dev bot commented Mar 4, 2025

The pull request introduces a significant number of changes related to the support for a .rooignore file, including the integration of the RooIgnoreController and associated tests. Given the size and scope of the changes (1375 lines added across 12 files), it might be beneficial to split this pull request into smaller, more manageable parts.

Here are some suggestions on how the changes could be split:

  1. Core Functionality: Focus on the introduction and integration of the RooIgnoreController, including its initialization, file access validation, and command validation.

  2. Testing: Separate the comprehensive tests for the RooIgnoreController into a different pull request. This includes security tests and tests for response formatting.

  3. Integration with Existing Systems: Changes related to the integration of the RooIgnoreController with existing systems like file listing, source code parsing, and regex search could be another separate pull request.

This approach can help in reviewing and testing the changes more effectively. Please consider splitting the pull request accordingly.

@dosubot dosubot bot added the enhancement New feature or request label Mar 4, 2025
@@ -70,6 +70,10 @@ export async function addCustomInstructions(
rules.push(`# Rules from ${modeRuleFile}:\n${modeRuleContent}`)
}

if (options.rooIgnoreInstructions) {
rules.push(options.rooIgnoreInstructions)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure formatting of .rooignore instructions aligns with other rule sections.

Suggested change
rules.push(options.rooIgnoreInstructions)
rules.push(`# .rooignore Instructions:\n${options.rooIgnoreInstructions}`)

@hannesrudolph
Copy link
Collaborator

hannesrudolph commented Mar 4, 2025

Related to #1014 #1013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants