harnessloop

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyFixes

func ApplyFixes(repoRoot string, findings []Finding) ([]string, error)

func BuildLocalAgentCLIBinary

func BuildLocalAgentCLIBinary(repoRoot string) (string, error)

func CommitIfDirty

func CommitIfDirty(repoRoot, msg string) (bool, error)

func CurrentBranch

func CurrentBranch(repoRoot string) string

func EnsureBranch

func EnsureBranch(repoRoot, branch string) error

func RenderCompareMarkdown

func RenderCompareMarkdown(report CompareReport) string

func RenderDoctorMarkdown

func RenderDoctorMarkdown(r DoctorReport) string

func WriteCompareOutput

func WriteCompareOutput(repoRoot string, report CompareReport, format, outPath string) (string, error)

func WriteRegressionBaseline

func WriteRegressionBaseline(path string, baseline RegressionBaseline) error

func WriteReports

func WriteReports(repoRoot string, result RunResult) error

Types

type BehaviorCommitteeSnapshot

type BehaviorCommitteeSnapshot struct {
	PlannerStrategy string `json:"planner_strategy"`
	FixerStrategy   string `json:"fixer_strategy"`
	JudgerStrategy  string `json:"judger_strategy"`
}

type BehaviorFindingSnapshot

type BehaviorFindingSnapshot struct {
	Code     string `json:"code"`
	Severity string `json:"severity"`
	Source   string `json:"source"`
}

type BehaviorJudgeSnapshot

type BehaviorJudgeSnapshot struct {
	Threshold               float64 `json:"threshold"`
	Score                   float64 `json:"score"`
	Pass                    bool    `json:"pass"`
	HardFailures            int     `json:"hard_failures"`
	CounterIntuitiveFinding int     `json:"counter_intuitive_findings"`
}

type BehaviorScenarioSnapshot

type BehaviorScenarioSnapshot struct {
	Name  string                 `json:"name"`
	OK    bool                   `json:"ok"`
	Steps []BehaviorStepSnapshot `json:"steps"`
}

type BehaviorSnapshot

type BehaviorSnapshot struct {
	Mode       string                     `json:"mode"`
	Iterations int                        `json:"iterations"`
	Scenario   BehaviorScenarioSnapshot   `json:"scenario"`
	Findings   []BehaviorFindingSnapshot  `json:"findings"`
	Judge      BehaviorJudgeSnapshot      `json:"judge"`
	Committee  *BehaviorCommitteeSnapshot `json:"committee,omitempty"`
}

func BuildBehaviorSnapshot

func BuildBehaviorSnapshot(result RunResult) BehaviorSnapshot

type BehaviorStepSnapshot

type BehaviorStepSnapshot struct {
	Name     string `json:"name"`
	ExitCode int    `json:"exit_code"`
}

type CommitteeMeta

type CommitteeMeta struct {
	Planner RoleExecution `json:"planner"`
	Fixer   RoleExecution `json:"fixer"`
	Judger  RoleExecution `json:"judger"`
}

type CompareDelta

type CompareDelta struct {
	Score             float64 `json:"score"`
	PassDelta         int     `json:"pass_delta"`
	FindingsDelta     int     `json:"findings_delta"`
	IterationsDelta   int     `json:"iterations_delta"`
	FixesAppliedDelta int     `json:"fixes_applied_delta"`
}

type CompareReport

type CompareReport struct {
	SchemaVersion string       `json:"schema_version"`
	RunA          RunResult    `json:"run_a"`
	RunB          RunResult    `json:"run_b"`
	Delta         CompareDelta `json:"delta"`
}

func CompareRuns

func CompareRuns(repoRoot, runA, runB string) (CompareReport, error)

type Config

type Config struct {
	RepoRoot         string
	Threshold        float64
	MaxIterations    int
	AutoFix          bool
	AutoCommit       bool
	Branch           string
	Mode             string
	RoleConfigPath   string
	Seed             int64
	Budget           int
	VerboseArtifacts bool
}

type DoctorReport

type DoctorReport struct {
	SchemaVersion    string    `json:"schema_version"`
	LeanReady        bool      `json:"lean_ready"`
	LabFeaturesReady bool      `json:"lab_features_ready"`
	Findings         []Finding `json:"findings"`
	Suggestions      []string  `json:"suggestions"`
	ReviewPath       string    `json:"review_path"`
}

func LoopDoctor

func LoopDoctor(repoRoot string) DoctorReport

type Finding

type Finding struct {
	Code     string `json:"code"`
	Severity string `json:"severity"`
	Message  string `json:"message"`
	Source   string `json:"source"`
}

func CheckOnboardingInstallReadiness

func CheckOnboardingInstallReadiness(repoRoot string) []Finding

func DetectFindings

func DetectFindings(r ScenarioResult) []Finding

type JudgeScore

