Skip to content

Extend --output json to sandbox list, sandbox create, and status commands #1964

Description

@zanetworker

Problem Statement

sandbox get and status output human-readable colored text with no machine-readable format option. Programmatic callers (Go, Rust, shell scripts) must parse ANSI-colored output and strip escape codes to extract sandbox details and gateway status.

sandbox list and provider list already support --output json/yaml/table via the OutputFormat enum. sandbox get and status do not.

Remaining Gaps

Command Current Gap
sandbox list Has --output json/yaml/table None
provider list Has --output json/yaml/table None
sandbox get Human-readable colored text only No --output flag
status Human-readable colored text only No --output flag

Proposed Design

Add --output json/yaml to sandbox get and status using the existing OutputFormat enum and sandbox_to_json helper.

sandbox get --output json:

{"id":"abc-123","name":"happy-fox","phase":"Ready","labels":{},"resource_version":42,"created_at":"2026-06-21 10:00:00","current_policy_version":2}

status --output json:

{"gateway":"podman-test","server":"http://127.0.0.1:8090","status":"connected","version":"0.0.66"}

Alternatives Considered

  1. Use the Python SDK — Works for Python callers. The SDK returns structured SandboxRef objects for get and list.
  2. Parse CLI output — Current approach for non-Python callers. Works but fragile.

Agent Investigation

  • sandbox get renders at run.rs:2535 with println! calls, no format flag
  • status renders at run.rs:507 with println! calls, no format flag
  • OutputFormat enum and print_output_collection helper in output.rs are reusable
  • sandbox_to_json() at run.rs:3352 already serializes sandbox objects to JSON

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions