feat: shell command explanation option#173
Conversation
Signed-off-by: crazywolf132 <crazywolf132@gmail.com>
|
Could you attach a small video of how it looks like? |
|
Will merge once there is a video attached that demonstrates this in action. |
Added a demo |
…ncy and upgrade 'zod' to version 3.24.3
|
This PR fixes a critical issue with the current flow, this PR requires this other PR to be merged too: |
|
Very nice. I will merge this, but in the future we will want to have the acting model explain the command based on the full context instead of delegating the explanation to a separate model. We will land this in a follow-up and will merge this as is as it's clearly useful and it's working well after trying it out locally. Thank you! |
| } catch (e) { | ||
| // In practice, there seem to be syntactically valid shell commands that | ||
| // shell-quote cannot parse, so we should not reject, but ask the user. | ||
| switch (policy) { |
There was a problem hiding this comment.
This should have stayed a switch statement because we have ESLint rules set up to ensure switch statements are exhaustive so that if a new variant of the ApprovalPolicy enum is introduced we are forced to address the existing callsites.
| }; | ||
| } | ||
|
|
||
| // In 'suggest' mode, all shell commands should require user permission |
There was a problem hiding this comment.
The point of isSafeCommand() is to avoid user permission.
| "openai": "^4.89.0", | ||
| "react": "^18.2.0", | ||
| "shell-quote": "^1.8.2", | ||
| "strip-ansi": "^7.1.0", |
There was a problem hiding this comment.
This should be in devDependencies.
Shell Command Explanation Option
Description
This PR adds an option to explain shell commands when the user is prompted to approve them (Fixes #110). When reviewing a shell command, users can now select "Explain this command" to get a detailed explanation of what the command does before deciding whether to approve or reject it.
Changes
ReviewDecisionenumBenefits
Testing
Screenshots
Additional Notes
The explanation is generated using the same model as the agent, ensuring consistency in the quality and style of explanations.