diff --git a/.claude/audits/.gitkeep b/.claude/audits/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md deleted file mode 100644 index c04b1d64..00000000 --- a/.claude/memory/blockers.md +++ /dev/null @@ -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 diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md deleted file mode 100644 index 8940892b..00000000 --- a/.claude/memory/decisions.md +++ /dev/null @@ -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//{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. diff --git a/.claude/memory/evals.md b/.claude/memory/evals.md deleted file mode 100644 index 77c89180..00000000 --- a/.claude/memory/evals.md +++ /dev/null @@ -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 | -|----|------|--------|--------| diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md deleted file mode 100644 index c63550c3..00000000 --- a/.claude/memory/journal.md +++ /dev/null @@ -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. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md deleted file mode 100644 index ed4c0571..00000000 --- a/.claude/memory/learnings.md +++ /dev/null @@ -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 | -|----|------|---------|------------| diff --git a/.claude/tasks/IMPLEMENTATION-PLAN.md b/.claude/tasks/IMPLEMENTATION-PLAN.md deleted file mode 100644 index 2eae6a10..00000000 --- a/.claude/tasks/IMPLEMENTATION-PLAN.md +++ /dev/null @@ -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//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`. 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` — `` + side panels (``, ``, ``, ``). - -## 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 ``, 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 `