feat: Add --yolo mode that automatically accepts all tools executions (#695)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Tolik Malibroda
2025-06-02 22:05:45 +02:00
committed by GitHub
parent 42bedbc3d3
commit 0795e55f0e
15 changed files with 364 additions and 156 deletions

View File

@@ -7,12 +7,41 @@
import React from 'react';
import { Box, Text } from 'ink';
import { Colors } from '../colors.js';
import { ApprovalMode } from '@gemini-code/core';
export const AutoAcceptIndicator: React.FC = () => (
<Box>
<Text color={Colors.AccentGreen}>
accepting edits
<Text color={Colors.SubtleComment}> (shift + tab to disable)</Text>
</Text>
</Box>
);
interface AutoAcceptIndicatorProps {
approvalMode: ApprovalMode;
}
export const AutoAcceptIndicator: React.FC<AutoAcceptIndicatorProps> = ({
approvalMode,
}) => {
let textColor = '';
let textContent = '';
let subText = '';
switch (approvalMode) {
case ApprovalMode.AUTO_EDIT:
textColor = Colors.AccentGreen;
textContent = 'accepting edits';
subText = ' (shift + tab to toggle)';
break;
case ApprovalMode.YOLO:
textColor = Colors.AccentRed;
textContent = 'YOLO mode';
subText = ' (ctrl + y to toggle)';
break;
case ApprovalMode.DEFAULT:
default:
break;
}
return (
<Box>
<Text color={textColor}>
{textContent}
{subText && <Text color={Colors.SubtleComment}>{subText}</Text>}
</Text>
</Box>
);
};