Skip to content

The agent that grows with you

fix(uninstall): keep dry-run profiles listing under full-uninstall only

Yuan Liffa4b29febe6
diff --git a/hermes_cli/uninstall.py b/hermes_cli/uninstall.py
index e1f4526d1c3..49cb3ed93f5 100644
--- a/hermes_cli/uninstall.py
+++ b/hermes_cli/uninstall.py
@@ -780,13 +780,16 @@ def _print_uninstall_dry_run(*, project_root: Path, hermes_home: Path, full_unin
print(f" • Code checkout: {project_root}")
if not full_uninstall:
print(f" • Keep Hermes config/data: {hermes_home}")
+ from hermes_cli.gui_uninstall import desktop_userdata_dir
+ if (userdata := desktop_userdata_dir()).exists():
+ print(f" • Keep desktop app data: {userdata}")
else:
print(f" • Hermes config/data: {hermes_home}")
if sys.platform == "darwin":
print(" • macOS: dashboard/serve launchd jobs, Electron + setup caches")
- from hermes_cli.gui_uninstall import desktop_userdata_dir
- if (userdata := desktop_userdata_dir()).exists():
- print(f" • {'Keep desktop' if not full_uninstall else 'Desktop'} app data: {userdata}")
+ from hermes_cli.gui_uninstall import desktop_userdata_dir
+ if (userdata := desktop_userdata_dir()).exists():
+ print(f" • Desktop app data: {userdata}")
profiles = _discover_named_profiles() if _is_default_hermes_home(hermes_home) else []
if profiles:
print(" • Named profiles (interactive uninstall asks before removing):")
diff --git a/tests/hermes_cli/test_uninstall_dry_run.py b/tests/hermes_cli/test_uninstall_dry_run.py
index 1c3d7c90441..8ad7c254fde 100644
--- a/tests/hermes_cli/test_uninstall_dry_run.py
+++ b/tests/hermes_cli/test_uninstall_dry_run.py
@@ -37,6 +37,46 @@ def test_dry_run_prints_plan_without_mutating(monkeypatch, tmp_path, capsys):
assert hermes_home.exists()
+def test_dry_run_lists_named_profiles_without_desktop_userdata(monkeypatch, tmp_path, capsys):
+ """Full-uninstall dry-run lists named profiles even on a machine with no desktop
+ userData dir — the profiles section must not depend on the desktop install."""
+ profile = SimpleNamespace(name="work", path=tmp_path / "profiles" / "work")
+ monkeypatch.setattr(uninstall, "_is_default_hermes_home", lambda home: True)
+ monkeypatch.setattr(uninstall, "_discover_named_profiles", lambda: [profile])
+ monkeypatch.setattr(
+ "hermes_cli.gui_uninstall.desktop_userdata_dir", lambda: tmp_path / "absent-userdata"
+ )
+
+ uninstall._print_uninstall_dry_run(
+ project_root=tmp_path, hermes_home=tmp_path / ".hermes", full_uninstall=True
+ )
+
+ out = capsys.readouterr().out
+ assert "Named profiles" in out
+ assert "work" in out
+
+
+def test_keep_data_dry_run_omits_named_profiles_even_with_desktop_userdata(
+ monkeypatch, tmp_path, capsys
+):
+ """Keep-data dry-run never lists named profiles (keep-data never removes them), even
+ when a desktop userData dir exists."""
+ profile = SimpleNamespace(name="work", path=tmp_path / "profiles" / "work")
+ userdata = tmp_path / "appdata" / "Hermes"
+ userdata.mkdir(parents=True)
+ monkeypatch.setattr(uninstall, "_is_default_hermes_home", lambda home: True)
+ monkeypatch.setattr(uninstall, "_discover_named_profiles", lambda: [profile])
+ monkeypatch.setattr("hermes_cli.gui_uninstall.desktop_userdata_dir", lambda: userdata)
+
+ uninstall._print_uninstall_dry_run(
+ project_root=tmp_path, hermes_home=tmp_path / ".hermes", full_uninstall=False
+ )
+
+ out = capsys.readouterr().out
+ assert "Named profiles" not in out
+ assert "Keep desktop app data" in out
+
+
def test_build_uninstall_parser_accepts_dry_run():
import argparse
from hermes_cli.subcommands.uninstall import build_uninstall_parser