Skip to content

Embed dashboard in the binary; drop "insights" naming#146

Merged
Exelord merged 1 commit into
mainfrom
claude/embed-ui
Jun 23, 2026
Merged

Embed dashboard in the binary; drop "insights" naming#146
Exelord merged 1 commit into
mainfrom
claude/embed-ui

Conversation

@Exelord

@Exelord Exelord commented Jun 21, 2026

Copy link
Copy Markdown
Member

Summary

Two owner directives:

  1. "vx serve --ui ... it should not be required! binary should have all necessary files" — a compiled vx failed --ui with --ui requires apps/insights/dist because it resolved the SPA from disk.
  2. "remove all insights naming".

Embedding

The dashboard now ships inside the binary:

  • apps/ui builds to a single self-contained dist/index.html (JS + CSS inlined by a ~20-line generateBundle plugin in vite.config.ts — no new dependency).
  • src/cli/ui-asset.ts imports it with with { type: 'file' }, so bun build --compile embeds the bytes; the import resolves to a /$bunfs/ path that Bun.file() reads. It's imported dynamically (only on --ui), so a source checkout that hasn't built the UI never breaks vx run.
  • vx serve --ui serves that one file for every non-API GET (the SPA is a hash router, so every route returns the same bytes). The old on-disk directory walk, MIME map, and VX_INSIGHTS_DIST are gone.
  • build.ui task (cd apps/ui && bun run build, boundary-free workspaceFiles I/O) builds the SPA; each build.bun.* cross-compile depends on it, so the binary embeds a fresh UI and a UI change cascades into the binary's cache key. It's a same-project dep (not a cross-project @vzn/vx-ui#build ref that scoped loading wouldn't resolve), so vx run test and CI aren't pulled into a UI build.

Verified end-to-end: compiled a --minify --bytecode binary, deleted apps/ui/dist entirely, and vx serve --ui still served the embedded "vx dashboard" — plus vx run build.bun.linux-x64 builds the UI then compiles in one graph.

Rename (insights → ui / metrics / dashboard)

  • apps/insights/apps/ui/; @vzn/vx-insights@vzn/vx-ui
  • src/orchestrator/insights-queries.tsmetrics.ts (+ test file)
  • guide insights.mddashboard.md; sidebar, brand ("vx insights" → "vx dashboard"), localStorage key (vx-insights:originvx-ui:origin), help text, README, cli.md, landing card, introduction
  • VX_INSIGHTS_DIST removed (nothing on disk to point at)

Design-doc archives + the append-only implementation log keep their historical "insights" references; a new log entry records the rename.

Test plan

  • bun src/bin.ts run ci — full gate green (925 tests)
  • Release binary serves embedded UI with source dist removed
  • vx run test does not trigger a UI build; vx run build.bun.* does
  • module-boundaries test gains a .html asset carve-out (mirrors the existing .json one)
  • No CACHE_VERSION impact

Note

This branches off main; the earlier query-dedup work (Tier 1 from the simplification audit) is still queued and will follow. The devframe-parity investigation also completed — happy to share that finding separately (you asked me to investigate before deciding).


Generated by Claude Code

vx serve --ui failed from a compiled binary ("--ui requires
apps/insights/dist") because it resolved the SPA from disk. A binary
must be self-contained — so the dashboard is now embedded.

Embedding:
- apps/ui builds to a single self-contained dist/index.html (JS + CSS
  inlined via a small generateBundle plugin in vite.config.ts).
- src/cli/ui-asset.ts imports it with `with { type: 'file' }`, so
  `bun build --compile` embeds the bytes; the import resolves to a
  bunfs path Bun.file() reads. Dynamically imported only on --ui, so
  a source checkout that hasn't built the UI doesn't break `vx run`.
- vx serve --ui serves that one file for every non-API GET (the SPA
  is a hash router). Drops the old on-disk dir walk + VX_INSIGHTS_DIST.
- build.ui task (cd apps/ui && bun run build, boundary-free
  workspaceFiles I/O) builds the SPA; each build.bun.* depends on it
  so the binary embeds a fresh UI and a UI change cascades into the
  binary cache key. Same-project dep keeps test/CI unpolluted.

Verified: compiled a --minify --bytecode binary, removed apps/ui/dist
entirely, vx serve --ui still served the embedded dashboard.

Rename (insights → ui / metrics / dashboard):
- apps/insights → apps/ui; @vzn/vx-insights → @vzn/vx-ui
- src/orchestrator/insights-queries.ts → metrics.ts (+ test)
- guide insights.md → dashboard.md; brand, localStorage key, help,
  README, cli, landing, introduction copy
- VX_INSIGHTS_DIST removed (nothing on disk to point at)

module-boundaries test gains a .html asset carve-out (mirrors .json).
No CACHE_VERSION impact. Full gate green (925 tests).
@Exelord Exelord merged commit c69936d into main Jun 23, 2026
1 check passed
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.

2 participants