feat(cli): add hideBanner setting to disable startup banner (#2803)

Co-authored-by: Pascal Birchler <pascalb@google.com>
This commit is contained in:
K 2025-07-14 10:07:31 +05:30 committed by GitHub
parent 8d0a4082a4
commit 3110e8f810
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 54 additions and 5 deletions

View File

@ -189,6 +189,15 @@ In addition to a project settings file, a project's `.gemini` directory can cont
"hideTips": true "hideTips": true
``` ```
- **`hideBanner`** (boolean):
- **Description:** Enables or disables the startup banner (ASCII art logo) in the CLI interface.
- **Default:** `false`
- **Example:**
```json
"hideBanner": true
```
- **`maxSessionTurns`** (number): - **`maxSessionTurns`** (number):
- **Description:** Sets the maximum number of turns for a session. If the session exceeds this limit, the CLI will stop processing and start a new chat. - **Description:** Sets the maximum number of turns for a session. If the session exceeds this limit, the CLI will stop processing and start a new chat.
- **Default:** `-1` (unlimited) - **Default:** `-1` (unlimited)
@ -222,6 +231,7 @@ In addition to a project settings file, a project's `.gemini` directory can cont
}, },
"usageStatisticsEnabled": true, "usageStatisticsEnabled": true,
"hideTips": false, "hideTips": false,
"hideBanner": false,
"maxSessionTurns": 10 "maxSessionTurns": 10
} }
``` ```

View File

@ -79,6 +79,7 @@ export interface Settings {
// UI setting. Does not display the ANSI-controlled terminal title. // UI setting. Does not display the ANSI-controlled terminal title.
hideWindowTitle?: boolean; hideWindowTitle?: boolean;
hideTips?: boolean; hideTips?: boolean;
hideBanner?: boolean;
// Setting for setting maximum number of user/model/tool turns in a session. // Setting for setting maximum number of user/model/tool turns in a session.
maxSessionTurns?: number; maxSessionTurns?: number;

View File

@ -187,6 +187,10 @@ vi.mock('./components/Tips.js', () => ({
Tips: vi.fn(() => null), Tips: vi.fn(() => null),
})); }));
vi.mock('./components/Header.js', () => ({
Header: vi.fn(() => null),
}));
describe('App UI', () => { describe('App UI', () => {
let mockConfig: MockServerConfig; let mockConfig: MockServerConfig;
let mockSettings: LoadedSettings; let mockSettings: LoadedSettings;
@ -445,6 +449,38 @@ describe('App UI', () => {
expect(vi.mocked(Tips)).not.toHaveBeenCalled(); expect(vi.mocked(Tips)).not.toHaveBeenCalled();
}); });
it('should display Header component by default', async () => {
const { Header } = await import('./components/Header.js');
const { unmount } = render(
<App
config={mockConfig as unknown as ServerConfig}
settings={mockSettings}
version={mockVersion}
/>,
);
currentUnmount = unmount;
await Promise.resolve();
expect(vi.mocked(Header)).toHaveBeenCalled();
});
it('should not display Header component when hideBanner is true', async () => {
const { Header } = await import('./components/Header.js');
mockSettings = createMockSettings({
user: { hideBanner: true },
});
const { unmount } = render(
<App
config={mockConfig as unknown as ServerConfig}
settings={mockSettings}
version={mockVersion}
/>,
);
currentUnmount = unmount;
await Promise.resolve();
expect(vi.mocked(Header)).not.toHaveBeenCalled();
});
it('should show tips if system says show, but workspace and user settings say hide', async () => { it('should show tips if system says show, but workspace and user settings say hide', async () => {
mockSettings = createMockSettings({ mockSettings = createMockSettings({
system: { hideTips: false }, system: { hideTips: false },

View File

@ -716,11 +716,13 @@ const App = ({ config, settings, startupWarnings = [], version }: AppProps) => {
key={staticKey} key={staticKey}
items={[ items={[
<Box flexDirection="column" key="header"> <Box flexDirection="column" key="header">
<Header {!settings.merged.hideBanner && (
terminalWidth={terminalWidth} <Header
version={version} terminalWidth={terminalWidth}
nightly={nightly} version={version}
/> nightly={nightly}
/>
)}
{!settings.merged.hideTips && <Tips config={config} />} {!settings.merged.hideTips && <Tips config={config} />}
</Box>, </Box>,
...history.map((h) => ( ...history.map((h) => (