diff --git a/plugins/ruflo-swarm/.codex-plugin/plugin.json b/plugins/ruflo-swarm/.codex-plugin/plugin.json new file mode 100644 index 0000000000..87711943d2 --- /dev/null +++ b/plugins/ruflo-swarm/.codex-plugin/plugin.json @@ -0,0 +1,12 @@ +{ + "name": "ruflo-swarm", + "description": "Agent teams, swarm coordination, Monitor streams, and worktree isolation — wraps 4 swarm_* + 8 agent_* MCP tools (12 total) plus 6 topologies (hierarchical / mesh / hierarchical-mesh / ring / star / adaptive). The live swarm pane needs Claude Code's function-hook engine and is not available on this host; those MCP tools, commands, skills and agents behave as on any other host.", + "version": "0.3.6", + "author": { + "name": "ruvnet", + "url": "https://github.com/ruvnet" + }, + "homepage": "https://github.com/ruvnet/ruflo", + "license": "MIT", + "hooks": "./hooks/codex-hooks.json" +} diff --git a/plugins/ruflo-swarm/hooks/codex-hooks.json b/plugins/ruflo-swarm/hooks/codex-hooks.json new file mode 100644 index 0000000000..7c3d73bec0 --- /dev/null +++ b/plugins/ruflo-swarm/hooks/codex-hooks.json @@ -0,0 +1,4 @@ +{ + "description": "The live swarm pane depends on Claude Code's function-hook engine and is unsupported on this host; this plugin's commands, skills and agents are unaffected. See plugins/ruflo-swarm/hooks/hooks.json for the Claude Code manifest.", + "hooks": {} +} diff --git a/scripts/ci-test-excluded.txt b/scripts/ci-test-excluded.txt index 6396139a45..3aa550596a 100644 --- a/scripts/ci-test-excluded.txt +++ b/scripts/ci-test-excluded.txt @@ -77,6 +77,7 @@ plugins/ruflo-x-gateway/tests/mod.test.ts plugins/ruflo-x-gateway/tests/textsof.test.ts scripts/check-adr-links.test.mjs tests/plugins/codex-mod-hooks.test.mjs +tests/plugins/codex-swarm-hook-manifest.test.mjs scripts/__tests__/guard-label.test.mjs scripts/__tests__/mod-capability-matrix.test.mjs tests/check-guard-tool-names.test.mjs diff --git a/tests/plugins/codex-swarm-hook-manifest.test.mjs b/tests/plugins/codex-swarm-hook-manifest.test.mjs new file mode 100644 index 0000000000..3cfdf36c02 --- /dev/null +++ b/tests/plugins/codex-swarm-hook-manifest.test.mjs @@ -0,0 +1,62 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +// Regression test for ruvnet/ruflo#3688: Codex's native app-server rejects +// ruflo-swarm's hooks.json with `unknown field 'modules', expected +// 'description' or 'hooks'` because that manifest declares a Claude Code +// function-hook module Codex cannot load. The fix ships a Codex-specific +// no-op manifest via the native `.codex-plugin/plugin.json` override (the +// same convention already used by ruflo-adr/ruflo-ddd/ruflo-sparc), so the +// Claude Code module keeps loading unchanged while Codex sees a manifest it +// can parse. + +const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..'); +const PLUGIN = 'ruflo-swarm'; + +test('ruflo-swarm: Codex gets a host-specific no-op manifest instead of the Claude function-hook one', () => { + const codexManifestPath = path.join(root, `plugins/${PLUGIN}/.codex-plugin/plugin.json`); + assert.ok( + fs.existsSync(codexManifestPath), + `${codexManifestPath} must exist so Codex's native plugin loader prefers it over .claude-plugin/plugin.json (see #3688)`, + ); + + const codexManifest = JSON.parse(fs.readFileSync(codexManifestPath, 'utf8')); + const claudeManifest = JSON.parse( + fs.readFileSync(path.join(root, `plugins/${PLUGIN}/.claude-plugin/plugin.json`), 'utf8'), + ); + assert.equal(codexManifest.name, claudeManifest.name); + assert.equal(codexManifest.version, claudeManifest.version); + assert.equal(codexManifest.hooks, './hooks/codex-hooks.json'); + + const codexHooksPath = path.join(root, `plugins/${PLUGIN}/hooks/codex-hooks.json`); + assert.ok(fs.existsSync(codexHooksPath), `${codexHooksPath} must exist`); + const codexHooks = JSON.parse(fs.readFileSync(codexHooksPath, 'utf8')); + + // Codex's native plugin hook-manifest loader accepts only `description` + // and `hooks` at the top level (#2855 / #3688) — anything else is a hard + // parse failure that drops the whole plugin. + const allowed = new Set(['description', 'hooks']); + const unknown = Object.keys(codexHooks).filter((key) => !allowed.has(key)); + assert.deepEqual( + unknown, + [], + `codex-hooks.json must only use ${[...allowed].join('/')} at the top level, found: ${unknown.join(', ')}`, + ); + assert.equal(typeof codexHooks.description, 'string'); + assert.deepEqual( + codexHooks.hooks, + {}, + 'ruflo-swarm has no Codex-portable guard logic (pure UI pane) — Codex gets an explicit no-op, not invented command hooks', + ); + + // The Claude Code function-hook manifest and its module must remain + // intact — this fix must not touch the Claude Code behaviour. + const claudeHooks = JSON.parse( + fs.readFileSync(path.join(root, `plugins/${PLUGIN}/hooks/hooks.json`), 'utf8'), + ); + assert.deepEqual(claudeHooks.modules, ['./register.ts']); + assert.ok(fs.existsSync(path.join(root, `plugins/${PLUGIN}/hooks/register.ts`))); +});