Skip to content

The agent that grows with you

refactor(hermes_cli): setup cluster — hug lone closing brackets

Tekniumf622145b84b7
diff --git a/hermes_cli/secrets_cli.py b/hermes_cli/secrets_cli.py
index 139e2e2fcc9..dc076817413 100644
--- a/hermes_cli/secrets_cli.py
+++ b/hermes_cli/secrets_cli.py
@@ -123,8 +123,7 @@ def _missing_noninteractive_flags(args: argparse.Namespace) -> list[str]:
provided = {
"--access-token": args.access_token,
"--server-url": (args.server_url or "").strip() or os.environ.get("BWS_SERVER_URL", ""),
- "--project-id": args.project_id,
- }
+ "--project-id": args.project_id}
return [flag for flag, value in provided.items() if not (value and value.strip())]
@@ -169,8 +168,7 @@ def cmd_setup(args: argparse.Namespace) -> int:
" Secrets Manager → Machine accounts → [your account] →\n"
" Access tokens → Create access token\n\n"
"Copy the token (starts with [cyan]0.[/cyan]…) — it cannot be retrieved later.",
- border_style="cyan",
- ))
+ border_style="cyan"))
binary = _setup_binary(bw, console)
if binary is None:
@@ -186,8 +184,7 @@ def cmd_setup(args: argparse.Namespace) -> int:
" hermes secrets bitwarden setup \\\n"
" --access-token '0.xxx' \\\n"
" --server-url 'https://vault.bitwarden.com' \\\n"
- " --project-id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'"
- )
+ " --project-id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'")
return 1
cfg = load_config()
@@ -214,8 +211,7 @@ def cmd_setup(args: argparse.Namespace) -> int:
_step(console, 4 if project_given else 5, "Test fetch")
try:
secrets, warnings = bw.fetch_bitwarden_secrets(
- access_token=token, project_id=project_id, binary=binary, use_cache=False, server_url=server_url,
- )
+ access_token=token, project_id=project_id, binary=binary, use_cache=False, server_url=server_url)
except Exception as exc: # noqa: BLE001
console.print(f" [red]✗ Fetch failed: {exc}[/red]")
return 1
@@ -267,8 +263,7 @@ def cmd_status(args: argparse.Namespace) -> int:
token = os.environ.get(token_env, "").strip()
binary = bw.find_bws(install_if_missing=False)
token_validation, validation_messages = _token_validation_status(
- enabled=enabled, binary=binary, token=token, server_url=server_url,
- )
+ enabled=enabled, binary=binary, token=token, server_url=server_url)
print_status_panel(console, "Bitwarden Secrets Manager", (
("Enabled", _yn(enabled)),
@@ -328,8 +323,7 @@ def cmd_token(args: argparse.Namespace) -> int:
console.print(
f"[yellow]Warning: configured project {project_id} is not visible "
"to this machine account. Grant it access in the Bitwarden web "
- "app or re-run `hermes secrets bitwarden setup` to pick a different project.[/yellow]"
- )
+ "app or re-run `hermes secrets bitwarden setup` to pick a different project.[/yellow]")
return True
return rotate_token(
@@ -347,8 +341,7 @@ def cmd_token(args: argparse.Namespace) -> int:
"[yellow]Note: the Bitwarden integration is currently disabled — "
"run `hermes secrets bitwarden setup` (or set "
"secrets.bitwarden.enabled: true) to turn it on.[/yellow]"
- ),
- )
+ ))
def cmd_sync(args: argparse.Namespace) -> int:
@@ -414,8 +407,7 @@ def cmd_disable(args: argparse.Namespace) -> int:
"[green]Disabled.[/green] Bitwarden secrets will NOT be pulled on the next "
"Hermes invocation.\n"
" Your access token is left in .env — remove it manually if you also want "
- "to revoke the credential.",
- )
+ "to revoke the credential.")
def cmd_install(args: argparse.Namespace) -> int:
@@ -481,8 +473,7 @@ def _list_projects(
try:
res = subprocess.run(
[str(binary), "project", "list", "--output", "json"],
- env=env, capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=15,
- )
+ env=env, capture_output=True, text=True, encoding='utf-8', errors='replace', timeout=15)
except (OSError, subprocess.TimeoutExpired) as exc:
console.print(f" [red]Couldn't list projects: {exc}[/red]")
return None
diff --git a/hermes_cli/send_cmd.py b/hermes_cli/send_cmd.py
index 6a6a4719346..fbad9cc143d 100644
--- a/hermes_cli/send_cmd.py
+++ b/hermes_cli/send_cmd.py
@@ -45,8 +45,7 @@ def _read_message_body(positional: Optional[str], file_path: Optional[str]) -> O
f' hermes send --to telegram "optional caption MEDIA:{file_path}"\n'
"Add [[as_document]] to deliver an image as an uncompressed file:\n"
f' hermes send --to telegram "[[as_document]] MEDIA:{file_path}"',
- _USAGE_EXIT,
- )
+ _USAGE_EXIT)
except OSError as exc:
_fail(f"hermes send: cannot read {file_path}: {exc}", _USAGE_EXIT)
@@ -110,8 +109,7 @@ def _list_targets(platform_filter: Optional[str], *, json_mode: bool) -> int:
if not filtered:
return _fail(
f"hermes send: no targets found for platform '{platform_filter}'. "
- f"Configured: {', '.join(sorted(platforms)) or '(none)'}"
- )
+ f"Configured: {', '.join(sorted(platforms)) or '(none)'}")
platforms = filtered
if json_mode:
@@ -230,16 +228,14 @@ def cmd_send(args: argparse.Namespace) -> None:
" hermes send --to telegram \"hello\"\n"
" hermes send --to discord:#ops --file report.md\n"
" hermes send --list # list available targets",
- _USAGE_EXIT,
- )
+ _USAGE_EXIT)
message = _read_message_body(getattr(args, "message", None), getattr(args, "file", None))
if message is None or not message.strip():
_fail(
"hermes send: no message provided. Pass text as a positional "
"argument, use --file PATH, or pipe data via stdin.",
- _USAGE_EXIT,
- )
+ _USAGE_EXIT)
# Optional subject line: a consistent header for alerting scripts.
subject = getattr(args, "subject", None)
@@ -310,8 +306,7 @@ def register_send_subparser(subparsers) -> argparse.ArgumentParser:
"\n"
"Exit codes: 0 ok, 1 delivery/backend error, 2 usage error."
),
- formatter_class=argparse.RawDescriptionHelpFormatter,
- )
+ formatter_class=argparse.RawDescriptionHelpFormatter)
for flags, kwargs in _SEND_ARGUMENTS:
parser.add_argument(*flags, **kwargs)
diff --git a/hermes_cli/setup.py b/hermes_cli/setup.py
index b1fc3fb53e4..97b9ea1a987 100644
--- a/hermes_cli/setup.py
+++ b/hermes_cli/setup.py
@@ -224,8 +224,7 @@ def _run_setup_steps(steps: list[tuple[str, Callable[[], None]]]) -> None:
previous_index = max(0, section_index - 1)
target_prompt = max(0, len(answers_by_section.get(previous_index, [])) - 1)
replay_by_section[previous_index] = copy.deepcopy(
- answers_by_section.get(previous_index, [])[:target_prompt]
- )
+ answers_by_section.get(previous_index, [])[:target_prompt])
print()
if previous_index == section_index:
print_info(f"Returning to the previous choice in {label}...")
@@ -717,8 +716,7 @@ def _run_full_setup(config: dict, hermes_home, *, is_existing: bool, migration_r
_step("model", "Model & Provider", lambda: setup_model_provider(config)),
_step("terminal", "Terminal Backend", lambda: setup_terminal_backend(config)),
("Messaging Platforms", _gateway_step),
- _step("tools", "Tools", lambda: setup_tools(config, first_install=not is_existing)),
- ])
+ _step("tools", "Tools", lambda: setup_tools(config, first_install=not is_existing))])
# First-time mode picker: (menu label, runner) — a None runner falls through to Full Setup.
diff --git a/hermes_cli/setup_migration.py b/hermes_cli/setup_migration.py
index 252dd50090d..3332a1432dd 100644
--- a/hermes_cli/setup_migration.py
+++ b/hermes_cli/setup_migration.py
@@ -217,8 +217,7 @@ def _print_migration_preview(report: dict):
if status == "migrated": # collect warnings for high-impact items
kind_lower, dest_lower = kind.lower(), str(item.get("destination", "")).lower()
warnings_shown.update(
- w for kw, w in _HIGH_IMPACT_KIND_KEYWORDS.items() if kw in kind_lower or kw in dest_lower
- )
+ w for kw, w in _HIGH_IMPACT_KIND_KEYWORDS.items() if kw in kind_lower or kw in dest_lower)
print()
if warnings_shown:
diff --git a/hermes_cli/setup_platforms.py b/hermes_cli/setup_platforms.py
index 8b678e6b7e3..8d4174bbe73 100644
--- a/hermes_cli/setup_platforms.py
+++ b/hermes_cli/setup_platforms.py
@@ -282,8 +282,7 @@ def _warn_missing_home_channels() -> None:
from hermes_cli.setup import get_env_value, _info, print_warning
missing_home = [
plat for plat, token_var, home_vars in _HOME_CHANNEL_CHECKS
- if get_env_value(token_var) and not any(get_env_value(v) for v in home_vars)
- ]
+ if get_env_value(token_var) and not any(get_env_value(v) for v in home_vars)]
if not missing_home:
return
print()