fix

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReasonUnsupportedFindingType = "unsupported_finding_type"
	ReasonMissingLocation        = "missing_location"
	ReasonAmbiguousPatchTarget   = "ambiguous_patch_target"
	ReasonMissingRuleTemplate    = "missing_rule_template"
)

Variables

View Source
var ErrNoApplyCapableRemediations = errors.New("no apply-capable remediations available")

Functions

This section is empty.

Types

type PRArtifact

type PRArtifact struct {
	Path          string
	Content       []byte
	CommitMessage string
}

func BuildApplyArtifacts added in v1.0.11

func BuildApplyArtifacts(snapshot state.Snapshot, plan Plan) ([]PRArtifact, error)

BuildApplyArtifacts renders deterministic repo files for the explicit apply surface. It fails closed when the selected plan has no apply-capable remediations.

func BuildPRArtifacts

func BuildPRArtifacts(plan Plan) ([]PRArtifact, error)

BuildPRArtifacts renders deterministic repository files that document and apply remediation intent so --open-pr produces code changes instead of metadata-only PRs.

type PRGroup added in v1.0.11

type PRGroup struct {
	Index int
	Total int
	Plan  Plan
}

func SplitPlanForPRs added in v1.0.11

func SplitPlanForPRs(plan Plan, maxPRs int) []PRGroup

SplitPlanForPRs partitions remediations into deterministic contiguous groups. Skipped findings stay attached to the first group only so the overall reason-code context is preserved without duplicating it across every PR payload.

type Plan

type Plan struct {
	RequestedTop int           `json:"requested_top"`
	Fingerprint  string        `json:"fingerprint"`
	Remediations []Remediation `json:"remediations"`
	Skipped      []Skipped     `json:"skipped"`
}

Plan is a deterministic remediation output for ranked findings.

func ApplyCapablePlan added in v1.0.11

func ApplyCapablePlan(plan Plan) Plan

func BuildPlan

func BuildPlan(ranked []risk.ScoredFinding, top int) (Plan, error)

BuildPlan returns deterministic remediation previews for top-ranked findings.

type Remediation

type Remediation struct {
	ID             string        `json:"id"`
	TemplateID     string        `json:"template_id"`
	Category       string        `json:"category"`
	RuleID         string        `json:"rule_id,omitempty"`
	ApplySupported bool          `json:"apply_supported,omitempty"`
	Title          string        `json:"title"`
	Rationale      string        `json:"rationale"`
	CommitMessage  string        `json:"commit_message"`
	PatchPreview   string        `json:"patch_preview"`
	Finding        model.Finding `json:"finding"`
}

Remediation describes one deterministic patch preview and commit intent.

type Skipped

type Skipped struct {
	CanonicalKey string `json:"canonical_key"`
	FindingType  string `json:"finding_type"`
	RuleID       string `json:"rule_id,omitempty"`
	Location     string `json:"location,omitempty"`
	ReasonCode   string `json:"reason_code"`
	Message      string `json:"message"`
}

Skipped is emitted for non-fixable findings with explicit reason codes.

type Template

type Template struct {
	ID           string   `yaml:"id"`
	Category     string   `yaml:"category"`
	Title        string   `yaml:"title"`
	CommitPrefix string   `yaml:"commit_prefix"`
	Hints        []string `yaml:"hints"`
}

Jump to

Keyboard shortcuts

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