Documentation
¶
Overview ¶
Package rules loads declarative lint rules and maps typed Jev answers to deterministic decisions. Repository-provided rule files are untrusted data.
Index ¶
- Variables
- func Questions(ctx context.Context, selections []Selection) ([]contextplan.Binding, error)
- func ValidateSelectors(includes, excludes []string) error
- type Decision
- type Mandate
- type Pack
- func CompileMandates(mandates []Mandate) (Pack, error)
- func Load(reader io.Reader) (Pack, error)
- func LoadContext(ctx context.Context, reader io.Reader) (Pack, error)
- func LoadDirectory(ctx context.Context, root string) (Pack, error)
- func WithOverrides(pack Pack, threshold *float64, severity *Severity) (Pack, error)
- func WithPolicy(pack Pack, threshold float64, severity Severity) (Pack, error)
- type Rule
- type Selection
- type Severity
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidDecision = errors.New("invalid rule decision")
var ErrInvalidPack = errors.New("invalid rule pack")
var ErrInvalidRule = errors.New("invalid rule")
var ErrInvalidSelector = errors.New("invalid rule path selector")
var ErrPackLimit = errors.New("rule pack limit exceeded")
var ErrUnsupportedSchema = errors.New("unsupported rule pack schema")
Functions ¶
func Questions ¶
Questions copies typed criteria into planner bindings. It returns no partial result for duplicate or invalid selections.
func ValidateSelectors ¶ added in v0.4.0
ValidateSelectors checks the same safe glob subset used by rule selection.
Types ¶
type Decision ¶
type Decision struct {
RuleID string
WorkItemID string
Path string
Side git.Side
StartLine int
EndLine int
Severity Severity
Title string
Message string
Kind string
Value float64
Confidence *float64
}
Decision carries fixed rule metadata, immutable Git coordinates, and one validated numeric signal. Value is a probability for Noul/Choice and a normalized score for Score; Kind names that distinction.
type Mandate ¶ added in v0.4.0
Mandate is one freeform Markdown requirement. ID is its path relative to a rule root.
type Pack ¶
type Pack struct {
// contains filtered or unexported fields
}
func CompileMandates ¶ added in v0.4.0
CompileMandates applies the same fixed policy to built-in and loaded Markdown.
func LoadContext ¶
LoadContext adds cancellation to bounded rule loading for CI callers.
func LoadDirectory ¶ added in v0.4.0
LoadDirectory reads Markdown mandates under root without following symlinks. Invalid or over-limit input returns no partial pack.
func WithOverrides ¶ added in v0.4.0
WithOverrides applies only explicitly provided run values, preserving rule metadata otherwise.
func WithPolicy ¶ added in v0.4.0
WithPolicy applies one trusted run policy to every mandate in a pack.
type Selection ¶
Selection binds one validated rule to one immutable Git work item.
func SelectWithPaths ¶ added in v0.4.0
func SelectWithPaths(ctx context.Context, pack Pack, groups []contextplan.Group, includes, excludes []string) ([]Selection, error)
SelectWithPaths applies run-level source-path filters before rule selection. A matching exclude takes precedence over every include.