From 8cd20301b7ddc3fcbd26f07355287f95fde6fcf2 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Tue, 10 Mar 2026 14:36:16 -0400 Subject: [PATCH] fix minor bugs such as maximum depth limit, settings dialog cases and build --- .../cli/src/ui/components/AskUserDialog.tsx | 9 +- .../ui/components/ExitPlanModeDialog.test.tsx | 6 + .../src/ui/components/ExitPlanModeDialog.tsx | 9 +- .../cli/src/ui/components/SettingsDialog.tsx | 2 +- ...tings-list-with-visual-indicators.snap.svg | 230 +++++++++--------- ...bility-settings-enabled-correctly.snap.svg | 230 +++++++++--------- ...olean-settings-disabled-correctly.snap.svg | 228 ++++++++--------- ...ld-render-default-state-correctly.snap.svg | 230 +++++++++--------- ...ing-settings-configured-correctly.snap.svg | 230 +++++++++--------- ...cused-on-scope-selector-correctly.snap.svg | 228 ++++++++--------- ...ean-and-number-settings-correctly.snap.svg | 228 ++++++++--------- ...s-and-security-settings-correctly.snap.svg | 230 +++++++++--------- ...oolean-settings-enabled-correctly.snap.svg | 228 ++++++++--------- .../messages/ToolConfirmationMessage.tsx | 9 +- packages/core/src/config/config.ts | 4 + 15 files changed, 1057 insertions(+), 1044 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index ee08534092..714720a4e8 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -1052,11 +1052,16 @@ export const AskUserDialog: React.FC = ({ isActive: questions.length > 1 && !submitted, }); + const onSubmitRef = useRef(onSubmit); + useEffect(() => { + onSubmitRef.current = onSubmit; + }, [onSubmit]); + useEffect(() => { if (submitted) { - onSubmit(answers); + onSubmitRef.current(answers); } - }, [submitted, answers, onSubmit]); + }, [submitted, answers]); const handleAnswer = useCallback( (answer: string) => { diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx index a09607170d..9462d9c3cc 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx @@ -20,6 +20,8 @@ import { import * as fs from 'node:fs'; import { useKeyMatchers } from '../hooks/useKeyMatchers.js'; +import { createMockSettings } from '../../test-utils/mockConfig.js'; + vi.mock('../utils/editorUtils.js', () => ({ openFileInEditor: vi.fn(), })); @@ -151,6 +153,7 @@ Implement a comprehensive authentication system with multiple providers. />, { ...options, + settings: createMockSettings(), config: { getTargetDir: () => mockTargetDir, getIdeMode: () => false, @@ -165,6 +168,7 @@ Implement a comprehensive authentication system with multiple providers. }), getUseAlternateBuffer: () => options?.useAlternateBuffer ?? true, getClearContextOnPlanApproval: () => undefined, + getClearContextOnPlanApprovalSessionOverride: () => undefined, setClearContextOnPlanApprovalSessionOverride: vi.fn(), } as unknown as import('@google/gemini-cli-core').Config, }, @@ -459,6 +463,7 @@ Implement a comprehensive authentication system with multiple providers. , { useAlternateBuffer, + settings: createMockSettings(), config: { getTargetDir: () => mockTargetDir, getIdeMode: () => false, @@ -472,6 +477,7 @@ Implement a comprehensive authentication system with multiple providers. }), getUseAlternateBuffer: () => useAlternateBuffer ?? true, getClearContextOnPlanApproval: () => undefined, + getClearContextOnPlanApprovalSessionOverride: () => undefined, setClearContextOnPlanApprovalSessionOverride: vi.fn(), } as unknown as import('@google/gemini-cli-core').Config, }, diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx index bb7451bfd6..da9691f20c 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx @@ -175,7 +175,7 @@ export const ExitPlanModeDialog: React.FC = ({ mode: ApprovalMode; clear: boolean; } | null>(null); - const { setSetting } = useSettingsStore(); + const { settings, setSetting } = useSettingsStore(); useEffect(() => { if (pendingApproval) { @@ -294,7 +294,12 @@ export const ExitPlanModeDialog: React.FC = ({ } if (nextMode) { - const clearContext = config.getClearContextOnPlanApproval(); + const sessionOverride = + config.getClearContextOnPlanApprovalSessionOverride(); + const persistentSetting = + settings.merged.general?.plan?.clearContextOnApproval; + const clearContext = sessionOverride ?? persistentSetting; + if (clearContext !== undefined) { onApprove(nextMode, clearContext); } else { diff --git a/packages/cli/src/ui/components/SettingsDialog.tsx b/packages/cli/src/ui/components/SettingsDialog.tsx index b8136254f3..7113163f76 100644 --- a/packages/cli/src/ui/components/SettingsDialog.tsx +++ b/packages/cli/src/ui/components/SettingsDialog.tsx @@ -275,7 +275,7 @@ export function SettingsDialog({ let newValue: SettingsValue; if (definition?.type === 'boolean') { - if (typeof currentValue !== 'boolean') { + if (typeof currentValue !== 'boolean' && currentValue !== undefined) { return; } newValue = !currentValue; diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Initial-Rendering-should-render-settings-list-with-visual-indicators.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Initial-Rendering-should-render-settings-list-with-visual-indicators.snap.svg index b4d435477a..eddb3d68be 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Initial-Rendering-should-render-settings-list-with-visual-indicators.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Initial-Rendering-should-render-settings-list-with-visual-indicators.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + false - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update - true - - - Enable automatic updates. - - - - + true + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-accessibility-settings-enabled-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-accessibility-settings-enabled-correctly.snap.svg index 4c7dd1001c..cbd3bfb5a8 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-accessibility-settings-enabled-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-accessibility-settings-enabled-correctly.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + true* - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update - true - - - Enable automatic updates. - - - - + true + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-all-boolean-settings-disabled-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-all-boolean-settings-disabled-correctly.snap.svg index ac64bd5295..70b74e92d3 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-all-boolean-settings-disabled-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-all-boolean-settings-disabled-correctly.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + false* - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update true* - - - Enable automatic updates. - - - - + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-default-state-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-default-state-correctly.snap.svg index b4d435477a..eddb3d68be 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-default-state-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-default-state-correctly.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + false - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update - true - - - Enable automatic updates. - - - - + true + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-file-filtering-settings-configured-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-file-filtering-settings-configured-correctly.snap.svg index b4d435477a..eddb3d68be 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-file-filtering-settings-configured-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-file-filtering-settings-configured-correctly.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + false - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update - true - - - Enable automatic updates. - - - - + true + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-focused-on-scope-selector-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-focused-on-scope-selector-correctly.snap.svg index cc297389e3..bfa8be5ff0 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-focused-on-scope-selector-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-focused-on-scope-selector-correctly.snap.svg @@ -4,136 +4,136 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + Settings - - - - - ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - - - Search to filter - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - + + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ + + + + Search to filter + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + + + Vim Mode - false - - - Enable Vim keybindings - - - - + false + + + Enable Vim keybindings + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update - true - - - Enable automatic updates. - - - - + true + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + > Apply To - - - + + + - - + + 1. - - + + User Settings - - - + + + 2. Workspace Settings - - + + 3. System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-mixed-boolean-and-number-settings-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-mixed-boolean-and-number-settings-correctly.snap.svg index 3b66401a58..3a88b33e72 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-mixed-boolean-and-number-settings-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-mixed-boolean-and-number-settings-correctly.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + false* - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update false* - - - Enable automatic updates. - - - - + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-tools-and-security-settings-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-tools-and-security-settings-correctly.snap.svg index b4d435477a..eddb3d68be 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-tools-and-security-settings-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-tools-and-security-settings-correctly.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + false - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update - true - - - Enable automatic updates. - - - - + true + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-various-boolean-settings-enabled-correctly.snap.svg b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-various-boolean-settings-enabled-correctly.snap.svg index 73a29bd34f..57b36b2ba8 100644 --- a/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-various-boolean-settings-enabled-correctly.snap.svg +++ b/packages/cli/src/ui/components/__snapshots__/SettingsDialog-SettingsDialog-Snapshot-Tests-should-render-various-boolean-settings-enabled-correctly.snap.svg @@ -4,142 +4,142 @@ - ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ - - - + ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ + + + > Settings - - - - + + + + ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ - - + + S - earch to filter + earch to filter - - + + ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ - - - - - - - - + + + + + + + + - - + + Vim Mode - - + + true* - - - - - Enable Vim keybindings - - - - - + + + + + Enable Vim keybindings + + + + + Default Approval Mode - Default - - - The default approval mode for tool execution. 'default' prompts for approval, 'au… - - - - + Default + + + The default approval mode for tool execution. 'default' prompts for approval, 'au… + + + + Enable Auto Update false* - - - Enable automatic updates. - - - - + + + Enable automatic updates. + + + + Enable Notifications - false - - - Enable run-event notifications for action-required prompts and session completion. … - - - - + false + + + Enable run-event notifications for action-required prompts and session completion. … + + + + Plan Directory - undefined - - - The directory where planning artifacts are stored. If not specified, defaults t… - - - - + 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… - - - - + true + + + Automatically switch between Pro and Flash models based on Plan Mode status. Uses Pr… + + + + Clear Context on Plan Approval - undefined - - - Automatically clear conversation context after a plan is approved and implement… - - - - + undefined + + + Automatically clear conversation context after a plan is approved and implement… + + + + Max Chat Model Attempts - 10 - - - Maximum number of attempts for requests to the main chat model. Cannot exceed 10. - - - - - - - - - + 10 + + + Maximum number of attempts for requests to the main chat model. Cannot exceed 10. + + + + + + + + + Apply To - - - + + + - - + + User Settings - - - + + + Workspace Settings - - + + System Settings - - - - - (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) - - - - ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ + + + + + (Use Enter to select, Ctrl+L to reset, Tab to change focus, Esc to close) + + + + ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ \ No newline at end of file diff --git a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx index b5ffc0dfd8..e167d8e662 100644 --- a/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolConfirmationMessage.tsx @@ -30,13 +30,12 @@ import { useKeypress } from '../../hooks/useKeypress.js'; import { theme } from '../../semantic-colors.js'; import { useSettings } from '../../contexts/SettingsContext.js'; import { useUIActions } from '../../contexts/UIActionsContext.js'; -import { keyMatchers, Command } from '../../key/keyMatchers.js'; +import { Command } from '../../key/keyMatchers.js'; import { formatCommand } from '../../key/keybindingUtils.js'; import { REDIRECTION_WARNING_NOTE_LABEL, REDIRECTION_WARNING_NOTE_TEXT, REDIRECTION_WARNING_TIP_LABEL, - REDIRECTION_WARNING_TIP_TEXT, } from '../../textConstants.js'; import { AskUserDialog } from '../AskUserDialog.js'; import { ExitPlanModeDialog } from '../ExitPlanModeDialog.js'; @@ -59,11 +58,6 @@ export interface ToolConfirmationMessageProps { terminalWidth: number; } -const REDIRECTION_WARNING_NOTE_LABEL = 'Note: '; -const REDIRECTION_WARNING_NOTE_TEXT = - 'Command contains redirection which can be undesirable.'; -const REDIRECTION_WARNING_TIP_LABEL = 'Tip: '; // Padded to align with "Note: " - export const ToolConfirmationMessage: React.FC< ToolConfirmationMessageProps > = ({ @@ -659,7 +653,6 @@ export const ToolConfirmationMessage: React.FC< isMcpToolDetailsExpanded, expandDetailsHintKey, mcpToolDetailsText, - getPreferredEditor, settings, ]); diff --git a/packages/core/src/config/config.ts b/packages/core/src/config/config.ts index e2d7ec30d0..4078f90bdd 100644 --- a/packages/core/src/config/config.ts +++ b/packages/core/src/config/config.ts @@ -2514,6 +2514,10 @@ export class Config implements McpContext, AgentLoopContext { ); } + getClearContextOnPlanApprovalSessionOverride(): boolean | undefined { + return this.clearContextOnPlanApprovalSessionOverride; + } + isClearContextOnPlanApprovalEnabled(): boolean { return this.getClearContextOnPlanApproval() ?? false; }