diff --git a/cli.py b/cli.py index 706221506..223c40563 100644 --- a/cli.py +++ b/cli.py @@ -3836,6 +3836,8 @@ class HermesCLI: self.console.print(f" Status bar {state}") elif canonical == "verbose": self._toggle_verbose() + elif canonical == "yolo": + self._toggle_yolo() elif canonical == "reasoning": self._handle_reasoning_command(cmd_original) elif canonical == "compress": @@ -4434,6 +4436,17 @@ class HermesCLI: } _cprint(labels.get(self.tool_progress_mode, "")) + def _toggle_yolo(self): + """Toggle YOLO mode — skip all dangerous command approval prompts.""" + import os + current = bool(os.environ.get("HERMES_YOLO_MODE")) + if current: + os.environ.pop("HERMES_YOLO_MODE", None) + self.console.print(" ⚠ YOLO mode [bold red]OFF[/] — dangerous commands will require approval.") + else: + os.environ["HERMES_YOLO_MODE"] = "1" + self.console.print(" ⚡ YOLO mode [bold green]ON[/] — all commands auto-approved. Use with caution.") + def _handle_reasoning_command(self, cmd: str): """Handle /reasoning — manage effort level and display toggle. diff --git a/gateway/run.py b/gateway/run.py index 2bd623b62..de077ede8 100644 --- a/gateway/run.py +++ b/gateway/run.py @@ -1877,6 +1877,9 @@ class GatewayRunner: if canonical == "verbose": return await self._handle_verbose_command(event) + if canonical == "yolo": + return await self._handle_yolo_command(event) + if canonical == "provider": return await self._handle_provider_command(event) @@ -4109,6 +4112,16 @@ class GatewayRunner: else: return f"🧠 ✓ Reasoning effort set to `{effort}` (this session only)" + async def _handle_yolo_command(self, event: MessageEvent) -> str: + """Handle /yolo — toggle dangerous command approval bypass.""" + current = bool(os.environ.get("HERMES_YOLO_MODE")) + if current: + os.environ.pop("HERMES_YOLO_MODE", None) + return "⚠️ YOLO mode **OFF** — dangerous commands will require approval." + else: + os.environ["HERMES_YOLO_MODE"] = "1" + return "⚡ YOLO mode **ON** — all commands auto-approved. Use with caution." + async def _handle_verbose_command(self, event: MessageEvent) -> str: """Handle /verbose command — cycle tool progress display mode. diff --git a/hermes_cli/commands.py b/hermes_cli/commands.py index 26247c066..f043ec73f 100644 --- a/hermes_cli/commands.py +++ b/hermes_cli/commands.py @@ -90,6 +90,8 @@ COMMAND_REGISTRY: list[CommandDef] = [ CommandDef("verbose", "Cycle tool progress display: off -> new -> all -> verbose", "Configuration", cli_only=True, gateway_config_gate="display.tool_progress_command"), + CommandDef("yolo", "Toggle YOLO mode (skip all dangerous command approvals)", + "Configuration"), CommandDef("reasoning", "Manage reasoning effort and display", "Configuration", args_hint="[level|show|hide]", subcommands=("none", "low", "minimal", "medium", "high", "xhigh", "show", "hide", "on", "off")),