4.1 KiB
4.1 KiB
Tasks — Add @suaveplan/api-plugin-site
Every checkbox MUST reflect work actually done in this change.
1. Spec authoring
- 1.1 Read
/mnt/s/web/suaveplan/enterprise/api-plugin-site.mdend-to-end. - 1.2 Confirm no prior
openspec/specs/api-plugin-site/spec.mdexists. - 1.3 Read
openspec/AGENTS.md§§ 0a, 2a, 6a, 7, 12, 13, 14. - 1.4 Draft
proposal.mdwith### Source mappingtable +### Excludedsection. - 1.5 Draft
specs/api-plugin-site/spec.mdwith## ADDED Requirements, every requirement carrying a**Verified by:**line.
2. Implementation
- 2.1
src/error-codes/error-codes.ts—defineCodes("SITE", [...])(14 codes) +SiteError extends SuaveplanError. - 2.2
src/types/types.ts— runtime-free types:Site,SiteSettings,SiteTheme, push types,SiteEventMap, state constants. - 2.3
src/schemas/site.ts— Zod schemas for the site entity. - 2.4
src/schemas/domain.ts— Zod schemas for domain values + requests/responses. - 2.5
src/schemas/push.ts— Push-config schemas +validatePushConfigpure validator. - 2.6
src/schemas/options.ts—SitePluginOptionsSchema,mergeConfig, frozenDEFAULT_CONFIG. - 2.7
src/otel/instruments.ts—getSiteInstruments/resetSiteInstruments/SiteInstruments. - 2.8
src/service/db-port.ts— structuralSiteDbinterface. - 2.9
src/service/normalize-domain.ts— pure normaliser. - 2.10
src/service/domain-resolver.ts—DomainResolverServicewith OTel + envelope result. - 2.11
src/service/site.ts—SiteService(CRUD + emitsite:settings:updated). - 2.12
src/middleware/domain-resolver.ts— middleware factory. - 2.13
src/routes/public-routes.ts— public OpenAPI router. - 2.14
src/routes/private-routes.ts— private OpenAPI router. - 2.15
src/plugin/plugin.ts—createSitePluginviadefinePlugin<SitePluginConfig>. - 2.16
src/services/registry-augmentation.ts—ServiceRegistryslots. - 2.17
src/index.ts— explicit named re-exports. - 2.18
surql/tables/site.surql— table +fn::domain::search.
3. Tests
- 3.1
src/error-codes/error-codes.test.ts— registry shape +SiteErrorpreserves cause. - 3.2
src/otel/instruments.test.ts— cache + rebind against realMeterProvider. - 3.3
src/schemas/options.test.ts,site.test.ts,domain.test.ts,push.test.ts. - 3.4
src/service/normalize-domain.test.ts. - 3.5
src/service/domain-resolver.test.ts— hit/miss/error envelopes, normalisation,resolveOrThrow. - 3.6
src/service/site.test.ts— every method, every error path. - 3.7
src/middleware/domain-resolver.test.ts— Hono integration. - 3.8
src/routes/public-routes.test.ts,private-routes.test.ts. - 3.9
src/plugin/plugin.test.ts— lifecycle, event wiring, route mount, collision detection. - 3.10
src/api-plugin-site.spec-conformance.test.ts— public-surface re-export check. - 3.11 Every
it(...)carries{ timeout: 5000 }. - 3.12 Every test imports from
@suaveplan/testing/runner.
4. Documentation
- 4.1 Sibling
.mdfor every non-barrel, non-test, non-types, non-augmentation.ts. - 4.2 Root
README.mdlists every module link.
5. Pre-archive gates
- 5.1
bunx turbo lint typecheck test --filter=@suaveplan/api-plugin-sitegreen. - 5.2
bunx turbo test:coverage --filter=@suaveplan/api-plugin-site≥ 100% on every metric. - 5.3
bunx turbo build --filter=@suaveplan/api-plugin-sitegreen. - 5.4 Banned-pattern scan returns no hits.
- 5.5 Barrel
export *scan returns no hits in<feature>/index.ts. - 5.6 Test-runner import scan returns no hits.
- 5.7 Sibling
.mdscan returns no missing-doc hits. - 5.8 No bare versions in
package.json. - 5.9 Subpath export count matches feature-module count.
6. Archive
- 6.1 Fold
specs/api-plugin-site/spec.mdintoopenspec/specs/api-plugin-site/spec.md. - 6.2
mv openspec/changes/add-api-plugin-site openspec/archive/2026-05-19-add-api-plugin-site.