Skip to content

The agent that grows with you

refactor(doctor): use the canonical PROFILE_ID_RE

kshitijk4poorff2d02f998f9
diff --git a/hermes_cli/doctor_state.py b/hermes_cli/doctor_state.py
index 345c995e018..d2f10cb789b 100644
--- a/hermes_cli/doctor_state.py
+++ b/hermes_cli/doctor_state.py
@@ -638,7 +638,8 @@ def _check_memory_provider(should_fix: bool, f: Finding) -> None:
@doctor_check("") # best-effort: profile enumeration must never break doctor
def _check_profiles(should_fix: bool, f: Finding) -> None:
- from hermes_cli.profiles import _PROFILE_ID_RE, _wrapper_path, list_profiles, _get_wrapper_dir, profile_exists
+ from hermes_constants import PROFILE_ID_RE
+ from hermes_cli.profiles import _wrapper_path, list_profiles, _get_wrapper_dir, profile_exists
import re as _re
named_profiles = [p for p in list_profiles() if not p.is_default]
if not named_profiles:
@@ -661,7 +662,7 @@ def _check_profiles(should_fix: bool, f: Finding) -> None:
_m = _re.search(r"hermes -p (\S+)", wrapper.read_text(encoding="utf-8-sig"))
if _m and not profile_exists(_m.group(1)):
alias = wrapper.stem if _wrapper_path(wrapper.stem) == wrapper else wrapper.name
- fix = f"hermes profile alias {alias} --remove" if _PROFILE_ID_RE.match(alias) else f"delete {wrapper}"
+ fix = f"hermes profile alias {alias} --remove" if PROFILE_ID_RE.match(alias) else f"delete {wrapper}"
check_warn(f"Orphan alias: {alias} → profile '{_m.group(1)}' no longer exists", f"(remove with: {fix})")
# Same helper as the multiplex migration preflight, so doctor names the duplicates that make
# `hermes gateway migrate --multiplex` refuse (and made pre-multiplex standalone gateways race).