chore: initial scaffold + design spec + implementation plan

Skeleton for Osteo Report MVP. Build passes, 7 smoke tests green, real
Horse.svg + Horse_head.svg in public/species/equine/. Zod schemas are
the contract; store/anatomy/pdf modules are typed stubs throwing
"not implemented" awaiting implementation.

Spec: docs/superpowers/specs/2026-05-18-osteo-report-mvp-design.md
Plan: docs/superpowers/plans/2026-05-18-osteo-report-mvp.md (23 phases, ~70 TDD tasks)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bastien ChanotandClaude Opus 4.7 committed 2026-05-18 20:55:10 +02:00
1 parent 12a3e48fdf
commit 8ca36b5ccd
104 files changed
+12448

No files matched your search

View File
Whitespace-only changes.
+20
View File
@@ -0,0 +1,20 @@
# Blockers Registry
Format: BLK-XXX | Date | Friction | Root cause | Solution | Status
---
## BLK-001 | 2026-05-18 | pnpm not on PATH
pnpm command not found on shell start.
Root: corepack shim broken on Node 20.20.0 (ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING).
Fix: curl https://get.pnpm.io/install.sh → ~/.local/share/pnpm/bin/pnpm.
Status: resolved.
---
## BLK-002 | 2026-05-18 | Pathology DB empty — pending content review
40-60 equine entries needed; source-cited from Merck Vet Manual, IMAIOS, PubMed, EVJ, WikiVet, LCAO.
Client osteo will review post-scaffold.
Status: open — Phase 2d.
+58
View File
@@ -0,0 +1,58 @@
# Decisions Registry
Format: BDR-XXX | Date | Title | Rationale | Alternatives | Status
---
## BDR-001 | 2026-05-18 | React SPA exception for tool app
Tool is practitioner-only, no public indexing needed → SPA valid per CLAUDE.md rule.
Alt: Next.js SSR rejected — no server, static deploy only.
Status: closed.
---
## BDR-002 | 2026-05-18 | SVG inline via DOMParser, not img/object
Inline SVG = full CSS control, pointer-events, data-* access.
img/object = sandboxed, no DOM access, no click delegation.
Status: closed.
---
## BDR-003 | 2026-05-18 | PDF attachment via native pdf-lib attach()
Native EmbeddedFiles (afRelationship:Data) = proper PDF spec, survives re-save in Acrobat.
Alt: custom metadata → rejected (non-standard, stripped by some viewers).
Status: closed.
---
## BDR-004 | 2026-05-18 | Runtime identity via window.__APP_CONFIG__
Build-time VITE_APP_* → baked into bundle; runtime injection via entrypoint.sh → no rebuild needed for brand changes.
Order: runtime > build-time > defaults.
Status: closed.
---
## BDR-005 | 2026-05-18 | Vertebra picker: region tabs + chip grid
≥40px touch targets, multi-select, per-region toggle.
Alt: flat list → too long for 54 total vertebrae.
Status: closed.
---
## BDR-006 | 2026-05-18 | Drag-reorder: up/down buttons, not DnD
DnD on mobile unreliable; ↑/↓ buttons accessible + simple.
Status: closed.
---
## BDR-007 | 2026-05-18 | pnpm 11 used instead of pnpm 9
pnpm@9 not available on host; corepack resolved 11.1.3.
Package.json engine constraint set to >=9 for Docker (Docker uses corepack latest).
Status: closed — deviation accepted.
+12
View File
@@ -0,0 +1,12 @@
# Evals Registry
Format: EVAL-XXX | Date | What evaluated | Method | Result | Anomalies | Action
---
## EVAL-001 | 2026-05-18 | Scaffold build + test pass
Method: pnpm install → pnpm build → pnpm test:run → pnpm typecheck.
Result: all pass, 0 errors.
Anomalies: pnpm version 11 instead of 9 (corepack issue on host).
Action: document in BDR-007, BLK-001.
+11
View File
@@ -0,0 +1,11 @@
# Journal
---
## 2026-05-18
Scaffolded Osteo Report MVP skeleton from approved design spec.
Created 80+ files: schemas, stubs, routes, stores, PDF modules, Docker infra.
Moved Horse.svg + Horse_head.svg to public/species/equine/.
pnpm install + build + typecheck + tests passing.
pnpm 11 used (corepack shim broken on host Node 20.20.0).
+28
View File
@@ -0,0 +1,28 @@
# Learnings Registry
Format: LRN-XXX | Date | Pattern | Context | Future application
---
## LRN-001 | 2026-05-18 | Zod discriminatedUnion for nextAppointment
Report.nextAppointment uses discriminatedUnion('kind', [...]).
Gives precise TS narrowing on .kind; avoids optional union type ambiguity.
Apply: any polymorphic field with a literal discriminant.
---
## LRN-002 | 2026-05-18 | SVG hitbox+visible twin pattern
Two SVG elements share same data-bone-id: hitbox (pointer-events:all, fill:transparent) + visible (pointer-events:none, colored).
Parser groups by data-bone-id → Bone.hitboxEls[], Bone.visibleEls[].
Apply: any SVG-based interactive map needing precise click areas.
---
## LRN-003 | 2026-05-18 | pnpm via corepack shim breaks on older Node 20
corepack shim on Node 20.20.0 throws ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING.
Fix: install pnpm directly via get.pnpm.io/install.sh.
Binary lands at ~/.local/share/pnpm/bin/pnpm.
Apply: CI/dev envs without system pnpm.
+38
View File
@@ -0,0 +1,38 @@
{
"permissions": {
"allow": [
"Bash(pnpm *)",
"Bash(node *)",
"Bash(npx *)",
"Bash(tsc *)",
"Bash(vite *)",
"Bash(vitest *)",
"Bash(eslint *)",
"Bash(prettier *)",
"Bash(docker build *)",
"Bash(docker compose *)",
"Bash(docker ps*)",
"Bash(docker images*)",
"Bash(docker logs *)",
"Bash(git status)",
"Bash(git log *)",
"Bash(git diff *)",
"Bash(git add *)",
"Bash(git commit *)",
"Bash(git mv *)",
"Bash(find *)",
"Bash(ls *)",
"Bash(mkdir *)",
"Bash(mv *)",
"Bash(cp *)"
],
"ask": [
"Bash(docker stop *)",
"Bash(docker rm *)",
"Bash(git push *)",
"Bash(git reset *)",
"Bash(git rebase *)"
],
"deny": []
}
}
+14
View File
@@ -0,0 +1,14 @@
# Implementation plan
Full plan lives at:
- [docs/superpowers/plans/2026-05-18-osteo-report-mvp.md](../../docs/superpowers/plans/2026-05-18-osteo-report-mvp.md)
The full design spec lives at:
- [docs/superpowers/specs/2026-05-18-osteo-report-mvp-design.md](../../docs/superpowers/specs/2026-05-18-osteo-report-mvp-design.md)
Read those two files before executing any task. The plan is structured in
23 phases of bite-sized TDD tasks (2–5 min each), with exact file paths and
complete code blocks per step. Use `superpowers:subagent-driven-development`
to execute it.
+105
View File
@@ -0,0 +1,105 @@
# TODO — Osteo Report MVP
## Status: Scaffold complete — ready for feature implementation
---
## Phase 1 — Skeleton (DONE)
- [x] Directory structure created
- [x] package.json + tsconfig + vite + vitest config
- [x] ESLint 9 flat config + Prettier
- [x] Zod schemas: report, observation, practitioner, animal, pathology
- [x] Species registry + equine manifest
- [x] Zustand store shape (stubs)
- [x] Anatomy types + empty parsers
- [x] PDF module stubs (export, import, attachment, fonts, render/*)
- [x] Component stubs (ui/*, canvas/*, observation/*, report/*, brand/*)
- [x] App router + ConfigProvider
- [x] Docker: Dockerfile + docker-compose + entrypoint.sh + nginx.conf
- [x] Env injection mechanism (window.__APP_CONFIG__)
- [x] Smoke tests pass
- [x] pnpm build passes
---
## Phase 2 — Core domain (next)
### 2a. Lib utilities
- [ ] `src/lib/id.ts` — generateId: already implemented (crypto.randomUUID)
- [ ] `src/lib/dates.ts` — formatDateFr: implement Intl.DateTimeFormat
- [ ] `src/lib/assert.ts` — already implemented
### 2b. Anatomy convention parser
- [ ] `src/anatomy/svgConvention.ts` — parseSvgBones: walk DOM, group by data-bone-id
- [ ] `src/anatomy/svgLoader.ts` — loadSvg: fetch + DOMParser inline
- [ ] Tests: valid SVG fixture → bones map; bad SVG → SvgConventionError
### 2c. Zustand store
- [ ] `src/state/reportStore.ts` — implement all actions
- [ ] `src/state/practitionerCache.ts` — localStorage read/write with Zod validation
- [ ] Tests: initReport, addObservation, updateObservation, hydrateReport
### 2d. Equine pathology DB
- [ ] `src/domain/species/equine/pathologies.ts` — 40-60 entries, source-cited
- [ ] Tests: all entries pass PathologySchema.parse() + have ≥1 source
---
## Phase 3 — UI components
### 3a. UI primitives
- [ ] Button, Card, Dialog, Input, Label, Select, Textarea, Badge, Chip, Toast
### 3b. Canvas
- [ ] AnatomyCanvas: inline SVG, delegated click listener, bone state colorization
- [ ] DetailModal: load detail SVG, click handler with detailSourceId
- [ ] ZoneTooltip: hover tooltip listing all observations owning the bone
### 3c. Observation panel
- [ ] ObservationList + ObservationCard
- [ ] ObservationEditor
- [ ] PathologyPicker + FreeTextPathologyInput
- [ ] VertebraPicker: region tabs + chip grid
- [ ] SeveritySelector
### 3d. Report forms
- [ ] PractitionerForm + AnimalForm (prefill from localStorage cache)
- [ ] ConclusionPanel + NextAppointmentPicker
- [ ] ReportHeader
---
## Phase 4 — Routes
- [ ] HomeRoute: CTAs + session draft card
- [ ] NewReportRoute: form → initReport → navigate /editor
- [ ] EditorRoute: split layout canvas + observation panel + export bar
- [ ] sessionStorage draft sync (osteo:draft)
---
## Phase 5 — PDF
- [ ] fonts.ts: fetch Inter + Fraunces TTF, embedFonts
- [ ] render/header + footer
- [ ] render/svgToPng: canvg → canvas → PNG bytes
- [ ] render/observationPage + conclusionPage
- [ ] attachment.ts: attachReportJson + extractReportJson
- [ ] export.ts + import.ts: full roundtrip
- [ ] Tests: attachment write+extract fixture
---
## Phase 6 — Docker deploy
- [ ] Verify pnpm-lock.yaml committed for --frozen-lockfile
- [ ] docker build smoke test on CI
- [ ] nginx.conf: PORT envsubst verified
---
## Phase 7 — QA
- [ ] Manual browser test: full report → export PDF → re-import
- [ ] Font embedding verified in PDF viewer
- [ ] Brand identity via env vars verified end-to-end