Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions packages/cli/src/gemini.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ import { appEvents, AppEvent } from './utils/events.js';
import {
type Config,
type ResumedSessionData,
type StartupWarning,
WarningPriority,
debugLogger,
coreEvents,
AuthType,
Expand Down Expand Up @@ -1193,7 +1195,9 @@ describe('startInteractiveUI', () => {
},
},
} as LoadedSettings;
const mockStartupWarnings = ['warning1'];
const mockStartupWarnings: StartupWarning[] = [
{ id: 'w1', message: 'warning1', priority: WarningPriority.High },
];
const mockWorkspaceRoot = '/root';
const mockInitializationResult = {
authError: null,
Expand Down Expand Up @@ -1226,7 +1230,7 @@ describe('startInteractiveUI', () => {
async function startTestInteractiveUI(
config: Config,
settings: LoadedSettings,
startupWarnings: string[],
startupWarnings: StartupWarning[],
workspaceRoot: string,
resumedSessionData: ResumedSessionData | undefined,
initializationResult: InitializationResult,
Expand Down
14 changes: 11 additions & 3 deletions packages/cli/src/gemini.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { loadCliConfig, parseArguments } from './config/config.js';
import * as cliConfig from './config/config.js';
import { readStdin } from './utils/readStdin.js';
import { basename } from 'node:path';
import { createHash } from 'node:crypto';
import v8 from 'node:v8';
import os from 'node:os';
import dns from 'node:dns';
Expand All @@ -37,6 +38,8 @@ import {
cleanupExpiredSessions,
} from './utils/sessionCleanup.js';
import {
type StartupWarning,
WarningPriority,
type Config,
type ResumedSessionData,
type OutputPayload,
Expand Down Expand Up @@ -180,7 +183,7 @@ ${reason.stack}`
export async function startInteractiveUI(
config: Config,
settings: LoadedSettings,
startupWarnings: string[],
startupWarnings: StartupWarning[],
workspaceRoot: string = process.cwd(),
resumedSessionData: ResumedSessionData | undefined,
initializationResult: InitializationResult,
Expand Down Expand Up @@ -668,8 +671,13 @@ export async function main() {
}

let input = config.getQuestion();
const startupWarnings = [
...(await getStartupWarnings()),
const rawStartupWarnings = await getStartupWarnings();
const startupWarnings: StartupWarning[] = [
...rawStartupWarnings.map((message) => ({
id: `startup-${createHash('sha256').update(message).digest('hex').substring(0, 16)}`,
message,
priority: WarningPriority.High,
})),
...(await getUserStartupWarnings(settings.merged)),
];

Expand Down
17 changes: 15 additions & 2 deletions packages/cli/src/ui/AppContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
CoreEvent,
type UserFeedbackPayload,
type ResumedSessionData,
type StartupWarning,
WarningPriority,
AuthType,
type AgentDefinition,
CoreToolCallStatus,
Expand Down Expand Up @@ -248,7 +250,7 @@ describe('AppContainer State Management', () => {
config?: Config;
version?: string;
initResult?: InitializationResult;
startupWarnings?: string[];
startupWarnings?: StartupWarning[];
resumedSessionData?: ResumedSessionData;
} = {}) => (
<SettingsContext.Provider value={settings}>
Expand Down Expand Up @@ -501,7 +503,18 @@ describe('AppContainer State Management', () => {
});

it('renders with startup warnings', async () => {
const startupWarnings = ['Warning 1', 'Warning 2'];
const startupWarnings: StartupWarning[] = [
{
id: 'w1',
message: 'Warning 1',
priority: WarningPriority.High,
},
{
id: 'w2',
message: 'Warning 2',
priority: WarningPriority.High,
},
];

let unmount: () => void;
await act(async () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/ui/AppContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { checkPermissions } from './hooks/atCommandProcessor.js';
import { MessageType, StreamingState } from './types.js';
import { ToolActionsProvider } from './contexts/ToolActionsContext.js';
import {
type StartupWarning,
type EditorType,
type Config,
type IdeInfo,
Expand Down Expand Up @@ -186,7 +187,7 @@ function isToolAwaitingConfirmation(

interface AppContainerProps {
config: Config;
startupWarnings?: string[];
startupWarnings?: StartupWarning[];
version: string;
initializationResult: InitializationResult;
resumedSessionData?: ResumedSessionData;
Expand Down
Loading
Loading