Help us shape the future of Go! Take the 2026 Go Developer Survey

verifier

package
v0.50.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package verifier provides post-generation verification strategies that validate generated projects compile and pass tests. The AgentVerifier uses an AI-powered autonomous repair loop — invoking Go build, test, and lint tools iteratively until the project is healthy or a retry limit is reached.

Index

Constants

This section is empty.

Variables

View Source
var ErrVerificationFailed = errors.NewSentinel("gtb.verifier.verification_failed", "verification failed or incomplete")

AgentVerifier implements the Verifier interface using an autonomous agent loop.

Functions

This section is empty.

Types

type AIResponse

type AIResponse struct {
	GoCode          string   `json:"go_code" jsonschema:"description=The converted/fixed Go code (FULL FILE CONTENT)"`
	TestCode        string   `json:"test_code" jsonschema:"description=Unit tests for the converted code (FULL FILE CONTENT)"`
	Recommendations []string `json:"recommendations" jsonschema:"description=Recommendations for the converted code"`
}

AIResponse represents the structured response from the AI for code generation/fixing.

type AgentVerifier

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

func NewAgentVerifier

func NewAgentVerifier(p *props.Props, allowQuery bool) *AgentVerifier

NewAgentVerifier creates a new AgentVerifier. allowQuery enables the query_user tool (interactive runs only).

func (*AgentVerifier) VerifyAndFix

func (v *AgentVerifier) VerifyAndFix(ctx context.Context, projectRoot, cmdDir string, _ *templates.CommandData, aiClient gochat.ChatClient, _ GeneratorFunc) error

VerifyAndFix runs the agentic verification loop.

type GeneratorFunc

type GeneratorFunc func(ctx context.Context, cmdDir string, data *templates.CommandData) error

GeneratorFunc is a callback that writes the command files (main.go, test.go) based on the data.

type Verifier

type Verifier interface {
	VerifyAndFix(ctx context.Context, projectRoot, cmdDir string, data *templates.CommandData, aiClient gochat.ChatClient, gen GeneratorFunc) error
}

Verifier defines the interface for verifying and fixing generated code.

Jump to

Keyboard shortcuts

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