/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../colors.js'; import { shortenPath, tildeifyPath } from '@google/gemini-cli-core'; import { ConsoleSummaryDisplay } from './ConsoleSummaryDisplay.js'; import process from 'node:process'; import path from 'node:path'; import Gradient from 'ink-gradient'; import { MemoryUsageDisplay } from './MemoryUsageDisplay.js'; import { ContextUsageDisplay } from './ContextUsageDisplay.js'; import { DebugProfiler } from './DebugProfiler.js'; import { useTerminalSize } from '../hooks/useTerminalSize.js'; import { isNarrowWidth } from '../utils/isNarrowWidth.js'; interface FooterProps { model: string; targetDir: string; branchName?: string; debugMode: boolean; debugMessage: string; corgiMode: boolean; errorCount: number; showErrorDetails: boolean; showMemoryUsage?: boolean; promptTokenCount: number; nightly: boolean; vimMode?: string; } export const Footer: React.FC = ({ model, targetDir, branchName, debugMode, debugMessage, corgiMode, errorCount, showErrorDetails, showMemoryUsage, promptTokenCount, nightly, vimMode, }) => { const { columns: terminalWidth } = useTerminalSize(); const isNarrow = isNarrowWidth(terminalWidth); // Adjust path length based on terminal width const pathLength = Math.max(20, Math.floor(terminalWidth * 0.4)); const displayPath = isNarrow ? path.basename(tildeifyPath(targetDir)) : shortenPath(tildeifyPath(targetDir), pathLength); return ( {debugMode && } {vimMode && [{vimMode}] } {nightly ? ( {displayPath} {branchName && ({branchName}*)} ) : ( {displayPath} {branchName && ({branchName}*)} )} {debugMode && ( {' ' + (debugMessage || '--debug')} )} {/* Middle Section: Centered Sandbox Info */} {process.env.SANDBOX && process.env.SANDBOX !== 'sandbox-exec' ? ( {process.env.SANDBOX.replace(/^gemini-(?:cli-)?/, '')} ) : process.env.SANDBOX === 'sandbox-exec' ? ( macOS Seatbelt{' '} ({process.env.SEATBELT_PROFILE}) ) : ( no sandbox (see /docs) )} {/* Right Section: Gemini Label and Console Summary */} {isNarrow ? '' : ' '} {model}{' '} {corgiMode && ( | `) )} {!showErrorDetails && errorCount > 0 && ( | )} {showMemoryUsage && } ); };