-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Add in-dialog command whitelisting with LLM suggestions (#5480) #5491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 15 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
cf6c380
fix: resolve all issues in PR #5491 - command whitelisting feature
hannesrudolph 20363b4
fix: resolve knip unused files issue
hannesrudolph a0e8c24
feat: add denyCommand handler for individual command deny listing
hannesrudolph 18e3cd1
feat: add unified UI for managing allow/deny command lists
hannesrudolph bacf751
fix: correct toggle behavior for allow/deny command buttons
hannesrudolph 9a01e80
fix: ensure immediate UI updates when toggling command allow/deny status
hannesrudolph 38fb80f
refactor: improve tooltip implementation to follow codebase standards
hannesrudolph 63f4a27
fix: remove hardcoded npm pattern suggestions
hannesrudolph 81ef373
chore: remove temporary PR fixer file from version control
hannesrudolph 7d75a0c
fix: trim trailing spaces from command suggestions
hannesrudolph df69540
fix: remove trailing spaces from command suggestion examples
hannesrudolph 4ec34ad
fix: use inclusive terminology in command permission instructions
hannesrudolph e98c404
refactor: streamline command permission instructions for LLM
hannesrudolph b7986c0
fix: address PR review comments and improve command permission UI
hannesrudolph c9964e2
chore: update all locale files with new command permission translations
hannesrudolph 8bbecac
feat: add setting to disable LLM command suggestions
hannesrudolph 10843e8
fix: add missing imports for vscode and Package in Task.ts
hannesrudolph 70ca7a6
refactor: move command whitelisting from VS Code settings to plugin UI
hannesrudolph 238bae6
fix: resolve command whitelisting issues
hannesrudolph 0b714fd
fix: add missing translations for disableLlmSuggestions setting
hannesrudolph f903871
fix: prevent removed commands from reappearing due to workspace confi…
hannesrudolph 0a067f0
feat: implement robust command pattern extraction using shell-quote
hannesrudolph a280f87
fix: prevent full command chains from being extracted as patterns
hannesrudolph 60815f4
fix: prevent LLM from suggesting full command chains in execute-command
hannesrudolph edba73a
test: add comprehensive real-world test cases for command pattern parser
hannesrudolph d899a36
refactor: Remove LLM suggestion feature in favor of deterministic she…
hannesrudolph 39a8fad
fix: Remove remaining references to disableLlmCommandSuggestions
hannesrudolph ded11f8
chore: remove temporary documentation files
hannesrudolph 06c8cb8
fix: replace hardcoded aria-labels with i18n translation keys
hannesrudolph abb8612
chore: remove test_fix_summary.md temporary file
hannesrudolph 51d010e
fix: add missing roo-cline.allowedCommands configuration registration
hannesrudolph 2f321e9
fix: address PR #5491 review feedback
hannesrudolph 83b6f3c
refactor: simplify command allow/deny implementation
hannesrudolph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -54,7 +54,54 @@ export async function executeCommandTool( | |||||
| cline.consecutiveMistakeCount = 0 | ||||||
|
|
||||||
| command = unescapeHtmlEntities(command) // Unescape HTML entities. | ||||||
| const didApprove = await askApproval("command", command) | ||||||
|
|
||||||
| // Parse suggestions if provided | ||||||
| let suggestions: string[] | undefined | ||||||
| if (block.params.suggestions) { | ||||||
| try { | ||||||
| // Handle if suggestions is already an array (from direct tool use) | ||||||
| if (Array.isArray(block.params.suggestions)) { | ||||||
| suggestions = block.params.suggestions | ||||||
| } else if (typeof block.params.suggestions === "string") { | ||||||
| const suggestionsString = block.params.suggestions | ||||||
|
|
||||||
| // First try to parse as JSON array | ||||||
| if (suggestionsString.trim().startsWith("[")) { | ||||||
| try { | ||||||
| const parsed = JSON.parse(suggestionsString) | ||||||
| if (Array.isArray(parsed)) { | ||||||
| suggestions = parsed | ||||||
| } | ||||||
| } catch (jsonError) { | ||||||
| // Fall through to XML parsing | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // If not JSON or JSON parsing failed, try to parse individual <suggest> tags | ||||||
| if (!suggestions) { | ||||||
| const individualSuggestMatches = suggestionsString.match(/<suggest>(.*?)<\/suggest>/g) | ||||||
| if (individualSuggestMatches) { | ||||||
| suggestions = individualSuggestMatches | ||||||
| .map((match) => { | ||||||
| const content = match.match(/<suggest>(.*?)<\/suggest>/) | ||||||
| return content ? content[1].trim() : "" | ||||||
| }) | ||||||
| .filter((suggestion) => suggestion.length > 0) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } catch (e) { | ||||||
| // If parsing fails, ignore suggestions | ||||||
| console.warn("Failed to parse suggestions:", e) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| // Pass suggestions as part of the command text in a structured format | ||||||
| const commandWithSuggestions = suggestions | ||||||
| ? `${command}\n<suggestions>${JSON.stringify(suggestions)}</suggestions>` | ||||||
|
||||||
| ? `${command}\n<suggestions>${JSON.stringify(suggestions)}</suggestions>` | |
| ? `${command}\n<suggestions>\n${suggestions.join("\n")}\n</suggestions>` |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] This suggestion-parsing logic duplicates the code in
parseCommandAndOutput; consider extracting it into a shared utility to avoid duplication.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with this parsing should be centralized in Roo's core.
Alternatively, cherry-pick this commit which provides a generalized way of passing metadata down from the tool into the web view:
a2bd68b