verify

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoConfig = errors.New("no .moa/verify.json found — create one to define verification checks")

ErrNoConfig is returned by Execute when the project has no .moa/verify.json. Callers that gate on check results (e.g. the goal verifier) use it to tell "no checks defined" apart from "checks defined but failing".

Functions

func FormatResult

func FormatResult(r Result) string

FormatResult produces a human-readable summary. Only failed checks include their output.

func NewTool

func NewTool(cwd string) core.Tool

NewTool creates the verify tool. cwd is the workspace root used to locate .moa/verify.json.

Types

type Check

type Check struct {
	Name    string `json:"name"`
	Command string `json:"command"`
	Timeout string `json:"timeout,omitempty"` // Go duration string, default "5m"
}

Check defines a single verification step.

type CheckResult

type CheckResult struct {
	Name     string
	Command  string
	Passed   bool
	Output   string // combined stdout+stderr
	ExitCode int
	TimedOut bool
	Elapsed  time.Duration
}

CheckResult holds the outcome of a single check execution.

type Config

type Config struct {
	Checks []Check `json:"checks"`
}

Config holds the verification configuration loaded from .moa/verify.json.

func LoadConfig

func LoadConfig(cwd string) (*Config, error)

LoadConfig reads .moa/verify.json from cwd. Returns (nil, nil) if the file doesn't exist (feature disabled). Returns (nil, error) if the file exists but is invalid.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks for structural errors. Returns an actionable error referencing the check index/name for the first problem found.

type Result

type Result struct {
	Checks  []CheckResult
	AllPass bool
}

Result holds the outcome of all checks.

func Execute

func Execute(ctx context.Context, cwd string) (Result, error)

Execute is the single entry point for running verification. Both the verify tool and the TUI /verify command call this.

func ExecuteWithConfig

func ExecuteWithConfig(ctx context.Context, cwd string, cfg Config) Result

ExecuteWithConfig runs verification with a pre-loaded config. Used by the tool to support check filtering.

func Run

func Run(ctx context.Context, cwd string, cfg Config) Result

Run executes all checks sequentially. If the parent ctx is cancelled, remaining checks are skipped.

Jump to

Keyboard shortcuts

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