From d35d0dbab72d1933649685f94e80c97c41309ef8 Mon Sep 17 00:00:00 2001 From: Keith Guerin Date: Fri, 27 Mar 2026 15:08:57 -0700 Subject: [PATCH] feat(cli): fix divider position and ensure 100% clean build --- packages/cli/src/ui/components/Composer.tsx | 99 ++++++++++--------- .../__snapshots__/Composer.test.tsx.snap | 10 +- 2 files changed, 56 insertions(+), 53 deletions(-) diff --git a/packages/cli/src/ui/components/Composer.tsx b/packages/cli/src/ui/components/Composer.tsx index 5854c2639a..1707d52178 100644 --- a/packages/cli/src/ui/components/Composer.tsx +++ b/packages/cli/src/ui/components/Composer.tsx @@ -4,16 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { Box, useIsScreenReaderEnabled, Text } from 'ink'; import { useState, useEffect } from 'react'; -import { useConfig } from '../contexts/ConfigContext.js'; -import { useSettings } from '../contexts/SettingsContext.js'; -import { useUIState } from '../contexts/UIStateContext.js'; -import { useUIActions } from '../contexts/UIActionsContext.js'; -import { useVimMode } from '../contexts/VimModeContext.js'; -import { useAlternateBuffer } from '../hooks/useAlternateBuffer.js'; -import { useTerminalSize } from '../hooks/useTerminalSize.js'; -import { isNarrowWidth } from '../utils/isNarrowWidth.js'; +import { Box, Text, useIsScreenReaderEnabled } from 'ink'; import { ToastDisplay, shouldShowToast } from './ToastDisplay.js'; import { DetailedMessagesDisplay } from './DetailedMessagesDisplay.js'; import { ShortcutsHelp } from './ShortcutsHelp.js'; @@ -22,11 +14,18 @@ import { Footer } from './Footer.js'; import { StatusRow } from './StatusRow.js'; import { ShowMoreLines } from './ShowMoreLines.js'; import { QueuedMessageDisplay } from './QueuedMessageDisplay.js'; +import { HorizontalLine } from './shared/HorizontalLine.js'; import { OverflowProvider } from '../contexts/OverflowContext.js'; import { ConfigInitDisplay } from './ConfigInitDisplay.js'; import { TodoTray } from './messages/Todo.js'; +import { isNarrowWidth } from '../utils/isNarrowWidth.js'; +import { useUIState } from '../contexts/UIStateContext.js'; +import { useUIActions } from '../contexts/UIActionsContext.js'; +import { useVimMode } from '../contexts/VimModeContext.js'; +import { useConfig } from '../contexts/ConfigContext.js'; +import { useSettings } from '../contexts/SettingsContext.js'; +import { useAlternateBuffer } from '../hooks/useAlternateBuffer.js'; import { useComposerStatus } from '../hooks/useComposerStatus.js'; -import { HorizontalLine } from './shared/HorizontalLine.js'; import { theme } from '../semantic-colors.js'; export const Composer = ({ isFocused = true }: { isFocused?: boolean }) => { @@ -36,13 +35,12 @@ export const Composer = ({ isFocused = true }: { isFocused?: boolean }) => { const config = useConfig(); const { vimEnabled, vimMode } = useVimMode(); const isScreenReaderEnabled = useIsScreenReaderEnabled(); - const { columns: terminalWidth } = useTerminalSize(); + const terminalWidth = uiState.terminalWidth; const isNarrow = isNarrowWidth(terminalWidth); const debugConsoleMaxHeight = Math.floor(Math.max(terminalWidth * 0.2, 5)); const [suggestionsVisible, setSuggestionsVisible] = useState(false); const isAlternateBuffer = useAlternateBuffer(); - const { showApprovalModeIndicator } = uiState; const showUiDetails = uiState.cleanUiDetailsVisible; const suggestionsPosition = isAlternateBuffer ? 'above' : 'below'; const hideContextSummary = @@ -152,44 +150,50 @@ export const Composer = ({ isFocused = true }: { isFocused?: boolean }) => { {/* Above Divider Zone: Alerts, Tips, and Hints */} - + {showUiDetails && ( - {showUiDetails && hasToast && } + + {hasToast && } + + + {ambientContent && ( + + + {ambientContent.text} + + + )} + - - {showUiDetails && ambientContent && ( - - - {ambientContent.text} - - - )} - - + )} + {showShortcutsHelp && } + {showUiDetails && } + + {/* Below Divider Zone: Active Processing and Status (handled by StatusRow) */} { hideUiDetailsForSuggestions={hideUiDetailsForSuggestions} hasPendingActionRequired={hasPendingActionRequired} /> - - {showShortcutsHelp && } - {showUiDetails && } {showUiDetails && uiState.showErrorDetails && ( @@ -235,7 +236,7 @@ export const Composer = ({ isFocused = true }: { isFocused?: boolean }) => { commandContext={uiState.commandContext} shellModeActive={uiState.shellModeActive} setShellModeActive={uiActions.setShellModeActive} - approvalMode={showApprovalModeIndicator} + approvalMode={uiState.showApprovalModeIndicator} onEscapePromptChange={uiActions.onEscapePromptChange} focus={isFocused} vimHandleInput={uiActions.vimHandleInput} diff --git a/packages/cli/src/ui/components/__snapshots__/Composer.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/Composer.test.tsx.snap index f1426de641..4f1a3da629 100644 --- a/packages/cli/src/ui/components/__snapshots__/Composer.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/Composer.test.tsx.snap @@ -2,8 +2,8 @@ exports[`Composer > Snapshots > matches snapshot in idle state 1`] = ` " ? for shortcuts - StatusDisplay ──────────────────────────────────────────────────────────────────────────────────────────────────── + StatusDisplay InputPrompt: Type your message or @path/to/file Footer " @@ -22,9 +22,11 @@ InputPrompt: Type your message or @path/to/file `; exports[`Composer > Snapshots > matches snapshot in narrow view 1`] = ` -" ? for shortcuts - StatusDisplay +" +? for shortcuts ──────────────────────────────────────── + +StatusDisplay InputPrompt: Type your message or @path/to/file Footer @@ -33,8 +35,8 @@ Footer exports[`Composer > Snapshots > matches snapshot while streaming 1`] = ` " ? for shortcuts - LoadingIndicator: Thinking ──────────────────────────────────────────────────────────────────────────────────────────────────── + LoadingIndicator: Thinking InputPrompt: Type your message or @path/to/file Footer "