()
| 72 | assert(mcp.mcpServers['citadel-state'], 'generated plugin MCP config must include citadel-state'); |
| 73 | |
| 74 | assert(!fs.existsSync(path.join(tmp, 'hooks', 'hooks.json')), |
| 75 | 'Codex generation must not recreate Claude Code auto-discovery path'); |
| 76 | const pluginHooks = readJson(path.resolve(tmp, manifest.hooks)); |
| 77 | for (const event of ['PermissionRequest', 'PreCompact', 'PostCompact', 'SubagentStart', 'SubagentStop']) { |
| 78 | assert(pluginHooks.hooks[event], `plugin hooks missing ${event}`); |
| 79 | } |
| 80 | const firstPluginHook = pluginHooks.hooks.PreToolUse |
| 81 | .flatMap((entry) => entry.hooks) |
| 82 | .find((hook) => hook.command && hook.command.includes('${PLUGIN_ROOT}')); |
| 83 | assert(firstPluginHook, 'plugin hooks should include generated PLUGIN_ROOT commands'); |
| 84 | const firstCommand = firstPluginHook.command; |
| 85 | assert(firstCommand.includes('${PLUGIN_ROOT}'), 'plugin hook command should use PLUGIN_ROOT'); |
| 86 | assert(firstPluginHook.commandWindows.includes('%PLUGIN_ROOT%'), 'plugin hook commandWindows should use PLUGIN_ROOT'); |
| 87 | |
| 88 | const fleetAgent = fs.readFileSync(path.join(tmp, '.codex', 'agents', 'fleet.toml'), 'utf8'); |
| 89 | assert(fleetAgent.includes('developer_instructions'), 'Codex fleet agent projection must include developer instructions'); |
| 90 | } finally { |
| 91 | fs.rmSync(tmp, { recursive: true, force: true }); |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | function testMcpServer() { |
| 96 | const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'citadel-mcp-state-')); |
| 97 | try { |
| 98 | fs.mkdirSync(path.join(tmp, '.planning', 'campaigns'), { recursive: true }); |
| 99 | fs.writeFileSync(path.join(tmp, '.planning', 'campaigns', 'demo.md'), '# Demo\n', 'utf8'); |
| 100 | const input = [ |
| 101 | JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'initialize', params: {} }), |
| 102 | JSON.stringify({ jsonrpc: '2.0', id: 2, method: 'tools/list', params: {} }), |
| 103 | JSON.stringify({ jsonrpc: '2.0', id: 3, method: 'tools/call', params: { name: 'citadel_status', arguments: { includeFiles: true } } }), |
| 104 | JSON.stringify({ jsonrpc: '2.0', id: 4, method: 'resources/read', params: { uri: 'citadel://status' } }), |
no test coverage detected