From 1b8ba5ca6bf739e4100a1d313721988f953acb49 Mon Sep 17 00:00:00 2001 From: christine betts Date: Fri, 25 Jul 2025 17:46:55 +0000 Subject: [ide-mode] Create an IDE manager class to handle connecting to and exposing methods from the IDE server (#4797) --- packages/cli/src/ui/commands/ideCommand.ts | 48 +++++++++++------------------- 1 file changed, 18 insertions(+), 30 deletions(-) (limited to 'packages/cli/src/ui/commands/ideCommand.ts') diff --git a/packages/cli/src/ui/commands/ideCommand.ts b/packages/cli/src/ui/commands/ideCommand.ts index 6fc4f50b..31f2371f 100644 --- a/packages/cli/src/ui/commands/ideCommand.ts +++ b/packages/cli/src/ui/commands/ideCommand.ts @@ -5,14 +5,7 @@ */ import { fileURLToPath } from 'url'; -import { - Config, - getMCPDiscoveryState, - getMCPServerStatus, - IDE_SERVER_NAME, - MCPDiscoveryState, - MCPServerStatus, -} from '@google/gemini-cli-core'; +import { Config, IDEConnectionStatus } from '@google/gemini-cli-core'; import { CommandContext, SlashCommand, @@ -56,36 +49,31 @@ export const ideCommand = (config: Config | null): SlashCommand | null => { description: 'check status of IDE integration', kind: CommandKind.BUILT_IN, action: (_context: CommandContext): SlashCommandActionReturn => { - const status = getMCPServerStatus(IDE_SERVER_NAME); - const discoveryState = getMCPDiscoveryState(); - switch (status) { - case MCPServerStatus.CONNECTED: + const connection = config.getIdeClient()?.getConnectionStatus(); + switch (connection?.status) { + case IDEConnectionStatus.Connected: return { type: 'message', messageType: 'info', content: `🟢 Connected`, - }; - case MCPServerStatus.CONNECTING: + } as const; + case IDEConnectionStatus.Connecting: return { type: 'message', messageType: 'info', - content: `🔄 Initializing...`, - }; - case MCPServerStatus.DISCONNECTED: - default: - if (discoveryState === MCPDiscoveryState.IN_PROGRESS) { - return { - type: 'message', - messageType: 'info', - content: `🔄 Initializing...`, - }; - } else { - return { - type: 'message', - messageType: 'error', - content: `🔴 Disconnected`, - }; + content: `🟡 Connecting...`, + } as const; + default: { + let content = `🔴 Disconnected`; + if (connection?.details) { + content += `: ${connection.details}`; } + return { + type: 'message', + messageType: 'error', + content, + } as const; + } } }, }, -- cgit v1.2.3