Skip to content

The agent that grows with you

refactor(hermes_cli): setup cluster — unify blank-slate epilogue and allowlist prompt

Teknium8ec7d0bfc587
diff --git a/hermes_cli/setup_platforms.py b/hermes_cli/setup_platforms.py
index 8d4174bbe73..54a7799e79c 100644
--- a/hermes_cli/setup_platforms.py
+++ b/hermes_cli/setup_platforms.py
@@ -70,6 +70,17 @@ def _save_allowlist(env_var: str, users: str, success_msg: str) -> None:
print_success(success_msg)
+def _prompt_allowlist(env_var: str, question: str, success_msg: str, open_msg: str, preset: str | None = None) -> str:
+ """Persist ``preset`` (or the prompted answer) as an allowlist, warning when it stays open."""
+ from hermes_cli.setup import print_info, prompt
+ users = prompt(question) if preset is None else preset
+ if users:
+ _save_allowlist(env_var, users, success_msg)
+ else:
+ print_info(open_msg)
+ return users.replace(" ", "")
+
+
def _save_port(env_var: str, value: str, default: str) -> None:
"""Persist ``value`` as an int port; warn (keeping ``default``) when it isn't one."""
from hermes_cli.setup import print_success, print_warning, save_env_value
@@ -159,14 +170,10 @@ def _setup_telegram():
if prompt_yes_no("Allow this Telegram account to use the bot?", True):
extra = prompt("Additional allowed user IDs (comma-separated, optional)")
allowed_users = ",".join(dict.fromkeys([detected_id, *filter(None, extra.replace(" ", "").split(","))]))
- if allowed_users is None:
- allowed_users = prompt("Allowed user IDs (comma-separated, leave empty for open access)")
-
- if allowed_users:
- allowed_users = allowed_users.replace(" ", "")
- _save_allowlist("TELEGRAM_ALLOWED_USERS", allowed_users, "Telegram allowlist configured - only listed users can use the bot")
- else:
- print_info("⚠️ No allowlist set - anyone who finds your bot can use it!")
+ allowed_users = _prompt_allowlist(
+ "TELEGRAM_ALLOWED_USERS", "Allowed user IDs (comma-separated, leave empty for open access)",
+ "Telegram allowlist configured - only listed users can use the bot",
+ "⚠️ No allowlist set - anyone who finds your bot can use it!", preset=allowed_users)
_info(None, "📬 Home Channel: where Hermes delivers cron job results,",
" cross-platform messages, and notifications.",
@@ -185,7 +192,7 @@ def _setup_telegram():
def _setup_bluebubbles():
"""Configure BlueBubbles iMessage gateway."""
- from hermes_cli.setup import _info, print_header, print_info, print_success, prompt, prompt_yes_no
+ from hermes_cli.setup import _info, print_header, print_success, prompt, prompt_yes_no
print_header("BlueBubbles (iMessage)")
if _declines_reconfigure("BLUEBUBBLES_SERVER_URL", "BlueBubbles", "Reconfigure BlueBubbles?"):
return
@@ -208,11 +215,8 @@ def _setup_bluebubbles():
_info(None, "🔒 Security: Restrict who can message your bot",
" Use iMessage addresses: email ([email protected]) or phone (+15551234567)", None)
- allowed_users = prompt("Allowed iMessage addresses (comma-separated, leave empty for open access)")
- if allowed_users:
- _save_allowlist("BLUEBUBBLES_ALLOWED_USERS", allowed_users, "BlueBubbles allowlist configured")
- else:
- print_info("⚠️ No allowlist set — anyone who can iMessage you can use the bot!")
+ _prompt_allowlist("BLUEBUBBLES_ALLOWED_USERS", "Allowed iMessage addresses (comma-separated, leave empty for open access)",
+ "BlueBubbles allowlist configured", "⚠️ No allowlist set — anyone who can iMessage you can use the bot!")
_info(None, "📬 Home Channel: phone or email for cron job delivery and notifications.",
" You can also set this later with /set-home in your iMessage chat.")
diff --git a/hermes_cli/setup_quick.py b/hermes_cli/setup_quick.py
index 76536208f75..cb5f1d191b4 100644
--- a/hermes_cli/setup_quick.py
+++ b/hermes_cli/setup_quick.py
@@ -12,9 +12,16 @@ logger = logging.getLogger("hermes_cli.setup")
# (env-var name substring, platform label, emoji) — order matters: first match wins.
_MESSAGING_PLATFORMS = (("TELEGRAM", "Telegram", "📱"), ("DISCORD", "Discord", "💬"), ("SLACK", "Slack", "💼"))
-_BLANK_SLATE_DONE_LINES = (
- " Seed skills: hermes skills opt-in --sync", " Add MCP servers: hermes mcp add",
-)
+
+
+def _blank_slate_done(config: dict, hermes_home, tools_line: str, *extra: str, intro: str | None = None) -> None:
+ """Shared Blank Slate epilogue: success banner, the "enable later" hints, then the summary."""
+ from hermes_cli.setup import _info, _print_setup_summary, print_success
+ print()
+ print_success("Blank Slate setup complete — minimal agent ready.")
+ _info(*([intro] if intro else []), tools_line, " Seed skills: hermes skills opt-in --sync",
+ " Add MCP servers: hermes mcp add", *extra, " Tune agent settings: hermes setup agent", None)
+ _print_setup_summary(config, hermes_home)
def _reload_config_into(config: dict, *, dict_only: bool = False) -> None:
@@ -213,8 +220,8 @@ def _run_blank_slate_setup(config: dict, hermes_home, is_existing: bool):
opting capabilities back in. Nothing is enabled that the user did not explicitly choose."""
from hermes_cli.setup import (
_blank_slate_minimal_toolsets, _blank_slate_minimize_config, _blank_slate_walkthrough, _info,
- print_header, print_info, _print_setup_summary, print_success, prompt_choice, save_config,
- setup_model_provider, setup_terminal_backend,
+ print_header, print_info, print_success, prompt_choice, save_config, setup_model_provider,
+ setup_terminal_backend,
)
print_header("Blank Slate Setup", gap=True)
_info("Everything starts OFF. First we force-enable only what's required",
@@ -259,18 +266,14 @@ def _run_blank_slate_setup(config: dict, hermes_home, is_existing: bool):
# Blank Slate means no bundled skills; record the opt-out so future `hermes update` runs
# don't re-inject them.
_set_bundled_skills_opt_out(True, "skill opt-out")
- print()
- print_success("Blank Slate setup complete — minimal agent ready.")
- _info("Enable anything later, on demand:", " Enable tools: hermes tools", *_BLANK_SLATE_DONE_LINES,
- " Enable plugins: hermes plugins", " Tune agent settings: hermes setup agent", None)
- _print_setup_summary(config, hermes_home)
+ _blank_slate_done(config, hermes_home, " Enable tools: hermes tools", " Enable plugins: hermes plugins",
+ intro="Enable anything later, on demand:")
def _blank_slate_walkthrough(config: dict, hermes_home):
"""Opt-in walkthrough for Blank Slate: skills, tools, plugins, MCP, gateway."""
from hermes_cli.setup import (
- _info, print_header, print_info, _print_setup_summary, print_success, print_warning, prompt_yes_no,
- save_config, setup_gateway,
+ _info, print_header, print_info, print_success, print_warning, prompt_yes_no, save_config, setup_gateway,
)
# Bundled skills — default to NONE, offer to seed all
print_header("Bundled Skills", gap=True)
@@ -326,13 +329,7 @@ def _blank_slate_walkthrough(config: dict, hermes_home):
setup_gateway(config)
save_config(config)
-
- print()
- print_success("Blank Slate setup complete — minimal agent ready.")
- _info(" Enable more tools: hermes tools", *_BLANK_SLATE_DONE_LINES,
- " Tune agent settings: hermes setup agent", None)
-
- _print_setup_summary(config, hermes_home)
+ _blank_slate_done(config, hermes_home, " Enable more tools: hermes tools")
def _run_quick_setup(config: dict, hermes_home):