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:
parent
c16870277c
commit
4b96d10bc3
1 changed files with 14 additions and 1 deletions
|
|
@ -2124,7 +2124,17 @@ def _restore_stashed_changes(
|
||||||
print(" Review `git diff` / `git status` if Hermes behaves unexpectedly.")
|
print(" Review `git diff` / `git status` if Hermes behaves unexpectedly.")
|
||||||
return True
|
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):
|
def cmd_update(args):
|
||||||
"""Update Hermes Agent to the latest version."""
|
"""Update Hermes Agent to the latest version."""
|
||||||
|
|
@ -2197,6 +2207,7 @@ def cmd_update(args):
|
||||||
commit_count = int(result.stdout.strip())
|
commit_count = int(result.stdout.strip())
|
||||||
|
|
||||||
if commit_count == 0:
|
if commit_count == 0:
|
||||||
|
_invalidate_update_cache()
|
||||||
print("✓ Already up to date!")
|
print("✓ Already up to date!")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -2217,6 +2228,8 @@ def cmd_update(args):
|
||||||
prompt_user=prompt_for_restore,
|
prompt_user=prompt_for_restore,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
_invalidate_update_cache()
|
||||||
|
|
||||||
# Reinstall Python dependencies (prefer uv for speed, fall back to pip)
|
# Reinstall Python dependencies (prefer uv for speed, fall back to pip)
|
||||||
print("→ Updating Python dependencies...")
|
print("→ Updating Python dependencies...")
|
||||||
uv_bin = shutil.which("uv")
|
uv_bin = shutil.which("uv")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue