(config: QodexConfig, cwd: string)
| 305 | |
| 306 | /** Merge plugin MCP servers into config.mcp.servers (mutates). User config wins. Returns count added. */ |
| 307 | export async function mergeClaudeCodePluginMcp(config: QodexConfig, cwd: string): Promise<number> { |
| 308 | if (disabled()) return 0; |
| 309 | const servers = await loadClaudeCodePluginMcpServers(cwd).catch(() => ({})); |
| 310 | const names = Object.keys(servers); |
| 311 | if (names.length === 0) return 0; |
| 312 | const mcp = ((config as any).mcp ??= { servers: {} }); |
| 313 | mcp.servers ??= {}; |
| 314 | let added = 0; |
| 315 | for (const [name, cfg] of Object.entries(servers)) { |
| 316 | if (mcp.servers[name]) continue; // user config wins |
| 317 | mcp.servers[name] = cfg; |
| 318 | added++; |
| 319 | } |
| 320 | if (added) logger.info('Imported Claude Code plugin MCP servers', { added }); |
| 321 | return added; |
| 322 | } |
| 323 | |
| 324 | /** Merge plugin hooks into config.hooks (mutates, appends). Returns count added. */ |
| 325 | export async function mergeClaudeCodePluginHooks(config: QodexConfig, cwd: string): Promise<number> { |
no test coverage detected