Changesets · Branches · Tags · Compare
| Changeset | 5bee4eb963b8ddc9e60b87872708871d71c9e84fe9dc529d48ec0d5d2a57ea62 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-09-25 17:38 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-25 17:38 -07:00 |
| Parents | 73194e7d2826, df04de9d7ffe |
1 file changed
modified extensions/cli/src/ui/components/ToolPermissionSelector.tsx +10 −1
| @@ -8,6 +8,9 @@ | ||
| 8 | 8 | |
| 9 | 9 | import { ToolPreview } from "./ToolPreview.js"; |
| 10 | 10 | |
| 11 | +// show dangerous commmand warning only once per CLI process | |
| 12 | +let hasShownDangerousCommandWarning = false; | |
| 13 | + | |
| 11 | 14 | interface PermissionOption { |
| 12 | 15 | id: string; |
| 13 | 16 | name: string; |
| @@ -61,6 +64,12 @@ | ||
| 61 | 64 | }) => { |
| 62 | 65 | const permissionOptions = getPermissionOptions(); |
| 63 | 66 | const [selectedIndex, setSelectedIndex] = useState(0); |
| 67 | + const [initialHasShownDangerousCommand] = useState( | |
| 68 | + hasShownDangerousCommandWarning, | |
| 69 | + ); | |
| 70 | + hasShownDangerousCommandWarning = false; | |
| 71 | + const showDynamicWarning = | |
| 72 | + hasDynamicEvaluation && !initialHasShownDangerousCommand; | |
| 64 | 73 | |
| 65 | 74 | useInput((input, key) => { |
| 66 | 75 | if (key.return) { |
| @@ -125,7 +134,7 @@ | ||
| 125 | 134 | |
| 126 | 135 | <Box marginTop={1} flexDirection="column"> |
| 127 | 136 | <Text color="dim">Would you like to continue?</Text> |
| 128 | - {hasDynamicEvaluation && ( | |
| 137 | + {showDynamicWarning && ( | |
| 129 | 138 | <Box marginTop={1}> |
| 130 | 139 | <Text color="yellow" dimColor> |
| 131 | 140 | Note: Dangerous commands will be blocked regardless of your |