2025-05-17 21:25:28 -07:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2025-08-26 00:04:53 +02:00
|
|
|
import type React from 'react';
|
2025-05-17 21:25:28 -07:00
|
|
|
import { Box, Text } from 'ink';
|
2025-09-10 10:57:07 -07:00
|
|
|
import { theme } from '../semantic-colors.js';
|
2025-06-25 05:41:11 -07:00
|
|
|
import { ApprovalMode } from '@google/gemini-cli-core';
|
2025-05-17 21:25:28 -07:00
|
|
|
|
2025-06-02 22:05:45 +02:00
|
|
|
interface AutoAcceptIndicatorProps {
|
|
|
|
|
approvalMode: ApprovalMode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const AutoAcceptIndicator: React.FC<AutoAcceptIndicatorProps> = ({
|
|
|
|
|
approvalMode,
|
|
|
|
|
}) => {
|
|
|
|
|
let textColor = '';
|
|
|
|
|
let textContent = '';
|
|
|
|
|
let subText = '';
|
|
|
|
|
|
|
|
|
|
switch (approvalMode) {
|
|
|
|
|
case ApprovalMode.AUTO_EDIT:
|
2025-09-11 10:34:29 -07:00
|
|
|
textColor = theme.status.warning;
|
2025-06-02 22:05:45 +02:00
|
|
|
textContent = 'accepting edits';
|
|
|
|
|
subText = ' (shift + tab to toggle)';
|
|
|
|
|
break;
|
|
|
|
|
case ApprovalMode.YOLO:
|
2025-09-10 10:57:07 -07:00
|
|
|
textColor = theme.status.error;
|
2025-06-02 22:05:45 +02:00
|
|
|
textContent = 'YOLO mode';
|
|
|
|
|
subText = ' (ctrl + y to toggle)';
|
|
|
|
|
break;
|
|
|
|
|
case ApprovalMode.DEFAULT:
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<Box>
|
|
|
|
|
<Text color={textColor}>
|
|
|
|
|
{textContent}
|
2025-09-10 10:57:07 -07:00
|
|
|
{subText && <Text color={theme.text.secondary}>{subText}</Text>}
|
2025-06-02 22:05:45 +02:00
|
|
|
</Text>
|
|
|
|
|
</Box>
|
|
|
|
|
);
|
|
|
|
|
};
|