Repository navigation
feat: add --json output to every command - #223
Merged
Merged
Conversation
Every command and live subcommand now takes --json. With it, stdout
carries exactly one JSON object on success and on failure.
- index.ts prints thrown errors as { status: 'FAILED', error } when
--json is in argv, and skips the help screen on usage errors.
- New --json on whoami, logout, switch-org, login, upgrade, artifacts
and all live subcommands. login and switch-org draw prompts and the
login URL on stderr.
- ReportDownloadService returns a result per download so artifacts
--json can report failures; it exits 1 if every download failed.
- live hierarchy --json --output prints { status, path } instead of a
plain-text line.
- Adds jsonFlag, logger.json, logger.fail and wantsJson; existing JSON
call sites use logger.json with unchanged output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
finalerock44
previously approved these changes
Oct 16, 2026
Under --json the 'Live session started' block is dropped, so a waitForReady
timeout or polling error left a billed session with no name to stop it by.
Catch the error and print { status: 'FAILED', error, session_name, platform,
ready: false, consoleUrl } before exiting with the original exit code.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code |
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
Every command and every
livesubcommand now takes--json. With it, stdout carries exactly one JSON object, on success and on failure, so scripts and agents can pipe it straight into a parser.Before this, only
cloud,upload,list,statusandlive hierarchyhad JSON output. And errors thrown from most commands printed plain text even with--jsonset.Changes
src/index.tschecks for--jsonin argv. If it's there, any thrown error prints as{ "status": "FAILED", "error": "..." }(colour codes removed), and usage errors skip the help screen.--jsonsupport:whoami,logout,switch-org,upgrade(UPGRADED/UP_TO_DATE/NO_RELEASE).loginandswitch-org: prompts and the login URL go to stderr, so a person can still answer them. stdout gets only the result.artifacts:ReportDownloadServicenow returns a result per download instead of only warning, so the command can list what happened. Exits 1 if every download failed.live start,install,exec,run,screenshot,stop,status, and the barelivemenu.live statusleaves out the large screenshot and hierarchy data. A failedlive runprints its result and exits 2, as before.live hierarchy --json --output <file>now prints{ status, path }instead of a plain-text line.jsonFlag(output.flags.ts),logger.json,logger.fail(exit non-zero without printing a second object), andwantsJson. Existing JSON call sites now uselogger.json; their output is unchanged.STYLE_GUIDE.mdrule 7 andCLAUDE.mddescribe the new rule.Testing
pnpm typecheck,pnpm lint(0 errors) andpnpm test:unit(325 passing). New specs are intest/unit/json-output.test.tsandreport-download.service.test.ts.whoami,logout,upgrade,artifacts(an error and a failed download),live,switch-org,live statusand an unknown command. Each printed one object thatjqcould read, with the right exit code.login,switch-orgwith its picker, andlive start/install/exec/run/screenshotagainst the real API. These need a real session or device.🤖 Generated with Claude Code