mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-27 11:22:03 +00:00
The pre-update HERMES_HOME zip shipped on by default (DEFAULT_CONFIG + runtime fallback both True), so every `hermes update` zipped the entire ~/.hermes — sessions DB, caches, skills — adding minutes to each update. The shipped cli-config.yaml.example, the --backup help, and the example config all already said "off by default," so the live default contradicted its own documentation. Flip the default to off everywhere: DEFAULT_CONFIG, the runtime `.get(..., False)` fallback in _run_pre_update_backup, and the stale --backup help string. Users who want the #48200 safety net opt in via updates.pre_update_backup: true or --backup for a single run. Updated test_default_enabled_creates_backup -> test_default_disabled_is_silent to assert the new default (silent no-op, no zip).
70 lines
2.6 KiB
Python
70 lines
2.6 KiB
Python
"""``hermes update`` subcommand parser.
|
|
|
|
Extracted verbatim from ``hermes_cli/main.py:main()`` (god-file Phase 2).
|
|
Handler injected to avoid importing ``main``.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Callable
|
|
|
|
|
|
def build_update_parser(subparsers, *, cmd_update: Callable) -> None:
|
|
"""Attach the ``update`` subcommand to ``subparsers``."""
|
|
# =========================================================================
|
|
# update command
|
|
# =========================================================================
|
|
update_parser = subparsers.add_parser(
|
|
"update",
|
|
help="Update Hermes Agent to the latest version",
|
|
description="Pull the latest changes from git and reinstall dependencies",
|
|
)
|
|
update_parser.add_argument(
|
|
"--gateway",
|
|
action="store_true",
|
|
default=False,
|
|
help="Gateway mode: use file-based IPC for prompts instead of stdin (used internally by /update)",
|
|
)
|
|
update_parser.add_argument(
|
|
"--check",
|
|
action="store_true",
|
|
default=False,
|
|
help="Check whether an update is available without installing anything",
|
|
)
|
|
update_parser.add_argument(
|
|
"--no-backup",
|
|
action="store_true",
|
|
default=False,
|
|
help="Skip the pre-update backup for this run (overrides updates.pre_update_backup)",
|
|
)
|
|
update_parser.add_argument(
|
|
"--backup",
|
|
action="store_true",
|
|
default=False,
|
|
help="Force a pre-update backup for this run (off by default; overrides updates.pre_update_backup=false)",
|
|
)
|
|
update_parser.add_argument(
|
|
"--yes",
|
|
"-y",
|
|
action="store_true",
|
|
default=False,
|
|
help="Assume yes for interactive prompts (config migration, stash restore). API-key entry is skipped; run 'hermes config migrate' separately for those.",
|
|
)
|
|
update_parser.add_argument(
|
|
"--branch",
|
|
default=None,
|
|
metavar="NAME",
|
|
help=(
|
|
"Update against this branch instead of the default (main). "
|
|
"If the local checkout is on a different branch, hermes will "
|
|
"switch to the requested branch first (auto-stashing any "
|
|
"uncommitted changes)."
|
|
),
|
|
)
|
|
update_parser.add_argument(
|
|
"--force",
|
|
action="store_true",
|
|
default=False,
|
|
help="Windows: proceed with the update even when another hermes.exe is detected. The concurrent process will likely cause WinError 32 warnings and may leave a reboot-deferred .exe replacement.",
|
|
)
|
|
update_parser.set_defaults(func=cmd_update)
|