From 8673475293f607e786672b3ae9aadc75b3356989 Mon Sep 17 00:00:00 2001 From: bchanot Date: Thu, 8 Oct 2026 21:51:13 +0200 Subject: [PATCH] chore(workspace): move the app to apps/app under a pnpm workspace (step 2) 144 files moved with git mv (pure renames). Root package.json delegates dev/typecheck/test:run/lint/build to the packages; Node 24 LTS and pnpm 10.13.1 pinned (.nvmrc, .node-version, engines, packageManager, root devDependency, engine-strict). Dockerfile builds @faunosteo/app on node:24-alpine and copies apps/app/dist; nginx and runtime config unchanged. CI workflow for Gitea Actions. packages/ reserved (README only). Docs synced: WORKSPACE.md, CLAUDE.md, README, DEPLOY, CHANGELOG, plan. 271/271 tests, typecheck, lint, build green from the root. --- .claude/tasks/TODO.md | 3 +- .claudeignore | 4 +- .dockerignore | 7 ++ .gitea/workflows/ci.yml | 32 +++++ .node-version | 1 + .npmrc | 2 + .nvmrc | 2 +- CHANGELOG.md | 10 ++ CLAUDE.md | 48 +++---- DEPLOY.md | 7 +- Dockerfile | 17 +-- README.md | 19 +-- eslint.config.js => apps/app/eslint.config.js | 0 index.html => apps/app/index.html | 0 apps/app/package.json | 45 +++++++ .../app/public}/Paws_in_harmony.svg | 0 .../app/public}/apple-touch-icon.png | Bin .../assets/faunosteo-horizontal-com-512.png | Bin .../assets/faunosteo_logo_horizontal-512.png | Bin .../app/public}/brand/zenquality-logo-fr.png | Bin {public => apps/app/public}/env.js | 0 {public => apps/app/public}/favicon.svg | 0 .../app/public}/logo-horizontal.svg | 0 .../app/public}/pathology-editor.html | 0 .../app/public}/species/equine/Horse.svg | 0 .../app/public}/species/equine/Horse_head.svg | 0 .../public}/species/equine/pathologies.json | 0 .../app/scripts}/scaffold-species.mjs | 0 {src => apps/app/src}/anatomy/labels.ts | 0 .../app/src}/anatomy/svgConvention.ts | 0 {src => apps/app/src}/anatomy/svgLoader.ts | 0 {src => apps/app/src}/anatomy/types.ts | 0 {src => apps/app/src}/app/App.tsx | 0 .../app/src}/app/providers/ConfigProvider.tsx | 0 .../app/src}/app/routes/EditorRoute.tsx | 0 .../app/src}/app/routes/EditorsRoute.tsx | 0 .../app/src}/app/routes/HomeRoute.tsx | 0 .../app/src}/app/routes/NewReportRoute.tsx | 0 .../app/src}/app/routes/NotFoundRoute.tsx | 0 .../app/src}/app/routes/SvgEditorRoute.tsx | 0 .../app/src}/components/brand/AppHeader.tsx | 0 .../app/src}/components/brand/Brand.tsx | 0 .../app/src}/components/brand/Footer.tsx | 0 .../components/brand/LanguageSwitcher.tsx | 0 .../src}/components/canvas/AnatomyCanvas.tsx | 0 .../src}/components/canvas/DetailModal.tsx | 0 .../observation/FindingsTreePicker.tsx | 0 .../observation/FreeTextFindingInput.tsx | 0 .../observation/LateralityPicker.tsx | 0 .../observation/ObservationCard.tsx | 0 .../observation/ObservationList.tsx | 0 .../observation/SeveritySelector.tsx | 0 .../components/observation/VertebraPicker.tsx | 0 .../app/src}/components/report/AnimalForm.tsx | 0 .../components/report/ConclusionPanel.tsx | 0 .../report/NextAppointmentPicker.tsx | 0 .../components/report/PractitionerForm.tsx | 0 .../src}/components/report/ReportHeader.tsx | 0 {src => apps/app/src}/components/ui/Badge.tsx | 0 .../app/src}/components/ui/Button.tsx | 0 {src => apps/app/src}/components/ui/Card.tsx | 0 {src => apps/app/src}/components/ui/Chip.tsx | 0 .../app/src}/components/ui/Dialog.tsx | 0 {src => apps/app/src}/components/ui/Input.tsx | 0 {src => apps/app/src}/components/ui/Label.tsx | 0 .../app/src}/components/ui/Select.tsx | 0 .../app/src}/components/ui/Textarea.tsx | 0 {src => apps/app/src}/config/env.ts | 0 {src => apps/app/src}/domain/schema/animal.ts | 0 .../app/src}/domain/schema/findings.ts | 0 .../app/src}/domain/schema/observation.ts | 0 .../app/src}/domain/schema/practitioner.ts | 0 {src => apps/app/src}/domain/schema/report.ts | 0 .../app/src}/domain/species/equine/index.ts | 0 .../domain/species/equine/pathologies.json | 0 .../src}/domain/species/equine/pathologies.ts | 0 .../src}/domain/species/equine/vertebrae.ts | 0 .../app/src}/domain/species/registry.ts | 0 {src => apps/app/src}/domain/species/types.ts | 0 {src => apps/app/src}/i18n/en.ts | 0 {src => apps/app/src}/i18n/fr.ts | 0 {src => apps/app/src}/i18n/index.ts | 0 {src => apps/app/src}/i18n/pickLocaleLabel.ts | 0 {src => apps/app/src}/i18n/types.ts | 0 {src => apps/app/src}/i18n/useT.ts | 0 {src => apps/app/src}/lib/assert.ts | 0 {src => apps/app/src}/lib/dates.ts | 0 {src => apps/app/src}/lib/id.ts | 0 {src => apps/app/src}/lib/spineZones.ts | 0 {src => apps/app/src}/lib/zoneMatch.ts | 0 {src => apps/app/src}/main.tsx | 0 {src => apps/app/src}/pdf/attachment.ts | 0 {src => apps/app/src}/pdf/export.ts | 0 {src => apps/app/src}/pdf/fonts.ts | 0 {src => apps/app/src}/pdf/import.ts | 0 .../app/src}/pdf/render/conclusionPage.ts | 0 {src => apps/app/src}/pdf/render/constants.ts | 0 {src => apps/app/src}/pdf/render/footer.ts | 0 {src => apps/app/src}/pdf/render/header.ts | 0 .../app/src}/pdf/render/linkAnnotation.ts | 0 {src => apps/app/src}/pdf/render/logo.ts | 0 .../app/src}/pdf/render/observationPage.ts | 0 {src => apps/app/src}/pdf/render/svgToPng.ts | 0 {src => apps/app/src}/pdf/render/text.ts | 0 {src => apps/app/src}/state/localeStore.ts | 0 .../app/src}/state/practitionerCache.ts | 0 {src => apps/app/src}/state/reportStore.ts | 0 {src => apps/app/src}/styles/index.css | 0 {src => apps/app/src}/styles/svg-editor.css | 0 {src => apps/app/src}/styles/tokens.css | 0 {tests => apps/app/tests}/fixtures/README.md | 0 .../app/tests}/fixtures/report-v2.full.json | 0 .../tests}/fixtures/report-v2.minimal.json | 0 {tests => apps/app/tests}/setup.ts | 0 .../app/tests}/unit/anatomy.horse.test.ts | 0 .../tests}/unit/anatomy.svgConvention.test.ts | 0 .../app/tests}/unit/anatomy.svgLoader.test.ts | 0 .../app/tests}/unit/char.catalog.test.ts | 0 .../app/tests}/unit/char.clickChain.test.tsx | 0 .../app/tests}/unit/char.i18nSpecies.test.tsx | 0 .../tests}/unit/char.pathologyEditor.test.ts | 0 .../app/tests}/unit/char.pdfFull.test.ts | 0 .../unit/char.schemaPersistence.test.ts | 0 .../tests}/unit/char.svgCatalogLink.test.ts | 0 .../unit/components.AnatomyCanvas.test.tsx | 0 .../app/tests}/unit/components.Brand.test.tsx | 0 .../components.FindingsTreePicker.test.tsx | 0 .../unit/components.LanguageSwitcher.test.tsx | 0 .../unit/components.VertebraPicker.test.tsx | 0 .../app/tests}/unit/i18n.dicts.test.ts | 0 .../app/tests}/unit/i18n.useT.test.tsx | 0 .../app/tests}/unit/lib.dates.test.ts | 0 {tests => apps/app/tests}/unit/lib.id.test.ts | 0 .../app/tests}/unit/lib.spineZones.test.ts | 0 .../app/tests}/unit/lib.zoneMatch.test.ts | 0 .../unit/pdf.attachment.inflate.test.ts | 0 .../app/tests}/unit/pdf.attachment.test.ts | 0 .../app/tests}/unit/pdf.roundtrip.test.ts | 0 .../app/tests}/unit/pdf.svgToPng.test.ts | 0 .../app/tests}/unit/pdf.zoneLabels.test.ts | 0 .../tests}/unit/schema.observation.test.ts | 0 .../app/tests}/unit/schema.report.test.ts | 0 {tests => apps/app/tests}/unit/smoke.test.ts | 0 .../unit/species.equineFindings.test.ts | 0 .../app/tests}/unit/species.registry.test.ts | 0 .../app/tests}/unit/state.draftMirror.test.ts | 0 .../app/tests}/unit/state.localeStore.test.ts | 0 .../unit/state.practitionerCache.test.ts | 0 .../unit/state.reportStore.restore.test.ts | 0 .../unit/state.reportStore.setters.test.ts | 0 .../app/tests}/unit/state.reportStore.test.ts | 0 .../app/tests}/unit/ui.Button.test.tsx | 0 .../app/tests}/unit/ui.Dialog.test.tsx | 0 tsconfig.json => apps/app/tsconfig.json | 0 .../app/tsconfig.node.json | 0 vite.config.ts => apps/app/vite.config.ts | 0 vitest.config.ts => apps/app/vitest.config.ts | 0 docs/development/IMPLEMENTATION_PLAN.md | 28 +++-- docs/development/REPOSITORY_MIGRATION_MAP.md | 2 +- docs/development/WORKSPACE.md | 117 ++++++++++++++++++ package.json | 53 +++----- packages/README.md | 20 +++ pnpm-lock.yaml | 47 +++---- pnpm-workspace.yaml | 12 +- 164 files changed, 348 insertions(+), 128 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .node-version rename eslint.config.js => apps/app/eslint.config.js (100%) rename index.html => apps/app/index.html (100%) create mode 100644 apps/app/package.json rename {public => apps/app/public}/Paws_in_harmony.svg (100%) rename {public => apps/app/public}/apple-touch-icon.png (100%) rename {public => apps/app/public}/assets/faunosteo-horizontal-com-512.png (100%) rename {public => apps/app/public}/assets/faunosteo_logo_horizontal-512.png (100%) rename {public => apps/app/public}/brand/zenquality-logo-fr.png (100%) rename {public => apps/app/public}/env.js (100%) rename {public => apps/app/public}/favicon.svg (100%) rename {public => apps/app/public}/logo-horizontal.svg (100%) rename {public => apps/app/public}/pathology-editor.html (100%) rename {public => apps/app/public}/species/equine/Horse.svg (100%) rename {public => apps/app/public}/species/equine/Horse_head.svg (100%) rename {public => apps/app/public}/species/equine/pathologies.json (100%) rename {scripts => apps/app/scripts}/scaffold-species.mjs (100%) rename {src => apps/app/src}/anatomy/labels.ts (100%) rename {src => apps/app/src}/anatomy/svgConvention.ts (100%) rename {src => apps/app/src}/anatomy/svgLoader.ts (100%) rename {src => apps/app/src}/anatomy/types.ts (100%) rename {src => apps/app/src}/app/App.tsx (100%) rename {src => apps/app/src}/app/providers/ConfigProvider.tsx (100%) rename {src => apps/app/src}/app/routes/EditorRoute.tsx (100%) rename {src => apps/app/src}/app/routes/EditorsRoute.tsx (100%) rename {src => apps/app/src}/app/routes/HomeRoute.tsx (100%) rename {src => apps/app/src}/app/routes/NewReportRoute.tsx (100%) rename {src => apps/app/src}/app/routes/NotFoundRoute.tsx (100%) rename {src => apps/app/src}/app/routes/SvgEditorRoute.tsx (100%) rename {src => apps/app/src}/components/brand/AppHeader.tsx (100%) rename {src => apps/app/src}/components/brand/Brand.tsx (100%) rename {src => apps/app/src}/components/brand/Footer.tsx (100%) rename {src => apps/app/src}/components/brand/LanguageSwitcher.tsx (100%) rename {src => apps/app/src}/components/canvas/AnatomyCanvas.tsx (100%) rename {src => apps/app/src}/components/canvas/DetailModal.tsx (100%) rename {src => apps/app/src}/components/observation/FindingsTreePicker.tsx (100%) rename {src => apps/app/src}/components/observation/FreeTextFindingInput.tsx (100%) rename {src => apps/app/src}/components/observation/LateralityPicker.tsx (100%) rename {src => apps/app/src}/components/observation/ObservationCard.tsx (100%) rename {src => apps/app/src}/components/observation/ObservationList.tsx (100%) rename {src => apps/app/src}/components/observation/SeveritySelector.tsx (100%) rename {src => apps/app/src}/components/observation/VertebraPicker.tsx (100%) rename {src => apps/app/src}/components/report/AnimalForm.tsx (100%) rename {src => apps/app/src}/components/report/ConclusionPanel.tsx (100%) rename {src => apps/app/src}/components/report/NextAppointmentPicker.tsx (100%) rename {src => apps/app/src}/components/report/PractitionerForm.tsx (100%) rename {src => apps/app/src}/components/report/ReportHeader.tsx (100%) rename {src => apps/app/src}/components/ui/Badge.tsx (100%) rename {src => apps/app/src}/components/ui/Button.tsx (100%) rename {src => apps/app/src}/components/ui/Card.tsx (100%) rename {src => apps/app/src}/components/ui/Chip.tsx (100%) rename {src => apps/app/src}/components/ui/Dialog.tsx (100%) rename {src => apps/app/src}/components/ui/Input.tsx (100%) rename {src => apps/app/src}/components/ui/Label.tsx (100%) rename {src => apps/app/src}/components/ui/Select.tsx (100%) rename {src => apps/app/src}/components/ui/Textarea.tsx (100%) rename {src => apps/app/src}/config/env.ts (100%) rename {src => apps/app/src}/domain/schema/animal.ts (100%) rename {src => apps/app/src}/domain/schema/findings.ts (100%) rename {src => apps/app/src}/domain/schema/observation.ts (100%) rename {src => apps/app/src}/domain/schema/practitioner.ts (100%) rename {src => apps/app/src}/domain/schema/report.ts (100%) rename {src => apps/app/src}/domain/species/equine/index.ts (100%) rename {src => apps/app/src}/domain/species/equine/pathologies.json (100%) rename {src => apps/app/src}/domain/species/equine/pathologies.ts (100%) rename {src => apps/app/src}/domain/species/equine/vertebrae.ts (100%) rename {src => apps/app/src}/domain/species/registry.ts (100%) rename {src => apps/app/src}/domain/species/types.ts (100%) rename {src => apps/app/src}/i18n/en.ts (100%) rename {src => apps/app/src}/i18n/fr.ts (100%) rename {src => apps/app/src}/i18n/index.ts (100%) rename {src => apps/app/src}/i18n/pickLocaleLabel.ts (100%) rename {src => apps/app/src}/i18n/types.ts (100%) rename {src => apps/app/src}/i18n/useT.ts (100%) rename {src => apps/app/src}/lib/assert.ts (100%) rename {src => apps/app/src}/lib/dates.ts (100%) rename {src => apps/app/src}/lib/id.ts (100%) rename {src => apps/app/src}/lib/spineZones.ts (100%) rename {src => apps/app/src}/lib/zoneMatch.ts (100%) rename {src => apps/app/src}/main.tsx (100%) rename {src => apps/app/src}/pdf/attachment.ts (100%) rename {src => apps/app/src}/pdf/export.ts (100%) rename {src => apps/app/src}/pdf/fonts.ts (100%) rename {src => apps/app/src}/pdf/import.ts (100%) rename {src => apps/app/src}/pdf/render/conclusionPage.ts (100%) rename {src => apps/app/src}/pdf/render/constants.ts (100%) rename {src => apps/app/src}/pdf/render/footer.ts (100%) rename {src => apps/app/src}/pdf/render/header.ts (100%) rename {src => apps/app/src}/pdf/render/linkAnnotation.ts (100%) rename {src => apps/app/src}/pdf/render/logo.ts (100%) rename {src => apps/app/src}/pdf/render/observationPage.ts (100%) rename {src => apps/app/src}/pdf/render/svgToPng.ts (100%) rename {src => apps/app/src}/pdf/render/text.ts (100%) rename {src => apps/app/src}/state/localeStore.ts (100%) rename {src => apps/app/src}/state/practitionerCache.ts (100%) rename {src => apps/app/src}/state/reportStore.ts (100%) rename {src => apps/app/src}/styles/index.css (100%) rename {src => apps/app/src}/styles/svg-editor.css (100%) rename {src => apps/app/src}/styles/tokens.css (100%) rename {tests => apps/app/tests}/fixtures/README.md (100%) rename {tests => apps/app/tests}/fixtures/report-v2.full.json (100%) rename {tests => apps/app/tests}/fixtures/report-v2.minimal.json (100%) rename {tests => apps/app/tests}/setup.ts (100%) rename {tests => apps/app/tests}/unit/anatomy.horse.test.ts (100%) rename {tests => apps/app/tests}/unit/anatomy.svgConvention.test.ts (100%) rename {tests => apps/app/tests}/unit/anatomy.svgLoader.test.ts (100%) rename {tests => apps/app/tests}/unit/char.catalog.test.ts (100%) rename {tests => apps/app/tests}/unit/char.clickChain.test.tsx (100%) rename {tests => apps/app/tests}/unit/char.i18nSpecies.test.tsx (100%) rename {tests => apps/app/tests}/unit/char.pathologyEditor.test.ts (100%) rename {tests => apps/app/tests}/unit/char.pdfFull.test.ts (100%) rename {tests => apps/app/tests}/unit/char.schemaPersistence.test.ts (100%) rename {tests => apps/app/tests}/unit/char.svgCatalogLink.test.ts (100%) rename {tests => apps/app/tests}/unit/components.AnatomyCanvas.test.tsx (100%) rename {tests => apps/app/tests}/unit/components.Brand.test.tsx (100%) rename {tests => apps/app/tests}/unit/components.FindingsTreePicker.test.tsx (100%) rename {tests => apps/app/tests}/unit/components.LanguageSwitcher.test.tsx (100%) rename {tests => apps/app/tests}/unit/components.VertebraPicker.test.tsx (100%) rename {tests => apps/app/tests}/unit/i18n.dicts.test.ts (100%) rename {tests => apps/app/tests}/unit/i18n.useT.test.tsx (100%) rename {tests => apps/app/tests}/unit/lib.dates.test.ts (100%) rename {tests => apps/app/tests}/unit/lib.id.test.ts (100%) rename {tests => apps/app/tests}/unit/lib.spineZones.test.ts (100%) rename {tests => apps/app/tests}/unit/lib.zoneMatch.test.ts (100%) rename {tests => apps/app/tests}/unit/pdf.attachment.inflate.test.ts (100%) rename {tests => apps/app/tests}/unit/pdf.attachment.test.ts (100%) rename {tests => apps/app/tests}/unit/pdf.roundtrip.test.ts (100%) rename {tests => apps/app/tests}/unit/pdf.svgToPng.test.ts (100%) rename {tests => apps/app/tests}/unit/pdf.zoneLabels.test.ts (100%) rename {tests => apps/app/tests}/unit/schema.observation.test.ts (100%) rename {tests => apps/app/tests}/unit/schema.report.test.ts (100%) rename {tests => apps/app/tests}/unit/smoke.test.ts (100%) rename {tests => apps/app/tests}/unit/species.equineFindings.test.ts (100%) rename {tests => apps/app/tests}/unit/species.registry.test.ts (100%) rename {tests => apps/app/tests}/unit/state.draftMirror.test.ts (100%) rename {tests => apps/app/tests}/unit/state.localeStore.test.ts (100%) rename {tests => apps/app/tests}/unit/state.practitionerCache.test.ts (100%) rename {tests => apps/app/tests}/unit/state.reportStore.restore.test.ts (100%) rename {tests => apps/app/tests}/unit/state.reportStore.setters.test.ts (100%) rename {tests => apps/app/tests}/unit/state.reportStore.test.ts (100%) rename {tests => apps/app/tests}/unit/ui.Button.test.tsx (100%) rename {tests => apps/app/tests}/unit/ui.Dialog.test.tsx (100%) rename tsconfig.json => apps/app/tsconfig.json (100%) rename tsconfig.node.json => apps/app/tsconfig.node.json (100%) rename vite.config.ts => apps/app/vite.config.ts (100%) rename vitest.config.ts => apps/app/vitest.config.ts (100%) create mode 100644 docs/development/WORKSPACE.md create mode 100644 packages/README.md diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index c8c389ef..f43a05c7 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -48,7 +48,8 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo - [x] Step 0 — preparation docs in docs/development/ (2026-10-08, validated) - [x] Step 1 — characterisation tests: 7 files / 91 cases, 2 golden fixtures, docs/development/CHARACTERIZATION_REPORT.md; 271/271, typecheck, lint, build green (2026-10-08, branch feature/step-01-characterisation-tests, awaiting validation) -- [ ] Step 2 — monorepo workspace (next, on validation) +- [x] Step 2 — monorepo workspace: apps/app via git mv (144 files), root scripts, Node 24 + pnpm 10.13.1 pins, Dockerfile node:24 + filtered build, CI .gitea/workflows/ci.yml, WORKSPACE.md; 271/271, typecheck, lint, build green from root (2026-10-08, branch feature/step-02-monorepo-workspace, uncommitted, awaiting validation) +- [ ] Step 3 — Supabase foundation (next, on validation) --- diff --git a/.claudeignore b/.claudeignore index b6c4a4e7..dd20dd15 100644 --- a/.claudeignore +++ b/.claudeignore @@ -19,8 +19,8 @@ coverage/ *.tsbuildinfo # Binary & media assets — reference by path only when needed -public/species/**/*.svg -src/assets/** +**/public/species/**/*.svg +**/src/assets/** *.png *.jpg *.jpeg diff --git a/.dockerignore b/.dockerignore index d8af93ec..9538a6c6 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,13 +1,20 @@ node_modules/ +**/node_modules/ dist/ +**/dist/ .git/ .env .env.* !.env.example coverage/ +**/coverage/ .vite/ +**/.vite/ *.log .DS_Store Thumbs.db graphify-out/ .claude/ +.gitea/ +docs/ +logos/ diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 00000000..b0c31389 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,32 @@ +# Gitea Actions (same syntax as GitHub Actions). Runs on the self-hosted forge +# runner; no external provider. No Supabase dependency at this stage. +name: ci + +on: + push: + branches: [main, develop] + pull_request: + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + - name: Activate pnpm (version from package.json "packageManager") + run: corepack enable && corepack prepare --activate + - run: pnpm install --frozen-lockfile + - run: pnpm typecheck + - run: pnpm test:run + - run: pnpm lint + - run: pnpm build + + docker: + runs-on: ubuntu-latest + needs: check + steps: + - uses: actions/checkout@v4 + - name: Docker image builds (runner needs a Docker daemon) + run: docker build -t faunosteo:ci . diff --git a/.node-version b/.node-version new file mode 100644 index 00000000..a45fd52c --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +24 diff --git a/.npmrc b/.npmrc index 630ea829..9dea4b6b 100644 --- a/.npmrc +++ b/.npmrc @@ -2,3 +2,5 @@ shamefully-hoist=false strict-peer-dependencies=false # Supply-chain guard: only install package versions published >= 24h ago minimum-release-age=1440 +# Refuse to install on a Node/pnpm outside package.json "engines" (explicit environment) +engine-strict=true diff --git a/.nvmrc b/.nvmrc index 209e3ef4..a45fd52c 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20 +24 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6236a7d0..9ee66cb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ Versions follow [Semantic Versioning](https://semver.org/). ## [Unreleased] +### Changed (SaaS migration, plan Step 2) + +- **pnpm workspace** — the application moved to `apps/app` (`@faunosteo/app`) with `git mv`; root commands (`pnpm typecheck|test:run|lint|build|dev`) delegate to the packages. `packages/` reserved, empty. CI workflow added (`.gitea/workflows/ci.yml`). +- **Node 24 LTS / pnpm 10.13.1** — declared in `.nvmrc`, `.node-version`, `engines`, `packageManager`; `engine-strict` on; Dockerfile builds on `node:24-alpine` and copies `apps/app/dist`. + +### Added (SaaS migration, plan Steps 0–1) + +- **Implementation plan** — `docs/development/` (27-step plan, migration map, domain map, architecture, strategies, open questions). +- **Characterisation suite** — 91 tests on the real SVGs, catalog and PDF pipeline; two golden Report v2 fixtures (`CHARACTERIZATION_REPORT.md`). + ### Added - **Laterality & bilaterality** — `LateralSideSchema` (left/right) + `Bone.lateral`, `data-anno-lateral` parsed from the SVG; `LateralityPicker` modal in the zone-click flow, side shown in zone badges and PDF labels; bilateral zones get a separate findings picker per side. diff --git a/CLAUDE.md b/CLAUDE.md index cb995b81..02de074f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,8 +20,8 @@ MVP species: equine only. Open-source MIT. | Concern | Choice | Version | |---|---|---| -| Runtime | Node.js | 20 | -| Package manager | pnpm | >=9 (11.x on host) | +| Runtime | Node.js | 24 LTS (`.nvmrc`, `engines` >=22.12 <25) | +| Package manager | pnpm | 10.13.1 (`packageManager`, root devDependency) | | Build | Vite + @vitejs/plugin-react-swc | 7.x | | UI | React | 19 | | Language | TypeScript strict | 5.x | @@ -38,6 +38,10 @@ MVP species: equine only. Open-source MIT. ## Build commands +pnpm workspace: `apps/app` = the private application, `packages/` empty for +now (see `docs/development/WORKSPACE.md`). Every command below runs from the +repository root and delegates to the packages. + ```bash # Development pnpm dev @@ -77,8 +81,8 @@ docker compose up --build docker compose down ``` -Note: pnpm binary at `~/.local/bin/pnpm` on dev host (corepack broken). -It is normally already on PATH; otherwise `export PATH="$HOME/.local/bin:$PATH"`. +Note: no global pnpm needed. `corepack enable` once (reads `packageManager`), +or call `corepack pnpm `. Root scripts resolve `node_modules/.bin/pnpm`. --- @@ -89,8 +93,9 @@ pnpm test:run # vitest run — all tests, single pass, CI-safe pnpm test # vitest watch — dev loop ``` -Test files live in `tests/unit/*.test.ts` and `tests/unit/*.test.tsx`. -Setup: `tests/setup.ts` imports @testing-library/jest-dom. +Test files live in `apps/app/tests/unit/*.test.ts(x)`; golden fixtures in +`apps/app/tests/fixtures/`. Setup: `apps/app/tests/setup.ts` imports +@testing-library/jest-dom. Characterisation suite: files prefixed `char.`. --- @@ -106,7 +111,8 @@ pnpm format # Prettier write ## Folder structure ``` -osteo/ +faunosteo/ +├─ apps/app/ ← @faunosteo/app (everything below until packages/) ├─ public/ │ ├─ species/equine/{Horse,Horse_head}.svg ← real anatomy SVGs │ └─ pathology-editor.html ← standalone JSON editor (served as static file) @@ -166,20 +172,18 @@ osteo/ │ ├─ ANATOMY-SVG-CONVENTION.md ← SVG data-* contract │ ├─ ADDING-A-SPECIES.md │ ├─ PDF-FORMAT.md -│ ├─ superpowers/specs/ -│ │ ├─ 2026-05-18-osteo-report-mvp-design.md -│ │ ├─ 2026-05-20-b3-i18n-fr-en-design.md -│ │ └─ 2026-05-22-pathology-editor-design.md -│ └─ superpowers/plans/ -│ ├─ 2026-05-18-osteo-report-mvp.md -│ └─ 2026-05-20-b3-i18n-fr-en.md +│ ├─ faunosteo-audit/ ← audit of the current system (frozen at 83e40af) +│ └─ development/ ← SaaS implementation plan, WORKSPACE.md +├─ eslint.config.js, index.html, package.json (@faunosteo/app) +├─ tsconfig*.json, vite.config.ts, vitest.config.ts +│ (end of apps/app) +├─ packages/README.md ← future shared packages (none yet) +├─ .gitea/workflows/ci.yml ← CI: install, typecheck, test, lint, build, docker ├─ .claude/{tasks/TODO.md,memory/,audits/} -├─ Dockerfile, docker-compose.yml -├─ .env.example, .editorconfig, .nvmrc, .prettierrc.json -├─ eslint.config.js, index.html -├─ package.json, tsconfig*.json -├─ vite.config.ts, vitest.config.ts -├─ CLAUDE.md, README.md, LICENSE +├─ Dockerfile, docker-compose.yml, docker/ +├─ .env.example, .editorconfig, .nvmrc, .node-version, .npmrc, .prettierrc.json +├─ package.json (workspace root), pnpm-workspace.yaml, pnpm-lock.yaml +├─ CLAUDE.md, README.md, DEPLOY.md, CHANGELOG.md, LICENSE ``` --- @@ -321,12 +325,12 @@ Runtime config - Pathology DB entries must be source-cited before commit; client review required for MVP batch. - Ask before any change to importReportFromPdf or extractReportJson — these handle user data. - After PDF roundtrip tests fail: check attachment bytes, then Zod validation, then DecompressionStream inflation. -- pnpm binary: `~/.local/bin/pnpm` on dev host (normally already on PATH). +- Node 24 / pnpm 10.13.1: `corepack enable` or `corepack pnpm`; never a global install. ## Commit message convention Conventional Commits format. Subject ≤72 chars, imperative mood, no trailing period. -Allowed scopes: `schema`, `store`, `anatomy`, `pdf`, `editor`, `home`, `new`, `ui`, `config`, `species`, `i18n`, `docker`, `docs`, `tests`, `chore`. +Allowed scopes: `schema`, `store`, `anatomy`, `pdf`, `editor`, `home`, `new`, `ui`, `config`, `species`, `i18n`, `docker`, `docs`, `tests`, `chore`, `app`, `workspace`, `ci`. Examples: - `test(schema): cover Report version literal` diff --git a/DEPLOY.md b/DEPLOY.md index d4e8ebb4..d34c7e35 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -1,7 +1,8 @@ # Deploy Single nginx:alpine container behind a host reverse proxy that terminates -TLS. The container serves a static SPA bundle from `/usr/share/nginx/html` +TLS. The container serves a static SPA bundle (built from `apps/app`, Node 24, +pnpm 10.13.1) from `/usr/share/nginx/html` and a runtime-injected `env.js`; there is no backend, no database, no persistent server-side state. Praticien data lives in the browser (`sessionStorage` / `localStorage`) and in the exported PDFs themselves @@ -163,8 +164,8 @@ curl -sI http://127.0.0.1:8080/ | head -1 # expect 200 OK curl -s http://127.0.0.1:8080/env.js # expect window.__APP_CONFIG__ = {...}; ``` -If the build OOMs on a 1 GB VPS, build locally and rsync the resulting -`dist/` over, then bind-mount it into a plain `nginx:alpine` until you +If the build OOMs on a 1 GB VPS, build locally (`pnpm build`) and rsync the +resulting `apps/app/dist/` over, then bind-mount it into a plain `nginx:alpine` until you upsize. --- diff --git a/Dockerfile b/Dockerfile index 81b05f47..47a8c9dd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,25 +1,28 @@ # ---- stage 1: builder ----------------------------------------------- -FROM node:20-alpine AS builder +# Node 24 LTS (Node 20 reached end-of-life on 2026-04-30). pnpm pinned to the +# same version as package.json "packageManager"; pnpm 11 needs Node >= 22.13 +# and rewrites the lockfile, so the 10.x line stays pinned on purpose. +FROM node:24-alpine AS builder WORKDIR /app -# Install pnpm via corepack RUN corepack enable && corepack prepare pnpm@10.13.1 --activate -# Copy manifests first for layer caching -COPY package.json pnpm-lock.yaml* ./ +# Workspace manifests first for layer caching (install depends only on these) +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./ +COPY apps/app/package.json apps/app/ RUN pnpm install --frozen-lockfile -# Copy source and build +# Copy source and build the private app only COPY . . -RUN pnpm build +RUN pnpm --filter @faunosteo/app build # ---- stage 2: runner ------------------------------------------------ FROM nginx:1.31-alpine AS runner # Copy built static assets -COPY --from=builder /app/dist /usr/share/nginx/html +COPY --from=builder /app/apps/app/dist /usr/share/nginx/html # Copy custom nginx config and entrypoint COPY docker/nginx.conf /etc/nginx/conf.d/default.conf diff --git a/README.md b/README.md index 9ea7bbb5..90fb25b4 100644 --- a/README.md +++ b/README.md @@ -56,9 +56,8 @@ contract. Single process, no Docker: ```bash -# Requires pnpm — install if needed: -curl -fsSL https://get.pnpm.io/install.sh | sh -source ~/.bashrc # or restart your shell +# Node 24 (see .nvmrc) + pnpm 10.13.1 via corepack, no global install: +corepack enable pnpm install cp .env.example .env # edit APP_* vars if desired @@ -80,8 +79,8 @@ docker compose up --build ```bash pnpm typecheck # TypeScript strict, no emit pnpm lint # ESLint 9 flat config, 0 warnings -pnpm test:run # vitest run (174 tests) -pnpm build # tsc + vite build → dist/ +pnpm test:run # vitest run (271 tests) +pnpm build # tsc + vite build → apps/app/dist/ ``` --- @@ -89,7 +88,7 @@ pnpm build # tsc + vite build → dist/ ## Build & deploy ```bash -pnpm build # production build → dist/ +pnpm build # production build → apps/app/dist/ docker build -t faunosteo . # multi-stage Docker image docker compose up --build # run with env_file: .env ``` @@ -114,7 +113,8 @@ For production deployment (VPS provisioning, firewall, TLS, nginx reverse proxy, ## Project layout ``` -osteo/ +faunosteo/ pnpm workspace (see docs/development/WORKSPACE.md) +├─ apps/app/ the private application (@faunosteo/app): ├─ public/species/equine/ anatomy SVGs (Horse.svg, Horse_head.svg) ├─ src/app/ routes + ConfigProvider ├─ src/config/ runtime env config resolution @@ -126,7 +126,8 @@ osteo/ ├─ src/pdf/ export/import/attachment/fonts + renderers ├─ src/lib/ id, dates, assert utilities ├─ src/styles/ Tailwind v4 CSS + design tokens -├─ tests/unit/ vitest tests +├─ tests/unit/ vitest tests (apps/app/tests, incl. characterisation suite) +├─ packages/ shared packages, none yet ├─ docker/ entrypoint.sh + nginx.conf ├─ docs/ conventions + species guide + PDF spec ├─ index.html SPA entry point @@ -141,7 +142,7 @@ v0.1.0 MVP — implementation complete. - `pnpm typecheck` ✅ - `pnpm lint` ✅ -- `pnpm test:run` ✅ — 174 tests across 30 files +- `pnpm test:run` ✅ — 271 tests across 39 files - `pnpm build` ✅ The first species data set ships with the real `Horse.svg` + `Horse_head.svg` diff --git a/eslint.config.js b/apps/app/eslint.config.js similarity index 100% rename from eslint.config.js rename to apps/app/eslint.config.js diff --git a/index.html b/apps/app/index.html similarity index 100% rename from index.html rename to apps/app/index.html diff --git a/apps/app/package.json b/apps/app/package.json new file mode 100644 index 00000000..3a6d373d --- /dev/null +++ b/apps/app/package.json @@ -0,0 +1,45 @@ +{ + "name": "@faunosteo/app", + "version": "0.1.0", + "private": true, + "description": "Faunosteo private application: veterinary osteopathy reports with PDF export/import", + "license": "MIT", + "scripts": { + "dev": "vite", + "build": "tsc -p tsconfig.json --noEmit && vite build", + "preview": "vite preview", + "typecheck": "tsc -p tsconfig.json --noEmit", + "test": "vitest", + "test:run": "vitest run", + "lint": "eslint . --max-warnings 0", + "scaffold:species": "node scripts/scaffold-species.mjs" + }, + "dependencies": { + "motion": "^11.11.17", + "pdf-lib": "^1.17.1", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "react-router-dom": "^7.1.1", + "zod": "^3.24.1", + "zustand": "^5.0.2" + }, + "devDependencies": { + "@tailwindcss/vite": "^4.3.0", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.1.0", + "@testing-library/user-event": "^14.5.2", + "@types/node": "^20.19.41", + "@types/react": "^19.0.1", + "@types/react-dom": "^19.0.1", + "@vitejs/plugin-react-swc": "^3.7.2", + "eslint": "^9.17.0", + "eslint-plugin-react": "^7.37.3", + "eslint-plugin-react-hooks": "^5.1.0", + "globals": "^15.14.0", + "happy-dom": "^20.10.6", + "typescript": "^5.7.2", + "typescript-eslint": "^8.19.0", + "vite": "^7.3.6", + "vitest": "^3.2.7" + } +} diff --git a/public/Paws_in_harmony.svg b/apps/app/public/Paws_in_harmony.svg similarity index 100% rename from public/Paws_in_harmony.svg rename to apps/app/public/Paws_in_harmony.svg diff --git a/public/apple-touch-icon.png b/apps/app/public/apple-touch-icon.png similarity index 100% rename from public/apple-touch-icon.png rename to apps/app/public/apple-touch-icon.png diff --git a/public/assets/faunosteo-horizontal-com-512.png b/apps/app/public/assets/faunosteo-horizontal-com-512.png similarity index 100% rename from public/assets/faunosteo-horizontal-com-512.png rename to apps/app/public/assets/faunosteo-horizontal-com-512.png diff --git a/public/assets/faunosteo_logo_horizontal-512.png b/apps/app/public/assets/faunosteo_logo_horizontal-512.png similarity index 100% rename from public/assets/faunosteo_logo_horizontal-512.png rename to apps/app/public/assets/faunosteo_logo_horizontal-512.png diff --git a/public/brand/zenquality-logo-fr.png b/apps/app/public/brand/zenquality-logo-fr.png similarity index 100% rename from public/brand/zenquality-logo-fr.png rename to apps/app/public/brand/zenquality-logo-fr.png diff --git a/public/env.js b/apps/app/public/env.js similarity index 100% rename from public/env.js rename to apps/app/public/env.js diff --git a/public/favicon.svg b/apps/app/public/favicon.svg similarity index 100% rename from public/favicon.svg rename to apps/app/public/favicon.svg diff --git a/public/logo-horizontal.svg b/apps/app/public/logo-horizontal.svg similarity index 100% rename from public/logo-horizontal.svg rename to apps/app/public/logo-horizontal.svg diff --git a/public/pathology-editor.html b/apps/app/public/pathology-editor.html similarity index 100% rename from public/pathology-editor.html rename to apps/app/public/pathology-editor.html diff --git a/public/species/equine/Horse.svg b/apps/app/public/species/equine/Horse.svg similarity index 100% rename from public/species/equine/Horse.svg rename to apps/app/public/species/equine/Horse.svg diff --git a/public/species/equine/Horse_head.svg b/apps/app/public/species/equine/Horse_head.svg similarity index 100% rename from public/species/equine/Horse_head.svg rename to apps/app/public/species/equine/Horse_head.svg diff --git a/public/species/equine/pathologies.json b/apps/app/public/species/equine/pathologies.json similarity index 100% rename from public/species/equine/pathologies.json rename to apps/app/public/species/equine/pathologies.json diff --git a/scripts/scaffold-species.mjs b/apps/app/scripts/scaffold-species.mjs similarity index 100% rename from scripts/scaffold-species.mjs rename to apps/app/scripts/scaffold-species.mjs diff --git a/src/anatomy/labels.ts b/apps/app/src/anatomy/labels.ts similarity index 100% rename from src/anatomy/labels.ts rename to apps/app/src/anatomy/labels.ts diff --git a/src/anatomy/svgConvention.ts b/apps/app/src/anatomy/svgConvention.ts similarity index 100% rename from src/anatomy/svgConvention.ts rename to apps/app/src/anatomy/svgConvention.ts diff --git a/src/anatomy/svgLoader.ts b/apps/app/src/anatomy/svgLoader.ts similarity index 100% rename from src/anatomy/svgLoader.ts rename to apps/app/src/anatomy/svgLoader.ts diff --git a/src/anatomy/types.ts b/apps/app/src/anatomy/types.ts similarity index 100% rename from src/anatomy/types.ts rename to apps/app/src/anatomy/types.ts diff --git a/src/app/App.tsx b/apps/app/src/app/App.tsx similarity index 100% rename from src/app/App.tsx rename to apps/app/src/app/App.tsx diff --git a/src/app/providers/ConfigProvider.tsx b/apps/app/src/app/providers/ConfigProvider.tsx similarity index 100% rename from src/app/providers/ConfigProvider.tsx rename to apps/app/src/app/providers/ConfigProvider.tsx diff --git a/src/app/routes/EditorRoute.tsx b/apps/app/src/app/routes/EditorRoute.tsx similarity index 100% rename from src/app/routes/EditorRoute.tsx rename to apps/app/src/app/routes/EditorRoute.tsx diff --git a/src/app/routes/EditorsRoute.tsx b/apps/app/src/app/routes/EditorsRoute.tsx similarity index 100% rename from src/app/routes/EditorsRoute.tsx rename to apps/app/src/app/routes/EditorsRoute.tsx diff --git a/src/app/routes/HomeRoute.tsx b/apps/app/src/app/routes/HomeRoute.tsx similarity index 100% rename from src/app/routes/HomeRoute.tsx rename to apps/app/src/app/routes/HomeRoute.tsx diff --git a/src/app/routes/NewReportRoute.tsx b/apps/app/src/app/routes/NewReportRoute.tsx similarity index 100% rename from src/app/routes/NewReportRoute.tsx rename to apps/app/src/app/routes/NewReportRoute.tsx diff --git a/src/app/routes/NotFoundRoute.tsx b/apps/app/src/app/routes/NotFoundRoute.tsx similarity index 100% rename from src/app/routes/NotFoundRoute.tsx rename to apps/app/src/app/routes/NotFoundRoute.tsx diff --git a/src/app/routes/SvgEditorRoute.tsx b/apps/app/src/app/routes/SvgEditorRoute.tsx similarity index 100% rename from src/app/routes/SvgEditorRoute.tsx rename to apps/app/src/app/routes/SvgEditorRoute.tsx diff --git a/src/components/brand/AppHeader.tsx b/apps/app/src/components/brand/AppHeader.tsx similarity index 100% rename from src/components/brand/AppHeader.tsx rename to apps/app/src/components/brand/AppHeader.tsx diff --git a/src/components/brand/Brand.tsx b/apps/app/src/components/brand/Brand.tsx similarity index 100% rename from src/components/brand/Brand.tsx rename to apps/app/src/components/brand/Brand.tsx diff --git a/src/components/brand/Footer.tsx b/apps/app/src/components/brand/Footer.tsx similarity index 100% rename from src/components/brand/Footer.tsx rename to apps/app/src/components/brand/Footer.tsx diff --git a/src/components/brand/LanguageSwitcher.tsx b/apps/app/src/components/brand/LanguageSwitcher.tsx similarity index 100% rename from src/components/brand/LanguageSwitcher.tsx rename to apps/app/src/components/brand/LanguageSwitcher.tsx diff --git a/src/components/canvas/AnatomyCanvas.tsx b/apps/app/src/components/canvas/AnatomyCanvas.tsx similarity index 100% rename from src/components/canvas/AnatomyCanvas.tsx rename to apps/app/src/components/canvas/AnatomyCanvas.tsx diff --git a/src/components/canvas/DetailModal.tsx b/apps/app/src/components/canvas/DetailModal.tsx similarity index 100% rename from src/components/canvas/DetailModal.tsx rename to apps/app/src/components/canvas/DetailModal.tsx diff --git a/src/components/observation/FindingsTreePicker.tsx b/apps/app/src/components/observation/FindingsTreePicker.tsx similarity index 100% rename from src/components/observation/FindingsTreePicker.tsx rename to apps/app/src/components/observation/FindingsTreePicker.tsx diff --git a/src/components/observation/FreeTextFindingInput.tsx b/apps/app/src/components/observation/FreeTextFindingInput.tsx similarity index 100% rename from src/components/observation/FreeTextFindingInput.tsx rename to apps/app/src/components/observation/FreeTextFindingInput.tsx diff --git a/src/components/observation/LateralityPicker.tsx b/apps/app/src/components/observation/LateralityPicker.tsx similarity index 100% rename from src/components/observation/LateralityPicker.tsx rename to apps/app/src/components/observation/LateralityPicker.tsx diff --git a/src/components/observation/ObservationCard.tsx b/apps/app/src/components/observation/ObservationCard.tsx similarity index 100% rename from src/components/observation/ObservationCard.tsx rename to apps/app/src/components/observation/ObservationCard.tsx diff --git a/src/components/observation/ObservationList.tsx b/apps/app/src/components/observation/ObservationList.tsx similarity index 100% rename from src/components/observation/ObservationList.tsx rename to apps/app/src/components/observation/ObservationList.tsx diff --git a/src/components/observation/SeveritySelector.tsx b/apps/app/src/components/observation/SeveritySelector.tsx similarity index 100% rename from src/components/observation/SeveritySelector.tsx rename to apps/app/src/components/observation/SeveritySelector.tsx diff --git a/src/components/observation/VertebraPicker.tsx b/apps/app/src/components/observation/VertebraPicker.tsx similarity index 100% rename from src/components/observation/VertebraPicker.tsx rename to apps/app/src/components/observation/VertebraPicker.tsx diff --git a/src/components/report/AnimalForm.tsx b/apps/app/src/components/report/AnimalForm.tsx similarity index 100% rename from src/components/report/AnimalForm.tsx rename to apps/app/src/components/report/AnimalForm.tsx diff --git a/src/components/report/ConclusionPanel.tsx b/apps/app/src/components/report/ConclusionPanel.tsx similarity index 100% rename from src/components/report/ConclusionPanel.tsx rename to apps/app/src/components/report/ConclusionPanel.tsx diff --git a/src/components/report/NextAppointmentPicker.tsx b/apps/app/src/components/report/NextAppointmentPicker.tsx similarity index 100% rename from src/components/report/NextAppointmentPicker.tsx rename to apps/app/src/components/report/NextAppointmentPicker.tsx diff --git a/src/components/report/PractitionerForm.tsx b/apps/app/src/components/report/PractitionerForm.tsx similarity index 100% rename from src/components/report/PractitionerForm.tsx rename to apps/app/src/components/report/PractitionerForm.tsx diff --git a/src/components/report/ReportHeader.tsx b/apps/app/src/components/report/ReportHeader.tsx similarity index 100% rename from src/components/report/ReportHeader.tsx rename to apps/app/src/components/report/ReportHeader.tsx diff --git a/src/components/ui/Badge.tsx b/apps/app/src/components/ui/Badge.tsx similarity index 100% rename from src/components/ui/Badge.tsx rename to apps/app/src/components/ui/Badge.tsx diff --git a/src/components/ui/Button.tsx b/apps/app/src/components/ui/Button.tsx similarity index 100% rename from src/components/ui/Button.tsx rename to apps/app/src/components/ui/Button.tsx diff --git a/src/components/ui/Card.tsx b/apps/app/src/components/ui/Card.tsx similarity index 100% rename from src/components/ui/Card.tsx rename to apps/app/src/components/ui/Card.tsx diff --git a/src/components/ui/Chip.tsx b/apps/app/src/components/ui/Chip.tsx similarity index 100% rename from src/components/ui/Chip.tsx rename to apps/app/src/components/ui/Chip.tsx diff --git a/src/components/ui/Dialog.tsx b/apps/app/src/components/ui/Dialog.tsx similarity index 100% rename from src/components/ui/Dialog.tsx rename to apps/app/src/components/ui/Dialog.tsx diff --git a/src/components/ui/Input.tsx b/apps/app/src/components/ui/Input.tsx similarity index 100% rename from src/components/ui/Input.tsx rename to apps/app/src/components/ui/Input.tsx diff --git a/src/components/ui/Label.tsx b/apps/app/src/components/ui/Label.tsx similarity index 100% rename from src/components/ui/Label.tsx rename to apps/app/src/components/ui/Label.tsx diff --git a/src/components/ui/Select.tsx b/apps/app/src/components/ui/Select.tsx similarity index 100% rename from src/components/ui/Select.tsx rename to apps/app/src/components/ui/Select.tsx diff --git a/src/components/ui/Textarea.tsx b/apps/app/src/components/ui/Textarea.tsx similarity index 100% rename from src/components/ui/Textarea.tsx rename to apps/app/src/components/ui/Textarea.tsx diff --git a/src/config/env.ts b/apps/app/src/config/env.ts similarity index 100% rename from src/config/env.ts rename to apps/app/src/config/env.ts diff --git a/src/domain/schema/animal.ts b/apps/app/src/domain/schema/animal.ts similarity index 100% rename from src/domain/schema/animal.ts rename to apps/app/src/domain/schema/animal.ts diff --git a/src/domain/schema/findings.ts b/apps/app/src/domain/schema/findings.ts similarity index 100% rename from src/domain/schema/findings.ts rename to apps/app/src/domain/schema/findings.ts diff --git a/src/domain/schema/observation.ts b/apps/app/src/domain/schema/observation.ts similarity index 100% rename from src/domain/schema/observation.ts rename to apps/app/src/domain/schema/observation.ts diff --git a/src/domain/schema/practitioner.ts b/apps/app/src/domain/schema/practitioner.ts similarity index 100% rename from src/domain/schema/practitioner.ts rename to apps/app/src/domain/schema/practitioner.ts diff --git a/src/domain/schema/report.ts b/apps/app/src/domain/schema/report.ts similarity index 100% rename from src/domain/schema/report.ts rename to apps/app/src/domain/schema/report.ts diff --git a/src/domain/species/equine/index.ts b/apps/app/src/domain/species/equine/index.ts similarity index 100% rename from src/domain/species/equine/index.ts rename to apps/app/src/domain/species/equine/index.ts diff --git a/src/domain/species/equine/pathologies.json b/apps/app/src/domain/species/equine/pathologies.json similarity index 100% rename from src/domain/species/equine/pathologies.json rename to apps/app/src/domain/species/equine/pathologies.json diff --git a/src/domain/species/equine/pathologies.ts b/apps/app/src/domain/species/equine/pathologies.ts similarity index 100% rename from src/domain/species/equine/pathologies.ts rename to apps/app/src/domain/species/equine/pathologies.ts diff --git a/src/domain/species/equine/vertebrae.ts b/apps/app/src/domain/species/equine/vertebrae.ts similarity index 100% rename from src/domain/species/equine/vertebrae.ts rename to apps/app/src/domain/species/equine/vertebrae.ts diff --git a/src/domain/species/registry.ts b/apps/app/src/domain/species/registry.ts similarity index 100% rename from src/domain/species/registry.ts rename to apps/app/src/domain/species/registry.ts diff --git a/src/domain/species/types.ts b/apps/app/src/domain/species/types.ts similarity index 100% rename from src/domain/species/types.ts rename to apps/app/src/domain/species/types.ts diff --git a/src/i18n/en.ts b/apps/app/src/i18n/en.ts similarity index 100% rename from src/i18n/en.ts rename to apps/app/src/i18n/en.ts diff --git a/src/i18n/fr.ts b/apps/app/src/i18n/fr.ts similarity index 100% rename from src/i18n/fr.ts rename to apps/app/src/i18n/fr.ts diff --git a/src/i18n/index.ts b/apps/app/src/i18n/index.ts similarity index 100% rename from src/i18n/index.ts rename to apps/app/src/i18n/index.ts diff --git a/src/i18n/pickLocaleLabel.ts b/apps/app/src/i18n/pickLocaleLabel.ts similarity index 100% rename from src/i18n/pickLocaleLabel.ts rename to apps/app/src/i18n/pickLocaleLabel.ts diff --git a/src/i18n/types.ts b/apps/app/src/i18n/types.ts similarity index 100% rename from src/i18n/types.ts rename to apps/app/src/i18n/types.ts diff --git a/src/i18n/useT.ts b/apps/app/src/i18n/useT.ts similarity index 100% rename from src/i18n/useT.ts rename to apps/app/src/i18n/useT.ts diff --git a/src/lib/assert.ts b/apps/app/src/lib/assert.ts similarity index 100% rename from src/lib/assert.ts rename to apps/app/src/lib/assert.ts diff --git a/src/lib/dates.ts b/apps/app/src/lib/dates.ts similarity index 100% rename from src/lib/dates.ts rename to apps/app/src/lib/dates.ts diff --git a/src/lib/id.ts b/apps/app/src/lib/id.ts similarity index 100% rename from src/lib/id.ts rename to apps/app/src/lib/id.ts diff --git a/src/lib/spineZones.ts b/apps/app/src/lib/spineZones.ts similarity index 100% rename from src/lib/spineZones.ts rename to apps/app/src/lib/spineZones.ts diff --git a/src/lib/zoneMatch.ts b/apps/app/src/lib/zoneMatch.ts similarity index 100% rename from src/lib/zoneMatch.ts rename to apps/app/src/lib/zoneMatch.ts diff --git a/src/main.tsx b/apps/app/src/main.tsx similarity index 100% rename from src/main.tsx rename to apps/app/src/main.tsx diff --git a/src/pdf/attachment.ts b/apps/app/src/pdf/attachment.ts similarity index 100% rename from src/pdf/attachment.ts rename to apps/app/src/pdf/attachment.ts diff --git a/src/pdf/export.ts b/apps/app/src/pdf/export.ts similarity index 100% rename from src/pdf/export.ts rename to apps/app/src/pdf/export.ts diff --git a/src/pdf/fonts.ts b/apps/app/src/pdf/fonts.ts similarity index 100% rename from src/pdf/fonts.ts rename to apps/app/src/pdf/fonts.ts diff --git a/src/pdf/import.ts b/apps/app/src/pdf/import.ts similarity index 100% rename from src/pdf/import.ts rename to apps/app/src/pdf/import.ts diff --git a/src/pdf/render/conclusionPage.ts b/apps/app/src/pdf/render/conclusionPage.ts similarity index 100% rename from src/pdf/render/conclusionPage.ts rename to apps/app/src/pdf/render/conclusionPage.ts diff --git a/src/pdf/render/constants.ts b/apps/app/src/pdf/render/constants.ts similarity index 100% rename from src/pdf/render/constants.ts rename to apps/app/src/pdf/render/constants.ts diff --git a/src/pdf/render/footer.ts b/apps/app/src/pdf/render/footer.ts similarity index 100% rename from src/pdf/render/footer.ts rename to apps/app/src/pdf/render/footer.ts diff --git a/src/pdf/render/header.ts b/apps/app/src/pdf/render/header.ts similarity index 100% rename from src/pdf/render/header.ts rename to apps/app/src/pdf/render/header.ts diff --git a/src/pdf/render/linkAnnotation.ts b/apps/app/src/pdf/render/linkAnnotation.ts similarity index 100% rename from src/pdf/render/linkAnnotation.ts rename to apps/app/src/pdf/render/linkAnnotation.ts diff --git a/src/pdf/render/logo.ts b/apps/app/src/pdf/render/logo.ts similarity index 100% rename from src/pdf/render/logo.ts rename to apps/app/src/pdf/render/logo.ts diff --git a/src/pdf/render/observationPage.ts b/apps/app/src/pdf/render/observationPage.ts similarity index 100% rename from src/pdf/render/observationPage.ts rename to apps/app/src/pdf/render/observationPage.ts diff --git a/src/pdf/render/svgToPng.ts b/apps/app/src/pdf/render/svgToPng.ts similarity index 100% rename from src/pdf/render/svgToPng.ts rename to apps/app/src/pdf/render/svgToPng.ts diff --git a/src/pdf/render/text.ts b/apps/app/src/pdf/render/text.ts similarity index 100% rename from src/pdf/render/text.ts rename to apps/app/src/pdf/render/text.ts diff --git a/src/state/localeStore.ts b/apps/app/src/state/localeStore.ts similarity index 100% rename from src/state/localeStore.ts rename to apps/app/src/state/localeStore.ts diff --git a/src/state/practitionerCache.ts b/apps/app/src/state/practitionerCache.ts similarity index 100% rename from src/state/practitionerCache.ts rename to apps/app/src/state/practitionerCache.ts diff --git a/src/state/reportStore.ts b/apps/app/src/state/reportStore.ts similarity index 100% rename from src/state/reportStore.ts rename to apps/app/src/state/reportStore.ts diff --git a/src/styles/index.css b/apps/app/src/styles/index.css similarity index 100% rename from src/styles/index.css rename to apps/app/src/styles/index.css diff --git a/src/styles/svg-editor.css b/apps/app/src/styles/svg-editor.css similarity index 100% rename from src/styles/svg-editor.css rename to apps/app/src/styles/svg-editor.css diff --git a/src/styles/tokens.css b/apps/app/src/styles/tokens.css similarity index 100% rename from src/styles/tokens.css rename to apps/app/src/styles/tokens.css diff --git a/tests/fixtures/README.md b/apps/app/tests/fixtures/README.md similarity index 100% rename from tests/fixtures/README.md rename to apps/app/tests/fixtures/README.md diff --git a/tests/fixtures/report-v2.full.json b/apps/app/tests/fixtures/report-v2.full.json similarity index 100% rename from tests/fixtures/report-v2.full.json rename to apps/app/tests/fixtures/report-v2.full.json diff --git a/tests/fixtures/report-v2.minimal.json b/apps/app/tests/fixtures/report-v2.minimal.json similarity index 100% rename from tests/fixtures/report-v2.minimal.json rename to apps/app/tests/fixtures/report-v2.minimal.json diff --git a/tests/setup.ts b/apps/app/tests/setup.ts similarity index 100% rename from tests/setup.ts rename to apps/app/tests/setup.ts diff --git a/tests/unit/anatomy.horse.test.ts b/apps/app/tests/unit/anatomy.horse.test.ts similarity index 100% rename from tests/unit/anatomy.horse.test.ts rename to apps/app/tests/unit/anatomy.horse.test.ts diff --git a/tests/unit/anatomy.svgConvention.test.ts b/apps/app/tests/unit/anatomy.svgConvention.test.ts similarity index 100% rename from tests/unit/anatomy.svgConvention.test.ts rename to apps/app/tests/unit/anatomy.svgConvention.test.ts diff --git a/tests/unit/anatomy.svgLoader.test.ts b/apps/app/tests/unit/anatomy.svgLoader.test.ts similarity index 100% rename from tests/unit/anatomy.svgLoader.test.ts rename to apps/app/tests/unit/anatomy.svgLoader.test.ts diff --git a/tests/unit/char.catalog.test.ts b/apps/app/tests/unit/char.catalog.test.ts similarity index 100% rename from tests/unit/char.catalog.test.ts rename to apps/app/tests/unit/char.catalog.test.ts diff --git a/tests/unit/char.clickChain.test.tsx b/apps/app/tests/unit/char.clickChain.test.tsx similarity index 100% rename from tests/unit/char.clickChain.test.tsx rename to apps/app/tests/unit/char.clickChain.test.tsx diff --git a/tests/unit/char.i18nSpecies.test.tsx b/apps/app/tests/unit/char.i18nSpecies.test.tsx similarity index 100% rename from tests/unit/char.i18nSpecies.test.tsx rename to apps/app/tests/unit/char.i18nSpecies.test.tsx diff --git a/tests/unit/char.pathologyEditor.test.ts b/apps/app/tests/unit/char.pathologyEditor.test.ts similarity index 100% rename from tests/unit/char.pathologyEditor.test.ts rename to apps/app/tests/unit/char.pathologyEditor.test.ts diff --git a/tests/unit/char.pdfFull.test.ts b/apps/app/tests/unit/char.pdfFull.test.ts similarity index 100% rename from tests/unit/char.pdfFull.test.ts rename to apps/app/tests/unit/char.pdfFull.test.ts diff --git a/tests/unit/char.schemaPersistence.test.ts b/apps/app/tests/unit/char.schemaPersistence.test.ts similarity index 100% rename from tests/unit/char.schemaPersistence.test.ts rename to apps/app/tests/unit/char.schemaPersistence.test.ts diff --git a/tests/unit/char.svgCatalogLink.test.ts b/apps/app/tests/unit/char.svgCatalogLink.test.ts similarity index 100% rename from tests/unit/char.svgCatalogLink.test.ts rename to apps/app/tests/unit/char.svgCatalogLink.test.ts diff --git a/tests/unit/components.AnatomyCanvas.test.tsx b/apps/app/tests/unit/components.AnatomyCanvas.test.tsx similarity index 100% rename from tests/unit/components.AnatomyCanvas.test.tsx rename to apps/app/tests/unit/components.AnatomyCanvas.test.tsx diff --git a/tests/unit/components.Brand.test.tsx b/apps/app/tests/unit/components.Brand.test.tsx similarity index 100% rename from tests/unit/components.Brand.test.tsx rename to apps/app/tests/unit/components.Brand.test.tsx diff --git a/tests/unit/components.FindingsTreePicker.test.tsx b/apps/app/tests/unit/components.FindingsTreePicker.test.tsx similarity index 100% rename from tests/unit/components.FindingsTreePicker.test.tsx rename to apps/app/tests/unit/components.FindingsTreePicker.test.tsx diff --git a/tests/unit/components.LanguageSwitcher.test.tsx b/apps/app/tests/unit/components.LanguageSwitcher.test.tsx similarity index 100% rename from tests/unit/components.LanguageSwitcher.test.tsx rename to apps/app/tests/unit/components.LanguageSwitcher.test.tsx diff --git a/tests/unit/components.VertebraPicker.test.tsx b/apps/app/tests/unit/components.VertebraPicker.test.tsx similarity index 100% rename from tests/unit/components.VertebraPicker.test.tsx rename to apps/app/tests/unit/components.VertebraPicker.test.tsx diff --git a/tests/unit/i18n.dicts.test.ts b/apps/app/tests/unit/i18n.dicts.test.ts similarity index 100% rename from tests/unit/i18n.dicts.test.ts rename to apps/app/tests/unit/i18n.dicts.test.ts diff --git a/tests/unit/i18n.useT.test.tsx b/apps/app/tests/unit/i18n.useT.test.tsx similarity index 100% rename from tests/unit/i18n.useT.test.tsx rename to apps/app/tests/unit/i18n.useT.test.tsx diff --git a/tests/unit/lib.dates.test.ts b/apps/app/tests/unit/lib.dates.test.ts similarity index 100% rename from tests/unit/lib.dates.test.ts rename to apps/app/tests/unit/lib.dates.test.ts diff --git a/tests/unit/lib.id.test.ts b/apps/app/tests/unit/lib.id.test.ts similarity index 100% rename from tests/unit/lib.id.test.ts rename to apps/app/tests/unit/lib.id.test.ts diff --git a/tests/unit/lib.spineZones.test.ts b/apps/app/tests/unit/lib.spineZones.test.ts similarity index 100% rename from tests/unit/lib.spineZones.test.ts rename to apps/app/tests/unit/lib.spineZones.test.ts diff --git a/tests/unit/lib.zoneMatch.test.ts b/apps/app/tests/unit/lib.zoneMatch.test.ts similarity index 100% rename from tests/unit/lib.zoneMatch.test.ts rename to apps/app/tests/unit/lib.zoneMatch.test.ts diff --git a/tests/unit/pdf.attachment.inflate.test.ts b/apps/app/tests/unit/pdf.attachment.inflate.test.ts similarity index 100% rename from tests/unit/pdf.attachment.inflate.test.ts rename to apps/app/tests/unit/pdf.attachment.inflate.test.ts diff --git a/tests/unit/pdf.attachment.test.ts b/apps/app/tests/unit/pdf.attachment.test.ts similarity index 100% rename from tests/unit/pdf.attachment.test.ts rename to apps/app/tests/unit/pdf.attachment.test.ts diff --git a/tests/unit/pdf.roundtrip.test.ts b/apps/app/tests/unit/pdf.roundtrip.test.ts similarity index 100% rename from tests/unit/pdf.roundtrip.test.ts rename to apps/app/tests/unit/pdf.roundtrip.test.ts diff --git a/tests/unit/pdf.svgToPng.test.ts b/apps/app/tests/unit/pdf.svgToPng.test.ts similarity index 100% rename from tests/unit/pdf.svgToPng.test.ts rename to apps/app/tests/unit/pdf.svgToPng.test.ts diff --git a/tests/unit/pdf.zoneLabels.test.ts b/apps/app/tests/unit/pdf.zoneLabels.test.ts similarity index 100% rename from tests/unit/pdf.zoneLabels.test.ts rename to apps/app/tests/unit/pdf.zoneLabels.test.ts diff --git a/tests/unit/schema.observation.test.ts b/apps/app/tests/unit/schema.observation.test.ts similarity index 100% rename from tests/unit/schema.observation.test.ts rename to apps/app/tests/unit/schema.observation.test.ts diff --git a/tests/unit/schema.report.test.ts b/apps/app/tests/unit/schema.report.test.ts similarity index 100% rename from tests/unit/schema.report.test.ts rename to apps/app/tests/unit/schema.report.test.ts diff --git a/tests/unit/smoke.test.ts b/apps/app/tests/unit/smoke.test.ts similarity index 100% rename from tests/unit/smoke.test.ts rename to apps/app/tests/unit/smoke.test.ts diff --git a/tests/unit/species.equineFindings.test.ts b/apps/app/tests/unit/species.equineFindings.test.ts similarity index 100% rename from tests/unit/species.equineFindings.test.ts rename to apps/app/tests/unit/species.equineFindings.test.ts diff --git a/tests/unit/species.registry.test.ts b/apps/app/tests/unit/species.registry.test.ts similarity index 100% rename from tests/unit/species.registry.test.ts rename to apps/app/tests/unit/species.registry.test.ts diff --git a/tests/unit/state.draftMirror.test.ts b/apps/app/tests/unit/state.draftMirror.test.ts similarity index 100% rename from tests/unit/state.draftMirror.test.ts rename to apps/app/tests/unit/state.draftMirror.test.ts diff --git a/tests/unit/state.localeStore.test.ts b/apps/app/tests/unit/state.localeStore.test.ts similarity index 100% rename from tests/unit/state.localeStore.test.ts rename to apps/app/tests/unit/state.localeStore.test.ts diff --git a/tests/unit/state.practitionerCache.test.ts b/apps/app/tests/unit/state.practitionerCache.test.ts similarity index 100% rename from tests/unit/state.practitionerCache.test.ts rename to apps/app/tests/unit/state.practitionerCache.test.ts diff --git a/tests/unit/state.reportStore.restore.test.ts b/apps/app/tests/unit/state.reportStore.restore.test.ts similarity index 100% rename from tests/unit/state.reportStore.restore.test.ts rename to apps/app/tests/unit/state.reportStore.restore.test.ts diff --git a/tests/unit/state.reportStore.setters.test.ts b/apps/app/tests/unit/state.reportStore.setters.test.ts similarity index 100% rename from tests/unit/state.reportStore.setters.test.ts rename to apps/app/tests/unit/state.reportStore.setters.test.ts diff --git a/tests/unit/state.reportStore.test.ts b/apps/app/tests/unit/state.reportStore.test.ts similarity index 100% rename from tests/unit/state.reportStore.test.ts rename to apps/app/tests/unit/state.reportStore.test.ts diff --git a/tests/unit/ui.Button.test.tsx b/apps/app/tests/unit/ui.Button.test.tsx similarity index 100% rename from tests/unit/ui.Button.test.tsx rename to apps/app/tests/unit/ui.Button.test.tsx diff --git a/tests/unit/ui.Dialog.test.tsx b/apps/app/tests/unit/ui.Dialog.test.tsx similarity index 100% rename from tests/unit/ui.Dialog.test.tsx rename to apps/app/tests/unit/ui.Dialog.test.tsx diff --git a/tsconfig.json b/apps/app/tsconfig.json similarity index 100% rename from tsconfig.json rename to apps/app/tsconfig.json diff --git a/tsconfig.node.json b/apps/app/tsconfig.node.json similarity index 100% rename from tsconfig.node.json rename to apps/app/tsconfig.node.json diff --git a/vite.config.ts b/apps/app/vite.config.ts similarity index 100% rename from vite.config.ts rename to apps/app/vite.config.ts diff --git a/vitest.config.ts b/apps/app/vitest.config.ts similarity index 100% rename from vitest.config.ts rename to apps/app/vitest.config.ts diff --git a/docs/development/IMPLEMENTATION_PLAN.md b/docs/development/IMPLEMENTATION_PLAN.md index 7506ff29..da4d2f68 100644 --- a/docs/development/IMPLEMENTATION_PLAN.md +++ b/docs/development/IMPLEMENTATION_PLAN.md @@ -84,16 +84,22 @@ Name: Monorepo workspace Objective: Move the app to apps/app under a pnpm workspace with zero behaviour change; add CI. Dependencies: Step 1 Changes expected: - - apps/app/{src,public,tests,index.html,vite.config.ts,vitest.config.ts,tsconfig*.json,eslint.config.js,package.json} - - root: pnpm-workspace.yaml (packages: apps/*, packages/*), package.json scripts delegating - (pnpm -r typecheck/test:run/lint/build), shared prettier/editorconfig. - - Dockerfile build context and paths updated; docker/nginx.conf and entrypoint.sh unchanged in behaviour. - - CI pipeline file for the forge in use (none exists today): typecheck, lint, test, build, docker build. - - packages/ directory created empty (no package yet; YAGNI). -Tests: full suite green from apps/app; docker image builds and serves / and /pathology-editor.html. -Manual validation: pnpm dev from root; open /, /new, /editor, /svg-editor, /editors, /pathology-editor.html; export a PDF; docker compose up --build and repeat on :8080. -Definition of Done: identical behaviour, same test count, CI green on the branch, DEPLOY.md paths updated. -Risks: path alias and Vite public dir regressions (caught by the e2e manual script); git history of moved files (use git mv in one commit). + - apps/app/{src,public,tests,scripts,index.html,vite.config.ts,vitest.config.ts,tsconfig*.json,eslint.config.js,package.json} + - root: pnpm-workspace.yaml (apps/*, packages/*), package.json scripts delegating + (pnpm -r typecheck/test:run/lint/build), engines + packageManager, Node 24 pins. + - Dockerfile build context and paths updated; docker/nginx.conf and entrypoint.sh unchanged. + - CI pipeline (.gitea/workflows/ci.yml): install, typecheck, test, lint, build (+ docker job). + - packages/ holds only a README (no empty package). +Tests: full suite green from the root; dist contains the static editor and species assets. +Manual validation: docs/development/WORKSPACE.md §6. +Definition of Done: identical behaviour, same test count, CI file present, docs synced (WORKSPACE.md, CLAUDE.md, README, DEPLOY.md, CHANGELOG). +Risks: path regressions (caught by the suite + dist listing); Docker build not verifiable on a host without a Docker daemon. +Status: DONE 2026-10-08 (branch feature/step-02-monorepo-workspace, uncommitted, awaiting validation). + Facts: 144 files moved with git mv; 271/271 tests, typecheck, lint, build green from the root; + Node 24 LTS adopted (Node 20 EOL 2026-04-30); pnpm 10.13.1 pinned (packageManager + root devDependency); + lockfile rewritten by pnpm 10.13.1 (libc fields left by an earlier pnpm 11 dropped). + Side note: the gitflow finish of Step 1 purged docs/superpowers/{specs,plans} (lib rule BDR-065, + commit 8f217d8 on develop); restore with `git revert 8f217d8` if those design records are wanted. ``` ```text @@ -498,7 +504,7 @@ Per-step table (depends on / unblocks / main risk): | Step | Depends on | Unblocks | Main risk | |---|---|---|---| | 1 Characterisation tests | 0 | 2, 4, 5 | encoding bugs as expected behaviour | -| 2 Workspace | 1 | 3, 4 | path regressions | +| 2 Workspace | 1 | 3, 4 | path regressions (DONE) | | 3 Supabase foundation | 2 | 7, 13 | hosting decision (Q2) | | 4 Sheet model + importer | 1, 2 | 5, 13 | special cases missed (audit 07) | | 5 App on sheet, document v3 | 4 | 6, 14, 17 | core refactor size | diff --git a/docs/development/REPOSITORY_MIGRATION_MAP.md b/docs/development/REPOSITORY_MIGRATION_MAP.md index c41799ba..571d4dc3 100644 --- a/docs/development/REPOSITORY_MIGRATION_MAP.md +++ b/docs/development/REPOSITORY_MIGRATION_MAP.md @@ -137,7 +137,7 @@ cannot ship without migrating it, LOW means it is cosmetic or self-contained. | `docs/PATHOLOGIES-FORMAT.md` | REFACTOR | Becomes the `finding_tree` section of the sheet document spec. | | `docs/ADDING-A-SPECIES.md` | REPLACE | Species are created in the editor. | | `docs/PDF-FORMAT.md` | REPLACE | 12-line placeholder today; written for attachment v3. | -| `docs/superpowers/*` | KEEP | Historical design records. | +| `docs/superpowers/*` | REMOVED | Purged by the gitflow finish of Step 1 (lib rule BDR-065, commit 8f217d8). Recoverable from git history. | | `docs/faunosteo-audit/` | KEEP | Reference for the migration; frozen at `83e40af`. | | `docs/development/` | NEW | This set. | diff --git a/docs/development/WORKSPACE.md b/docs/development/WORKSPACE.md new file mode 100644 index 00000000..1f11603b --- /dev/null +++ b/docs/development/WORKSPACE.md @@ -0,0 +1,117 @@ +# Workspace + +Status: plan Step 2, 2026-10-08. The repository is a pnpm workspace. The +private application was moved under `apps/app` with `git mv` (history kept) +and runs exactly as before; nothing else was extracted. + +## 1. Structure + +```text +faunosteo/ +├─ apps/ +│ └─ app/ @faunosteo/app — Vite + React private application (the current app) +│ ├─ src/ public/ tests/ scripts/ index.html +│ ├─ vite.config.ts vitest.config.ts tsconfig*.json eslint.config.js +│ └─ package.json app dependencies and scripts +├─ packages/ shared code, empty on purpose (see packages/README.md) +├─ docker/ nginx.conf, entrypoint.sh (unchanged) +├─ docs/ conventions, audit, development plan +├─ logos/ brand sources +├─ .gitea/workflows/ci.yml CI (Gitea Actions) +├─ Dockerfile builds apps/app, serves it with nginx (unchanged runtime) +├─ docker-compose.yml .env.example +├─ package.json workspace root: scripts, engines, packageManager +├─ pnpm-workspace.yaml apps/*, packages/*, approved build scripts +├─ pnpm-lock.yaml single lockfile for the whole workspace +├─ .nvmrc .node-version Node 24 +└─ .npmrc supply-chain guard, engine-strict +``` + +Future units, created only by the step that needs them: + +| Path | Role | Created at | +|---|---|---| +| `apps/public-web` | SSR public site (landing, practitioner profiles, search) | plan Step 22 | +| `apps/worker` | Node job runner (emails, expiry, calendar sync, imports) | plan Step 19 | +| `packages/*` | shared domain, anatomy, pdf, i18n, supabase, config, ui | see `packages/README.md` | +| `supabase/` | migrations, functions, seed, tests | plan Step 3 | + +## 2. Why this layout now + +- Root commands stay one word (`pnpm test:run`) and delegate with `pnpm -r`; a developer never needs to `cd`. +- Docker builds one filtered package (`pnpm --filter @faunosteo/app build`) and copies `apps/app/dist`; adding `public-web` or `worker` later is a second stage, not a rewrite of the Dockerfile. +- The lockfile was already v9 (workspace-capable); it now has one importer per package. +- Moving 144 files while the app is small costs one commit; doing it after packages and a second app exist would not. + +Alternatives weighed in `FRONTEND_ARCHITECTURE.md` §2 (app kept at root, single Next.js app): rejected. + +## 3. Node and pnpm + +| Tool | Version | Declared in | +|---|---|---| +| Node | 24 (LTS) | `.nvmrc`, `.node-version`, `package.json` `engines.node` `>=22.12 <25`, `Dockerfile` `node:24-alpine`, CI `node-version-file` | +| pnpm | 10.13.1 | `package.json` `packageManager`, `engines.pnpm` `>=10.13 <11`, root `devDependencies.pnpm` (so `node_modules/.bin/pnpm` exists for the root scripts), `Dockerfile` `corepack prepare pnpm@10.13.1` | + +Why Node 24: Node 20 reached end-of-life on 2026-04-30, the development host +already runs 24, and every check of Steps 1 and 2 ran on 24.21.0. +Why pnpm 10.x and not 11: pnpm 11 requires Node ≥ 22.13 *and* rewrites the +lockfile; 10.13.1 is the version the Dockerfile was validated with (BLK-005). +`engine-strict=true` in `.npmrc` makes `pnpm install` refuse a wrong Node, so +the mismatch is visible at the first command instead of in a test. + +Bootstrapping without a global install: + +```bash +corepack enable # once per machine; picks pnpm@10.13.1 from package.json +pnpm install # or: corepack pnpm install +``` + +If `corepack enable` cannot write to the Node bin directory, every command also +works as `corepack pnpm `. + +## 4. Commands (from the root) + +| Command | Does | +|---|---| +| `pnpm install` | installs the whole workspace from the lockfile | +| `pnpm dev` | Vite dev server of `apps/app` on :5173 | +| `pnpm preview` | serves `apps/app/dist` on :4173 | +| `pnpm typecheck` | `tsc --noEmit` in every package | +| `pnpm test:run` | vitest once in every package | +| `pnpm test` | vitest watch for `apps/app` | +| `pnpm lint` | ESLint, 0 warnings, in every package | +| `pnpm build` | typecheck + Vite build in every package | +| `pnpm check` | typecheck, test:run, lint, build in sequence (what CI runs) | +| `pnpm format` | Prettier on the whole repository | +| `pnpm scaffold:species` | legacy species scaffold (slated for removal) | + +Package-scoped: `pnpm --filter @faunosteo/app