Docs: DESIGN.md as a current-state page; 2026-11-10 history and module map

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
RobinFiredrake 2026-11-10 20:36:02 -06:00
parent 99f4d21911
commit 650e24e9b7
3 changed files with 129 additions and 103 deletions

View file

@ -139,6 +139,31 @@ templates/ built-in templates · examples/logic_demo.json (original demo board)
- ui: choice_dialog, inspector_card, inspector, main, edit_history
- io: json_io
## 3b. Modules added 2026-11-10
- **Theme:** `ui/style.gd` (tokens, `fill_texture`, `panel_box`), `ui/theme_store.gd`,
`ui/builtin_themes.gd`, `ui/theme_dialog.gd`, `ui/fill_editor.gd`, `ui/color_choice.gd`.
- **Card visuals and input:** `ui/card_frame.gd` (border + shader), `ui/card_grip.gd` (resize),
`ui/card_shield.gd` (zoomed out), `ui/sparkles.gd`; TableCard helpers `table_card_skin/input/
geometry/list/kind_rows.gd` (next to header/rows/editing/value/text).
- **Menus and selection:** `ui/actions.gd` (all menus), `ui/main_selection.gd` (groups in the
selection), `ui/main_layout.gd` (Main's layout, saving, mode, input; Main keeps delegators).
- **Lists and phones:** `ui/list_view.gd`, `ui/list_tree.gd`, `ui/list_order.gd`,
`ui/mobile_layout.gd`, `ui/touch_input.gd`.
- **Book and pictures:** `core/book_page.gd`, `core/board_images.gd`, `ui/book_panel.gd`,
`ui/page_editor.gd`, `ui/image_field.gd`. `TowerBoard` has `book`, `images`, nesting helpers
(`tables_in`, `groups_in`, `hidden_by`, `set_group_parent`).
- **Roll features:** `core/roll_combine.gd` (Roller.OP_COMBINE), `core/roll_costs.gd`, pause in
`core/roller.gd` (OP_PAUSE) + `ui/roll_pauses.gd`, `RollRange.limit` (floor/ceiling),
`ui/batch_roll.gd`. Each roll's token lives in a holder dict in MainRolling so a paused roll
can be revived.
- **Output and help:** `ui/sheet_export.gd`, `core/demo_spreads.gd`, `ui/demo_mode.gd`.
- **Splits (audit):** `ui/inspector_result/thread/sync.gd`, `ui/inspector_threads.gd`,
`core/describe_cards.gd`, `core/describe_why.gd`, `io/json_canon.gd`, `io/json_links.gd`,
`ui/choice_preview/chrome/option_row.gd`, `ui/edit_labels.gd`.
- **New JSON keys** (all optional; JsonCanon passes them through): spread `book`, `images`;
group `parent`; table `color`, `w`, `list_h`, `roll_floor`, `roll_ceiling`, `deck_empty_text`;
result `page`, `image`, `cost {value, amount}`; thread `color`, `combine`, `pause`.
## 4. Data and storage
- **Collections:** `user://collections/<id>.json`, format_version 2 (`{format_version, id,
name, tables, groups?}`). On Linux that's `~/.local/share/godot/app_userdata/TableTower/`.

View file

@ -1,16 +1,18 @@
# Table Tarot (repo: TableTower) — Status and Plan
**Engine:** Godot 4.7.2 (GDScript) · **Started:** 2026-11-08 · **Last updated:** 2026-11-10 (plan steps 1–12 done; merged to main 2026-11-10)
**Engine:** Godot 4.7.2 (GDScript) · **Started:** 2026-11-08 · **Last updated:** 2026-11-10 (the
2026-11-10 plan is finished and on `main`)
The short page to read at the start of every session. Everything else is read only when needed:
- `docs/ARCHITECTURE.md`: feature summary, file map, key implementation facts, data/storage, known gaps.
- `docs/HISTORY.md`: decisions on record, the private Traveller board, the old ideas list, history.
- `docs/ARCHITECTURE.md`: feature summary, file map (§3b lists the 2026-11-10 modules), storage, known gaps.
- `docs/HISTORY.md`: decisions on record, the Traveller board, ideas, history (§11: the 2026-11-10 plan).
- `docs/LOGIC.md` (rule language), `docs/PLAIN.md` (plain-language layer), `README.md` (CLI flags).
## 1. What it is
A desktop (soon Android) app for building **random roll tables** as cards on a board, joined by
threads (code: pipes). A roll flows card to card; a logic layer adds choices, values, repeats,
branches and sheets.
A desktop (and, once built, Android) app for building **random roll tables** as cards on a
**spread**, joined by **threads**. A roll flows card to card; a logic layer adds choices, values,
repeats, branches and sheets. Themed as tarot: purple cloth, beaded card frames, a fortune-teller
mascot (`assets/art/fortune_teller.svg`, logo variant `fortune_teller_logo.svg`, splash uses the PNG).
**Product principles (from the user)**
- **General-purpose.** The Traveller board is only a capability test. No game-specific features.
@ -18,108 +20,74 @@ branches and sheets.
- **Plain words by default**; rule text stays stored and reachable ("Edit as text").
- **Themed names are welcome** as long as they stay easy to understand.
## 2. Names (decided 2026-11-10; UI text only; code and JSON keys keep old names)
| UI word | Was (UI) | Code / JSON |
|---|---|---|
| Table Tarot (app) | TableTower | project, classes, `user://` folder unchanged |
| Spread (a saved set of cards) | Board / Collection | `TowerBoard`, `LibraryStore`, `collections/` |
| Thread | Pipe | `pipes`, `PipeLayer` |
| Deck mode | Card mode | `card_mode` |
| Book / Page (reusable results) | — | new |
| Branch (if… / otherwise) | Router | `router` |
| Repeat | Loop | `loop` |
The Collection *card kind* needs a new UI name (not "List", not "Collection"); undecided.
## 2. Names (UI text only; code, JSON keys and the project's internal name are unchanged)
| UI word | Code / JSON |
|---|---|
| Table Tarot (app; window title set at runtime) | project `config/name="TableTower"`, so `user://` didn't move |
| Spread (a saved set of cards) | `TowerBoard`, `LibraryStore`, `collections/` |
| Thread | `pipes`, `PipeLayer` |
| Deck mode | `card_mode` |
| Book / Page (reusable results) | `book`, `BookPage`, `TableEntry.page` |
| Branch / Repeat (card kinds) | `router` / `loop` |
The Collection *card kind* still needs a new UI name (not "List", not "Collection").
Card, Result, Change, Reset, Dice wording rules: `docs/HISTORY.md` §6 "Terminology".
## 3. Plan (agreed 2026-11-10, in order)
Merged to `main` 2026-11-10 (branch `tarot` is the same). Details in `git log`.
1. **Theme system: done.** `Style` colours are static-var tokens named by role; `ThemeStore`
applies sets (built-ins in `BuiltinThemes`: Tarot default, Felt), saves user sets in
`user://themes/`; View ▾ → Theme… (`ThemeDialog`, `FillEditor` for gradients). Applying
reloads the scene (`ThemeStore.carry_board` keeps the open spread). Per-card
(`RollTable.color`) and per-thread (`TableEntry.pipe_color`) colours via `ColorChoice` and
right-click Colour ▸. **Not done:** font choice (only Atkinson + Rokkitt are bundled; add
OFL fonts first), card/thread art per theme beyond the frame on/off.
2. **Rename and reskin: done.** UI text only (code names, JSON keys and the project's internal
name, so `user://`, unchanged). Logo `assets/art/fortune_teller_logo.svg` (the art minus its
background square), app icon = mascot. `CardFrame` draws the beaded border (shader recolours
to TRIM or the card colour). `Sparkles` (CPU particles) on the thread pulse and on landing
results. Thread string art: waiting on the user's drawings.
3. **Board interaction: done** except two-finger touch pan (do with mobile). No walls; Build
drag on empty = selection box (Ctrl/Shift adds); middle-drag / Space+drag pans (Play: plain
drag pans too); `MainSelection` box-selects groups and drags the whole selection; `CardGrip`
resizes cards (`RollTable.width`, `list_height`).
4. **One menu system: done.** `Actions` builds card/thread/group/background menus for
right-click, the ⋯ buttons and the top bar's ☰. Below 45% zoom `CardShield` covers cards
(name tooltip, drag, right-click, Play click rolls). Long-press on touch: with mobile.
5. **Small UI items: done.** Bold chip sources, Threads in/out in the inspector
(`InspectorThreads`), backwards ranges warn and block rolling, template Replace and Edit…,
Other formats submenu, plain Test spread hints.
6. **Deck mode: done.** Faded drawn results, inspector Deck mode section, Wait for Shuffle with
an Empty result (`deck_empty_text`), Shuffle all decks.
7. **Nested groups, List view, phone layout: done.** `TableGroup.parent` nests groups
(`TowerBoard.tables_in/groups_in/hidden_by`); `ListView` + `ListTree` + `ListOrder` (folders =
groups, drag to reorder/move, own search, thread counts with tooltips); `MobileLayout`
(`--mobile` to try) and `TouchInput` (long press = right-click, two-finger pan/pinch).
Android export templates installed (checksum verified). **Not done:** the Android SDK
(build-tools, platform-tools) isn't installed, so no APK yet: ask the user before downloading;
no Android preset in `export_presets.cfg` (the user has uncommitted edits there).
8. **Book and Pages: done.** `BookPage` in the spread file (`"book"`), `TableEntry.page` links a
result (edit the page → every copy changes; editing the result's own text unlinks). `BookPanel`
+ `PageEditor`; drop a page on a result or a card (handled on drag end, since text fields eat
drops). Undo covers the Book. **Not done:** images on pages (step 11).
9. **Roll features: done.** `RollCombine` (thread "then": keep all / add / highest / lowest /
let me choose; Roller.OP_COMBINE), `BatchRoll` (Roll several times…), pause (`pipe_pause`,
Roller.OP_PAUSE, `RollPauses` chips with set-aside and Continue), `RollCosts` (option costs,
greyed out when unaffordable), roll floor/ceiling (`roll_floor`, `roll_ceiling`: "adjust later
rolls"). Open question for the user: should a "reroll" result that comes up during its own
reroll be ignored and rolled again (common table rule)? Not implemented.
10. **Sheets: done.** Sheet inspector "+ Add a line for" a value; tray Copy ▾ → Save as a file
(Text / Markdown / HTML, `SheetExport`).
11. **Pictures: done.** `TableEntry.image`, `BookPage.image`, stored as WebP base64 in the spread
(`BoardImages`, ≤512 px, only used ones saved); thumbnail on rows, picture in the details pop-up.
Not inline in BBCode (Godot's labels can't load outside images). JSON import/export now passes
every new key (it used to drop unknown keys; round-trip test in test_book).
12. **Help: done.** New topics, shortcut cheat sheet, `[demo]key[/demo]` links → `DemoSpreads` +
`DemoMode` (unsaved, unlisted; Keep a copy / Back).
## 3. Where things stand (2026-11-10)
- **Everything from the 2026-11-10 plan is built, tested and on `main`** (pushed): theme system,
rename and reskin, spread interaction, menus, Deck mode, nested groups, List view, phone layout,
the Book, roll features (combine, batches, pause, costs, limits), sheet export, pictures, Help
with demo spreads, splash screen. Summary in HISTORY.md §11; module map in ARCHITECTURE.md §3b.
- **First user playtest found two bugs, both fixed:** the card resize corner caught clicks far
outside cards; a left-drag on empty space panned instead of selecting. Now a left-drag draws a
selection box in Play and Build; panning is middle-drag or Space+drag.
- **Audits done:** the seven files over 600 lines were split into helpers; tests share `TestBase`.
- **The user is playtesting.** Expect more bug reports; fix them first.
**Next, for the user to decide:** hands-on playtest of everything above
(nothing was tried by hand, only tests and screenshots); Android SDK download for an APK; extra
OFL fonts for the theme font choice; a new UI name for the Collection card kind; the reroll rule
question in step 9; thread string art when drawn.
## 4. Open items
**Waiting on the user**
- Android: export templates are installed (checksum verified); the Android SDK (build-tools,
platform-tools) is not. Ask before downloading. No Android preset yet.
- Fonts: the theme editor has no font choice until more OFL fonts are bundled.
- A UI name for the Collection card kind.
- Reroll rule: should a "reroll" result that comes up during its own reroll be ignored and rolled again?
- Thread string art (the user will draw it), then use it like `CardFrame` does for cards.
- Repo privacy on Forgejo: needs Niles/sock's username and a token from the user.
**Audits done (2026-11-10).** The seven files over 600 lines were split into helpers with
one-line delegators (inspector → inspector_result/thread/sync; describe → describe_cards/why;
json_io → json_canon/links; choice_dialog → choice_preview/chrome/option_row; table_card →
table_card_skin/input/geometry/list/kind_rows; main → main_layout; edit_history → edit_labels).
Still over ~450: inspector_card (591), roll_table (569), expr (544), main_cli, board_tester (505),
builder, roller, tower_board, group_card. Tests extend `TestBase` (`tests/testbase.gd`: named so the
runner's `test_*.gd` glob skips it): `start_main()`, `require_sample()`, `_check`, `_eq`, `_frames`,
`finish()`.
**Known, not urgent**
- `export_presets.cfg` has the user's uncommitted edits (a Windows preset). Its `include_filter`
is empty, so Windows builds lack `help/*.txt` and `templates/*.json` (the Linux preset has them).
Tell the user rather than editing their file.
- Still over ~450 lines: inspector_card (591), roll_table (569), expr (544), main_cli, board_tester
(505), builder, roller, tower_board, group_card. Split when next touched.
- Known gaps: ARCHITECTURE.md §7.
**Still open from before:** repo privacy on Forgejo (waiting on the user: Niles/sock's username +
token); hands-on playtest; size audit of `core/describe.gd` (731 lines) and the other files over
~530 lines (list in ARCHITECTURE.md §3); known gaps in ARCHITECTURE.md §7.
## 4. Working on it
- **Godot:** `~/apps/Godot_v4.7.2-stable_linux.x86_64`. After adding `class_name` files run
`godot --headless --path . --import` first.
- **Tests:** `tools/run_tests.sh [filter]`: parallel, ~20 s, one line per suite, fails on SCRIPT
ERROR too. Prints details only for failures. Use it instead of the old for-loop.
- **Smoke test:** `godot --headless --path . --quit-after 120 -- --sample` (no SCRIPT ERROR).
- **Simulator:** `godot --headless --path . -s res://tools/simulate_board.gd -- --board=<json> --start=<id> --runs=N [--check] [--quiet]`.
## 5. Working on it
- **Godot:** `~/apps/Godot_v4.7.2-stable_linux.x86_64`. New `class_name` files need
`godot --headless --path . --import` (the test runner does this).
- **Tests:** `tools/run_tests.sh [filter]`: 36 suites in parallel, ~35 s. One line per suite; a
failing suite prints 8 lines; a compile error shared by many suites prints once. Suites extend
`TestBase` (`tests/testbase.gd`, named so the `test_*.gd` glob skips it): `start_main()`,
`require_sample()`, `_check`, `_eq`, `_frames`, `finish()`.
- **Smoke test:** `godot --headless --path . --quit-after 120 -- --sample` (no SCRIPT ERROR; the
"resources still in use at exit" line is normal).
- **Windowed runs/screenshots: always `tools/test_window.sh -- --sample --screenshot=/path.png [flags]`**
(KWin rule keeps it in the background; never plain `godot --path .`; don't minimize). Flags are in
`ui/main_cli.gd`. Launching for the user to look at: plain `godot --path .` in the background.
- **Keep files under ~400 lines**; split by area into RefCounted helpers holding `m: Main` with
one-line delegators. Reuse shared builders (list in ARCHITECTURE.md §3).
- **Coderstanding** (structure scanner) for audits:
clone https://forgejo.smhub.duckdns.org/digit/coderstanding into the scratchpad, venv,
`pip install`, `XDG_CONFIG_HOME=<scratch>/xdgconf`, `coderstanding add tabletower <repo> --data
<scratch>/cs_data`. Commands: `outline`, `hotspots`, `dupes`, `warnings`, `find`, `uses`, `brief`.
(KWin rule keeps it in the background; never plain `godot --path .`; don't minimize). Useful flags:
`--build`, `--roll=ID`, `--view=x,y,zoom`, `--window=WxH`, `--mobile`, `--list`, `--book`,
`--demo=KEY`; all in `ui/main_cli.gd`. If a run is interrupted it leaves `override.cfg` behind:
delete it before the next run.
- **Keep files under ~400 lines**; split by area into RefCounted helpers with one-line delegators.
- **GDScript traps hit today:** don't name methods `_set`, `_get` or `convert` (built-ins); compare
roll-node Dictionaries with `is_same()`, not `==` (it compares contents); in Python patch
scripts, avoid apostrophes inside single-quoted replacement strings.
- **Git:** origin `git@forgejo.smhub.duckdns.org:RobinFiredrake/TableTower.git`. Feature branch,
fast-forward merge to `main` when the user asks. Co-Authored-By line on commits.
- **Agents:** only for large, separate features (each rereads context). Worktree briefs start with
`git reset --hard <branch>`, own specific files, keep public APIs as delegators. Remove worktrees
after merging.
- **Keep this page short.** Update §3 as items land; put history in HISTORY.md, not here.
- **Agents:** only for large, separate jobs. Worktree briefs start with `git reset --hard <branch>`,
own specific files, keep public APIs as delegators, don't touch tests. The user's computer has
been crashing: an interrupted agent's work stays in `.claude/worktrees/`; resume it with
SendMessage ("don't reset"), then cherry-pick its commit and `git worktree remove -f -f`.
- **Token savings:** read only this page at the start; read the other docs on demand; keep tool
output short (the test runner already does); avoid viewing full-size screenshots (crop/resize).
- **Coderstanding** (structure scanner) for audits: clone
https://forgejo.smhub.duckdns.org/digit/coderstanding into the scratchpad, venv, `pip install`,
`XDG_CONFIG_HOME=<scratch>/xdgconf`, `coderstanding add tabletower <repo> --data <scratch>/cs_data`.
- **Keep this page short.** Put history in HISTORY.md and file maps in ARCHITECTURE.md.

View file

@ -152,3 +152,36 @@ Read on demand. Status and plan: `docs/DESIGN.md`.
**2026-11-09: fan-out fix**
14. A range on a ranged table can pipe into several cards; a new pipe no longer replaces the old one.
## 11. The 2026-11-10 plan: Table Tarot (all merged to `main`)
**Agreed with the user:** theme first; names Spread / Thread / Deck mode / Book and Pages /
Branch / Repeat; walls removed; middle-drag or Space+drag pans; a visible ☰ menu as well as
right-click; set a paused roll aside with a Continue chip; Text/Markdown/HTML instead of PDF;
cards resize in both directions with scrolling results; only "Router" → "Branch", "Loop" →
"Repeat" and odd export formats under "Other formats" from the programmer-y list; Android
export template download approved.
15. **Token diet 2.** DESIGN.md slimmed (architecture and history split out); `tools/run_tests.sh`.
16. **Theme system.** Style tokens by role as static vars; `ThemeStore` + `BuiltinThemes` (Tarot,
Felt) + `ThemeDialog`/`FillEditor`; per-card and per-thread colours.
17. **Reskin.** UI rename; logo, icon, splash; `CardFrame` beaded borders (recolouring shader);
`Sparkles` on the thread pulse and landing results.
18. **Spread interaction.** No walls; selection box; `MainSelection` (groups in the selection);
`CardGrip` resizing; `CardShield` below 45% zoom.
19. **Menus.** `Actions` feeds right-click, ⋯ buttons and ☰.
20. **Small items.** Bold chip sources, `InspectorThreads`, backwards ranges block rolling,
template Replace/Edit…, Other formats submenu.
21. **Deck mode.** Faded drawn results, inspector section, Wait for Shuffle + Empty result, Shuffle all.
22. **Nested groups** (`TableGroup.parent`), **List view** (`ListView`/`ListTree`/`ListOrder`),
**phone layout** (`MobileLayout`, `TouchInput`).
23. **The Book** (`BookPage`, `BookPanel`, `PageEditor`; linked results; undo covers it).
24. **Roll features.** `RollCombine`, `BatchRoll`, pause (`RollPauses`), `RollCosts`,
`roll_floor`/`roll_ceiling`.
25. **Sheets and pictures.** `SheetExport`; `BoardImages` (WebP in the spread file).
**Fix:** JSON export/import (`JsonIO.canonical`) used to drop every unknown key; it now keeps
all of the above (round-trip test).
26. **Help.** New topics, shortcut sheet, `DemoSpreads` + `DemoMode`.
27. **Playtest fixes.** Resize corner caught clicks outside the card (unbounded `_has_point`);
left-drag now selects in Play too.
28. **Audits.** Seven 600+-line files split by parallel agents; tests share `TestBase`. Two
computer crashes mid-run; agents were resumed from their worktrees.