chore: cr fixes

This commit is contained in:
ajspig 2026-04-14 11:50:50 -04:00
parent bc8bb9f7a8
commit af3463cf4b
2 changed files with 10 additions and 4 deletions

View File

@ -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)

View File

@ -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()