fix(cli): invalidate update-check cache after hermes update

Signed-off-by: nidhi-singh02 <nidhi2894@gmail.com>
Co-authored-by: nidhi-singh02 <nidhi2894@gmail.com>
This commit is contained in:
Teknium
2026-03-17 01:38:11 -07:00
committed by GitHub
parent c16870277c
commit 4b96d10bc3

View File

@@ -2124,7 +2124,17 @@ def _restore_stashed_changes(
print(" Review `git diff` / `git status` if Hermes behaves unexpectedly.")
return True
def _invalidate_update_cache():
"""Delete the update-check cache so ``hermes --version`` doesn't
report a stale "commits behind" count after a successful update."""
try:
cache_file = Path(os.getenv(
"HERMES_HOME", Path.home() / ".hermes"
)) / ".update_check"
if cache_file.exists():
cache_file.unlink()
except Exception:
pass
def cmd_update(args):
"""Update Hermes Agent to the latest version."""
@@ -2197,6 +2207,7 @@ def cmd_update(args):
commit_count = int(result.stdout.strip())
if commit_count == 0:
_invalidate_update_cache()
print("✓ Already up to date!")
return
@@ -2217,6 +2228,8 @@ def cmd_update(args):
prompt_user=prompt_for_restore,
)
_invalidate_update_cache()
# Reinstall Python dependencies (prefer uv for speed, fall back to pip)
print("→ Updating Python dependencies...")
uv_bin = shutil.which("uv")