(mcpClients: MCPServerConnection[], ideInstallationStatus: IDEExtensionInstallationStatus | null = null, theme: ThemeName)
| 36 | }]; |
| 37 | } |
| 38 | export function buildIDEProperties(mcpClients: MCPServerConnection[], ideInstallationStatus: IDEExtensionInstallationStatus | null = null, theme: ThemeName): Property[] { |
| 39 | const ideClient = mcpClients?.find(client => client.name === 'ide'); |
| 40 | if (ideInstallationStatus) { |
| 41 | const ideName = toIDEDisplayName(ideInstallationStatus.ideType); |
| 42 | const pluginOrExtension = isJetBrainsIde(ideInstallationStatus.ideType) ? 'plugin' : 'extension'; |
| 43 | if (ideInstallationStatus.error) { |
| 44 | return [{ |
| 45 | label: 'IDE', |
| 46 | value: <Text> |
| 47 | {color('error', theme)(figures.cross)} Error installing {ideName}{' '} |
| 48 | {pluginOrExtension}: {ideInstallationStatus.error} |
| 49 | {'\n'}Please restart your IDE and try again. |
| 50 | </Text> |
| 51 | }]; |
| 52 | } |
| 53 | if (ideInstallationStatus.installed) { |
| 54 | if (ideClient && ideClient.type === 'connected') { |
| 55 | if (ideInstallationStatus.installedVersion !== ideClient.serverInfo?.version) { |
| 56 | return [{ |
| 57 | label: 'IDE', |
| 58 | value: `Connected to ${ideName} ${pluginOrExtension} version ${ideInstallationStatus.installedVersion} (server version: ${ideClient.serverInfo?.version})` |
| 59 | }]; |
| 60 | } else { |
| 61 | return [{ |
| 62 | label: 'IDE', |
| 63 | value: `Connected to ${ideName} ${pluginOrExtension} version ${ideInstallationStatus.installedVersion}` |
| 64 | }]; |
| 65 | } |
| 66 | } else { |
| 67 | return [{ |
| 68 | label: 'IDE', |
| 69 | value: `Installed ${ideName} ${pluginOrExtension}` |
| 70 | }]; |
| 71 | } |
| 72 | } |
| 73 | } else if (ideClient) { |
| 74 | const ideName = getIdeClientName(ideClient) ?? 'IDE'; |
| 75 | if (ideClient.type === 'connected') { |
| 76 | return [{ |
| 77 | label: 'IDE', |
| 78 | value: `Connected to ${ideName} extension` |
| 79 | }]; |
| 80 | } else { |
| 81 | return [{ |
| 82 | label: 'IDE', |
| 83 | value: `${color('error', theme)(figures.cross)} Not connected to ${ideName}` |
| 84 | }]; |
| 85 | } |
| 86 | } |
| 87 | return []; |
| 88 | } |
| 89 | export function buildMcpProperties(clients: MCPServerConnection[] = [], theme: ThemeName): Property[] { |
| 90 | const servers = clients.filter(client => client.name !== 'ide'); |
| 91 | if (!servers.length) { |
no test coverage detected