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