fix: execute command after whitelisting with 'Always allow' button

- Modified addToWhitelist handler to trigger command execution after whitelisting
- Fixes issue where chat was stuck after clicking 'Always allow'
- Command now gets whitelisted AND executed in one action
This commit is contained in:
hannesrudolph 2025-07-07 14:15:15 -06:00
parent c58268b88f
commit c43927b935
2 changed files with 5 additions and 2 deletions

View file

@ -588,7 +588,7 @@ export const webviewMessageHandler = async (
break
}
case "addToWhitelist": {
// Handle adding a command pattern to the whitelist without running it
// Handle adding a command pattern to the whitelist and then running it
if (message.pattern) {
// Get current allowed commands
const currentAllowedCommands = getGlobalState("allowedCommands") || []
@ -608,6 +608,9 @@ export const webviewMessageHandler = async (
// Post state update to webview
await provider.postStateToWebview()
}
// After whitelisting, approve the pending command execution
provider.getCurrentCline()?.handleWebviewAskResponse("yesButtonClicked")
}
break
}

View file

@ -1659,7 +1659,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
<>
{/* Command approval with auto-approve pattern */}
{clineAsk === "command" && !isStreaming ? (
<div className="flex flex-col gap-[6px]">
<div className="flex flex-col gap-[6px] mb-[10px]">
{/* Top row: Run Command and Reject */}
<div className="flex gap-[6px]">
<StandardTooltip content={t("chat:runCommand.tooltip")}>