Skip to content

hegner123/reporter

Repository files navigation

reporter

Compresses go test output into a minimal JSON summary. Built for LLM agents that need test results without burning context on thousands of passing tests.

A 5,000-line verbose test run becomes ~10 lines of JSON with everything an agent needs to act: pass/fail counts, failing test names, packages, error output, and source locations.

Output

{
  "passed": 373,
  "failed": 1,
  "failures": [
    {
      "test": "TestBucketEndpointURL/empty_endpoint_returns_empty_string",
      "package": "github.com/hegner123/modulacms/internal/config",
      "output": "config_test.go:102: BucketEndpointURL() = \"\", want \"s\"",
      "location": "config_test.go:102"
    }
  ]
}

When all tests pass, failures is an empty array.

Getting Started

go build -o reporter .

MCP server (default)

Register as an MCP tool. The agent sends raw go test -json output as the input parameter and gets structured JSON back.

claude mcp add --transport stdio reporter -- /path/to/reporter

CLI

go test -json ./... | ./reporter
go test -v ./...   | ./reporter

Stdin auto-detection: piped input runs CLI mode, terminal runs MCP server. --cli flag forces CLI mode.

Why

An LLM agent running tests gets back a wall of text. Passing that into a context window wastes tokens on information the agent can't act on (passing tests). This tool strips it down to what matters:

  • Token compression: 250:1 reduction on a typical test run. 5,000 lines become the count "passed": 5725 plus only the failures with actionable detail.
  • Structured output: JSON the agent can parse directly instead of scanning text for --- FAIL patterns.
  • Source locations: file.go:NNN extracted and surfaced so the agent can navigate to the failure without searching.

Input Formats

JSON mode (go test -json): Recommended. Each line is a tagged event with the test name and package, so output attribution is reliable even with heavy parallelism and multi-line log output.

Verbose text mode (go test -v): Best-effort fallback. Works well for typical output but may misattribute lines when tests run in parallel and produce multi-line log output. The text format was never designed for machine parsing.

Auto-detected from the first non-empty line: starts with { means JSON, otherwise verbose text.

Platform Support

  • macOS
  • Linux

Windows is not supported.

About

Compresses go test output into a minimal JSON summary for LLM agents

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors