dispatch

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Classify

func Classify(err error) (output.ExitCode, string, map[string]any)

Classify maps a known error to (exit code, message, envelope-extra fields).

func RequestIDFrom

func RequestIDFrom(ctx context.Context) string

RequestIDFrom returns the dispatch-issued request id from a context.

func Run

func Run(name string, opts Options, runner Runner) int

Run executes runner under a dispatch chokepoint: generates a request id, classifies known errors, builds the output envelope, audits, and emits. Returns the process exit code.

Types

type Options

type Options struct {
	JSON           bool
	Stdout         any // io.Writer; left as any to avoid an import in the type
	Stderr         any
	HumanFormatter func(any)
	AuditPath      string
	Args           map[string]any
}

Options configure how Run emits and audits a single command.

type Runner

type Runner func(ctx context.Context) (any, error)

Runner returns the success-envelope `data` payload, or an error.

Jump to

Keyboard shortcuts

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