Embed dashboard in the binary; drop "insights" naming#146
Merged
Conversation
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).
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two owner directives:
vxfailed--uiwith--ui requires apps/insights/distbecause it resolved the SPA from disk.Embedding
The dashboard now ships inside the binary:
dist/index.html(JS + CSS inlined by a ~20-linegenerateBundleplugin invite.config.ts— no new dependency).src/cli/ui-asset.tsimports it withwith { type: 'file' }, sobun build --compileembeds the bytes; the import resolves to a/$bunfs/path thatBun.file()reads. It's imported dynamically (only on--ui), so a source checkout that hasn't built the UI never breaksvx run.vx serve --uiserves 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, andVX_INSIGHTS_DISTare gone.build.uitask (cd apps/ui && bun run build, boundary-freeworkspaceFilesI/O) builds the SPA; eachbuild.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#buildref that scoped loading wouldn't resolve), sovx run testand CI aren't pulled into a UI build.Verified end-to-end: compiled a
--minify --bytecodebinary, deletedapps/ui/distentirely, andvx serve --uistill served the embedded "vx dashboard" — plusvx run build.bun.linux-x64builds the UI then compiles in one graph.Rename (insights → ui / metrics / dashboard)
apps/insights/→apps/ui/;@vzn/vx-insights→@vzn/vx-uisrc/orchestrator/insights-queries.ts→metrics.ts(+ test file)insights.md→dashboard.md; sidebar, brand ("vx insights" → "vx dashboard"),localStoragekey (vx-insights:origin→vx-ui:origin), help text, README,cli.md, landing card, introductionVX_INSIGHTS_DISTremoved (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)vx run testdoes not trigger a UI build;vx run build.bun.*doesmodule-boundariestest gains a.htmlasset carve-out (mirrors the existing.jsonone)CACHE_VERSIONimpactNote
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