From af3463cf4b9619b15ff61071ab24aeabdab549cf Mon Sep 17 00:00:00 2001 From: ajspig Date: Tue, 14 Apr 2026 11:50:50 -0400 Subject: [PATCH] chore: cr fixes --- honcho-cli/src/honcho_cli/commands/conclusion.py | 5 +++-- honcho-cli/src/honcho_cli/commands/setup.py | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/honcho-cli/src/honcho_cli/commands/conclusion.py b/honcho-cli/src/honcho_cli/commands/conclusion.py index a330d8ca..dc742db4 100644 --- a/honcho-cli/src/honcho_cli/commands/conclusion.py +++ b/honcho-cli/src/honcho_cli/commands/conclusion.py @@ -134,8 +134,9 @@ def create( # If content looks like JSON, try to parse it try: payload = json.loads(content) - content = payload.get("content", content) - except (json.JSONDecodeError, AttributeError): + if isinstance(payload, dict): + content = payload.get("content", content) + except json.JSONDecodeError: pass p = client.peer(observer) diff --git a/honcho-cli/src/honcho_cli/commands/setup.py b/honcho-cli/src/honcho_cli/commands/setup.py index be8e1829..c357f231 100644 --- a/honcho-cli/src/honcho_cli/commands/setup.py +++ b/honcho-cli/src/honcho_cli/commands/setup.py @@ -144,6 +144,9 @@ def _confirm_or_prompt_api_key(value: str, source: str) -> str: _console.print(f" API key: [dim]{_redact(value)}[/dim] [{BRAND}](from {source})[/{BRAND}]") if use_json() or typer.confirm(" Use this API key?", default=True): return value + if use_json(): + print_error("MISSING_VALUE", "API key is required", {}) + raise typer.Exit(1) # Never set ``default=`` to the raw key — typer would echo it in brackets. new = typer.prompt(" API key") if not new: @@ -160,8 +163,10 @@ def _confirm_or_prompt_url(value: str, source: str) -> str: _console.print(f" Honcho URL: [dim]{value}[/dim] [{BRAND}](from {source})[/{BRAND}]") if use_json() or typer.confirm(" Use this URL?", default=True): return value - if not use_json(): - _console.print(" [dim](e.g. https://api.honcho.dev for managed, http://localhost:8000 for local)[/dim]") + if use_json(): + print_error("MISSING_VALUE", "Honcho URL is required", {}) + raise typer.Exit(1) + _console.print(" [dim](e.g. https://api.honcho.dev for managed, http://localhost:8000 for local)[/dim]") return typer.prompt(" Honcho URL", default=DEFAULT_BASE_URL).strip()