Help us shape the future of Go! Take the 2026 Go Developer Survey

output

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package output renders acurl reports in human and machine formats.

Index

Constants

View Source
const (
	ExitOK      = 0 // every profile was allowed
	ExitBlocked = 1 // at least one profile was blocked or challenged
	ExitError   = 2 // a request failed, or acurl itself failed
)

Exit codes returned by acurl.

View Source
const Caveat = "acurl sends agent user-agent strings from your own IP address. Real AI agents " +
	"come from published IP ranges and may sign their requests, so these results show how a " +
	"site responds to user-agent strings, not guaranteed agent access."

Caveat explains what acurl results do and do not prove.

View Source
const DefaultFailOn = "blocked,challenged,error"

DefaultFailOn is the --fail-on default.

Variables

View Source
var Formats = []string{"table", "json", "markdown", "csv", "junit", "sarif", "html"}

Formats lists the supported output formats.

View Source
var Version = "dev"

Version is reported in machine-readable formats. The CLI sets it.

Functions

func BatchExitCode added in v0.3.0

func BatchExitCode(rep *types.BatchReport, p Policy) int

BatchExitCode returns the worst exit code across the batch under p.

func ExitCode

func ExitCode(s types.Summary) int

ExitCode maps a summary to a process exit code.

func FormatSize

func FormatSize(n int) string

FormatSize renders a byte count as B, KB or MB.

func Write

func Write(w io.Writer, format string, result types.ComparisonResult, color bool) error

Write renders result in format to w.

func WriteBatch added in v0.3.0

func WriteBatch(w io.Writer, format string, rep *types.BatchReport, color bool) error

WriteBatch renders a batch report as a table, JSON or Markdown.

func WriteCSV added in v0.3.0

func WriteCSV(w io.Writer, reports []*types.ComparisonResult) error

WriteCSV writes one row per URL and profile, for spreadsheets.

func WriteDiff added in v0.2.0

func WriteDiff(w io.Writer, baseName, otherName string, lines []textdiff.Line, color bool) error

WriteDiff prints a line diff of the visible text two profiles received.

func WriteHTML added in v0.4.0

func WriteHTML(w io.Writer, reports []*types.ComparisonResult) error

WriteHTML renders a self-contained HTML report (no external assets). When response bodies are available, it includes visible-text diffs for every agent whose content differs noticeably from the browser.

func WriteJSON

func WriteJSON(w io.Writer, result types.ComparisonResult) error

WriteJSON renders result as indented JSON.

func WriteJUnit added in v0.3.0

func WriteJUnit(w io.Writer, reports []*types.ComparisonResult) error

WriteJUnit writes a JUnit XML report: one test suite per URL and one test case per profile. Blocked, challenged, rate-limited and cloaked results are failures, network errors are errors and robots.txt-disallowed results are skipped (blocking an agent there is a choice, not a bug).

func WriteMarkdown

func WriteMarkdown(w io.Writer, result types.ComparisonResult) error

WriteMarkdown renders result as a GitHub-flavored Markdown report.

func WriteRobotsAudit added in v0.2.0

func WriteRobotsAudit(w io.Writer, format string, a types.RobotsAudit, color bool) error

WriteRobotsAudit renders a robots.txt audit as a table or JSON.

func WriteSARIF added in v0.3.0

func WriteSARIF(w io.Writer, version string, reports []*types.ComparisonResult) error

WriteSARIF writes findings as SARIF 2.1.0 for GitHub code scanning and other SARIF viewers. Each problem result and failed readiness check becomes one finding located at the page URL.

func WriteTable

func WriteTable(w io.Writer, result types.ComparisonResult, color bool) error

WriteTable renders result as a terminal table.

Types

type Policy added in v0.3.0

type Policy struct {
	Classes  map[string]bool // classifications that fail the run
	MinScore int             // fail when the score is below this; 0 = off
}

Policy decides which outcomes fail a run.

func ParsePolicy added in v0.3.0

func ParsePolicy(spec string) (Policy, error)

ParsePolicy parses a --fail-on value such as "blocked,cloaked,score<70". "none" never fails on results (network errors still exit 2).

func (Policy) ExitCode added in v0.3.0

func (p Policy) ExitCode(rep *types.ComparisonResult) int

ExitCode returns the exit code for one report under p. Errors always map to ExitError when "error" is in the policy; every other match is ExitBlocked.

func (Policy) Reasons added in v0.3.0

func (p Policy) Reasons(rep *types.ComparisonResult) []string

Reasons lists why rep fails under p, for a one-line CI message.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL