Skip to content

feat(sandbox): add --json and --non-interactive to the sandbox root#102

Open
crowlbot wants to merge 2 commits into
mainfrom
sandbox-json-noninteractive
Open

feat(sandbox): add --json and --non-interactive to the sandbox root#102
crowlbot wants to merge 2 commits into
mainfrom
sandbox-json-noninteractive

Conversation

@crowlbot
Copy link
Copy Markdown
Contributor

@crowlbot crowlbot commented Jun 3, 2026

What

The deno deploy root exposes global -j, --json and -y, --non-interactive flags (so agents/CI can get machine-readable output and fail fast instead of hanging on prompts), but the standalone deno sandbox root did not. An agent driving deno sandbox non-interactively would hit ANSI color codes, table-formatted output, and — with no token — the OAuth browser flow.

This brings deno sandbox to parity.

Changes

  • Register --json / --non-interactive as globalOptions on sandboxCommand, and disable ANSI color in JSON mode (setColorEnabled(false)), mirroring deployCommand.
  • Emit a single JSON object/array on stdout for the data-producing subcommands, with human progress kept on stderr so … --json | jq stays clean:
    • sandbox list{ items: [{ id, status, region, createdAt, stoppedAt }], org }
    • sandbox create (detached, non-session) → { id }
    • sandbox extend{ id, timeout }
    • sandbox deploy{ id, app, deployed: true }
    • sandbox kill{ id, killed }
    • volumes create/list/delete/snapshot and snapshots create/list/delete
  • --non-interactive threads through the shared getOrg(), which already refuses prompts and names the --org flag to pass — no per-command wiring needed.
  • Interactive stdio-passthrough paths (exec, ssh, session-mode create) are intentionally left as-is; JSON output is not meaningful for a streamed/interactive session.

Tests

tests/agent.test.ts gains two cases:

  • deno sandbox --help advertises both --json and --non-interactive.
  • A sandbox command in --json mode emits a structured error envelope (never a browser/hang) with a clean stdout.

Human-interactive behavior is unchanged when stdout is a TTY and neither flag is set.

crowlbot and others added 2 commits June 3, 2026 04:49
The `deno deploy` root exposes global `-j, --json` and
`-y, --non-interactive` flags, but the standalone `deno sandbox` root
did not, so agents driving `deno sandbox` couldn't get machine-readable
output or fail-fast prompt refusal — they'd hit color codes, table
output, and (without a token) the OAuth browser flow.

- Register `--json` / `--non-interactive` as globalOptions on
  sandboxCommand and disable ANSI color in JSON mode, mirroring the
  deploy root.
- Emit a single JSON object/array on stdout for the data-producing
  subcommands: `sandbox list`, `sandbox create` (detached), `extend`,
  `deploy`, `kill`, and the `volumes`/`snapshots` create/list/delete/
  snapshot commands. Progress stays on stderr; stdout is jq-clean.
- `--non-interactive` threads through the shared getOrg(), which already
  refuses prompts and names the `--org` flag to pass.
- Tests: assert the sandbox root advertises both flags and that a
  sandbox command in `--json` mode emits a structured error envelope
  (never a browser/hang) with a clean stdout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants