Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
# Tasks — `@suaveplan/api-graphql-ui-graphiql`
> Every checkbox MUST reflect work actually done in this change.
## 0. Pre-flight (non-negotiable)
- [x] 0.1 Confirmed clean working tree before opening this change (verified at dispatch).
- [x] 0.2 Worktree accounted for — this change executed in an isolated agent worktree.
- [x] 0.3 `MANIFEST.md` refreshed after package land (task 7.4).
## 1. Spec authoring
- [x] 1.1 Read design doc §10.6
- [x] 1.2 Read umbrella Stage 7 acceptance
- [x] 1.3 Read `openspec/AGENTS.md` Sections 13 and 14
- [x] 1.4 Draft `proposal.md`
- [x] 1.5 Draft `specs/api-graphql-ui-graphiql/spec.md`
- [x] 1.6 Every requirement carries a `**Verified by:**` line
## 2. Implementation
- [x] 2.1 Scaffold `packages/api-stack/api/api-graphql-ui-graphiql/`
- [x] 2.2 `src/options/options.ts` — `GraphiqlUiOptions` Zod schema
- [x] 2.3 `src/factory/create-graphiql-ui.ts` — `createGraphiqlUi(opts)` returning `RouterPlugin`
- [x] 2.4 `src/html/render-shell.ts` — HTML shell template embedding configured endpoints + theme
- [x] 2.5 `src/assets/assets.ts` — static-asset map; cache-busting hashes
- [x] 2.6 `src/headers/csp.ts` — Content-Security-Policy header builder
- [x] 2.7 `src/instruments/instruments.ts` — `graphql.ui.requests_total` counter
- [x] 2.8 `src/error-codes/error-codes.ts` — 2 `GRAPHQL_UI_GRAPHIQL_*` codes
- [x] 2.9 `src/index.ts` — explicit named re-exports
## 3. Tests
- [x] 3.1 Unit tests, every `it(...)` `{ timeout: 5000 }`
- [x] 3.2 Conformance test pins endpoint mount + embedded-config (`create-graphiql-ui.spec-conformance.test.ts`)
- [x] 3.3 Asset reachability test (`{ timeout: 5000 }`)
- [x] 3.4 End-to-end integration (`{ timeout: 30000 }`) — in-memory `Router` + minimal GraphQL handler exercising shell + asset + protocol round-trip. Playwright-driven browser variant remains gated on `api-graphql-yoga` landing (Stage 7.1); integration test stands in until then with full HTTP contract coverage.
- [x] 3.5 All tests import from `@suaveplan/testing/runner`
## 4. Documentation
- [x] 4.1 Sibling `.md` per implementation file (7/7 — docs:check passes)
- [x] 4.2 `README.md` calling out: opt-in via host config; no CDN; bundled assets only
## 5. Pre-archive verification
- [x] 5.1 `bun run check` — biome auto-fix applied, no remaining issues
- [x] 5.2 `bunx turbo lint typecheck test --filter=@suaveplan/api-graphql-ui-graphiql` — green
- [x] 5.3 `bunx turbo test:coverage --filter=@suaveplan/api-graphql-ui-graphiql` — 100/100/100/100
- [ ] 5.4 `bun scripts/openspec-conformance.ts @suaveplan/api-graphql-ui-graphiql` — script throws on 3-level packages layout (pre-existing issue; reproducible on every existing api-stack package). Tracked separately; not blocking this change.
- [x] 5.5 `bunx turbo build --filter=@suaveplan/api-graphql-ui-graphiql` — green (runs as part of the gate)
## 6. Pre-archive 7-row checklist
- [x] 6.1 Generics where applicable; literal-type narrowing exercised on theme + ui-label
- [x] 6.2 Zod schema on options (strict, defaults baked)
- [x] 6.3 Both error codes thrown by production paths (asserted in `error-codes.test.ts` + `factory/*.test.ts`)
- [x] 6.4 Strict-mode tested (theme system vs explicit; strict unknown-key rejection)
- [x] 6.5 `graphql.ui.requests_total` asserted via in-memory `MeterProvider` fake
- [x] 6.6 Lifecycle dedup N/A (stateless static-asset server)
- [x] 6.7 No retroactive ticks — Stage-7 row 7.3 ticked only on this change
## 7. Archive
- [x] 7.1 Fold spec delta into `openspec/specs/api-graphql-ui-graphiql/spec.md`
- [x] 7.2 Move to `openspec/archive/2026-05-26-api-graphql-ui-graphiql/`
- [x] 7.3 Tick Stage-7 row in umbrella tasks
- [x] 7.4 Refresh `MANIFEST.md`