Repository navigation
feat: add TOON output format alongside json/yaml - #282
Merged
Merged
Conversation
Wires up Token-Oriented Object Notation (TOON) as a new --output choice so CLI output can be piped into LLM prompts with ~30-60% fewer tokens than equivalent JSON. Uses the toon_format package from the official toon-format org (MIT, community-driven, currently beta). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Unit tests for nested structures, unicode, empty list, ImportError guard, and that list-of-dicts hit the compact tabular form. - Integration tests confirming --filter / --fields / --sort-by still work with fmt=toon. - Search output test parallel to the yaml/csv/jsonl ones. - Refresh remaining "CSV and YAML" help strings in search.py. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
--output toonto the CLI, rendering results in Token-Oriented Object Notation (a compact, LLM-friendly format that saves ~30-60% tokens vs JSON). See https://toonformat.dev.toon_formatpackage, maintained under the officialtoon-formatGitHub org (MIT, listed as the official Python implementation on the TOON site). Pinned astoon_format>=0.9.0b1,<1.0since upstream is currently in beta (v0.9.0b1).format_outputlike the other formats, and is treated as a buffered format (same memory semantics asyaml/csv) insearch run.Notes on package choice
There are several third-party TOON ports on PyPI (
toon-py,toon-python,py-toon-format, etc.), but the one chosen here is the only implementation listed under the officialtoon-formatGitHub org, referenced from toonformat.dev's implementation list. It is MIT-licensed and pure-Python with no transitive deps. It's still labeled beta (0.9.x); the version pin allows upstream patch/beta bumps while preventing a 1.0 API break from sneaking in.Example
Test plan
pytest tests/unit- all 3110 unit tests pass (4 new TOON tests added intest_output.py)limacharlie --helpshows[json|yaml|toon|csv|table|jsonl]as the--outputchoicesformat_output(..., fmt="toon")🤖 Generated with Claude Code