Skip to content

Define standardized exit codes #13

@joelhooks

Description

@joelhooks

Problem

CLI currently uses generic exit codes. Agents and scripts can't distinguish between different failure modes.

Pattern from Go CLI Books

Standard Unix exit code conventions:

const (
    ExitSuccess           = 0   // Operation succeeded
    ExitGenericError      = 1   // Generic error
    ExitMisuse            = 2   // Wrong arguments, invalid flags
    ExitDataError         = 64  // Invalid input data format
    ExitTimeout           = 65  // Operation timed out
    ExitIOError           = 66  // Can't write to socket/file
    ExitProtocolError     = 67  // Invalid RPC response
    ExitDaemonUnavailable = 69  // Daemon not running
    ExitInternalError     = 70  // Panic, unexpected condition
)

Action Items

  • Create internal/types/exitcodes.go with constants
  • Update all command handlers to use specific exit codes
  • Document exit codes in README and --help output
  • Add exit code to JSON error output

Book References

  • Search: pdf-brain search "exit code convention" --fts --expand 2000
  • Search: pdf-brain search "os.Exit error handling" --fts --expand 2000

Priority

P1 - Important for agentic workflows

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions