summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/FolderTrustDialog.tsx
diff options
context:
space:
mode:
authorshrutip90 <[email protected]>2025-08-21 00:38:12 -0700
committerGitHub <[email protected]>2025-08-21 07:38:12 +0000
commitba5309c4050efde8b0be0d9dd726e5c5f1a4c4c6 (patch)
treed34cc814b2968bc8a09add14128544afe0f4f529 /packages/cli/src/ui/components/FolderTrustDialog.tsx
parent0242ecd83a5b0673a6ef97a406a743b286ef12e2 (diff)
Force restart on trust level change to reload settings (#6713)
Diffstat (limited to 'packages/cli/src/ui/components/FolderTrustDialog.tsx')
-rw-r--r--packages/cli/src/ui/components/FolderTrustDialog.tsx62
1 files changed, 44 insertions, 18 deletions
diff --git a/packages/cli/src/ui/components/FolderTrustDialog.tsx b/packages/cli/src/ui/components/FolderTrustDialog.tsx
index 30f3ff52..88aea32c 100644
--- a/packages/cli/src/ui/components/FolderTrustDialog.tsx
+++ b/packages/cli/src/ui/components/FolderTrustDialog.tsx
@@ -12,6 +12,7 @@ import {
RadioSelectItem,
} from './shared/RadioButtonSelect.js';
import { useKeypress } from '../hooks/useKeypress.js';
+import * as process from 'process';
export enum FolderTrustChoice {
TRUST_FOLDER = 'trust_folder',
@@ -21,10 +22,12 @@ export enum FolderTrustChoice {
interface FolderTrustDialogProps {
onSelect: (choice: FolderTrustChoice) => void;
+ isRestarting?: boolean;
}
export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
onSelect,
+ isRestarting,
}) => {
useKeypress(
(key) => {
@@ -32,7 +35,16 @@ export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
onSelect(FolderTrustChoice.DO_NOT_TRUST);
}
},
- { isActive: true },
+ { isActive: !isRestarting },
+ );
+
+ useKeypress(
+ (key) => {
+ if (key.name === 'r') {
+ process.exit(0);
+ }
+ },
+ { isActive: !!isRestarting },
);
const options: Array<RadioSelectItem<FolderTrustChoice>> = [
@@ -51,24 +63,38 @@ export const FolderTrustDialog: React.FC<FolderTrustDialogProps> = ({
];
return (
- <Box
- flexDirection="column"
- borderStyle="round"
- borderColor={Colors.AccentYellow}
- padding={1}
- width="100%"
- marginLeft={1}
- >
- <Box flexDirection="column" marginBottom={1}>
- <Text bold>Do you trust this folder?</Text>
- <Text>
- Trusting a folder allows Gemini to execute commands it suggests. This
- is a security feature to prevent accidental execution in untrusted
- directories.
- </Text>
- </Box>
+ <Box flexDirection="column">
+ <Box
+ flexDirection="column"
+ borderStyle="round"
+ borderColor={Colors.AccentYellow}
+ padding={1}
+ width="100%"
+ marginLeft={1}
+ >
+ <Box flexDirection="column" marginBottom={1}>
+ <Text bold>Do you trust this folder?</Text>
+ <Text>
+ Trusting a folder allows Gemini to execute commands it suggests.
+ This is a security feature to prevent accidental execution in
+ untrusted directories.
+ </Text>
+ </Box>
- <RadioButtonSelect items={options} onSelect={onSelect} isFocused />
+ <RadioButtonSelect
+ items={options}
+ onSelect={onSelect}
+ isFocused={!isRestarting}
+ />
+ </Box>
+ {isRestarting && (
+ <Box marginLeft={1} marginTop={1}>
+ <Text color={Colors.AccentYellow}>
+ To see changes, Gemini CLI must be restarted. Press r to exit and
+ apply changes now.
+ </Text>
+ </Box>
+ )}
</Box>
);
};