Skip to content

Commit 63d5e30

Browse files
SannidhyaSahSannidhya
andauthored
docs: comprehensive audit and sync with Roo Code v3.47.3 source (#539)
* docs: add Skills tutorial video and update embedded video on skills page (#538) Co-authored-by: Sannidhya <sann@Sannidhyas-MacBook-Pro.local> * docs: add 7 new tool pages to sidebar - Add apply-patch, edit, edit-file, generate-image, read-command-output, search-replace, skill to Available Tools section in alphabetical order * docs: restore run-slash-command to Available Tools sidebar - run-slash-command is an experimental tool but should appear in both Experimental and Available Tools sections (similar to generate-image) - Was accidentally omitted during sidebar update --------- Co-authored-by: Sannidhya <sann@Sannidhyas-MacBook-Pro.local>
1 parent 0e4a013 commit 63d5e30

57 files changed

Lines changed: 1141 additions & 1220 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
description: Apply unified diff patches to multiple files in a single operation using the apply_patch tool in Roo Code.
3+
keywords:
4+
- apply_patch
5+
- patch
6+
- unified diff
7+
- multi-file edits
8+
- file operations
9+
- Roo Code tools
10+
- diff patches
11+
---
12+
13+
# apply_patch
14+
15+
The `apply_patch` tool applies unified diff patches to multiple files in a single operation. It supports custom patch headers for adding, deleting, and updating files, making it ideal for complex multi-file refactoring operations.
16+
17+
---
18+
19+
## Parameters
20+
21+
The tool accepts these parameters:
22+
23+
- `patch` (required): A unified diff patch string with custom headers. Supports `*** Add File:`, `*** Delete File:`, and `*** Update File:` headers.
24+
25+
---
26+
27+
## What It Does
28+
29+
This tool processes unified diff patches containing operations for multiple files. It parses the patch content, identifies file operations (add, delete, update), and applies the changes atomically. Unlike [`apply_diff`](/advanced-usage/available-tools/apply-diff) which handles single-file search-and-replace operations, `apply_patch` works with traditional unified diff format.
30+
31+
---
32+
33+
## When is it used?
34+
35+
- When applying patches generated by version control systems or diff tools
36+
- When performing complex multi-file refactoring with precise line-level changes
37+
- When migrating code changes from one branch or repository to another
38+
- When bulk-adding, updating, or removing multiple files in one operation
39+
- When working with patches from external sources or automated tools
40+
41+
---
42+
43+
## Key Features
44+
45+
- Supports multiple files in a single patch operation
46+
- Handles file addition, deletion, and modification
47+
- Uses unified diff format for precise line-level control
48+
- Custom headers (`*** Add File:`, `*** Delete File:`, `*** Update File:`) for clarity
49+
- Atomic operations with validation before applying changes
50+
- Compatible with standard diff/patch tooling output
51+
52+
---
53+
54+
## Limitations
55+
56+
- Requires proper unified diff format syntax
57+
- Line numbers and context must match existing file content
58+
- Cannot apply patches with conflicts or mismatched context
59+
- Less flexible than search-and-replace tools for fuzzy matching
60+
- Requires exact line-level accuracy in patches
61+
62+
---
63+
64+
## How It Works
65+
66+
When the `apply_patch` tool is invoked, it follows this process:
67+
68+
1. **Patch Parsing**: Parses the patch string to identify custom headers (`*** Add File:`, `*** Delete File:`, `*** Update File:`) and unified diff blocks.
69+
2. **Operation Identification**: Groups changes by file path and operation type (add, delete, update).
70+
3. **Validation**: Validates that target files exist (for updates/deletes) or can be created (for adds).
71+
4. **RooIgnore Check**: Ensures target files are not restricted by `.rooignore` rules.
72+
5. **User Review**: Presents the patch operations for user review and approval.
73+
6. **Application**: Applies approved changes to each file sequentially.
74+
7. **Feedback**: Reports success or failure for each file operation.
75+
76+
---
77+
78+
## Patch Format
79+
80+
The patch format uses custom headers followed by unified diff blocks:
81+
82+
```diff
83+
*** Add File: src/utils/newHelper.ts
84+
--- /dev/null
85+
+++ b/src/utils/newHelper.ts
86+
@@ -0,0 +1,5 @@
87+
+export function helperFunction(value: string): string {
88+
+ return value.toUpperCase();
89+
+}
90+
91+
*** Update File: src/main.ts
92+
--- a/src/main.ts
93+
+++ b/src/main.ts
94+
@@ -10,7 +10,7 @@
95+
import { config } from './config';
96+
-const timeout = 5000;
97+
+const timeout = 10000;
98+
99+
function main() {
100+
101+
*** Delete File: src/deprecated/oldUtil.ts
102+
```
103+
104+
---
105+
106+
## Relation to Other Tools
107+
108+
- [`apply_diff`](/advanced-usage/available-tools/apply-diff): Use for single-file search-and-replace with fuzzy matching
109+
- `apply_patch`: Use for multi-file operations with unified diff format
110+
- [`write_to_file`](/advanced-usage/available-tools/write-to-file): Use for creating entire new files

docs/advanced-usage/available-tools/browser-action.md

Lines changed: 0 additions & 184 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
description: Replace all occurrences of text in files using the edit_file search-and-replace tool in Roo Code.
3+
keywords:
4+
- edit_file
5+
- search and replace
6+
- file editing
7+
- text replacement
8+
- Roo Code tools
9+
- code modifications
10+
---
11+
12+
# edit_file
13+
14+
The `edit_file` tool performs search-and-replace operations on files, replacing **all occurrences** of specified text. It provides a straightforward way to make consistent changes across a file when you need to update every instance of a pattern.
15+
16+
---
17+
18+
## Parameters
19+
20+
The tool accepts these parameters:
21+
22+
- `file_path` (required): The path of the file to modify relative to the current working directory.
23+
- `old_string` (required): The exact text to search for and replace.
24+
- `new_string` (required): The text to replace all occurrences with.
25+
- `expected_replacements` (optional): Expected number of replacements. If specified, the operation fails if the actual count doesn't match.
26+
27+
---
28+
29+
## What It Does
30+
31+
This tool searches for an exact string in a file and replaces **all occurrences** with new text. The replacement is performed globally across the entire file, making it ideal for consistent updates like renaming variables, updating API endpoints, or fixing repeated patterns.
32+
33+
---
34+
35+
## When is it used?
36+
37+
- When renaming variables, functions, or identifiers throughout a file
38+
- When updating repeated string literals or configuration values
39+
- When fixing consistent typos or outdated terminology
40+
- When replacing all instances of a deprecated API or import path
41+
- When you need to ensure exact match replacement without fuzzy logic
42+
43+
---
44+
45+
## Key Features
46+
47+
- Replaces **all occurrences** by default (global replacement)
48+
- Exact string matching (no regex or fuzzy matching)
49+
- Optional validation via `expected_replacements` parameter
50+
- Shows preview of changes before applying
51+
- Fails safely if expected replacement count doesn't match actual
52+
- Preserves file formatting and structure
53+
54+
---
55+
56+
## Limitations
57+
58+
- Requires exact string matches (case-sensitive, whitespace-sensitive)
59+
- Always replaces all occurrences (cannot target specific instances)
60+
- Cannot use regular expressions or patterns
61+
- Not suitable for context-dependent replacements
62+
- Less precise than [`apply_diff`](/advanced-usage/available-tools/apply-diff) for complex edits
63+
64+
---
65+
66+
## How It Works
67+
68+
When the `edit_file` tool is invoked, it follows this process:
69+
70+
1. **Parameter Validation**: Validates required `file_path`, `old_string`, and `new_string` parameters.
71+
2. **File Loading**: Reads the target file content.
72+
3. **Search Operation**: Searches for all occurrences of `old_string` in the file.
73+
4. **Count Validation**: If `expected_replacements` is specified, validates the actual occurrence count matches.
74+
5. **Replacement**: Replaces all found occurrences with `new_string`.
75+
6. **User Review**: Shows a preview of changes for user approval.
76+
7. **Application**: Applies changes to the file if approved.
77+
8. **Feedback**: Reports the number of replacements made.
78+
79+
---
80+
81+
## Relation to Other Tools
82+
83+
- `edit_file`: Replaces **all occurrences** (this tool)
84+
- [`edit`](/advanced-usage/available-tools/edit): Replaces **first occurrence** only (unless `replace_all: true`)
85+
- [`search_replace`](/advanced-usage/available-tools/search-replace): Also replaces **all occurrences**
86+
- [`apply_diff`](/advanced-usage/available-tools/apply-diff): Use for precise, context-aware edits with fuzzy matching
87+
88+
These are different implementations of search-and-replace with varying default behaviors.

0 commit comments

Comments
 (0)