gate

package
v1.40.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 15 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 gate implements the deterministic, local PR quality gate shared by qmax-code's CLI and interactive console.

Index

Constants

View Source
const (
	DefaultBase    = "origin/main"
	DefaultTimeout = 10 * time.Minute
)

Variables

View Source
var (
	ErrToolUnavailable = errors.New("required tool is unavailable")
	ErrTimedOut        = errors.New("command timed out")
)

Functions

func DisplayPath

func DisplayPath(path string) string

DisplayPath quotes paths so unusual filenames cannot inject terminal lines.

func IsHelp

func IsHelp(err error) bool

func WriteCLIUsage

func WriteCLIUsage(w io.Writer)

WriteCLIUsage prints only non-sensitive static command help.

func WriteText

func WriteText(w io.Writer, result Result)

WriteText renders the stable human-readable gate report.

Types

type CLIOptions

type CLIOptions struct {
	Base string
}

CLIOptions are the stable arguments for the gate subcommand.

func ParseCLIArgs

func ParseCLIArgs(args []string, errorOutput io.Writer) (CLIOptions, error)

ParseCLIArgs parses qmax-code gate arguments without touching global flags.

type Check

type Check struct {
	Name     string
	Command  string
	Status   CheckStatus
	Duration time.Duration
	Evidence string
}

Check records one command without retaining unbounded command output.

type CheckStatus

type CheckStatus string

CheckStatus describes the result of one deterministic check.

const (
	CheckPass       CheckStatus = "PASS"
	CheckFail       CheckStatus = "FAIL"
	CheckIncomplete CheckStatus = "INCOMPLETE"
)

type ExecRunner

type ExecRunner struct{}

ExecRunner runs commands directly, never through a shell.

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, dir, name string, args ...string) (string, error)

type Options

type Options struct {
	Base       string
	Dir        string
	Timeout    time.Duration
	Runner     Runner
	OnProgress func(string)
}

Options controls local gate execution.

type Result

type Result struct {
	Base      string
	MergeBase string
	Head      string
	Files     []string
	// FilesTruncated indicates that Files contains only the complete paths that
	// fit inside the bounded command-output budget.
	FilesTruncated bool
	Checks         []Check
	Verdict        Verdict
	Incomplete     string
}

Result is shared by all gate presentation surfaces.

func Run

func Run(ctx context.Context, opts Options) Result

Run scopes the complete local candidate diff and runs the repository checks. It does not modify source files, invoke an inference backend, or contact QualityMax.

func (Result) ExitCode

func (r Result) ExitCode() int

ExitCode follows the documented command contract.

type Runner

type Runner interface {
	Run(ctx context.Context, dir, name string, args ...string) (string, error)
}

Runner is injectable so gate behavior can be tested without spawning tools.

type Verdict

type Verdict string

Verdict is the gate's stable merge decision.

const (
	Pass       Verdict = "PASS"
	Fail       Verdict = "FAIL"
	Incomplete Verdict = "INCOMPLETE"
)

Jump to

Keyboard shortcuts

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