From ec0acc486e467c8e7b05f18ecc31ceb817c33eca Mon Sep 17 00:00:00 2001 From: Gal Zahavi <38544478+galz10@users.noreply.github.com> Date: Thu, 18 Sep 2025 13:35:55 -0700 Subject: [PATCH] fix(cli) : fix shell colors to match new coloring (#8747) Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- .../components/messages/ToolGroupMessage.tsx | 14 ++-- .../ui/components/messages/ToolMessage.tsx | 81 +++++++++++-------- packages/cli/src/ui/constants.ts | 2 + 3 files changed, 57 insertions(+), 40 deletions(-) diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx index b2b25cc8a1..cc8fe82716 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.tsx @@ -12,7 +12,7 @@ import { ToolCallStatus } from '../../types.js'; import { ToolMessage } from './ToolMessage.js'; import { ToolConfirmationMessage } from './ToolConfirmationMessage.js'; import { theme } from '../../semantic-colors.js'; -import { SHELL_COMMAND_NAME } from '../../constants.js'; +import { SHELL_COMMAND_NAME, SHELL_NAME } from '../../constants.js'; import { useConfig } from '../../contexts/ConfigContext.js'; interface ToolGroupMessageProps { @@ -47,11 +47,15 @@ export const ToolGroupMessage: React.FC = ({ ); const config = useConfig(); - const isShellCommand = toolCalls.some((t) => t.name === SHELL_COMMAND_NAME); + const isShellCommand = toolCalls.some( + (t) => t.name === SHELL_COMMAND_NAME || t.name === SHELL_NAME, + ); const borderColor = - hasPending || isShellCommand || isShellFocused - ? theme.status.warning - : theme.border.default; + isShellCommand || isShellFocused + ? theme.ui.symbol + : hasPending + ? theme.status.warning + : theme.border.default; const staticHeight = /* border */ 2 + /* marginBottom */ 1; // This is a bit of a magic number, but it accounts for the border and diff --git a/packages/cli/src/ui/components/messages/ToolMessage.tsx b/packages/cli/src/ui/components/messages/ToolMessage.tsx index 5f29ba5667..0099bbc02f 100644 --- a/packages/cli/src/ui/components/messages/ToolMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolMessage.tsx @@ -14,7 +14,11 @@ import { AnsiOutputText } from '../AnsiOutput.js'; import { GeminiRespondingSpinner } from '../GeminiRespondingSpinner.js'; import { MaxSizedBox } from '../shared/MaxSizedBox.js'; import { ShellInputPrompt } from '../ShellInputPrompt.js'; -import { SHELL_COMMAND_NAME, TOOL_STATUS } from '../../constants.js'; +import { + SHELL_COMMAND_NAME, + SHELL_NAME, + TOOL_STATUS, +} from '../../constants.js'; import { theme } from '../../semantic-colors.js'; import type { AnsiOutput, Config } from '@google/gemini-cli-core'; @@ -88,7 +92,7 @@ export const ToolMessage: React.FC = ({ return ( - + = ({ type ToolStatusIndicatorProps = { status: ToolCallStatus; + name: string; }; const ToolStatusIndicator: React.FC = ({ status, -}) => ( - - {status === ToolCallStatus.Pending && ( - {TOOL_STATUS.PENDING} - )} - {status === ToolCallStatus.Executing && ( - - )} - {status === ToolCallStatus.Success && ( - - {TOOL_STATUS.SUCCESS} - - )} - {status === ToolCallStatus.Confirming && ( - - {TOOL_STATUS.CONFIRMING} - - )} - {status === ToolCallStatus.Canceled && ( - - {TOOL_STATUS.CANCELED} - - )} - {status === ToolCallStatus.Error && ( - - {TOOL_STATUS.ERROR} - - )} - -); + name, +}) => { + const isShell = name === SHELL_COMMAND_NAME || name === SHELL_NAME; + const statusColor = isShell ? theme.ui.symbol : theme.status.warning; + + return ( + + {status === ToolCallStatus.Pending && ( + {TOOL_STATUS.PENDING} + )} + {status === ToolCallStatus.Executing && ( + + )} + {status === ToolCallStatus.Success && ( + + {TOOL_STATUS.SUCCESS} + + )} + {status === ToolCallStatus.Confirming && ( + + {TOOL_STATUS.CONFIRMING} + + )} + {status === ToolCallStatus.Canceled && ( + + {TOOL_STATUS.CANCELED} + + )} + {status === ToolCallStatus.Error && ( + + {TOOL_STATUS.ERROR} + + )} + + ); +}; type ToolInfo = { name: string; diff --git a/packages/cli/src/ui/constants.ts b/packages/cli/src/ui/constants.ts index 9c95a29d10..6b099fd806 100644 --- a/packages/cli/src/ui/constants.ts +++ b/packages/cli/src/ui/constants.ts @@ -16,6 +16,8 @@ export const STREAM_DEBOUNCE_MS = 100; export const SHELL_COMMAND_NAME = 'Shell Command'; +export const SHELL_NAME = 'Shell'; + // Tool status symbols used in ToolMessage component export const TOOL_STATUS = { SUCCESS: '✓',