Skip to content

feat(cli): consistent --json success envelope + batch --output/--follow polish - #9

Merged
AnderRV merged 2 commits into
feat/batch-coherencefrom
feat/cli-consistency
Aug 4, 2026
Merged

feat(cli): consistent --json success envelope + batch --output/--follow polish#9
AnderRV merged 2 commits into
feat/batch-coherencefrom
feat/cli-consistency

Conversation

@AnderRV

@AnderRV AnderRV commented Aug 3, 2026

Copy link
Copy Markdown
Member

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).

…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>
@AnderRV AnderRV self-assigned this Aug 3, 2026
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>
@AnderRV
AnderRV marked this pull request as ready for review August 4, 2026 07:35
@AnderRV
AnderRV merged commit 51cfb36 into feat/batch-coherence Aug 4, 2026
@AnderRV
AnderRV deleted the feat/cli-consistency branch August 4, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant