Skip to content

Commit fc253fc

Browse files
feat: Add .rooignore feature documentation and sidebar entry (#191)
1 parent c9d4259 commit fc253fc

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

docs/features/rooignore.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
sidebar_label: .rooignore
3+
---
4+
5+
# Using .rooignore to Control File Access
6+
7+
The `.rooignore` file is a key feature for managing Roo Code's interaction with your project files. It allows you to specify files and directories that Roo should not access or modify, similar to how `.gitignore` works for Git.
8+
9+
## What is `.rooignore`?
10+
11+
* **Purpose**: To protect sensitive information, prevent accidental changes to build artifacts or large assets, and generally define Roo's operational scope within your workspace.
12+
* **How to Use**: Create a file named `.rooignore` in the root directory of your VS Code workspace. List patterns in this file to tell Roo which files and directories to ignore.
13+
14+
Roo actively monitors the `.rooignore` file. Any changes you make are reloaded automatically, ensuring Roo always uses the most current rules. The `.rooignore` file itself is always implicitly ignored, so Roo cannot change its own access rules.
15+
16+
## Pattern Syntax
17+
18+
The syntax for `.rooignore` is identical to `.gitignore`. Here are common examples:
19+
20+
* `node_modules/`: Ignores the entire `node_modules` directory.
21+
* `*.log`: Ignores all files ending in `.log`.
22+
* `config/secrets.json`: Ignores a specific file.
23+
* `!important.log`: An exception; Roo will *not* ignore this specific file, even if a broader pattern like `*.log` exists.
24+
* `build/`: Ignores the `build` directory.
25+
* `docs/**/*.md`: Ignores all Markdown files in the `docs` directory and its subdirectories.
26+
27+
For a comprehensive guide on syntax, refer to the [official Git documentation on .gitignore](https://git-scm.com/docs/gitignore).
28+
29+
## How Roo Tools Interact with `.rooignore`
30+
31+
`.rooignore` rules are enforced across various Roo tools:
32+
33+
### Strict Enforcement (Reads & Writes)
34+
35+
These tools directly check `.rooignore` before any file operation. If a file is ignored, the operation is blocked:
36+
37+
* [`read_file`](/advanced-usage/available-tools/read-file): Will not read ignored files.
38+
* [`write_to_file`](/advanced-usage/available-tools/write-to-file): Will not write to or create new ignored files.
39+
* [`apply_diff`](/advanced-usage/available-tools/apply-diff): Will not apply diffs to ignored files.
40+
* [`list_code_definition_names`](/advanced-usage/available-tools/list-code-definition-names): Will not parse ignored files for code symbols.
41+
42+
### File Editing Tools (Potential Write Bypass)
43+
44+
The [`insert_content`](/advanced-usage/available-tools/insert-content) and [`search_and_replace`](/advanced-usage/available-tools/search-and-replace) tools use an internal component for managing changes.
45+
**Important**: Currently, the final write operation performed by these tools might bypass `.rooignore` rules. While initial read attempts might be blocked, the save action itself does not have an explicit check.
46+
47+
### File Discovery and Listing
48+
49+
* **[`list_files`](/advanced-usage/available-tools/list-files) Tool**: When Roo lists files, ignored files are typically omitted or marked with a 🔒 symbol (see "User Experience" below).
50+
* **Environment Details**: Information about your workspace (like open tabs and project structure) provided to Roo is filtered to exclude or mark ignored items.
51+
52+
### Command Execution
53+
54+
* **[`execute_command`](/advanced-usage/available-tools/execute-command) Tool**: This tool checks if a command (from a predefined list like `cat` or `grep`) targets an ignored file. If so, execution is blocked.
55+
56+
## Key Limitations and Scope
57+
58+
* **Workspace-Centric**: `.rooignore` rules apply **only to files and directories within the current VS Code workspace root**. Files outside this scope are not affected.
59+
* **[`execute_command`](/advanced-usage/available-tools/execute-command) Specificity**: Protection for `execute_command` is limited to a predefined list of file-reading commands. Custom scripts or uncommon utilities might not be caught.
60+
* **Write Operations via [`insert_content`](/advanced-usage/available-tools/insert-content) & [`search_and_replace`](/advanced-usage/available-tools/search-and-replace)**: As noted, these tools might be able to write to ignored files due to current limitations in their save mechanism.
61+
* **Not a Full Sandbox**: `.rooignore` is a powerful tool for controlling Roo's file access via its tools, but it does not create a system-level sandbox.
62+
63+
## User Experience and Notifications
64+
65+
* **Visual Cue (🔒)**: In file listings, files ignored by `.rooignore` may be marked with a lock symbol (🔒), depending on the `showRooIgnoredFiles` setting (defaults to `true`).
66+
* **Error Messages**: If a tool operation is blocked, Roo receives an error: `"Access to [file_path] is blocked by the .rooignore file settings. You must try to continue in the task without using this file, or ask the user to update the .rooignore file."`
67+
* **Chat Notifications**: You will typically see a notification in the Roo chat interface when an action is blocked due to `.rooignore`.
68+
69+
This guide helps you understand the `.rooignore` feature, its capabilities, and its current limitations, so you can effectively manage Roo's interaction with your codebase.

sidebars.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const sidebars: SidebarsConfig = {
3535
'features/footgun-prompting',
3636
'features/keyboard-shortcuts',
3737
'features/model-temperature',
38+
'features/rooignore',
3839
'features/settings-management',
3940
'features/shell-integration',
4041
'features/suggested-responses',

0 commit comments

Comments
 (0)