Repository navigation
Conversation
|
Claude finished @alukach's task in 18s —— View job ✅ No blocking issues — safe to merge. I read the diff and didn't run the tests. I found no correctness or security problems. Non-blocking notes:
Simplify (ponytail)
💰 Estimated review cost: $0.15 · 0m18s · 6 turns |
alukach
force-pushed
the
feat/json-output
branch
from
October 14, 2026 17:42
af4bba8 to
64e8b1a
Compare
alukach
force-pushed
the
feat/json-output
branch
from
October 14, 2026 18:00
64e8b1a to
efe0cbd
Compare
AGENTS.md gets the JSON-output rules: --json on every command that
reports information, one document on stdout, API field names, additive
changes only, output::json for printing, JSON errors on stderr, and one
table of exit codes.
fail(e, json) prints a failure as {"error": {code, message, status?,
field_errors?}} under --json and exits with its kind: 3 rejected input,
4 not signed in or not allowed, 5 not found, 130 interrupted, else 1.
failure.rs recovers the API's code, status and field errors from the
String errors commands return (a bridge until errors are typed).
auth status --json prints what auth status shows as data, with the
account's profile_url and the refresh token's issue time.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alukach
force-pushed
the
feat/json-output
branch
from
October 14, 2026 18:16
efe0cbd to
1c786a2
Compare
This was referenced Oct 14, 2026
Contributor
Author
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.
Why
Scripts and AI agents should never have to parse output laid out for people. This PR makes
--jsona contract across the CLI, writes the rules down for future commands, and givesauth statusa--jsonform.What
Rules:
AGENTS.md, "JSON output" (whichCLAUDE.mdimports):--json. The exceptions already print for machines or are interactive:creds,exec,auth token,api,-i.output::json.Errors and exit codes, for every command:
fail(e, json)prints a failure under--jsonas{"error": {"code", "message", "status"?, "field_errors"?}}, the API's own error shape, on stderr, keeping stdout empty.It exits with the failure's kind:
Without
--jsonthe message is printed as before.How the API's details survive (
src/failure.rs): commands pass errors around as plain text (String), which drops the API's code, status and field errors.failure::rememberrecords them as an API error is turned into text, andclassifyfinds them again in the text that reachesfail(), even when wrapped (for example by the saved-draft note). It's a deliberate bridge, marked with aponytail:comment naming the proper fix: a typed error, which would mean rewriting about 80 function signatures across files under active change.auth status --json: whatauth statusshows, as data: environment,logged_in, the login's state, account (account_id,name,profile_url), each token's times with anexpiredflag (the refresh token'sissued_at), and the role's cached credentials. The Profile row and the refresh token's renewal time themselves are in #40.Also: product
print_jsongoes throughoutput::json, andProductCommand::wants_json()tellsfailwhether--jsonwas asked for. The README documentsauth status --json, and JSON output and exit codes.Testing
cargo testandcargo test --features staging: 99 passed. New:status_json.cargo clippy --all-targets -- -D warningsandcargo fmt --check: clean.HOMEfor a made-up environment (so no keychain entry was read), against a local stub API:auth status --jsonreturns the document above;product view acct/nope --jsonleaves stdout empty, prints{"error":{"code":"not_found","message":"Product acct/nope not found","status":404}}on stderr, and exits 5. Without--jsonit prints the prose error, also exiting 5.🤖 Generated with Claude Code