Initial Commit
This commit is contained in:
71
openspec/archive/2026-05-19-add-api-plugin-cms/tasks.md
Normal file
71
openspec/archive/2026-05-19-add-api-plugin-cms/tasks.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# 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
|
||||
|
||||
- [x] 1.1 Read `../suaveplan/enterprise/api-plugin-cms.md` end-to-end
|
||||
- [x] 1.2 Read `openspec/specs/` for prior art (api-plugin-database, api-plugin-audit) — no existing `api-plugin-cms/spec.md`
|
||||
- [x] 1.3 Read `openspec/AGENTS.md` Sections 13 and 14
|
||||
- [x] 1.4 Draft `proposal.md` from `openspec/templates/proposal.md`
|
||||
- [x] 1.5 Fill in `## Source mapping` table — every requirement cites a line range OR appears in the "no source line" table with justification
|
||||
- [x] 1.6 Draft `specs/api-plugin-cms/spec.md` from `openspec/templates/spec-delta.md`
|
||||
- [x] 1.7 Every requirement in the spec delta carries a `**Verified by:**` line naming concrete `it(...)` titles
|
||||
|
||||
## 2. Implementation
|
||||
|
||||
- [x] 2.1 `src/types/cms.types.ts` — verbatim port of upstream content-model types, slug + validator utilities, status transitions, event map (adapted to `EventBus<EventMap>` single-payload style)
|
||||
- [x] 2.2 `src/error-codes/error-codes.ts` — `defineCodes("CMS", [...])` + `CmsError extends SuaveplanError<CmsErrorCode>` + six factory helpers
|
||||
- [x] 2.3 `src/engine/cms-engine.ts` — port `CmsEngine` (model CRUD, content CRUD, query, transitions, versions); compose with `EventBus<CmsEventMap>`; inject `Clock` + `IdGenerator`; emit OTel counters
|
||||
- [x] 2.4 `src/routes/problem-json.ts` — local `ProblemDetails` + `formatProblemJson` + `respondProblemJson` with full `CMS_CODES` → HTTP status table
|
||||
- [x] 2.5 `src/schemas/options.ts` — Zod `CmsPluginOptionsSchema` with `Clock` / `IdGenerator` accepted as opaque `unknown` (genesis convention from audit plugin)
|
||||
- [x] 2.6 `src/otel/instruments.ts` — `CmsInstruments` bundle with counters for the seven engine events + validation failures
|
||||
- [x] 2.7 `src/services/registry-augmentation.ts` — `declare module "@suaveplan/api-plugin/service-registry"` adding the `cms: CmsEngine` slot
|
||||
- [x] 2.8 `src/plugin/plugin.ts` — `createCmsPlugin(options)` factory returning a `PluginDescriptor`; `onInit` constructs `CmsEngine`, registers it; `onClose` drops the reference
|
||||
- [x] 2.9 `src/index.ts` — barrel with explicit named re-exports + side-effect imports of code registry and registry augmentation
|
||||
|
||||
## 3. Tests
|
||||
|
||||
- [x] 3.1 `src/types/cms.types.test.ts` — `generateSlug`, `validateContentData`, `VALID_STATUS_TRANSITIONS`
|
||||
- [x] 3.2 `src/error-codes/error-codes.test.ts` — every factory raises expected code; cause chain; `instanceof` narrowing
|
||||
- [x] 3.3 `src/engine/cms-engine.test.ts` — model + content CRUD, query, transitions, versions, events
|
||||
- [x] 3.4 `src/engine/cms-engine.spec-conformance.test.ts` — determinism with injected Clock/IdGenerator; full code enumeration
|
||||
- [x] 3.5 `src/routes/problem-json.test.ts` — CmsError mapping, generic SuaveplanError, non-error throwables
|
||||
- [x] 3.6 `src/schemas/options.test.ts` — Zod boundary
|
||||
- [x] 3.7 `src/plugin/plugin.test.ts` — descriptor shape, onInit/onClose
|
||||
- [x] 3.8 `src/otel/instruments.test.ts` — counter emission asserted with in-memory `MeterProvider`
|
||||
- [x] 3.9 `src/api-plugin-cms.spec-conformance.test.ts` — every code thrown from production source, side-effect barrel imports
|
||||
- [x] 3.10 `tests/dep-graph.test.ts` — pins runtime dep set
|
||||
- [x] 3.11 Every `it(...)` carries `{ timeout: 5000 }`
|
||||
|
||||
## 4. Documentation
|
||||
|
||||
- [x] 4.1 Sibling `.md` for every implementation `.ts` (≥200 words, basic + advanced examples, full API reference)
|
||||
- [x] 4.2 README at package root linking every co-located `.md`
|
||||
- [x] 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)
|
||||
|
||||
- [x] 5.1 `bun run check` — Biome 0/0/0
|
||||
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-cms` — green
|
||||
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-plugin-cms` — 100/100/100/100
|
||||
- [x] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/api-plugin-cms` — exit 0, no `error` findings
|
||||
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-plugin-cms` — green
|
||||
|
||||
## 6. Pre-archive 9-row checklist (skill §7)
|
||||
|
||||
- [x] 6.1 Generics threaded; `expectTypeOf` on every literal-type claim (event-map keys)
|
||||
- [x] 6.2 Zod schemas wired at every declared boundary (`createCmsPlugin`)
|
||||
- [x] 6.3 Every error code in `error-codes.ts` thrown by ≥1 production path
|
||||
- [x] 6.4 Strict-mode behaviors tested both on and off — N/A; no strict-mode flag in this package
|
||||
- [x] 6.5 OTel instruments emitted from production paths and asserted with real `MeterProvider`
|
||||
- [x] 6.6 Lifecycle dedup tested where claimed — N/A; engine state is per-instance, no in-flight Promise dedup
|
||||
- [x] 6.7 No retroactive tick — every box reflects work done in this change
|
||||
- [x] 6.8 No `export *` in any feature-module barrel (no feature-module barrels; flat module per dir)
|
||||
- [x] 6.9 No direct `vitest` / `bun:test` imports — every test imports `@suaveplan/testing/runner`
|
||||
|
||||
## 7. Archive
|
||||
|
||||
- [x] 7.1 Fold spec delta into `openspec/specs/api-plugin-cms/spec.md`
|
||||
- [x] 7.2 Move `openspec/changes/add-api-plugin-cms/` → `openspec/archive/2026-05-19-add-api-plugin-cms/`
|
||||
- [x] 7.3 Refresh `MANIFEST.md` — skipped per session protocol (concurrent sessions own MANIFEST.md)
|
||||
Reference in New Issue
Block a user