Initial TTRPG character meta-builder with visual sheet editor.

Offline Electron app seeds 10 system presets, supports create-from-scratch designer with palette/drag/resize/bricks, and exports .ttrpg-system.json for the player.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ivan Fontosh
2026-09-12 14:49:31 +08:00
commit d1f180ee0a
44 changed files with 10548 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
# ADR-001: Stack and storage
## Decision
Electron + React + TypeScript + Vite; SQLite with JSON documents for systems/characters; portable `app/shared` contract for future TTRPG Player + mobile.
## Rationale
Matches TTRPG Player packaging targets; offline-first; no Postgres.
# ADR-002: Formula DSL
## Decision
Custom minimal expression language (`floor`, `ceil`, `round`, `min`, `max`, `clamp`, arithmetic, `attr.*` / `skill.*` / `resource.*` / `derived.*`).
## Rationale
Same evaluator can be copied into the player; explicit rounding; no heavy CEL/JSONata dependency.
# ADR-003: Schema freeze via snapshotHash
## Decision
Player binds store `snapshotHash` (content-addressed) rather than inline full schema per character.
## Rationale
Implements freeze-on-bind without bloating `players.json`.
# ADR-004: Spells from dnd.su
## Decision
Provide an import pipeline for PHB-labelled spells from dnd.su at product owner request, with README/IP disclaimer. Prefer SRD stubs in default presets.
## Rationale
Owner requested PHB coverage; redistribution risk acknowledged.
+27
View File
@@ -0,0 +1,27 @@
# Testing
## Layers
- **Unit** (`tsx --test`): `app/shared/*` — formula, derived, creation, snapshot, system validate
- **Integration**: SQLite store (builder), GameSystemsStore (player)
- **E2E** (Playwright Electron): functional asserts — not smoke-only (see plan)
## Commands
```bash
# builder
npm test
npm run test:e2e # when e2e suite is added
# player (meta_builder)
npx tsx --test app/main/gameSystems/gameSystemsStore.test.ts
npx tsx --test app/shared/characterSheet/core.test.ts
```
## Preset smoke
```bash
node scripts/preset-smoke.mjs
```
Validates every `presets/*.json` (except samples) via `validateSystemDefinition` + sample derived compute.