feat(sandbox): add --json and --non-interactive to the sandbox root#102
Open
crowlbot wants to merge 2 commits into
Open
feat(sandbox): add --json and --non-interactive to the sandbox root#102crowlbot wants to merge 2 commits into
crowlbot wants to merge 2 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
deno deployroot exposes global-j, --jsonand-y, --non-interactiveflags (so agents/CI can get machine-readable output and fail fast instead of hanging on prompts), but the standalonedeno sandboxroot did not. An agent drivingdeno sandboxnon-interactively would hit ANSI color codes, table-formatted output, and — with no token — the OAuth browser flow.This brings
deno sandboxto parity.Changes
--json/--non-interactiveasglobalOptions onsandboxCommand, and disable ANSI color in JSON mode (setColorEnabled(false)), mirroringdeployCommand.… --json | jqstays 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/snapshotandsnapshots create/list/delete--non-interactivethreads through the sharedgetOrg(), which already refuses prompts and names the--orgflag to pass — no per-command wiring needed.exec,ssh, session-modecreate) are intentionally left as-is; JSON output is not meaningful for a streamed/interactive session.Tests
tests/agent.test.tsgains two cases:deno sandbox --helpadvertises both--jsonand--non-interactive.--jsonmode 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.