Skip to content

Commit 9680f38

Browse files
committed
feat(cli): default eval fts report to table format on TTYs
When stdout is a terminal, default --format to "table" so the user sees the lipgloss-styled report out of the box. Pipes, files, and CI fall back to "markdown" (stable, diff-friendly). --format still overrides.
1 parent 88256f1 commit 9680f38

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

cmd/micasa/eval.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package main
66
import (
77
"context"
88
"fmt"
9+
"io"
910
"os"
1011
"os/signal"
1112
"strings"
@@ -81,8 +82,8 @@ provider is a cloud service, the data leaves the machine.`,
8182
"deterministic rubric only; skip the LLM judge")
8283
cmd.Flags().BoolVar(&opts.noAB, "no-ab", false,
8384
"run each question once (FTS on) instead of twice")
84-
cmd.Flags().StringVar(&opts.format, "format", "markdown",
85-
"report format: markdown or json")
85+
cmd.Flags().StringVar(&opts.format, "format", "",
86+
"report format: table (default when TTY), markdown, or json")
8687
cmd.Flags().StringVar(&opts.output, "output", "",
8788
"write report to this file instead of stdout")
8889
cmd.Flags().BoolVar(&opts.strict, "strict", false,
@@ -171,8 +172,9 @@ func runEvalFTS(defaultOut interface {
171172
return fmt.Errorf("run eval: %w", err)
172173
}
173174

174-
// Write report.
175-
out := defaultOut
175+
// Write report. Default format: "table" when writing to a TTY,
176+
// "markdown" otherwise (pipes, files, CI). --format overrides.
177+
out := io.Writer(defaultOut)
176178
if opts.output != "" {
177179
f, err := os.Create(opts.output)
178180
if err != nil {
@@ -181,6 +183,13 @@ func runEvalFTS(defaultOut interface {
181183
defer func() { _ = f.Close() }()
182184
out = f
183185
}
186+
if harnessCfg.Format == "" {
187+
if writerIsTerminal(out) {
188+
harnessCfg.Format = "table"
189+
} else {
190+
harnessCfg.Format = "markdown"
191+
}
192+
}
184193
if err := ftseval.WriteReport(out, harnessCfg, results); err != nil {
185194
return fmt.Errorf("write report: %w", err)
186195
}

docs/content/docs/reference/cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1684,7 +1684,7 @@ micasa eval fts [flags]
16841684
| Flag | Default | Description |
16851685
|------|---------|-------------|
16861686
| `--db` | - | path to a micasa SQLite DB (default: fixture) |
1687-
| `--format` | `markdown` | report format: markdown or json |
1687+
| `--format` | - | report format: table (default when TTY), markdown, or json |
16881688
| `-h`, `--help` | - | help for fts |
16891689
| `--judge-model` | - | model for the LLM judge (default: same as --model) |
16901690
| `--model` | - | override chat model from config |

0 commit comments

Comments
 (0)