feat: highlight denied commands in command execution code block#12297
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
feat: highlight denied commands in command execution code block#12297roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
When a command is blocked by the denied commands list, a yellow warning banner now appears below the code block showing which specific sub-commands triggered the denial. This helps users understand why a command is asking for approval when all other commands in the block appear to be allowed. - Add getDeniedSubcommands utility to identify denied sub-commands - Add DeniedCommandsBanner component with yellow warning styling - Add i18n string for denied command detection message - Add tests for utility and component integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #12292
Description
This PR attempts to address the request in Issue #12292 (comment by @PlanBernhard) to visually highlight which specific command(s) triggered a denial when a command block is presented for approval. Feedback and guidance are welcome.
Changes:
New utility (
webview-ui/src/utils/command-denied.ts):getDeniedSubcommands()parses a command string into sub-commands usingparseCommand, then checks each against the denied/allowed command lists using the same longest-prefix-match logic as the backend.New UI component (
DeniedCommandsBannerinCommandExecution.tsx): When denied sub-commands are detected, a yellow warning banner appears below the code block showing exactly which commands triggered the block. Uses VSCode warning theme colors for consistent styling.i18n: Added
deniedCommandDetectedstring to the English locale.Test Procedure
getDeniedSubcommandsutility covering: empty inputs, single denied commands, chained commands, longest-prefix-match resolution, case-insensitivity, and mixed allowed/denied chains.DeniedCommandsBannerrendering inCommandExecution.spec.tsxcovering: banner visibility for denied commands, hidden when allowed, chained command detection, and empty deny list.All 45 tests pass (12 utility + 33 component tests including 29 pre-existing).
Run tests:
Pre-Submission Checklist
Screenshots / Videos
N/A (running in headless environment). The banner uses VSCode warning theme variables (
--vscode-inputValidation-warningBackground,--vscode-inputValidation-warningBorder) for a yellow warning appearance, with a shield icon and denied commands displayed in highlighted code tags.Documentation Updates
No documentation updates needed.
Interactively review PR in Roo Code Cloud