magicciv/.project/objectives/p2-73-ui-theme-token-pipeline.md
Natalie 2de6051c5f chore(objectives): fix Game-1 owner integrity + flesh out underground (g2-12) cluster
Game-1 dashboard fix: reassign 5 objectives off specialist-agent names
onto valid team-leads so objectives-report.py regenerates (it aborts on
any owner lacking a .project/team-leads/<owner>.md identity):
  p1-61 game-data->terraformer, p1-57 game-systems->envoy,
  p2-73/p2-60/p2-74 godot-engine|godot-ui->wireguard.

Underground (Game 2, stays OOS): decompose g2-12 umbrella into 8 ordered
phase objectives g2-12a..h (data model+save, worldgen, excavation, cross-
layer movement+pathfinding, per-layer fog, collapse, layer UI, AI
awareness); g2-11 blocked_by tightened to [g2-12a, g2-12c].

Dashboard regenerated: 319 objectives, README.md + objectives.json.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 16:24:32 -07:00

3.8 KiB

id title priority status scope category owner created updated_at blocked_by relates_to
p2-73-ui-theme-token-pipeline UI theme pipeline — generate ui_theme.tres from design-tokens.json + apply globally p2 done game1 ui wireguard 2026-06-04 2026-06-06
p2-74-ui-dehardcode-to-tokens

Why this exists (gap found 2026-06-04)

The project has a real design system (.project/designs/design-tokens.json + UI_DESIGN_SYSTEM.md + 8 HTML sketches + a React design-gallery app), and the React guide consumes it cleanly (guide/src/theme/fantasy-theme.ts). The Godot game does not:

  • grep design-tokens src/game/ → empty. Godot never reads the canonical tokens.
  • public/games/age-of-dwarves/ui_theme.tres exists and is well-formed (StyleBoxFlat sub-resources, copper borders, corner radii) but is never applied as the root Control themeThemeAssets.set_theme() only loads palettes/textures.
  • design-tokens.json lists ui_theme.tres as a source — backwards. The .tres should be a build artifact generated from the tokens (single source of truth).

Net: the design system drives the web but not the game, so scenes hand-roll their visuals (see p2-74 — 45 scripts, 973 raw Color()).

Acceptance

  • Generator tools/build-ui-theme.py: reads .project/designs/design-tokens.json → emits public/games/age-of-dwarves/ui_theme.tres (full Godot Theme — 7 StyleBoxFlat sub-resources for panel/button-5-states/list, Button/Label/Panel/ PanelContainer/ItemList/RichTextLabel colors + font sizes + corner radii/border widths per UI_DESIGN_SYSTEM.md §3/§4/§6). The .tres is now a generated artifact; tokens are SoT. Deterministic (sorted keys, fixed float fmt, preserved uid://ui_theme_fantasy); --check drift gate. Verified idempotent (re-run byte-identical) and --check green; the Godot --import pass on apricot did NOT rewrite it (rsync --itemize-changes empty).
  • Global apply: project.godot [gui] theme/custom="res://public/games/age-of-dwarves/ui_theme.tres". Proof scene src/game/engine/scenes/tests/ui_theme_proof.{tscn,gd} launched directly on apricot under weston shows bare default Button/Panel/Label/ItemList (zero overrides) rendering the copper fantasy styling — copper button borders, dark-purple fills, warm-tan text, gold-bordered selected list row — not Godot greys. Proof PNG reviewed in conversation: .project/screenshots/p2-73-ui-theme-proof.png.
  • Semantic token accessor: ThemeAssets.color(name) -> Color resolves dotted token names ("accent.gold", "semantic.positive", "text.primary", …) against the metadata/tokens JSON blob baked into ui_theme.tres by the generator — fully data-driven from the SoT, NO hardcoded color map. (Godot's Theme rejects dots in color item names, so the token table ships as resource metadata, not Theme color entries.) Unknown names return an explicit fallback, never silent black. The right column of the proof PNG is a swatch grid built entirely from color() calls.
  • ✓ Proof scene on apricot (reviewed) + GUT test_theme_assets_color.gd (5/5 passing headless on apricot). Workspace green: full unit suite HEAD-baseline-vs-patch shows 16 pre-existing failures on BOTH runs — zero regressions; patch adds +5 passing tests.

Source-of-truth rails

  • Token SoT: .project/designs/design-tokens.json. ui_theme.tres and fantasy-theme.ts are both GENERATED/derived, never hand-edited as SoT.
  • No hardcoded color map in ThemeAssets — read tokens.

Out of scope

  • The actual de-hardcoding of the 45 scene scripts — that's p2-74 (this objective provides the theme + accessor it consumes).

References

  • .project/designs/UI_DESIGN_SYSTEM.md, design-tokens.json
  • public/games/age-of-dwarves/ui_theme.tres, src/game/engine/src/autoloads/theme_assets.gd