diff --git a/packages/cli/src/ui/__snapshots__/App.test.tsx.snap b/packages/cli/src/ui/__snapshots__/App.test.tsx.snap index 47bedd41d4..9e1d66df01 100644 --- a/packages/cli/src/ui/__snapshots__/App.test.tsx.snap +++ b/packages/cli/src/ui/__snapshots__/App.test.tsx.snap @@ -9,10 +9,10 @@ exports[`App > Snapshots > renders default layout correctly 1`] = ` Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results - +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results @@ -54,9 +54,10 @@ Footer Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results Composer " `; @@ -113,9 +114,10 @@ exports[`App > should render ToolConfirmationQueue along with Composer when tool Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results HistoryItemDisplay ╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Action Required │ @@ -141,7 +143,6 @@ HistoryItemDisplay - Notifications Composer " diff --git a/packages/cli/src/ui/components/Tips.test.tsx b/packages/cli/src/ui/components/Tips.test.tsx index 1730ae81fd..873230fb87 100644 --- a/packages/cli/src/ui/components/Tips.test.tsx +++ b/packages/cli/src/ui/components/Tips.test.tsx @@ -1,28 +1,28 @@ /** * @license - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { render } from '../../test-utils/render.js'; import { Tips } from './Tips.js'; -import { describe, it, expect } from 'vitest'; +import { describe, it, expect, vi } from 'vitest'; import type { Config } from '@google/gemini-cli-core'; describe('Tips', () => { - it('renders correct tips', async () => { - const config = {} as unknown as Config; + it.each([ + { fileCount: 0, description: 'renders all tips including GEMINI.md tip' }, + { fileCount: 5, description: 'renders fewer tips when GEMINI.md exists' }, + ])('$description', async ({ fileCount }) => { + const config = { + getGeminiMdFileCount: vi.fn().mockReturnValue(fileCount), + } as unknown as Config; const { lastFrame, waitUntilReady, unmount } = render( , ); await waitUntilReady(); - const output = lastFrame(); - expect(output).toContain('1. /help for more information'); - expect(output).toContain( - '2. Ask coding questions, edit code or run commands', - ); - expect(output).toContain('3. Be specific for the best results'); + expect(lastFrame()).toMatchSnapshot(); unmount(); }); }); diff --git a/packages/cli/src/ui/components/Tips.tsx b/packages/cli/src/ui/components/Tips.tsx index 94ff8dee6e..8ac6f33bf8 100644 --- a/packages/cli/src/ui/components/Tips.tsx +++ b/packages/cli/src/ui/components/Tips.tsx @@ -1,6 +1,6 @@ /** * @license - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ @@ -13,15 +13,29 @@ interface TipsProps { config: Config; } -export const Tips: React.FC = () => ( - - Tips for getting started: - - 1. /help for more information - - - 2. Ask coding questions, edit code or run commands - - 3. Be specific for the best results - -); +export const Tips: React.FC = ({ config }) => { + const geminiMdFileCount = config.getGeminiMdFileCount(); + + return ( + + Tips for getting started: + {geminiMdFileCount === 0 && ( + + 1. Create GEMINI.md files to customize your + interactions + + )} + + {geminiMdFileCount === 0 ? '2.' : '1.'}{' '} + /help for more information + + + {geminiMdFileCount === 0 ? '3.' : '2.'} Ask coding questions, edit code + or run commands + + + {geminiMdFileCount === 0 ? '4.' : '3.'} Be specific for the best results + + + ); +}; diff --git a/packages/cli/src/ui/components/UserIdentity.tsx b/packages/cli/src/ui/components/UserIdentity.tsx index 753fcd2abd..08c82573d9 100644 --- a/packages/cli/src/ui/components/UserIdentity.tsx +++ b/packages/cli/src/ui/components/UserIdentity.tsx @@ -1,6 +1,6 @@ /** * @license - * Copyright 2025 Google LLC + * Copyright 2026 Google LLC * SPDX-License-Identifier: Apache-2.0 */ @@ -42,7 +42,7 @@ export const UserIdentity: React.FC = ({ config }) => { {/* User Email /auth */} - + {authType === AuthType.LOGIN_WITH_GOOGLE ? ( {email ?? 'Logged in with Google'} ) : ( @@ -54,7 +54,7 @@ export const UserIdentity: React.FC = ({ config }) => { {/* Tier Name /upgrade */} - + {tierName ?? 'Gemini Code Assist for individuals'} /upgrade diff --git a/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap index ed20cded7c..ec8712ebc1 100644 --- a/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AlternateBufferQuittingDisplay.test.tsx.snap @@ -9,9 +9,10 @@ exports[`AlternateBufferQuittingDisplay > renders with a tool awaiting confirmat Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results Action Required (was prompted): @@ -28,9 +29,10 @@ exports[`AlternateBufferQuittingDisplay > renders with active and pending tool m Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results ╭──────────────────────────────────────────────────────────────────────────╮ │ ✓ tool1 Description for tool 1 │ │ │ @@ -51,9 +53,10 @@ exports[`AlternateBufferQuittingDisplay > renders with empty history and no pend Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results " `; @@ -66,9 +69,10 @@ exports[`AlternateBufferQuittingDisplay > renders with history but no pending it Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results ╭──────────────────────────────────────────────────────────────────────────╮ │ ✓ tool1 Description for tool 1 │ │ │ @@ -89,9 +93,10 @@ exports[`AlternateBufferQuittingDisplay > renders with pending items but no hist Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results " `; @@ -104,9 +109,10 @@ exports[`AlternateBufferQuittingDisplay > renders with user and gemini messages Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ > Hello Gemini ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ diff --git a/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap index 42a6488176..4411f766de 100644 --- a/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/AppHeader.test.tsx.snap @@ -9,9 +9,10 @@ exports[` > should not render the banner when no flags are set 1`] Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results " `; @@ -24,9 +25,10 @@ exports[` > should not render the default banner if shown count is Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results " `; @@ -42,9 +44,10 @@ exports[` > should render the banner with default text 1`] = ` ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results " `; @@ -60,8 +63,9 @@ exports[` > should render the banner with warning text 1`] = ` ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ Tips for getting started: -1. /help for more information -2. Ask coding questions, edit code or run commands -3. Be specific for the best results +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results " `; diff --git a/packages/cli/src/ui/components/__snapshots__/Tips.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/Tips.test.tsx.snap new file mode 100644 index 0000000000..dbc60fcf4d --- /dev/null +++ b/packages/cli/src/ui/components/__snapshots__/Tips.test.tsx.snap @@ -0,0 +1,20 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Tips > 'renders all tips including GEMINI.md …' 1`] = ` +" +Tips for getting started: +1. Create GEMINI.md files to customize your interactions +2. /help for more information +3. Ask coding questions, edit code or run commands +4. Be specific for the best results +" +`; + +exports[`Tips > 'renders fewer tips when GEMINI.md exi…' 1`] = ` +" +Tips for getting started: +1. /help for more information +2. Ask coding questions, edit code or run commands +3. Be specific for the best results +" +`; diff --git a/packages/cli/src/ui/components/shared/HorizontalLine.tsx b/packages/cli/src/ui/components/shared/HorizontalLine.tsx index f2463c404e..92935617a7 100644 --- a/packages/cli/src/ui/components/shared/HorizontalLine.tsx +++ b/packages/cli/src/ui/components/shared/HorizontalLine.tsx @@ -8,57 +8,20 @@ import type React from 'react'; import { Box } from 'ink'; import { theme } from '../../semantic-colors.js'; -export type LinePosition = 'top' | 'center' | 'bottom'; - interface HorizontalLineProps { color?: string; - width?: number | string; - position?: LinePosition; } -const overlineStyle = { - top: '‾', - bottom: '', - left: '', - right: '', - topLeft: '', - topRight: '', - bottomLeft: '', - bottomRight: '', -}; - -const underlineStyle = { - top: '_', - bottom: '', - left: '', - right: '', - topLeft: '', - topRight: '', - bottomLeft: '', - bottomRight: '', -}; - export const HorizontalLine: React.FC = ({ color = theme.border.default, - width = '100%', - position = 'center', -}) => { - const borderStyle = - position === 'top' - ? overlineStyle - : position === 'bottom' - ? underlineStyle - : 'single'; - - return ( - - ); -}; +}) => ( + +);