From ce214ab70ceeb618badf2c98f74a5b29eacf6236 Mon Sep 17 00:00:00 2001 From: Alexander Zielonka Date: Mon, 27 Apr 2026 14:53:46 +0200 Subject: [PATCH] fix(01-03): align Foundry path with pf2e-8.0.3 layout - Foundry pf2e v8 nests pf2e packs under packs/pf2e/ (v7 had packs/classes/ directly) - Update FOUNDRY_CLASSES_DIR path to packs/pf2e/classes/ - Document v8 layout in SEED-README and update failure-mode path string - Pitfall #5 mitigation: comment in seed script explains version-specific path Worked-example verification (Wizard end-to-end): - 320 ClassProgression rows seeded (16 classes x 20 levels) - Wizard L1..L19 carry ARCANE spell-slot increments + L1 has 5 cantrips - Wizard L1 has choiceType=school, choiceOptionsRef=wizard-school - 1 ClassFeatureOption row for wizard-school (battle-magic / School of Battle Magic) - Idempotent on re-run: 0 created, 320 updated, 0 errors --- .../01-level-up-pf2e-regelkonform/SEED-README.md | 9 ++++++++- server/prisma/seed-class-progression.ts | 12 +++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.planning/phases/01-level-up-pf2e-regelkonform/SEED-README.md b/.planning/phases/01-level-up-pf2e-regelkonform/SEED-README.md index 24ed405..f628dda 100644 --- a/.planning/phases/01-level-up-pf2e-regelkonform/SEED-README.md +++ b/.planning/phases/01-level-up-pf2e-regelkonform/SEED-README.md @@ -35,9 +35,16 @@ npm run db:seed:class-progression Idempotent: running twice does not duplicate rows. Console output reports `created` and `updated` counts plus any errors. +## Foundry pf2e v8 layout note + +In Foundry pf2e v8 (the pinned tag `pf2e-8.0.3`), class JSONs live under +`packs/pf2e/classes/`. Earlier major versions (v7) used `packs/classes/` directly. The +seed script reads from the v8 path; if you bump the pinned tag back to a v7 release, +update `FOUNDRY_CLASSES_DIR` in `server/prisma/seed-class-progression.ts` accordingly. + ## Failure modes -- **"Foundry pf2e clone not found at server/prisma/data/foundry-pf2e/packs/classes/"** — +- **"Foundry pf2e clone not found at server/prisma/data/foundry-pf2e/packs/pf2e/classes/"** — run the `git clone` step above. - **"Class JSON does not match expected schema"** — Foundry pf2e changed the JSON shape between major versions. Update the seed parser or pin to an older tag. diff --git a/server/prisma/seed-class-progression.ts b/server/prisma/seed-class-progression.ts index da29fab..8652c70 100644 --- a/server/prisma/seed-class-progression.ts +++ b/server/prisma/seed-class-progression.ts @@ -28,7 +28,17 @@ import { CLASS_FEATURE_OPTIONS } from './data/class-feature-options'; const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL }); const prisma = new PrismaClient({ adapter }); -const FOUNDRY_CLASSES_DIR = path.join(__dirname, 'data', 'foundry-pf2e', 'packs', 'classes'); +// Foundry pf2e v8 nests packs under a system subdirectory: `packs/pf2e/classes/`. +// (RESEARCH §Pitfall 5: Foundry pf2e data shape may shift across major versions. +// In v7 this was `packs/classes/`. SEED-README pins us to pf2e-8.0.3.) +const FOUNDRY_CLASSES_DIR = path.join( + __dirname, + 'data', + 'foundry-pf2e', + 'packs', + 'pf2e', + 'classes', +); // The 16 D-16 classes. Filename in Foundry = lowercase classname. const D16_CLASS_NAMES = [