3D engine that AI agents drive
Ship 67js as a Claude Code plugin (issue #650)
Nguyen Xuan Anc507ad3eb8c8
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonnew file mode 100644index 00000000..b74cf0bf--- /dev/null+++ b/.claude-plugin/marketplace.json@@ -0,0 +1,14 @@+{+ "name": "67js",+ "owner": { "name": "CodePawl", "url": "https://67js.codepawl.com" },+ "metadata": { "description": "67js, a 3D engine an AI agent drives through MCP." },+ "plugins": [+ {+ "name": "67js",+ "source": "./",+ "description": "The 67js MCP server and the build-67js-scene and render-67js-media skills.",+ "version": "0.16.0",+ "category": "development"+ }+ ]+}diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonnew file mode 100644index 00000000..f4cc22c5--- /dev/null+++ b/.claude-plugin/plugin.json@@ -0,0 +1,17 @@+{+ "name": "67js",+ "version": "0.16.0",+ "description": "Build, light, film and render 3D scenes through the 67js MCP server, with the skills that teach an agent to drive it.",+ "author": { "name": "CodePawl", "url": "https://67js.codepawl.com" },+ "homepage": "https://67js.codepawl.com",+ "repository": "https://github.com/codepawl/67.js",+ "license": "MIT",+ "keywords": ["3d", "mcp", "three.js", "render", "scene"],+ "skills": ["./skills/build-67js-scene", "./skills/render-67js-media"],+ "mcpServers": {+ "67js": {+ "command": "npx",+ "args": ["-y", "-p", "@codepawlhq/67js", "67js-mcp"]+ }+ }+}diff --git a/README.md b/README.mdindex 195e7dbc..5adcf965 100644--- a/README.md+++ b/README.md@@ -53,6 +53,14 @@ Install 67js from npm as `67js@npm:@codepawlhq/67js` and connect its MCP serverhttps://67js.codepawl.com/llms.txt first and follow it.```+**Claude Code plugin.** One command adds the MCP server and both skills. The server starts from the published npm+package with `npx`, so nothing is built locally.++```text+/plugin marketplace add codepawl/67.js+/plugin install 67js@67js+```+**By hand**```shdiff --git a/changes/650.md b/changes/650.mdnew file mode 100644index 00000000..8314cbfc--- /dev/null+++ b/changes/650.md@@ -0,0 +1,2 @@+- A Claude Code plugin: `/plugin marketplace add codepawl/67.js` then `/plugin install 67js@67js` adds the 67js MCP server (started with `npx` from the npm package) and the build-67js-scene and render-67js-media skills (#650)+- `npm run plugin:sync` copies the package.json version into the plugin manifests, and a test fails when they differ (#650)diff --git a/docs/learn/connect-mcp.md b/docs/learn/connect-mcp.mdindex b4566018..5f3ffa99 100644--- a/docs/learn/connect-mcp.md+++ b/docs/learn/connect-mcp.md@@ -62,7 +62,14 @@ On macOS and Linux, use the output of `which node` as the command. Use forward s## Claude Code-Claude Code can add the server with one command. Everything after `--` is the launch command:+The plugin is the shortest route. It adds the server and the `build-67js-scene` and `render-67js-media` skills:++```text+/plugin marketplace add codepawl/67.js+/plugin install 67js@67js+```++The plugin starts the server with `npx` from the published npm package. For a manual setup, Claude Code can add the server with one command. Everything after `--` is the launch command:```shclaude mcp add --transport stdio 67js-scene -- npx -y --package @codepawlhq/67js 67js-mcp --backend gpu --memory 192diff --git a/package.json b/package.jsonindex 40808847..f55e3e35 100644--- a/package.json+++ b/package.json@@ -167,7 +167,8 @@"smoke:site": "node scripts/smoke-site.mjs","smoke:agent-review-close": "node scripts/smoke-agent-review-close.mjs","smoke:film-physics": "node scripts/smoke-film-physics.mjs",- "publish:ci": "node scripts/publish-ci.mjs",+ "plugin:sync": "node scripts/sync-plugin-version.mjs",+ "publish:ci":"node scripts/publish-ci.mjs","smoke:character": "node scripts/smoke-character.mjs","smoke:modeling": "node scripts/smoke-modeling.mjs","smoke:material-maps": "node scripts/smoke-material-maps.mjs",diff --git a/scripts/sync-plugin-version.mjs b/scripts/sync-plugin-version.mjsnew file mode 100644index 00000000..fe9d3086--- /dev/null+++ b/scripts/sync-plugin-version.mjs@@ -0,0 +1,22 @@+// Copies the version in package.json into the Claude Code plugin manifest and the marketplace entry.+// Run it with `npm run plugin:sync` after bumping the version for a release.+import { readFile, writeFile } from 'node:fs/promises';+import { resolve } from 'node:path';++const root = resolve(import.meta.dirname, '..');+const packageMetadata = JSON.parse(await readFile(resolve(root, 'package.json'), 'utf8'));++async function updateJson(relativePath, update) {+ const filePath = resolve(root, relativePath);+ const document = JSON.parse(await readFile(filePath, 'utf8'));+ update(document);+ await writeFile(filePath, `${JSON.stringify(document, null, 2)}\n`);+}++await updateJson('.claude-plugin/plugin.json', (manifest) => {+ manifest.version = packageMetadata.version;+});+await updateJson('.claude-plugin/marketplace.json', (marketplace) => {+ for (const plugin of marketplace.plugins) plugin.version = packageMetadata.version;+});+console.log(`Claude Code plugin set to ${packageMetadata.version}.`);diff --git a/tests/claude-plugin.test.js b/tests/claude-plugin.test.jsnew file mode 100644index 00000000..0dd5d0ce--- /dev/null+++ b/tests/claude-plugin.test.js@@ -0,0 +1,40 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { existsSync, readFileSync } from 'node:fs';+import packageMetadata from '../package.json' with { type: 'json' };++function readJson(relativePath) {+ return JSON.parse(readFileSync(new URL(`../${relativePath}`, import.meta.url), 'utf8'));+}++const manifest = readJson('.claude-plugin/plugin.json');+const marketplace = readJson('.claude-plugin/marketplace.json');+const syncHint = 'Run `npm run plugin:sync` to copy the version from package.json.';++test('the plugin manifest version matches package.json', () => {+ assert.equal(manifest.version, packageMetadata.version, syncHint);+});++test('every marketplace entry matches the plugin name and version', () => {+ assert.ok(marketplace.plugins.length > 0);+ for (const plugin of marketplace.plugins) {+ assert.equal(plugin.name, manifest.name);+ assert.equal(plugin.version, packageMetadata.version, syncHint);+ }+});++test('the plugin ships both skills that exist in the repository', () => {+ assert.deepEqual(manifest.skills, ['./skills/build-67js-scene', './skills/render-67js-media']);+ for (const skillPath of manifest.skills) {+ assert.ok(existsSync(new URL(`../${skillPath}/SKILL.md`, import.meta.url)), `${skillPath} has no SKILL.md`);+ }+});++test('the plugin starts the published MCP bin and the npm package ships its files', () => {+ const server = manifest.mcpServers['67js'];+ assert.equal(server.command, 'npx');+ const [binName] = Object.keys(packageMetadata.bin);+ assert.deepEqual(server.args, ['-y', '-p', packageMetadata.name, binName]);+ assert.ok(packageMetadata.files.includes('skills'));+ assert.ok(!packageMetadata.files.includes('.claude-plugin'), 'the plugin manifests are for the repository, not the npm tarball');+});