From 0a5cf463a17056e56e3bb4fce747d4aebceed6b1 Mon Sep 17 00:00:00 2001 From: hannesrudolph Date: Wed, 23 Jul 2025 13:26:06 -0600 Subject: [PATCH] fix: revert conditional display of command pattern selector Per user feedback, the command pattern selector should always be displayed when patterns are available, regardless of whether command restrictions are configured. --- .../src/components/chat/CommandExecution.tsx | 5 +-- .../chat/__tests__/CommandExecution.spec.tsx | 33 ++----------------- 2 files changed, 3 insertions(+), 35 deletions(-) diff --git a/webview-ui/src/components/chat/CommandExecution.tsx b/webview-ui/src/components/chat/CommandExecution.tsx index a0efabeb4d..8bbb7d9041 100644 --- a/webview-ui/src/components/chat/CommandExecution.tsx +++ b/webview-ui/src/components/chat/CommandExecution.tsx @@ -47,9 +47,6 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec const [isExpanded, setIsExpanded] = useState(terminalShellIntegrationDisabled) const [streamingOutput, setStreamingOutput] = useState("") const [status, setStatus] = useState(null) - // Show suggestions when user has command restrictions enabled (has denied commands) - // This provides a better UX by only showing the pattern selector when it's relevant - const showCommandSuggestions = deniedCommands.length > 0 || allowedCommands.length > 0 // 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 @@ -206,7 +203,7 @@ export const CommandExecution = ({ executionId, text, icon, title }: CommandExec )} - {showCommandSuggestions && commandPatterns.length > 0 && ( + {commandPatterns.length > 0 && ( { - const noRestrictionsState = { - ...mockExtensionState, - allowedCommands: [], - deniedCommands: [], - } - - render( - - - , - ) - - // Should not show pattern selector when no restrictions are configured - expect(screen.queryByTestId("command-pattern-selector")).not.toBeInTheDocument() - }) - - it("should show pattern selector when command restrictions are configured", () => { - // Default mockExtensionState has allowedCommands: ["npm"] and deniedCommands: ["rm"] - render( - - - , - ) - - // Should show pattern selector when restrictions are configured - expect(screen.getByTestId("command-pattern-selector")).toBeInTheDocument() - }) - it("should expand output when terminal shell integration is disabled", () => { const disabledState = { ...mockExtensionState, @@ -317,8 +288,8 @@ Output here` , ) - // When both are undefined (which defaults to empty arrays), pattern selector should not show - expect(screen.queryByTestId("command-pattern-selector")).not.toBeInTheDocument() + // Should show pattern selector when patterns are available + expect(screen.getByTestId("command-pattern-selector")).toBeInTheDocument() }) it("should handle pattern change when moving from denied to allowed", () => {