diff --git a/packages/cli/src/ui/components/Banner.tsx b/packages/cli/src/ui/components/Banner.tsx
index 8003abc949..460bef540f 100644
--- a/packages/cli/src/ui/components/Banner.tsx
+++ b/packages/cli/src/ui/components/Banner.tsx
@@ -5,8 +5,7 @@
*/
import { Box, Text } from 'ink';
-import Gradient from 'ink-gradient';
-import { theme } from '../semantic-colors.js';
+import { ThemedGradient } from './ThemedGradient.js';
interface BannerProps {
bannerText: string;
@@ -14,20 +13,17 @@ interface BannerProps {
width: number;
}
-export const Banner = ({ bannerText, color, width }: BannerProps) => {
- const gradient = theme.ui.gradient;
- return (
-
-
- {bannerText}
-
-
- );
-};
+export const Banner = ({ bannerText, color, width }: BannerProps) => (
+
+
+ {bannerText}
+
+
+);
diff --git a/packages/cli/src/ui/components/GradientRegression.test.tsx b/packages/cli/src/ui/components/GradientRegression.test.tsx
index 1b4bc8a4f7..af6d5c1df0 100644
--- a/packages/cli/src/ui/components/GradientRegression.test.tsx
+++ b/packages/cli/src/ui/components/GradientRegression.test.tsx
@@ -6,10 +6,13 @@
import { describe, it, expect, vi } from 'vitest';
import { renderWithProviders } from '../../test-utils/render.js';
-import { Footer } from './Footer.js';
-import { StatsDisplay } from './StatsDisplay.js';
import * as SessionContext from '../contexts/SessionContext.js';
import type { SessionStatsState } from '../contexts/SessionContext.js';
+import { Banner } from './Banner.js';
+import { Footer } from './Footer.js';
+import { Header } from './Header.js';
+import { ModelDialog } from './ModelDialog.js';
+import { StatsDisplay } from './StatsDisplay.js';
// Mock the theme module
vi.mock('../semantic-colors.js', async (importOriginal) => {
@@ -63,6 +66,36 @@ useSessionStatsMock.mockReturnValue({
});
describe('Gradient Crash Regression Tests', () => {
+ it(' should not crash when theme.ui.gradient is empty', () => {
+ const { lastFrame } = renderWithProviders(
+ ,
+ {
+ width: 120,
+ },
+ );
+ expect(lastFrame()).toBeDefined();
+ });
+
+ it(' should not crash when theme.ui.gradient is empty', () => {
+ const { lastFrame } = renderWithProviders(
+ {}} />,
+ {
+ width: 120,
+ },
+ );
+ expect(lastFrame()).toBeDefined();
+ });
+
+ it(' should not crash when theme.ui.gradient is empty', () => {
+ const { lastFrame } = renderWithProviders(
+ ,
+ {
+ width: 120,
+ },
+ );
+ expect(lastFrame()).toBeDefined();
+ });
+
it(' should not crash when theme.ui.gradient has only one color (or empty) and nightly is true', () => {
const { lastFrame } = renderWithProviders(, {
width: 120,
diff --git a/packages/cli/src/ui/components/ModelDialog.tsx b/packages/cli/src/ui/components/ModelDialog.tsx
index e61f34bf6d..caec692e01 100644
--- a/packages/cli/src/ui/components/ModelDialog.tsx
+++ b/packages/cli/src/ui/components/ModelDialog.tsx
@@ -23,7 +23,7 @@ import { useKeypress } from '../hooks/useKeypress.js';
import { theme } from '../semantic-colors.js';
import { DescriptiveRadioButtonSelect } from './shared/DescriptiveRadioButtonSelect.js';
import { ConfigContext } from '../contexts/ConfigContext.js';
-import Gradient from 'ink-gradient';
+import { ThemedGradient } from './ThemedGradient.js';
interface ModelDialogProps {
onClose: () => void;
@@ -115,9 +115,9 @@ export function ModelDialog({ onClose }: ModelDialogProps): React.JSX.Element {
Select Model
-
+
{header}
-
+
{subheader}