/reload gains two subcommands on every surface (CLI, messaging gateway, TUI, Desktop catalog, Discord native tree and relay manifest): `/reload mcp [now|always]` runs the old /reload-mcp handler (same Approve Once / Always Approve / Cancel confirmation, same approvals.mcp_reload_confirm gate) and `/reload skills` runs the old /reload-skills handler. Bare /reload still reloads .env in the terminal and TUI; in a chat (where it never existed) it lists the two subcommands. /reload-mcp and /reload-skills (and their _ spellings) are retired with RETIRED_COMMANDS: typing one runs nothing and answers "`/reload-mcp` is now `/reload mcp`.". Every user-facing hint, locale string, doc and skill that said /reload-mcp or /reload-skills now says the new form.
27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
"""``/reload [mcp|skills]``: bare reloads ``.env``; ``mcp`` and ``skills`` run the MCP-server and
|
|
skill-rescan handlers (``/reload-mcp`` and ``/reload-skills`` before they were folded in)."""
|
|
from __future__ import annotations
|
|
|
|
from agent.i18n import t
|
|
|
|
# subcommand -> CLI handler method; each takes the normalized ``/reload <sub>`` command line.
|
|
_SUBCOMMANDS = {
|
|
"mcp": "_confirm_and_reload_mcp",
|
|
"skills": "_cmd_reload_skills",
|
|
}
|
|
|
|
|
|
def run_reload_command(cli, cmd: str) -> None:
|
|
"""Run ``/reload [subcommand]``; bare reloads ``.env``, an unknown subcommand prints the list."""
|
|
words = cmd.split()
|
|
if len(words) < 2:
|
|
from hermes_cli.config import reload_env
|
|
print(f" {t('cli.reload.env_reloaded', count=reload_env())}")
|
|
return
|
|
sub = words[1].lower()
|
|
method = _SUBCOMMANDS.get(sub)
|
|
if method is None:
|
|
print("\n".join(f" {line}" for line in t("commands.reload_usage").splitlines()))
|
|
return
|
|
getattr(cli, method)(" ".join([f"/reload {sub}", *words[2:]]))
|