Skip to content

okf viz: externalize repo specifics into a root okf-viz.toml - #24

Merged
kriswill merged 4 commits into
mainfrom
viz-toml
Jul 4, 2026
Merged

okf viz: externalize repo specifics into a root okf-viz.toml#24
kriswill merged 4 commits into
mainfrom
viz-toml

Conversation

@kriswill

@kriswill kriswill commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

First step toward other projects consuming the OKF viz for their own bundles: every dotfiles-specific string and setting moves out of the viz code into an optional repo-root okf-viz.toml, and okf viz builds a fully working generic viewer when the file is absent.

  • New scripts/okf/viz-app/config.tsVizConfig schema, generic defaults, and normalizeVizConfig(): strict at build (Bun's built-in TOML parser, zero new deps; unknown keys / type mismatches / reserved platform names / dangling cross-references fail the build with the offending key path), lenient in the app off the existing #data blob. Accepts kebab- and camelCase keys, so normalization is idempotent (test-enforced).
  • Configurable now: [bundle] dir/out, [display] title/badge/fallback-name/name/about-html (sidebar header + the (?) explainer bubble), [embed] max-bytes, [taxonomy] types/dir-groups/group-order/other, [platform] values/types/hosts/host-default/packages-nix/nix-guards, [repo] url. TYPE_ORDER/GROUP_OF_DIR/GROUP_ORDER/NIXOS_HOSTS are deleted from data.ts; markdown.ts loses its hardcoded knowledge/ prefix and slice(10, -3) offsets.
  • Generic fallbacks without okf-viz.toml: no platform filter (foreign os= deep links clamp to all), alphabetical types with generated colors, flat legend, generic "OKF bundle" header/about.
  • Unchanged with the checked-in okf-viz.toml: title, header, bubble, 12-slot palette, legend groups, darwin/nixos segments, and package classifications are functionally identical to before.
  • pages CI also triggers on okf-viz.toml; decision record in knowledge/decisions/viz-config-toml.md.

Verification

  • 202 bun tests pass (25 new: config suite, generic-mode model/state/component coverage, non-default bundleDir markdown case); okf viz --check clean.
  • Parity build with okf-viz.toml, generic build with it moved aside, malformed configs exit 1 with clear errors, and okf viz --perf boots the built page to interactive in headless Chrome (~260 ms).
  • okf validate: 0 errors, 0 warnings.

kriswill added 4 commits July 4, 2026 10:28
Move every dotfiles-specific string and setting out of the viz code into
an optional repo-root viz.toml: display strings (header name/badge, (?)
help bubble, page title), the darwin/nixos platform filter (packages.nix
path + optionalAttrs guard map, host list, type rule table, segment
labels), the type/legend taxonomy (palette slot order, dir->group map,
group order), embed cap, bundle dir, output name, and a repo-URL
override. New shared viz-app/config.ts normalizes strictly at build
(Bun.TOML.parse; unknown keys and dangling refs fail with their key
path) and leniently in the app off the #data blob. Without viz.toml the
viewer builds generic: no platform control, alphabetical types with
generated colors, flat legend, generic header/about. The sidebar header
now identifies the repo (owner/repo + badge) with a hoverable (?)
explainer. pages CI also triggers on viz.toml.
Fixes from the adversarial review of the viz.toml PR:
- buildModel no longer double-appends the other bucket when group-order
  already lists it (listing it there now pins the overflow cluster's
  position instead of crashing Legend's keyed each at mount)
- strict validation rejects duplicate taxonomy.types / group-order
  entries (same each_key_duplicate crash class)
- path fields (bundle.dir/out, packages-nix) drop trailing slashes at
  normalize time, so the bundle-prefix compares in viz.ts and
  markdown.ts can't silently misclassify in-bundle links
- empty-string display.name / repo.url / host-default / packages-nix
  mean 'unset' (TOML has no null), instead of rendering a blank header
- repoNameFromUrl accepts the same URL shapes as githubRemoteUrl
  (https/ssh, ±.git); non-GitHub URLs fall back to display.name
- stale TYPE_ORDER comment updated; markdown.ts's bundleDir default now
  shares config.ts's DEFAULT_BUNDLE_DIR
The root config's name should say what tool it belongs to; update the
loader, error messages, pages CI trigger, and all docs/knowledge
references.
@kriswill kriswill changed the title okf viz: externalize repo specifics into a root viz.toml okf viz: externalize repo specifics into a root okf-viz.toml Jul 4, 2026
kriswill added a commit that referenced this pull request Jul 4, 2026
…24, #25)

okf viz: generalize [platform] filter into 0..n facet lenses
@kriswill
kriswill merged commit 8bd1812 into main Jul 4, 2026
@kriswill
kriswill deleted the viz-toml branch July 4, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant