5.4 KiB
5.4 KiB
Tasks — Add @suaveplan/api-plugin-cms
Every checkbox MUST reflect work actually done in this change. Do not retroactively tick boxes for work that was already in main when this change opened. Do not tick a box for a test that doesn't exist or doesn't pin the requirement it claims to verify. Retroactive ticking is the failure mode this template guards against.
1. Spec authoring
- 1.1 Read
../suaveplan/enterprise/api-plugin-cms.mdend-to-end - 1.2 Read
openspec/specs/for prior art (api-plugin-database, api-plugin-audit) — no existingapi-plugin-cms/spec.md - 1.3 Read
openspec/AGENTS.mdSections 13 and 14 - 1.4 Draft
proposal.mdfromopenspec/templates/proposal.md - 1.5 Fill in
## Source mappingtable — every requirement cites a line range OR appears in the "no source line" table with justification - 1.6 Draft
specs/api-plugin-cms/spec.mdfromopenspec/templates/spec-delta.md - 1.7 Every requirement in the spec delta carries a
**Verified by:**line naming concreteit(...)titles
2. Implementation
- 2.1
src/types/cms.types.ts— verbatim port of upstream content-model types, slug + validator utilities, status transitions, event map (adapted toEventBus<EventMap>single-payload style) - 2.2
src/error-codes/error-codes.ts—defineCodes("CMS", [...])+CmsError extends SuaveplanError<CmsErrorCode>+ six factory helpers - 2.3
src/engine/cms-engine.ts— portCmsEngine(model CRUD, content CRUD, query, transitions, versions); compose withEventBus<CmsEventMap>; injectClock+IdGenerator; emit OTel counters - 2.4
src/routes/problem-json.ts— localProblemDetails+formatProblemJson+respondProblemJsonwith fullCMS_CODES→ HTTP status table - 2.5
src/schemas/options.ts— ZodCmsPluginOptionsSchemawithClock/IdGeneratoraccepted as opaqueunknown(genesis convention from audit plugin) - 2.6
src/otel/instruments.ts—CmsInstrumentsbundle with counters for the seven engine events + validation failures - 2.7
src/services/registry-augmentation.ts—declare module "@suaveplan/api-plugin/service-registry"adding thecms: CmsEngineslot - 2.8
src/plugin/plugin.ts—createCmsPlugin(options)factory returning aPluginDescriptor;onInitconstructsCmsEngine, registers it;onClosedrops the reference - 2.9
src/index.ts— barrel with explicit named re-exports + side-effect imports of code registry and registry augmentation
3. Tests
- 3.1
src/types/cms.types.test.ts—generateSlug,validateContentData,VALID_STATUS_TRANSITIONS - 3.2
src/error-codes/error-codes.test.ts— every factory raises expected code; cause chain;instanceofnarrowing - 3.3
src/engine/cms-engine.test.ts— model + content CRUD, query, transitions, versions, events - 3.4
src/engine/cms-engine.spec-conformance.test.ts— determinism with injected Clock/IdGenerator; full code enumeration - 3.5
src/routes/problem-json.test.ts— CmsError mapping, generic SuaveplanError, non-error throwables - 3.6
src/schemas/options.test.ts— Zod boundary - 3.7
src/plugin/plugin.test.ts— descriptor shape, onInit/onClose - 3.8
src/otel/instruments.test.ts— counter emission asserted with in-memoryMeterProvider - 3.9
src/api-plugin-cms.spec-conformance.test.ts— every code thrown from production source, side-effect barrel imports - 3.10
tests/dep-graph.test.ts— pins runtime dep set - 3.11 Every
it(...)carries{ timeout: 5000 }
4. Documentation
- 4.1 Sibling
.mdfor every implementation.ts(≥200 words, basic + advanced examples, full API reference) - 4.2 README at package root linking every co-located
.md - 4.3 CLAUDE.md package listing — covered by the api-plugin family entry already present (no edit needed for additive plugin)
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-plugin-cms— green - 5.3
bunx turbo test:coverage --filter=@suaveplan/api-plugin-cms— 100/100/100/100 - 5.4
bun scripts/openspec-conformance.ts @suaveplan/api-plugin-cms— exit 0, noerrorfindings - 5.5
bunx turbo build --filter=@suaveplan/api-plugin-cms— green
6. Pre-archive 9-row checklist (skill §7)
- 6.1 Generics threaded;
expectTypeOfon every literal-type claim (event-map keys) - 6.2 Zod schemas wired at every declared boundary (
createCmsPlugin) - 6.3 Every error code in
error-codes.tsthrown by ≥1 production path - 6.4 Strict-mode behaviors tested both on and off — N/A; no strict-mode flag in this package
- 6.5 OTel instruments emitted from production paths and asserted with real
MeterProvider - 6.6 Lifecycle dedup tested where claimed — N/A; engine state is per-instance, no in-flight Promise dedup
- 6.7 No retroactive tick — every box reflects work done in this change
- 6.8 No
export *in any feature-module barrel (no feature-module barrels; flat module per dir) - 6.9 No direct
vitest/bun:testimports — every test imports@suaveplan/testing/runner
7. Archive
- 7.1 Fold spec delta into
openspec/specs/api-plugin-cms/spec.md - 7.2 Move
openspec/changes/add-api-plugin-cms/→openspec/archive/2026-05-19-add-api-plugin-cms/ - 7.3 Refresh
MANIFEST.md— skipped per session protocol (concurrent sessions own MANIFEST.md)