Elffuss BraidHub

kikocis/continue public

feat(cli): show dangerous command once per session
Changeset480243bc3999144ed9d879aead4fdb15c80244f7f2021ecca76ca043f6d482ce
Authoruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-23 19:23 +05:30
Committeruinstinct <61635505+uinstinct@users.noreply.github.com> · 2025-09-23 19:23 +05:30
Parents578c9023eefa

Browse the files at this changeset

1 file changed

modified extensions/cli/src/ui/components/ToolPermissionSelector.tsx +12 −2
@@ -1,5 +1,5 @@
11 import { Box, Text, useInput } from "ink";
2-import React, { useState } from "react";
2+import React, { useEffect, useState } from "react";
33
44 import { ToolCallTitle } from "src/tools/ToolCallTitle.js";
55
@@ -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,13 @@
6164 }) => {
6265 const permissionOptions = getPermissionOptions();
6366 const [selectedIndex, setSelectedIndex] = useState(0);
67+ const showDynamicWarning =
68+ hasDynamicEvaluation && !hasShownDangerousCommandWarning;
69+ useEffect(() => {
70+ if (showDynamicWarning) {
71+ hasShownDangerousCommandWarning = true;
72+ }
73+ }, [showDynamicWarning]);
6474
6575 useInput((input, key) => {
6676 if (key.return) {
@@ -125,7 +135,7 @@
125135
126136 <Box marginTop={1} flexDirection="column">
127137 <Text color="dim">Would you like to continue?</Text>
128- {hasDynamicEvaluation && (
138+ {showDynamicWarning && (
129139 <Box marginTop={1}>
130140 <Text color="yellow" dimColor>
131141 Note: Dangerous commands will be blocked regardless of your