cli

package
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExitSuccess indicates the command completed successfully.
	ExitSuccess = 0

	// ExitError indicates a general error occurred.
	ExitError = 1

	// ExitUsage indicates invalid arguments or flags were provided.
	ExitUsage = 2

	// ExitNotFound indicates a requested resource was not found
	// (message, config, agent, etc.).
	ExitNotFound = 3

	// ExitTimeout indicates a timeout occurred (watch, monitor commands).
	ExitTimeout = 4

	// ExitContextMismatch indicates a valid command was blocked because its
	// resolved mailbox root conflicts with the pinned AMQ session context.
	ExitContextMismatch = 5

	// ExitActionRequired indicates the command cannot proceed without an
	// operator action (stale conversation token, Inspect unknown, untrusted
	// config digest, refused committed-command shape, blocked auto-rebind).
	ExitActionRequired = 6
)

Exit codes for CLI commands. These provide semantic meaning for scripting and automation.

Variables

This section is empty.

Functions

func ActionRequiredError added in v0.61.0

func ActionRequiredError(format string, args ...any) error

ActionRequiredError creates an error with ExitActionRequired code.

func AggregateExitCode added in v0.61.0

func AggregateExitCode(wholeCommand int, agents []AgentOutcome) int

AggregateExitCode implements the §11 launch/resume exit contract. A nonzero wholeCommand is a pre-launch failure and is returned as-is. Once per-agent work begins (wholeCommand == 0), the aggregate is the highest-precedence per-agent outcome: 6 > 4 > 1 > 0. Expected dispositions (disabled, unsupported, policy-consistent fresh) contribute 0 even when Code is set to a failure. A nonzero per-agent code outside {6, 4, 1, 0} fails closed as ExitError.

func ContextMismatchError added in v0.42.1

func ContextMismatchError(format string, args ...any) error

ContextMismatchError creates an error with ExitContextMismatch code.

func FilterMessages added in v0.9.6

func FilterMessages(items []listItem, opts FilterOptions) []listItem

FilterMessages returns items that match all provided filter options.

func GetExitCode added in v0.9.6

func GetExitCode(err error) int

GetExitCode extracts the exit code from an error. Returns ExitSuccess (0) if err is nil. Returns the wrapped code if err is an *ExitCodeError. Returns ExitError (1) for all other errors.

func NotFoundError added in v0.9.6

func NotFoundError(format string, args ...any) error

NotFoundError creates an error with ExitNotFound code.

func Run

func Run(args []string, version string) error

func TimeoutError added in v0.9.6

func TimeoutError(format string, args ...any) error

TimeoutError creates an error with ExitTimeout code.

func UsageError added in v0.9.6

func UsageError(format string, args ...any) error

UsageError creates an error with ExitUsage code.

func WithExitCode added in v0.9.6

func WithExitCode(code int, err error) error

WithExitCode wraps an error with a specific exit code.

Types

type AgentDisposition added in v0.61.0

type AgentDisposition string

AgentDisposition classifies a per-agent launch/resume outcome.

const (
	// AgentDispositionDisabled is an expected skip; it contributes 0.
	AgentDispositionDisabled AgentDisposition = "disabled"
	// AgentDispositionUnsupported is an expected capability skip; it contributes 0.
	AgentDispositionUnsupported AgentDisposition = "unsupported"
	// AgentDispositionFresh is a policy-consistent fresh start; it contributes 0.
	AgentDispositionFresh AgentDisposition = "fresh"
)

type AgentOutcome added in v0.61.0

type AgentOutcome struct {
	Code        int
	Disposition AgentDisposition
}

AgentOutcome is one agent's contribution to an aggregate process exit code.

type CommandHandler added in v0.23.0

type CommandHandler func([]string) error

CommandHandler is the function signature for command handlers in the registry.

type CommandInfo added in v0.23.0

type CommandInfo struct {
	Name            string
	Summary         string
	Description     string
	LongDescription []string
	Examples        []string
	Footer          string
	Handler         CommandHandler
	Children        []CommandInfo
}

CommandInfo describes a top-level command or subcommand for help generation and future routing/completion work.

type ExitCodeError added in v0.9.6

type ExitCodeError struct {
	Code int
	Err  error
}

ExitCodeError wraps an error with a specific exit code.

func (*ExitCodeError) Error added in v0.9.6

func (e *ExitCodeError) Error() string

func (*ExitCodeError) Unwrap added in v0.9.6

func (e *ExitCodeError) Unwrap() error

type FilterOptions added in v0.9.6

type FilterOptions struct {
	Priority string
	From     string
	Kind     string
	Labels   []string
}

FilterOptions defines filter criteria for listing messages.

type SessionContextError added in v0.42.1

type SessionContextError struct {
	Message string
}

SessionContextError identifies an unsafe or incoherent mailbox context. It is distinct from a usage error: the command syntax was valid.

func (*SessionContextError) Error added in v0.42.1

func (e *SessionContextError) Error() string

type TreeRelation added in v0.44.0

type TreeRelation uint8

TreeRelation is a physical-filesystem relationship. Unknown is deliberately distinct from Different: callers must choose whether unverifiable identity is advisory or authority-bearing instead of accidentally collapsing failures.

const (
	TreeRelationUnknown TreeRelation = iota
	TreeRelationSame
	TreeRelationDifferent
)

func (TreeRelation) String added in v0.44.0

func (r TreeRelation) String() string

Source Files

Jump to

Keyboard shortcuts

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