mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
update rule & prompt for insert-code-block
This commit is contained in:
@@ -8,6 +8,7 @@ export function getRulesSection(
|
|||||||
supportsComputerUse: boolean,
|
supportsComputerUse: boolean,
|
||||||
diffStrategy?: DiffStrategy,
|
diffStrategy?: DiffStrategy,
|
||||||
context?: vscode.ExtensionContext,
|
context?: vscode.ExtensionContext,
|
||||||
|
experiments?: Record<string, boolean> | undefined,
|
||||||
): string {
|
): string {
|
||||||
const settingsDir = context ? path.join(context.globalStorageUri.fsPath, "settings") : "<settings directory>"
|
const settingsDir = context ? path.join(context.globalStorageUri.fsPath, "settings") : "<settings directory>"
|
||||||
const customModesPath = path.join(settingsDir, "cline_custom_modes.json")
|
const customModesPath = path.join(settingsDir, "cline_custom_modes.json")
|
||||||
@@ -26,6 +27,8 @@ ${
|
|||||||
? "- You should use apply_diff instead of write_to_file when making changes to existing files since it is much faster and easier to apply a diff than to write the entire file again. Only use write_to_file to edit files when apply_diff has failed repeatedly to apply the diff."
|
? "- You should use apply_diff instead of write_to_file when making changes to existing files since it is much faster and easier to apply a diff than to write the entire file again. Only use write_to_file to edit files when apply_diff has failed repeatedly to apply the diff."
|
||||||
: "- When you want to modify a file, use the write_to_file tool directly with the desired content. You do not need to display the content before using the tool."
|
: "- When you want to modify a file, use the write_to_file tool directly with the desired content. You do not need to display the content before using the tool."
|
||||||
}
|
}
|
||||||
|
${experiments?.["insert_code_block"] === true ? "- Use the insert_code_block tool to add code snippets or content block 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." : ""}
|
||||||
|
${experiments?.["search_and_replace"] === true ? "- Use the search_and_replace tool to find and replace text or regex in files. This tool allows you to search for a specific regex pattern or text and replace it with another value. Be cautious when using this tool to ensure you are replacing the correct text." : ""}
|
||||||
- Some modes have restrictions on which files they can edit. If you attempt to edit a restricted file, the operation will be rejected with a FileRestrictionError that will specify which file patterns are allowed for the current mode.
|
- Some modes have restrictions on which files they can edit. If you attempt to edit a restricted file, the operation will be rejected with a FileRestrictionError that will specify which file patterns are allowed for the current mode.
|
||||||
- Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write.
|
- Be sure to consider the type of project (e.g. Python, JavaScript, web application) when determining the appropriate structure and files to include. Also consider what files may be most relevant to accomplishing the task, for example looking at a project's manifest file would help you understand the project's dependencies, which you could incorporate into any code you write.
|
||||||
* For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$"
|
* For example, in architect mode trying to edit app.js would be rejected because architect mode can only edit files matching "\\.md$"
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ ${getCapabilitiesSection(cwd, supportsComputerUse, mcpHub, effectiveDiffStrategy
|
|||||||
|
|
||||||
${modesSection}
|
${modesSection}
|
||||||
|
|
||||||
${getRulesSection(cwd, supportsComputerUse, effectiveDiffStrategy, context)}
|
${getRulesSection(cwd, supportsComputerUse, effectiveDiffStrategy, context, experiments)}
|
||||||
|
|
||||||
${getSystemInfoSection(cwd, mode, customModeConfigs)}
|
${getSystemInfoSection(cwd, mode, customModeConfigs)}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ Parameters:
|
|||||||
- path: (required) The path of the file to insert code into (relative to the current working directory ${args.cwd.toPosix()})
|
- path: (required) The path of the file to insert code into (relative to the current working directory ${args.cwd.toPosix()})
|
||||||
- operations: (required) A JSON array of insertion operations. Each operation is an object with:
|
- operations: (required) A JSON array of insertion operations. Each operation is an object with:
|
||||||
* start_line: (required) The line number where the code block should be inserted. The content currently at that line will end up below the inserted code block.
|
* start_line: (required) The line number where the code block should be inserted. The content currently at that line will end up below the inserted code block.
|
||||||
* content: (required) The code block to insert at the specified position
|
* content: (required) The code block 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.
|
||||||
Usage:
|
Usage:
|
||||||
<insert_code_block>
|
<insert_code_block>
|
||||||
<path>File path here</path>
|
<path>File path here</path>
|
||||||
|
|||||||
Reference in New Issue
Block a user