Files
nexu-io__open-design/apps/daemon/tests/plugins-export.test.ts
Cursor Agent 04784013e6 feat(plugins): od plugin scaffold + od plugin export (Phase 4 author tooling)
Plan G1 + G2 / spec §14.

Two new author-side CLI verbs that close the spec §14 'one repo, every
catalog' loop without leaving the terminal.

apps/daemon/src/plugins/scaffold.ts owns the scaffold path:

  od plugin scaffold --id <id> [--title] [--description]
                     [--task-kind <new-generation|code-migration|
                                   figma-migration|tune-collab>]
                     [--mode <m>] [--scenario <s>]
                     [--out <dir>] [--with-claude-plugin]

  Writes <out>/<id>/{SKILL.md, open-design.json, README.md} (plus the
  optional .claude-plugin/plugin.json for cross-catalog publishing).
  Refuses to overwrite an existing scaffold; rejects unsafe ids.

apps/daemon/src/plugins/export.ts + POST /api/applied-plugins/export
own the export path. Three targets:

  od            → SKILL.md + open-design.json + provenance README
  claude-plugin → SKILL.md + .claude-plugin/plugin.json + README
  agent-skill   → SKILL.md + README only (every catalog accepts this)

  od plugin export <projectId> --as od|claude-plugin|agent-skill --out <dir>
  od plugin export --snapshot-id <id> --as <target> --out <dir>

The exporter pulls SKILL.md straight off the installed plugin's fsPath
when available and otherwise synthesises one from the snapshot's
frozen plugin metadata, so a publishable folder is reproducible even
after od plugin update / uninstall rotates the live source. The
generated open-design.json carries a provenance block recording
snapshot id + manifestSourceDigest so a downstream catalog viewer can
reverse-resolve the originating run.

The HTTP route is loopback-only (requireLocalDaemonRequest) because
it writes to the host filesystem; the CLI is the canonical caller.

Daemon tests: 1455 → 1465 (+10): plugins-scaffold (5 cases) +
plugins-export (5 cases).

Co-authored-by: Tom Huang <1043269994@qq.com>
2026-05-09 12:22:16 +00:00

4.8 KiB