Skip to content

The agent that grows with you

fix(gui): keep shared workspace node_modules on uninstall --gui

itsflowniumf9fec19d965d
diff --git a/hermes_cli/gui_uninstall.py b/hermes_cli/gui_uninstall.py
index f958f96b493..e25cffb5c89 100644
--- a/hermes_cli/gui_uninstall.py
+++ b/hermes_cli/gui_uninstall.py
@@ -36,12 +36,12 @@ def desktop_userdata_dir() -> Path:
def source_built_gui_artifacts(hermes_home: Path) -> "list[Path]":
"""GUI build artifacts produced by ``hermes desktop`` inside the checkout (same ``hermes-agent/`` layout
- install.sh uses). The Python agent runs from source + venv and never needs the Electron build output or
- node_modules (the workspace-root node_modules only carries Electron, ~200MB)."""
+ install.sh uses). The workspace-root node_modules is shared with the TUI, dashboard and other
+ workspaces, so only the desktop workspace's own dependencies belong to GUI removal."""
agent_root = hermes_home / "hermes-agent"
desktop_dir = agent_root / "apps" / "desktop"
return [desktop_dir / "dist", desktop_dir / "release", desktop_dir / "node_modules",
- agent_root / "node_modules", hermes_home / "desktop-build-stamp.json"]
+ hermes_home / "desktop-build-stamp.json"]
def desktop_install_record() -> Path:
diff --git a/hermes_cli/uninstall.py b/hermes_cli/uninstall.py
index 490373221ea..6ec507d9266 100644
--- a/hermes_cli/uninstall.py
+++ b/hermes_cli/uninstall.py
@@ -729,6 +729,8 @@ def run_gui_uninstall(args):
print(color("Kept intact:", Colors.GREEN, Colors.BOLD))
print(f" • The Hermes agent at {hermes_home / 'hermes-agent'}")
print(f" • Your config, sessions, and secrets under {hermes_home}")
+ if (shared_modules := hermes_home / "hermes-agent" / "node_modules").exists():
+ print(f" • Shared workspace dependencies at {shared_modules}")
print()
if bool(getattr(args, "dry_run", False)):
diff --git a/tests/hermes_cli/test_gui_uninstall_retention.py b/tests/hermes_cli/test_gui_uninstall_retention.py
index ea722b195d4..621d549034b 100644
--- a/tests/hermes_cli/test_gui_uninstall_retention.py
+++ b/tests/hermes_cli/test_gui_uninstall_retention.py
@@ -70,3 +70,11 @@ def test_gui_dry_run_never_confirms_or_removes_installed_state(installation, mon
main.main()
for path, data in {**protected, **gui_files}.items():
assert path.read_bytes() == data
+
+
+def test_gui_removal_keeps_agent_data_and_shared_workspace_dependencies(installation, monkeypatch):
+ protected, gui_files, _ = installation
+ _run(monkeypatch, "--yes")
+ for path, data in protected.items():
+ assert path.read_bytes() == data
+ assert all(not path.exists() for path in gui_files)
diff --git a/website/docs/user-guide/desktop.md b/website/docs/user-guide/desktop.md
index 96351c9e8db..3ac2bbe86a0 100644
--- a/website/docs/user-guide/desktop.md
+++ b/website/docs/user-guide/desktop.md
@@ -391,7 +391,7 @@ For self-managed installations, you can do the same from the terminal — `herme
Preview GUI cleanup with `hermes uninstall --gui --dry-run`. It lists the removal targets and returns without prompting or removing anything, including when `--yes` is also supplied.
:::note
-Running `hermes uninstall --gui` from a **source checkout** (a `hermes desktop` dev build) also removes the workspace `node_modules` and `apps/desktop/{dist,release}` build output, since those are GUI build artifacts. They're recoverable with `hermes desktop` (or `npm install` + a rebuild) — but if you're actively hacking on the desktop app, expect to reinstall dependencies afterward.
+Running `hermes uninstall --gui` from a **source checkout** (a `hermes desktop` dev build) removes `apps/desktop/{dist,release,node_modules}` and the desktop build stamp. The workspace-root `node_modules` stays installed because it is shared with the TUI, dashboard and other workspaces. Rebuild the GUI with `hermes desktop` if you need it again.
:::
## CLI reference: `hermes desktop`