mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-18 04:41:56 +00:00
feat(update): support pip install --upgrade for PyPI installs
When .git is absent and detect_install_method returns "pip", fork hermes update to run `uv pip install --upgrade hermes-agent` (or `python -m pip install --upgrade hermes-agent` as fallback) instead of hard-exiting with "Not a git repository".
This commit is contained in:
parent
624ce11ee8
commit
79afa50703
1 changed files with 28 additions and 0 deletions
|
|
@ -7671,6 +7671,29 @@ def cmd_update(args):
|
|||
_finalize_update_output(_update_io_state)
|
||||
|
||||
|
||||
def _cmd_update_pip(args):
|
||||
"""Update Hermes via pip (for PyPI installs)."""
|
||||
import subprocess as _sp
|
||||
from hermes_cli import __version__
|
||||
|
||||
print(f"→ Current version: {__version__}")
|
||||
print("→ Checking PyPI for updates...")
|
||||
|
||||
uv = shutil.which("uv")
|
||||
if uv:
|
||||
cmd = [uv, "pip", "install", "--upgrade", "hermes-agent"]
|
||||
else:
|
||||
cmd = [sys.executable, "-m", "pip", "install", "--upgrade", "hermes-agent"]
|
||||
|
||||
print(f"→ Running: {' '.join(cmd)}")
|
||||
result = _sp.run(cmd)
|
||||
if result.returncode != 0:
|
||||
print("✗ Update failed")
|
||||
sys.exit(1)
|
||||
|
||||
print("✓ Update complete! Restart hermes to use the new version.")
|
||||
|
||||
|
||||
def _cmd_update_impl(args, gateway_mode: bool):
|
||||
"""Body of ``cmd_update`` — kept separate so the wrapper can always
|
||||
restore stdio even on ``sys.exit``."""
|
||||
|
|
@ -7698,6 +7721,11 @@ def _cmd_update_impl(args, gateway_mode: bool):
|
|||
if sys.platform == "win32":
|
||||
use_zip_update = True
|
||||
else:
|
||||
from hermes_cli.config import detect_install_method
|
||||
method = detect_install_method(PROJECT_ROOT)
|
||||
if method == "pip":
|
||||
_cmd_update_pip(args)
|
||||
return
|
||||
print("✗ Not a git repository. Please reinstall:")
|
||||
print(
|
||||
" curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue