fix(install): scope npm installs/audits to avoid pulling in apps/desktop

Root package.json uses apps/* workspaces glob which unconditionally
includes apps/desktop (Electron + node-pty@1.1.0, ~200MB, requires
make/g++ to build) in every unscoped npm command run from the repo root.

This commit addresses the core problem by adding explicit workspace
scoping to all internal npm calls:

hermes_cli/main.py (_build_web_ui):
  - Add --workspace web to the npm install call so only the web
    workspace deps are resolved, never apps/desktop.

hermes_cli/tools_config.py:
  - Add --workspaces=false to agent-browser and Camofox root installs
    so only root-level deps (agent-browser, @streamdown/math) are
    installed, bypassing the workspace graph entirely.

hermes_cli/doctor.py (run_doctor npm audit):
  - Replace the single unscoped 'npm audit --json' at PROJECT_ROOT with
    three scoped invocations:
      * --workspaces=false for root deps (Browser tools)
      * --workspace web for the web workspace
      * --workspace ui-tui for the TUI workspace
  - Update remediation hints to use matching scoped 'npm audit fix'
    commands so users don't accidentally trigger a desktop rebuild.

package.json:
  - Add convenience scripts for scoped operations:
      npm run install:root  / install:web / install:tui / install:desktop
      npm run audit:root    / audit:web   / audit:tui
      npm run audit:fix:root / audit:fix:web / audit:fix:tui
    These give developers and CI a safe, explicit interface for the
    most common per-workspace tasks without accidentally pulling desktop.

Fixes #38772
This commit is contained in:
Zak B. Elep
2026-06-06 18:22:20 -07:00
committed by Teknium
parent d165933c56
commit 1c0437dfc5
4 changed files with 50 additions and 13 deletions
+5 -1
View File
@@ -7090,7 +7090,11 @@ def _build_web_ui(web_dir: Path, *, fatal: bool = False) -> bool:
_say(text)
npm_cwd = _workspace_root(web_dir)
npm_workspace_args: tuple[str, ...] = ()
# Scope the install to the web workspace only so that the full workspace
# graph (including apps/desktop with its Electron + node-pty deps) is never
# resolved here. Without --workspace the root package.json's apps/* glob
# would pull in desktop on every web build. See #38772.
npm_workspace_args: tuple[str, ...] = ("--workspace", "web")
if _is_termux_startup_environment():
npm_cwd, npm_workspace_args = _termux_workspace_install_context(web_dir)
r1 = _run_npm_install_deterministic(