From 128dc99927c8b8261ea6d33b4d37ec1a0891ae47 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Tue, 3 Mar 2026 17:16:12 -0500 Subject: [PATCH 01/22] fix(cli): prevent plan truncation in approval dialog by supporting unconstrained heights Fixes #20716 --- .../cli/src/ui/components/AskUserDialog.tsx | 6 ++++- .../src/ui/components/ExitPlanModeDialog.tsx | 1 + .../ExitPlanModeDialog.test.tsx.snap | 24 ++++--------------- packages/core/src/confirmation-bus/types.ts | 2 ++ 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index 96065135100..3201ac394dd 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -789,9 +789,13 @@ const ChoiceQuestionView: React.FC = ({ const listHeight = availableHeight ? Math.max(1, availableHeight - overhead) : undefined; + const maxQuestionHeight = + question.unconstrainedHeight && listHeight + ? Math.max(1, listHeight - DIALOG_PADDING - selectionItems.length * 2) + : 15; const questionHeight = listHeight && !isAlternateBuffer - ? Math.min(15, Math.max(1, listHeight - DIALOG_PADDING)) + ? Math.min(maxQuestionHeight, Math.max(1, listHeight - DIALOG_PADDING)) : undefined; const maxItemsToShow = listHeight && questionHeight diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx index 39e1b8a1550..677bc479be2 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx @@ -247,6 +247,7 @@ export const ExitPlanModeDialog: React.FC = ({ ], placeholder: 'Type your feedback...', multiSelect: false, + unconstrainedHeight: true, }, ]} onSubmit={(answers) => { diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 073c106ceb3..54884fecdda 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -11,11 +11,7 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add tests in src/auth/__tests__/ - -Files to Modify - - - src/index.ts - Add auth middleware - - src/config.ts - Add auth configuration options +... last 5 lines hidden (Ctrl+O to show) ... 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -38,11 +34,7 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add tests in src/auth/__tests__/ - -Files to Modify - - - src/index.ts - Add auth middleware - - src/config.ts - Add auth configuration options +... last 5 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -70,11 +62,7 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add OAuth2 provider support in src/auth/providers/OAuth2Provider.ts - 5. Add SAML provider support in src/auth/providers/SAMLProvider.ts - 6. Add LDAP provider support in src/auth/providers/LDAPProvider.ts - 7. Create token refresh mechanism in src/auth/TokenManager.ts - 8. Add multi-factor authentication in src/auth/MFAService.ts -... last 22 lines hidden (Ctrl+O to show) ... +... last 26 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -97,11 +85,7 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add tests in src/auth/__tests__/ - -Files to Modify - - - src/index.ts - Add auth middleware - - src/config.ts - Add auth configuration options +... last 5 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically diff --git a/packages/core/src/confirmation-bus/types.ts b/packages/core/src/confirmation-bus/types.ts index aefafe0fa03..544571913c5 100644 --- a/packages/core/src/confirmation-bus/types.ts +++ b/packages/core/src/confirmation-bus/types.ts @@ -162,6 +162,8 @@ export interface Question { multiSelect?: boolean; /** Placeholder hint text. For type='text', shown in the input field. For type='choice', shown in the "Other" custom input. */ placeholder?: string; + /** Allow the question to consume more vertical space instead of being strictly capped. */ + unconstrainedHeight?: boolean; } export interface AskUserRequest { From 36b06f7333655f9c6bbb0c7a1638ed17de6ce095 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Wed, 4 Mar 2026 11:16:03 -0500 Subject: [PATCH 02/22] address bot comment --- .../cli/src/ui/components/AskUserDialog.tsx | 6 +++++- .../components/ToolConfirmationQueue.test.tsx | 3 ++- .../ExitPlanModeDialog.test.tsx.snap | 20 +++++++++++++++---- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index 3201ac394dd..d81cbca09c6 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -791,7 +791,11 @@ const ChoiceQuestionView: React.FC = ({ : undefined; const maxQuestionHeight = question.unconstrainedHeight && listHeight - ? Math.max(1, listHeight - DIALOG_PADDING - selectionItems.length * 2) + ? // When unconstrained, give the question a majority of the vertical space (e.g., 70%). + // The options list will take the remaining space and scroll if necessary. + // This is more robust than calculating based on `selectionItems.length`, + // which can incorrectly shrink the question if there are many options. + Math.max(1, Math.floor(listHeight * 0.7)) : 15; const questionHeight = listHeight && !isAlternateBuffer diff --git a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx index 7b45bd0458e..26d3baeca6d 100644 --- a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx +++ b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx @@ -282,7 +282,8 @@ describe('ToolConfirmationQueue', () => { // hideToolIdentity is true for ask_user -> subtracts 4 instead of 6 // availableContentHeight = 19 - 4 = 15 // ToolConfirmationMessage handlesOwnUI=true -> returns full 15 - // AskUserDialog uses 15 lines to render its multi-line question and options. + // AskUserDialog allocates maxQuestionHeight = floor(15 * 0.7) = 10. + // 10 lines is enough for the 6-line question + padding. await waitFor(() => { expect(lastFrame()).toContain('Line 6'); expect(lastFrame()).not.toContain('lines hidden'); diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 54884fecdda..8a39f4acaed 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -11,7 +11,10 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add tests in src/auth/__tests__/ -... last 5 lines hidden (Ctrl+O to show) ... + +Files to Modify + +... last 2 lines hidden (Ctrl+O to show) ... 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -34,7 +37,10 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add tests in src/auth/__tests__/ -... last 5 lines hidden (Ctrl+O to show) ... + +Files to Modify + +... last 2 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -62,7 +68,10 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add OAuth2 provider support in src/auth/providers/OAuth2Provider.ts -... last 26 lines hidden (Ctrl+O to show) ... + 5. Add SAML provider support in src/auth/providers/SAMLProvider.ts + 6. Add LDAP provider support in src/auth/providers/LDAPProvider.ts + 7. Create token refresh mechanism in src/auth/TokenManager.ts +... last 23 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -85,7 +94,10 @@ Implementation Steps 2. Add session storage in src/storage/SessionStore.ts 3. Update src/commands/index.ts to check auth status 4. Add tests in src/auth/__tests__/ -... last 5 lines hidden (Ctrl+O to show) ... + +Files to Modify + +... last 2 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically From 0f88ddb73eaa09e8beaf72bb82d1c42afd5a38ed Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Wed, 4 Mar 2026 12:56:31 -0500 Subject: [PATCH 03/22] address bot comments --- packages/cli/src/ui/components/AskUserDialog.tsx | 2 +- packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index d81cbca09c6..b5651f79bb0 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -795,7 +795,7 @@ const ChoiceQuestionView: React.FC = ({ // The options list will take the remaining space and scroll if necessary. // This is more robust than calculating based on `selectionItems.length`, // which can incorrectly shrink the question if there are many options. - Math.max(1, Math.floor(listHeight * 0.7)) + Math.max(5, Math.floor(listHeight * 0.7)) : 15; const questionHeight = listHeight && !isAlternateBuffer diff --git a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx index 26d3baeca6d..adf631bfff8 100644 --- a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx +++ b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx @@ -282,7 +282,8 @@ describe('ToolConfirmationQueue', () => { // hideToolIdentity is true for ask_user -> subtracts 4 instead of 6 // availableContentHeight = 19 - 4 = 15 // ToolConfirmationMessage handlesOwnUI=true -> returns full 15 - // AskUserDialog allocates maxQuestionHeight = floor(15 * 0.7) = 10. + // AskUserDialog allocates questionHeight = Math.min(maxQuestionHeight, Math.max(5, listHeight - DIALOG_PADDING)). + // maxQuestionHeight = floor(15 * 0.7) = 10. // 10 lines is enough for the 6-line question + padding. await waitFor(() => { expect(lastFrame()).toContain('Line 6'); From ec2d0a89d256d6e8922774280da53f6719f3346b Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 15:40:12 -0500 Subject: [PATCH 04/22] update to height based on all available height module fix overflow --- .../cli/src/ui/components/AskUserDialog.tsx | 28 ++++++++++--------- .../components/ToolConfirmationQueue.test.tsx | 7 +++-- .../__snapshots__/AskUserDialog.test.tsx.snap | 16 +++++++++++ .../src/ui/components/shared/MaxSizedBox.tsx | 14 ++++++++++ 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index b5651f79bb0..56a433934b0 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -12,6 +12,7 @@ import { useEffect, useReducer, useContext, + useState, } from 'react'; import { Box, Text } from 'ink'; import { theme } from '../semantic-colors.js'; @@ -782,28 +783,28 @@ const ChoiceQuestionView: React.FC = ({ } }, [customOptionText, isCustomOptionSelected, question.multiSelect]); + const [actualQuestionHeight, setActualQuestionHeight] = useState(0); + const HEADER_HEIGHT = progressHeader ? 2 : 0; const TITLE_MARGIN = 1; const FOOTER_HEIGHT = 2; // DialogFooter + margin const overhead = HEADER_HEIGHT + TITLE_MARGIN + FOOTER_HEIGHT; + const listHeight = availableHeight ? Math.max(1, availableHeight - overhead) : undefined; - const maxQuestionHeight = - question.unconstrainedHeight && listHeight - ? // When unconstrained, give the question a majority of the vertical space (e.g., 70%). - // The options list will take the remaining space and scroll if necessary. - // This is more robust than calculating based on `selectionItems.length`, - // which can incorrectly shrink the question if there are many options. - Math.max(5, Math.floor(listHeight * 0.7)) - : 15; - const questionHeight = + + // Modulo the fixed overflow (overhead + 4 lines reserved for list), use all remaining height. + const maxQuestionHeight = listHeight ? Math.max(5, listHeight - 4) : 15; + + const questionHeightLimit = listHeight && !isAlternateBuffer - ? Math.min(maxQuestionHeight, Math.max(1, listHeight - DIALOG_PADDING)) + ? Math.min(maxQuestionHeight, listHeight) : undefined; + const maxItemsToShow = - listHeight && questionHeight - ? Math.max(1, Math.floor((listHeight - questionHeight) / 2)) + listHeight && actualQuestionHeight + ? Math.max(1, Math.floor((listHeight - actualQuestionHeight) / 2)) : selectionItems.length; return ( @@ -811,9 +812,10 @@ const ChoiceQuestionView: React.FC = ({ {progressHeader} { // hideToolIdentity is true for ask_user -> subtracts 4 instead of 6 // availableContentHeight = 19 - 4 = 15 // ToolConfirmationMessage handlesOwnUI=true -> returns full 15 - // AskUserDialog allocates questionHeight = Math.min(maxQuestionHeight, Math.max(5, listHeight - DIALOG_PADDING)). - // maxQuestionHeight = floor(15 * 0.7) = 10. - // 10 lines is enough for the 6-line question + padding. + // AskUserDialog allocates questionHeight = availableHeight - overhead - minListHeight. + // listHeight = 15 - overhead (Header:0, Margin:1, Footer:2) = 12. + // maxQuestionHeight = listHeight - 4 = 8. + // 8 lines is enough for the 6-line question. await waitFor(() => { expect(lastFrame()).toContain('Line 6'); expect(lastFrame()).not.toContain('lines hidden'); diff --git a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap index 06f509f1f65..e3e43363688 100644 --- a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap @@ -36,6 +36,22 @@ Enter to select · ↑/↓ to navigate · Esc to cancel " `; +exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: false) > shows scroll arrows correctly when useAlternateBuffer is false 2`] = ` +"Choose an option + +▲ +● 1. Option 1 + Description 1 + 2. Option 2 + Description 2 + 3. Option 3 + Description 3 +▼ + +Enter to select · ↑/↓ to navigate · Esc to cancel +" +`; + exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: true) > shows scroll arrows correctly when useAlternateBuffer is true 1`] = ` "Choose an option diff --git a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx index ee91d34f57c..f365fea9a42 100644 --- a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx +++ b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx @@ -26,6 +26,7 @@ interface MaxSizedBoxProps { maxHeight?: number; overflowDirection?: 'top' | 'bottom'; additionalHiddenLinesCount?: number; + onHeightChange?: (height: number) => void; } /** @@ -38,6 +39,7 @@ export const MaxSizedBox: React.FC = ({ maxHeight, overflowDirection = 'top', additionalHiddenLinesCount = 0, + onHeightChange, }) => { const id = useId(); const { addOverflowingId, removeOverflowingId } = useOverflowActions() || {}; @@ -80,6 +82,18 @@ export const MaxSizedBox: React.FC = ({ ? effectiveMaxHeight - 1 : effectiveMaxHeight; + const actualHeight = + visibleContentHeight !== undefined + ? Math.min(contentHeight, visibleContentHeight) + : contentHeight; + + const totalActualHeight = + actualHeight + (isOverflowing && effectiveMaxHeight !== undefined ? 1 : 0); + + useEffect(() => { + onHeightChange?.(totalActualHeight); + }, [totalActualHeight, onHeightChange]); + const hiddenLinesCount = visibleContentHeight !== undefined ? Math.max(0, contentHeight - visibleContentHeight) From e5d97195d9fbea5f2715fb1a1666c46cc307f4d9 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 15:52:41 -0500 Subject: [PATCH 05/22] update snapshot --- .../ExitPlanModeDialog.test.tsx.snap | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 8a39f4acaed..75e3bf58e80 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -18,8 +18,8 @@ Files to Modify 1. Yes, automatically accept edits Approves plan and allows tools to run automatically -● 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool +● 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool 3. Type your feedback... Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel @@ -42,8 +42,8 @@ Files to Modify ... last 2 lines hidden (Ctrl+O to show) ... -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -99,8 +99,8 @@ Files to Modify ... last 2 lines hidden (Ctrl+O to show) ... -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -128,8 +128,8 @@ Files to Modify 1. Yes, automatically accept edits Approves plan and allows tools to run automatically -● 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool +● 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool 3. Type your feedback... Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel @@ -153,8 +153,8 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -206,8 +206,8 @@ Testing Strategy - Security penetration testing - Load testing for session management -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -233,8 +233,8 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... From c397c7259a84103c0ae2739264743ef0dae867ac Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 16:02:48 -0500 Subject: [PATCH 06/22] fix From 633ef48c91b153f1ed116bd424da3871838bd2d8 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 16:39:53 -0500 Subject: [PATCH 07/22] update snapshot --- .../ExitPlanModeDialog.test.tsx.snap | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 75e3bf58e80..2546d7a6e36 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -26,6 +26,33 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; +exports[`ExitPlanModeDialog > useAlternateBuffer: false > bubbles up Ctrl+C when feedback is empty while editing 2`] = ` +"Overview + +Add user authentication to the CLI application. + +Implementation Steps + + 1. Create src/auth/AuthService.ts with login/logout methods + 2. Add session storage in src/storage/SessionStore.ts + 3. Update src/commands/index.ts to check auth status + 4. Add tests in src/auth/__tests__/ + +Files to Modify + + - src/index.ts - Add auth middleware + - src/config.ts - Add auth configuration options + + 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically + 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool +● 3. Type your feedback... + +Enter to submit · Ctrl+X to edit plan · Esc to cancel +" +`; + exports[`ExitPlanModeDialog > useAlternateBuffer: false > calls onFeedback when feedback is typed and submitted 1`] = ` "Overview @@ -52,6 +79,33 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; +exports[`ExitPlanModeDialog > useAlternateBuffer: false > calls onFeedback when feedback is typed and submitted 2`] = ` +"Overview + +Add user authentication to the CLI application. + +Implementation Steps + + 1. Create src/auth/AuthService.ts with login/logout methods + 2. Add session storage in src/storage/SessionStore.ts + 3. Update src/commands/index.ts to check auth status + 4. Add tests in src/auth/__tests__/ + +Files to Modify + + - src/index.ts - Add auth middleware + - src/config.ts - Add auth configuration options + + 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically + 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool +● 3. Add tests + +Enter to submit · Ctrl+X to edit plan · Esc to cancel +" +`; + exports[`ExitPlanModeDialog > useAlternateBuffer: false > displays error state when file read fails 1`] = ` " Error reading plan: File not found " @@ -136,6 +190,33 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; +exports[`ExitPlanModeDialog > useAlternateBuffer: true > bubbles up Ctrl+C when feedback is empty while editing 2`] = ` +"Overview + +Add user authentication to the CLI application. + +Implementation Steps + + 1. Create src/auth/AuthService.ts with login/logout methods + 2. Add session storage in src/storage/SessionStore.ts + 3. Update src/commands/index.ts to check auth status + 4. Add tests in src/auth/__tests__/ + +Files to Modify + + - src/index.ts - Add auth middleware + - src/config.ts - Add auth configuration options + + 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically + 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool +● 3. Type your feedback... + +Enter to submit · Ctrl+X to edit plan · Esc to cancel +" +`; + exports[`ExitPlanModeDialog > useAlternateBuffer: true > calls onFeedback when feedback is typed and submitted 1`] = ` "Overview @@ -163,6 +244,33 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; +exports[`ExitPlanModeDialog > useAlternateBuffer: true > calls onFeedback when feedback is typed and submitted 2`] = ` +"Overview + +Add user authentication to the CLI application. + +Implementation Steps + + 1. Create src/auth/AuthService.ts with login/logout methods + 2. Add session storage in src/storage/SessionStore.ts + 3. Update src/commands/index.ts to check auth status + 4. Add tests in src/auth/__tests__/ + +Files to Modify + + - src/index.ts - Add auth middleware + - src/config.ts - Add auth configuration options + + 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically + 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool +● 3. Add tests + +Enter to submit · Ctrl+X to edit plan · Esc to cancel +" +`; + exports[`ExitPlanModeDialog > useAlternateBuffer: true > displays error state when file read fails 1`] = ` " Error reading plan: File not found " From 05b50f45a373cbf720454a483d1ffe4920093175 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 16:53:30 -0500 Subject: [PATCH 08/22] update snapshots --- .../__snapshots__/AskUserDialog.test.tsx.snap | 63 +++++++++- .../ExitPlanModeDialog.test.tsx.snap | 108 ------------------ 2 files changed, 61 insertions(+), 110 deletions(-) diff --git a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap index e3e43363688..96440266340 100644 --- a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap @@ -11,6 +11,17 @@ Enter to submit · Esc to cancel " `; +exports[`AskUserDialog > Choice question placeholder > uses default placeholder when not provided 2`] = ` +"Select your preferred language: + + 1. TypeScript + 2. JavaScript +● 3. Enter a custom value + +Enter to submit · Esc to cancel +" +`; + exports[`AskUserDialog > Choice question placeholder > uses placeholder for "Other" option when provided 1`] = ` "Select your preferred language: @@ -22,6 +33,17 @@ Enter to submit · Esc to cancel " `; +exports[`AskUserDialog > Choice question placeholder > uses placeholder for "Other" option when provided 2`] = ` +"Select your preferred language: + + 1. TypeScript + 2. JavaScript +● 3. Type another language... + +Enter to submit · Esc to cancel +" +`; + exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: false) > shows scroll arrows correctly when useAlternateBuffer is false 1`] = ` "Choose an option @@ -44,8 +66,6 @@ exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: false) > shows scrol Description 1 2. Option 2 Description 2 - 3. Option 3 - Description 3 ▼ Enter to select · ↑/↓ to navigate · Esc to cancel @@ -91,6 +111,45 @@ Enter to select · ↑/↓ to navigate · Esc to cancel " `; +exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: true) > shows scroll arrows correctly when useAlternateBuffer is true 2`] = ` +"Choose an option + +● 1. Option 1 + Description 1 + 2. Option 2 + Description 2 + 3. Option 3 + Description 3 + 4. Option 4 + Description 4 + 5. Option 5 + Description 5 + 6. Option 6 + Description 6 + 7. Option 7 + Description 7 + 8. Option 8 + Description 8 + 9. Option 9 + Description 9 + 10. Option 10 + Description 10 + 11. Option 11 + Description 11 + 12. Option 12 + Description 12 + 13. Option 13 + Description 13 + 14. Option 14 + Description 14 + 15. Option 15 + Description 15 + 16. Enter a custom value + +Enter to select · ↑/↓ to navigate · Esc to cancel +" +`; + exports[`AskUserDialog > Text type questions > renders text input for type: "text" 1`] = ` "What should we name this component? diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 2546d7a6e36..75e3bf58e80 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -26,33 +26,6 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; -exports[`ExitPlanModeDialog > useAlternateBuffer: false > bubbles up Ctrl+C when feedback is empty while editing 2`] = ` -"Overview - -Add user authentication to the CLI application. - -Implementation Steps - - 1. Create src/auth/AuthService.ts with login/logout methods - 2. Add session storage in src/storage/SessionStore.ts - 3. Update src/commands/index.ts to check auth status - 4. Add tests in src/auth/__tests__/ - -Files to Modify - - - src/index.ts - Add auth middleware - - src/config.ts - Add auth configuration options - - 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically - 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool -● 3. Type your feedback... - -Enter to submit · Ctrl+X to edit plan · Esc to cancel -" -`; - exports[`ExitPlanModeDialog > useAlternateBuffer: false > calls onFeedback when feedback is typed and submitted 1`] = ` "Overview @@ -79,33 +52,6 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; -exports[`ExitPlanModeDialog > useAlternateBuffer: false > calls onFeedback when feedback is typed and submitted 2`] = ` -"Overview - -Add user authentication to the CLI application. - -Implementation Steps - - 1. Create src/auth/AuthService.ts with login/logout methods - 2. Add session storage in src/storage/SessionStore.ts - 3. Update src/commands/index.ts to check auth status - 4. Add tests in src/auth/__tests__/ - -Files to Modify - - - src/index.ts - Add auth middleware - - src/config.ts - Add auth configuration options - - 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically - 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool -● 3. Add tests - -Enter to submit · Ctrl+X to edit plan · Esc to cancel -" -`; - exports[`ExitPlanModeDialog > useAlternateBuffer: false > displays error state when file read fails 1`] = ` " Error reading plan: File not found " @@ -190,33 +136,6 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; -exports[`ExitPlanModeDialog > useAlternateBuffer: true > bubbles up Ctrl+C when feedback is empty while editing 2`] = ` -"Overview - -Add user authentication to the CLI application. - -Implementation Steps - - 1. Create src/auth/AuthService.ts with login/logout methods - 2. Add session storage in src/storage/SessionStore.ts - 3. Update src/commands/index.ts to check auth status - 4. Add tests in src/auth/__tests__/ - -Files to Modify - - - src/index.ts - Add auth middleware - - src/config.ts - Add auth configuration options - - 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically - 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool -● 3. Type your feedback... - -Enter to submit · Ctrl+X to edit plan · Esc to cancel -" -`; - exports[`ExitPlanModeDialog > useAlternateBuffer: true > calls onFeedback when feedback is typed and submitted 1`] = ` "Overview @@ -244,33 +163,6 @@ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " `; -exports[`ExitPlanModeDialog > useAlternateBuffer: true > calls onFeedback when feedback is typed and submitted 2`] = ` -"Overview - -Add user authentication to the CLI application. - -Implementation Steps - - 1. Create src/auth/AuthService.ts with login/logout methods - 2. Add session storage in src/storage/SessionStore.ts - 3. Update src/commands/index.ts to check auth status - 4. Add tests in src/auth/__tests__/ - -Files to Modify - - - src/index.ts - Add auth middleware - - src/config.ts - Add auth configuration options - - 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically - 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool -● 3. Add tests - -Enter to submit · Ctrl+X to edit plan · Esc to cancel -" -`; - exports[`ExitPlanModeDialog > useAlternateBuffer: true > displays error state when file read fails 1`] = ` " Error reading plan: File not found " From f5c02538b24bcb7ce64e29b68720b2a7a8939d9b Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 17:31:54 -0500 Subject: [PATCH 09/22] plz work --- .../cli/src/ui/components/AskUserDialog.test.tsx | 14 +++++++++----- .../src/ui/components/ExitPlanModeDialog.test.tsx | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.test.tsx b/packages/cli/src/ui/components/AskUserDialog.test.tsx index 1bd29241db0..392d7f14d93 100644 --- a/packages/cli/src/ui/components/AskUserDialog.test.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.test.tsx @@ -268,8 +268,8 @@ describe('AskUserDialog', () => { expect(lastFrame()).not.toContain('▼'); } await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); }); + expect(lastFrame()).toMatchSnapshot(); }); }, ); @@ -569,8 +569,9 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); + expect(lastFrame()).toContain('Review your answers:'); }); + expect(lastFrame()).toMatchSnapshot(); writeKey(stdin, '\x1b[D'); // Left arrow back @@ -614,8 +615,9 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); + expect(lastFrame()).toContain('Review your answers:'); }); + expect(lastFrame()).toMatchSnapshot(); }); it('submits with unanswered questions when user confirms on Review', async () => { @@ -1309,8 +1311,9 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); + expect(lastFrame()).toContain('Type another language...'); }); + expect(lastFrame()).toMatchSnapshot(); }); it('uses default placeholder when not provided', async () => { @@ -1343,8 +1346,9 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toMatchSnapshot(); + expect(lastFrame()).toContain('Enter a custom value'); }); + expect(lastFrame()).toMatchSnapshot(); }); }); }); diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx index 2bf1f723a6e..cb56f236b4c 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx @@ -251,8 +251,9 @@ Implement a comprehensive authentication system with multiple providers. } await waitFor(() => { - expect(lastFrame()).toMatchSnapshot(); + expect(lastFrame()).toContain('Add tests'); }); + expect(lastFrame()).toMatchSnapshot(); writeKey(stdin, '\r'); @@ -469,8 +470,9 @@ Implement a comprehensive authentication system with multiple providers. writeKey(stdin, '\x03'); // Ctrl+C await waitFor(() => { - expect(lastFrame()).toMatchSnapshot(); + expect(lastFrame()).toContain('Type your feedback...'); }); + expect(lastFrame()).toMatchSnapshot(); expect(onBubbledQuit).not.toHaveBeenCalled(); // Second Ctrl+C to exit (should bubble) From 7490f285dae588f658f1a9fa8436dc4fd86d6bb6 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 23:10:50 -0500 Subject: [PATCH 10/22] update snapshots --- .../__snapshots__/AskUserDialog.test.tsx.snap | 97 +++---------------- .../ExitPlanModeDialog.test.tsx.snap | 21 ++-- 2 files changed, 26 insertions(+), 92 deletions(-) diff --git a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap index 96440266340..a14f90789ab 100644 --- a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap @@ -1,17 +1,6 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`AskUserDialog > Choice question placeholder > uses default placeholder when not provided 1`] = ` -"Select your preferred language: - - 1. TypeScript - 2. JavaScript -● 3. Enter a custom value - -Enter to submit · Esc to cancel -" -`; - -exports[`AskUserDialog > Choice question placeholder > uses default placeholder when not provided 2`] = ` "Select your preferred language: 1. TypeScript @@ -23,17 +12,6 @@ Enter to submit · Esc to cancel `; exports[`AskUserDialog > Choice question placeholder > uses placeholder for "Other" option when provided 1`] = ` -"Select your preferred language: - - 1. TypeScript - 2. JavaScript -● 3. Type another language... - -Enter to submit · Esc to cancel -" -`; - -exports[`AskUserDialog > Choice question placeholder > uses placeholder for "Other" option when provided 2`] = ` "Select your preferred language: 1. TypeScript @@ -47,71 +25,20 @@ Enter to submit · Esc to cancel exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: false) > shows scroll arrows correctly when useAlternateBuffer is false 1`] = ` "Choose an option -▲ -● 1. Option 1 - Description 1 - 2. Option 2 - Description 2 -▼ - -Enter to select · ↑/↓ to navigate · Esc to cancel -" -`; - -exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: false) > shows scroll arrows correctly when useAlternateBuffer is false 2`] = ` -"Choose an option - ▲ ● 1. Option 1 Description 1 2. Option 2 Description 2 -▼ - -Enter to select · ↑/↓ to navigate · Esc to cancel -" -`; - -exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: true) > shows scroll arrows correctly when useAlternateBuffer is true 1`] = ` -"Choose an option - -● 1. Option 1 - Description 1 - 2. Option 2 - Description 2 3. Option 3 Description 3 - 4. Option 4 - Description 4 - 5. Option 5 - Description 5 - 6. Option 6 - Description 6 - 7. Option 7 - Description 7 - 8. Option 8 - Description 8 - 9. Option 9 - Description 9 - 10. Option 10 - Description 10 - 11. Option 11 - Description 11 - 12. Option 12 - Description 12 - 13. Option 13 - Description 13 - 14. Option 14 - Description 14 - 15. Option 15 - Description 15 - 16. Enter a custom value +▼ Enter to select · ↑/↓ to navigate · Esc to cancel " `; -exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: true) > shows scroll arrows correctly when useAlternateBuffer is true 2`] = ` +exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: true) > shows scroll arrows correctly when useAlternateBuffer is true 1`] = ` "Choose an option ● 1. Option 1 @@ -197,8 +124,8 @@ Enter to submit · Tab/Shift+Tab to edit answers · Esc to cancel exports[`AskUserDialog > hides progress header for single question 1`] = ` "Which authentication method should we use? -● 1. OAuth 2.0 - Industry standard, supports SSO +● 1. OAuth 2.0 + Industry standard, supports SSO 2. JWT tokens Stateless, good for APIs 3. Enter a custom value @@ -210,8 +137,8 @@ Enter to select · ↑/↓ to navigate · Esc to cancel exports[`AskUserDialog > renders question and options 1`] = ` "Which authentication method should we use? -● 1. OAuth 2.0 - Industry standard, supports SSO +● 1. OAuth 2.0 + Industry standard, supports SSO 2. JWT tokens Stateless, good for APIs 3. Enter a custom value @@ -225,8 +152,8 @@ exports[`AskUserDialog > shows Review tab in progress header for multiple questi Which framework? -● 1. React - Component library +● 1. React + Component library 2. Vue Progressive framework 3. Enter a custom value @@ -238,8 +165,8 @@ Enter to select · ←/→ to switch questions · Esc to cancel exports[`AskUserDialog > shows keyboard hints 1`] = ` "Which authentication method should we use? -● 1. OAuth 2.0 - Industry standard, supports SSO +● 1. OAuth 2.0 + Industry standard, supports SSO 2. JWT tokens Stateless, good for APIs 3. Enter a custom value @@ -253,8 +180,8 @@ exports[`AskUserDialog > shows progress header for multiple questions 1`] = ` Which database should we use? -● 1. PostgreSQL - Relational database +● 1. PostgreSQL + Relational database 2. MongoDB Document database 3. Enter a custom value diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 75e3bf58e80..10d08418a5e 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -14,7 +14,8 @@ Implementation Steps Files to Modify -... last 2 lines hidden (Ctrl+O to show) ... + - src/index.ts - Add auth middleware + - src/config.ts - Add auth configuration options 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -40,7 +41,8 @@ Implementation Steps Files to Modify -... last 2 lines hidden (Ctrl+O to show) ... + - src/index.ts - Add auth middleware + - src/config.ts - Add auth configuration options ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically @@ -71,13 +73,17 @@ Implementation Steps 5. Add SAML provider support in src/auth/providers/SAMLProvider.ts 6. Add LDAP provider support in src/auth/providers/LDAPProvider.ts 7. Create token refresh mechanism in src/auth/TokenManager.ts -... last 23 lines hidden (Ctrl+O to show) ... + 8. Add multi-factor authentication in src/auth/MFAService.ts + 9. Implement session timeout handling in src/auth/SessionManager.ts + 10. Add audit logging for auth events in src/auth/AuditLogger.ts +... last 20 lines hidden (Ctrl+O to show) ... -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +▲ +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool - 3. Type your feedback... +▼ Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " @@ -97,7 +103,8 @@ Implementation Steps Files to Modify -... last 2 lines hidden (Ctrl+O to show) ... + - src/index.ts - Add auth middleware + - src/config.ts - Add auth configuration options ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically From d879da626d69379bc0c990389b54cc4dc8fc9e9d Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Thu, 5 Mar 2026 23:18:51 -0500 Subject: [PATCH 11/22] test: update snapshots for AskUserDialog and ExitPlanModeDialog --- .../__snapshots__/AskUserDialog.test.tsx.snap | 32 +++++++++---------- .../ExitPlanModeDialog.test.tsx.snap | 32 +++++++++---------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap index a14f90789ab..a84741aba4e 100644 --- a/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AskUserDialog.test.tsx.snap @@ -5,7 +5,7 @@ exports[`AskUserDialog > Choice question placeholder > uses default placeholder 1. TypeScript 2. JavaScript -● 3. Enter a custom value +● 3. Enter a custom value Enter to submit · Esc to cancel " @@ -16,7 +16,7 @@ exports[`AskUserDialog > Choice question placeholder > uses placeholder for "Oth 1. TypeScript 2. JavaScript -● 3. Type another language... +● 3. Type another language... Enter to submit · Esc to cancel " @@ -26,8 +26,8 @@ exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: false) > shows scrol "Choose an option ▲ -● 1. Option 1 - Description 1 +● 1. Option 1 + Description 1 2. Option 2 Description 2 3. Option 3 @@ -41,8 +41,8 @@ Enter to select · ↑/↓ to navigate · Esc to cancel exports[`AskUserDialog > Scroll Arrows (useAlternateBuffer: true) > shows scroll arrows correctly when useAlternateBuffer is true 1`] = ` "Choose an option -● 1. Option 1 - Description 1 +● 1. Option 1 + Description 1 2. Option 2 Description 2 3. Option 3 @@ -124,8 +124,8 @@ Enter to submit · Tab/Shift+Tab to edit answers · Esc to cancel exports[`AskUserDialog > hides progress header for single question 1`] = ` "Which authentication method should we use? -● 1. OAuth 2.0 - Industry standard, supports SSO +● 1. OAuth 2.0 + Industry standard, supports SSO 2. JWT tokens Stateless, good for APIs 3. Enter a custom value @@ -137,8 +137,8 @@ Enter to select · ↑/↓ to navigate · Esc to cancel exports[`AskUserDialog > renders question and options 1`] = ` "Which authentication method should we use? -● 1. OAuth 2.0 - Industry standard, supports SSO +● 1. OAuth 2.0 + Industry standard, supports SSO 2. JWT tokens Stateless, good for APIs 3. Enter a custom value @@ -152,8 +152,8 @@ exports[`AskUserDialog > shows Review tab in progress header for multiple questi Which framework? -● 1. React - Component library +● 1. React + Component library 2. Vue Progressive framework 3. Enter a custom value @@ -165,8 +165,8 @@ Enter to select · ←/→ to switch questions · Esc to cancel exports[`AskUserDialog > shows keyboard hints 1`] = ` "Which authentication method should we use? -● 1. OAuth 2.0 - Industry standard, supports SSO +● 1. OAuth 2.0 + Industry standard, supports SSO 2. JWT tokens Stateless, good for APIs 3. Enter a custom value @@ -180,8 +180,8 @@ exports[`AskUserDialog > shows progress header for multiple questions 1`] = ` Which database should we use? -● 1. PostgreSQL - Relational database +● 1. PostgreSQL + Relational database 2. MongoDB Document database 3. Enter a custom value diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 10d08418a5e..0c58bb2ce81 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -19,8 +19,8 @@ Files to Modify 1. Yes, automatically accept edits Approves plan and allows tools to run automatically -● 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool +● 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool 3. Type your feedback... Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel @@ -44,8 +44,8 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -79,8 +79,8 @@ Implementation Steps ... last 20 lines hidden (Ctrl+O to show) ... ▲ -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool ▼ @@ -106,8 +106,8 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -135,8 +135,8 @@ Files to Modify 1. Yes, automatically accept edits Approves plan and allows tools to run automatically -● 2. Yes, manually accept edits - Approves plan but requires confirmation for each tool +● 2. Yes, manually accept edits + Approves plan but requires confirmation for each tool 3. Type your feedback... Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel @@ -160,8 +160,8 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -213,8 +213,8 @@ Testing Strategy - Security penetration testing - Load testing for session management -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... @@ -240,8 +240,8 @@ Files to Modify - src/index.ts - Add auth middleware - src/config.ts - Add auth configuration options -● 1. Yes, automatically accept edits - Approves plan and allows tools to run automatically +● 1. Yes, automatically accept edits + Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool 3. Type your feedback... From 8cfc314fc0d1a516fea0215b6089cc6b664ff8aa Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Fri, 6 Mar 2026 10:28:28 -0500 Subject: [PATCH 12/22] revert file change --- .../cli/src/ui/components/AskUserDialog.test.tsx | 14 +++++--------- .../src/ui/components/ExitPlanModeDialog.test.tsx | 6 ++---- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.test.tsx b/packages/cli/src/ui/components/AskUserDialog.test.tsx index 392d7f14d93..1bd29241db0 100644 --- a/packages/cli/src/ui/components/AskUserDialog.test.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.test.tsx @@ -268,8 +268,8 @@ describe('AskUserDialog', () => { expect(lastFrame()).not.toContain('▼'); } await waitUntilReady(); + expect(lastFrame()).toMatchSnapshot(); }); - expect(lastFrame()).toMatchSnapshot(); }); }, ); @@ -569,9 +569,8 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toContain('Review your answers:'); + expect(lastFrame()).toMatchSnapshot(); }); - expect(lastFrame()).toMatchSnapshot(); writeKey(stdin, '\x1b[D'); // Left arrow back @@ -615,9 +614,8 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toContain('Review your answers:'); + expect(lastFrame()).toMatchSnapshot(); }); - expect(lastFrame()).toMatchSnapshot(); }); it('submits with unanswered questions when user confirms on Review', async () => { @@ -1311,9 +1309,8 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toContain('Type another language...'); + expect(lastFrame()).toMatchSnapshot(); }); - expect(lastFrame()).toMatchSnapshot(); }); it('uses default placeholder when not provided', async () => { @@ -1346,9 +1343,8 @@ describe('AskUserDialog', () => { await waitFor(async () => { await waitUntilReady(); - expect(lastFrame()).toContain('Enter a custom value'); + expect(lastFrame()).toMatchSnapshot(); }); - expect(lastFrame()).toMatchSnapshot(); }); }); }); diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx index cb56f236b4c..2bf1f723a6e 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.test.tsx @@ -251,9 +251,8 @@ Implement a comprehensive authentication system with multiple providers. } await waitFor(() => { - expect(lastFrame()).toContain('Add tests'); + expect(lastFrame()).toMatchSnapshot(); }); - expect(lastFrame()).toMatchSnapshot(); writeKey(stdin, '\r'); @@ -470,9 +469,8 @@ Implement a comprehensive authentication system with multiple providers. writeKey(stdin, '\x03'); // Ctrl+C await waitFor(() => { - expect(lastFrame()).toContain('Type your feedback...'); + expect(lastFrame()).toMatchSnapshot(); }); - expect(lastFrame()).toMatchSnapshot(); expect(onBubbledQuit).not.toHaveBeenCalled(); // Second Ctrl+C to exit (should bubble) From 55cc847e8fe9fcfa4ce0503a44b00517bb2d9023 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Fri, 6 Mar 2026 12:55:04 -0500 Subject: [PATCH 13/22] use question.unconstrainedHeight again --- packages/cli/src/ui/components/AskUserDialog.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index 56a433934b0..a97c0b1e2b9 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -795,7 +795,10 @@ const ChoiceQuestionView: React.FC = ({ : undefined; // Modulo the fixed overflow (overhead + 4 lines reserved for list), use all remaining height. - const maxQuestionHeight = listHeight ? Math.max(5, listHeight - 4) : 15; + const maxQuestionHeight = + question.unconstrainedHeight && listHeight + ? Math.max(5, listHeight - 4) + : 15; const questionHeightLimit = listHeight && !isAlternateBuffer From 0a6fb84bec0271ace3f96a1707bc4fb42a2a3f1e Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Fri, 6 Mar 2026 14:40:46 -0500 Subject: [PATCH 14/22] prevent radio button area from getting truncated --- .../cli/src/ui/components/AskUserDialog.tsx | 29 +++++++++++++++---- .../ExitPlanModeDialog.test.tsx.snap | 6 ++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index a97c0b1e2b9..472573dafc2 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -794,10 +794,15 @@ const ChoiceQuestionView: React.FC = ({ ? Math.max(1, availableHeight - overhead) : undefined; - // Modulo the fixed overflow (overhead + 4 lines reserved for list), use all remaining height. + const idealOptionsHeight = selectionItems.reduce( + (acc, item) => acc + (item.value.description ? 2 : 1), + 0, + ); + + // Use remaining height for the question, reserving space for the options list const maxQuestionHeight = question.unconstrainedHeight && listHeight - ? Math.max(5, listHeight - 4) + ? Math.max(5, listHeight - Math.min(idealOptionsHeight, 10)) : 15; const questionHeightLimit = @@ -805,10 +810,22 @@ const ChoiceQuestionView: React.FC = ({ ? Math.min(maxQuestionHeight, listHeight) : undefined; - const maxItemsToShow = - listHeight && actualQuestionHeight - ? Math.max(1, Math.floor((listHeight - actualQuestionHeight) / 2)) - : selectionItems.length; + let maxItemsToShow = selectionItems.length; + if (listHeight && actualQuestionHeight) { + const remainingHeight = Math.max(0, listHeight - actualQuestionHeight); + let linesUsed = 0; + let itemsThatFit = 0; + for (const item of selectionItems) { + const itemLines = item.value.description ? 2 : 1; + if (linesUsed + itemLines <= remainingHeight) { + linesUsed += itemLines; + itemsThatFit++; + } else { + break; + } + } + maxItemsToShow = Math.max(1, itemsThatFit); + } return ( diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 0c58bb2ce81..7113805a828 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -75,15 +75,13 @@ Implementation Steps 7. Create token refresh mechanism in src/auth/TokenManager.ts 8. Add multi-factor authentication in src/auth/MFAService.ts 9. Implement session timeout handling in src/auth/SessionManager.ts - 10. Add audit logging for auth events in src/auth/AuditLogger.ts -... last 20 lines hidden (Ctrl+O to show) ... +... last 21 lines hidden (Ctrl+O to show) ... -▲ ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool -▼ + 3. Type your feedback... Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel " From 53a3fc97765cf4851e2f9435f63e0dbc74696308 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Fri, 6 Mar 2026 14:58:37 -0500 Subject: [PATCH 15/22] address feedback from/review frontend --- .../cli/src/ui/components/AskUserDialog.tsx | 39 ++++--------------- .../__snapshots__/AskUserDialog.test.tsx.snap | 2 - .../ExitPlanModeDialog.test.tsx.snap | 3 +- .../src/ui/components/shared/MaxSizedBox.tsx | 14 ------- 4 files changed, 9 insertions(+), 49 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index 472573dafc2..769e0f7fcc0 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -12,7 +12,6 @@ import { useEffect, useReducer, useContext, - useState, } from 'react'; import { Box, Text } from 'ink'; import { theme } from '../semantic-colors.js'; @@ -783,8 +782,6 @@ const ChoiceQuestionView: React.FC = ({ } }, [customOptionText, isCustomOptionSelected, question.multiSelect]); - const [actualQuestionHeight, setActualQuestionHeight] = useState(0); - const HEADER_HEIGHT = progressHeader ? 2 : 0; const TITLE_MARGIN = 1; const FOOTER_HEIGHT = 2; // DialogFooter + margin @@ -794,38 +791,19 @@ const ChoiceQuestionView: React.FC = ({ ? Math.max(1, availableHeight - overhead) : undefined; - const idealOptionsHeight = selectionItems.reduce( - (acc, item) => acc + (item.value.description ? 2 : 1), - 0, - ); - - // Use remaining height for the question, reserving space for the options list - const maxQuestionHeight = - question.unconstrainedHeight && listHeight - ? Math.max(5, listHeight - Math.min(idealOptionsHeight, 10)) - : 15; + const minListHeight = 6; // Reserve ~6 lines for options list to avoid squishing const questionHeightLimit = listHeight && !isAlternateBuffer - ? Math.min(maxQuestionHeight, listHeight) + ? question.unconstrainedHeight + ? Math.max(1, listHeight - minListHeight) + : Math.min(15, Math.max(1, listHeight - DIALOG_PADDING)) : undefined; - let maxItemsToShow = selectionItems.length; - if (listHeight && actualQuestionHeight) { - const remainingHeight = Math.max(0, listHeight - actualQuestionHeight); - let linesUsed = 0; - let itemsThatFit = 0; - for (const item of selectionItems) { - const itemLines = item.value.description ? 2 : 1; - if (linesUsed + itemLines <= remainingHeight) { - linesUsed += itemLines; - itemsThatFit++; - } else { - break; - } - } - maxItemsToShow = Math.max(1, itemsThatFit); - } + const maxItemsToShow = + listHeight && questionHeightLimit + ? Math.max(1, Math.floor((listHeight - questionHeightLimit) / 2)) + : selectionItems.length; return ( @@ -835,7 +813,6 @@ const ChoiceQuestionView: React.FC = ({ maxHeight={questionHeightLimit} maxWidth={availableWidth} overflowDirection="bottom" - onHeightChange={setActualQuestionHeight} > Scroll Arrows (useAlternateBuffer: false) > shows scrol Description 1 2. Option 2 Description 2 - 3. Option 3 - Description 3 ▼ Enter to select · ↑/↓ to navigate · Esc to cancel diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 7113805a828..073c106ceb3 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -74,8 +74,7 @@ Implementation Steps 6. Add LDAP provider support in src/auth/providers/LDAPProvider.ts 7. Create token refresh mechanism in src/auth/TokenManager.ts 8. Add multi-factor authentication in src/auth/MFAService.ts - 9. Implement session timeout handling in src/auth/SessionManager.ts -... last 21 lines hidden (Ctrl+O to show) ... +... last 22 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically diff --git a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx index f365fea9a42..ee91d34f57c 100644 --- a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx +++ b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx @@ -26,7 +26,6 @@ interface MaxSizedBoxProps { maxHeight?: number; overflowDirection?: 'top' | 'bottom'; additionalHiddenLinesCount?: number; - onHeightChange?: (height: number) => void; } /** @@ -39,7 +38,6 @@ export const MaxSizedBox: React.FC = ({ maxHeight, overflowDirection = 'top', additionalHiddenLinesCount = 0, - onHeightChange, }) => { const id = useId(); const { addOverflowingId, removeOverflowingId } = useOverflowActions() || {}; @@ -82,18 +80,6 @@ export const MaxSizedBox: React.FC = ({ ? effectiveMaxHeight - 1 : effectiveMaxHeight; - const actualHeight = - visibleContentHeight !== undefined - ? Math.min(contentHeight, visibleContentHeight) - : contentHeight; - - const totalActualHeight = - actualHeight + (isOverflowing && effectiveMaxHeight !== undefined ? 1 : 0); - - useEffect(() => { - onHeightChange?.(totalActualHeight); - }, [totalActualHeight, onHeightChange]); - const hiddenLinesCount = visibleContentHeight !== undefined ? Math.max(0, contentHeight - visibleContentHeight) From 5f0464de62cc554cd23abe3c06f1504b585ca788 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Sat, 7 Mar 2026 11:40:21 -0500 Subject: [PATCH 16/22] make sure usually at most 1 line of history is present above plan confirmation --- .../cli/src/ui/components/ExitPlanModeDialog.tsx | 2 +- .../src/ui/components/ToolConfirmationQueue.tsx | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx index 677bc479be2..866d8345e2e 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx @@ -226,7 +226,7 @@ export const ExitPlanModeDialog: React.FC = ({ const editHint = formatCommand(Command.OPEN_EXTERNAL_EDITOR); return ( - + = ({ // Safety check: ToolConfirmationMessage requires confirmationDetails if (!tool.confirmationDetails) return null; + const isExitPlanMode = tool.confirmationDetails.type === 'exit_plan_mode'; + // Render up to 100% of the available terminal height (minus 1 line for safety) // to maximize space for diffs and other content. - const maxHeight = + let maxHeight = uiAvailableHeight !== undefined ? Math.max(uiAvailableHeight - 1, 4) : Math.floor(terminalHeight * 0.5); + if (isExitPlanMode && uiAvailableHeight !== undefined) { + // For exit plan mode, we want to cover almost everything except 1 line of history. + // Based on the calculation of availableTerminalHeight in AppContainer.tsx: + // availableTerminalHeight = terminalHeight - controlsHeight - staticExtraHeight - 2 - backgroundShellHeight + // where staticExtraHeight = 3. + // So, terminalHeight - controlsHeight - backgroundShellHeight - 1 (the space we want to take) + // is equal to availableTerminalHeight + 3 + 2 - 1 = availableTerminalHeight + 4. + maxHeight = Math.max(uiAvailableHeight + 4, 4); + } + const isRoutine = tool.confirmationDetails?.type === 'ask_user' || tool.confirmationDetails?.type === 'exit_plan_mode'; From c3870247f09c5f286b159af406a9f71a64abf52b Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Mon, 9 Mar 2026 16:53:28 -0400 Subject: [PATCH 17/22] make sure exit plan dialog takes up available height only when there's enough content --- packages/cli/src/ui/components/ExitPlanModeDialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx index 866d8345e2e..677bc479be2 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx @@ -226,7 +226,7 @@ export const ExitPlanModeDialog: React.FC = ({ const editHint = formatCommand(Command.OPEN_EXTERNAL_EDITOR); return ( - + Date: Mon, 9 Mar 2026 14:30:13 -0700 Subject: [PATCH 18/22] test: fix variable name in comment --- packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx index 0742c2d4875..ab12ae496fc 100644 --- a/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx +++ b/packages/cli/src/ui/components/ToolConfirmationQueue.test.tsx @@ -282,7 +282,7 @@ describe('ToolConfirmationQueue', () => { // hideToolIdentity is true for ask_user -> subtracts 4 instead of 6 // availableContentHeight = 19 - 4 = 15 // ToolConfirmationMessage handlesOwnUI=true -> returns full 15 - // AskUserDialog allocates questionHeight = availableHeight - overhead - minListHeight. + // AskUserDialog allocates questionHeight = availableHeight - overhead - DIALOG_PADDING. // listHeight = 15 - overhead (Header:0, Margin:1, Footer:2) = 12. // maxQuestionHeight = listHeight - 4 = 8. // 8 lines is enough for the 6-line question. From 421623284762bfb276c60a55f9d807900f990929 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Tue, 10 Mar 2026 10:00:19 -0400 Subject: [PATCH 19/22] update minListHeight --- packages/cli/src/ui/components/AskUserDialog.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index 769e0f7fcc0..ca2881a5ca2 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -791,12 +791,10 @@ const ChoiceQuestionView: React.FC = ({ ? Math.max(1, availableHeight - overhead) : undefined; - const minListHeight = 6; // Reserve ~6 lines for options list to avoid squishing - const questionHeightLimit = listHeight && !isAlternateBuffer ? question.unconstrainedHeight - ? Math.max(1, listHeight - minListHeight) + ? Math.max(1, listHeight - selectionItems.length * 2) : Math.min(15, Math.max(1, listHeight - DIALOG_PADDING)) : undefined; From bd7aa5667fa73e0d8229ffdee34f078c74dbda66 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Tue, 10 Mar 2026 14:43:53 -0400 Subject: [PATCH 20/22] remove changes to uiAvailableHeight --- packages/cli/src/ui/AppContainer.tsx | 6 +----- packages/cli/src/ui/components/ExitPlanModeDialog.tsx | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/cli/src/ui/AppContainer.tsx b/packages/cli/src/ui/AppContainer.tsx index 41cc5dec3dc..d12971593a4 100644 --- a/packages/cli/src/ui/AppContainer.tsx +++ b/packages/cli/src/ui/AppContainer.tsx @@ -1387,11 +1387,7 @@ Logging in with Google... Restarting Gemini CLI to continue. // Compute available terminal height based on controls measurement const availableTerminalHeight = Math.max( 0, - terminalHeight - - controlsHeight - - staticExtraHeight - - 2 - - backgroundShellHeight, + terminalHeight - controlsHeight - backgroundShellHeight - 1, ); config.setShellExecutionConfig({ diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx index 677bc479be2..39e1b8a1550 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx @@ -247,7 +247,6 @@ export const ExitPlanModeDialog: React.FC = ({ ], placeholder: 'Type your feedback...', multiSelect: false, - unconstrainedHeight: true, }, ]} onSubmit={(answers) => { From a27a134fe814afc5264dd59354726f473d066966 Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Tue, 10 Mar 2026 14:46:44 -0400 Subject: [PATCH 21/22] remove changes to uiAvailableHeight --- .../src/ui/components/ToolConfirmationQueue.tsx | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/packages/cli/src/ui/components/ToolConfirmationQueue.tsx b/packages/cli/src/ui/components/ToolConfirmationQueue.tsx index 1e52323fb45..3fb1cc8c6f0 100644 --- a/packages/cli/src/ui/components/ToolConfirmationQueue.tsx +++ b/packages/cli/src/ui/components/ToolConfirmationQueue.tsx @@ -55,25 +55,13 @@ export const ToolConfirmationQueue: React.FC = ({ // Safety check: ToolConfirmationMessage requires confirmationDetails if (!tool.confirmationDetails) return null; - const isExitPlanMode = tool.confirmationDetails.type === 'exit_plan_mode'; - // Render up to 100% of the available terminal height (minus 1 line for safety) // to maximize space for diffs and other content. - let maxHeight = + const maxHeight = uiAvailableHeight !== undefined ? Math.max(uiAvailableHeight - 1, 4) : Math.floor(terminalHeight * 0.5); - if (isExitPlanMode && uiAvailableHeight !== undefined) { - // For exit plan mode, we want to cover almost everything except 1 line of history. - // Based on the calculation of availableTerminalHeight in AppContainer.tsx: - // availableTerminalHeight = terminalHeight - controlsHeight - staticExtraHeight - 2 - backgroundShellHeight - // where staticExtraHeight = 3. - // So, terminalHeight - controlsHeight - backgroundShellHeight - 1 (the space we want to take) - // is equal to availableTerminalHeight + 3 + 2 - 1 = availableTerminalHeight + 4. - maxHeight = Math.max(uiAvailableHeight + 4, 4); - } - const isRoutine = tool.confirmationDetails?.type === 'ask_user' || tool.confirmationDetails?.type === 'exit_plan_mode'; From 457ca8ea0df4ee5a9189c0c9b33679875172745a Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Tue, 10 Mar 2026 14:49:44 -0400 Subject: [PATCH 22/22] add unconstrainedHeight as false to exit plan mode dialog --- packages/cli/src/ui/components/ExitPlanModeDialog.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx index 39e1b8a1550..c795bcd475d 100644 --- a/packages/cli/src/ui/components/ExitPlanModeDialog.tsx +++ b/packages/cli/src/ui/components/ExitPlanModeDialog.tsx @@ -247,6 +247,7 @@ export const ExitPlanModeDialog: React.FC = ({ ], placeholder: 'Type your feedback...', multiSelect: false, + unconstrainedHeight: false, }, ]} onSubmit={(answers) => {