The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(cli): accept `hermes --tui --checkpoints` at the top level
Teknium3712e99d60c0
diff --git a/hermes_cli/_parser.py b/hermes_cli/_parser.pyindex 1d6f167042a..507234e8e53 100644--- a/hermes_cli/_parser.py+++ b/hermes_cli/_parser.py@@ -197,6 +197,8 @@ def _add_top_level_flags(parser: argparse.ArgumentParser) -> None:help="Bypass all dangerous command approval prompts (use at your own risk)")inherited(parser, "--pass-session-id", action="store_true", default=False,help="Include the session ID in the agent's system prompt")+ inherited(parser, "--checkpoints", action="store_true", default=False,+ help="Enable filesystem checkpoints before destructive file operations (use /rollback to restore)")inherited(parser, "--ignore-user-config", action="store_true", default=False,help=f"Ignore {_cfg_path()} and fall back to built-in defaults (credentials in .env are still loaded)")inherited(parser, "--ignore-rules", action="store_true", default=False,@@ -291,8 +293,8 @@ def _build_chat_parser(subparsers) -> argparse.ArgumentParser:"Auto-approve any unseen shell hooks declared in config.yaml ""without a TTY prompt (see also HERMES_ACCEPT_HOOKS env var and ""hooks_auto_accept: in config.yaml)."))- add("--checkpoints", action="store_true", default=False,- help="Enable filesystem checkpoints before destructive file operations (use /rollback to restore)")+ inherited(chat_parser, "--checkpoints", action="store_true", default=SUPPRESS,+ help="Enable filesystem checkpoints before destructive file operations (use /rollback to restore)")add("--max-turns", type=int, default=None, metavar="N",help="Maximum tool-calling iterations per conversation turn (default: 500, or agent.max_turns in config)")add("--run-budget", type=float, default=None, metavar="SECONDS", dest="run_budget", help=(diff --git a/hermes_cli/gateway_chat.py b/hermes_cli/gateway_chat.pyindex d25f2398599..9a2e59ea120 100644--- a/hermes_cli/gateway_chat.py+++ b/hermes_cli/gateway_chat.py@@ -28,7 +28,7 @@ _RELOCATED = {"w": "`hermes --tui -w`","no_restore_cwd": "`--in <dir>` (the gateway keeps the session's frozen cwd)","run_budget": "`agent.run_budget_seconds` in config.yaml",- "verbose": "`hermes logs --follow`, or `hermes --tui -v`",+ "verbose": "`hermes logs --follow`, or `hermes chat --tui -v`","compact": "`display.compact: true` in config.yaml","list_tools": "`hermes tools list`","list_toolsets": "`hermes tools list`",diff --git a/tests/hermes_cli/test_argparse_flag_propagation.py b/tests/hermes_cli/test_argparse_flag_propagation.pyindex 5c3361ee6ec..94fb5fcc1dc 100644--- a/tests/hermes_cli/test_argparse_flag_propagation.py+++ b/tests/hermes_cli/test_argparse_flag_propagation.py@@ -205,3 +205,12 @@ class TestChatSubparserInheritedValueFlags:+ "\n ".join(f"{opts} dest={dest} default={d!r}"for opts, dest, d in offenders))++[email protected]("argv", [+ ["--tui", "--checkpoints"], ["--checkpoints", "chat"], ["chat", "--tui", "--checkpoints"]])+def test_checkpoints_parses_at_the_top_level_and_survives_chat(argv):+ """`hermes --tui --checkpoints` is the TUI launch the docs and gateway refusals name; it was+ declared only on `chat`, so the top-level form failed with "unrecognized arguments"."""+ from hermes_cli._parser import build_top_level_parser+ assert build_top_level_parser()[0].parse_args(argv).checkpoints is Truediff --git a/tests/hermes_cli/test_gateway_chat.py b/tests/hermes_cli/test_gateway_chat.pyindex 905cd005b59..a53defd1829 100644--- a/tests/hermes_cli/test_gateway_chat.py+++ b/tests/hermes_cli/test_gateway_chat.py@@ -171,3 +171,17 @@ async def test_yolo_slash_toggles_the_session_bypass_on_the_owner(capsys):assert calls == [("config.set", {"session_id": "sid", "key": "yolo", "value": "0"}),("config.set", {"session_id": "sid", "key": "yolo"})]assert "YOLO off for this session" in capsys.readouterr().out+++def test_every_relocation_hint_names_a_command_that_parses():+ """A refusal that points at `hermes --tui --checkpoints` / `hermes --tui -v` must not send the+ user to a command argparse rejects."""+ import re+ import shlex+ from hermes_cli import gateway_chat+ from hermes_cli.main import _build_cli_parser+ parser = _build_cli_parser()+ parser = parser[0] if isinstance(parser, tuple) else parser+ for hint in gateway_chat._RELOCATED.values():+ for command in re.findall(r"`(hermes [^`]*)`", hint):+ parser.parse_args([arg for arg in shlex.split(command)[1:] if not arg.startswith("<")])