From 0416f852f2fcf966dae8a8f357c81b579462887a Mon Sep 17 00:00:00 2001 From: "Zak B. Elep" Date: Thu, 4 Jun 2026 17:21:46 +0800 Subject: [PATCH] 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. --- hermes_cli/main.py | 8 +++++--- tests/hermes_cli/test_cmd_update.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hermes_cli/main.py b/hermes_cli/main.py index 60f82adf2b..e967a158be 100644 --- a/hermes_cli/main.py +++ b/hermes_cli/main.py @@ -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 diff --git a/tests/hermes_cli/test_cmd_update.py b/tests/hermes_cli/test_cmd_update.py index d8204524c5..0c629a6668 100644 --- a/tests/hermes_cli/test_cmd_update.py +++ b/tests/hermes_cli/test_cmd_update.py @@ -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.