Skip to content

Commit acc9182

Browse files
authored
Merge branch 'RooVetGit:main' into main
2 parents 3864a5c + 60e43a1 commit acc9182

File tree

81 files changed

+1400
-488
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+1400
-488
lines changed

.roomodes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"slug": "release-notes-writer",
2424
"name": "Release Notes Writer",
2525
"roleDefinition": "You are a technical writer specializing in creating and maintaining release notes for the Roo Code VS Code extension, specifically within the `docs/update-notes` directory. Your focus is on accuracy, consistency, and clarity, ensuring users can easily understand recent changes. You adhere strictly to the project's release note standards.",
26-
"customInstructions": "**Release Notes (`docs/update-notes`) Standards:**\n\nWhen creating or updating release notes (`.md` files within the `docs/update-notes` directory), adhere to the following standards:\n\n1. **File Naming:**\n * **Patch Releases:** Use the full version number (e.g., `v3.3.1.md`). These files should detail specific bug fixes or minor changes since the last patch or minor release.\n * **Minor/Major Releases:** Use the major.minor version number (e.g., `v3.11.md`). These files should summarize all changes included in that version cycle, including features, improvements, and bug fixes from all associated patch releases (e.g., `v3.11.0`, `v3.11.1`, `v3.11.2`, etc.).\n2. **File Structure (`vX.Y.Z.md` or `vX.Y.md`):**\n * **Title:** The H1 title must follow the format: `# Roo Code X.Y.Z Release Notes (YYYY-MM-DD)` or `# Roo Code X.Y Release Notes (YYYY-MM-DD)`. Ensure the date reflects the release date and is always included.\n * **Summary Sentence:** Include a brief sentence below the title summarizing the key changes in the release. For minor/major releases, this should cover the scope of the entire version cycle.\n * **Section Headings:** Use consistent `##` headings. Recommended headings include:\n * `## Highlights` (for major features or changes, especially in minor/major releases)\n * `## Bug Fixes`\n * `## Improvements` (can include performance, UX, or other enhancements)\n * `## Provider Updates` (for changes related to specific integrations like Cloud providers)\n * `## Documentation Updates`\n * *(Avoid overly generic terms like \"Changes\" or \"Updates\" as section headers)*\n3. **`index.md` File (Main Index):**\n * The main `index.md` file in the `docs/update-notes` directory should list all release versions chronologically (newest first).\n * Each entry should link to the corresponding release note file (e.g., `v3.11.md` for the summary page, `v3.3.1.md` for a specific patch). Use absolute paths from `/docs/` and omit the `.md` extension (e.g., `[3.11.8](/update-notes/v3.11.8)`).\n * Ensure the date `(YYYY-MM-DD)` is included next to each version link.\n4. **Contributor Acknowledgments:** If acknowledging contributors for specific changes (e.g., bug fixes), do so consistently. Add `(thanks username!)` at the end of the relevant bullet point, omitting the `@` symbol.\n5. **Content Style:** Maintain a clear, concise, and informative writing style. Use Markdown formatting correctly (e.g., use backticks `` for code or version numbers). Ensure consistent terminology (e.g., \"release notes\" vs. \"changelog\").\n6. **Sidebar Update (`sidebars.ts`):**\n * When a new **release note page** (e.g., `vX.Y.md` or `vX.Y.Z.md`) is created, you **must** update the `sidebars.ts` file.\n * Add the Docusaurus ID for the new page (e.g., `'update-notes/vX.Y'` or `'update-notes/vX.Y.Z'`) to the `items` array within the appropriate 'Update Notes' category.",
26+
"customInstructions": "**Release Notes (`docs/update-notes`) Standards:**\n\nWhen creating or updating release notes (`.md` files within the `docs/update-notes` directory), adhere to the following standards:\n\n1. **File Naming:**\n * **Patch Releases:** Use the full version number (e.g., `v3.3.1.md`). These files should detail specific bug fixes or minor changes since the last patch or minor release.\n * **Minor/Major Releases:** Use the major.minor version number (e.g., `v3.11.md`). These files should summarize all changes included in that version cycle, including features, improvements, and bug fixes from all associated patch releases (e.g., `v3.11.0`, `v3.11.1`, `v3.11.2`, etc.).\n2. **File Structure (`vX.Y.Z.md` or `vX.Y.md`):**\n * **Title:** The H1 title must follow the format: `# Roo Code X.Y.Z Release Notes (YYYY-MM-DD)` or `# Roo Code X.Y Release Notes (YYYY-MM-DD)`. Ensure the date reflects the release date and is always included.\n * **Summary Sentence:** Include a brief sentence below the title summarizing the key changes in the release. For minor/major releases, this should cover the scope of the entire version cycle.\n * **Section Headings:** Use consistent `##` headings. Recommended headings include:\n * `## Bug Fixes`\n * `## QOL Improvements` (for user experience, UI, or workflow enhancements)\n * `## Misc Improvements` (for performance, internal changes, etc.)\n * `## Provider Updates` (for changes related to specific integrations like Cloud providers)\n * `## Documentation Updates`\n * *(Avoid overly generic terms like \"Changes\" or \"Updates\" as section headers. Do NOT use `## Highlights`)*\n3. **`index.md` File (Main Index):**\n * The main `index.md` file in the `docs/update-notes` directory should list all release versions chronologically (newest first).\n * Each entry should link to the corresponding release note file (e.g., `v3.11.md` for the summary page, `v3.3.1.md` for a specific patch). Use absolute paths from `/docs/` and omit the `.md` extension (e.g., `[3.11.8](/update-notes/v3.11.8)`).\n * Ensure the date `(YYYY-MM-DD)` is included next to each version link.\n* **Updating Combined Notes:** When creating a patch release note (`vX.Y.Z.md`), you must also update the corresponding minor/major release note (`vX.Y.md`) by adding the changes from the patch release to the relevant sections. Do *not* include the patch version number (e.g., `(vX.Y.Z)`) in the combined notes.\n4. **Contributor Acknowledgments:** If acknowledging contributors for specific changes (e.g., bug fixes), do so consistently. Add `(thanks username!)` at the end of the relevant bullet point, omitting the `@` symbol.\n5. **Content Style:** Maintain a clear, concise, and informative writing style. Use Markdown formatting correctly (e.g., use backticks `` for code or version numbers). Ensure consistent terminology (e.g., \"release notes\" vs. \"changelog\").\n6. **Sidebar Update (`sidebars.ts`):**\n * When a new **release note page** (e.g., `vX.Y.md` or `vX.Y.Z.md`) is created, you **must** update the `sidebars.ts` file.\n * Add the Docusaurus ID for the new page (e.g., `'update-notes/vX.Y'` or `'update-notes/vX.Y.Z'`) to the `items` array within the appropriate 'Update Notes' category.",
2727
"groups": [
2828
"read",
2929
"command",
File renamed without changes.

docs/features/tools/apply-diff.md renamed to docs/advanced-usage/available-tools/apply-diff.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
# apply_diff
22

3-
The `apply_diff` tool makes precise, surgical changes to files by specifying exactly what content to replace. It uses multiple sophisticated strategies for finding and applying changes while maintaining proper code formatting and structure.
3+
The `apply_diff` tool makes precise, surgical changes to files by specifying exactly what content to replace. It uses a sophisticated strategy for finding and applying changes while maintaining proper code formatting and structure.
44

55
## Parameters
66

77
The tool accepts these parameters:
88

99
- `path` (required): The path of the file to modify relative to the current working directory.
1010
- `diff` (required): The search/replace block defining the changes using a format specific to the active diff strategy.
11-
- `start_line` (optional): A hint for where the search content begins, used by some strategies.
12-
- `end_line` (optional): A hint for where the search content ends, used by some strategies.
11+
- `start_line` (optional): A hint for where the search content begins. _Note: This top-level parameter appears unused by the current main strategy, which relies on `:start_line:` within the diff content._
12+
- `end_line` (optional): A hint for where the search content ends. _Note: This top-level parameter appears unused by the current main strategy._
1313

1414
## What It Does
1515

16-
This tool applies targeted changes to existing files using sophisticated strategies to locate and replace content precisely. Unlike simple search and replace, it uses intelligent matching algorithms (including fuzzy matching) that adapt to different content types and file sizes, with fallback mechanisms for complex edits.
16+
This tool applies targeted changes to existing files using fuzzy matching guided by line number hints to locate and replace content precisely. Unlike simple search and replace, it identifies the exact block for replacement based on the provided content and location hints.
1717

1818
## When is it used?
1919

@@ -24,11 +24,10 @@ This tool applies targeted changes to existing files using sophisticated strateg
2424

2525
## Key Features
2626

27-
- Uses intelligent fuzzy matching with configurable confidence thresholds (typically 0.8-1.0).
27+
- Uses fuzzy matching (Levenshtein distance on normalized strings) guided by a `:start_line:` hint, with configurable confidence thresholds (typically 0.8-1.0).
2828
- Provides context around matches using `BUFFER_LINES` (default 40).
29-
- Employs an overlapping window approach for searching large files.
30-
- Preserves code formatting and indentation automatically.
31-
- Combines overlapping matches for improved confidence scoring.
29+
- Performs a middle-out search within a configurable context window (`bufferLines`) around the hinted start line.
30+
- Preserves code formatting and indentation passively by replacing exact blocks.
3231
- Shows changes in a diff view for user review and editing before applying.
3332
- Tracks consecutive errors per file (`consecutiveMistakeCountForApplyDiff`) to prevent repeated failures.
3433
- Validates file access against `.rooignore` rules.
@@ -49,8 +48,8 @@ When the `apply_diff` tool is invoked, it follows this process:
4948
1. **Parameter Validation**: Validates required `path` and `diff` parameters.
5049
2. **RooIgnore Check**: Validates if the target file path is allowed by `.rooignore` rules.
5150
3. **File Analysis**: Loads the target file content.
52-
4. **Match Finding**: Uses the selected strategy's algorithms (exact, fuzzy, overlapping windows) to locate the target content, considering confidence thresholds and context (`BUFFER_LINES`).
53-
5. **Change Preparation**: Generates the proposed changes, preserving indentation.
51+
4. **Match Finding**: Uses a fuzzy matching algorithm (Levenshtein on normalized strings) guided by the `:start_line:` hint within a context window (`BUFFER_LINES`), searching middle-out to locate the target content based on the confidence threshold.
52+
5. **Change Preparation**: Generates the proposed changes by replacing the identified block.
5453
6. **User Interaction**:
5554
* Displays the changes in a diff view.
5655
* Allows the user to review and potentially edit the proposed changes.
@@ -59,16 +58,11 @@ When the `apply_diff` tool is invoked, it follows this process:
5958
8. **Error Handling**: If errors occur (e.g., match failure, partial application), increments the `consecutiveMistakeCountForApplyDiff` for the file and reports the failure type.
6059
9. **Feedback**: Returns the result, including any user feedback or error details.
6160

62-
## Diff Strategy
61+
## Diff Format Requirements
6362

64-
Roo Code uses this strategy for applying diffs:
63+
The `<diff>` parameter requires a specific format supporting one or more changes in a single request. Each change block requires a line number hint for the original content.
6564

66-
### MultiSearchReplaceDiffStrategy
67-
68-
An enhanced search/replace format supporting multiple changes in one request. Requires line numbers for each search block.
69-
70-
* **Best for**: Multiple, distinct changes where line numbers are known or can be estimated.
71-
* **Requires**: Exact match for the `SEARCH` block content, including whitespace and indentation. Line numbers (`:start_line:`, `:end_line:`) are mandatory. Markers within content must be escaped (`\`).
65+
* **Requires**: Exact match for the `SEARCH` block content (within the fuzzy threshold), including whitespace and indentation. The `:start_line:` number hint is mandatory within each block. The `:end_line:` hint is optional (but supported by the parser). Markers like `<<<<<<<` within the file's content must be escaped (`\\`) in the SEARCH block.
7266

7367
Example format for the `<diff>` block:
7468

@@ -94,5 +88,4 @@ Example format for the `<diff>` block:
9488
const defaultTimeout = 5000;
9589
=======
9690
const defaultTimeout = 10000; // Increased timeout
97-
>>>>>>> REPLACE
98-
```
91+
>>>>>>> REPLACE
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# insert_content
2+
3+
The `insert_content` tool adds new lines of content into an existing file without modifying the original content. It's ideal for inserting code blocks, configuration entries, or log lines at specific locations.
4+
5+
## Parameters
6+
7+
The tool accepts these parameters:
8+
9+
- `path` (required): The relative path (from the workspace root) of the file to insert content into.
10+
- `line` (required): The 1-based line number *before* which the content should be inserted. Use `0` to append the content to the end of the file.
11+
- `content` (required): The text content to insert.
12+
13+
## What It Does
14+
15+
This tool reads the target file, identifies the specified insertion point based on the `line` parameter, and inserts the provided `content` at that location. If `line` is `0`, the content is added to the end. Changes are presented in a diff view for user approval before being saved.
16+
17+
## When is it used?
18+
19+
- When adding new import statements at the beginning of a file.
20+
- When inserting new functions or methods into existing code.
21+
- When adding configuration blocks to settings files.
22+
- When appending log entries or data records.
23+
- When adding any multi-line text block without altering existing lines.
24+
25+
## Key Features
26+
27+
- **Targeted Insertion**: Adds content precisely at the specified line number or appends to the end.
28+
- **Preserves Existing Content**: Does not modify or delete original file lines.
29+
- **Interactive Approval**: Shows proposed insertions in a diff view, requiring explicit user approval.
30+
- **User Edit Support**: Allows editing the proposed content directly within the diff view before final approval.
31+
- **Handles Line Numbers**: Correctly interprets the `line` parameter (1-based or 0 for append).
32+
- **Context Tracking**: Records the file edit operation for context management.
33+
- **Error Handling**: Checks for missing parameters, invalid line numbers, and file access issues.
34+
35+
## Limitations
36+
37+
- **Insert Only**: Cannot replace or delete existing content. Use `apply_diff` or `search_and_replace` for modifications.
38+
- **Requires Existing File**: The target file specified by `path` must exist.
39+
- **Review Overhead**: The mandatory diff view approval adds an interactive step.
40+
41+
## How It Works
42+
43+
When the `insert_content` tool is invoked, it follows this process:
44+
45+
1. **Parameter Validation**: Checks for required `path`, `line`, and `content`. Validates `line` is a non-negative integer.
46+
2. **File Reading**: Reads the content of the target file specified by `path`.
47+
3. **Insertion Point Calculation**: Converts the 1-based `line` parameter to a 0-based index for internal processing (`-1` for appending).
48+
4. **Content Insertion**: Uses an internal utility (`insertGroups`) to merge the original file lines with the new `content` at the calculated index.
49+
5. **Diff View Interaction**:
50+
* Opens the file in the diff view (`cline.diffViewProvider.open`).
51+
* Updates the diff view with the proposed content (`cline.diffViewProvider.update`).
52+
6. **User Approval**: Presents the change via `askApproval`. Reverts if rejected.
53+
7. **Saving Changes**: If approved, saves the changes using `cline.diffViewProvider.saveChanges`.
54+
8. **File Context Tracking**: Tracks the edit using `cline.getFileContextTracker().trackFileContext`.
55+
9. **Handling User Edits**: If the user edited the content in the diff view, reports the final merged content back.
56+
10. **Result Reporting**: Reports success (including user edits) or failure back to the AI model.
57+
58+
## Usage Examples
59+
60+
Inserting import statements at the beginning of a file (`line: 1`):
61+
62+
```xml
63+
<insert_content>
64+
<path>src/utils.ts</path>
65+
<line>1</line>
66+
<content>
67+
// Add imports at start of file
68+
import { sum } from './math';
69+
import { parse } from 'date-fns';
70+
</content>
71+
</insert_content>
72+
```
73+
74+
Appending content to the end of a file (`line: 0`):
75+
76+
```xml
77+
<insert_content>
78+
<path>config/routes.yaml</path>
79+
<line>0</line>
80+
<content>
81+
- path: /new-feature
82+
component: NewFeatureComponent
83+
auth_required: true
84+
</content>
85+
</insert_content>
86+
```
87+
88+
Inserting a function before line 50:
89+
90+
```xml
91+
<insert_content>
92+
<path>src/services/api.js</path>
93+
<line>50</line>
94+
<content>
95+
async function fetchUserData(userId) {
96+
const response = await fetch(`/api/users/${userId}`);
97+
if (!response.ok) {
98+
throw new Error('Failed to fetch user data');
99+
}
100+
return response.json();
101+
}
102+
</content>
103+
</insert_content>
104+
```

docs/features/tools/list-code-definition-names.md renamed to docs/advanced-usage/available-tools/list-code-definition-names.md

File renamed without changes.

docs/features/tools/list-files.md renamed to docs/advanced-usage/available-tools/list-files.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ This tool lists all files and directories in a specified location, providing a c
2828
- Intelligently ignores common large directories like `node_modules` and `.git` in recursive mode
2929
- Respects `.gitignore` rules when in recursive mode
3030
- Marks files ignored by `.rooignore` with a lock symbol (🔒) when `showRooIgnoredFiles` is enabled
31-
- Optimizes performance with level-by-level directory traversal
31+
- Optimizes file listing performance by leveraging the `ripgrep` tool.
3232
- Sorts results to show directories before their contents, maintaining a logical hierarchy
3333
- Presents results in a clean, organized format
3434
- Automatically creates a mental map of your project structure
3535

3636
## Limitations
3737

3838
- File listing is capped at about 200 files by default to prevent performance issues
39-
- Has a 10-second timeout for directory traversal to prevent hanging on complex directory structures
39+
- The underlying `ripgrep` file listing process has a 10-second timeout; if exceeded, partial results may be returned.
4040
- When the file limit is hit, it adds a note suggesting to use `list_files` on specific subdirectories
4141
- Not designed for confirming the existence of files you've just created
4242
- May have reduced performance in very large directory structures
@@ -49,10 +49,10 @@ When the `list_files` tool is invoked, it follows this process:
4949
1. **Parameter Validation**: Validates the required `path` parameter and optional `recursive` parameter
5050
2. **Path Resolution**: Resolves the relative path to an absolute path
5151
3. **Security Checks**: Prevents listing files in sensitive locations like root or home directories
52-
4. **Directory Scanning**:
53-
- For non-recursive mode: Lists only the top-level contents
54-
- For recursive mode: Traverses the directory structure level by level with a 10-second timeout
55-
- If timeout occurs, returns partial results collected up to that point
52+
4. **Directory/File Scanning**:
53+
- Uses the `ripgrep` tool to efficiently list files, applying a 10-second timeout.
54+
- Uses Node.js `fs` module to list directories.
55+
- Applies different filtering logic for recursive vs. non-recursive modes.
5656
5. **Result Filtering**:
5757
- In recursive mode, skips common large directories like `node_modules`, `.git`, etc.
5858
- Respects `.gitignore` rules when in recursive mode

0 commit comments

Comments
 (0)