Documentation
¶
Overview ¶
Package temper runs build, lint, and test verification in a worktree.
Temper ("tempering the steel") validates that Claude's changes compile, pass linting, and pass tests before progressing to the Warden review stage. Commands are configurable per-anvil.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Steps is the ordered list of verification steps.
Steps []Step
// GoRaceDetection is a configuration hint indicating whether Go race
// detection should be enabled (e.g., by adding a separate "race" step
// such as 'go test -race -short ./...'). It does not automatically
// modify Steps; callers are responsible for constructing Steps
// accordingly (e.g., via DefaultConfigWithRace). Default is false since
// -race slows tests and increases memory usage.
GoRaceDetection bool
}
Config holds per-anvil verification configuration.
func DefaultConfig ¶
func DefaultConfig(worktreePath string, opts *DetectOptions) Config
DefaultConfig returns a default config that auto-detects the project type.
func DefaultConfigWithRace ¶
func DefaultConfigWithRace(worktreePath string, opts *DetectOptions, raceEnabled bool) Config
DefaultConfigWithRace returns a default config with race detection support.
type DetectOptions ¶
type DetectOptions struct {
// DisableGolangciLint skips the golangci-lint step even if the binary
// is available. When false (default), golangci-lint is added as an
// optional step for Go projects if the binary is found on PATH.
DisableGolangciLint bool
}
DetectOptions controls optional steps during auto-detection.
func DetectOptionsFromAnvilFlag ¶
func DetectOptionsFromAnvilFlag(golangciLint *bool) *DetectOptions
DetectOptionsFromAnvilFlag converts a nullable boolean anvil config flag into DetectOptions. When golangciLint is non-nil and false, golangci-lint is disabled. This centralises the anvil-config → DetectOptions translation so all call sites stay in sync when new detection toggles are added.
type Result ¶
type Result struct {
// Steps is the ordered list of step results.
Steps []StepResult
// Passed is true if all required steps passed (optional steps may have
// warned without affecting this flag).
Passed bool
// Duration is the total time for all steps.
Duration time.Duration
// FailedStep is the name of the first failed step, or empty if all passed.
FailedStep string
// Summary is a human-readable summary of the verification.
Summary string
}
Result is the overall Temper verification result.
type Step ¶
type Step struct {
// Name identifies the step.
Name string
// Command is the shell command to run.
Command string
// Args are the command arguments.
Args []string
// Dir is the working directory (relative to worktree, or absolute).
// If empty, runs in the worktree root.
Dir string
// Timeout is the maximum duration for this step. Zero means 5 minutes.
Timeout time.Duration
// Optional means failure here doesn't fail the overall check.
Optional bool
}
Step defines a verification step to run.
type StepResult ¶
type StepResult struct {
// Name identifies the step (e.g., "build", "lint", "test").
Name string
// Command is the full command that was run.
Command string
// ExitCode is the process exit code.
ExitCode int
// Output is the combined stdout+stderr.
Output string
// Duration is how long the step took.
Duration time.Duration
// Passed indicates whether the step succeeded.
Passed bool
// Optional mirrors the Step.Optional flag — failure here does not fail
// the overall check. Surfaced so summaries can render it distinctly.
Optional bool
}
StepResult captures the outcome of a single verification step.
type TemperYAML ¶
type TemperYAML struct {
GoRaceDetection *bool `yaml:"go_race_detection"`
}
TemperYAML represents the per-anvil .forge/temper.yaml configuration.
func LoadAnvilConfig ¶
func LoadAnvilConfig(anvilPath string) (*TemperYAML, error)
LoadAnvilConfig loads per-anvil temper configuration from .forge/temper.yaml within the given anvil path. Returns (nil, nil) if the file does not exist. Returns a non-nil error for read or parse failures so the caller can decide how to surface it (e.g., log once per change, return structured error).