Skip to content

feat(output): default to json instead of toon for non-TTY stdout (DX-5867)#44

Merged
johnpmitsch merged 1 commit into
mainfrom
dx-5867-default-to-json-instead-of-toon-for-non-tty-output
Jun 24, 2026
Merged

feat(output): default to json instead of toon for non-TTY stdout (DX-5867)#44
johnpmitsch merged 1 commit into
mainfrom
dx-5867-default-to-json-instead-of-toon-for-non-tty-output

Conversation

@johnpmitsch

Copy link
Copy Markdown
Collaborator

Summary

Makes JSON the default output format when stdout is not a terminal (piped / scripted / agent invocations), replacing TOON. JSON is understood by virtually every downstream tool and parses cleanly, so it's the safer universal default for the piped path. TOON is newer and not as widely supported, so it's a poor implicit default.

TOON stays fully supported via --format toon and the config file. Only the default-when-unset changes: the CLI flag > config > built-in default ordering is unchanged, and the TTY default stays table.

The only behavioral edit is one branch in resolve_output_inner (src/context.rs). Everything else syncs docs to the new state: module docs, --format help, the embedded qn agent context guide, and the README (intro example, formats table, config defaults).

Test plan

  • cargo test — all pass (117+ tests), including the updated default_is_json_when_stdout_is_not_a_tty and a new config_toon_overrides_non_tty_default
  • cargo clippy --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • cargo build --release — clean
  • qn agent context and qn --help both report JSON as the non-TTY default

Closes DX-5867

…5867)

When stdout is not a terminal (piped / scripted / agent invocations), the
default output format is now JSON instead of TOON. JSON is understood by
virtually every downstream tool and parses cleanly, making it the safer
universal default for the piped path; TOON is newer and not as widely
supported, so it's a poor fit as the implicit default.

TOON remains fully supported via `--format toon` and the config file. Only
the default-when-unset changes; the CLI flag > config > built-in default
ordering is unchanged, and the TTY default stays `table`.

Syncs the module docs, `--format` help, the embedded `qn agent context`
guide, and the README (intro example, formats table, config defaults) to
describe JSON as the non-TTY default.
@johnpmitsch johnpmitsch merged commit f2153df into main Jun 24, 2026
13 checks passed
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.

2 participants