diff options
Diffstat (limited to 'packages/cli/src/ui/components/FolderTrustDialog.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/FolderTrustDialog.tsx | 62 |
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> ); }; |
