feat(cli): consistent --json success envelope + batch --output/--follow polish - #9
Merged
Merged
Conversation
…ow polish
Additive CLI-consistency pass (the safe half of the coherence review;
the exit-code contract change is deferred to its own PR):
- every success --json path now leads with a flat `ok` field, matching the
established shape (fetch/browser/batch already did). Errors already emit
`{ok:false, error}` via printError, so agents can branch on `.ok` uniformly.
Touched: account/config/policy/usage/mcp/plugin/trace/browser(info)/batch
(estimate) + asset explain/validate. `ok` reflects validity where meaningful
(estimate, asset validate). Raw-dump paths left as-is by intent (trace
export, eval stored results, browser human-readable fallback).
- batch `--output`: fail loudly (INVALID_USAGE) on an unknown format instead of
silently dropping it — matching fetch's normalizeOutput (no silent drops).
- batch `--follow`: clearer name for "poll until done"; `--wait` kept as a
back-compat alias (fetch/extract use `--wait <ms>` for a different meaning).
- tests: --output loud-fail (no-network) + estimate --json envelope (ok true/false).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The top-level catch mapped CAPABILITY_UNAVAILABLE to exit 2, but the capability-gated commands (fetch/extract/batch/browser) all catch internally and return 1, so that branch never fired — the CLI already exits 1 on every error in practice, and no docs promised otherwise. Make the contract honest: any error exits 1. Machine consumers read the precise `error.code` from --json output to tell a denial from a failure, which is finer- grained than a 1-vs-2 exit code would ever be. Behavior-preserving. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Additive CLI-consistency pass (the safe half of the coherence review; the exit-code contract change is deferred to its own PR):
okfield, matching the established shape (fetch/browser/batch already did). Errors already emit{ok:false, error}via printError, so agents can branch on.okuniformly. Touched: account/config/policy/usage/mcp/plugin/trace/browser(info)/batch (estimate) + asset explain/validate.okreflects validity where meaningful (estimate, asset validate). Raw-dump paths left as-is by intent (trace export, eval stored results, browser human-readable fallback).--output: fail loudly (INVALID_USAGE) on an unknown format instead of silently dropping it — matching fetch's normalizeOutput (no silent drops).--follow: clearer name for "poll until done";--waitkept as a back-compat alias (fetch/extract use--wait <ms>for a different meaning).