fix: clean up HTTP error messages for CLI commands
The new formatHttpError() utility:
- Maps common HTTP status codes (400, 401, 403, 404, 408, 429, 500, 502, 503, 504) to human-readable messages
- Detects and suppresses HTML content (Cloudflare error pages, etc.)
- Extracts
message/error/detailfields from JSON error responses - Truncates overly long plain text responses (>500 chars)
Test plan
-
Verify build passes:
bun run build -
Test with valid API key:
postgresai issues list - Test with invalid API key to verify 401 message formatting
- Simulate 502 error to verify HTML is not dumped