feat: default to pretty output, add --json and --jq flags#71
feat: default to pretty output, add --json and --jq flags#71Ramon Nogueira (ramon-langchain) wants to merge 1 commit into
Conversation
Change the default output format from JSON to pretty (human-readable tables). Add --json as a shorthand for --format json, and --jq to apply a jq expression to JSON output (powered by gojq, implies --json).
There was a problem hiding this comment.
Devin Review found 1 potential issue.
🐛 1 issue in files not directly in the diff
🐛 --json and --jq flags silently ignored by api ls and api info commands (internal/cmdutil/resolve.go:45-51)
The api ls and api info subcommands resolve their output format via cmdutil.ResolveFormat(cmd) (internal/cmdutil/resolve.go:45-51), which only reads the --format flag. The new --json and --jq persistent flags added to the root command are accepted by cobra (they're inherited persistent flags) but have no effect on these commands. For example, langsmith api ls --json will still render a pretty table because cmdutil.ResolveFormat returns "pretty" (the new default) without checking the --json or --jq flags. Meanwhile, all other subcommands use cmd.GetFormat() (internal/cmd/root.go:107-111) which correctly checks both flagJSON and flagJQ. This creates an inconsistency where --json works everywhere except the api subcommands.
View 4 additional findings in Devin Review.
Summary
jsontopretty(human-readable tables/trees)--jsonflag as shorthand for--format json--jq EXPRflag to apply jq expressions to JSON output (powered by gojq, implies--json)Example usage:
Release Note
Default output is now human-readable; use
--jsonor--jqfor machine-readable output.Test Plan
applyJQcovering field access, array indexing, select, pipes, keys, length, nested access, invalid expressions, and nil inputOutputJSONwith and withoutJQExpr--jqimplies JSON format,--jsonflag, flag defaults