diff --git a/.agents/plugins/marketplace.json b/.agents/plugins/marketplace.json index 0017c933c..5bbeb5faa 100644 --- a/.agents/plugins/marketplace.json +++ b/.agents/plugins/marketplace.json @@ -7,8 +7,9 @@ { "name": "rea", "source": { - "source": "local", - "path": "./" + "source": "npm", + "package": "rea-agents", + "version": "6.4.0" }, "policy": { "installation": "AVAILABLE", diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index b059b686c..5751d94cf 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -10,7 +10,11 @@ { "name": "rea", "description": "Reverse engineer anything from your terminal or agent with one CLI and MCP server.", - "source": "./", + "source": { + "source": "npm", + "package": "rea-agents", + "version": "6.4.0" + }, "category": "development" } ] diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 2e7910f23..10e272406 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -15,9 +15,7 @@ "decompiler", "mcp-server" ], - "skills": [ - "./.agents/skills/reverse-engineer-anything" - ], + "skills": "./skills", "mcpServers": { "rea": { "command": "npx", diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 9cbfa3c03..ff458145a 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -15,9 +15,7 @@ "decompiler", "mcp-server" ], - "skills": [ - "./.agents/skills/reverse-engineer-anything" - ], + "skills": "./skills", "mcpServers": { "rea": { "command": "npx", diff --git a/docs/installation.md b/docs/installation.md index afb8a42ae..346b144d8 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -783,15 +783,23 @@ Ghidra/JDK installation; neither is inferred from startup alone. ## Agent plugins and marketplaces -The repository root is both a Claude Code plugin -(`.claude-plugin/plugin.json`) and a Codex plugin -(`.codex-plugin/plugin.json`). Each manifest bundles the -`reverse-engineer-anything` skill from `.agents/skills/` and registers the -stdio server through `npx`, pinned to the exact package version in that -manifest, without a second distribution artifact. +REA's npm package is the shared Claude Code and Codex plugin artifact. It +contains `.claude-plugin/plugin.json`, `.codex-plugin/plugin.json`, and the +canonical generated `skills/` tree. Both manifests select `./skills` and pin +the stdio MCP server to that exact package version. The existing release skill +generator also pins CLI recovery commands to the same version. -The repository is also its own single-plugin marketplace, through +The repository's single-plugin marketplaces are declared in `.claude-plugin/marketplace.json` and `.agents/plugins/marketplace.json`. +Both select an exact `rea-agents` npm version instead of mutable source-checkout +contents. Release Please updates their selectors alongside the plugin manifests. +No plugin-only publication or generated skill files committed to Git are needed. + +This distribution becomes installable after the first qualified npm release +containing these plugin manifests. Earlier published packages are not changed +by this source proposal. For local source development, generate the existing +packaged skill before loading the repository as a plugin; the authored +`.agents/skills/` tree is not the plugin's shipped skill layout. In Claude Code: diff --git a/package.json b/package.json index b2e2a51d3..a7611f58d 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,8 @@ "scripts/hopper-demo-x11.py", "scripts/prepack.mjs", "scripts/prepare.mjs", + ".claude-plugin/plugin.json", + ".codex-plugin/plugin.json", "skills", "README.md", "DISCLAIMER.md", diff --git a/release-please-config.json b/release-please-config.json index 824da4ca5..5543ecc6d 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -51,6 +51,16 @@ "type": "json", "path": ".codex-plugin/plugin.json", "jsonpath": "$.mcpServers.rea.args[1]" + }, + { + "type": "json", + "path": ".claude-plugin/marketplace.json", + "jsonpath": "$.plugins[0].source.version" + }, + { + "type": "json", + "path": ".agents/plugins/marketplace.json", + "jsonpath": "$.plugins[0].source.version" } ] } diff --git a/scripts/lib/release-notes.mjs b/scripts/lib/release-notes.mjs index a79877987..9e884f907 100644 --- a/scripts/lib/release-notes.mjs +++ b/scripts/lib/release-notes.mjs @@ -365,15 +365,29 @@ export function verifyReleaseNotes(raw, text, body) { }; } -const VERSION_ONLY_PLUGIN_MANIFESTS = new Set([ +const VERSION_ONLY_PLUGIN_METADATA = new Set([ ".claude-plugin/plugin.json", ".codex-plugin/plugin.json", + ".claude-plugin/marketplace.json", + ".agents/plugins/marketplace.json", ]); -/** Serialize a plugin manifest with its release-owned version fields blanked. */ -function pluginManifestWithoutVersions(text) { +/** Serialize plugin metadata with only its release-owned version fields blanked. */ +function pluginMetadataWithoutVersions(path, text) { const manifest = JSON.parse(text); if (manifest === null || typeof manifest !== "object") return text; + if (path.endsWith("marketplace.json")) { + if (Array.isArray(manifest.plugins)) + for (const plugin of manifest.plugins) + if ( + plugin?.name === "rea" && + plugin?.source?.source === "npm" && + plugin.source.package === "rea-agents" && + typeof plugin.source.version === "string" + ) + plugin.source.version = ""; + return JSON.stringify(manifest); + } if ("version" in manifest) manifest.version = ""; const launch = manifest.mcpServers?.rea?.args; // Only the version after the last "@" is release-owned; a different package @@ -384,17 +398,21 @@ function pluginManifestWithoutVersions(text) { } /** - * A plugin manifest also carries plugin behavior, so a release may change only - * its version and pinned server launch. Any other difference, an unreadable + * Plugin metadata also carries behavior, so a release may change only + * its version, pinned server launch, and exact REA marketplace version. Any other difference, an unreadable * side, or a manifest added by the release counts as a product change. */ async function changesOnlyPluginVersions(run, path, from, to) { try { return ( - pluginManifestWithoutVersions( + pluginMetadataWithoutVersions( + path, await run("git", ["show", `${from}:${path}`]), ) === - pluginManifestWithoutVersions(await run("git", ["show", `${to}:${path}`])) + pluginMetadataWithoutVersions( + path, + await run("git", ["show", `${to}:${path}`]), + ) ); } catch { return false; @@ -473,7 +491,7 @@ export async function verifyInventoryHistory(run, raw, source) { for (const path of paths) { if (allowed.has(path)) continue; if ( - VERSION_ONLY_PLUGIN_MANIFESTS.has(path) && + VERSION_ONLY_PLUGIN_METADATA.has(path) && (await changesOnlyPluginVersions(run, path, inventory.target, resolved)) ) continue; diff --git a/scripts/verify-package-pack.mjs b/scripts/verify-package-pack.mjs index fc9676745..f38d99909 100644 --- a/scripts/verify-package-pack.mjs +++ b/scripts/verify-package-pack.mjs @@ -60,6 +60,34 @@ export async function verifyPackagePack({ root, workspace }) { throw new Error( "packaged skill metadata did not match the catalog shipped in the package", ); + for (const path of [ + ".claude-plugin/plugin.json", + ".codex-plugin/plugin.json", + ]) { + const manifest = JSON.parse( + (await exec("tar", ["-xOf", tarball, `package/${path}`])).stdout, + ); + if ( + manifest.version !== packedManifest.version || + manifest.skills !== "./skills" || + JSON.stringify(manifest.mcpServers?.rea?.args) !== + JSON.stringify([ + "-y", + `${packedManifest.name}@${packedManifest.version}`, + "mcp", + ]) + ) + throw new Error( + `Packaged plugin ${path} does not match the exact runtime and canonical skill release`, + ); + } + if ( + skill.includes(`${packedManifest.name}@latest`) || + !skill.includes(`${packedManifest.name}@${packedManifest.version}`) + ) + throw new Error( + "Packaged plugin skill recovery is not pinned to the shipped runtime", + ); if ( packedFiles.some( (path) => path.includes("__pycache__") || path.endsWith(".pyc"), diff --git a/tests/boundary/filesystem/releaseNotes.test.ts b/tests/boundary/filesystem/releaseNotes.test.ts index 432f5ce97..9062ba727 100644 --- a/tests/boundary/filesystem/releaseNotes.test.ts +++ b/tests/boundary/filesystem/releaseNotes.test.ts @@ -48,6 +48,16 @@ const pluginManifests = [ ".codex-plugin/plugin.json", ] as const; +const pluginMarketplaces = [ + ".claude-plugin/marketplace.json", + ".agents/plugins/marketplace.json", +] as const; +const pluginMarketplace = (version: string, packageName = "rea-agents") => ({ + plugins: [ + { name: "rea", source: { source: "npm", package: packageName, version } }, + ], +}); + const pluginManifest = ( version: string, { skills = ["./skill"], packageName = "rea-agents" } = {}, @@ -79,6 +89,13 @@ beforeAll(async () => { JSON.stringify(pluginManifest("6.3.0")), ); } + for (const path of pluginMarketplaces) { + await mkdir(join(directory, dirname(path)), { recursive: true }); + await writeFile( + join(directory, path), + JSON.stringify(pluginMarketplace("6.3.0")), + ); + } await git(directory, ["add", "."]); await git(directory, ["commit", "-m", "chore: baseline"]); const base = await git(directory, ["rev-parse", "HEAD"]); @@ -394,7 +411,17 @@ it("binds publication to complete recorded history and the reviewed base", async join(f.directory, path), JSON.stringify(pluginManifest("6.4.0")), ); - await git(f.directory, ["add", "CHANGELOG.md", ...pluginManifests]); + for (const path of pluginMarketplaces) + await writeFile( + join(f.directory, path), + JSON.stringify(pluginMarketplace("6.4.0")), + ); + await git(f.directory, [ + "add", + "CHANGELOG.md", + ...pluginManifests, + ...pluginMarketplaces, + ]); await git(f.directory, ["commit", "-m", "chore: release notes"]); const source = await git(f.directory, ["rev-parse", "HEAD"]); // Release PRs bump the plugin manifest version and pinned launch only. @@ -592,3 +619,23 @@ it("fails closed on partial GitHub errors and non-advancing pagination without s }); await expect(access(output)).rejects.toMatchObject({ code: "ENOENT" }); }); + +it.each(pluginMarketplaces)( + "treats a marketplace package change in %s as product behavior", + async (path) => { + const f = await fixture(); + await writeFile( + join(f.directory, path), + JSON.stringify(pluginMarketplace("6.4.0", "another-package")), + ); + await git(f.directory, ["add", "CHANGELOG.md", path]); + await git(f.directory, ["commit", "-m", "chore: release notes"]); + await expect( + f.invoke(["check", "--manifest", f.manifest, "--source", "HEAD"]), + ).rejects.toMatchObject({ + stderr: expect.stringContaining( + `Product changed after notes target; regenerate inventory: ${path}`, + ), + }); + }, +); diff --git a/tests/conformance/releaseConfiguration.test.ts b/tests/conformance/releaseConfiguration.test.ts index 5d72c4114..7c9718765 100644 --- a/tests/conformance/releaseConfiguration.test.ts +++ b/tests/conformance/releaseConfiguration.test.ts @@ -61,6 +61,14 @@ describe("release configuration", () => { jsonpath, })), ), + ...[ + ".claude-plugin/marketplace.json", + ".agents/plugins/marketplace.json", + ].map((path) => ({ + type: "json", + path, + jsonpath: "$.plugins[0].source.version", + })), ], }, }, @@ -150,6 +158,33 @@ describe("release configuration", () => { }); describe("plugin manifests", () => { + it("distributes both plugins with generated canonical skills from the exact npm release", async () => { + const pkg = (await readJson("package.json")) as { + version: string; + files: string[]; + }; + expect(pkg.files).toEqual( + expect.arrayContaining([...pluginManifests, "skills"]), + ); + for (const path of pluginManifests) + expect(await readJson(path)).toMatchObject({ skills: "./skills" }); + for (const path of [ + ".claude-plugin/marketplace.json", + ".agents/plugins/marketplace.json", + ]) + expect(await readJson(path)).toMatchObject({ + plugins: [ + { + source: { + source: "npm", + package: "rea-agents", + version: pkg.version, + }, + }, + ], + }); + }); + it.each(pluginManifests)( "pins the plugin manifest %s and its server launch to the package version", async (path) => {