()
| 825 | return; |
| 826 | } |
| 827 | async function detectMcpb() { |
| 828 | // Check plugin manifest first |
| 829 | const mcpServersSpec = selectedPlugin!.plugin.manifest.mcpServers; |
| 830 | let hasMcpb = false; |
| 831 | if (mcpServersSpec) { |
| 832 | hasMcpb = typeof mcpServersSpec === 'string' && isMcpbSource(mcpServersSpec) || Array.isArray(mcpServersSpec) && mcpServersSpec.some(s_2 => typeof s_2 === 'string' && isMcpbSource(s_2)); |
| 833 | } |
| 834 | |
| 835 | // If not in manifest, read raw marketplace.json directly (bypassing schema validation) |
| 836 | // This works even with old cached marketplaces from before MCPB support |
| 837 | if (!hasMcpb) { |
| 838 | try { |
| 839 | const marketplaceDir = path.join(selectedPlugin!.plugin.path, '..'); |
| 840 | const marketplaceJsonPath = path.join(marketplaceDir, '.claude-plugin', 'marketplace.json'); |
| 841 | const content = await fs.readFile(marketplaceJsonPath, 'utf-8'); |
| 842 | const marketplace_1 = jsonParse(content); |
| 843 | const entry_0 = marketplace_1.plugins?.find((p: { |
| 844 | name: string; |
| 845 | }) => p.name === selectedPlugin!.plugin.name); |
| 846 | if (entry_0?.mcpServers) { |
| 847 | const spec = entry_0.mcpServers; |
| 848 | hasMcpb = typeof spec === 'string' && isMcpbSource(spec) || Array.isArray(spec) && spec.some((s_3: unknown) => typeof s_3 === 'string' && isMcpbSource(s_3)); |
| 849 | } |
| 850 | } catch (err) { |
| 851 | logForDebugging(`Failed to read raw marketplace.json: ${err}`); |
| 852 | } |
| 853 | } |
| 854 | setSelectedPluginHasMcpb(hasMcpb); |
| 855 | } |
| 856 | void detectMcpb(); |
| 857 | }, [selectedPlugin]); |
| 858 |
no test coverage detected