feat(cli): Add hideTips setting (#1524)
Co-authored-by: Allen Hutchison <adh@google.com>
This commit is contained in:
parent
1732e90d52
commit
d1eb86581c
|
@ -176,6 +176,15 @@ In addition to a project settings file, a project's `.gemini` directory can cont
|
||||||
"usageStatisticsEnabled": false
|
"usageStatisticsEnabled": false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **`hideTips`** (boolean):
|
||||||
|
- **Description:** Enables or disables helpful tips in the CLI interface.
|
||||||
|
- **Default:** `false`
|
||||||
|
- **Example:**
|
||||||
|
|
||||||
|
```json
|
||||||
|
"hideTips": true
|
||||||
|
```
|
||||||
|
|
||||||
### Example `settings.json`:
|
### Example `settings.json`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
@ -199,7 +208,8 @@ In addition to a project settings file, a project's `.gemini` directory can cont
|
||||||
"otlpEndpoint": "http://localhost:4317",
|
"otlpEndpoint": "http://localhost:4317",
|
||||||
"logPrompts": true
|
"logPrompts": true
|
||||||
},
|
},
|
||||||
"usageStatisticsEnabled": true
|
"usageStatisticsEnabled": true,
|
||||||
|
"hideTips": false
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,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;
|
||||||
|
|
||||||
// Add other settings here.
|
// Add other settings here.
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import {
|
||||||
} from '@google/gemini-cli-core';
|
} from '@google/gemini-cli-core';
|
||||||
import { LoadedSettings, SettingsFile, Settings } from '../config/settings.js';
|
import { LoadedSettings, SettingsFile, Settings } from '../config/settings.js';
|
||||||
import process from 'node:process';
|
import process from 'node:process';
|
||||||
|
import { Tips } from './components/Tips.js';
|
||||||
|
|
||||||
// Define a more complete mock server config based on actual Config
|
// Define a more complete mock server config based on actual Config
|
||||||
interface MockServerConfig {
|
interface MockServerConfig {
|
||||||
|
@ -173,6 +174,10 @@ vi.mock('../config/config.js', async (importOriginal) => {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
vi.mock('./components/Tips.js', () => ({
|
||||||
|
Tips: vi.fn(() => null),
|
||||||
|
}));
|
||||||
|
|
||||||
describe('App UI', () => {
|
describe('App UI', () => {
|
||||||
let mockConfig: MockServerConfig;
|
let mockConfig: MockServerConfig;
|
||||||
let mockSettings: LoadedSettings;
|
let mockSettings: LoadedSettings;
|
||||||
|
@ -379,6 +384,34 @@ describe('App UI', () => {
|
||||||
expect(lastFrame()).toContain('Using 2 MCP servers');
|
expect(lastFrame()).toContain('Using 2 MCP servers');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should display Tips component by default', async () => {
|
||||||
|
const { unmount } = render(
|
||||||
|
<App
|
||||||
|
config={mockConfig as unknown as ServerConfig}
|
||||||
|
settings={mockSettings}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
currentUnmount = unmount;
|
||||||
|
await Promise.resolve();
|
||||||
|
expect(vi.mocked(Tips)).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not display Tips component when hideTips is true', async () => {
|
||||||
|
mockSettings = createMockSettings({
|
||||||
|
hideTips: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const { unmount } = render(
|
||||||
|
<App
|
||||||
|
config={mockConfig as unknown as ServerConfig}
|
||||||
|
settings={mockSettings}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
currentUnmount = unmount;
|
||||||
|
await Promise.resolve();
|
||||||
|
expect(vi.mocked(Tips)).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
describe('when no theme is set', () => {
|
describe('when no theme is set', () => {
|
||||||
let originalNoColor: string | undefined;
|
let originalNoColor: string | undefined;
|
||||||
|
|
||||||
|
|
|
@ -584,7 +584,7 @@ const App = ({ config, settings, startupWarnings = [] }: AppProps) => {
|
||||||
items={[
|
items={[
|
||||||
<Box flexDirection="column" key="header">
|
<Box flexDirection="column" key="header">
|
||||||
<Header terminalWidth={terminalWidth} />
|
<Header terminalWidth={terminalWidth} />
|
||||||
<Tips config={config} />
|
{!settings.merged.hideTips && <Tips config={config} />}
|
||||||
{updateMessage && <UpdateNotification message={updateMessage} />}
|
{updateMessage && <UpdateNotification message={updateMessage} />}
|
||||||
</Box>,
|
</Box>,
|
||||||
...history.map((h) => (
|
...history.map((h) => (
|
||||||
|
|
Loading…
Reference in New Issue