Disable tips after 10 runs (#17101)

This commit is contained in:
Adib234
2026-01-22 15:46:18 -05:00
committed by GitHub
parent 5d68d8cda5
commit 016a94ffaf
11 changed files with 327 additions and 91 deletions

View File

@@ -28,6 +28,13 @@ import { type HistoryItemToolGroup, StreamingState } from '../ui/types.js';
import { ToolActionsProvider } from '../ui/contexts/ToolActionsContext.js';
import { type Config } from '@google/gemini-cli-core';
import { FakePersistentState } from './persistentStateFake.js';
export const persistentStateMock = new FakePersistentState();
vi.mock('../utils/persistentState.js', () => ({
persistentState: persistentStateMock,
}));
// Wrapper around ink-testing-library's render that ensures act() is called
export const render = (
@@ -191,6 +198,7 @@ export const renderWithProviders = (
config = configProxy as unknown as Config,
useAlternateBuffer = true,
uiActions,
persistentState,
}: {
shellFocus?: boolean;
settings?: LoadedSettings;
@@ -200,6 +208,10 @@ export const renderWithProviders = (
config?: Config;
useAlternateBuffer?: boolean;
uiActions?: Partial<UIActions>;
persistentState?: {
get?: typeof persistentStateMock.get;
set?: typeof persistentStateMock.set;
};
} = {},
): ReturnType<typeof render> & { simulateClick: typeof simulateClick } => {
const baseState: UIState = new Proxy(
@@ -220,6 +232,15 @@ export const renderWithProviders = (
},
) as UIState;
if (persistentState?.get) {
persistentStateMock.get.mockImplementation(persistentState.get);
}
if (persistentState?.set) {
persistentStateMock.set.mockImplementation(persistentState.set);
}
persistentStateMock.mockClear();
const terminalWidth = width ?? baseState.terminalWidth;
let finalSettings = settings;
if (useAlternateBuffer !== undefined) {