mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-13 05:12:55 -07:00
Co-authored-by: Miguel Solorio <miguelsolorio@google.com> Co-authored-by: Miguel Solorio <miguel.solorio07@gmail.com>
This commit is contained in:
@@ -54,6 +54,9 @@ export const Composer = () => {
|
|||||||
promptTokenCount: uiState.sessionStats.lastPromptTokenCount,
|
promptTokenCount: uiState.sessionStats.lastPromptTokenCount,
|
||||||
nightly: uiState.nightly,
|
nightly: uiState.nightly,
|
||||||
isTrustedFolder: uiState.isTrustedFolder,
|
isTrustedFolder: uiState.isTrustedFolder,
|
||||||
|
hideCWD: settings.merged.ui?.footer?.hideCWD || false,
|
||||||
|
hideSandboxStatus: settings.merged.ui?.footer?.hideSandboxStatus || false,
|
||||||
|
hideModelInfo: settings.merged.ui?.footer?.hideModelInfo || false,
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -107,12 +110,16 @@ export const Composer = () => {
|
|||||||
|
|
||||||
<Box
|
<Box
|
||||||
marginTop={1}
|
marginTop={1}
|
||||||
justifyContent="space-between"
|
justifyContent={
|
||||||
|
settings.merged.ui?.hideContextSummary
|
||||||
|
? 'flex-start'
|
||||||
|
: 'space-between'
|
||||||
|
}
|
||||||
width="100%"
|
width="100%"
|
||||||
flexDirection={isNarrow ? 'column' : 'row'}
|
flexDirection={isNarrow ? 'column' : 'row'}
|
||||||
alignItems={isNarrow ? 'flex-start' : 'center'}
|
alignItems={isNarrow ? 'flex-start' : 'center'}
|
||||||
>
|
>
|
||||||
<Box>
|
<Box marginRight={1}>
|
||||||
{process.env['GEMINI_SYSTEM_MD'] && (
|
{process.env['GEMINI_SYSTEM_MD'] && (
|
||||||
<Text color={theme.status.error}>|⌐■_■| </Text>
|
<Text color={theme.status.error}>|⌐■_■| </Text>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -156,4 +156,56 @@ describe('<Footer />', () => {
|
|||||||
vi.unstubAllEnvs();
|
vi.unstubAllEnvs();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('footer configuration filtering (golden snapshots)', () => {
|
||||||
|
it('renders complete footer with all sections visible (baseline)', () => {
|
||||||
|
const { lastFrame } = renderWithWidth(120, {
|
||||||
|
...defaultProps,
|
||||||
|
hideCWD: false,
|
||||||
|
hideSandboxStatus: false,
|
||||||
|
hideModelInfo: false,
|
||||||
|
});
|
||||||
|
expect(lastFrame()).toMatchSnapshot('complete-footer-wide');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders footer with all optional sections hidden (minimal footer)', () => {
|
||||||
|
const { lastFrame } = renderWithWidth(120, {
|
||||||
|
...defaultProps,
|
||||||
|
hideCWD: true,
|
||||||
|
hideSandboxStatus: true,
|
||||||
|
hideModelInfo: true,
|
||||||
|
});
|
||||||
|
expect(lastFrame()).toMatchSnapshot('footer-minimal');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders footer with only model info hidden (partial filtering)', () => {
|
||||||
|
const { lastFrame } = renderWithWidth(120, {
|
||||||
|
...defaultProps,
|
||||||
|
hideCWD: false,
|
||||||
|
hideSandboxStatus: false,
|
||||||
|
hideModelInfo: true,
|
||||||
|
});
|
||||||
|
expect(lastFrame()).toMatchSnapshot('footer-no-model');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders footer with CWD and model info hidden to test alignment (only sandbox visible)', () => {
|
||||||
|
const { lastFrame } = renderWithWidth(120, {
|
||||||
|
...defaultProps,
|
||||||
|
hideCWD: true,
|
||||||
|
hideSandboxStatus: false,
|
||||||
|
hideModelInfo: true,
|
||||||
|
});
|
||||||
|
expect(lastFrame()).toMatchSnapshot('footer-only-sandbox');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders complete footer in narrow terminal (baseline narrow)', () => {
|
||||||
|
const { lastFrame } = renderWithWidth(79, {
|
||||||
|
...defaultProps,
|
||||||
|
hideCWD: false,
|
||||||
|
hideSandboxStatus: false,
|
||||||
|
hideModelInfo: false,
|
||||||
|
});
|
||||||
|
expect(lastFrame()).toMatchSnapshot('complete-footer-narrow');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ export interface FooterProps {
|
|||||||
nightly: boolean;
|
nightly: boolean;
|
||||||
vimMode?: string;
|
vimMode?: string;
|
||||||
isTrustedFolder?: boolean;
|
isTrustedFolder?: boolean;
|
||||||
|
hideCWD?: boolean;
|
||||||
|
hideSandboxStatus?: boolean;
|
||||||
|
hideModelInfo?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Footer: React.FC<FooterProps> = ({
|
export const Footer: React.FC<FooterProps> = ({
|
||||||
@@ -49,6 +52,9 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
nightly,
|
nightly,
|
||||||
vimMode,
|
vimMode,
|
||||||
isTrustedFolder,
|
isTrustedFolder,
|
||||||
|
hideCWD = false,
|
||||||
|
hideSandboxStatus = false,
|
||||||
|
hideModelInfo = false,
|
||||||
}) => {
|
}) => {
|
||||||
const { columns: terminalWidth } = useTerminalSize();
|
const { columns: terminalWidth } = useTerminalSize();
|
||||||
|
|
||||||
@@ -60,17 +66,21 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
? path.basename(tildeifyPath(targetDir))
|
? path.basename(tildeifyPath(targetDir))
|
||||||
: shortenPath(tildeifyPath(targetDir), pathLength);
|
: shortenPath(tildeifyPath(targetDir), pathLength);
|
||||||
|
|
||||||
|
const justifyContent = hideCWD && hideModelInfo ? 'center' : 'space-between';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
justifyContent="space-between"
|
justifyContent={justifyContent}
|
||||||
width="100%"
|
width="100%"
|
||||||
flexDirection={isNarrow ? 'column' : 'row'}
|
flexDirection={isNarrow ? 'column' : 'row'}
|
||||||
alignItems={isNarrow ? 'flex-start' : 'center'}
|
alignItems={isNarrow ? 'flex-start' : 'center'}
|
||||||
>
|
>
|
||||||
|
{(debugMode || vimMode || !hideCWD) && (
|
||||||
<Box>
|
<Box>
|
||||||
{debugMode && <DebugProfiler />}
|
{debugMode && <DebugProfiler />}
|
||||||
{vimMode && <Text color={theme.text.secondary}>[{vimMode}] </Text>}
|
{vimMode && <Text color={theme.text.secondary}>[{vimMode}] </Text>}
|
||||||
{nightly ? (
|
{!hideCWD &&
|
||||||
|
(nightly ? (
|
||||||
<Gradient colors={theme.ui.gradient}>
|
<Gradient colors={theme.ui.gradient}>
|
||||||
<Text>
|
<Text>
|
||||||
{displayPath}
|
{displayPath}
|
||||||
@@ -84,19 +94,21 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
<Text color={theme.text.secondary}> ({branchName}*)</Text>
|
<Text color={theme.text.secondary}> ({branchName}*)</Text>
|
||||||
)}
|
)}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
))}
|
||||||
{debugMode && (
|
{debugMode && (
|
||||||
<Text color={theme.status.error}>
|
<Text color={theme.status.error}>
|
||||||
{' ' + (debugMessage || '--debug')}
|
{' ' + (debugMessage || '--debug')}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Middle Section: Centered Trust/Sandbox Info */}
|
{/* Middle Section: Centered Trust/Sandbox Info */}
|
||||||
|
{!hideSandboxStatus && (
|
||||||
<Box
|
<Box
|
||||||
flexGrow={isNarrow ? 0 : 1}
|
flexGrow={isNarrow || hideCWD || hideModelInfo ? 0 : 1}
|
||||||
alignItems="center"
|
alignItems="center"
|
||||||
justifyContent={isNarrow ? 'flex-start' : 'center'}
|
justifyContent={isNarrow || hideCWD ? 'flex-start' : 'center'}
|
||||||
display="flex"
|
display="flex"
|
||||||
paddingX={isNarrow ? 0 : 1}
|
paddingX={isNarrow ? 0 : 1}
|
||||||
paddingTop={isNarrow ? 1 : 0}
|
paddingTop={isNarrow ? 1 : 0}
|
||||||
@@ -121,9 +133,15 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Right Section: Gemini Label and Console Summary */}
|
{/* Right Section: Gemini Label and Console Summary */}
|
||||||
|
{(!hideModelInfo ||
|
||||||
|
showMemoryUsage ||
|
||||||
|
corgiMode ||
|
||||||
|
(!showErrorDetails && errorCount > 0)) && (
|
||||||
<Box alignItems="center" paddingTop={isNarrow ? 1 : 0}>
|
<Box alignItems="center" paddingTop={isNarrow ? 1 : 0}>
|
||||||
|
{!hideModelInfo && (
|
||||||
<Box alignItems="center">
|
<Box alignItems="center">
|
||||||
<Text color={theme.text.accent}>
|
<Text color={theme.text.accent}>
|
||||||
{isNarrow ? '' : ' '}
|
{isNarrow ? '' : ' '}
|
||||||
@@ -135,10 +153,11 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
</Text>
|
</Text>
|
||||||
{showMemoryUsage && <MemoryUsageDisplay />}
|
{showMemoryUsage && <MemoryUsageDisplay />}
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
<Box alignItems="center" paddingLeft={2}>
|
<Box alignItems="center" paddingLeft={2}>
|
||||||
{corgiMode && (
|
{corgiMode && (
|
||||||
<Text>
|
<Text>
|
||||||
<Text color={theme.ui.comment}>| </Text>
|
{!hideModelInfo && <Text color={theme.ui.comment}>| </Text>}
|
||||||
<Text color={theme.status.error}>▼</Text>
|
<Text color={theme.status.error}>▼</Text>
|
||||||
<Text color={theme.text.primary}>(´</Text>
|
<Text color={theme.text.primary}>(´</Text>
|
||||||
<Text color={theme.status.error}>ᴥ</Text>
|
<Text color={theme.status.error}>ᴥ</Text>
|
||||||
@@ -148,12 +167,13 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
)}
|
)}
|
||||||
{!showErrorDetails && errorCount > 0 && (
|
{!showErrorDetails && errorCount > 0 && (
|
||||||
<Box>
|
<Box>
|
||||||
<Text color={theme.ui.comment}>| </Text>
|
{!hideModelInfo && <Text color={theme.ui.comment}>| </Text>}
|
||||||
<ConsoleSummaryDisplay errorCount={errorCount} />
|
<ConsoleSummaryDisplay errorCount={errorCount} />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||||
|
|
||||||
|
exports[`<Footer /> > footer configuration filtering (golden snapshots) > renders complete footer in narrow terminal (baseline narrow) > complete-footer-narrow 1`] = `
|
||||||
|
"long (main*)
|
||||||
|
|
||||||
|
no sandbox (see /docs)
|
||||||
|
|
||||||
|
gemini-pro (100% context left)"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Footer /> > footer configuration filtering (golden snapshots) > renders complete footer with all sections visible (baseline) > complete-footer-wide 1`] = `
|
||||||
|
"...bar/and/some/more/directories/to/make/it/long no sandbox (see gemini-pro (100% context
|
||||||
|
(main*) /docs) left)"
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Footer /> > footer configuration filtering (golden snapshots) > renders footer with CWD and model info hidden to test alignment (only sandbox visible) > footer-only-sandbox 1`] = `" no sandbox (see /docs)"`;
|
||||||
|
|
||||||
|
exports[`<Footer /> > footer configuration filtering (golden snapshots) > renders footer with all optional sections hidden (minimal footer) > footer-minimal 1`] = `""`;
|
||||||
|
|
||||||
|
exports[`<Footer /> > footer configuration filtering (golden snapshots) > renders footer with only model info hidden (partial filtering) > footer-no-model 1`] = `"...bar/and/some/more/directories/to/make/it/long (main*) no sandbox (see /docs)"`;
|
||||||
Reference in New Issue
Block a user