Files
gemini-cli/packages/cli/src/ui/components/Footer.tsx
T

92 lines
2.5 KiB
TypeScript
Raw Normal View History

/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
2025-04-15 21:41:08 -07:00
import React from 'react';
import { Box, Text } from 'ink';
2025-04-19 12:38:09 -04:00
import { Colors } from '../colors.js';
2025-05-28 23:30:05 +00:00
import { shortenPath, tildeifyPath } from '@gemini-code/server';
import { ConsoleSummaryDisplay } from './ConsoleSummaryDisplay.js';
2025-04-15 21:41:08 -07:00
interface FooterProps {
2025-05-28 23:30:05 +00:00
model: string;
targetDir: string;
branchName?: string;
2025-04-20 20:20:40 +01:00
debugMode: boolean;
debugMessage: string;
cliVersion: string;
2025-05-17 21:57:27 -07:00
corgiMode: boolean;
errorCount: number;
showErrorDetails: boolean;
2025-04-15 21:41:08 -07:00
}
2025-04-20 20:20:40 +01:00
export const Footer: React.FC<FooterProps> = ({
2025-05-28 23:30:05 +00:00
model,
targetDir,
branchName,
2025-04-20 20:20:40 +01:00
debugMode,
debugMessage,
2025-05-17 21:57:27 -07:00
corgiMode,
errorCount,
showErrorDetails,
2025-04-20 20:20:40 +01:00
}) => (
<Box marginTop={1} justifyContent="space-between" width="100%">
<Box>
2025-05-19 16:58:57 -07:00
<Text color={Colors.LightBlue}>
2025-05-28 23:30:05 +00:00
{shortenPath(tildeifyPath(targetDir), 70)}
{branchName && (
<Text color={Colors.SubtleComment}> ({branchName}*)</Text>
)}
2025-05-19 16:58:57 -07:00
</Text>
{debugMode && (
<Text color={Colors.AccentRed}>
2025-05-19 16:58:57 -07:00
{' ' + (debugMessage || '--debug')}
</Text>
)}
2025-04-17 18:06:21 -04:00
</Box>
{/* Middle Section: Centered Sandbox Info */}
<Box
flexGrow={1}
alignItems="center"
justifyContent="center"
display="flex"
>
{process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec' ? (
<Text color="green">
{process.env.SANDBOX.replace(/^gemini-(?:cli-)?/, '')}
</Text>
) : process.env.SANDBOX === 'sandbox-exec' ? (
<Text color={Colors.AccentYellow}>
sandbox-exec ({process.env.SEATBELT_PROFILE})
</Text>
) : (
<Text color={Colors.AccentRed}>no sandbox (see README)</Text>
)}
</Box>
{/* Right Section: Gemini Label and Console Summary */}
<Box alignItems="center">
2025-05-28 23:30:05 +00:00
<Text color={Colors.AccentBlue}> {model} </Text>
2025-05-17 21:57:27 -07:00
{corgiMode && (
<Text>
<Text color={Colors.SubtleComment}>| </Text>
<Text color={Colors.AccentRed}></Text>
<Text color={Colors.Foreground}>(´</Text>
<Text color={Colors.AccentRed}></Text>
<Text color={Colors.Foreground}>`)</Text>
<Text color={Colors.AccentRed}>▼ </Text>
</Text>
)}
{!showErrorDetails && errorCount > 0 && (
<Box>
<Text color={Colors.SubtleComment}>| </Text>
<ConsoleSummaryDisplay errorCount={errorCount} />
</Box>
)}
</Box>
2025-04-18 18:08:43 -04:00
</Box>
);