Skip to content

fix: keep --json output parseable on stdout#286

Open
socksy wants to merge 2 commits into
developfrom
fix/json-output-purity
Open

fix: keep --json output parseable on stdout#286
socksy wants to merge 2 commits into
developfrom
fix/json-output-purity

Conversation

@socksy

@socksy socksy commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

--json is supposed to mean "stdout is JSON you can parse". Several commands broke that promise by mixing raw text into the output. tower run --detached --json printed a "See more" link after the success JSON. tower run --json against a missing app printed remediation steps after the error JSON. tower schedules list --json printed "No schedules found." instead of []. tower teams list --json printed the active-team legend after the data. And tower version --json wasn't JSON at all.

The root cause is the same everywhere: output::write() knows about MCP mode but not JSON mode. Instead of special-casing call sites, the broken sites now go through JSON-aware output functions. output.rs gains two: text() writes a human rendering or the data as JSON (the same shape as table() and list()), and note() writes presentation-only text that JSON mode suppresses. The run link travels inside the success message, with the scheduled run as structured data.

The new integration tests run each case with --json and parse stdout. Putting teams list under test required updating the mock server's /v1/session/refresh response, which had drifted from the generated client models. flake.lock gets a nixpkgs bump so binaryen comes from the binary cache on aarch64-darwin instead of compiling LLVM from source.

@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 684b13c6-35b8-4649-9d17-77eba9149288

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/json-output-purity

Comment @coderabbitai help to get the list of available commands and usage tips.

@socksy socksy force-pushed the fix/json-output-purity branch from 3794a87 to 64123af Compare June 2, 2026 12:24
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