5.1 KiB
5.1 KiB
Tasks — @suaveplan/api-manifest
Every checkbox MUST reflect work actually done in this change.
0. Pre-flight (non-negotiable)
- 0.1 Confirm clean working tree (
git statusreports nothing) and no in-flight worktrees with uncommitted work (git worktree listthengit statusin each) - 0.2 If any worktrees exist under
.claude/worktrees/, account for each one: still-active agent, work-pending-merge, or stale-and-prune. Stale worktrees MUST be removed (git worktree remove) before opening a new one — code that has been lost twice on main is the failure mode this guards against. - 0.3 Confirm the package set in
MANIFEST.mdmatchesfind packages -maxdepth 3 -name package.jsoncount. Drift here means a prior change archived without regenerating the manifest.
1. Spec authoring
- 1.1 Read design doc §3 (manifest schema), §4 (lifecycle reinstall criteria), §5.2 (capability resolution), §8.1a (manifest hash)
- 1.2 Read
openspec/specs/api-manifest/spec.md(does not exist yet — net-new) - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Source-mapping table — every requirement cites a design-doc section
- 1.6 Draft
specs/api-manifest/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1 Scaffold
packages/api/api-manifest/("version": "0.1.0","sideEffects": false, deps:@suaveplan/api-typesworkspace,@suaveplan/errorworkspace,zodcatalog,@suaveplan/typesworkspace) - 2.2
src/schema/— one file per top-level manifest key (identity.ts,compat.ts,isolation.ts,permissions.ts,dependsOn.ts,routes.ts,graphql.ts,websockets.ts,sse.ts,sagas.ts,twoPhaseCommit.ts,database.ts,jobs.ts,events.ts,secrets.ts,config.ts,scopes.ts,telemetry.ts,openapi.ts,errors.ts,uninstall.ts); compositeplugin-manifest.tsjoining them. Alwaysimport z from "zod". - 2.3
src/parse/—parseManifest,parseManifestSafe - 2.4
src/validators/—validate-saga-ownership,validate-permissions-when-sandboxed,validate-openapi-requires-graphql-or-routes,validate-error-status-map-shape - 2.5
src/dep-graph/— Kahn's-algorithm topological sort with cycle detection; semver-range matcher - 2.6
src/capability-resolver/— required vs optional resolution against aCapabilityDescriptor[]source - 2.7
src/hash/— canonical-JSON serializer + sha256 (from@suaveplan/crypto-hash) - 2.8
src/error-codes/—MANIFEST_CODESregistry:PARSE_FAILED,DEPENDENCY_CYCLE,MISSING_DEPENDENCY,DEPENDENCY_VERSION_MISMATCH,CAPABILITY_REQUIRED_MISSING,CAPABILITY_VERSION_MISMATCH,INVALID_SAGA_OWNERSHIP,SANDBOX_REQUIRES_BUDGETS,INVALID_ERROR_STATUS_MAP - 2.9
src/testing/—runManifestConformance(parse)harness - 2.10
src/index.ts— explicit named re-exports (rule 10); namespace re-exports per subpath - 2.11
package.jsonexports— one subpath per category
3. Tests
- 3.1 Schema unit tests per feature (
<feature>.test.ts) — golden fixtures - 3.2 Spec-conformance tests (
<feature>.spec-conformance.test.ts) — type-level + code-registry pinning - 3.3 Property tests (
fast-check) ondep-graphtopological sort +hashkey-order stability - 3.4 Every
it(...)carries{ timeout: 5000 }
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced) - 4.2
README.mdat root linking every co-located.mdunder## Modules - 4.3 No CLAUDE.md update needed (covered by umbrella entry)
5. Pre-archive verification (the 5-gate triple)
- 5.1
bun run check— Biome 0/0/0 - 5.2
bunx turbo lint typecheck test --filter=@suaveplan/api-manifest— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-manifest— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-manifest— exit 0 - 5.5
bunx turbo build --filter=@suaveplan/api-manifest— green
6. Pre-archive 7-row checklist (AGENTS.md Section 13)
- 6.1 Generics on
parseManifest<T extends PluginManifest>;expectTypeOfon inferred Zod outputs vsapi-typesshape - 6.2 Zod schemas wired at the public boundary (
parseManifest); every input goes through Zod - 6.3 Every
MANIFEST_CODESentry thrown by a production path with a test asserting it - 6.4 Strict-mode behavior — Zod
.strict()rejecting unknown top-level keys is tested both with strict on and off (per-field override) - 6.5 OTel instruments — N/A (this is a pure parser; instrumentation lives in
api-hostcallers) - 6.6 Lifecycle dedup — N/A (no async lifecycle in this package)
- 6.7 No retroactive tick
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-manifest/spec.md - 7.2 Move
openspec/changes/api-manifest/→openspec/archive/<yyyy-mm-dd>-api-manifest/ - 7.3 Tick
1.2in umbrellaopenspec/changes/api-plugin-foundation/tasks.md - 7.4 Refresh
MANIFEST.md