Elffuss BraidHub

kikocis/continue public

Merge pull request #7919 from uinstinct/cli-danger-command

feat(cli): show dangerous command once per session
Changeset5bee4eb963b8ddc9e60b87872708871d71c9e84fe9dc529d48ec0d5d2a57ea62
AuthorDallin Romney <dallinromney@gmail.com> · 2025-09-25 17:38 -07:00
CommitterGitHub <noreply@github.com> · 2025-09-25 17:38 -07:00
Parents73194e7d2826, df04de9d7ffe

Browse the files at this changeset

1 file changed

modified extensions/cli/src/ui/components/ToolPermissionSelector.tsx +10 −1
@@ -8,6 +8,9 @@
88
99 import { ToolPreview } from "./ToolPreview.js";
1010
11+// show dangerous commmand warning only once per CLI process
12+let hasShownDangerousCommandWarning = false;
13+
1114 interface PermissionOption {
1215 id: string;
1316 name: string;
@@ -61,6 +64,12 @@
6164 }) => {
6265 const permissionOptions = getPermissionOptions();
6366 const [selectedIndex, setSelectedIndex] = useState(0);
67+ const [initialHasShownDangerousCommand] = useState(
68+ hasShownDangerousCommandWarning,
69+ );
70+ hasShownDangerousCommandWarning = false;
71+ const showDynamicWarning =
72+ hasDynamicEvaluation && !initialHasShownDangerousCommand;
6473
6574 useInput((input, key) => {
6675 if (key.return) {
@@ -125,7 +134,7 @@
125134
126135 <Box marginTop={1} flexDirection="column">
127136 <Text color="dim">Would you like to continue?</Text>
128- {hasDynamicEvaluation && (
137+ {showDynamicWarning && (
129138 <Box marginTop={1}>
130139 <Text color="yellow" dimColor>
131140 Note: Dangerous commands will be blocked regardless of your