diff --git a/webview-ui/src/components/chat/CommandExecution.tsx b/webview-ui/src/components/chat/CommandExecution.tsx index 290d05c398..7abbe1203d 100644 --- a/webview-ui/src/components/chat/CommandExecution.tsx +++ b/webview-ui/src/components/chat/CommandExecution.tsx @@ -110,40 +110,13 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec // Found an operator, process the current command const trimmedCommand = currentCommand.trim() if (trimmedCommand) { - // For npm commands, generate multiple pattern options - if (trimmedCommand.startsWith("npm ")) { - // Add the specific pattern - const specificPattern = extractCommandPattern(trimmedCommand) - if (specificPattern) { - patterns.push({ - pattern: specificPattern, - description: getPatternDescription(specificPattern), - }) - } - - // Add broader npm patterns - if (trimmedCommand.startsWith("npm run ")) { - // Add "npm run" pattern - patterns.push({ - pattern: "npm run", - description: t("chat:commandExecution.allowAllNpmRun"), - }) - } - - // Add "npm" pattern + // Extract pattern for the command + const pattern = extractCommandPattern(trimmedCommand) + if (pattern) { patterns.push({ - pattern: "npm", - description: t("chat:commandExecution.allowAllNpm"), + pattern, + description: getPatternDescription(pattern), }) - } else { - // For non-npm commands, just add the extracted pattern - const pattern = extractCommandPattern(trimmedCommand) - if (pattern) { - patterns.push({ - pattern, - description: getPatternDescription(pattern), - }) - } } } currentCommand = "" @@ -162,40 +135,13 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec // Process the last command const trimmedCommand = currentCommand.trim() if (trimmedCommand) { - // For npm commands, generate multiple pattern options - if (trimmedCommand.startsWith("npm ")) { - // Add the specific pattern - const specificPattern = extractCommandPattern(trimmedCommand) - if (specificPattern) { - patterns.push({ - pattern: specificPattern, - description: getPatternDescription(specificPattern), - }) - } - - // Add broader npm patterns - if (trimmedCommand.startsWith("npm run ")) { - // Add "npm run" pattern - patterns.push({ - pattern: "npm run", - description: t("chat:commandExecution.allowAllNpmRun"), - }) - } - - // Add "npm" pattern + // Extract pattern for the command + const pattern = extractCommandPattern(trimmedCommand) + if (pattern) { patterns.push({ - pattern: "npm", - description: t("chat:commandExecution.allowAllNpm"), + pattern, + description: getPatternDescription(pattern), }) - } else { - // For non-npm commands, just add the extracted pattern - const pattern = extractCommandPattern(trimmedCommand) - if (pattern) { - patterns.push({ - pattern, - description: getPatternDescription(pattern), - }) - } } } @@ -205,7 +151,7 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec ) return uniquePatterns - }, [command, suggestions, showSuggestions, t]) + }, [command, suggestions, showSuggestions]) // The command's output can either come from the text associated with the // task message (this is the case for completed commands) or from the diff --git a/webview-ui/src/i18n/locales/en/chat.json b/webview-ui/src/i18n/locales/en/chat.json index 77c1191bee..684e870578 100644 --- a/webview-ui/src/i18n/locales/en/chat.json +++ b/webview-ui/src/i18n/locales/en/chat.json @@ -212,8 +212,6 @@ "pid": "PID: {{pid}}", "exited": "Exited ({{exitCode}})", "addToAllowedCommands": "Add to Allowed Auto-Execute Commands", - "allowAllNpmRun": "Allow all npm run commands", - "allowAllNpm": "Allow all npm commands", "manageCommands": "Manage Command Permissions", "commandManagementDescription": "Click ✓ to allow auto-execution, ✗ to deny execution" },