feat: emit JSON for env list, database list/query, and logs (NDJSON)#93
Open
crowlbot wants to merge 1 commit into
Open
feat: emit JSON for env list, database list/query, and logs (NDJSON)#93crowlbot wants to merge 1 commit into
crowlbot wants to merge 1 commit into
Conversation
This was referenced May 13, 2026
cfd9e77 to
535af87
Compare
Third slice of the agent-ergonomics series. Wires `--json` (from #91) into the list/inspect commands that an agent would normally pipe into `jq`: - `env list --json` — array of `{ id, key, value, isSecret, contexts }`. Secret values are emitted as `null` rather than the `***` placeholder so agents can tell "secret" from "literally three asterisks". Contexts are resolved to names. - `database list --json` — array of database instances with `name`, `engine`, `createdAt`, `assignments` (app slugs), `connection` (the safe-to-display fields), and a nested `databases` array. - `database query --json` — `{ rows: [...] }` on success; `{ error: { code, message, ... } }` (via the existing error envelope) with errorCode `POSTGRES_ERROR` or `QUERY_ERROR` on failure. - `logs --json` — NDJSON: one log record per line on stdout, fields flattened to lowerCamelCase (`timestamp`, `traceId`, `severity`, `severityNumber`, `body`, `scope`, `revision`, `attributes`). Pipes cleanly into `jq -c .` or `grep -F`. The "connected, streaming logs" preamble is suppressed. Human output is unchanged when `--json` is not set. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
dabbbef to
3594eb9
Compare
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.
Summary
Stacked on #92 (which is stacked on #91). Wires the
--jsonglobal flag from #91 into the list/inspect commands an agent would normally pipe into `jq`.What's in this PR
{ id, key, value, isSecret, contexts }. Secret values come back asnullrather than the human-mode***placeholder, so agents can distinguish "secret" from "literally three asterisks". Contexts are resolved to names.name,engine,createdAt,assignments(app slugs),connection(the safe-to-display fields), and a nesteddatabasesarray.{ rows: [...] }.errorCode: POSTGRES_ERRORorQUERY_ERROR.timestamp,traceId,spanId,severity,severityNumber,body,scope,revision,attributes). The "connected, streaming logs" preamble is suppressed in JSON mode. Pipes cleanly into `jq -c .` or `grep -F`.Human output is unchanged when
--jsonis not set.Test plan
deno fmtcleandeno lintcleandeno check main.ts— 114 errors, same asmain. No new regressions.deno test -A tests/agent.test.ts tests/create.test.ts— 23/23 pass.env list --jsonpayload shape against the existingEnvVarshape in the tRPC query.database list --jsonpayload against the response type already declared in the file.logs --jsonwrites via `Deno.stdout.writeSync` to avoid color/buffering interleaving with stderr.Follow-up
New list subcommands (`apps list`, `orgs list`, `deployments list`) come in the next PR — keeping this one tight.
🤖 Generated with Claude Code