Skip to content
This repository was archived by the owner on Jul 16, 2026. It is now read-only.

feat(web-server): CLIENT_DIST_DIR pluggability — clean rebase of #68 - #98

Open
jgluck96 wants to merge 2 commits into
mainfrom
fix/phase-1.7-clean
Open

jgluck96 wants to merge 2 commits into
mainfrom
fix/phase-1.7-clean

Conversation

@jgluck96

@jgluck96 jgluck96 commented Jun 3, 2026

Copy link
Copy Markdown

Summary

Clean cherry-pick of PR #68 (josh/phase-1.7-client-dist-dir-pluggability) onto current main. The original PR included PR #69's stando-ui extraction as ancestor commits, making the diff show 109 files; this branch isolates the actual 2-file change.

What changed:

  • src/web-server.ts: reads CLIENT_DIST_DIR env var to locate the UI bundle; falls back to client/dist (unchanged behavior)
  • tests/client-dist-dir-override.test.ts: 130-line regression test covering the override and default paths

Why: Allows serving any UI bundle (e.g. stando-ui builds) without source edits:

CLIENT_DIST_DIR=/abs/path/to/dist bash src/startup.sh

Closes #68 (supersedes it with a clean diff).

Test plan

  • npm test — client-dist-dir-override.test.ts passes
  • CLIENT_DIST_DIR=/tmp/test-ui bash src/startup.sh — web server serves from the override path

🤖 Generated with Claude Code

jgluck96 and others added 2 commits June 3, 2026 15:16
Adds the same env-var-driven UI override that sutando's web-server has
(see josh/migrate-to-react on sonichi/sutando, commit c350a10). With
this in place, stando can serve any UI bundle by exporting:

  CLIENT_DIST_DIR=/abs/path/to/dist bash src/startup.sh

before launching the voice agent. Without the env var, behavior is
unchanged — stando serves its bundled client/dist/ as before.

Phase 1.7 of the OSS sync roadmap. Unblocks the workflow where
production stando deployments override the default UI with a private
branded dist while developer / demo builds still serve the stando
default UI from client/.

Mechanics ported verbatim from sutando:
- resolveClientDistDir() function with tilde expansion
- module-level `let CLIENT_DIST_DIR = resolveClientDistDir()` so
  existing references keep working
- per-call re-resolve inside startWebServer() so tests + dynamic env
  changes pick up the latest value
- JSDoc updated to document the override

Submodule auto-init block from sutando's startup.sh deliberately NOT
ported — stando's client/ is still vendored (not a submodule), and
the goal is independence from OSS UI updates, not auto-sync.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ports sutando/tests/client-dist-dir-override.test.ts verbatim so the
private repo's pluggability contract stays in lockstep with OSS. Same
3 cases: custom dir override serves, default fallback serves bundled
UI, path traversal blocked.

All 3 pass against the new resolveClientDistDir() in src/web-server.ts.

Co-authored-by: Cursor <cursoragent@cursor.com>

@bassilkhilo-ag2 bassilkhilo-ag2 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean. Module-level init + re-resolve inside startWebServer() is the right pattern for testability. Tilde expansion is necessary (node path.resolve doesn't expand ~). Test coverage is thorough — override path, fallback, and re-read between server instances. Nothing unexpected in the 2-file diff.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants