fix: correct detect install method when running from a subtree

This commit is contained in:
ethernet 2026-07-02 19:46:25 -04:00
parent eb40402420
commit 05c01af68c
2 changed files with 16 additions and 4 deletions

View file

@ -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)}[/]"

View file

@ -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)