fix(install): scope npm installs/audits to avoid pulling in apps/desktop - #38810
Closed
zakame wants to merge 4 commits into
Closed
fix(install): scope npm installs/audits to avoid pulling in apps/desktop#38810zakame wants to merge 4 commits into
zakame wants to merge 4 commits into
Conversation
zakame
force-pushed
the
fix/workspace-glob-desktop-isolation
branch
from
June 4, 2026 07:20
3b65f2c to
135be94
Compare
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 NousResearch#38772
- 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.
- Update the --skip-build pre-build hint in the dashboard startup path to use `npm install --workspace web && npm run build -w web` so users don't accidentally trigger a desktop rebuild by following the hint. - Add test_tui_launch_install_uses_workspace_scope to assert that the TUI launch npm install carries --workspace ui-tui, covering the call site added in the prior commit.
- check_dir = npm_dir if audit_extra else npm_dir evaluated identically in both branches; change to PROJECT_ROOT if audit_extra else npm_dir so workspace-scoped audits check the workspace root's node_modules - Add test_npm_install_uses_workspace_web_scope asserting --workspace web is passed adjacently in the _build_web_ui npm install invocation
zakame
force-pushed
the
fix/workspace-glob-desktop-isolation
branch
from
June 5, 2026 04:08
393ccff to
e242bec
Compare
Contributor
|
Merged via #40543 — your four commits were cherry-picked onto current main with your authorship preserved per-commit (rebase merge). Resolved one conflict against the newer Termux install-context branch so both the Termux and non-Termux paths stay workspace-scoped. Added you to |
Contributor
Author
|
@teknium1 thanks for the update and glad to help! 👍 |
This was referenced Jul 29, 2026
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
Fixes #38772.
The root
package.jsonworkspaces: ["apps/*", ...]glob unconditionally pullsapps/desktop(Electron +node-pty@1.1.0, ~200 MB, requiresmake/g++to build from source) into every unscopednpmcommand run from the repo root. This patch adds explicit workspace scoping to every internalnpm install/npm auditcall in the codebase, and adds convenience scripts topackage.jsonso developers don't have to remember the right flags.Changes
hermes_cli/main.py—_build_web_ui--workspace webto thenpm ci/npm installcall inside_build_web_ui(), so only thewebworkspace deps are resolved when building the dashboard frontend. Previously the call ran against the workspace root without scoping, triggering fullapps/*resolution on every web rebuild.npm install --workspace web && npm run build -w webso users following the hint don't accidentally trigger a desktop rebuild.hermes_cli/main.py— TUI launch path--workspace ui-tuito the inlinenpm installthat runs when launchinghermes tuiwith missing deps. Previously this ran unscoped fromPROJECT_ROOT, resolvingapps/*including desktop.hermes_cli/tools_config.py--workspaces=falseto thenpm install --silentcalls that install root-level browser tool deps (agent-browser, Camofox). Root deps live in the rootpackage.jsonand don't need any workspace to be resolved.hermes_cli/doctor.py—run_doctornpm audit blocknpm audit --jsonatPROJECT_ROOTwith three scoped invocations:--workspaces=falsefor root deps,--workspace webfor the web workspace, and--workspace ui-tuifor the TUI workspace.npm audit fixcommand, so users aren't directed to run an unscoped fix that would rebuildnode-pty.check_dirtautology:npm_dir if audit_extra else npm_diralways evaluated tonpm_dir; corrected toPROJECT_ROOT if audit_extra else npm_dirso workspace-scoped audits check the workspace root'snode_modules.package.jsonAdd convenience npm scripts for the most common scoped operations:
npm run install:rootnpm install --workspaces=falsenpm run install:webnpm install --workspace webnpm run install:tuinpm install --workspace ui-tuinpm run install:desktopnpm install --workspace apps/desktopnpm run audit:rootnpm audit --workspaces=falsenpm run audit:webnpm audit --workspace webnpm run audit:tuinpm audit --workspace ui-tuinpm run audit:fix:rootnpm audit fix --workspaces=falsenpm run audit:fix:webnpm audit fix --workspace webnpm run audit:fix:tuinpm audit fix --workspace ui-tuitests/hermes_cli/test_cmd_update.py_build_web_uinpm ci call to expect--workspace web.tests/hermes_cli/test_tui_npm_install.pytest_tui_launch_install_uses_workspace_scopeto assert that the TUI launch npm install carries--workspace ui-tui.tests/hermes_cli/test_web_ui_build.pytest_npm_install_uses_workspace_web_scopeto assert that_build_web_uipasses--workspace webadjacently in the npm install invocation, directly covering the most critical call site.What this does NOT change
workspacesarray inpackage.jsonitself —apps/desktopstays in the workspace graph so the single shared lockfile and hoistednode_modules/continue to work for desktop developers._update_node_dependencies()function already correctly used--workspaces=false+--workspace ui-tui --workspace web(the fix from _build_web_ui() npm install missing --workspace web flag breaks "hermes update" on multi-workspace repos #38358); this PR only fixes the remaining unscoped call sites.Test Plan
hermes dashboardstill builds the dashboard (_build_web_uipath)hermes --tuidoes not pull desktop deps on first launchhermes updatedoes not pull desktop deps (_update_node_dependenciesunchanged)hermes doctorreports separate audit results for root / web / ui-tui workspacesnpm run audit:fix:webcan be run on a minimal Linux box withoutmake/g++