tools

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 28 Imported by: 0 modules, 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

Overview

Package tools keeps the evidence that the code sessions change was checked: the checks their commands run, the files their writes land in, and the nudge that sends the agent back to check before it finishes a turn that changed code. It runs the recipe of a project too, for the tool that has the agent verify it and for the service the app and the command line verify it through

Index

Constants

View Source
const Guidance = "[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, added to the nudge unless tools.verify.guidance turns it off

View Source
const Project = "verify_project"

Name of the tool that runs a project's recipe

Variables

View Source
var Steps = append(slices.Clone(recipes.Phases), "start")

Steps a run may take, in their order

Functions

func Answered

func Answered(url string, ready bool, status int32, failure string) string

Whether the started app answered at the address, in a sentence: the status it answered with, else the last failure to reach it

func Described

func Described(name, root string, manifest bool) string

What a recipe is of, the folder of its project when one is given, and where it came from, in words, such as Go project in ~/code/app, worked out from the files of the project

func IsStep

func IsStep(name string) bool

Whether the name is one of the steps a run may take

func Outcome

func Outcome(ok, timedOut bool) string

How a step went, as a person reads it

func Source

func Source(manifest bool) string

Where a recipe came from, in words

func Took

func Took(seconds float64) string

Length of a step given in seconds as words, to a tenth of a second

func Word

func Word(step string) string

Word a person reads a step as, such as Setup for bootstrap

Types

type Env

type Env struct {
	Config   *config.Config
	Ledger   *Ledger
	Terminal *terminal.Terminal
	Session  string
}

What a run reaches: the profile's settings, the ledger it records into, the terminal its steps run on, and the session it is for

type Ledger

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

Evidence each profile keeps that the workspaces its sessions change were checked: the checks run, and per session and workspace the newest check and the files changed since

func Register

func Register(registry *tools.Registry, host *terminal.Terminal, stores *sessions.Registry, runs *runner.Registry) *Ledger

Registers the ledger and the tool that runs a project's recipe, the session stores and the runner telling a chat app's sessions apart and the stores telling the person of a ledger file set aside: the ledger, which every run records into

func (*Ledger) Close

func (l *Ledger) Close() error

Closes the databases of every profile, as icebath exits

func (*Ledger) Enabled

func (l *Ledger) Enabled(cfg *config.Config, platform string) bool

Whether the profile asks for the edits of its sessions on the surface to be checked, which is all the ledger records for: on, or auto anywhere but a chat app

func (*Ledger) Verify

func (l *Ledger) Verify(ctx context.Context, cfg *config.Config, dir, session string, ok bool, scope, output string) error

Records a finished run of verify in the folder as evidence for its workspace, a partial one as targeted

type NoRecipeError

type NoRecipeError struct{ Root string }

A folder that holds no project verify recognizes

func (*NoRecipeError) Error

func (e *NoRecipeError) Error() string

type NotFolderError

type NotFolderError struct{ Path string }

A path given to a run that is no folder

func (*NotFolderError) Error

func (e *NotFolderError) Error() string

type NotStepError

type NotStepError struct{ Name string }

A name given to a run for a step that is none of those it may take, said to whoever named it

func (*NotStepError) Error

func (e *NotStepError) Error() string

type Options

type Options struct {
	// Only works out the recipe, saving it when Save says so, running nothing
	DetectOnly, Save, SkipStart bool
	// Steps to run, every one when empty
	Phases []string
	// Port the started app is asked on in place of the one the recipe names, 0 for that one
	Port int
	// Longest one command of a step may take, and the longest wait for the started app to answer
	Timeout, ReadyTimeout time.Duration
	// Told what the run does now, such as the command a step runs; nil to tell nothing
	Doing func(text string)
	// Asked of every command the run is to start before the first of them starts: why it may not run, nil when it may. nil lets every
	// one run, as for a person who asked for the run themselves
	Allow func(command string) error
	// Why the recipe may not be saved at the path, empty when it may; nil lets it be saved anywhere
	Unwritable func(path string) string
}

What a run of verify is asked to do

func Defaults

func Defaults() Options

Options of a run of every step with the usual time limits

type Report

type Report struct {
	Root     string
	Recipe   *recipes.Recipe
	Manifest bool
	Saved    string
	Result   *recipes.Result
}

What a run found: the folder of the project, its recipe and where that came from, the file it was saved to, and how each step went, none for a run that only worked out the recipe

func Run

func Run(ctx context.Context, env Env, path string, o Options) (*Report, error)

Works out the recipe of the project in the folder, or reads its saved one, saving it when asked, then runs its steps and records the run as evidence for the project's workspace

func (*Report) OK

func (r *Report) OK() bool

Whether every step passed and the app, when it was started, answered; a run that only worked out the recipe passes

Jump to

Keyboard shortcuts

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