Workflow guide for authoring the bible into markdown now that engine
prereqs have shipped. Suggests slicing by region rather than by kind so
each PR produces a playable surface.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
After each state-mutating dispatch, evaluate world.endings in priority
order (true > wrong > bad). The first whose whenFlags are all satisfied
sets state.endedWith and appends a kind:'ending' transcript line. Once
ended, further dispatches return a "story has ended" narration.
Also update test-world fixtures and placeholder ending markdown files
to use whenFlags: { _never: true } instead of {} so that vacuously-true
empty flags don't accidentally fire on every successful turn.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Adds the new schema flags and per-state body sections so the dispatcher's
new verb handlers have content to narrate.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Existing items with no body sections continue to load unchanged. New items
can author per-state prose in dedicated sections; the dispatcher will read
these in subsequent commits.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Optional fields used by the new read/light/extinguish dispatcher branches.
Loader updates and dispatcher logic follow.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- Validate lockedExits[*].requires resolves to a known item or flag
- Throw if any of true/wrong/bad ending markdown files are missing
- Detect malformed ## headers (spaces, dots, etc.) and throw a clear
error rather than silently dropping the section
Tests: 86 passing.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
gray-matter eagerly loads Node's Buffer API path even when only
matter(rawString) is called, crashing browser bundles. Replace it with
an inline frontmatter parser backed by the browser-safe yaml package.
All 84 mystery tests pass; build is clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rooms, items, and endings now come from .md files under world/{rooms,items,endings}/.
Encounters still come from encounters.ts (Tasks 11–12 will complete that leg).
Cross-reference validation at module init ensures exits, item refs, and encounter
refs are all consistent. Deletes rooms.ts, items.ts, roundtrip.test.ts, and the
one-shot migration script (whose output is already committed).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds scripts/migrate-mystery-content.ts which reads rooms, items,
encounters, and endings from TypeScript source and emits byte-identical
markdown files under src/mystery/world/{rooms,items,encounters,endings}/.
Installs tsx as a devDep to support .ts imports across src/ during the
one-shot run.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>