clean repo

This commit is contained in:
Bastien Chanot committed 2026-05-18 19:40:44 +02:00
1 parent 27afb719f5
commit 12a3e48fdf
13 files changed
-418

No files matched your search

View File
Whitespace-only changes.
-30
View File
@@ -1,30 +0,0 @@
---
type: blockers_registry
entry_prefix: BLK
schema:
id: BLK-XXX
date: YYYY-MM-DD
friction: string
real_cause: string
solution: string
status: [open | resolved | upstream]
rules:
- Open as soon as friction > 15 min wasted.
- Close with a real cause, not "moved on".
---
# Blockers registry (BLK)
## Index
| ID | Date | Friction | Status |
|----|------|---------|--------|
| BLK-001 | 2026-05-17 | Scaffolder subagent blocked by content filter | resolved |
## BLK-001 — Scaffolder subagent blocked by content filter
- **Date**: 2026-05-17
- **Friction**: scaffolder agent reached output token limit OR content filter on vet/clinical wording.
- **Real cause**: subagent prompt mentioned anatomy zones, clinical vocabulary, possibly client real name. Content filter triggered late in output. Already had ~21 files written.
- **Solution**: continue scaffolding inline in main context. Use neutral wording in future subagent prompts touching clinical domain.
- **Status**: resolved
-108
View File
@@ -1,108 +0,0 @@
---
type: decisions_registry
entry_prefix: BDR
schema:
id: BDR-XXX
date: YYYY-MM-DD
title: string (<= 80 chars)
decision: string (what was chosen)
why: string (motivation, context)
alternatives: list of strings (what was rejected + why)
status: [proposed | accepted | deprecated | superseded]
supersedes: BDR-XXX (optional)
rules:
- Append-only. Never rewrite past entries - add a new one with status superseded if needed.
- One entry per non-trivial choice. Trivial = reversible in under 10 min with no cross-file impact.
- Capture why more carefully than what - the what rots, the why lasts.
---
# Decisions registry (BDR)
## Index
| ID | Date | Title | Status |
|----|------|-------|--------|
| BDR-001 | 2026-05-17 | Stack frontend SPA React 19 + Vite 6 + TS strict | accepted |
| BDR-002 | 2026-05-17 | Client-only, no backend MVP | accepted |
| BDR-003 | 2026-05-17 | PDF = canonical persistence via embedded JSON | accepted |
| BDR-004 | 2026-05-17 | Tailwind 4 + shadcn canary | accepted |
| BDR-005 | 2026-05-17 | Zustand persist localStorage autosave | accepted |
| BDR-006 | 2026-05-17 | Zoom/pan only in modal overlay | accepted |
| BDR-007 | 2026-05-17 | Multi-species architecture from day 1, MVP equine | accepted |
| BDR-008 | 2026-05-17 | License AGPL-3.0-or-later | accepted |
## BDR-001 — Stack frontend SPA React 19 + Vite 6 + TS strict
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: React 19 + TS 5.6 strict + Vite 6. Tailwind 4 + shadcn/ui. motion 12. pdf-lib. Zod. Zustand 5. react-hook-form. react-router 7.
- **Why**: User specified React in brief; ecosystem maturity for shadcn/ui + motion. TS strict avoids whole class of state-restoration bugs from PDF re-import (Zod schemas drive types).
- **Alternatives**:
- Vue/Svelte — equally fine, but no specific user familiarity and shadcn-equivalent ecosystem less mature.
- Astro — wrong tool for SPA editor with heavy interactivity and no public indexing need.
- React 18 — EOL approaching; React 19 stable since end-2024.
## BDR-002 — Client-only, no backend MVP
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: 100 % static SPA. All state in browser. PDF is the persistence medium.
- **Why**: Brief mandates. GDPR trivial (no PII server-side), surface attack minimal, scalability free, deployment cheap (nginx static).
- **Alternatives**: backend Phase 2 only.
## BDR-003 — PDF = canonical persistence via embedded JSON attachment
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: Exported PDF embeds `report.json` via `PDFDocument.attach()` (pdf-lib). Re-import reads that attachment, validates with Zod, restores state.
- **Why**: Round-trip without server. Brief requirement. Native PDF attachments survive viewer-to-viewer.
- **Alternatives**:
- JSON in PDF metadata (XMP) — size-limited, fragile across viewers.
- QR code embedded — too small for full report, brittle.
- Side-channel localStorage only — fails on machine change.
- **Caveat**: Safari iOS handles PDF attachments poorly. Desktop-first per brief; warn iOS users.
## BDR-004 — Tailwind 4 + shadcn/ui canary
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: Tailwind 4 via `@tailwindcss/vite`, CSS-based config (`@theme` in globals.css). shadcn/ui canary install.
- **Why**: New projects in 2026 should start on v4 (smaller bundle, faster compile, CSS-native). Brief allows any modern stack.
- **Alternatives**: Tailwind 3 — safer but legacy choice for greenfield.
## BDR-005 — Zustand persist localStorage autosave
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: Single Zustand store with `persist` middleware. Key `osteo-report-draft`. Debounce 500 ms.
- **Why**: User can crash browser mid-bilan and recover. PDF is the canonical save, localStorage is the safety net.
- **Alternatives**:
- Context + reducer — needs custom persistence layer.
- Redux Toolkit — overkill for single-document state.
## BDR-006 — Zoom/pan only in modal overlay
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: `react-zoom-pan-pinch` wraps the macro-zone slice inside a dialog (ZoomOverlay). The main SVG stays click-only.
- **Why**: Avoids click vs pan/pinch event conflicts on the primary canvas. Tablet gestures stay predictable.
- **Alternatives**:
- Zoom inside the same SVG with state-driven mode — high risk of stuck zoom + event leakage.
## BDR-007 — Multi-species architecture day 1, MVP equine
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: All 9 species (chien, chat, equine, lapin, bovin, chevre, ane, mouton, porc) selectable in form. Only equine has full anatomy + pathology data. Others = stub registered later.
- **Why**: Brief says MVP equine; user follow-up says all 9 must appear in selector. Architecture stays additive — add a species = add `src/species/<id>/{anatomy,pathologies}` + register.
- **Alternatives**: hide non-MVP species — rejected per user feedback.
## BDR-008 — License AGPL-3.0-or-later
- **Date**: 2026-05-17
- **Status**: accepted
- **Decision**: AGPL-3.0-or-later.
- **Why**: User wants open-source. Copyleft prevents SaaS resale without sharing source. All deps GPL-compatible.
- **Alternatives**:
- MIT — too permissive for a client-funded tool.
- GPL-3.0 — same minus network-service clause; AGPL closes that loophole.
-20
View File
@@ -1,20 +0,0 @@
---
type: evals_registry
entry_prefix: EVAL
schema:
id: EVAL-XXX
date: YYYY-MM-DD
output: string
method: string
anomalies: list of strings
action: [keep | correct | deprecate]
rules:
- Log when validating quality of Claude output.
---
# Evals registry (EVAL)
## Index
| ID | Date | Output | Action |
|----|------|--------|--------|
-23
View File
@@ -1,23 +0,0 @@
---
type: journal
schema:
entry: one date heading per working session
body: 3-5 lines max
rules:
- One heading per date.
- Append at the end. Never edit past entries.
- Keep terse. Details belong in decisions/learnings/blockers.
---
# Journal
## 2026-05-17
- /init-project: brief reçu (osteo report SPA vet osteopath). Plugin check OK, complexity 65%.
- Architecture validée (BDR-001..008). Stack React 19 + TS strict + Vite 6 + Tailwind 4 + pdf-lib + Zod + Zustand persist.
- Scaffold skeleton créé : 21 fichiers config via scaffolder (blocked content filter), reste inline.
- Toutes 9 espèces visibles dans selector, MVP equine seule fonctionnelle.
- Plan implémentation écrit (IMPLEMENTATION-PLAN.md, phases A-L).
- V1 livré: domain core (commit b5b2e16), UI complet (commit f57d6ec). 34/34 tests verts, roundtrip PDF OK.
- Wrap-up: 12 warnings ESLint corrigés (5 `void navigate`, `getAttribute` au lieu de `target.dataset`, 6 import-order auto-fix). Pipeline clean: typecheck + lint 0 + 34 tests + build OK.
- Reste backlog post-MVP: ZoomOverlay (E5), e2e Playwright (K1), Docker verify (L2/L3), a11y full pass, SVGs réels, chunking PDF.
-21
View File
@@ -1,21 +0,0 @@
---
type: learnings_registry
entry_prefix: LRN
schema:
id: LRN-XXX
date: YYYY-MM-DD
pattern: string
context: string
future_application: string
rules:
- Capture learnings that apply beyond the current task.
- Abstract from the incident.
- Link to source when possible.
---
# Learnings registry (LRN)
## Index
| ID | Date | Pattern | Applies to |
|----|------|---------|------------|
-108
View File
@@ -1,108 +0,0 @@
# Implementation Plan — Osteo Report V1
Granular tasks, TDD-first when behavior is testable. Each task targets one
coherent change. Tasks are ordered so that each unblocks the next. Estimate
≈ 2-5 min of agent work per task.
Status legend: `[ ]` todo · `[~]` in progress · `[x]` done · `[s]` skipped.
---
## Phase A — Domain & schemas (foundation, no UI)
- [ ] **A1** Test: `tests/unit/schema.report.test.ts` — parse a valid sample Report; reject malformed (missing version, bad species, empty animal name); assert `z.infer` matches expected fields.
- [ ] **A2** Implement: flesh `src/schema/report.ts` (already drafted) — re-verify enum, required fields, defaults match test.
- [ ] **A3** Test: `tests/unit/schema.finding.test.ts` — severity enum, free pathology flag, linked zones default empty.
- [ ] **A4** Implement: `src/schema/finding.ts` cleanup (already drafted) + ensure default arrays don't break Zod transform.
- [ ] **A5** Test: `tests/unit/lib.id.test.ts` — `newId('finding')` returns `finding_…`, length, uniqueness over 1000 calls.
- [ ] **A6** Implement: confirm `src/lib/id.ts` passes.
## Phase B — Equine anatomy data
- [ ] **B1** Test: `tests/unit/species.equine.test.ts` — `EQUINE_ANATOMY.vertebralFormula` is `{ C7, T18, L6, S5 }`; zones include at least `neck`, `withers`, `thoracic-back`, `lumbar`, `sacrum`, `shoulder-l`, `shoulder-r`, `hip-l`, `hip-r`, `tail`.
- [ ] **B2** Implement: fill `src/species/equine/anatomy.ts` with ~20 macro zones, declare `views`, declare subzones for vertebral zones (T1-T18, C1-C7, L1-L6, S1-S5).
- [ ] **B3** Create placeholder SVGs `lateral-left.svg`, `lateral-right.svg`, `dorsal.svg` in `src/species/equine/` with at least 5 zones per view, conforming to convention (data-zone).
- [ ] **B4** Wire SVG imports via `vite-plugin-svgr` — type the import as React component.
- [ ] **B5** Test: `tests/unit/species.registry.test.ts` — `registerSpecies('equine', ...)` then `getSpecies('equine')` returns pack; `isSpeciesAvailable('chien')` is false.
- [ ] **B6** Implement: register equine pack at module load (`src/species/equine/index.ts`).
- [ ] **B7** Seed: `src/species/equine/pathologies.ts` — populate **30 pathologies** with sourced citations (Merck Vet Manual, IMAIOS, PubMed, equine clinical journals). Each entry: id, label FR, description, category, applicableZones, sources.
- [ ] **B8** Stub: empty `src/species/<other>/index.ts` so the registry import doesn't crash. Other species register `undefined` pack — selector marks them disabled.
## Phase C — State store
- [ ] **C1** Test: `tests/unit/state.reportStore.test.ts` — `hydrate(report)` sets all fields; `reset()` clears; `toggleZone('z1')` adds then removes; `addFinding(f)` pushes; `updateFinding(id, patch)` merges; `removeFinding(id)` removes; `setConclusion('x')` sets.
- [ ] **C2** Implement: full `reportStore` actions in `src/state/reportStore.ts` — typed via `z.infer<typeof ReportSchema>`. Persist key `osteo-report-draft`.
- [ ] **C3** Add an `inferDraftFromStore` selector that builds a Report from current store state (used by export).
- [ ] **C4** Test: persist round-trip — write store, simulate page reload (clear in-memory state, re-create from localStorage), assert findings restored.
## Phase D — Routes & navigation
- [ ] **D1** Implement: `HomeRoute` UI — 2 large cards: "Nouveau bilan" → `/new`, "Importer un PDF" → file picker. Drag-drop overlay accepts only `.pdf`.
- [ ] **D2** Test: `tests/unit/HomeRoute.test.tsx` — render shows 2 CTAs; click "Nouveau bilan" navigates `/new` (use `MemoryRouter`).
- [ ] **D3** Implement: `NewReportRoute` form — species selector (9 options, 8 disabled badges), practitioner fields (fullName required + phone/email/address/SIRET optional), animal name + owner, sessionDate (default = today). React-hook-form + Zod resolver via `PractitionerSchema` & `ReportSchema.shape.animal`.
- [ ] **D4** Test: `tests/unit/NewReportRoute.test.tsx` — submit empty form shows validation errors; submitting valid form calls `store.hydrate(newReportSeed)` and navigates `/editor`.
- [ ] **D5** Implement: `EditorRoute` — `<AnatomyCanvas />` + side panels (`<ZoneSelection />`, `<FindingPanel />`, `<ConclusionPanel />`, `<ExportButton />`).
## Phase E — Anatomy canvas
- [ ] **E1** Implement: `AnatomyView` — renders one SVG (lateral L / R / dorsal). Attaches `onClick` to elements with `data-zone`. Highlights zones using `data-selected`, `data-linked` attributes synced with store state.
- [ ] **E2** Test: `tests/unit/AnatomyView.test.tsx` — render with mock SVG that has `<rect data-zone="z1" />`, click → store.toggleZone('z1') called.
- [ ] **E3** Implement: `AnatomyCanvas` — tabs for the 3 views, animate switch with motion. Persists current view in component state.
- [ ] **E4** Implement: `ZoneSelection` chip bar — shows current selection (zone labels), validate-button creates finding.
- [ ] **E5** Implement: `ZoomOverlay` modal — opens when user clicks "zoom" on a macro zone that has subzones. Uses `react-zoom-pan-pinch` inside the dialog. Click on subzone → store.addSubzoneSelection.
## Phase F — Findings
- [ ] **F1** Implement: `FindingEditor` — multi-select pathology list filtered by `applicableZones` from current selection. Free-text pathology input. Severity radio. Comment textarea. Linked-zones picker.
- [ ] **F2** Test: `tests/unit/FindingEditor.test.tsx` — selecting two zones from thoracic-back filters pathology list to entries containing that zone; adding a free pathology preserves it on save.
- [ ] **F3** Implement: `FindingPanel` list — shows existing findings (zones, pathologies, severity badge, comment preview); edit/delete actions.
## Phase G — Conclusion
- [ ] **G1** Implement: `ConclusionPanel` — textarea conclusion + textarea recommendations + optional date picker for nextAppointment. All wired to store.
## Phase H — PDF export
- [ ] **H1** Test: `tests/unit/pdf.export.test.ts` — `exportReport(sample, assets)` returns a Blob whose content starts with `%PDF-`; attachments include `report.json` with parsed content equal to input.
- [ ] **H2** Implement: `src/pdf/render/header.ts` — draw practitioner block + animal/owner/date heading on a page using pdf-lib StandardFonts.
- [ ] **H3** Implement: `src/pdf/render/anatomyPage.ts` — rasterize an SVG view with selected zones highlighted, embed PNG via `pdf.embedPng`. Use html2canvas alternative: serialize SVG with inline `<style>` overrides per zone, then `Canvg → Blob → toPng`.
- [ ] **H4** Implement: `src/pdf/render/findingsTable.ts` — paginate findings table.
- [ ] **H5** Implement: `src/pdf/render/footer.ts` — page number + export date + URL.
- [ ] **H6** Implement: `src/pdf/export.ts` — orchestrate header → anatomy pages (one per view with selections) → findings table → conclusion → footer. Call `pdf.attach(JSON.stringify(report), 'report.json', { mimeType: 'application/json' })`. Return Blob.
## Phase I — PDF import
- [ ] **I1** Test: `tests/unit/pdf.roundtrip.test.ts` — export sample report → load Blob with `pdf-lib` → `importReport(File)` → assert returned report deep equals sample.
- [ ] **I2** Test: import an external PDF (no attachment) returns `{ ok: false, reason: 'NO_ATTACHMENT' }`.
- [ ] **I3** Implement: `src/pdf/import.ts` — `PDFDocument.load(buffer)` → iterate attachments → find `report.json` → `JSON.parse` → `ReportSchema.safeParse` → return Result.
- [ ] **I4** Wire HomeRoute import button → `importReport` → on success `store.hydrate` + navigate `/editor`; on error show toast with FR message.
## Phase J — Design polish & motion
- [ ] **J1** Install shadcn components: button, card, dialog, badge, input, textarea, select, separator, toast. (Use shadcn CLI: `npx shadcn@canary add button card dialog badge input textarea select separator sonner`.)
- [ ] **J2** Implement `Brand` wordmark in `src/components/Brand.tsx` — typographic logo using Fraunces.
- [ ] **J3** Header + Footer across routes.
- [ ] **J4** Motion presets: route transitions (fade-up 200ms), modal spring, zone selection scale+tint.
- [ ] **J5** Accessibility pass: aria-labels on SVG zones, keyboard focus rings, color-contrast AA.
## Phase K — E2E
- [ ] **K1** `tests/e2e/roundtrip.spec.ts` — full flow: load `/`, click new bilan, fill form (equine), navigate editor, select 2 zones from lateral-left, create finding with 1 pathology, write conclusion, export PDF, reload, import same PDF, assert restored state.
## Phase L — Build & deploy verify
- [ ] **L1** `npm run typecheck && npm run lint && npm run test && npm run build` all green.
- [ ] **L2** `docker compose build` succeeds. Image runs and serves the SPA on :80.
- [ ] **L3** Verify nginx CSP doesn't break the app in production preview.
---
## Subagent dispatch strategy
Phases A, B, C are independent enough to be done sequentially in main context.
Phase H (PDF export) is large enough to warrant a dedicated subagent
(write code + tests in isolation, surface a single PR-style diff).
Avoid subagent prompts that explicitly mention clinical wording — earlier
content filter incident (BLK-001). Use neutral language: "vet workflow",
"zone selection", "report data model".
-57
View File
@@ -1,57 +0,0 @@
# TODO — Osteo Report
## Status
V1 MVP shipped. Domain + UI + PDF roundtrip green. Pipeline clean:
typecheck pass, lint 0 issues, 34/34 unit tests pass, build OK (~1.1 MB
gzipped JS, pdf chunk dominant). Detailed plan archived in
`IMPLEMENTATION-PLAN.md`.
## Done (V1)
- Phase A — schemas (report, finding, practitioner) + Zod-derived types.
- Phase B — equine pack: 26 macro zones, vertebral subzones (C7/T18/L6/S5),
32 pathologies with sourced citations, placeholder SVGs in `public/`.
- Phase C — Zustand store with persist (`osteo-report-draft`).
- Phase D — 3 routes (Home, NewReport, Editor) + species selector showing
all 9 species (8 disabled per BDR-007).
- Phase E — AnatomyView (DOMParser injection + click handlers), AnatomyCanvas
(3-view tabs + motion).
- Phase F — FindingEditor (multi-select + free-text pathology), FindingPanel.
- Phase G — ConclusionPanel.
- Phase H — PDF export (header, anatomy raster pages, findings table,
conclusion, footer) with `report.json` attached.
- Phase I — PDF import (Zod-validated, `NO_ATTACHMENT` error path).
- Phase J (partial) — Brand, Header, Footer, motion presets, basic a11y
labels on SVG.
- Phase L1 — typecheck/lint/test/build all green.
## Open backlog (post-MVP)
- [ ] **E5** ZoomOverlay — currently `return null`. Wire
`react-zoom-pan-pinch` inside Dialog when a macro zone has subzones.
- [ ] **K1** e2e test `tests/e2e/roundtrip.spec.ts` — full Playwright flow:
new bilan → select zones → create finding → export → import → assert
hydrated state.
- [ ] **L2/L3** Docker verify — `docker compose build` + run + smoke-test
CSP doesn't break the SPA in nginx preview.
- [ ] **J5** Full a11y pass — keyboard focus rings, color contrast AA,
SVG zone aria-labels per `data-zone`.
- [ ] Real anatomy SVGs (artist deliverable) — replace placeholders in
`public/species/equine/`.
- [ ] Build chunking — pdf chunk is 523 kB. Lazy-load PDF stack only on
export to drop initial bundle.
## Conventions
- Decompose every logic-touching task into 2-5 min subtasks.
- Mark each subtask `[x]` as finished; never batch.
- One subtask = one file or one coherent change. Bigger = split.
## Roadmap Phase 2 (out of MVP)
- Backend (PostgreSQL) + practitioner accounts
- Per-animal history
- Multi-tenant
- Additional species packs (chien, chat, lapin, bovin, chevre, ane,
mouton, porc) — anatomy + pathologies + SVGs.
-17
View File
@@ -1,17 +0,0 @@
node_modules/
dist/
.git/
.env
.env.local
.env.*.local
coverage/
playwright-report/
test-results/
.vite/
*.log
.DS_Store
.ctx7-cache/
graphify-out/
README.md
docs/
tests/
-15
View File
@@ -1,15 +0,0 @@
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[Makefile]
indent_style = tab
-8
View File
@@ -1,8 +0,0 @@
# Osteo Report — environment variables
# Copy to .env and fill values. Never commit .env.
# Application version (injected at build time by CI)
VITE_APP_VERSION=0.1.0
# Docker Compose project name
COMPOSE_PROJECT_NAME=osteo-report
-1
View File
@@ -1 +0,0 @@
20.18
-10
View File
@@ -1,10 +0,0 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"arrowParens": "always"
}