baseline

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFileName is the default baseline snapshot file path.
	DefaultFileName = ".promptinel-baseline.json"
	// SnapshotVersion is the current baseline file format version.
	SnapshotVersion = 1
)

Variables

This section is empty.

Functions

func FilterFindings

func FilterFindings(findings []engine.FileFinding, snapshot Snapshot) []engine.FileFinding

FilterFindings removes findings already accepted by the provided snapshot.

func HashFinding

func HashFinding(finding engine.FileFinding) string

HashFinding returns a deterministic hash for one finding.

func Write

func Write(path string, snapshot Snapshot) error

Write saves a baseline snapshot to disk in a deterministic JSON format.

Types

type Entry

type Entry struct {
	Hash     string          `json:"hash"`
	Path     string          `json:"path"`
	RuleID   string          `json:"rule_id"`
	Severity config.Severity `json:"severity"`
	Message  string          `json:"message"`
	Line     int             `json:"line"`
	Column   int             `json:"column"`
}

Entry represents one accepted finding.

type Snapshot

type Snapshot struct {
	Version int     `json:"version"`
	Entries []Entry `json:"entries"`
}

Snapshot stores accepted findings in a deterministic representation.

func BuildSnapshot

func BuildSnapshot(findings []engine.FileFinding) Snapshot

BuildSnapshot converts findings into a deterministic baseline snapshot.

func Read

func Read(path string) (Snapshot, error)

Read loads a baseline snapshot file from disk.

Jump to

Keyboard shortcuts

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