diff --git a/packages/a2a-server/src/utils/testing_utils.ts b/packages/a2a-server/src/utils/testing_utils.ts index 74e93f8f7b..be4c719262 100644 --- a/packages/a2a-server/src/utils/testing_utils.ts +++ b/packages/a2a-server/src/utils/testing_utils.ts @@ -20,6 +20,8 @@ import { import { createMockMessageBus } from '@google/gemini-cli-core/src/test-utils/mock-message-bus.js'; import type { Config, Storage } from '@google/gemini-cli-core'; import { expect, vi } from 'vitest'; +import os from 'node:os'; +import path from 'node:path'; export function createMockConfig( overrides: Partial = {}, @@ -43,8 +45,8 @@ export function createMockConfig( getCheckpointingEnabled: vi.fn().mockReturnValue(false), // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion storage: { - getProjectTempDir: () => '/tmp', - getProjectTempCheckpointsDir: () => '/tmp/checkpoints', + getProjectTempDir: () => os.tmpdir(), + getProjectTempCheckpointsDir: () => path.join(os.tmpdir(), 'checkpoints'), } as Storage, getTruncateToolOutputThreshold: () => DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD, diff --git a/packages/cli/src/config/extension-manager-themes.spec.ts b/packages/cli/src/config/extension-manager-themes.spec.ts index 7db2899929..2e8e3fb811 100644 --- a/packages/cli/src/config/extension-manager-themes.spec.ts +++ b/packages/cli/src/config/extension-manager-themes.spec.ts @@ -6,6 +6,7 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; +import * as os from 'node:os'; import { beforeAll, afterAll, @@ -29,7 +30,7 @@ describe('ExtensionManager theme loading', () => { beforeAll(async () => { tempHomeDir = await fs.promises.mkdtemp( - path.join(fs.realpathSync('/tmp'), 'gemini-cli-test-'), + path.join(os.tmpdir(), 'gemini-cli-test-'), ); }); diff --git a/packages/cli/src/ui/components/MainContent.test.tsx b/packages/cli/src/ui/components/MainContent.test.tsx index 395d5acc5b..850b71e0bb 100644 --- a/packages/cli/src/ui/components/MainContent.test.tsx +++ b/packages/cli/src/ui/components/MainContent.test.tsx @@ -32,6 +32,9 @@ const mockSettings = { output: { verbosity: 'info', }, + ui: { + enableCompactToolOutput: false, + }, }, }; @@ -97,6 +100,7 @@ describe('MainContent', () => { beforeEach(() => { vi.mocked(useAlternateBuffer).mockReturnValue(false); mockSettings.merged.output.verbosity = 'info'; + mockSettings.merged.ui.enableCompactToolOutput = false; }); afterEach(() => { diff --git a/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap index 7cfa551edf..d108cb8911 100644 --- a/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap @@ -1,5 +1,28 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html +exports[`AlternateBufferQuittingDisplay > renders with a tool awaiting confirmation > with_confirming_tool 1`] = ` +" + ███ █████████ +░░░███ ███░░░░░███ + ░░░███ ███ ░░░ + ░░░███░███ + ███░ ░███ █████ + ███░ ░░███ ░░███ + ███░ ░░█████████ +░░░ ░░░░░░░░░ + +Tips for getting started: +1. Ask questions, edit files, or run commands. +2. Be specific for the best results. +3. Create GEMINI.md files to customize your interactions with Gemini. +4. /help for more information. + +Action Required (was prompted): + +? confirming_tool Confirming tool description +" +`; + exports[`AlternateBufferQuittingDisplay > renders with active and pending tool messages > with_history_and_pending 1`] = ` " ███ █████████ @@ -16,20 +39,9 @@ Tips for getting started: 2. Be specific for the best results. 3. Create GEMINI.md files to customize your interactions with Gemini. 4. /help for more information. -╭─────────────────────────────────────────────────────────────────────────────╮ -│ ✓ tool1 Description for tool 1 │ -│ │ -╰─────────────────────────────────────────────────────────────────────────────╯ + ✓ tool1 Description for tool 1 -╭─────────────────────────────────────────────────────────────────────────────╮ -│ ✓ tool2 Description for tool 2 │ -│ │ -╰─────────────────────────────────────────────────────────────────────────────╯ - -╭─────────────────────────────────────────────────────────────────────────────╮ -│ o tool3 Description for tool 3 │ -│ │ -╰─────────────────────────────────────────────────────────────────────────────╯ + ✓ tool2 Description for tool 2 " `; @@ -67,15 +79,9 @@ Tips for getting started: 2. Be specific for the best results. 3. Create GEMINI.md files to customize your interactions with Gemini. 4. /help for more information. -╭─────────────────────────────────────────────────────────────────────────────╮ -│ ✓ tool1 Description for tool 1 │ -│ │ -╰─────────────────────────────────────────────────────────────────────────────╯ + ✓ tool1 Description for tool 1 -╭─────────────────────────────────────────────────────────────────────────────╮ -│ ✓ tool2 Description for tool 2 │ -│ │ -╰─────────────────────────────────────────────────────────────────────────────╯ + ✓ tool2 Description for tool 2 " `; @@ -94,12 +100,7 @@ Tips for getting started: 1. Ask questions, edit files, or run commands. 2. Be specific for the best results. 3. Create GEMINI.md files to customize your interactions with Gemini. -4. /help for more information. -╭─────────────────────────────────────────────────────────────────────────────╮ -│ o tool3 Description for tool 3 │ -│ │ -╰─────────────────────────────────────────────────────────────────────────────╯ -" +4. /help for more information." `; exports[`AlternateBufferQuittingDisplay > renders with user and gemini messages > with_user_gemini_messages 1`] = ` @@ -118,8 +119,9 @@ Tips for getting started: 2. Be specific for the best results. 3. Create GEMINI.md files to customize your interactions with Gemini. 4. /help for more information. - -> Hello Gemini - -✦ Hello User!" +▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ + > Hello Gemini +▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ +✦ Hello User! +" `; diff --git a/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap index cae69d7064..c773877fb3 100644 --- a/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/MainContent.test.tsx.snap @@ -26,9 +26,8 @@ AppHeader │ Line 18 │ │ Line 19 │ │ Line 20 │ -│ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - ShowMoreLines +ShowMoreLines " `; @@ -54,7 +53,7 @@ AppHeader │ Line 19 █ │ │ Line 20 █ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - ShowMoreLines +ShowMoreLines " `; @@ -79,7 +78,7 @@ exports[`MainContent > MainContent Tool Output Height Logic > 'Normal mode - Con │ Line 19 │ │ Line 20 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - ShowMoreLines +ShowMoreLines " `; @@ -104,7 +103,7 @@ exports[`MainContent > MainContent Tool Output Height Logic > 'Normal mode - Unc │ Line 19 │ │ Line 20 │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - ShowMoreLines +ShowMoreLines " `; diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/SettingsDialog.test.tsx.snap index ef63c3e244..2d05a2bf83 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog.test.tsx.snap @@ -10,10 +10,7 @@ exports[`SettingsDialog > Initial Rendering > should render settings list with v │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode false │ +│ ● Vim Mode false │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update true │ @@ -34,6 +31,9 @@ exports[`SettingsDialog > Initial Rendering > should render settings list with v │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -41,7 +41,7 @@ exports[`SettingsDialog > Initial Rendering > should render settings list with v │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -56,10 +56,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'accessibility settings │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode true* │ +│ ● Vim Mode true* │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update true │ @@ -80,6 +77,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'accessibility settings │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -87,7 +87,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'accessibility settings │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -102,10 +102,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'all boolean settings d │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode false* │ +│ ● Vim Mode false* │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update true* │ @@ -126,6 +123,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'all boolean settings d │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -133,7 +133,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'all boolean settings d │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -148,10 +148,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'default state' correct │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode false │ +│ ● Vim Mode false │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update true │ @@ -172,6 +169,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'default state' correct │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -179,7 +179,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'default state' correct │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -194,10 +194,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'file filtering setting │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode false │ +│ ● Vim Mode false │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update true │ @@ -218,6 +215,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'file filtering setting │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -225,7 +225,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'file filtering setting │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -240,9 +240,6 @@ exports[`SettingsDialog > Snapshot Tests > should render 'focused on scope selec │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ │ Vim Mode false │ │ Enable Vim keybindings │ │ │ @@ -264,6 +261,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'focused on scope selec │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ > Apply To │ @@ -271,7 +271,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'focused on scope selec │ 2. Workspace Settings │ │ 3. System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -286,10 +286,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'mixed boolean and numb │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode false* │ +│ ● Vim Mode false* │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update false* │ @@ -310,6 +307,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'mixed boolean and numb │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -317,7 +317,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'mixed boolean and numb │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -332,10 +332,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'tools and security set │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode false │ +│ ● Vim Mode false │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update true │ @@ -356,6 +353,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'tools and security set │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -363,7 +363,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'tools and security set │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; @@ -378,10 +378,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'various boolean settin │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ ▲ │ -│ ● Preview Features (e.g., models) false │ -│ Enable preview features (e.g., preview models). │ -│ │ -│ Vim Mode true* │ +│ ● Vim Mode true* │ │ Enable Vim keybindings │ │ │ │ Enable Auto Update false* │ @@ -402,6 +399,9 @@ exports[`SettingsDialog > Snapshot Tests > should render 'various boolean settin │ Verbose Output History true │ │ Show verbose output history. When enabled, output history will include autonomous to… │ │ │ +│ Auto Theme Switching true │ +│ Automatically switch between default light and dark themes based on terminal backgro… │ +│ │ │ ▼ │ │ │ │ Apply To │ @@ -409,7 +409,7 @@ exports[`SettingsDialog > Snapshot Tests > should render 'various boolean settin │ Workspace Settings │ │ System Settings │ │ │ -│ (Use Enter to select, Tab to change focus, Esc to close) │ +│ (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯" `; diff --git a/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap index a4238e2028..fa0d91b325 100644 --- a/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ToolConfirmationQueue.test.tsx.snap @@ -16,7 +16,7 @@ exports[`ToolConfirmationQueue > calculates availableContentHeight based on avai │ 4. No, suggest changes (esc) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ - Press ctrl-o to show more lines + Press ctrl-o to show more lines " `; @@ -58,7 +58,7 @@ exports[`ToolConfirmationQueue > renders expansion hint when content is long and │ 4. No, suggest changes (esc) │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ - Press ctrl-o to show more lines + Press ctrl-o to show more lines diff --git a/packages/cli/src/ui/components/messages/ToolConfirmationMessageOverflow.test.tsx b/packages/cli/src/ui/components/messages/ToolConfirmationMessageOverflow.test.tsx index b59b6c5adf..d2f2454885 100644 --- a/packages/cli/src/ui/components/messages/ToolConfirmationMessageOverflow.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolConfirmationMessageOverflow.test.tsx @@ -11,6 +11,7 @@ import type { Config, } from '@google/gemini-cli-core'; import { renderWithProviders } from '../../../test-utils/render.js'; +import { createMockSettings } from '../../../test-utils/settings.js'; import { useToolActions } from '../../contexts/ToolActionsContext.js'; import { StreamingState, @@ -101,6 +102,11 @@ describe('ToolConfirmationMessage Overflow', () => { streamingState: StreamingState.WaitingForConfirmation, constrainHeight: true, }, + settings: createMockSettings({ + ui: { + enableCompactToolOutput: false, + }, + }), }, ); diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx index 5368684ea2..de0ca01c0d 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx @@ -48,13 +48,22 @@ describe('', () => { enableEventDrivenScheduler: true, }); + const commonOptions = { + config: baseMockConfig, + settings: createMockSettings({ + ui: { + enableCompactToolOutput: false, + }, + }), + }; + describe('Golden Snapshots', () => { it('renders single successful tool call', () => { const toolCalls = [createToolCall()]; const { lastFrame, unmount } = renderWithProviders( , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -94,6 +103,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { + ...commonOptions, config: mockConfig, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], @@ -128,6 +138,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { + ...commonOptions, config: mockConfig, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], @@ -150,7 +161,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -190,6 +201,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { + ...commonOptions, config: mockConfig, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], @@ -223,7 +235,7 @@ describe('', () => { availableTerminalHeight={10} />, { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -242,7 +254,7 @@ describe('', () => { isFocused={false} />, { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -267,7 +279,7 @@ describe('', () => { terminalWidth={40} />, { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -281,7 +293,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: [] }], }, @@ -312,7 +324,7 @@ describe('', () => { , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -335,7 +347,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -369,7 +381,7 @@ describe('', () => { , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [ { type: 'tool_group', tools: toolCalls1 }, @@ -395,6 +407,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { + ...commonOptions, config: mockConfig, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], @@ -416,7 +429,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -438,7 +451,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -472,7 +485,7 @@ describe('', () => { availableTerminalHeight={20} />, { - config: baseMockConfig, + ...commonOptions, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], }, @@ -518,6 +531,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { + ...commonOptions, config: mockConfig, uiState: { pendingHistoryItems: [{ type: 'tool_group', tools: toolCalls }], @@ -544,6 +558,7 @@ describe('', () => { }), ]; const settings = createMockSettings({ + ui: { enableCompactToolOutput: false }, security: { enablePermanentToolApproval: true }, }); const mockConfig = makeFakeConfig({ @@ -555,6 +570,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , { + ...commonOptions, settings, config: mockConfig, uiState: { @@ -590,7 +606,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , - { config: mockConfig }, + { ...commonOptions, config: mockConfig }, ); expect(lastFrame()).not.toContain('Allow for all future sessions'); expect(lastFrame()).toMatchSnapshot(); @@ -617,7 +633,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , - { config: mockConfig }, + { ...commonOptions, config: mockConfig }, ); // Should render nothing because all tools in the group are confirming @@ -650,7 +666,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , - { config: mockConfig }, + { ...commonOptions, config: mockConfig }, ); const output = lastFrame(); @@ -679,7 +695,7 @@ describe('', () => { toolCalls={toolCalls} borderBottom={false} />, - { config: baseMockConfig }, + { ...commonOptions, config: baseMockConfig }, ); // AskUser tools in progress are rendered by AskUserDialog, so we expect nothing. expect(lastFrame()).toMatchSnapshot(); @@ -703,7 +719,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , - { config: baseMockConfig }, + { ...commonOptions, config: baseMockConfig }, ); expect(lastFrame()).toMatchSnapshot(); @@ -723,7 +739,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , - { config: baseMockConfig }, + { ...commonOptions, config: baseMockConfig }, ); expect(lastFrame()).toMatchSnapshot(); @@ -747,7 +763,7 @@ describe('', () => { const { lastFrame, unmount } = renderWithProviders( , - { config: baseMockConfig }, + { ...commonOptions, config: baseMockConfig }, ); expect(lastFrame()).toMatchSnapshot(); diff --git a/packages/cli/src/ui/components/messages/ToolResultDisplayOverflow.test.tsx b/packages/cli/src/ui/components/messages/ToolResultDisplayOverflow.test.tsx index f991171861..eb6d19d0ca 100644 --- a/packages/cli/src/ui/components/messages/ToolResultDisplayOverflow.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolResultDisplayOverflow.test.tsx @@ -7,6 +7,7 @@ import { describe, it, expect } from 'vitest'; import { ToolGroupMessage } from './ToolGroupMessage.js'; import { renderWithProviders } from '../../../test-utils/render.js'; +import { createMockSettings } from '../../../test-utils/settings.js'; import { StreamingState, ToolCallStatus, @@ -50,6 +51,11 @@ describe('ToolResultDisplay Overflow', () => { constrainHeight: true, }, useAlternateBuffer: false, + settings: createMockSettings({ + ui: { + enableCompactToolOutput: false, + }, + }), }, ); diff --git a/packages/cli/src/ui/components/messages/ToolStickyHeaderRegression.test.tsx b/packages/cli/src/ui/components/messages/ToolStickyHeaderRegression.test.tsx index 7755d882f2..a936c63b82 100644 --- a/packages/cli/src/ui/components/messages/ToolStickyHeaderRegression.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolStickyHeaderRegression.test.tsx @@ -5,6 +5,7 @@ */ import { renderWithProviders } from '../../../test-utils/render.js'; +import { createMockSettings } from '../../../test-utils/settings.js'; import { describe, it, expect, vi, afterEach } from 'vitest'; import { ToolGroupMessage } from './ToolGroupMessage.js'; import { ToolCallStatus } from '../../types.js'; @@ -98,6 +99,11 @@ describe('ToolMessage Sticky Header Regression', () => { { width: terminalWidth, uiState: { terminalWidth }, + settings: createMockSettings({ + ui: { + enableCompactToolOutput: false, + }, + }), }, ); @@ -184,6 +190,11 @@ describe('ToolMessage Sticky Header Regression', () => { { width: terminalWidth, uiState: { terminalWidth }, + settings: createMockSettings({ + ui: { + enableCompactToolOutput: false, + }, + }), }, ); diff --git a/packages/cli/src/ui/components/messages/__snapshots__/ShellToolMessage.test.tsx.snap b/packages/cli/src/ui/components/messages/__snapshots__/ShellToolMessage.test.tsx.snap index e8b04b7fce..483069bc56 100644 --- a/packages/cli/src/ui/components/messages/__snapshots__/ShellToolMessage.test.tsx.snap +++ b/packages/cli/src/ui/components/messages/__snapshots__/ShellToolMessage.test.tsx.snap @@ -161,6 +161,110 @@ exports[` > Height Constraints > uses full availableTerminal │ │" `; +exports[` > Height Constraints > uses full availableTerminalHeight when focused in alternate buffer mode 2`] = ` +"╭──────────────────────────────────────────────────────────────────────────────╮ +│ ⊷ Shell Command A shell command (Shift+Tab to unfocus) │ +│ │ +│ Line 3 │ +│ Line 4 │ +│ Line 5 █ │ +│ Line 6 █ │ +│ Line 7 █ │ +│ Line 8 █ │ +│ Line 9 █ │ +│ Line 10 █ │ +│ Line 11 █ │ +│ Line 12 █ │ +│ Line 13 █ │ +│ Line 14 █ │ +│ Line 15 █ │ +│ Line 16 █ │ +│ Line 17 █ │ +│ Line 18 █ │ +│ Line 19 █ │ +│ Line 20 █ │ +│ Line 21 █ │ +│ Line 22 █ │ +│ Line 23 █ │ +│ Line 24 █ │ +│ Line 25 █ │ +│ Line 26 █ │ +│ Line 27 █ │ +│ Line 28 █ │ +│ Line 29 █ │ +│ Line 30 █ │ +│ Line 31 █ │ +│ Line 32 █ │ +│ Line 33 █ │ +│ Line 34 █ │ +│ Line 35 █ │ +│ Line 36 █ │ +│ Line 37 █ │ +│ Line 38 █ │ +│ Line 39 █ │ +│ Line 40 █ │ +│ Line 41 █ │ +│ Line 42 █ │ +│ Line 43 █ │ +│ Line 44 █ │ +│ Line 45 █ │ +│ Line 46 █ │ +│ Line 47 █ │ +│ Line 48 █ │ +│ Line 49 █ │ +│ Line 50 █ │ +│ Line 51 █ │ +│ Line 52 █ │ +│ Line 53 █ │ +│ Line 54 █ │ +│ Line 55 █ │ +│ Line 56 █ │ +│ Line 57 █ │ +│ Line 58 █ │ +│ Line 59 █ │ +│ Line 60 █ │ +│ Line 61 █ │ +│ Line 62 █ │ +│ Line 63 █ │ +│ Line 64 █ │ +│ Line 65 █ │ +│ Line 66 █ │ +│ Line 67 █ │ +│ Line 68 █ │ +│ Line 69 █ │ +│ Line 70 █ │ +│ Line 71 █ │ +│ Line 72 █ │ +│ Line 73 █ │ +│ Line 74 █ │ +│ Line 75 █ │ +│ Line 76 █ │ +│ Line 77 █ │ +│ Line 78 █ │ +│ Line 79 █ │ +│ Line 80 █ │ +│ Line 81 █ │ +│ Line 82 █ │ +│ Line 83 █ │ +│ Line 84 █ │ +│ Line 85 █ │ +│ Line 86 █ │ +│ Line 87 █ │ +│ Line 88 █ │ +│ Line 89 █ │ +│ Line 90 █ │ +│ Line 91 █ │ +│ Line 92 █ │ +│ Line 93 █ │ +│ Line 94 █ │ +│ Line 95 █ │ +│ Line 96 █ │ +│ Line 97 █ │ +│ Line 98 █ │ +│ Line 99 █ │ +│ Line 100 █ │" +`; + exports[` > Snapshots > renders in Alternate Buffer mode while focused 1`] = ` "╭──────────────────────────────────────────────────────────────────────────────╮ │ ⊷ Shell Command A shell command (Shift+Tab to unfocus) │ @@ -169,6 +273,13 @@ exports[` > Snapshots > renders in Alternate Buffer mode whi │ │" `; +exports[` > Snapshots > renders in Alternate Buffer mode while focused 2`] = ` +"╭──────────────────────────────────────────────────────────────────────────────╮ +│ ⊷ Shell Command A shell command (Shift+Tab to unfocus) │ +│ │ +│ Test result │" +`; + exports[` > Snapshots > renders in Alternate Buffer mode while unfocused 1`] = ` "╭──────────────────────────────────────────────────────────────────────────────╮ │ ⊷ Shell Command A shell command │ diff --git a/packages/cli/src/ui/components/messages/__snapshots__/ToolConfirmationMessageOverflow.test.tsx.snap b/packages/cli/src/ui/components/messages/__snapshots__/ToolConfirmationMessageOverflow.test.tsx.snap index 2bbad0dc70..0a6f23e830 100644 --- a/packages/cli/src/ui/components/messages/__snapshots__/ToolConfirmationMessageOverflow.test.tsx.snap +++ b/packages/cli/src/ui/components/messages/__snapshots__/ToolConfirmationMessageOverflow.test.tsx.snap @@ -14,5 +14,6 @@ exports[`ToolConfirmationMessage Overflow > should display "press ctrl-o" hint w │ 4. No, suggest changes (esc) │ │ │ ╰──────────────────────────────────────────────────────────────────────────╯ - Press ctrl-o to show more lines" + Press ctrl-o to show more lines +" `; diff --git a/packages/cli/src/ui/components/messages/__snapshots__/ToolResultDisplayOverflow.test.tsx.snap b/packages/cli/src/ui/components/messages/__snapshots__/ToolResultDisplayOverflow.test.tsx.snap index 5d64da232b..a73d5cfdfc 100644 --- a/packages/cli/src/ui/components/messages/__snapshots__/ToolResultDisplayOverflow.test.tsx.snap +++ b/packages/cli/src/ui/components/messages/__snapshots__/ToolResultDisplayOverflow.test.tsx.snap @@ -10,5 +10,6 @@ exports[`ToolResultDisplay Overflow > should display "press ctrl-o" hint when co │ line 49 │ │ line 50 │ ╰──────────────────────────────────────────────────────────────────────────╯ - Press ctrl-o to show more lines" + Press ctrl-o to show more lines +" `; diff --git a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx index 1c4434a34a..fcf0d1e360 100644 --- a/packages/cli/src/ui/hooks/useGeminiStream.test.tsx +++ b/packages/cli/src/ui/hooks/useGeminiStream.test.tsx @@ -9,6 +9,7 @@ import type { Mock, MockInstance } from 'vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest'; import { act } from 'react'; import { renderHookWithProviders } from '../../test-utils/render.js'; +import { createMockSettings } from '../../test-utils/settings.js'; import { waitFor } from '../../test-utils/async.js'; import { useGeminiStream } from './useGeminiStream.js'; import { useKeypress } from './useKeypress.js'; @@ -293,7 +294,12 @@ describe('useGeminiStream', () => { }); const mockLoadedSettings: LoadedSettings = { - merged: { preferredEditor: 'vscode' }, + merged: { + preferredEditor: 'vscode', + ui: { + enableCompactToolOutput: true, + }, + }, user: { path: '/user/settings.json', settings: {} }, workspace: { path: '/workspace/.gemini/settings.json', settings: {} }, errors: [], @@ -301,6 +307,12 @@ describe('useGeminiStream', () => { setValue: vi.fn(), } as unknown as LoadedSettings; + const commonSettings = createMockSettings({ + ui: { + enableCompactToolOutput: true, + }, + }); + const renderTestHook = ( initialToolCalls: TrackedToolCall[] = [], geminiClient?: any, @@ -384,6 +396,7 @@ describe('useGeminiStream', () => { ), { initialProps, + settings: commonSettings, }, ); return { @@ -463,26 +476,30 @@ describe('useGeminiStream', () => { modelSwitched = false, } = options; - return renderHookWithProviders(() => - useGeminiStream( - new MockedGeminiClientClass(mockConfig), - [], - mockAddItem, - mockConfig, - mockLoadedSettings, - mockOnDebugMessage, - mockHandleSlashCommand, - shellModeActive, - () => 'vscode' as EditorType, - onAuthError, - performMemoryRefresh, - modelSwitched, - setModelSwitched, - onCancelSubmit, - setShellInputFocused, - 80, - 24, - ), + return renderHookWithProviders( + () => + useGeminiStream( + new MockedGeminiClientClass(mockConfig), + [], + mockAddItem, + mockConfig, + mockLoadedSettings, + mockOnDebugMessage, + mockHandleSlashCommand, + shellModeActive, + () => 'vscode' as EditorType, + onAuthError, + performMemoryRefresh, + modelSwitched, + setModelSwitched, + onCancelSubmit, + setShellInputFocused, + 80, + 24, + ), + { + settings: commonSettings, + }, ); }; @@ -2023,26 +2040,30 @@ describe('useGeminiStream', () => { })(), ); - const { result } = renderHookWithProviders(() => - useGeminiStream( - new MockedGeminiClientClass(mockConfig), - [], - mockAddItem, - mockConfig, - mockLoadedSettings, - mockOnDebugMessage, - mockHandleSlashCommand, - false, - () => 'vscode' as EditorType, - () => {}, - () => Promise.resolve(), - false, - () => {}, - () => {}, - () => {}, - 80, - 24, - ), + const { result } = renderHookWithProviders( + () => + useGeminiStream( + new MockedGeminiClientClass(mockConfig), + [], + mockAddItem, + mockConfig, + mockLoadedSettings, + mockOnDebugMessage, + mockHandleSlashCommand, + false, + () => 'vscode' as EditorType, + () => {}, + () => Promise.resolve(), + false, + () => {}, + () => {}, + () => {}, + 80, + 24, + ), + { + settings: commonSettings, + }, ); // Submit a query @@ -2527,26 +2548,30 @@ describe('useGeminiStream', () => { })(), ); - const { result } = renderHookWithProviders(() => - useGeminiStream( - new MockedGeminiClientClass(mockConfig), - [], - mockAddItem, - mockConfig, - mockLoadedSettings, - mockOnDebugMessage, - mockHandleSlashCommand, - false, - () => 'vscode' as EditorType, - () => {}, - () => Promise.resolve(), - false, - () => {}, - () => {}, - () => {}, - 80, - 24, - ), + const { result } = renderHookWithProviders( + () => + useGeminiStream( + new MockedGeminiClientClass(mockConfig), + [], + mockAddItem, + mockConfig, + mockLoadedSettings, + mockOnDebugMessage, + mockHandleSlashCommand, + false, + () => 'vscode' as EditorType, + () => {}, + () => Promise.resolve(), + false, + () => {}, + () => {}, + () => {}, + 80, + 24, + ), + { + settings: commonSettings, + }, ); // Submit first query to set a thought @@ -2609,26 +2634,30 @@ describe('useGeminiStream', () => { 0, ]); - const { result, rerender } = renderHookWithProviders(() => - useGeminiStream( - mockConfig.getGeminiClient(), - [], - mockAddItem, - mockConfig, - mockLoadedSettings, - mockOnDebugMessage, - mockHandleSlashCommand, - false, - () => 'vscode' as EditorType, - () => {}, - () => Promise.resolve(), - false, - () => {}, - () => {}, - () => {}, - 80, - 24, - ), + const { result, rerender } = renderHookWithProviders( + () => + useGeminiStream( + mockConfig.getGeminiClient(), + [], + mockAddItem, + mockConfig, + mockLoadedSettings, + mockOnDebugMessage, + mockHandleSlashCommand, + false, + () => 'vscode' as EditorType, + () => {}, + () => Promise.resolve(), + false, + () => {}, + () => {}, + () => {}, + 80, + 24, + ), + { + settings: commonSettings, + }, ); const firstResult = result.current.pendingHistoryItems; @@ -2680,26 +2709,30 @@ describe('useGeminiStream', () => { })(), ); - const { result } = renderHookWithProviders(() => - useGeminiStream( - new MockedGeminiClientClass(mockConfig), - [], - mockAddItem, - mockConfig, - mockLoadedSettings, - mockOnDebugMessage, - mockHandleSlashCommand, - false, - () => 'vscode' as EditorType, - () => {}, - () => Promise.resolve(), - false, - () => {}, - () => {}, - () => {}, - 80, - 24, - ), + const { result } = renderHookWithProviders( + () => + useGeminiStream( + new MockedGeminiClientClass(mockConfig), + [], + mockAddItem, + mockConfig, + mockLoadedSettings, + mockOnDebugMessage, + mockHandleSlashCommand, + false, + () => 'vscode' as EditorType, + () => {}, + () => Promise.resolve(), + false, + () => {}, + () => {}, + () => {}, + 80, + 24, + ), + { + settings: commonSettings, + }, ); // Submit query @@ -2737,26 +2770,30 @@ describe('useGeminiStream', () => { })(), ); - const { result } = renderHookWithProviders(() => - useGeminiStream( - new MockedGeminiClientClass(mockConfig), - [], - mockAddItem, - mockConfig, - mockLoadedSettings, - mockOnDebugMessage, - mockHandleSlashCommand, - false, - () => 'vscode' as EditorType, - () => {}, - () => Promise.resolve(), - false, - () => {}, - () => {}, - () => {}, - 80, - 24, - ), + const { result } = renderHookWithProviders( + () => + useGeminiStream( + new MockedGeminiClientClass(mockConfig), + [], + mockAddItem, + mockConfig, + mockLoadedSettings, + mockOnDebugMessage, + mockHandleSlashCommand, + false, + () => 'vscode' as EditorType, + () => {}, + () => Promise.resolve(), + false, + () => {}, + () => {}, + () => {}, + 80, + 24, + ), + { + settings: commonSettings, + }, ); // Submit query @@ -2805,26 +2842,30 @@ describe('useGeminiStream', () => { })(), ); - const { result } = renderHookWithProviders(() => - useGeminiStream( - new MockedGeminiClientClass(mockConfig), - [], - mockAddItem, - mockConfig, - mockLoadedSettings, - mockOnDebugMessage, - mockHandleSlashCommand, - false, - () => 'vscode' as EditorType, - () => {}, - () => Promise.resolve(), - false, - () => {}, - () => {}, - () => {}, - 80, - 24, - ), + const { result } = renderHookWithProviders( + () => + useGeminiStream( + new MockedGeminiClientClass(mockConfig), + [], + mockAddItem, + mockConfig, + mockLoadedSettings, + mockOnDebugMessage, + mockHandleSlashCommand, + false, + () => 'vscode' as EditorType, + () => {}, + () => Promise.resolve(), + false, + () => {}, + () => {}, + () => {}, + 80, + 24, + ), + { + settings: commonSettings, + }, ); // Submit query