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

cli

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEnvFileLimit = errors.New("env file limit exceeded")
View Source
var ErrInvalidEnvFile = errors.New("invalid env file")
View Source
var ErrInvalidOptions = errors.New("invalid lint options")

Functions

func Doctor

func Doctor(ctx context.Context, output io.Writer, provider, tokenEnv string) error

Doctor checks local Git and credential presence. It never makes HTTP calls or prints token values, source, endpoint URLs, or repository content.

func ExitCode

func ExitCode(err error) int

ExitCode classifies errors without exposing their potentially untrusted text.

func ExitMessage

func ExitMessage(code int) string

func ExitMessageFor added in v0.4.0

func ExitMessageFor(err error) string

ExitMessageFor renders a sanitized user-facing error message.

func NewRoot

func NewRoot(lint LintFunc, version string) *cobra.Command

NewRoot constructs the executable command tree without opening files or constructing a provider. Later commands can be added at this boundary.

Types

type LintFunc

type LintFunc func(context.Context, Options, io.Writer, io.Writer) error

LintFunc receives parsed process options and the command's output streams.

type LookupEnv

type LookupEnv func(string) (string, bool)

func LayeredLookup added in v0.3.0

func LayeredLookup(process LookupEnv, file map[string]string) LookupEnv

LayeredLookup gives an existing process setting precedence over file data.

func LoadEnv added in v0.3.0

func LoadEnv(ctx context.Context, cwd, explicitPath string, disabled bool) (LookupEnv, error)

LoadEnv loads local configuration without changing the process environment. An absent default file is allowed; an explicitly selected file is required.

type Options

type Options struct {
	Base, Head, Provider, Model, Rules, Out string
	BaseURL, APIPath, AuthTokenEnv          string
	Credential                              string
	CredentialResolved                      bool
	Format                                  report.Format
	FailOn                                  report.Threshold
	Gate                                    bool
	RuleThreshold                           float64
	RuleSeverity                            rules.Severity
	RuleThresholdSet, RuleSeveritySet       bool
	Include, Exclude                        []string
	Limits                                  app.Limits
	Metrics                                 bool
	Uncommitted                             bool
}

func Resolve

func Resolve(raw RawOptions, lookup LookupEnv) (Options, error)

Resolve uses flag > LINTPAL_* environment > default precedence. Rule content never enters this function, so it cannot choose an endpoint or token source.

type RawOptions

type RawOptions struct {
	Base, Head, Provider, Model, Rules, Format, Out, FailOn, BlockOn string
	Timeout, MaxConcurrency, BaseURL, APIPath, AuthTokenEnv          string
	RuleThreshold, RuleSeverity                                      string
	Include, Exclude                                                 []string
	Metrics                                                          bool
	Uncommitted                                                      bool
	Changed                                                          map[string]bool
}

RawOptions contains only process-owned flag values. Changed distinguishes an explicit empty flag from an absent flag when environment values are present.

Jump to

Keyboard shortcuts

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