gaze report

April 9, 2026 · View on GitHub

Orchestrate Gaze's four analysis operations (CRAP, quality, classification, docscan) and pipe the combined JSON payload to an external AI CLI for formatting into a human-readable markdown report.

The formatted report is written to stdout and optionally appended to $GITHUB_STEP_SUMMARY for GitHub Actions Step Summary integration.

Synopsis

gaze report [packages] [flags]

Arguments

ArgumentRequiredDescription
packagesNoGo package patterns (e.g., ./..., ./internal/...). Defaults to ./... when omitted.

When no package arguments are provided, ./... is used automatically (the entire module).

Flags

FlagTypeDefaultDescription
--formatstringtextOutput format: text (AI-formatted markdown) or json (raw analysis payload)
--aistring""AI adapter: claude, gemini, ollama, or opencode. Required in text mode.
--modelstring""Model name for the AI adapter. Required for ollama; optional for other adapters.
--ai-timeoutduration10mMaximum time to wait for the AI adapter to respond. Uses Go duration format (e.g., 5m, 30s, 2m30s).
--coverprofilestring""Path to a pre-generated Go coverage profile. Skips the internal go test -coverprofile run.
--max-craploadintnot setCI gate: fail if CRAPload exceeds N. Absent by default (no enforcement).
--max-gaze-craploadintnot setCI gate: fail if GazeCRAPload exceeds N. Absent by default (no enforcement).
--min-contract-coverageintnot setCI gate: fail if average contract coverage is below N%. Absent by default (no enforcement).

Threshold Semantics

The threshold flags (--max-crapload, --max-gaze-crapload, --min-contract-coverage) use pointer semantics internally: when a flag is not provided, no threshold is enforced. When explicitly set — even to 0 — the threshold is active. This means --max-crapload=0 will fail if any function is in the CRAPload (i.e., zero tolerance).

Configuration Interaction

The gaze report command does not directly read .gaze.yaml. The underlying analysis pipeline uses default classification thresholds. To customize thresholds, use gaze crap and gaze quality individually.

The --coverprofile flag is the key CI optimization — pass a coverage profile generated during your test step to avoid running tests twice.

AI Adapter Details

AdapterBinarySystem Prompt DeliveryPayload Delivery
claudeclaudeTemp file via -p flagstdin
geminigeminiGEMINI.md in temp dirstdin
ollamaHTTP APIsystem field in JSON bodyprompt field in JSON body
opencodeopencode.opencode/agents/gaze-reporter.md in temp dir via --dirstdin

Before the analysis pipeline starts, Gaze validates that the adapter binary exists on PATH (or that the Ollama HTTP API is reachable). An invalid binary produces a hard exit before any analysis runs.

Environment Variables

VariableDescription
GITHUB_STEP_SUMMARYWhen set, the formatted report is appended to this file path for GitHub Actions Step Summary display. Symlink protection (O_NOFOLLOW) is applied.

Examples

AI-formatted report with Claude

gaze report ./... --ai=claude

JSON-only output (no AI required)

gaze report ./... --format=json > report.json

In JSON mode, the --ai flag is not required. The raw analysis payload is written directly to stdout.

CI integration with thresholds

# Generate coverage during test step
go test -race -count=1 -coverprofile=coverage.out ./...

# Run report with pre-generated coverage and quality gates
gaze report ./... \
  --ai=opencode \
  --coverprofile=coverage.out \
  --max-crapload=35 \
  --max-gaze-crapload=5 \
  --min-contract-coverage=8

Using Ollama (local model)

gaze report ./... --ai=ollama --model=llama3.2

The --model flag is required for Ollama and specifies which model to use for formatting.

See Also