verify

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 31 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultPhaseTimeout = 600.0
	DefaultReadyTimeout = 60.0
)
View Source
const CodingVerifyGuidanceText = "[Coding] Before you run tests/linters or call this done: if this is " +
	"creative UI/visual work, hold off on tests and linters until the user says " +
	"they like the result or you're about to commit. And before every commit, " +
	"clean your work: keep it KISS/DRY, match the surrounding code style, and be " +
	"elitist, shorthand, clever, concise, efficient, and elegant."

How-to-verify advice appended to verification stop nudges

View Source
const ManifestVersion = 1

Variables

View Source
var (
	SpawnOwned                   func(ctx context.Context, cmd *exec.Cmd, purpose string) error
	ReleaseProcessGroupOnceEmpty func(pgid int, poll func(), timeout time.Duration) bool
)

Process ownership of pkg/tools process_identity, installed by the pkg/plugins init

View Source
var EvidenceRecorder func(ctx context.Context, root, sessionID string, ok bool, command, scope, output string) (map[string]any, error)

Ledger writer a completed verify run records through, assigned by the agent package

View Source
var PhaseOrder = []string{"bootstrap", "build", "test"}

Functions

func CodingVerifyGuidance

func CodingVerifyGuidance(ctx context.Context) string

Guidance appended to verification stop nudges, empty when agent.verify_guidance of the profile of ctx turns it off

func DetectPackageManager

func DetectPackageManager(root string) (string, error)

Package manager named by the first lockfile present, empty when none is

func ManifestPath

func ManifestPath(root string) string

Verify manifest path of the project at root

func MaxVerifyNudges

func MaxVerifyNudges(ctx context.Context) int

Bound on consecutive pre_verify continue directives per turn from agent.max_verify_nudges of the profile of ctx, never below zero

func SaveManifest

func SaveManifest(root string, recipe *Recipe) (string, error)

Writes the recipe in the versioned wrapper shape and returns the manifest path

Types

type OSError

type OSError struct {
	Class string
	Err   error
}

OSError of a failed filesystem call with the CPython errno text and quoted filename

func (*OSError) Error

func (e *OSError) Error() string

func (*OSError) Unwrap

func (e *OSError) Unwrap() error

type Parser

type Parser struct {
	Name        string
	Help        string
	Description string
	Arguments   []ParserArgument
	JSONHelp    string
}

verify subcommand parser, the help, description and arguments the CLI binding builds

func BuildVerifyParser

func BuildVerifyParser() Parser

Parser for the verify subcommand with every flag, choice, default and help text

type ParserArgument

type ParserArgument struct {
	Name     string
	Action   string
	Choices  []string
	Default  any
	Type     string
	Optional bool
	Help     string
}

Argument of the verify subcommand, an argparse add_argument call the CLI binding replays

type PhaseResult

type PhaseResult struct {
	Phase      string
	Command    string
	ExitCode   *int
	Duration   float64
	OutputTail string
	TimedOut   bool
}

PhaseResult is one recipe command run, a nil exit code meaning it timed out

func (*PhaseResult) OK

func (p *PhaseResult) OK() bool

Reports a zero exit without a timeout

func (*PhaseResult) ToDict

func (p *PhaseResult) ToDict() *jsonutil.Object

JSON mapping of the phase with the duration rounded to milliseconds

type ReadinessResult

type ReadinessResult struct {
	URL        string
	Ready      bool
	StatusCode *int
	Duration   float64
	Error      *string
	OutputTail string
}

ReadinessResult is the start phase poll of the app URL

func (*ReadinessResult) ToDict

func (r *ReadinessResult) ToDict() *jsonutil.Object

JSON mapping of the readiness poll with the duration rounded to milliseconds

type Recipe

type Recipe struct {
	Name          string
	Kind          string
	Bootstrap     []string
	Build         []string
	Test          []string
	Start         *string
	Port          *int
	PortTrue      bool
	ReadinessPath string
	Evidence      []string
}

Recipe is a runnable verification recipe whose command lists are shell strings run in the project root

func DetectRecipe

func DetectRecipe(root string) (*Recipe, error)

Recipe for root in grok order, package.json then Python, Go, Rust, Java, Makefile and compose, nil when none matches

func LoadManifest

func LoadManifest(root string) (*Recipe, error)

Saved recipe in the wrapped or bare shape, nil on any read, decode or shape problem

func LoadOrDetect

func LoadOrDetect(root string) (*Recipe, string, error)

Saved manifest recipe with source manifest, else the detected recipe with source detected

func RecipeFromDict

func RecipeFromDict(raw any) (*Recipe, error)

Tolerant recipe loader accepting these field names and the grok camelCase aliases, nil without a usable name

func (*Recipe) ToDict

func (r *Recipe) ToDict() *jsonutil.Object

Manifest mapping with the grok field names in dataclass order

type RequestError

type RequestError struct {
	Class string
	Msg   string
}

RequestError is the InvalidURL or UnicodeEncodeError http.client raises before sending a readiness request

func (*RequestError) Error

func (e *RequestError) Error() string

type TypeError

type TypeError struct{ Msg string }

TypeError is the Python TypeError a non string start script raises in port inference

func (*TypeError) Error

func (e *TypeError) Error() string

type VerifyOptions

type VerifyOptions struct {
	Phases        []string
	PhaseTimeout  float64
	ReadyTimeout  float64
	SkipStart     bool
	PortOverride  *int
	StopOnFailure bool
	OnOutput      func(string)
}

VerifyOptions are the run_verify keyword arguments, start from NewVerifyOptions for the defaults

func NewVerifyOptions

func NewVerifyOptions() VerifyOptions

Options with the run_verify defaults, every phase, 600 s phases, 60 s readiness and stop on failure

type VerifyResult

type VerifyResult struct {
	RecipeName string
	Phases     []*PhaseResult
	Readiness  *ReadinessResult
}

VerifyResult is a whole verification pass

func RunVerify

func RunVerify(ctx context.Context, root string, recipe *Recipe, opts VerifyOptions) (*VerifyResult, error)

Runs the selected phases in order then boots, polls and tears down the app, refusing a compose project with live containers

func (*VerifyResult) OK

func (v *VerifyResult) OK() bool

Reports every phase passing and the app answering when it was started

func (*VerifyResult) ToDict

func (v *VerifyResult) ToDict() *jsonutil.Object

JSON mapping of the pass, readiness null when the app never started

Jump to

Keyboard shortcuts

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