You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"You should always prefer using other editing tools over write_to_file when making changes to existing files since write_to_file is much slower and cannot handle large files.",
576
576
)
577
-
expect(prompt).toContain("The insert_code_block tool adds code snippets or content blocks to files")
577
+
expect(prompt).toContain("The insert_content tool adds lines of text to files")
578
578
expect(prompt).toContain("The search_and_replace tool finds and replaces text or regex in files")
Copy file name to clipboardexpand all lines: src/core/prompts/sections/rules.ts
+4-4
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,8 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
11
11
if(diffStrategy){
12
12
availableTools.push("apply_diff (for replacing lines in existing files)")
13
13
}
14
-
if(experiments?.["insert_code_block"]){
15
-
availableTools.push("insert_code_block (for adding sections to existing files)")
14
+
if(experiments?.["insert_content"]){
15
+
availableTools.push("insert_content (for adding lines to existing files)")
16
16
}
17
17
if(experiments?.["search_and_replace"]){
18
18
availableTools.push("search_and_replace (for finding and replacing individual pieces of text)")
@@ -24,9 +24,9 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor
24
24
}
25
25
26
26
// Additional details for experimental features
27
-
if(experiments?.["insert_code_block"]){
27
+
if(experiments?.["insert_content"]){
28
28
instructions.push(
29
-
"- The insert_code_block tool adds code snippets or content blocks to files, such as adding a new function to a JavaScript file or inserting a new route in a Python file. This tool will insert it at the specified line location. It can support multiple operations at once.",
29
+
"- The insert_content tool adds lines of text to files, such as adding a new function to a JavaScript file or inserting a new route in a Python file. This tool will insert it at the specified line location. It can support multiple operations at once.",
Description: Inserts content at specific line positions in a file. This is the primary tool for adding new content and code (functions/methods/classes, imports, attributes etc.) as it allows for precise insertions without overwriting existing content. The tool uses an efficient line-based insertion system that maintains file integrity and proper ordering of multiple insertions. Beware to use the proper indentation. This tool is the preferred way to add new content and code to files.
6
+
Parameters:
7
+
- path: (required) The path of the file to insert content into (relative to the current working directory ${args.cwd.toPosix()})
8
+
- operations: (required) A JSON array of insertion operations. Each operation is an object with:
9
+
* start_line: (required) The line number where the content should be inserted. The content currently at that line will end up below the inserted content.
10
+
* content: (required) The content to insert at the specified position. IMPORTANT NOTE: If the content is a single line, it can be a string. If it's a multi-line content, it should be a string with newline characters (\n) for line breaks. Make sure to include the correct indentation for the content.
11
+
Usage:
12
+
<insert_content>
13
+
<path>File path here</path>
14
+
<operations>[
15
+
{
16
+
"start_line": 10,
17
+
"content": "Your content here"
18
+
}
19
+
]</operations>
20
+
</insert_content>
21
+
Example: Insert a new function and its import statement
22
+
<insert_content>
23
+
<path>File path here</path>
24
+
<operations>[
25
+
{
26
+
"start_line": 1,
27
+
"content": "import { sum } from './utils';"
28
+
},
29
+
{
30
+
"start_line": 10,
31
+
"content": "function calculateTotal(items: number[]): number {\n return items.reduce((sum, item) => sum + item, 0);\n}"
"Enable the experimental insert block tool, allowing Roo to insert multiple code blocks at once at specific line numbers without needing to create a diff.",
35
+
"Enable the experimental insert content tool, allowing Roo to insert content at specific line numbers without needing to create a diff.",
0 commit comments