type JudgeScore struct {
	Score                float64 `json:"score"`
	Threshold            float64 `json:"threshold"`
	Pass                 bool    `json:"pass"`
	UXScore              float64 `json:"ux_score"`
	QualityScore         float64 `json:"quality_score"`
	PenaltyScore         float64 `json:"penalty_score"`
	PlannerScore         float64 `json:"planner_score,omitempty"`
	FixerScore           float64 `json:"fixer_score,omitempty"`
	JudgerScore          float64 `json:"judger_score,omitempty"`
	ScenarioPassRate     float64 `json:"scenario_pass_rate"`
	CounterIntuitiveFind int     `json:"counter_intuitive_findings"`
	HardFailures         int     `json:"hard_failures"`
}

func Judge

func Judge(r ScenarioResult, findings []Finding, threshold float64) JudgeScore

type RegressionBaseline

type RegressionBaseline struct {
	SchemaVersion string           `json:"schema_version"`
	Kind          string           `json:"kind"`
	Profile       string           `json:"profile"`
	GeneratedAt   time.Time        `json:"generated_at"`
	Snapshot      BehaviorSnapshot `json:"snapshot"`
}

func ReadRegressionBaseline

func ReadRegressionBaseline(path string) (RegressionBaseline, error)

type RegressionDrift

type RegressionDrift struct {
	Path     string `json:"path"`
	Expected string `json:"expected"`
	Actual   string `json:"actual"`
}

func CompareBehaviorSnapshot

func CompareBehaviorSnapshot(expected, actual BehaviorSnapshot) []RegressionDrift

type ReplayReport

type ReplayReport struct {
	SchemaVersion  string         `json:"schema_version"`
	RunID          string         `json:"run_id"`
	Iteration      int            `json:"iteration"`
	Baseline       ScenarioResult `json:"baseline"`
	Replay         ScenarioResult `json:"replay"`
	ReplayJudge    JudgeScore     `json:"replay_judge"`
	ReplayFindings []Finding      `json:"replay_findings"`
}

func ReplayIteration

func ReplayIteration(repoRoot, runID string, iteration int, threshold float64) (ReplayReport, error)

type RoleConfig

type RoleConfig struct {
	Planner RoleSpec `json:"planner"`
	Fixer   RoleSpec `json:"fixer"`
	Judger  RoleSpec `json:"judger"`
}

type RoleExecution

type RoleExecution struct {
	Strategy    string   `json:"strategy"`
	Independent bool     `json:"independent,omitempty"`
	Command     string   `json:"command,omitempty"`
	Artifacts   string   `json:"artifacts,omitempty"`
	Applied     []string `json:"applied,omitempty"`
	Notes       string   `json:"notes,omitempty"`
	ExitCode    int      `json:"exit_code,omitempty"`
	StderrTail  string   `json:"stderr_tail,omitempty"`
}

type RoleSpec

type RoleSpec struct {
	Strategy string `json:"strategy"`
	Command  string `json:"command"`
}

type RunResult

type RunResult struct {
	SchemaVersion string         `json:"schema_version"`
	StartedAt     time.Time      `json:"started_at"`
	FinishedAt    time.Time      `json:"finished_at"`
	Scenario      ScenarioResult `json:"scenario"`
	Findings      []Finding      `json:"findings"`
	Judge         JudgeScore     `json:"judge"`
	Iterations    int            `json:"iterations"`
	Branch        string         `json:"branch"`
	FixesApplied  []string       `json:"fixes_applied"`
	Mode          string         `json:"mode,omitempty"`
	RunID         string         `json:"run_id,omitempty"`
	Committee     *CommitteeMeta `json:"committee,omitempty"`
}

func RunLoop

func RunLoop(cfg Config) (RunResult, error)

type Scenario

type Scenario struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	WorkDir     string `json:"work_dir"`
	Steps       []Step `json:"steps"`
}

func DefaultOnboardingScenario

func DefaultOnboardingScenario(agentcliBin string) Scenario

type ScenarioResult

type ScenarioResult struct {
	Name       string       `json:"name"`
	StartedAt  time.Time    `json:"started_at"`
	FinishedAt time.Time    `json:"finished_at"`
	OK         bool         `json:"ok"`
	Steps      []StepResult `json:"steps"`
}

func RunScenario

func RunScenario(s Scenario) (ScenarioResult, error)

type Step

type Step struct {
	Name    string `json:"name"`
	Command string `json:"command"`
}

type StepResult

type StepResult struct {
	Name         string `json:"name"`
	Command      string `json:"command"`
	ExitCode     int    `json:"exit_code"`
	DurationMs   int64  `json:"duration_ms"`
	Stdout       string `json:"stdout"`
	Stderr       string `json:"stderr"`
	CombinedTail string `json:"combined_tail"`
}

Jump to

Keyboard shortcuts

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