Documentation
¶
Overview ¶
Package output renders acurl reports in human and machine formats.
Index ¶
- Constants
- Variables
- func BatchExitCode(rep *types.BatchReport, p Policy) int
- func ExitCode(s types.Summary) int
- func FormatSize(n int) string
- func Write(w io.Writer, format string, result types.ComparisonResult, color bool) error
- func WriteBatch(w io.Writer, format string, rep *types.BatchReport, color bool) error
- func WriteCSV(w io.Writer, reports []*types.ComparisonResult) error
- func WriteDiff(w io.Writer, baseName, otherName string, lines []textdiff.Line, color bool) error
- func WriteHTML(w io.Writer, reports []*types.ComparisonResult) error
- func WriteJSON(w io.Writer, result types.ComparisonResult) error
- func WriteJUnit(w io.Writer, reports []*types.ComparisonResult) error
- func WriteMarkdown(w io.Writer, result types.ComparisonResult) error
- func WriteRobotsAudit(w io.Writer, format string, a types.RobotsAudit, color bool) error
- func WriteSARIF(w io.Writer, version string, reports []*types.ComparisonResult) error
- func WriteTable(w io.Writer, result types.ComparisonResult, color bool) error
- type Policy
Constants ¶
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.
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.
const DefaultFailOn = "blocked,challenged,error"
DefaultFailOn is the --fail-on default.
Variables ¶
var Formats = []string{"table", "json", "markdown", "csv", "junit", "sarif", "html"}
Formats lists the supported output formats.
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 WriteBatch ¶ added in v0.3.0
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
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
WriteRobotsAudit renders a robots.txt audit as a table or JSON.
func WriteSARIF ¶ added in v0.3.0
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 ¶
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
ParsePolicy parses a --fail-on value such as "blocked,cloaked,score<70". "none" never fails on results (network errors still exit 2).