Skip to content

Commit 340c61f

Browse files
crowlbotclaude
authored andcommitted
feat: add --json, --non-interactive flags and exit-code taxonomy
Make the CLI usable by AI agents and CI bots: - Global `--json` flag emits a single JSON object/array on stdout and a structured `{ error: { code, message, hint, traceId } }` envelope on stderr. Suppresses spinners, progress bars, and ANSI color so output pipes cleanly into `jq`. Wired into `publish` (final result with revisionId, URL, status, timelines) and `create` (including `--dry-run`, which now emits the resolved build config as JSON). - Global `-y, --non-interactive, --yes` flag makes `requireInteractive()` fail fast with a clear `NON_INTERACTIVE_REQUIRED` error instead of hanging on stdin, even on a TTY. Same flag on both `deploy` and `sandbox` roots. - `ExitCode` enum (OK=0, GENERIC=1, USAGE=2, AUTH=3, NOT_FOUND=4, CONFLICT=5, NETWORK=6). `error()` accepts `{ code, errorCode, hint, response }` and exits with the matching numeric code. tRPC errors are mapped via `mapTrpcError()`: 401/403/NOT_AUTHENTICATED/TOKEN_EXPIRED → AUTH, 404 → NOT_FOUND, 409 → CONFLICT, 5xx → NETWORK. Invalid-token path emits `AUTH_INVALID_TOKEN` with an explicit hint pointing at `DENO_DEPLOY_TOKEN` rather than retrying through a browser. - Move the keychain-unavailable warning from stdout to stderr so it doesn't pollute machine-readable output. Adds `tests/agent.test.ts` covering JSON dry-run, non-interactive short-circuit, `AUTH_INVALID_TOKEN` envelope, and the `-y` alias. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 73b65b9 commit 340c61f

0 file changed

File tree

    0 commit comments

    Comments
     (0)