Files
hermes-agent/hermes_cli/cli_backup_command.py
Teknium 998f1ef7f9 refactor(slash): retired-name mechanism; _ = - in names; /platforms absorbs /platform; /backup
RETIRED_COMMANDS (hermes_cli/commands.py) maps an old slash name to the
invocation that replaced it. On every surface a retired name runs nothing
and answers one localized line (commands.retired): CLI process_command,
gateway idle and busy paths (busy bypass, never queued as a turn), TUI and
Desktop (commands.catalog carries the rendered notices; they are answered
before alias/fuzzy matching, so /platform no longer prefix-expands), and
slash.exec / command.dispatch as the backstop. Skills and plugins cannot
claim a retired name.

resolve_command normalizes `_` to `-`, so the underscore twins
(reload_mcp, reload_skills, codex_runtime) are deleted; /set-home is
retired for /sethome.

/platforms is now the one platforms command on every surface: bare or
`list` shows status, `pause|resume <name>` act on a failing adapter in a
chat (the CLI points to a chat). /platform and /gateway are retired.

/backup snapshot|export|import replaces /snapshot (/snap), /export and
/import; bare /backup lists the three.
2026-11-28 19:42:51 -08:00

24 lines
942 B
Python

"""``/backup snapshot|export|import``: one slash command over the state-snapshot and profile-archive
handlers (``/snapshot``, ``/export`` and ``/import`` before they were folded in)."""
from __future__ import annotations
from agent.i18n import t
# subcommand -> CLI handler method; each takes the command line in its old ``/<name> args`` shape.
_SUBCOMMANDS = {
"snapshot": "_handle_snapshot_command",
"export": "_handle_export_command",
"import": "_handle_import_command",
}
def run_backup_command(cli, cmd: str) -> None:
"""Run ``/backup <subcommand> [args]``; bare or unknown prints the three subcommands."""
words = cmd.split(maxsplit=2)
sub = words[1].lower() if len(words) > 1 else ""
method = _SUBCOMMANDS.get(sub)
if method is None:
print("\n".join(f" {line}" for line in t("commands.backup_usage").splitlines()))
return
getattr(cli, method)(" ".join([f"/{sub}", *words[2:]]))