mix malachi.tokens (malachi v0.22.7)

View Source

Generates the design token outputs from docs/design/design-tokens.json, or checks them.

mix malachi.tokens          # write the four generated files
mix malachi.tokens --check  # fail unless they match the token file, as CI does

docs/design/design-tokens.json is the one place the web console, the terminal interface and any server rendered page take a color, a size or a duration from. This task generates, from it:

  • assets/src/styles/tokens.css, the web console's custom properties;
  • tui/src/theme/generated.rs, the terminal palette in truecolor, 256 and 16 colors;
  • lib/malachi/ui/tokens.ex, Malachi.UI.Tokens;
  • docs/design/tokens.snapshot.json, the flat view the contract tests compare the others against.

Nothing is written when the token file breaks a rule or fails a gate (contrast, color vision, colors kept apart, gamut, terminal distinctness); every reason is listed instead. See Malachi.UI.TokenGen.

--check regenerates in memory and fails on any output that is missing or differs from what the token file produces, on a committed output that breaks the cross language contract, and on a raw color literal anywhere in assets/src or tui/src outside the generated files. The fix for the first two is to run the task without --check and commit the result; for the third, use a token.

--root points the task at another checkout. It exists for the tests, which run it against a scratch tree; everywhere else the task runs from the repository root without it.