feat: markdown → scenario-data generator (tools/)

Add a deterministic authoring tool that turns a structured scenario
markdown file into a validated scenario-data module:
- tools/scenario-md.js: pure parseScenarioMarkdown + emitScenarioModule
  (frontmatter → meta; ## Timeline/## Clues/## Cast lists → the arrays;
  auto-slugged ids; validated via validateScenario before emit).
- tools/md-to-scenario.mjs: CLI (npm run gen:scenario), file or stdout.
- tools/example-scenario.md: documented format example.

Parses a defined format, not freeform con prose. tools/ is dev-only and
never bundled. tests/tools/scenario-md.test.js round-trips + validates.
187 tests pass; build clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
slaguru666
2026-07-20 23:33:28 +01:00
co-authored by Claude Opus 4.8
parent 6d529c9799
commit 7c6ee3eecc
7 changed files with 390 additions and 3 deletions
+2 -1
View File
@@ -8,7 +8,8 @@
"build": "vite build",
"preview": "vite preview",
"test": "vitest run",
"test:watch": "vitest"
"test:watch": "vitest",
"gen:scenario": "node tools/md-to-scenario.mjs"
},
"devDependencies": {
"jsdom": "^24.0.0",