engine

package
v1.55.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package engine runs NoSlop's risk-proportional front-stage pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentReviewer

type AgentReviewer struct {
	// contains filtered or unexported fields
}

AgentReviewer adapts an existing no-slop agent to the NoSlop reviewer seam.

func NewAgentReviewer

func NewAgentReviewer(ag agent.Agent, onChunk func(string)) *AgentReviewer

NewAgentReviewer constructs a structured lens reviewer.

func (*AgentReviewer) Review

func (r *AgentReviewer) Review(ctx context.Context, request ReviewRequest) ([]Finding, error)

Review asks the agent to inspect the repository and return named findings.

type Change

type Change struct {
	Path            string
	BaselinePath    string
	Status          risk.ChangeStatus
	Added           int
	Deleted         int
	AddedContent    string
	CurrentContent  string
	BaselineContent string
	BaselineContext string
}

Change contains the revision content each mechanical check needs.

func LoadGitChanges

func LoadGitChanges(ctx context.Context, workDir, baseRef, headRef string) ([]Change, error)

LoadGitChanges materializes the committed change between two refs. Git invocations inherit the repository's bounded subprocess policy.

type Config

type Config struct {
	Risk                 risk.Config
	Blocklist            []string
	RefuseLeakExemptions bool
	OutboundPaths        []string
	AITellWords          []string
	TestCountFloor       bool
	TestCommand          string
	TierOverride         risk.Tier
	ForceTier            bool
	ThreadURL            string
	EvidenceRoot         string
}

Config controls classification and mandatory artifact checks.

type Dependencies

type Dependencies struct {
	Reviewer         Reviewer
	ReviewerFactory  func(context.Context) (Reviewer, error)
	Tests            TestRunner
	ThreadReader     prose.ThreadReader
	OnDecision       func(risk.Decision)
	OnLeakExemptions func([]leakscan.Exemption)
}

Dependencies are adapters at the engine's external seams.

type Finding

type Finding struct {
	Lens        string
	Severity    string
	Path        string
	Line        int
	Description string
}

Finding is one named gate failure.

type Input

type Input struct {
	WorkDir       string
	Branch        string
	DefaultBranch string
	BaseRef       string
	HeadRef       string
	Intent        string
	Files         []Change
	Config        Config
}

Input is the complete gate request.

type MandatoryCheck

type MandatoryCheck struct {
	Name     string
	Enabled  bool
	Findings int
}

MandatoryCheck records whether a tier-independent check ran and how many findings it produced.

type Result

type Result struct {
	Decision        risk.Decision
	Findings        []Finding
	LeakExemptions  []leakscan.Exemption
	MandatoryChecks []MandatoryCheck
	Tests           []TestResult
	ReviewRan       bool
	ReviewRounds    int
	Passed          bool
}

Result contains the visible route and every named finding.

func Run

func Run(ctx context.Context, input Input, deps Dependencies) (Result, error)

Run classifies first, runs mandatory checks, then spends only the work the selected tier requires.

type ReviewRequest

type ReviewRequest struct {
	WorkDir       string
	Branch        string
	BaseRef       string
	HeadRef       string
	Intent        string
	Tier          risk.Tier
	Round         ReviewRound
	PriorFindings []Finding
	Prompt        string
}

ReviewRequest is the narrow reviewer seam.

type ReviewRound

type ReviewRound string

ReviewRound identifies one pass in a tier's reviewer protocol.

const (
	ReviewRoundLensReview           ReviewRound = "lens-review"
	ReviewRoundAdversarialChallenge ReviewRound = "adversarial-challenge"
)

type Reviewer

type Reviewer interface {
	Review(context.Context, ReviewRequest) ([]Finding, error)
}

Reviewer runs the AI-authorship lens pass.

type ShellTestRunner

type ShellTestRunner struct{}

ShellTestRunner executes an explicitly configured command with the same descendant-reaping policy as the inherited pipeline.

func (ShellTestRunner) Run

func (ShellTestRunner) Run(ctx context.Context, workDir, command string) (TestResult, error)

Run captures output and represents an ordinary nonzero exit in TestResult.

type TestResult

type TestResult struct {
	Command  string
	ExitCode int
	Output   string
}

TestResult is the configured command's captured result.

type TestRunner

type TestRunner interface {
	Run(context.Context, string, string) (TestResult, error)
}

TestRunner executes the configured full-tier test command.

Jump to

Keyboard shortcuts

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