From 822803d9d658d62688c5ced3bf9d7af6904f6edd Mon Sep 17 00:00:00 2001 From: "N. Taylor Mullen" Date: Thu, 5 Jun 2025 00:00:34 -0700 Subject: [PATCH] Fix "npx https:...." header issue (#759) --- packages/cli/src/ui/App.tsx | 2 +- .../cli/src/ui/components/Header.test.tsx | 48 ------------------- packages/cli/src/ui/components/Header.tsx | 22 +++++---- 3 files changed, 14 insertions(+), 58 deletions(-) delete mode 100644 packages/cli/src/ui/components/Header.test.tsx diff --git a/packages/cli/src/ui/App.tsx b/packages/cli/src/ui/App.tsx index 6f83e7b6..8dd037a5 100644 --- a/packages/cli/src/ui/App.tsx +++ b/packages/cli/src/ui/App.tsx @@ -337,7 +337,7 @@ export const App = ({ key={staticKey} items={[ -
+
, ...history.map((h) => ( diff --git a/packages/cli/src/ui/components/Header.test.tsx b/packages/cli/src/ui/components/Header.test.tsx deleted file mode 100644 index 0c03e514..00000000 --- a/packages/cli/src/ui/components/Header.test.tsx +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @license - * Copyright 2025 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import { render } from 'ink-testing-library'; -import { Header } from './Header.js'; -import { vi } from 'vitest'; - -// Mock ink-gradient and ink-big-text as they might have complex rendering -vi.mock('ink-gradient', () => ({ - default: vi.fn(({ children }) => children), // Pass through children -})); - -import { Text } from 'ink'; // Import the actual Text component from Ink - -vi.mock('ink-big-text', () => ({ - default: vi.fn(({ text }) => {text}), // Use Ink's Text component -})); - -describe('
', () => { - it('should render with the default title "GEMINI" when no title prop is provided', () => { - const { lastFrame } = render(
); - const output = lastFrame(); - // Check if the output contains the default text "GEMINI" - // The actual output will be simple text due to mocking - expect(output).toContain('GEMINI'); - }); - - it('should render with a custom title when the title prop is provided', () => { - const customTitle = 'My Custom CLI'; - const { lastFrame } = render(
); - const output = lastFrame(); - // Check if the output contains the custom title - expect(output).toContain(customTitle); - }); - - it('should render with an empty title if an empty string is provided', () => { - const customTitle = ''; - const { lastFrame } = render(
); - const output = lastFrame(); - // Depending on how BigText handles empty strings, - // it might render nothing or a specific representation. - // For this test, we'll assume it renders the empty string. - expect(output).toContain(''); // or check for a specific structure if BigText behaves differently - }); -}); diff --git a/packages/cli/src/ui/components/Header.tsx b/packages/cli/src/ui/components/Header.tsx index 2b971395..1554f987 100644 --- a/packages/cli/src/ui/components/Header.tsx +++ b/packages/cli/src/ui/components/Header.tsx @@ -5,24 +5,28 @@ */ import React from 'react'; -import { Box } from 'ink'; +import { Box, Text } from 'ink'; import Gradient from 'ink-gradient'; -import BigText from 'ink-big-text'; import { Colors } from '../colors.js'; -interface HeaderProps { - title?: string; -} +const asciiArtLogo = ` + ██████╗ ███████╗███╗ ███╗██╗███╗ ██╗██╗ +██╔════╝ ██╔════╝████╗ ████║██║████╗ ██║██║ +██║ ███╗█████╗ ██╔████╔██║██║██╔██╗ ██║██║ +██║ ██║██╔══╝ ██║╚██╔╝██║██║██║╚██╗██║██║ +╚██████╔╝███████╗██║ ╚═╝ ██║██║██║ ╚████║██║ + ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ +`; -export const Header: React.FC = ({ title = 'GEMINI' }) => ( +export const Header: React.FC = () => ( <> - + {Colors.GradientColors ? ( - + {asciiArtLogo} ) : ( - + {asciiArtLogo} )}