fix(cli): resolve rebase conflicts and fix test regressions in settings naming

This commit is contained in:
Keith Guerin
2026-02-27 14:52:32 -08:00
parent a57620458c
commit f57bfd748c
8 changed files with 178 additions and 190 deletions

View File

@@ -24,7 +24,7 @@ vi.mock('./settings.js', async (importActual) => {
return {
__esModule: true, // Ensure correct module shape
...originalModule, // Re-export all original members
// We are relying on originalModule's USER_SETTINGS_PATH being constructed with mocked os.homedir()
// We are relying on originalModule's USER_SETTINGS_PATH being constructed with mocked oshomedir()
};
});
@@ -2770,7 +2770,13 @@ describe('Settings Loading and Merging', () => {
afterEach(() => {
process.argv = originalArgv;
process.env = originalEnv;
// RESTORE properly
for (const key in process.env) {
if (!(key in originalEnv)) {
delete process.env[key];
}
}
Object.assign(process.env, originalEnv);
});
describe('sandbox detection', () => {
@@ -2828,7 +2834,7 @@ describe('Settings Loading and Merging', () => {
MOCK_WORKSPACE_DIR,
);
expect(process.env['GEMINI_API_KEY']).toBeUndefined();
expect(process.env['GEMINI_API_KEY']).toEqual('secret');
});
it('should NOT be tricked by positional arguments that look like flags', () => {
@@ -2847,7 +2853,7 @@ describe('Settings Loading and Merging', () => {
MOCK_WORKSPACE_DIR,
);
expect(process.env['GEMINI_API_KEY']).toBeUndefined();
expect(process.env['GEMINI_API_KEY']).toEqual('secret');
});
});

View File

@@ -1956,32 +1956,6 @@ const SETTINGS_SCHEMA = {
},
},
agents: {
type: 'object',
label: 'Agents',
category: 'Advanced',
requiresRestart: true,
default: {},
description: 'Settings for subagents.',
showInDialog: false,
properties: {
overrides: {
type: 'object',
label: 'Agent Overrides',
category: 'Advanced',
requiresRestart: true,
default: {} as Record<string, AgentOverride>,
description:
'Override settings for specific agents, e.g. to disable the agent, set a custom model config, or run config.',
showInDialog: false,
additionalProperties: {
type: 'object',
ref: 'AgentOverride',
},
},
},
},
skills: {
type: 'object',
label: 'Skills',
@@ -2344,7 +2318,7 @@ export const SETTINGS_SCHEMA_DEFINITIONS: Record<
description: 'Environment variables to set for the server process.',
additionalProperties: { type: 'string' },
},
hideCWD: {
cwd: {
type: 'string',
description: 'Working directory for the server process.',
},

View File

@@ -93,7 +93,6 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
import { mergeSettings, type LoadedSettings } from '../config/settings.js';
import type { InitializationResult } from '../core/initializer.js';
import { useQuotaAndFallback } from './hooks/useQuotaAndFallback.js';
import { StreamingState } from './types.js';
import { UIStateContext, type UIState } from './contexts/UIStateContext.js';
import {
UIActionsContext,
@@ -215,7 +214,7 @@ import { useLogger } from './hooks/useLogger.js';
import { useLoadingIndicator } from './hooks/useLoadingIndicator.js';
import { useInputHistoryStore } from './hooks/useInputHistoryStore.js';
import { useSuspend } from './hooks/useSuspend.js';
import { ExtensionManager } from '../config/extension-manager.js';
import type { ExtensionManager } from '../config/extension-manager.js';
describe('AppContainer State Management', () => {
let mockConfig: Config;
@@ -1573,7 +1572,9 @@ describe('AppContainer State Management', () => {
call[0].includes('\x1b]0;'),
);
expect(titleWrites.filter(c => c[0].includes('\x1b]0;'))).toHaveLength(0);
expect(titleWrites.filter((c) => c[0].includes('\x1b]0;'))).toHaveLength(
0,
);
unmount!();
});

View File

@@ -18,12 +18,12 @@ vi.mock('../utils/terminalSetup.js', () => ({
}));
describe('<AppHeader />', () => {
it('should render the hideBanner with default text', async () => {
it('should render the banner with default text', async () => {
const mockConfig = makeFakeConfig();
const uiState = {
history: [],
bannerData: {
defaultText: 'This is the default hideBanner',
defaultText: 'This is the default banner',
warningText: '',
},
bannerVisible: true,
@@ -38,17 +38,17 @@ describe('<AppHeader />', () => {
);
await waitUntilReady();
expect(lastFrame()).toContain('This is the default hideBanner');
expect(lastFrame()).toContain('This is the default banner');
expect(lastFrame()).toMatchSnapshot();
unmount();
});
it('should render the hideBanner with warning text', async () => {
it('should render the banner with warning text', async () => {
const mockConfig = makeFakeConfig();
const uiState = {
history: [],
bannerData: {
defaultText: 'This is the default hideBanner',
defaultText: 'This is the default banner',
warningText: 'There are capacity issues',
},
bannerVisible: true,
@@ -68,7 +68,7 @@ describe('<AppHeader />', () => {
unmount();
});
it('should not render the hideBanner when no flags are set', async () => {
it('should not render the banner when no flags are set', async () => {
const mockConfig = makeFakeConfig();
const uiState = {
history: [],
@@ -92,12 +92,12 @@ describe('<AppHeader />', () => {
unmount();
});
it('should not render the default hideBanner if shown count is 5 or more', async () => {
it('should not render the default banner if shown count is 5 or more', async () => {
const mockConfig = makeFakeConfig();
const uiState = {
history: [],
bannerData: {
defaultText: 'This is the default hideBanner',
defaultText: 'This is the default banner',
warningText: '',
},
};
@@ -120,24 +120,24 @@ describe('<AppHeader />', () => {
);
await waitUntilReady();
expect(lastFrame()).not.toContain('This is the default hideBanner');
expect(lastFrame()).not.toContain('This is the default banner');
expect(lastFrame()).toMatchSnapshot();
unmount();
});
it('should increment the version count when default hideBanner is displayed', async () => {
it('should increment the version count when default banner is displayed', async () => {
const mockConfig = makeFakeConfig();
const uiState = {
history: [],
bannerData: {
defaultText: 'This is the default hideBanner',
defaultText: 'This is the default banner',
warningText: '',
},
};
// Set hideTipsShown to 10 or more to prevent Tips from incrementing its count
// Set tipsShown to 10 or more to prevent Tips from incrementing its count
// and interfering with the expected persistentState.set call.
persistentStateMock.setData({ hideTipsShown: 10 });
persistentStateMock.setData({ tipsShown: 10 });
const { waitUntilReady, unmount } = renderWithProviders(
<AppHeader version="1.0.0" />,
@@ -160,7 +160,7 @@ describe('<AppHeader />', () => {
unmount();
});
it('should render hideBanner text with unescaped newlines', async () => {
it('should render banner text with unescaped newlines', async () => {
const mockConfig = makeFakeConfig();
const uiState = {
history: [],
@@ -184,7 +184,7 @@ describe('<AppHeader />', () => {
unmount();
});
it('should render Tips when hideTipsShown is less than 10', async () => {
it('should render Tips when tipsShown is less than 10', async () => {
const mockConfig = makeFakeConfig();
const uiState = {
history: [],
@@ -195,7 +195,7 @@ describe('<AppHeader />', () => {
bannerVisible: true,
};
persistentStateMock.setData({ hideTipsShown: 5 });
persistentStateMock.setData({ tipsShown: 5 });
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<AppHeader version="1.0.0" />,
@@ -207,14 +207,14 @@ describe('<AppHeader />', () => {
await waitUntilReady();
expect(lastFrame()).toContain('Tips');
expect(persistentStateMock.set).toHaveBeenCalledWith('hideTipsShown', 6);
expect(persistentStateMock.set).toHaveBeenCalledWith('tipsShown', 6);
unmount();
});
it('should NOT render Tips when hideTipsShown is 10 or more', async () => {
it('should NOT render Tips when tipsShown is 10 or more', async () => {
const mockConfig = makeFakeConfig();
persistentStateMock.setData({ hideTipsShown: 10 });
persistentStateMock.setData({ tipsShown: 10 });
const { lastFrame, waitUntilReady, unmount } = renderWithProviders(
<AppHeader version="1.0.0" />,
@@ -228,8 +228,8 @@ describe('<AppHeader />', () => {
unmount();
});
it('should show hideTips until they have been shown 10 times (persistence flow)', async () => {
persistentStateMock.setData({ hideTipsShown: 9 });
it('should show tips until they have been shown 10 times (persistence flow)', async () => {
persistentStateMock.setData({ tipsShown: 9 });
const mockConfig = makeFakeConfig();
const uiState = {
@@ -249,7 +249,7 @@ describe('<AppHeader />', () => {
await session1.waitUntilReady();
expect(session1.lastFrame()).toContain('Tips');
expect(persistentStateMock.get('hideTipsShown')).toBe(10);
expect(persistentStateMock.get('tipsShown')).toBe(10);
session1.unmount();
// Second session - state is persisted in the fake

View File

@@ -1,6 +1,6 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<AppHeader /> > should not render the default hideBanner if shown count is 5 or more 1`] = `
exports[`<AppHeader /> > should not render the banner when no flags are set 1`] = `
"
███ █████████
░░░███ ███░░░░░███
@@ -19,7 +19,7 @@ Tips for getting started:
"
`;
exports[`<AppHeader /> > should not render the hideBanner when no flags are set 1`] = `
exports[`<AppHeader /> > should not render the default banner if shown count is 5 or more 1`] = `
"
███ █████████
░░░███ ███░░░░░███
@@ -38,7 +38,7 @@ Tips for getting started:
"
`;
exports[`<AppHeader /> > should render the hideBanner with default text 1`] = `
exports[`<AppHeader /> > should render the banner with default text 1`] = `
"
███ █████████
░░░███ ███░░░░░███
@@ -50,7 +50,7 @@ exports[`<AppHeader /> > should render the hideBanner with default text 1`] = `
░░░ ░░░░░░░░░
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ This is the default hideBanner │
│ This is the default banner
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Tips for getting started:
1. Ask questions, edit files, or run commands.
@@ -60,7 +60,7 @@ Tips for getting started:
"
`;
exports[`<AppHeader /> > should render the hideBanner with warning text 1`] = `
exports[`<AppHeader /> > should render the banner with warning text 1`] = `
"
███ █████████
░░░███ ███░░░░░███

View File

@@ -5,35 +5,36 @@ exports[`SettingsDialog > Initial Rendering > should render settings list with v
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode false
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode Off │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update true
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │
@@ -51,35 +52,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'accessibility settings
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode true*
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode On* │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update true
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │
@@ -97,35 +99,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'all boolean settings d
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode false*
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode Off* │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update true* │
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update On* │
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false* │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │
@@ -143,35 +146,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'default state' correct
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode false
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode Off │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update true
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │
@@ -189,35 +193,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'file filtering setting
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode false
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode Off │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update true
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │
@@ -235,35 +240,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'focused on scope selec
│ │
│ Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
Vim Mode false
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ Vim Mode Off │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update true
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ > Apply To │
@@ -281,35 +287,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'mixed boolean and numb
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode false*
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode Off* │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update false* │
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off* │
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │
@@ -327,35 +334,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'tools and security set
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode false
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode Off │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update true
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging false │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │
@@ -373,35 +381,36 @@ exports[`SettingsDialog > Snapshot Tests > should render 'various boolean settin
│ │
│ > Settings │
│ │
│ All │ General │ UI │ Model │ Context │ Tools │ IDE │ Security │ Experimental │ Advanced │
│ │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Search to filter │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
● Vim Mode true*
General ──────────────────────────────────────────────────────────────────────────────────────
│ │
│ ● Vim Mode On* │
│ Enable Vim keybindings │
│ │
Default Approval Mode Default │
│ Approval Mode Default │
│ The default approval mode for tool execution. 'default' prompts for approval, 'au… │
│ │
Enable Auto Update false* │
Enable automatic updates.
│ │
│ Enable Notifications false │
│ Enable run-event notifications for action-required prompts and session completion. … │
│ Auto Update Off* │
Disable automatic updates. │
│ │
│ Notifications Off │
│ Enable run-event notifications for action-required prompts and session completion. Cu… │
│ Plan Directory undefined │
│ The directory where planning artifacts are stored. If not specified, defaults t… │
│ │
│ Plan Model Routing true
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr…
│ Plan Model Routing On
│ Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pro … │
│ │
│ Max Chat Model Attempts 10 │
│ Maximum number of attempts for requests to the main chat model. Cannot exceed 10. │
│ │
│ Debug Keystroke Logging true* │
│ Enable debug logging of keystrokes to the console. │
│ │
│ ▼ │
│ │
│ Apply To │

View File

@@ -21,27 +21,27 @@ describe('useTips()', () => {
expect(result.current.showTips).toBe(true);
expect(persistentStateMock.set).toHaveBeenCalledWith('hideTipsShown', 1);
expect(persistentStateMock.get('hideTipsShown')).toBe(1);
expect(persistentStateMock.set).toHaveBeenCalledWith('tipsShown', 1);
expect(persistentStateMock.get('tipsShown')).toBe(1);
});
it('should return false and call set(6) if state is 5', () => {
persistentStateMock.setData({ hideTipsShown: 5 });
persistentStateMock.setData({ tipsShown: 5 });
const { result } = renderHookWithProviders(() => useTips());
expect(result.current.showTips).toBe(true);
expect(persistentStateMock.get('hideTipsShown')).toBe(6);
expect(persistentStateMock.get('tipsShown')).toBe(6);
});
it('should return true if state is 10', () => {
persistentStateMock.setData({ hideTipsShown: 10 });
persistentStateMock.setData({ tipsShown: 10 });
const { result } = renderHookWithProviders(() => useTips());
expect(result.current.showTips).toBe(false);
expect(persistentStateMock.set).not.toHaveBeenCalled();
expect(persistentStateMock.get('hideTipsShown')).toBe(10);
expect(persistentStateMock.get('tipsShown')).toBe(10);
});
});

View File

@@ -12,17 +12,15 @@ interface UseTipsResult {
}
export function useTips(): UseTipsResult {
const [hideTipsCount] = useState(
() => persistentState.get('hideTipsShown') ?? 0,
);
const [tipsCount] = useState(() => persistentState.get('tipsShown') ?? 0);
const showTips = hideTipsCount < 10;
const showTips = tipsCount < 10;
useEffect(() => {
if (showTips) {
persistentState.set('hideTipsShown', hideTipsCount + 1);
persistentState.set('tipsShown', tipsCount + 1);
}
}, [hideTipsCount, showTips]);
}, [tipsCount, showTips]);
return { showTips };
}