Skip to content

Commit 39575fb

Browse files
committed
docs: add append_to_file tool documentation and update release notes for versions 3.13.0 and 3.13.1
1 parent 7bad916 commit 39575fb

File tree

5 files changed

+138
-0
lines changed

5 files changed

+138
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# append_to_file
2+
3+
The `append_to_file` tool adds content to the end of a specified file. If the file doesn't exist, it creates the file with the provided content. It automatically handles directory creation if needed.
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 append to.
10+
- `content` (required): The content to append to the file.
11+
12+
## What It Does
13+
14+
This tool appends the provided `content` to the end of the file specified by `path`. If the target file doesn't exist, the tool creates it and populates it with the `content`. It also ensures any necessary parent directories for the file path are created. Changes are presented in a diff view for user approval before being saved.
15+
16+
## When is it used?
17+
18+
- When adding new entries to log files.
19+
- When appending data records to existing datasets (e.g., CSV, JSON lines).
20+
- When incrementally building a file where new content should always go at the end.
21+
- When creating a file for the first time with initial content, especially if subsequent operations will append to it.
22+
23+
## Key Features
24+
25+
- **Append or Create**: Appends content to existing files or creates new files if they don't exist.
26+
- **Interactive Approval**: Shows proposed changes (append or new file creation) in a diff view, requiring explicit user approval.
27+
- **User Edit Support**: Allows editing the proposed content directly within the diff view before final approval.
28+
- **Automatic Directory Creation**: Automatically creates parent directories if they don't exist for the specified `path`.
29+
- **Content Preprocessing**: Cleans content by removing potential AI model artifacts (like code fences) and unescaping HTML entities.
30+
- **Access Control**: Validates file access against `.rooignore` rules.
31+
- **Diff View Integration**: Opens the file in a diff view, scrolling to the first change for review.
32+
- **Partial Update Support**: Can handle streaming content (`block.partial`) into the diff view.
33+
- **Context Tracking**: Records the file edit operation for context management.
34+
35+
## Limitations
36+
37+
- **Append Only**: Content is always added to the *end* of the file; it cannot insert content at other positions.
38+
- **Review Overhead**: The mandatory diff view approval adds an interactive step.
39+
- **Potential for Large Files**: While generally efficient, appending large amounts of content repeatedly might impact performance less than `write_to_file` but more than `apply_diff` for targeted changes.
40+
41+
## How It Works
42+
43+
When the `append_to_file` tool is invoked, it follows this process:
44+
45+
1. **Parameter Validation**: Checks for required `path` and `content`. Reports errors if missing.
46+
2. **Path Processing**: Resolves the relative `path` to an absolute path and checks if it's outside the workspace.
47+
3. **Access Control**: Validates file access against `.rooignore` rules using `rooIgnoreController`.
48+
4. **File Existence Check**: Determines if the file exists using `fileExistsAtPath`.
49+
5. **Content Preprocessing**: Removes markdown code fences, unescapes HTML entities (for non-Claude models), and strips potential line numbers.
50+
6. **Diff View Interaction**:
51+
* Opens the file in the diff view (`cline.diffViewProvider.open`).
52+
* If the file exists, prepares the `newContent` by prefixing it with the `originalContent` and a newline (`\n`).
53+
* Updates the diff view with the final content (`cline.diffViewProvider.update`), supporting partial (streaming) updates.
54+
* Scrolls to the first detected change after a complete update (`cline.diffViewProvider.scrollToFirstDiff`).
55+
7. **User Approval**: Presents the change (append or creation) via `askApproval`. Shows a formatted diff if appending. Reverts if rejected.
56+
8. **Saving Changes**: If approved, saves the changes using `cline.diffViewProvider.saveChanges`.
57+
9. **File Context Tracking**: Tracks the edit using `cline.getFileContextTracker().trackFileContext`.
58+
10. **Handling User Edits**: If the user edited the content in the diff view, reports the final merged content back to the AI.
59+
11. **Error Handling**: Uses the `handleError` callback for issues. Resets the diff view on completion, error, or rejection.
60+
12. **Result Reporting**: Reports success (including user edits) or failure back to the AI model using `pushToolResult`.
61+
62+
## Usage Examples
63+
64+
Appending log entries to an existing file:
65+
66+
```xml
67+
<append_to_file>
68+
<path>logs/application.log</path>
69+
<content>
70+
[2024-04-18 10:30:00] INFO: User logged in successfully.
71+
[2024-04-18 10:30:05] WARN: Disk space running low.
72+
</content>
73+
</append_to_file>
74+
```
75+
76+
Creating a new file and adding initial content (if `notes.md` doesn't exist):
77+
78+
```xml
79+
<append_to_file>
80+
<path>project/docs/notes.md</path>
81+
<content>
82+
# Project Notes
83+
84+
- Initial setup complete.
85+
- Need to configure database connection.
86+
</content>
87+
</append_to_file>

docs/update-notes/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This section contains notes about recent updates to Roo Code, listed by version number.
44

5+
## Version 3.13
6+
7+
* [3.13.1](/update-notes/v3.13.1) (2025-04-18)
8+
* [3.13.0](/update-notes/v3.13.0) (2025-04-17)
9+
510
## Version 3.12
611

712
* [3.12.2](/update-notes/v3.12.2) (2025-04-16)

docs/update-notes/v3.13.0.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Roo Code 3.13.0 Release Notes (2025-04-17)
2+
3+
This release brings significant UI improvements across multiple views, adds the new append_to_file tool, introduces Gemini 2.5 Flash Preview support, and includes important bug fixes.
4+
5+
## Gemini 2.5 Flash Preview
6+
- Add Gemini 2.5 Flash Preview to Gemini and Vertex providers (thanks nbihan-mediware!)
7+
8+
## UI Improvements
9+
- UI improvements to task header, chat view, history preview, and welcome view (thanks sachasayan!)
10+
11+
## New Tool: append_to_file
12+
- Added new [append_to_file](/features/tools/append-to-file) tool for appending content to files (thanks samhvw8!)
13+
- Efficiently add content to the end of existing files or create new files
14+
- Ideal for logs, data records, and incremental file building
15+
- Includes automatic directory creation and interactive approval via diff view
16+
- Complements existing file manipulation tools with specialized append functionality
17+
18+
## Bug Fixes
19+
- Fix image support in Bedrock (thanks Smartsheet-JB-Brown!)
20+
- Make diff edits more resilient to models passing in incorrect parameters

docs/update-notes/v3.13.1.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Roo Code 3.13.1 Release Notes (2025-04-18)
2+
3+
This release includes Gemini 2.5 Flash thinking mode support, UI improvements for auto-approval toggles, and several bug fixes.
4+
5+
## Gemini 2.5 Flash Thinking Mode
6+
- Support Gemini 2.5 Flash thinking mode (thanks monotykamary!)
7+
8+
## UI Improvements
9+
- Make auto-approval toggle on/off states more obvious (thanks sachasayan!)
10+
11+
## Bug Fixes
12+
- Fix the path of files dragging into the chat textarea on Windows (thanks NyxJae!)
13+
- Resolves path normalization issues specific to Windows environments
14+
- Ensures consistent file handling across platforms
15+
16+
## Telemetry Enhancements
17+
- Add telemetry for shell integration errors

sidebars.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const sidebars: SidebarsConfig = {
4444
items: [
4545
'features/tools/tool-use-overview',
4646
'features/tools/access-mcp-resource',
47+
'features/tools/append-to-file',
4748
'features/tools/apply-diff',
4849
'features/tools/ask-followup-question',
4950
'features/tools/attempt-completion',
@@ -137,6 +138,14 @@ const sidebars: SidebarsConfig = {
137138
label: 'Update Notes',
138139
items: [
139140
'update-notes/index',
141+
{
142+
type: 'category',
143+
label: '3.13',
144+
items: [
145+
{ type: 'doc', id: 'update-notes/v3.13.1', label: '3.13.1' },
146+
{ type: 'doc', id: 'update-notes/v3.13.0', label: '3.13.0' },
147+
],
148+
},
140149
{
141150
type: 'category',
142151
label: '3.12',

0 commit comments

Comments
 (0)