diff --git a/.roomodes b/.roomodes index 0ccbb47432..f10ca32056 100644 --- a/.roomodes +++ b/.roomodes @@ -1,8 +1,8 @@ { "customModes": [ { - "slug": "translator", - "name": "Translator", + "slug": "translate", + "name": "Translate", "roleDefinition": "You are Roo, a linguistic specialist focused on translating and managing localization files. Your responsibility is to help maintain and update translation files for the application, ensuring consistency and accuracy across all language resources.", "groups": [ "read", diff --git a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap index 2668f15ead..0202ebcef7 100644 --- a/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap +++ b/src/core/prompts/__tests__/__snapshots__/system.test.ts.snap @@ -132,12 +132,14 @@ Example: Requesting to write to frontend-config.json ## execute_command -Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/path +Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Prefer relative commands and paths that avoid location sensitivity for terminal consistency, e.g: \`touch ./testdata/example.file\`, \`dir ./examples/model1/data/yaml\`, or \`go test ./cmd/front --config ./cmd/front/config.yml\`. If directed by the user, you may open a terminal in a different directory by using the \`cwd\` parameter. Parameters: - command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- cwd: (optional) The working directory to execute the command in (default: /test/path) Usage: Your command here +Working directory path (optional) Example: Requesting to execute npm run dev @@ -145,6 +147,12 @@ Example: Requesting to execute npm run dev npm run dev +Example: Requesting to execute ls in a specific directory if directed + +ls -la +/home/user/projects + + ## ask_followup_question Description: Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth. Parameters: @@ -543,12 +551,14 @@ Example: Replace all occurrences of "old" with "new" using regex ## execute_command -Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/path +Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Prefer relative commands and paths that avoid location sensitivity for terminal consistency, e.g: \`touch ./testdata/example.file\`, \`dir ./examples/model1/data/yaml\`, or \`go test ./cmd/front --config ./cmd/front/config.yml\`. If directed by the user, you may open a terminal in a different directory by using the \`cwd\` parameter. Parameters: - command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- cwd: (optional) The working directory to execute the command in (default: /test/path) Usage: Your command here +Working directory path (optional) Example: Requesting to execute npm run dev @@ -556,6 +566,12 @@ Example: Requesting to execute npm run dev npm run dev +Example: Requesting to execute ls in a specific directory if directed + +ls -la +/home/user/projects + + ## ask_followup_question Description: Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth. Parameters: @@ -923,12 +939,14 @@ Example: Replace all occurrences of "old" with "new" using regex ## execute_command -Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Commands will be executed in the current working directory: /test/path +Description: Request to execute a CLI command on the system. Use this when you need to perform system operations or run specific commands to accomplish any step in the user's task. You must tailor your command to the user's system and provide a clear explanation of what the command does. For command chaining, use the appropriate chaining syntax for the user's shell. Prefer to execute complex CLI commands over creating executable scripts, as they are more flexible and easier to run. Prefer relative commands and paths that avoid location sensitivity for terminal consistency, e.g: \`touch ./testdata/example.file\`, \`dir ./examples/model1/data/yaml\`, or \`go test ./cmd/front --config ./cmd/front/config.yml\`. If directed by the user, you may open a terminal in a different directory by using the \`cwd\` parameter. Parameters: - command: (required) The CLI command to execute. This should be valid for the current operating system. Ensure the command is properly formatted and does not contain any harmful instructions. +- cwd: (optional) The working directory to execute the command in (default: /test/path) Usage: Your command here +Working directory path (optional) Example: Requesting to execute npm run dev @@ -936,6 +954,12 @@ Example: Requesting to execute npm run dev npm run dev +Example: Requesting to execute ls in a specific directory if directed + +ls -la +/home/user/projects + + ## ask_followup_question Description: Ask the user a question to gather additional information needed to complete the task. This tool should be used when you encounter ambiguities, need clarification, or require more details to proceed effectively. It allows for interactive problem-solving by enabling direct communication with the user. Use this tool judiciously to maintain a balance between gathering necessary information and avoiding excessive back-and-forth. Parameters: diff --git a/src/core/prompts/sections/custom-instructions.ts b/src/core/prompts/sections/custom-instructions.ts index b50219d563..04ef5b06c9 100644 --- a/src/core/prompts/sections/custom-instructions.ts +++ b/src/core/prompts/sections/custom-instructions.ts @@ -47,7 +47,9 @@ export async function addCustomInstructions( // Add language preference if provided if (options.language) { - sections.push(`Language Preference:\nYou should always speak and think in the "${options.language}" language.`) + sections.push( + `Language Preference:\nYou should always speak and think in the "${options.language}" language unless the user gives you instructions below to do otherwise.`, + ) } // Add global instructions first diff --git a/src/core/prompts/sections/rules.ts b/src/core/prompts/sections/rules.ts index 99979544bf..86e554a157 100644 --- a/src/core/prompts/sections/rules.ts +++ b/src/core/prompts/sections/rules.ts @@ -16,7 +16,6 @@ function getEditingInstructions(diffStrategy?: DiffStrategy, experiments?: Recor } else { availableTools.push("write_to_file (for creating new files or complete file rewrites)") } - if (experiments?.["insert_content"]) { availableTools.push("insert_content (for adding lines to existing files)") } diff --git a/src/core/prompts/system.ts b/src/core/prompts/system.ts index a6220126e1..41c0f4fc4a 100644 --- a/src/core/prompts/system.ts +++ b/src/core/prompts/system.ts @@ -39,7 +39,7 @@ async function generatePrompt( customModeConfigs?: ModeConfig[], globalCustomInstructions?: string, diffEnabled?: boolean, - experiments?: Record | boolean | undefined, + experiments?: Record, enableMcpServerCreation?: boolean, rooIgnoreInstructions?: string, ): Promise { @@ -61,12 +61,6 @@ async function generatePrompt( : Promise.resolve(""), ]) - // Convert experiments to an object if it's a boolean - const experimentSettings = - typeof experiments === "boolean" - ? {} // Empty object if experiments is just a boolean - : (experiments ?? {}) - const basePrompt = `${roleDefinition} ${getSharedToolUseSection()} @@ -79,7 +73,7 @@ ${getToolDescriptionsForMode( browserViewportSize, mcpHub, customModeConfigs, - experimentSettings, + experiments, )} ${getToolUseGuidelinesSection()} @@ -90,7 +84,7 @@ ${getCapabilitiesSection(cwd, supportsComputerUse, mcpHub, effectiveDiffStrategy ${modesSection} -${getRulesSection(cwd, supportsComputerUse, effectiveDiffStrategy, experimentSettings)} +${getRulesSection(cwd, supportsComputerUse, effectiveDiffStrategy, experiments)} ${getSystemInfoSection(cwd, mode, customModeConfigs)} @@ -113,7 +107,7 @@ export const SYSTEM_PROMPT = async ( customModes?: ModeConfig[], globalCustomInstructions?: string, diffEnabled?: boolean, - experiments?: Record | boolean | undefined, + experiments?: Record, enableMcpServerCreation?: boolean, rooIgnoreInstructions?: string, ): Promise => { @@ -157,11 +151,6 @@ ${customInstructions}` // If diff is disabled, don't pass the diffStrategy const effectiveDiffStrategy = diffEnabled ? diffStrategy : undefined - // Convert experiments to an object if it's a boolean - const experimentSettings = - typeof experiments === "boolean" - ? {} // Empty object if experiments is just a boolean - : (experiments ?? {}) return generatePrompt( context, @@ -175,7 +164,7 @@ ${customInstructions}` customModes, globalCustomInstructions, diffEnabled, - experimentSettings, + experiments, enableMcpServerCreation, rooIgnoreInstructions, ) diff --git a/src/core/prompts/tools/index.ts b/src/core/prompts/tools/index.ts index 2aec9bfda1..1b9b9a43d9 100644 --- a/src/core/prompts/tools/index.ts +++ b/src/core/prompts/tools/index.ts @@ -61,15 +61,13 @@ export function getToolDescriptionsForMode( const tools = new Set() - const experimentSettings = experiments ?? {} - // Add tools from mode's groups config.groups.forEach((groupEntry) => { const groupName = getGroupName(groupEntry) const toolGroup = TOOL_GROUPS[groupName] if (toolGroup) { toolGroup.tools.forEach((tool) => { - if (isToolAllowedForMode(tool as ToolName, mode, customModes ?? [], experimentSettings)) { + if (isToolAllowedForMode(tool as ToolName, mode, customModes ?? [], experiments ?? {})) { tools.add(tool) } }) diff --git a/webview-ui/.gitignore b/webview-ui/.gitignore index e2d1897154..1f81cba3f5 100644 --- a/webview-ui/.gitignore +++ b/webview-ui/.gitignore @@ -23,3 +23,5 @@ yarn-debug.log* yarn-error.log* *storybook.log + +tsconfig.tsbuildinfo diff --git a/webview-ui/package-lock.json b/webview-ui/package-lock.json index 38aecc9d09..439e5bd797 100644 --- a/webview-ui/package-lock.json +++ b/webview-ui/package-lock.json @@ -21,7 +21,6 @@ "@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.8", "@tailwindcss/vite": "^4.0.0", - "@testing-library/dom": "^10.4.0", "@vscode/webview-ui-toolkit": "^1.4.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", @@ -131,6 +130,7 @@ "version": "7.26.2", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dev": true, "license": "MIT", "dependencies": { "@babel/helper-validator-identifier": "^7.25.9", @@ -448,6 +448,7 @@ "version": "7.25.9", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=6.9.0" @@ -6536,6 +6537,8 @@ "version": "10.4.0", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz", "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", + "dev": true, + "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -6645,7 +6648,9 @@ "node_modules/@types/aria-query": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", - "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==" + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", + "dev": true, + "peer": true }, "node_modules/@types/babel__core": { "version": "7.20.5", @@ -7781,6 +7786,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -7790,6 +7796,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -7838,6 +7845,7 @@ "version": "5.3.0", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, "license": "Apache-2.0", "dependencies": { "dequal": "^2.0.3" @@ -8533,6 +8541,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.1.0", @@ -9132,6 +9141,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -9144,6 +9154,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, "license": "MIT" }, "node_modules/combined-stream": { @@ -10180,7 +10191,9 @@ "node_modules/dom-accessibility-api": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", - "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==" + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true, + "peer": true }, "node_modules/domexception": { "version": "4.0.0", @@ -12427,6 +12440,7 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -15403,6 +15417,8 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "peer": true, "bin": { "lz-string": "bin/bin.js" } @@ -18266,6 +18282,7 @@ "version": "27.5.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1", @@ -18280,6 +18297,7 @@ "version": "5.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, "license": "MIT", "engines": { "node": ">=10" @@ -18525,6 +18543,7 @@ "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true, "license": "MIT" }, "node_modules/react-markdown": { @@ -20466,6 +20485,7 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "license": "MIT", "dependencies": { "has-flag": "^4.0.0" diff --git a/webview-ui/package.json b/webview-ui/package.json index 29dad1893a..264878328c 100644 --- a/webview-ui/package.json +++ b/webview-ui/package.json @@ -28,7 +28,6 @@ "@radix-ui/react-slot": "^1.1.2", "@radix-ui/react-tooltip": "^1.1.8", "@tailwindcss/vite": "^4.0.0", - "@testing-library/dom": "^10.4.0", "@vscode/webview-ui-toolkit": "^1.4.0", "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", diff --git a/webview-ui/src/components/prompts/PromptsView.tsx b/webview-ui/src/components/prompts/PromptsView.tsx index 483cfa6b27..ef1282b4c2 100644 --- a/webview-ui/src/components/prompts/PromptsView.tsx +++ b/webview-ui/src/components/prompts/PromptsView.tsx @@ -30,6 +30,7 @@ import { import { TOOL_GROUPS, GROUP_DISPLAY_NAMES, ToolGroup } from "../../../../src/shared/tool-groups" import { vscode } from "../../utils/vscode" import { Tab, TabContent, TabHeader } from "../common/Tab" +import i18next from "i18next" // Get all available groups that should show in prompts view const availableGroups = (Object.keys(TOOL_GROUPS) as ToolGroup[]).filter((group) => !TOOL_GROUPS[group].alwaysAvailable) @@ -409,49 +410,7 @@ const PromptsView = ({ onDone }: PromptsViewProps) => { -
-
Custom Instructions for All Modes
-
- These instructions apply to all modes. They provide a base set of behaviors that can be enhanced - by mode-specific instructions below. -
- { - const value = - (e as CustomEvent)?.detail?.target?.value || - ((e as any).target as HTMLTextAreaElement).value - setCustomInstructions(value || undefined) - vscode.postMessage({ - type: "customInstructions", - text: value.trim() || undefined, - }) - }} - rows={4} - resize="vertical" - className="w-full" - data-testid="global-custom-instructions-textarea" - /> -
- Instructions can also be loaded from{" "} - - vscode.postMessage({ - type: "openFile", - text: "./.clinerules", - values: { - create: true, - content: "", - }, - }) - }> - .clinerules - {" "} - in your workspace. -
-
-
+
e.stopPropagation()} className="flex justify-between items-center mb-3">

Modes

@@ -882,8 +841,37 @@ const PromptsView = ({ onDone }: PromptsViewProps) => {
+ {/* + NOTE: This setting is placed in PromptsView rather than SettingsView since it + directly affects the functionality related to modes and custom mode creation, + which are managed in this component. This is an intentional deviation from + the standard pattern described in cline_docs/settings.md. + */} +
+ { + // Just update the local state through React context + // The React context will update the global state + setEnableCustomModeCreation(e.target.checked) + }}> + Enable Custom Mode Creation Through Prompts + +

+ When enabled, Roo allows you to create custom modes using prompts like ‘Make me a custom + mode that…’. Disabling this reduces your system prompt by about 700 tokens when this feature + isn’t needed. When disabled you can still manually create custom modes using the + button + above or by editing the related config JSON. +

+
+ {/* Custom System Prompt Disclosure */} -
+
)}
+
- {/* - NOTE: This setting is placed in PromptsView rather than SettingsView since it - directly affects the functionality related to modes and custom mode creation, - which are managed in this component. This is an intentional deviation from - the standard pattern described in cline_docs/settings.md. - */} -
- { - // Just update the local state through React context - // The React context will update the global state - setEnableCustomModeCreation(e.target.checked) - }}> - Enable Custom Mode Creation Through Prompts - -

- When enabled, Roo allows you to create custom modes using prompts like ‘Make me a custom - mode that…’. Disabling this reduces your system prompt by about 700 tokens when this feature - isn’t needed. When disabled you can still manually create custom modes using the + button - above or by editing the related config JSON. -

+
+

+ Custom Instructions for All Modes +

+ +
+ These instructions apply to all modes. They provide a base set of behaviors that can be enhanced + by mode-specific instructions below. +
+ If you would like Roo to think and speak in a different language than your editor display + language ({i18next.language}), you can specify it here. +
+ { + const value = + (e as CustomEvent)?.detail?.target?.value || + ((e as any).target as HTMLTextAreaElement).value + setCustomInstructions(value || undefined) + vscode.postMessage({ + type: "customInstructions", + text: value.trim() || undefined, + }) + }} + rows={4} + resize="vertical" + className="w-full" + data-testid="global-custom-instructions-textarea" + /> +
+ Instructions can also be loaded from{" "} + + vscode.postMessage({ + type: "openFile", + text: "./.clinerules", + values: { + create: true, + content: "", + }, + }) + }> + .clinerules + {" "} + in your workspace.
diff --git a/webview-ui/src/i18n/TranslationContext.tsx b/webview-ui/src/i18n/TranslationContext.tsx index e6115dae6a..17f1545065 100644 --- a/webview-ui/src/i18n/TranslationContext.tsx +++ b/webview-ui/src/i18n/TranslationContext.tsx @@ -1,4 +1,4 @@ -import React, { createContext, useContext, ReactNode, useEffect } from "react" +import React, { createContext, useContext, ReactNode, useEffect, useCallback } from "react" import { useTranslation } from "react-i18next" import i18next, { loadTranslations } from "./setup" import { useExtensionState } from "@/context/ExtensionStateContext" @@ -32,12 +32,18 @@ export const TranslationProvider: React.FC<{ children: ReactNode }> = ({ childre i18n.changeLanguage(extensionState.language) }, [i18n, extensionState.language]) + // Memoize the translation function to prevent unnecessary re-renders + const translate = useCallback( + (key: string, options?: Record) => { + return i18n.t(key, options) + }, + [i18n], + ) + return ( ) => { - return i18n.t(key, options) - }, + t: translate, i18n, }}> {children} diff --git a/webview-ui/src/i18n/locales/ar/.gitkeep b/webview-ui/src/i18n/locales/ar/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/ar/chat.json b/webview-ui/src/i18n/locales/ar/chat.json deleted file mode 100644 index af09e7cf5e..0000000000 --- a/webview-ui/src/i18n/locales/ar/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "ماذا يمكن أن يفعل Roo من أجلك؟" -} diff --git a/webview-ui/src/i18n/locales/ca/.gitkeep b/webview-ui/src/i18n/locales/ca/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/ca/chat.json b/webview-ui/src/i18n/locales/ca/chat.json deleted file mode 100644 index 9f9d819936..0000000000 --- a/webview-ui/src/i18n/locales/ca/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Què pot fer Roo per tu?" -} diff --git a/webview-ui/src/i18n/locales/cs/.gitkeep b/webview-ui/src/i18n/locales/cs/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/cs/chat.json b/webview-ui/src/i18n/locales/cs/chat.json deleted file mode 100644 index 989655bf4b..0000000000 --- a/webview-ui/src/i18n/locales/cs/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Co pro vás může Roo udělat?" -} diff --git a/webview-ui/src/i18n/locales/de/.gitkeep b/webview-ui/src/i18n/locales/de/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/de/chat.json b/webview-ui/src/i18n/locales/de/chat.json deleted file mode 100644 index 9047746c50..0000000000 --- a/webview-ui/src/i18n/locales/de/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Was kann Roo für dich tun?" -} diff --git a/webview-ui/src/i18n/locales/en/.gitkeep b/webview-ui/src/i18n/locales/en/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/es/.gitkeep b/webview-ui/src/i18n/locales/es/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/es/chat.json b/webview-ui/src/i18n/locales/es/chat.json deleted file mode 100644 index 34b857fba7..0000000000 --- a/webview-ui/src/i18n/locales/es/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "¿Qué puedo hacer por ti?" -} diff --git a/webview-ui/src/i18n/locales/fr/.gitkeep b/webview-ui/src/i18n/locales/fr/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/fr/chat.json b/webview-ui/src/i18n/locales/fr/chat.json deleted file mode 100644 index 8a2e696594..0000000000 --- a/webview-ui/src/i18n/locales/fr/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Que peut faire Roo pour vous ?" -} diff --git a/webview-ui/src/i18n/locales/hi/.gitkeep b/webview-ui/src/i18n/locales/hi/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/hi/chat.json b/webview-ui/src/i18n/locales/hi/chat.json deleted file mode 100644 index 5212c2026c..0000000000 --- a/webview-ui/src/i18n/locales/hi/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Roo आपके लिए क्या कर सकता है?" -} diff --git a/webview-ui/src/i18n/locales/hu/.gitkeep b/webview-ui/src/i18n/locales/hu/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/hu/chat.json b/webview-ui/src/i18n/locales/hu/chat.json deleted file mode 100644 index f57221300c..0000000000 --- a/webview-ui/src/i18n/locales/hu/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Mit tehet érted a Roo?" -} diff --git a/webview-ui/src/i18n/locales/it/.gitkeep b/webview-ui/src/i18n/locales/it/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/it/chat.json b/webview-ui/src/i18n/locales/it/chat.json deleted file mode 100644 index 6ab48932bc..0000000000 --- a/webview-ui/src/i18n/locales/it/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Cosa può fare Roo per te?" -} diff --git a/webview-ui/src/i18n/locales/ja/.gitkeep b/webview-ui/src/i18n/locales/ja/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/ja/chat.json b/webview-ui/src/i18n/locales/ja/chat.json deleted file mode 100644 index d372814cee..0000000000 --- a/webview-ui/src/i18n/locales/ja/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Rooは何をお手伝いできますか?" -} diff --git a/webview-ui/src/i18n/locales/ko/.gitkeep b/webview-ui/src/i18n/locales/ko/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/ko/chat.json b/webview-ui/src/i18n/locales/ko/chat.json deleted file mode 100644 index a96e6d17a3..0000000000 --- a/webview-ui/src/i18n/locales/ko/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Roo가 당신을 위해 무엇을 할 수 있을까요?" -} diff --git a/webview-ui/src/i18n/locales/pl/.gitkeep b/webview-ui/src/i18n/locales/pl/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/pl/chat.json b/webview-ui/src/i18n/locales/pl/chat.json deleted file mode 100644 index b21e0047ed..0000000000 --- a/webview-ui/src/i18n/locales/pl/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Co Roo może dla Ciebie zrobić?" -} diff --git a/webview-ui/src/i18n/locales/pt-BR/.gitkeep b/webview-ui/src/i18n/locales/pt-BR/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/pt-br/chat.json b/webview-ui/src/i18n/locales/pt-br/chat.json deleted file mode 100644 index 9fcd1ad1e7..0000000000 --- a/webview-ui/src/i18n/locales/pt-br/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "O que o Roo pode fazer por você?" -} diff --git a/webview-ui/src/i18n/locales/pt/.gitkeep b/webview-ui/src/i18n/locales/pt/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/pt/chat.json b/webview-ui/src/i18n/locales/pt/chat.json deleted file mode 100644 index 66bef0dff9..0000000000 --- a/webview-ui/src/i18n/locales/pt/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "O que o Roo pode fazer por si?" -} diff --git a/webview-ui/src/i18n/locales/ru/.gitkeep b/webview-ui/src/i18n/locales/ru/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/ru/chat.json b/webview-ui/src/i18n/locales/ru/chat.json deleted file mode 100644 index b01532b168..0000000000 --- a/webview-ui/src/i18n/locales/ru/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Что Roo может сделать для вас?" -} diff --git a/webview-ui/src/i18n/locales/tr/.gitkeep b/webview-ui/src/i18n/locales/tr/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/tr/chat.json b/webview-ui/src/i18n/locales/tr/chat.json deleted file mode 100644 index 8c160b2b77..0000000000 --- a/webview-ui/src/i18n/locales/tr/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Roo sizin için ne yapabilir?" -} diff --git a/webview-ui/src/i18n/locales/zh-CN/.gitkeep b/webview-ui/src/i18n/locales/zh-CN/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/zh-TW/.gitkeep b/webview-ui/src/i18n/locales/zh-TW/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/webview-ui/src/i18n/locales/zh-cn/chat.json b/webview-ui/src/i18n/locales/zh-cn/chat.json deleted file mode 100644 index 4e17fd3ca0..0000000000 --- a/webview-ui/src/i18n/locales/zh-cn/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Roo能为您做什么?" -} diff --git a/webview-ui/src/i18n/locales/zh-tw/chat.json b/webview-ui/src/i18n/locales/zh-tw/chat.json deleted file mode 100644 index 13724748a9..0000000000 --- a/webview-ui/src/i18n/locales/zh-tw/chat.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "greeting": "Roo能為您做什麼?" -}