From f7edf711906ed8492fc65f3c1cfad1ccd7ede187 Mon Sep 17 00:00:00 2001 From: Taylor Mullen Date: Sat, 19 Apr 2025 12:38:09 -0400 Subject: Give Gemini Code a face lift. - This utilizes `ink-gradient` to render GEMINI CODE in amazing colors. - Added a shared color configuration for UX (should this be in config?). It's very possible that we shouldn't be talking about the specific colors and instead be mentioning "foreground"/"background"/inlineCode etc. type colors. - Updated existing color usages to utilize `Colors.*` Fixes https://b.corp.google.com/issues/411385593 --- packages/cli/src/ui/App.tsx | 35 ++++++++++----- packages/cli/src/ui/colors.ts | 12 +++++ packages/cli/src/ui/components/Footer.tsx | 7 ++- packages/cli/src/ui/components/Header.tsx | 51 ++++++++++------------ packages/cli/src/ui/components/InputPrompt.tsx | 28 ++++++------ .../cli/src/ui/components/LoadingIndicator.tsx | 5 ++- packages/cli/src/ui/components/Tips.tsx | 29 +++++++----- .../src/ui/components/messages/DiffRenderer.tsx | 14 +++--- .../src/ui/components/messages/ErrorMessage.tsx | 5 ++- .../src/ui/components/messages/GeminiMessage.tsx | 5 ++- .../cli/src/ui/components/messages/InfoMessage.tsx | 5 ++- .../messages/ToolConfirmationMessage.tsx | 5 ++- .../ui/components/messages/ToolGroupMessage.tsx | 3 +- .../cli/src/ui/components/messages/ToolMessage.tsx | 15 ++++--- .../cli/src/ui/components/messages/UserMessage.tsx | 3 +- packages/cli/src/ui/utils/MarkdownRenderer.tsx | 15 ++++--- 16 files changed, 141 insertions(+), 96 deletions(-) create mode 100644 packages/cli/src/ui/colors.ts (limited to 'packages/cli/src') diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index fa9b6f9b..14b76c8f 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -11,7 +11,6 @@ import { useGeminiStream } from './hooks/useGeminiStream.js'; import { useLoadingIndicator } from './hooks/useLoadingIndicator.js'; import { useInputHistory } from './hooks/useInputHistory.js'; import { Header } from './components/Header.js'; -import { Tips } from './components/Tips.js'; import { HistoryDisplay } from './components/HistoryDisplay.js'; import { LoadingIndicator } from './components/LoadingIndicator.js'; import { InputPrompt } from './components/InputPrompt.js'; @@ -22,7 +21,8 @@ import { useStartupWarnings, useInitializationErrorEffect, } from './hooks/useAppEffects.js'; -import type { Config } from '@gemini-code/server'; +import { shortenPath, type Config } from '@gemini-code/server'; +import { Colors } from './colors.js'; interface AppProps { config: Config; @@ -73,39 +73,37 @@ export const App = ({ config }: AppProps) => { return ( -
+
{startupWarnings.length > 0 && ( {startupWarnings.map((warning, index) => ( - + {warning} ))} )} - - {initError && streamingState !== StreamingState.Responding && !isWaitingForToolConfirmation && ( {history.find( (item) => item.type === 'error' && item.text?.includes(initError), )?.text ? ( - + { history.find( (item) => @@ -115,8 +113,10 @@ export const App = ({ config }: AppProps) => { ) : ( <> - Initialization Error: {initError} - + + Initialization Error: {initError} + + {' '} Please check API key and configuration. @@ -134,7 +134,18 @@ export const App = ({ config }: AppProps) => { /> - {isInputActive && } + {isInputActive && ( + <> + + cwd: + + {shortenPath(config.getTargetDir(), /*maxLength*/ 70)} + + + + + + )}