diff --git a/hermes_cli/banner.py b/hermes_cli/banner.py index a596bc91d70..06fc84a4ac1 100644 --- a/hermes_cli/banner.py +++ b/hermes_cli/banner.py @@ -322,7 +322,7 @@ def check_for_updates() -> Optional[int]: # (branding.tsx, guarded on `typeof === 'number' && > 0`) show nothing. try: from hermes_cli.config import detect_install_method, get_project_root - if detect_install_method() == "docker": + if detect_install_method(get_project_root()) == "docker": return None except Exception: pass @@ -885,7 +885,7 @@ def build_welcome_banner(console: "Console", model: str, cwd: str, is_unsupported_install_method, get_project_root ) - _install_method = detect_install_method() + _install_method = detect_install_method(get_project_root()) if is_unsupported_install_method(_install_method): right_lines.append( f"[bold yellow]⚠ {format_unsupported_install_warning(_install_method)}[/]" diff --git a/hermes_cli/config.py b/hermes_cli/config.py index fadca5457fa..4625e58bd9b 100644 --- a/hermes_cli/config.py +++ b/hermes_cli/config.py @@ -439,8 +439,20 @@ def detect_install_method(project_root: Optional[Path] = None) -> str: managed = get_managed_system() if managed: return managed.lower().replace(" ", "-") - if (root / ".git").is_dir(): + + # detect git repo installs (normal installer, development env) + git_path = root / ".git" + if git_path.is_dir(): return "git" + + # detect git repo installs from worktrees + if git_path.is_file(): + try: + content = git_path.read_text(encoding="utf-8").strip() + if content.startswith("gitdir:"): + return "git" + except OSError: + pass return "pip" @@ -526,7 +538,7 @@ def recommended_update_command() -> str: managed_cmd = get_managed_update_command() if managed_cmd: return managed_cmd - method = detect_install_method() + method = detect_install_method(get_project_root()) return recommended_update_command_for_method(method)