Skip to content

Detect non-TTY output and add --no-color / --output-format flags #61

Description

@that-github-user

Problem

thinktank always emits ANSI color codes and Unicode box-drawing characters regardless of whether stdout is a terminal. When output is piped to a file, CI log aggregator, or grep, the result is unreadable garbage:

\x1b[1m\x1b[36m══ Ensemble Results ══\x1b[0m

Proposed solution

  1. TTY detection: wrap all color calls in a check — if !process.stdout.isTTY, strip colors and replace Unicode box-drawing with ASCII equivalents (already partially done for Windows in Add ANSI color support detection for Windows cmd.exe compatibility #27, but TTY detection is separate)
  2. --no-color flag: explicit opt-out (also honour NO_COLOR=1 env var per https://no-color.org/)
  3. --output-format flag: text (default), json
    • json mode: emit a single JSON object to stdout containing the full EnsembleResult so scripts can process results programmatically
    • text mode: current human-readable output

Acceptance criteria

  • When stdout is not a TTY, colors are stripped automatically
  • NO_COLOR=1 thinktank list produces plain text
  • --no-color flag works
  • --output-format json prints the full result as a JSON object (matches EnsembleResult schema)
  • --output-format json is consistent for run, list, stats, and compare
  • Tests verify plain-text and JSON output modes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions