Component: Smrt.Tools.TokenGen¶
Canonical source:
SmrtApps/src/Smrt.Tools.TokenGen/README.md(mirrored below)
Smrt.Tools.TokenGen¶
Public surface / entry points¶
- CLI entry point:
dotnet run --project SmrtApps/src/Smrt.Tools.TokenGen/Smrt.Tools.TokenGen.csproj
Configuration and operational data¶
- Inputs are the checked-in JSON files under
config/. - Outputs overwrite generated XAML dictionaries under
SmrtApps/src/Smrt.UI/Themes/.
Observability and diagnostics¶
- Emits logs using
SmrtHub.Loggingunder thetoken-genslug.
Support Bundle¶
- Not applicable.
Related docs¶
Smrt.UI: SmrtApps/src/Smrt.UI/README.md
Overview & Responsibilities¶
- Generates WinUI XAML ResourceDictionary files from the canonical JSON token and palette definitions.
- Ensures Smrt.UI themes stay synchronized with design system updates (spacing, typography, motion, and color palettes).
- Used by internal build/design workflows; not shipped to end users.
Inputs¶
config/tokens.json— non-color tokens (spacing, radius, opacity, motion, typography).config/palettes.json— palette definitions for Light/Dark/HighContrast (keys map toColor.*resources).
Outputs¶
SmrtApps/src/Smrt.UI/Themes/Tokens/BaseTokens.xamlSmrtApps/src/Smrt.UI/Themes/Palettes/Theme.<Name>.xaml(Light, Dark, HighContrast, etc.)
Usage¶
- From the repository root run
dotnet run --project SmrtApps/src/Smrt.Tools.TokenGen/Smrt.Tools.TokenGen.csproj. - The tool locates
global.json, resolves the SmrtApps directories, and overwrites the generated dictionaries. - Commit changes alongside design approval notes (see
Themes/CHANGES-*.md).
Dependencies & Integrations¶
- References
SmrtHub.Loggingto emit operational logs in thetoken-genslug. - Relies on the JSON schema enforced by design tooling; extending schemas requires updating
Program.csand the downstream XAML consumers.
Validation Checklist¶
- After regeneration, build
Smrt.UIto confirm XBF compilation succeeds. - Smoke test consuming apps (HubWindow, Supervisor) to verify theme resources load without runtime exceptions.
- Diff generated XAML to confirm expected token changes only.
Directory Map¶
Program.cs— token generator implementation.config/— JSON sources for tokens and palettes.Smrt.Tools.TokenGen.csproj— .NET 8 console project.bin/,obj/— build output (safe to delete viadotnet clean).