Commit Graph

2 Commits

Author SHA1 Message Date
Riley Zhang
ee24ab8aeb feat: implement Phase 3 CLI Polish - Error handling, output formatting, completions
Implements comprehensive CLI improvements for Hatch:

Error Handling:
- Add structured CLIError type with exit codes
- Add consistent exit codes (OK, GeneralError, UsageError, NetworkError, ServerError, ConfigError)
- Add colored error messages with details
- Add proper connection refused error handling

Output Formatting:
- Add ANSI color support with terminal detection
- Add colored success/error/warning messages
- Add compact output format option
- Add --output flag for json/table/compact formats

Shell Completions:
- Add bash completions with full command/flag support
- Add zsh completions with descriptions and subcommand handling
- Add fish completions with helper functions
- Add PowerShell completions with native argument completer
- Add hatch completions <shell> command

Configuration Support:
- Add config file support (XDG_CONFIG_HOME or ~/.config/hatch/config.json)
- Add environment variable overrides (HATCH_URL, HATCH_FORMAT, NO_COLOR)
- Add hatch config show/set/get/init commands
- Add configuration keys: server_url, format, no_color, timeout

Additional Improvements:
- Add version command with build-time version injection
- Add help command with colored usage output
- Add --output flag to all commands for format control
- Add request timeout support
- Improve error messages with actionable suggestions
- Add comprehensive test coverage

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-24 05:17:58 +02:00
SoftwareEngineer
60e25bfc9d feat: add thin CLI for Hatch
Implements CLI commands that wrap the JSON API layer:
- hatch capture <url> - Send request to endpoint and store it
- hatch inspect <endpoint> - Fetch requests as JSON
- hatch search <endpoint> - Search captured traffic
- hatch replay <request-id> - Replay a captured request
- hatch mock set <endpoint> - Configure mock response
- hatch doc generate <endpoint> - Output OpenAPI spec

Uses stdlib flag package for CLI parsing (boring tools philosophy).
All commands talk to running Hatch server via HTTP.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-06-23 09:59:38 +02:00