From 0a7f5be81f20cbc1476ee93a0a33589dc7e8ab19 Mon Sep 17 00:00:00 2001 From: Miguel Solorio Date: Tue, 2 Sep 2025 10:35:43 -0700 Subject: [PATCH] Add footer configuration settings (#7419) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- packages/cli/src/config/settings.ts | 4 + packages/cli/src/config/settingsSchema.ts | 55 ++++++ packages/cli/src/ui/App.test.tsx | 36 ++++ packages/cli/src/ui/App.tsx | 22 ++- .../src/ui/__snapshots__/App.test.tsx.snap | 6 +- .../cli/src/ui/components/Footer.test.tsx | 27 +++ packages/cli/src/ui/components/Footer.tsx | 164 ++++++++++-------- .../src/ui/components/MemoryUsageDisplay.tsx | 2 +- 8 files changed, 231 insertions(+), 85 deletions(-) diff --git a/packages/cli/src/config/settings.ts b/packages/cli/src/config/settings.ts index f7fb67ad92..b7bc25f321 100644 --- a/packages/cli/src/config/settings.ts +++ b/packages/cli/src/config/settings.ts @@ -45,6 +45,10 @@ const MIGRATION_MAP: Record = { hideTips: 'ui.hideTips', hideBanner: 'ui.hideBanner', hideFooter: 'ui.hideFooter', + hideCWD: 'ui.footer.hideCWD', + hideSandboxStatus: 'ui.footer.hideSandboxStatus', + hideModelInfo: 'ui.footer.hideModelInfo', + hideContextSummary: 'ui.hideContextSummary', showMemoryUsage: 'ui.showMemoryUsage', showLineNumbers: 'ui.showLineNumbers', showCitations: 'ui.showCitations', diff --git a/packages/cli/src/config/settingsSchema.ts b/packages/cli/src/config/settingsSchema.ts index 2cebe7392c..cf4c792893 100644 --- a/packages/cli/src/config/settingsSchema.ts +++ b/packages/cli/src/config/settingsSchema.ts @@ -192,6 +192,55 @@ export const SETTINGS_SCHEMA = { description: 'Hide the application banner', showInDialog: true, }, + hideContextSummary: { + type: 'boolean', + label: 'Hide Context Summary', + category: 'UI', + requiresRestart: false, + default: false, + description: + 'Hide the context summary (GEMINI.md, MCP servers) above the input.', + showInDialog: true, + }, + footer: { + type: 'object', + label: 'Footer', + category: 'UI', + requiresRestart: false, + default: {}, + description: 'Settings for the footer.', + showInDialog: false, + properties: { + hideCWD: { + type: 'boolean', + label: 'Hide CWD', + category: 'UI', + requiresRestart: false, + default: false, + description: + 'Hide the current working directory path in the footer.', + showInDialog: true, + }, + hideSandboxStatus: { + type: 'boolean', + label: 'Hide Sandbox Status', + category: 'UI', + requiresRestart: false, + default: false, + description: 'Hide the sandbox status indicator in the footer.', + showInDialog: true, + }, + hideModelInfo: { + type: 'boolean', + label: 'Hide Model Info', + category: 'UI', + requiresRestart: false, + default: false, + description: 'Hide the model name and context usage in the footer.', + showInDialog: true, + }, + }, + }, hideFooter: { type: 'boolean', label: 'Hide Footer', @@ -793,3 +842,9 @@ type InferSettings = { }; export type Settings = InferSettings; + +export interface FooterSettings { + hideCWD?: boolean; + hideSandboxStatus?: boolean; + hideModelInfo?: boolean; +} diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx index 7fffa15743..e0d5fc9922 100644 --- a/packages/cli/src/ui/App.test.tsx +++ b/packages/cli/src/ui/App.test.tsx @@ -653,6 +653,42 @@ describe('App UI', () => { ); }); + it('should not display context summary when hideContextSummary is true', async () => { + mockSettings = createMockSettings({ + workspace: { + ui: { hideContextSummary: true }, + }, + }); + vi.mocked(ideContext.getIdeContext).mockReturnValue({ + workspaceState: { + openFiles: [ + { + path: '/path/to/my-file.ts', + isActive: true, + selectedText: 'hello', + timestamp: 0, + }, + ], + }, + }); + mockConfig.getGeminiMdFileCount.mockReturnValue(1); + mockConfig.getAllGeminiMdFilenames.mockReturnValue(['GEMINI.md']); + + const { lastFrame, unmount } = renderWithProviders( + , + ); + currentUnmount = unmount; + await Promise.resolve(); + const output = lastFrame(); + expect(output).not.toContain('Using:'); + expect(output).not.toContain('open file'); + expect(output).not.toContain('GEMINI.md file'); + }); + it('should display default "GEMINI.md" in footer when contextFileName is not set and count is 1', async () => { mockConfig.getGeminiMdFileCount.mockReturnValue(1); mockConfig.getAllGeminiMdFilenames.mockReturnValue(['GEMINI.md']); diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index 2783942c2f..4bf0529c15 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -983,6 +983,8 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { ? " Press 'i' for INSERT mode and 'Esc' for NORMAL mode." : ' Type your message or @path/to/file'; + const hideContextSummary = settings.merged.ui?.hideContextSummary ?? false; + return ( @@ -1216,7 +1218,6 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { } elapsedTime={elapsedTime} /> - {/* Display queued messages below loading indicator */} {messageQueue.length > 0 && ( @@ -1248,10 +1249,11 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { )} )} - { ) : showEscapePrompt ? ( Press Esc again to clear. - ) : ( + ) : !hideContextSummary ? ( { blockedMcpServers={config.getBlockedMcpServers()} showToolDescriptions={showToolDescriptions} /> - )} + ) : null} - + {showAutoAcceptIndicator !== ApprovalMode.DEFAULT && !shellModeActive && ( { {shellModeActive && } - {showErrorDetails && ( @@ -1306,7 +1310,6 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => { )} - {isInputActive && ( { nightly={nightly} vimMode={vimModeEnabled ? vimMode : undefined} isTrustedFolder={isTrustedFolderState} + hideCWD={settings.merged.ui?.footer?.hideCWD} + hideSandboxStatus={settings.merged.ui?.footer?.hideSandboxStatus} + hideModelInfo={settings.merged.ui?.footer?.hideModelInfo} /> )} diff --git a/packages/cli/src/ui/__snapshots__/App.test.tsx.snap b/packages/cli/src/ui/__snapshots__/App.test.tsx.snap index f5425dba58..985eaa82a9 100644 --- a/packages/cli/src/ui/__snapshots__/App.test.tsx.snap +++ b/packages/cli/src/ui/__snapshots__/App.test.tsx.snap @@ -6,14 +6,14 @@ exports[`App UI > should render correctly with the prompt input box 1`] = ` ╭────────────────────────────────────────────────────────────────────────────────────────╮ │ > Type your message or @path/to/file │ ╰────────────────────────────────────────────────────────────────────────────────────────╯ -/test/dir no sandbox (see /docs) model (100% context left)" +/test/dir no sandbox (see /docs) model (100% context left)" `; exports[`App UI > should render the initial UI correctly 1`] = ` " I'm Feeling Lucky (esc to cancel, 0s) -/test/dir no sandbox (see /docs) model (100% context left)" +/test/dir no sandbox (see /docs) model (100% context left)" `; exports[`App UI > when in a narrow terminal > should render with a column layout 1`] = ` @@ -27,5 +27,5 @@ dir no sandbox (see /docs) -model (100% context left)| ✖ 5 errors (ctrl+o for details)" +model (100% context left) | ✖ 5 errors (ctrl+o for details)" `; diff --git a/packages/cli/src/ui/components/Footer.test.tsx b/packages/cli/src/ui/components/Footer.test.tsx index e3673dfee7..fbeb2eeef6 100644 --- a/packages/cli/src/ui/components/Footer.test.tsx +++ b/packages/cli/src/ui/components/Footer.test.tsx @@ -156,4 +156,31 @@ describe('