fix: removing quiet tag and fixing session key ordering
This commit is contained in:
parent
e99174073b
commit
37985b2dcd
|
|
@ -169,7 +169,6 @@ honcho peer inspect other_id # positional arg still takes precedence
|
|||
| Flag | Description |
|
||||
|------|-------------|
|
||||
| `--json` | Force JSON output |
|
||||
| `--quiet` / `-q` | Suppress status messages |
|
||||
| `--workspace` / `-w` | Override workspace ID |
|
||||
| `--peer` / `-p` | Override peer ID |
|
||||
| `--session` / `-s` | Override session ID |
|
||||
|
|
|
|||
|
|
@ -181,14 +181,13 @@ def delete(
|
|||
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", help="Override workspace ID"),
|
||||
peer: Optional[str] = typer.Option(None, "--peer", "-p", help="Override peer ID"),
|
||||
quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress status messages"),
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
) -> None:
|
||||
"""Delete a conclusion."""
|
||||
from honcho_cli.common import handle_cmd_flags
|
||||
from honcho_cli.main import get_client
|
||||
|
||||
handle_cmd_flags(json_output=json_output, quiet=quiet, workspace=workspace, peer=peer)
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace, peer=peer)
|
||||
validate_resource_id(conclusion_id, "conclusion")
|
||||
client, config = get_client()
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ def list_messages(
|
|||
brief: bool = typer.Option(False, "--brief", help="Show only IDs, peer, token count, and created_at (no content)"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", help="Override workspace ID"),
|
||||
session: Optional[str] = typer.Option(None, "--session", "-s", help="Override session ID"),
|
||||
quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress status messages"),
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
) -> None:
|
||||
"""List messages in a session."""
|
||||
|
|
@ -33,7 +32,7 @@ def list_messages(
|
|||
from honcho_cli.common import handle_cmd_flags
|
||||
from honcho_cli.main import get_client
|
||||
|
||||
handle_cmd_flags(json_output=json_output, quiet=quiet, workspace=workspace, session=session)
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace, session=session)
|
||||
sid = _get_session_id(session_id)
|
||||
client, config = get_client()
|
||||
sess = client.session(sid)
|
||||
|
|
|
|||
|
|
@ -173,14 +173,13 @@ def delete(
|
|||
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", help="Override workspace ID"),
|
||||
session: Optional[str] = typer.Option(None, "--session", "-s", help="Override session ID"),
|
||||
quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress status messages"),
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
) -> None:
|
||||
"""Delete a session and all its data. Destructive — requires --yes or interactive confirm."""
|
||||
from honcho_cli.common import handle_cmd_flags
|
||||
from honcho_cli.main import get_client
|
||||
|
||||
handle_cmd_flags(json_output=json_output, quiet=quiet, workspace=workspace, session=session)
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace, session=session)
|
||||
sid = _get_session_id(session_id)
|
||||
client, config = get_client()
|
||||
sess = client.session(sid)
|
||||
|
|
@ -297,13 +296,14 @@ def search(
|
|||
session_id: Optional[str] = typer.Argument(None, help="Session ID (uses default if omitted)"),
|
||||
limit: int = typer.Option(10, help="Max results"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", help="Override workspace ID"),
|
||||
session: Optional[str] = typer.Option(None, "--session", "-s", help="Override session ID"),
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
) -> None:
|
||||
"""Search messages in a session."""
|
||||
from honcho_cli.common import handle_cmd_flags
|
||||
from honcho_cli.main import get_client
|
||||
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace)
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace, session=session)
|
||||
sid = _get_session_id(session_id)
|
||||
client, config = get_client()
|
||||
sess = client.session(sid)
|
||||
|
|
@ -332,13 +332,14 @@ def representation(
|
|||
search_query: Optional[str] = typer.Option(None, help="Semantic search query to filter conclusions"),
|
||||
max_conclusions: Optional[int] = typer.Option(None, help="Maximum number of conclusions to include"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", help="Override workspace ID"),
|
||||
session: Optional[str] = typer.Option(None, "--session", "-s", help="Override session ID"),
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
) -> None:
|
||||
"""Get the representation of a peer within a session."""
|
||||
from honcho_cli.common import handle_cmd_flags
|
||||
from honcho_cli.main import get_client
|
||||
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace)
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace, session=session)
|
||||
sid = _get_session_id(session_id)
|
||||
client, config = get_client()
|
||||
sess = client.session(sid)
|
||||
|
|
@ -380,16 +381,17 @@ def get_metadata(
|
|||
|
||||
@app.command("set-metadata")
|
||||
def set_metadata(
|
||||
metadata: str = typer.Argument(help="JSON metadata to set (e.g. '{\"key\": \"value\"}')"),
|
||||
session_id: Optional[str] = typer.Argument(None, help="Session ID (uses default if omitted)"),
|
||||
metadata: str = typer.Option(..., "--data", "-d", help="JSON metadata to set (e.g. '{\"key\": \"value\"}')"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", help="Override workspace ID"),
|
||||
session: Optional[str] = typer.Option(None, "--session", "-s", help="Override session ID"),
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
) -> None:
|
||||
"""Set metadata for a session."""
|
||||
from honcho_cli.common import handle_cmd_flags
|
||||
from honcho_cli.main import get_client
|
||||
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace)
|
||||
handle_cmd_flags(json_output=json_output, workspace=workspace, session=session)
|
||||
sid = _get_session_id(session_id)
|
||||
client, config = get_client()
|
||||
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ def delete(
|
|||
yes: bool = typer.Option(False, "--yes", "-y", help="Skip confirmation prompt (for scripted/agent use)"),
|
||||
cascade: bool = typer.Option(False, "--cascade", help="Delete all sessions before deleting the workspace"),
|
||||
dry_run: bool = typer.Option(False, "--dry-run", help="Show what would be deleted without deleting"),
|
||||
quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress status messages"),
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
) -> None:
|
||||
"""Delete a workspace. Use --dry-run first to see what will be deleted.
|
||||
|
|
@ -120,7 +119,7 @@ def delete(
|
|||
from honcho_cli.common import handle_cmd_flags
|
||||
from honcho_cli.main import get_client
|
||||
|
||||
handle_cmd_flags(json_output=json_output, quiet=quiet)
|
||||
handle_cmd_flags(json_output=json_output)
|
||||
|
||||
validate_resource_id(workspace_id, "workspace")
|
||||
# workspace_id is a required positional and we rebuild the client with it
|
||||
|
|
|
|||
|
|
@ -13,12 +13,11 @@ from typing import Optional
|
|||
|
||||
import typer
|
||||
|
||||
from honcho_cli.output import set_json_mode, set_quiet_mode
|
||||
from honcho_cli.output import set_json_mode
|
||||
|
||||
|
||||
def handle_cmd_flags(
|
||||
json_output: bool = False,
|
||||
quiet: bool = False,
|
||||
workspace: str | None = None,
|
||||
peer: str | None = None,
|
||||
session: str | None = None,
|
||||
|
|
@ -26,8 +25,6 @@ def handle_cmd_flags(
|
|||
"""Apply command-level flags. Idempotent if already set by group callback."""
|
||||
if json_output:
|
||||
set_json_mode(True)
|
||||
if quiet:
|
||||
set_quiet_mode(True)
|
||||
|
||||
from honcho_cli.main import _global_overrides
|
||||
|
||||
|
|
@ -40,21 +37,18 @@ def handle_cmd_flags(
|
|||
|
||||
|
||||
def add_common_options(app: typer.Typer) -> None:
|
||||
"""Add a callback to a sub-app that accepts --json, --quiet, -w, -p, -s."""
|
||||
"""Add a callback to a sub-app that accepts --json, -w, -p, -s."""
|
||||
|
||||
@app.callback(invoke_without_command=True)
|
||||
def _callback(
|
||||
ctx: typer.Context,
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress status messages"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", help="Override workspace ID"),
|
||||
peer: Optional[str] = typer.Option(None, "--peer", "-p", help="Override peer ID"),
|
||||
session: Optional[str] = typer.Option(None, "--session", "-s", help="Override session ID"),
|
||||
) -> None:
|
||||
if json_output:
|
||||
set_json_mode(True)
|
||||
if quiet:
|
||||
set_quiet_mode(True)
|
||||
|
||||
from honcho_cli.main import _global_overrides
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from typing import Optional
|
|||
import typer
|
||||
|
||||
from honcho_cli import __version__
|
||||
from honcho_cli.output import set_json_mode, set_quiet_mode
|
||||
from honcho_cli.output import set_json_mode
|
||||
|
||||
BANNER = r"""
|
||||
██╗ ██╗ ██████╗ ███╗ ██╗ ██████╗██╗ ██╗ ██████╗
|
||||
|
|
@ -57,7 +57,6 @@ def version_callback(value: bool) -> None:
|
|||
def main(
|
||||
ctx: typer.Context,
|
||||
json_output: bool = typer.Option(False, "--json", help="Force JSON output"),
|
||||
quiet: bool = typer.Option(False, "--quiet", "-q", help="Suppress status messages"),
|
||||
workspace: Optional[str] = typer.Option(None, "--workspace", "-w", envvar="HONCHO_WORKSPACE_ID", help="Override workspace ID"),
|
||||
peer: Optional[str] = typer.Option(None, "--peer", "-p", envvar="HONCHO_PEER_ID", help="Override peer ID"),
|
||||
session: Optional[str] = typer.Option(None, "--session", "-s", envvar="HONCHO_SESSION_ID", help="Override session ID"),
|
||||
|
|
@ -65,7 +64,6 @@ def main(
|
|||
) -> None:
|
||||
"""Honcho CLI — admin & debugging tool for Honcho workspaces."""
|
||||
set_json_mode(json_output)
|
||||
set_quiet_mode(quiet)
|
||||
|
||||
# Store global overrides for commands to access
|
||||
_global_overrides["workspace"] = workspace
|
||||
|
|
|
|||
|
|
@ -21,9 +21,8 @@ def is_tty() -> bool:
|
|||
return sys.stdout.isatty()
|
||||
|
||||
|
||||
# Global state for --json and --quiet flags
|
||||
# Global state for --json flag
|
||||
_force_json = False
|
||||
_quiet = False
|
||||
|
||||
|
||||
def set_json_mode(enabled: bool) -> None:
|
||||
|
|
@ -31,10 +30,6 @@ def set_json_mode(enabled: bool) -> None:
|
|||
_force_json = enabled
|
||||
|
||||
|
||||
def set_quiet_mode(enabled: bool) -> None:
|
||||
global _quiet
|
||||
_quiet = enabled
|
||||
|
||||
|
||||
def use_json() -> bool:
|
||||
"""Should we output JSON?"""
|
||||
|
|
@ -115,6 +110,5 @@ def print_error(code: str, message: str, details: dict | None = None) -> None:
|
|||
|
||||
|
||||
def status(msg: str) -> None:
|
||||
"""Print a status message (suppressed in quiet mode)."""
|
||||
if not _quiet:
|
||||
console.print(f"[dim]{msg}[/dim]")
|
||||
"""Print a status message to stderr."""
|
||||
console.print(f"[dim]{msg}[/dim]")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ description: A terminal for Honcho — memory that reasons.
|
|||
- **TTY**: Human-readable tables (default when interactive)
|
||||
- **Piped/scripted**: JSON/NDJSON automatically
|
||||
- `--json`: Force JSON output
|
||||
- `--quiet`: Suppress status messages
|
||||
|
||||
## Exit Codes
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue