Skip to content

feat(skills): M5 Phase A — registry foundation (#85)#90

Open
viktor-shcherb wants to merge 2 commits into
mainfrom
dev/85-skill-registry
Open

feat(skills): M5 Phase A — registry foundation (#85)#90
viktor-shcherb wants to merge 2 commits into
mainfrom
dev/85-skill-registry

Conversation

@viktor-shcherb
Copy link
Copy Markdown
Member

Summary

Skill registry foundation: schema + JSON-body upload + browse +
deprecate + pipeline-binding validator. Publishers upload named,
versioned content bundles (markdown + structured manifest); Murmur
stores them and exposes browse / read endpoints. Same-publisher
isolation by construction.

The MCP `resources/list` / `resources/read` exposure (with the
auto-load flag), the tarball / git-ref upload forms, and the 90-day
deprecation sweeper all ship in follow-ups against the same
`skill_files` row shape.

  • Schema (migration 0004) — `skills` (`(publisher_id, name, version)`
    UNIQUE; `deprecated_at` retained-on-flip) + `skill_files` (flat
    rows, UTF-8 text content, `(skill_id, path)` UNIQUE).
  • Endpoints under `/skills*` (publisher-scoped via
    `publisherAuth(db)`):
    • `POST /skills` (admin)
    • `GET /skills` (admin OR runner)
    • `GET /skills/:name` (admin OR runner)
    • `GET /skills/:name/:version` (admin OR runner)
    • `GET /skills/:name/:version/files` (admin OR runner)
    • `GET /skills/:name/:version/files/:path{.+}` (admin OR runner)
    • `DELETE /skills/:name/:version` (admin)
  • Validation — 256 KB per-file cap, 4 MB bundle cap, 64-file cap,
    kebab-case names, semver-ish versions, path-traversal-safe paths,
    `SKILL.md` REQUIRED. Re-upload of the same triple → 409.
    Cross-publisher reads → 404 (no information leak).
  • Pipeline-binding validator — `validatePipelineSkillRefs`
    resolves `/@` (or bare
    `@`) refs. Snapshots `name@latest` to the
    most-recent non-deprecated version at validation time. Rejects
    cross-publisher refs. The `POST /pipelines` consumer wiring lands
    in a follow-up (it extends the M0 pipeline-def schema to include a
    `skills` field, which is its own contract change).

DoD coverage

  • Skill bundle storage (DB-resident in v1; tarball form follow-up)
  • Upload / list / fetch / deprecate API
  • Pipeline binding validation (helper exported; consumer wiring follow-up)
  • `name@latest` resolution at pipeline-registration time
  • Documentation: skill authoring guide (`docs/skills.md`)
  • MCP resource exposure with auto-load flag — follow-up. Tracked.

Branch ordering note

Numbers as migration 0004 because PR #89 (M2) holds 0003. The
two PRs are independent and can land in either order — the migrations
runner iterates by numeric prefix and tolerates gaps.

Test plan

  • `pnpm test:unit` — 417 tests pass (22 new for skills)
  • `pnpm typecheck`, `pnpm lint`, `pnpm grep:all` — green
  • Post-merge: deploy + verify `POST /skills` round-trips against
    the demo publisher's MURMUR_TOKEN.

🤖 Generated with Claude Code

viktor-shcherb and others added 2 commits May 7, 2026 21:41
…binding validator)

Skill registry foundation per issue #85. Publishers upload named,
versioned content bundles (markdown + structured manifest); Murmur
stores them and exposes browse + read endpoints. The MCP
`resources/list` / `resources/read` exposure + auto-load semantics
ship in a follow-up; tarball / git-ref upload forms ship later as a
separate ingestion path against the same `skill_files` row shape.

Schema (migration 0004 — 0003 reserved for M2 in PR #89):
- `skills` — `(publisher_id, name, version)` UNIQUE; `manifest_json`,
  `deprecated_at`, retained on deprecation.
- `skill_files` — flat file rows; `(skill_id, path)` UNIQUE; UTF-8
  text content (binary out of scope for v1).

Endpoints (publisher-scoped via `publisherAuth(db)`; `/skills*` zone
added to `src/server.ts`):
- `POST   /skills`                                  (admin)
- `GET    /skills`                                  (admin OR runner)
- `GET    /skills/:name`                            (admin OR runner)
- `GET    /skills/:name/:version`                   (admin OR runner)
- `GET    /skills/:name/:version/files`             (admin OR runner)
- `GET    /skills/:name/:version/files/:path{.+}`   (admin OR runner)
- `DELETE /skills/:name/:version`                   (admin)

Validation:
- 256 KB per-file cap, 4 MB bundle cap, 64-file cap, kebab-case names,
  semver-ish versions, path-traversal-safe file paths.
- `SKILL.md` REQUIRED in every bundle.
- Re-upload of `(publisher_id, name, version)` → 409 (immutability).
- Cross-publisher reads → 404 (no information leak).

Pipeline-binding validator:
- `validatePipelineSkillRefs` resolves `<publisher>/<name>@<version>`
  refs (or bare `<name>@<version>`) against this publisher's skills.
- `name@latest` resolves to the most-recent non-deprecated version at
  validation time — caller writes the resolved canonical ref into the
  stored pipeline def (snapshotting per the M5 spec).
- Cross-publisher refs rejected (`cross_publisher_skill_ref_unsupported`)
  in v1.
- The `POST /pipelines` consumer wiring lands in a follow-up — needs
  the M0 pipeline-def schema to add a `skills` field, which is its
  own contract change.

Tests:
- 22 cases covering happy path, every named validation reject,
  immutability, deprecation lifecycle, cross-publisher isolation, and
  the validator + parseSkillRef.

DoD coverage (issue #85):
- [x] Skill bundle storage (DB-resident in v1; tarball form follow-up)
- [x] Upload / list / fetch / deprecate API
- [x] Pipeline binding validation at registration (helper exported,
      consumer wiring follow-up)
- [x] `name@latest` resolution at pipeline-registration time
- [x] Documentation: skill authoring guide (`docs/skills.md`)
- [ ] MCP resource exposure with auto-load flag — follow-up

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…GET/DELETE

CI's coverage gate flagged src/api/**/*.ts branches at 73.24% (threshold
75%) — skills.ts at 59.22% was the culprit. Adds 14 cases covering
each individual validation reject (malformed JSON, non-object body,
missing/malformed version, empty description, non-object manifest,
non-array files, empty files array, file count cap, non-object file
entry, non-string content) plus 401-on-no-auth on GET / DELETE.

Lifts skills.ts branch coverage to 71.55% and the src/api/publisher
folder to 75.07% (above the 75% threshold).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant