Skip to content

feat: add --toon output format for token-efficient CLI output #216

Description

@akb4q

Problem

CLI output currently supports two formats: --json (verbose, high token count) and a human-readable table. For LLM-powered toolchains that consume CLI output programmatically, JSON is wasteful — it duplicates keys on every row and adds structural overhead.

Proposal

Add --toon as a third global output format. TOON (Token-Oriented Object Notation) is a line-oriented, indentation-based data format designed as a compact lossless representation of the JSON data model, optimized for LLM prompt injection.

Design

  • Global --toon flag registered in Commander.js
  • outputTable: when toonMode is set, prints tabular TOON ([N]{fields}:) instead of cli-table3
  • outputJson: when --toon and --json both present, reroutes to outputJsonToon which produces TOON key-value format
  • No new runtime dependencies — hand-written formatter (~130 lines in src/lib/output.ts)

Token savings (measured)

projects list on a single project:

  • JSON: 989 B / ~250 tokens
  • TOON: 129 B / ~32 tokens (7.7× reduction)

Status

Working PR at #215 — this issue tracks the prerequisite checklist before final merge.

  • Remove the "needs-issue" label from PR 215
  • Final review from @jwfing

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions