From 9ac47ebf8bbf22b1e76ffa99ef71c3e5bb73865b Mon Sep 17 00:00:00 2001 From: jacob314 Date: Thu, 13 Nov 2025 14:55:25 -0800 Subject: [PATCH] Fix merge conflicts. --- packages/cli/src/config/keyBindings.ts | 152 ---------------- .../messages/ToolGroupMessage.test.tsx | 1 + .../ToolGroupMessage.test.tsx.snap | 165 +++++------------- 3 files changed, 41 insertions(+), 277 deletions(-) diff --git a/packages/cli/src/config/keyBindings.ts b/packages/cli/src/config/keyBindings.ts index adaa4a5332..1981740432 100644 --- a/packages/cli/src/config/keyBindings.ts +++ b/packages/cli/src/config/keyBindings.ts @@ -215,155 +215,3 @@ export const defaultKeyBindings: KeyBindingConfig = { [Command.EXPAND_SUGGESTION]: [{ key: 'right' }], [Command.COLLAPSE_SUGGESTION]: [{ key: 'left' }], }; -<<<<<<< HEAD -======= - -interface CommandCategory { - readonly title: string; - readonly commands: readonly Command[]; -} - -/** - * Presentation metadata for grouping commands in documentation or UI. - */ -export const commandCategories: readonly CommandCategory[] = [ - { - title: 'Basic Controls', - commands: [Command.RETURN, Command.ESCAPE], - }, - { - title: 'Cursor Movement', - commands: [Command.HOME, Command.END], - }, - { - title: 'Editing', - commands: [ - Command.KILL_LINE_RIGHT, - Command.KILL_LINE_LEFT, - Command.CLEAR_INPUT, - Command.DELETE_WORD_BACKWARD, - ], - }, - { - title: 'Screen Control', - commands: [Command.CLEAR_SCREEN], - }, - { - title: 'Scrolling', - commands: [ - Command.SCROLL_UP, - Command.SCROLL_DOWN, - Command.SCROLL_HOME, - Command.SCROLL_END, - Command.PAGE_UP, - Command.PAGE_DOWN, - ], - }, - { - title: 'History & Search', - commands: [ - Command.HISTORY_UP, - Command.HISTORY_DOWN, - Command.REVERSE_SEARCH, - Command.SUBMIT_REVERSE_SEARCH, - Command.ACCEPT_SUGGESTION_REVERSE_SEARCH, - ], - }, - { - title: 'Navigation', - commands: [ - Command.NAVIGATION_UP, - Command.NAVIGATION_DOWN, - Command.DIALOG_NAVIGATION_UP, - Command.DIALOG_NAVIGATION_DOWN, - ], - }, - { - title: 'Suggestions & Completions', - commands: [ - Command.ACCEPT_SUGGESTION, - Command.COMPLETION_UP, - Command.COMPLETION_DOWN, - Command.EXPAND_SUGGESTION, - Command.COLLAPSE_SUGGESTION, - ], - }, - { - title: 'Text Input', - commands: [Command.SUBMIT, Command.NEWLINE], - }, - { - title: 'External Tools', - commands: [Command.OPEN_EXTERNAL_EDITOR, Command.PASTE_CLIPBOARD_IMAGE], - }, - { - title: 'App Controls', - commands: [ - Command.SHOW_ERROR_DETAILS, - Command.SHOW_FULL_TODOS, - Command.TOGGLE_IDE_CONTEXT_DETAIL, - Command.TOGGLE_MARKDOWN, - Command.TOGGLE_COPY_MODE, - Command.SHOW_MORE_LINES, - Command.TOGGLE_SHELL_INPUT_FOCUS, - ], - }, - { - title: 'Session Control', - commands: [Command.QUIT, Command.EXIT], - }, -]; - -/** - * Human-readable descriptions for each command, used in docs/tooling. - */ -export const commandDescriptions: Readonly> = { - [Command.RETURN]: 'Confirm the current selection or choice.', - [Command.ESCAPE]: 'Dismiss dialogs or cancel the current focus.', - [Command.HOME]: 'Move the cursor to the start of the line.', - [Command.END]: 'Move the cursor to the end of the line.', - [Command.KILL_LINE_RIGHT]: 'Delete from the cursor to the end of the line.', - [Command.KILL_LINE_LEFT]: 'Delete from the cursor to the start of the line.', - [Command.CLEAR_INPUT]: 'Clear all text in the input field.', - [Command.DELETE_WORD_BACKWARD]: 'Delete the previous word.', - [Command.CLEAR_SCREEN]: 'Clear the terminal screen and redraw the UI.', - [Command.SCROLL_UP]: 'Scroll content up.', - [Command.SCROLL_DOWN]: 'Scroll content down.', - [Command.SCROLL_HOME]: 'Scroll to the top.', - [Command.SCROLL_END]: 'Scroll to the bottom.', - [Command.PAGE_UP]: 'Scroll up by one page.', - [Command.PAGE_DOWN]: 'Scroll down by one page.', - [Command.HISTORY_UP]: 'Show the previous entry in history.', - [Command.HISTORY_DOWN]: 'Show the next entry in history.', - [Command.NAVIGATION_UP]: 'Move selection up in lists.', - [Command.NAVIGATION_DOWN]: 'Move selection down in lists.', - [Command.DIALOG_NAVIGATION_UP]: 'Move up within dialog options.', - [Command.DIALOG_NAVIGATION_DOWN]: 'Move down within dialog options.', - [Command.ACCEPT_SUGGESTION]: 'Accept the inline suggestion.', - [Command.COMPLETION_UP]: 'Move to the previous completion option.', - [Command.COMPLETION_DOWN]: 'Move to the next completion option.', - [Command.SUBMIT]: 'Submit the current prompt.', - [Command.NEWLINE]: 'Insert a newline without submitting.', - [Command.OPEN_EXTERNAL_EDITOR]: - 'Open the current prompt in an external editor.', - [Command.PASTE_CLIPBOARD_IMAGE]: 'Paste an image from the clipboard.', - [Command.SHOW_ERROR_DETAILS]: 'Toggle detailed error information.', - [Command.SHOW_FULL_TODOS]: 'Toggle the full TODO list.', - [Command.TOGGLE_IDE_CONTEXT_DETAIL]: 'Toggle IDE context details.', - [Command.TOGGLE_MARKDOWN]: 'Toggle Markdown rendering.', - [Command.TOGGLE_COPY_MODE]: - 'Toggle copy mode when the terminal is using the alternate buffer.', - [Command.QUIT]: 'Cancel the current request or quit the CLI.', - [Command.EXIT]: 'Exit the CLI when the input buffer is empty.', - [Command.SHOW_MORE_LINES]: - 'Expand a height-constrained response to show additional lines.', - [Command.REVERSE_SEARCH]: 'Start reverse search through history.', - [Command.SUBMIT_REVERSE_SEARCH]: 'Insert the selected reverse-search match.', - [Command.ACCEPT_SUGGESTION_REVERSE_SEARCH]: - 'Accept a suggestion while reverse searching.', - [Command.TOGGLE_SHELL_INPUT_FOCUS]: - 'Toggle focus between the shell and Gemini input.', - [Command.EXPAND_SUGGESTION]: 'Expand an inline suggestion.', - [Command.COLLAPSE_SUGGESTION]: 'Collapse an inline suggestion.', -}; ->>>>>>> 60fe5acd (feat(ui) support animated page up/down, fn-up/down and end+home (#13012)) diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx index b7836b0fdb..5019cf75ea 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx @@ -12,6 +12,7 @@ import { ToolCallStatus } from '../../types.js'; import type { ToolCallConfirmationDetails } from '@google/gemini-cli-core'; import { TOOL_STATUS } from '../../constants.js'; import { Scrollable } from '../shared/Scrollable.js'; +import { Text } from 'ink'; // Mock child components to isolate ToolGroupMessage behavior vi.mock('./ToolMessage.js', () => ({ diff --git a/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap b/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap index cc55ce1f7b..7d4dc7704c 100644 --- a/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap +++ b/packages/cli/src/ui/components/messages/__snapshots__/ToolGroupMessage.test.tsx.snap @@ -1,188 +1,103 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[` > Border Color Logic > uses gray border when all tools are successful and no shell commands 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ test-tool A tool for testing │ -│ │ -│ Test result │ -│ │ -│ ✓ another-tool A tool for testing │ -│ │ -│ Test result │ +"MockTool[tool-123]: ✓ test-tool - A tool for testing (medium) +MockTool[tool-2]: ✓ another-tool - A tool for testing (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Border Color Logic > uses yellow border for shell commands even when successful 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ run_shell_command A tool for testing │ -│ │ -│ Test result │ +"MockTool[tool-123]: ✓ run_shell_command - A tool for testing (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Border Color Logic > uses yellow border when tools are pending 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ o test-tool A tool for testing │ -│ │ -│ Test result │ +"MockTool[tool-123]: o test-tool - A tool for testing (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Confirmation Handling > shows confirmation dialog for first confirming tool only 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ? first-confirm A tool for testing ← │ -│ │ -│ Test result │ -│ Confirm first tool │ -│ │ -│ Do you want to proceed? │ -│ │ -│ ● 1. Yes, allow once │ -│ 2. Yes, allow always │ -│ 3. No, suggest changes (esc) │ -│ │ -│ │ -│ ? second-confirm A tool for testing │ -│ │ -│ Test result │ +"MockTool[tool-1]: ? first-confirm - A tool for testing (high) +│ MockConfirmation: Confirm first tool │ +MockTool[tool-2]: ? second-confirm - A tool for testing (low) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders empty tool calls array 1`] = `""`; exports[` > Golden Snapshots > renders header when scrolled 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ tool-1 Description 1. This is a long description that will need to be tr… │ -│──────────────────────────────────────────────────────────────────────────────│ -│ line5 │ █ -│ │ █ -│ ✓ tool-2 Description 2 │ █ -│ │ █ -│ line1 │ █ -│ line2 │ █ -╰──────────────────────────────────────────────────────────────────────────────╯ █" +"MockTool[1]: ✓ tool-1 - Description 1. This is a long description that will need +to be truncated if the terminal width is small. (medium) +MockTool[2]: ✓ tool-2 - Description 2 (medium) +╰──────────────────────────────────────────────────────────────────────────────╯ + + + + + +" `; exports[` > Golden Snapshots > renders mixed tool calls including shell command 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ read_file Read a file │ -│ │ -│ Test result │ -│ │ -│ ⊷ run_shell_command Run command │ -│ │ -│ Test result │ -│ │ -│ o write_file Write to file │ -│ │ -│ Test result │ +"MockTool[tool-1]: ✓ read_file - Read a file (medium) +MockTool[tool-2]: ⊷ run_shell_command - Run command (medium) +MockTool[tool-3]: o write_file - Write to file (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders multiple tool calls with different statuses 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ successful-tool This tool succeeded │ -│ │ -│ Test result │ -│ │ -│ o pending-tool This tool is pending │ -│ │ -│ Test result │ -│ │ -│ x error-tool This tool failed │ -│ │ -│ Test result │ +"MockTool[tool-1]: ✓ successful-tool - This tool succeeded (medium) +MockTool[tool-2]: o pending-tool - This tool is pending (medium) +MockTool[tool-3]: x error-tool - This tool failed (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders shell command with yellow border 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ run_shell_command Execute shell command │ -│ │ -│ Test result │ +"MockTool[shell-1]: ✓ run_shell_command - Execute shell command (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders single successful tool call 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ test-tool A tool for testing │ -│ │ -│ Test result │ +"MockTool[tool-123]: ✓ test-tool - A tool for testing (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders tool call awaiting confirmation 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ? confirmation-tool This tool needs confirmation ← │ -│ │ -│ Test result │ -│ Are you sure you want to proceed? │ -│ │ -│ Do you want to proceed? │ -│ │ -│ ● 1. Yes, allow once │ -│ 2. Yes, allow always │ -│ 3. No, suggest changes (esc) │ -│ │ +"MockTool[tool-confirm]: ? confirmation-tool - This tool needs confirmation +(high) +│ MockConfirmation: Are you sure you want to proceed? │ ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders tool call with outputFile 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ tool-with-file Tool that saved output to file │ -│ │ -│ Test result │ -│ Output too long and was saved to: /path/to/output.txt │ -╰──────────────────────────────────────────────────────────────────────────────╯" -`; - -exports[` > Golden Snapshots > renders tool call with outputFile 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│MockTool[tool-output-file]: ✓ tool-with-file - Tool that saved output to │ -│file (medium) │ +"MockTool[tool-output-file]: ✓ tool-with-file - Tool that saved output to file +(medium) │ Output too long and was saved to: /path/to/output.txt │ ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders when not focused 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ test-tool A tool for testing │ -│ │ -│ Test result │ +"MockTool[tool-123]: ✓ test-tool - A tool for testing (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders with limited terminal height 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ tool-with-result Tool with output │ -│ │ -│ This is a long result that might need height constraints │ -│ │ -│ ✓ another-tool Another tool │ -│ │ -│ More output here │ +"MockTool[tool-1]: ✓ tool-with-result - Tool with output (medium) +MockTool[tool-2]: ✓ another-tool - Another tool (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `; exports[` > Golden Snapshots > renders with narrow terminal width 1`] = ` -"╭──────────────────────────────────────╮ -│ ✓ very-long-tool-name-that-might-w… │ -│ │ -│ Test result │ +"MockTool[tool-123]: ✓ +very-long-tool-name-that-might-wrap - +This is a very long description that +might cause wrapping issues (medium) ╰──────────────────────────────────────╯" `; exports[` > Height Calculation > calculates available height correctly with multiple tools with results 1`] = ` -"╭──────────────────────────────────────────────────────────────────────────────╮ -│ ✓ test-tool A tool for testing │ -│ │ -│ Result 1 │ -│ │ -│ ✓ test-tool A tool for testing │ -│ │ -│ Result 2 │ -│ │ -│ ✓ test-tool A tool for testing │ -│ │ +"MockTool[tool-1]: ✓ test-tool - A tool for testing (medium) +MockTool[tool-2]: ✓ test-tool - A tool for testing (medium) +MockTool[tool-3]: ✓ test-tool - A tool for testing (medium) ╰──────────────────────────────────────────────────────────────────────────────╯" `;