mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-21 02:24:09 -07:00
initial redirection changes
This commit is contained in:
@@ -63,6 +63,15 @@ export const ToolConfirmationMessage: React.FC<
|
||||
const allowPermanentApproval =
|
||||
settings.merged.security.enablePermanentToolApproval;
|
||||
|
||||
const containsRedirection = useMemo(() => {
|
||||
if (confirmationDetails.type !== 'exec') return false;
|
||||
const commandsToDisplay =
|
||||
confirmationDetails.commands && confirmationDetails.commands.length > 1
|
||||
? confirmationDetails.commands
|
||||
: [confirmationDetails.command];
|
||||
return commandsToDisplay.some((cmd) => hasRedirection(cmd));
|
||||
}, [confirmationDetails]);
|
||||
|
||||
const handlesOwnUI =
|
||||
confirmationDetails.type === 'ask_user' ||
|
||||
confirmationDetails.type === 'exit_plan_mode';
|
||||
@@ -149,6 +158,13 @@ export const ToolConfirmationMessage: React.FC<
|
||||
key: 'Allow once',
|
||||
});
|
||||
if (isTrustedFolder) {
|
||||
if (containsRedirection) {
|
||||
options.push({
|
||||
label: 'Allow redirection for this session',
|
||||
value: ToolConfirmationOutcome.ProceedAlwaysRedirection,
|
||||
key: 'Allow redirection for this session',
|
||||
});
|
||||
}
|
||||
options.push({
|
||||
label: `Allow for this session`,
|
||||
value: ToolConfirmationOutcome.ProceedAlways,
|
||||
@@ -231,6 +247,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||
allowPermanentApproval,
|
||||
config,
|
||||
isDiffingEnabled,
|
||||
containsRedirection,
|
||||
]);
|
||||
|
||||
const availableBodyContentHeight = useCallback(() => {
|
||||
@@ -344,9 +361,6 @@ export const ToolConfirmationMessage: React.FC<
|
||||
executionProps.commands && executionProps.commands.length > 1
|
||||
? executionProps.commands
|
||||
: [executionProps.command];
|
||||
const containsRedirection = commandsToDisplay.some((cmd) =>
|
||||
hasRedirection(cmd),
|
||||
);
|
||||
|
||||
let bodyContentHeight = availableBodyContentHeight();
|
||||
let warnings: React.ReactNode = null;
|
||||
@@ -461,6 +475,7 @@ export const ToolConfirmationMessage: React.FC<
|
||||
availableBodyContentHeight,
|
||||
terminalWidth,
|
||||
handleConfirm,
|
||||
containsRedirection,
|
||||
]);
|
||||
|
||||
if (confirmationDetails.type === 'edit') {
|
||||
|
||||
+3
-2
@@ -8,7 +8,8 @@ Tip: Toggle auto-edit (Shift+Tab) to allow redirection in the future.
|
||||
Allow execution of: 'echo, redirection (>)'?
|
||||
|
||||
● 1. Allow once
|
||||
2. Allow for this session
|
||||
3. No, suggest changes (esc)
|
||||
2. Allow redirection for this session
|
||||
3. Allow for this session
|
||||
4. No, suggest changes (esc)
|
||||
"
|
||||
`;
|
||||
|
||||
@@ -683,6 +683,7 @@ export class Session {
|
||||
case ToolConfirmationOutcome.ProceedAlwaysAndSave:
|
||||
case ToolConfirmationOutcome.ProceedAlwaysServer:
|
||||
case ToolConfirmationOutcome.ProceedAlwaysTool:
|
||||
case ToolConfirmationOutcome.ProceedAlwaysRedirection:
|
||||
case ToolConfirmationOutcome.ModifyWithEditor:
|
||||
break;
|
||||
default: {
|
||||
|
||||
Reference in New Issue
Block a user