(config: QodexConfig, cwd: string)
| 323 | |
| 324 | /** Merge plugin hooks into config.hooks (mutates, appends). Returns count added. */ |
| 325 | export async function mergeClaudeCodePluginHooks(config: QodexConfig, cwd: string): Promise<number> { |
| 326 | if (disabled()) return 0; |
| 327 | const hooks = await loadClaudeCodePluginHooks(cwd).catch(() => ({} as HooksConfig)); |
| 328 | const cfgHooks = ((config as any).hooks ??= {}); |
| 329 | let added = 0; |
| 330 | for (const event of SUPPORTED_HOOK_EVENTS) { |
| 331 | const incoming = hooks[event]; |
| 332 | if (!incoming?.length) continue; |
| 333 | (cfgHooks[event] ??= []).push(...incoming); |
| 334 | added += incoming.length; |
| 335 | } |
| 336 | if (added) logger.info('Imported Claude Code plugin hooks', { added }); |
| 337 | return added; |
| 338 | } |
| 339 | |
| 340 | /** One-shot: import agents + MCP servers + hooks from Claude Code into config (mutates). */ |
| 341 | export async function applyClaudeCodeIntegration( |
no test coverage detected