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> |
||
|---|---|---|
| .github/workflows | ||
| brand | ||
| cmd/hatch | ||
| docs | ||
| examples | ||
| internal | ||
| scripts | ||
| site | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| .golangci.yml | ||
| .mailmap | ||
| Caddyfile | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
El Foundation
Engineering repository for El Foundation.
About
El Foundation builds institutions that outlast their founders. We create technology and organizations that compound in value over time. This repository is the source of truth for our engineering work.
Getting Started
- Read the company charter to understand why we exist.
- Read the operating model to understand how decisions are made.
- Read CONTRIBUTING.md before making any changes.
- Read docs/engineering/local-dev.md for the day-to-day workflow.
- Read docs/engineering/hatch-architecture.md for the component map.
Installation
Pre-built Binaries (Recommended)
Download the latest binary for your platform from the Releases page:
- Linux (x64):
hatch-linux-amd64 - Linux (ARM64):
hatch-linux-arm64 - macOS (Intel):
hatch-darwin-amd64 - macOS (Apple Silicon):
hatch-darwin-arm64 - Windows (x64):
hatch-windows-amd64.exe
After downloading:
# Linux/macOS
chmod +x hatch-*
sudo mv hatch-* /usr/local/bin/hatch
# Windows (PowerShell)
Rename-Item hatch-windows-amd64.exe hatch.exe
# Move to a directory in your PATH
Build from Source
Requires Go 1.25 or later:
git clone https://github.com/elfoundation/hatch.git
cd hatch
CGO_ENABLED=0 go build -o hatch ./cmd/hatch
sudo mv hatch /usr/local/bin/
Repository Layout
├── .github/workflows/ # CI/CD definitions
├── cmd/hatch/ # Server entrypoint (Go binary)
├── docs/
│ ├── company/ # Founding documents (charter, org, etc.)
│ ├── engineering/ # Engineering standards, architecture, local dev
│ └── adrs/ # Architecture Decision Records
├── examples/ # Usage examples and integration guides
├── internal/ # Go packages (handler, store, ...)
├── Dockerfile # Multi-stage static binary build (golang → scratch)
├── docker-compose.yml # Local stack with optional Caddy sidecar
├── Caddyfile # TLS reverse proxy for the demo host
└── go.mod # Go module definition
Hatch — Deploy in one command
Hatch is a self-hostable HTTP request inspector + mocker. Ship it to any VPS with Docker.
Read why we are building Hatch →
Quick start (local dev, no HTTPS)
docker compose up --build
# Hatch UI: http://localhost:8080
# Health check: http://localhost:8080/healthz
Or run the binary directly:
go run ./cmd/hatch
# Health check: http://localhost:8080/healthz
Production (with HTTPS via Caddy)
# Set your domain name
cp .env.example .env
# Edit HATCH_HOSTNAME in .env to your real domain
# Start Hatch + Caddy (auto-issues Let's Encrypt cert)
docker compose --profile with-caddy up -d --build
# Hatch UI: https://{your-domain}
# Capture endpoint: https://{your-domain}/{endpoint-id}
Architecture
Internet → :443 (Caddy) → hatch:8080 (Go binary, internal network)
│
├─ Auto TLS (Let's Encrypt, or self-signed for localhost)
├─ Reverse proxy with security headers
└─ JSON access logs to stdout
Caddy terminates TLS and reverse-proxies to the Hatch Go binary. The Hatch container only listens on 127.0.0.1:8080 — it's never directly exposed to the internet.
CLI Reference
Hatch includes a powerful CLI for interacting with the server from the command line:
# Capture requests
hatch capture https://api.example.com/webhook
# Inspect captured traffic
hatch inspect my-webhook
# Search for specific requests
hatch search my-webhook -query 'status:500'
# Replay requests to other services
hatch replay <request-id> -endpoint my-webhook -target https://httpbin.org/post
# Configure mock responses
hatch mock set my-webhook -status 200 -body '{"ok":true}'
# Generate OpenAPI documentation
hatch doc generate my-webhook > openapi.json
For detailed CLI documentation, see docs/engineering/cli.md.
Technology Stack
See docs/engineering/tech-stack.md for current choices and rationale, and docs/adrs/ for the decision records that produced them.
Contributing
See CONTRIBUTING.md.
License
Hatch is released under the MIT License — see LICENSE.