Changesets · Branches · Tags · Compare
| Changeset | 2e6f3439cd004ad1d3a5183e7a551e66c9ae7f26ada216703025c1245b130d8f |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-09-26 17:07 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-26 17:07 -07:00 |
| Parents | 574faa3a4add |
2 files changed
modified core/tools/definitions/multiEdit.ts +2 −3
| @@ -1,7 +1,6 @@ | ||
| 1 | 1 | import { Tool } from "../.."; |
| 2 | 2 | import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn"; |
| 3 | 3 | import { NO_PARALLEL_TOOL_CALLING_INSTRUCTION } from "./editFile"; |
| 4 | -import { singleFindAndReplaceTool } from "./singleFindAndReplace"; | |
| 5 | 4 | |
| 6 | 5 | export interface EditOperation { |
| 7 | 6 | old_string: string; |
| @@ -25,8 +24,7 @@ | ||
| 25 | 24 | isInstant: false, |
| 26 | 25 | function: { |
| 27 | 26 | name: BuiltInToolNames.MultiEdit, |
| 28 | - description: `This is a tool for making multiple edits to a single file in one operation. It is built on top of the ${singleFindAndReplaceTool.function.name} and allows you to perform multiple find-and-replace operations efficiently. | |
| 29 | -Prefer this tool over the ${singleFindAndReplaceTool.function.name} tool when you need to make multiple edits to the same file. | |
| 27 | + description: `Use this tool to make multiple edits to a single file in one operation. It allows you to perform multiple find-and-replace operations efficiently. | |
| 30 | 28 | |
| 31 | 29 | To make multiple edits to a file, provide the following: |
| 32 | 30 | 1. filepath: The path to the file to modify, RELATIVE to the project/workspace root (verify the directory path is correct) |
| @@ -36,6 +34,7 @@ | ||
| 36 | 34 | - replace_all: Replace all occurrences of old_string. This parameter is optional and defaults to false. |
| 37 | 35 | |
| 38 | 36 | IMPORTANT: |
| 37 | +- Files may be modified between tool calls by users, linters, etc, so always make all edits in one tool call where possible. For example, do not only edit imports if there are other changes in the file, as unused imports may be removed by a linter between tool calls. | |
| 39 | 38 | - All edits are applied in sequence, in the order they are provided |
| 40 | 39 | - Each edit operates on the result of the previous edit, so plan your edits carefully to avoid conflicts between sequential operations |
| 41 | 40 | - Edits are atomic - all edits must be valid for the operation to succeed - if any edit fails, none will be applied |
modified extensions/cli/src/tools/multiEdit.ts +4 −3
| @@ -10,7 +10,7 @@ | ||
| 10 | 10 | getLanguageFromFilePath, |
| 11 | 11 | } from "../telemetry/utils.js"; |
| 12 | 12 | |
| 13 | -import { validateAndResolveFilePath } from "./edit.js"; | |
| 13 | +import { editTool, validateAndResolveFilePath } from "./edit.js"; | |
| 14 | 14 | import { readFileTool } from "./readFile.js"; |
| 15 | 15 | import { Tool } from "./types.js"; |
| 16 | 16 | import { generateDiff } from "./writeFile.js"; |
| @@ -31,8 +31,8 @@ | ||
| 31 | 31 | displayName: "MultiEdit", |
| 32 | 32 | readonly: false, |
| 33 | 33 | isBuiltIn: true, |
| 34 | - description: `This is a tool for making multiple edits to a single file in one operation. It allows you to perform multiple find-and-replace operations efficiently. | |
| 35 | -This tool is ideal when you need to make multiple edits to the same file. | |
| 34 | + description: `Use this tool to make multiple edits to a single file in one operation. It allows you to perform multiple find-and-replace operations efficiently. | |
| 35 | +Prefer this tool over the ${editTool.name} tool when you need to make multiple edits to the same file. | |
| 36 | 36 | |
| 37 | 37 | To make multiple edits to a file, provide the following: |
| 38 | 38 | 1. file_path: The absolute path to the file to modify. Relative paths can also be used (resolved against cwd) but absolute is preferred |
| @@ -42,6 +42,7 @@ | ||
| 42 | 42 | - replace_all: Replace all occurrences of old_string. This parameter is optional and defaults to false. |
| 43 | 43 | |
| 44 | 44 | IMPORTANT: |
| 45 | +- Files may be modified between tool calls by users, linters, etc, so always make all edits in one tool call where possible. For example, do not only edit imports if there are other changes in the file, as unused imports may be removed by a linter between tool calls. | |
| 45 | 46 | - All edits are applied in sequence, in the order they are provided |
| 46 | 47 | - Each edit operates on the result of the previous edit, so plan your edits carefully to avoid conflicts between sequential operations |
| 47 | 48 | - Edits are atomic - all edits must be valid for the operation to succeed - if any edit fails, none will be applied |