fix(tui): scope TUI launch install and fix stale hints/test

- Add --workspace ui-tui to the TUI launch npm install, the one call
  site missed by the prior commit. Without scoping it ran from
  PROJECT_ROOT and still resolved apps/desktop via the apps/* glob.

- Update the two manual-recovery hints in _build_web_ui (npm install
  failure and build failure paths) to use the scoped form
  `npm install --workspace web && npm run build -w web` so users
  following the hint don't accidentally trigger a desktop rebuild.

- Update the stale test assertion in test_cmd_update.py to expect
  --workspace web in the _build_web_ui npm ci call, which was
  previously unreachable through the if-guard and left the workspace-
  scoping change from the prior commit unverified.
This commit is contained in:
Zak B. Elep 2026-06-04 17:21:46 +08:00 committed by Teknium
parent 1c0437dfc5
commit 0416f852f2
2 changed files with 6 additions and 4 deletions

View file

@ -1570,7 +1570,9 @@ def _make_tui_argv(tui_dir: Path, tui_dev: bool) -> tuple[list[str], Path]:
if not os.environ.get("HERMES_QUIET"):
print("Installing TUI dependencies…")
npm_cwd = _workspace_root(tui_dir)
npm_workspace_args: tuple[str, ...] = ()
# --workspace ui-tui avoids resolving apps/desktop (Electron + node-pty).
# See #38772.
npm_workspace_args: tuple[str, ...] = ("--workspace", "ui-tui")
if termux_startup:
npm_cwd, npm_workspace_args = _termux_workspace_install_context(
tui_dir,
@ -7109,7 +7111,7 @@ def _build_web_ui(web_dir: Path, *, fatal: bool = False) -> bool:
)
_relay(r1)
if fatal:
_say(" Run manually: cd web && npm install && npm run build")
_say(" Run manually: npm install --workspace web && npm run build -w web")
return False
# First attempt — stream output via idle-timeout helper (issue #33788).
# capture_output=True on a long Vite build looks identical to a hang;
@ -7151,7 +7153,7 @@ def _build_web_ui(web_dir: Path, *, fatal: bool = False) -> bool:
)
_relay(r2)
if fatal:
_say(" Run manually: cd web && npm install && npm run build")
_say(" Run manually: npm install --workspace web && npm run build -w web")
return False
_say(" ✓ Web UI built")
return True

View file

@ -272,7 +272,7 @@ class TestCmdUpdateBranchFallback:
# The web/ install runs from the workspace root when the root
# lockfile exists (npm workspaces hoist node_modules upward).
assert npm_calls[2:] == [
(["/usr/bin/npm", "ci", "--silent"], PROJECT_ROOT),
(["/usr/bin/npm", "ci", "--silent", "--workspace", "web"], PROJECT_ROOT),
]
# The web UI build itself went through the streaming helper.