Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(cli): add --json output mode to release and release-react#43

Merged
Monoradioactivo merged 1 commit into
mainfrom
feat/cli-json-output
May 29, 2026
Merged

feat(cli): add --json output mode to release and release-react#43
Monoradioactivo merged 1 commit into
mainfrom
feat/cli-json-output

Conversation

@Monoradioactivo

Copy link
Copy Markdown
Owner

Summary

Adds a --json flag to release and release-react. When set, the CLI emits a single-line JSON object describing the released package as the last line of stdout; all progress messages route to stderr. The motivation is the upcoming aetherpush/deploy-action GitHub Action, which needs structured outputs (label, package hash, size, etc.) to chain post-release steps without parsing prose with regex.

Behavior

With --json:

  • stdout receives exactly one line: a compact JSON object.
  • stderr receives all the human-readable progress (Uploading release package..., hermes/signing notices, success line).
  • On failure: nothing on stdout, human error on stderr, exit non-zero. Standard UNIX convention.
  • Pipes work clean: aether release MyApp ./bundle.js 1.0.0 --json | jq .label.

Without --json: zero change from current behavior.

Schema

The JSON object reuses the Package returned by the server (already typed Promise<Package> on the SDK), so it reflects the post-upload truth — label assigned, hash computed, size measured, description with the [ci=...] bracket already injected by Phase 4's --ci-metadata.

Fields: label, packageHash, size, appVersion, blobUrl, manifestBlobUrl, description, releasedBy, releaseMethod, uploadTime, rollout, isMandatory, isDisabled. Undefined fields are dropped from the JSON.

Design notes

The flag is scoped to release and release-react (declared per-builder, not in addCommonConfiguration). It does not autoset --non-interactive or vice versa — the two flags are orthogonal.

releaseReact already delegates to release at the end of its bundle/hermes/sign chain, so a single JSON emit point in release() covers both commands. The shared progressLog(command, message) helper routes 7 progress sites in the two functions to stderr when command.json is set.

The formatter lives in a small script/utils/release-json.ts module. promote and patch are out of scope for this PR but can adopt the same formatter in roughly three lines each when needed.

Tests

  • __tests__/utils/release-json.test.ts: shape with a full package, dropping of undefined fields, single-line guarantee.
  • __tests__/command-parser.test.ts: --json absent leaves the field undefined, present sets it true on both release and release-react.
  • __tests__/command-executor.test.ts: with --json, the last stdout line parses as JSON and matches schema while the upload notice goes to stderr; without --json, the upload notice stays on stdout and no JSON line appears.

Coverage on release-json.ts: 100% across statements, branches, functions, lines. Suite total 392 tests, all passing.

Type of change

  • feat
  • fix
  • refactor
  • chore
  • docs

Checklist

  • Build and typecheck pass locally (npm run build)
  • Tests added or updated (when test infrastructure is wired up)
  • Relevant docs updated

When --json is passed to release or release-react, the CLI emits a
single-line JSON object describing the released package as the last
line of stdout and routes all progress messages to stderr. Pipes like
`aether release ... --json | jq` work without filtering.

Schema mirrors what the server returns: label, packageHash, size,
appVersion, blobUrl, manifestBlobUrl, description, releasedBy,
releaseMethod, uploadTime, rollout, isMandatory, isDisabled. Undefined
fields are dropped from the JSON.

On error the CLI follows UNIX convention: stderr human message, exit
non-zero, no JSON on stdout. Errors keep the existing handler path.

The flag is scoped to release and release-react. promote and patch
stay unchanged for now; the formatter helper lives in
script/utils/release-json.ts and is reusable when those need wiring.
@Monoradioactivo Monoradioactivo self-assigned this May 29, 2026
@Monoradioactivo Monoradioactivo added the enhancement New feature or request label May 29, 2026
@Monoradioactivo Monoradioactivo merged commit d327cec into main May 29, 2026
7 checks passed
@Monoradioactivo Monoradioactivo deleted the feat/cli-json-output branch May 29, 2026 00:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant