diff --git a/ui-tui/src/components/prompts.tsx b/ui-tui/src/components/prompts.tsx index 98aba0789b..bfc603c51c 100644 --- a/ui-tui/src/components/prompts.tsx +++ b/ui-tui/src/components/prompts.tsx @@ -8,6 +8,7 @@ import { TextInput } from './textInput.js' const OPTS = ['once', 'session', 'always', 'deny'] as const const LABELS = { always: 'Always allow', deny: 'Deny', once: 'Allow once', session: 'Allow this session' } as const +const CMD_PREVIEW_LINES = 10 export function ApprovalPrompt({ onChoice, req, t }: ApprovalPromptProps) { const [sel, setSel] = useState(0) @@ -34,13 +35,28 @@ export function ApprovalPrompt({ onChoice, req, t }: ApprovalPromptProps) { } }) + const rawLines = req.command.split('\n') + const shown = rawLines.slice(0, CMD_PREVIEW_LINES) + const overflow = rawLines.length - shown.length + return ( ⚠ approval required · {req.description} - {req.command} + + {shown.map((line, i) => ( + + {line || ' '} + + ))} + + {overflow > 0 ? ( + … +{overflow} more line{overflow === 1 ? '' : 's'} (full text above) + ) : null} + + {OPTS.map((o, i) => (