{"modulePath":"github.com/vibexp/cli","version":"v0.6.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package exitcode\n\nPackage exitcode defines the CLI's stable process exit codes and a typed error that carries the intended code, so the mapping lives in exactly one place (unwrapped once in cmd/vibexp/main.go).\n\n## Constants\n\n```go\nconst (\n\tOK         = 0 // success\n\tRuntimeErr = 1 // API or runtime error\n\tUsageErr   = 2 // invalid usage (bad flags/args)\n\tAuthErr    = 4 // authentication/authorization failure\n)\n```\nStable exit codes. These are part of the CLI's scripting contract — do not renumber. Documented in docs/architecture.md.\n\n## Functions\n\n```go\nfunc FromError(err error) int\n```\nFromError resolves the process exit code for err:\n\n  - nil                 -\u003e OK (0)\n  - wraps a CodedError  -\u003e that code\n  - anything else       -\u003e RuntimeErr (1)\n\n## Types\n\n```go\ntype CodedError struct {\n\tCode int\n\tErr  error\n}\n```\nCodedError wraps an error with the process exit code it should produce.\n\n```go\nfunc Auth(format string, args ...any) *CodedError\n```\nAuth is a convenience constructor for auth (exit 4) errors.\n\n```go\nfunc New(code int, err error) *CodedError\n```\nNew wraps err with the given exit code.\n\n```go\nfunc Newf(code int, format string, args ...any) *CodedError\n```\nNewf wraps a formatted message with the given exit code.\n\n```go\nfunc Usage(format string, args ...any) *CodedError\n```\nUsage is a convenience constructor for usage (exit 2) errors.\n\n```go\nfunc (e *CodedError) Error() string\n```\n\n```go\nfunc (e *CodedError) ExitCode() int\n```\nExitCode reports the process exit code, satisfying ExitCoder.\n\n```go\nfunc (e *CodedError) Unwrap() error\n```\nUnwrap exposes the wrapped error to errors.Is / errors.As.\n\n```go\ntype ExitCoder interface {\n\tExitCode() int\n}\n```\nExitCoder is any error that knows its intended process exit code. Both \\*CodedError and the API error layer implement it.\n\n","path":"github.com/vibexp/cli/internal/exitcode","name":"exitcode","synopsis":"Package exitcode defines the CLI's stable process exit codes and a typed error that carries the intended code, so the mapping lives in exactly one place (unwrapped once in cmd/vibexp/main.go).","isRedistributable":true}
