feat: add --output toon (token-efficient output format)#23
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an opt-in --output toon format to the CLI, using the TOON (Token-Oriented Object Notation) encoder for more token-efficient, agent-friendly output while keeping table as the default.
Changes:
- Add
toonto--outputflag help + validation and register a newdciToonContentTypeformatter. - Add unit tests covering TOON marshaling and
--outputflag validation. - Add the
github.com/toon-format/toon-godependency and document TOON in README + internal design/plan docs.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents --output toon and links to the TOON format site. |
| main.go | Registers toon output, validates the new flag value, and implements dciToonContentType marshaling with JSON fallback. |
| main_test.go | Adds tests for TOON marshaling and for --output flag validation behavior via Cobra execution. |
| go.mod | Adds github.com/toon-format/toon-go dependency. |
| go.sum | Adds checksums for the new TOON dependency. |
| docs/superpowers/specs/2026-06-08-toon-output-design.md | Adds design spec for the TOON output slice of #9. |
| docs/superpowers/plans/2026-06-08-toon-output.md | Adds an implementation plan for TOON output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
886d71b to
9da2fcf
Compare
Collaborator
Author
|
Addressed the Copilot review:
|
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
Adds
toonas an opt-in value for--output, emitting TOON (Token-Oriented Object Notation) — a compact, lossless format that uses ~40% fewer tokens than JSON for list-shaped data, useful when an LLM agent drives the CLI.tableremains the default.dciToonContentTypemirrors the existingdciTableContentType:toJSONSafe→toon.Marshal, degrading to indented JSON on any encode error.toon; wired into the--outputvalidation switch, help text, and error message.github.com/toon-format/toon-go(pure-Go, no cgo — keeps cross-compilation portable).Implements the TOON slice of #9. Schema/projection/truncation/limit work remains open on #9 and is intentionally out of scope. Coordination note left on #21 (agent-mode) so it can adopt
toonas the agent default.Design + plan:
docs/superpowers/specs/2026-06-08-toon-output-design.md,docs/superpowers/plans/2026-06-08-toon-output.md.Test Plan
go build ./... && go vet ./... && go test ./...all greendciToonContentType.Marshalunit tests: list (tabular), object (real TOON, not JSON fallback), scalarsTestOutputFlagValidationdrives real cobraExecute— accepts table/json/yaml/auto/toon, rejects unknowndci list-budgets --output toonrenders TOON against the live API;--output boguserrors with the supported listCGO_ENABLED=0confirms toon-go introduces no cgo requirement