A vibe coded POC to try to get a network tab for CLI app
- Drop-in replacement for Go's standard HTTP client
- Automatic logging of requests and responses
- Namespace support for organizing logs by project/service
- Zero-overhead when disabled
- Request/response body capture with automatic restoration
- Duration tracking for performance analysis
- Error handling and logging
- Beautiful TUI built with Bubble Tea
- Two-panel layout similar to browser dev tools
- Request filtering and search capabilities
- Detailed request/response inspection
- Namespace-based filtering
- Keyboard navigation for efficiency
- Color-coded status indicators
go get github.com/bobby/slurpypackage main
import (
"log"
"github.com/bobby/slurpy/sdk"
)
func main() {
// Create client with logging enabled
client, err := slurpy.New(slurpy.Config{
Namespace: "my-app",
Enabled: true,
})
if err != nil {
log.Fatal(err)
}
// Use like any HTTP client - requests are automatically logged
resp, err := client.Get("https://api.example.com/users")
if err != nil {
log.Fatal(err)
}
defer resp.Body.Close()
// Request is now logged to ~/.config/slurpy/logs/
}# Build and run
go build -o slurpy ./cli
./slurpy
# Or use the Makefile
make clitype Config struct {
Namespace string // Unique identifier for this project
Enabled bool // Enable/disable logging
}Default namespace: "default"
Storage location: ~/.config/slurpy/logs/
The Slurpy client implements all standard HTTP methods:
// Standard methods
resp, err := client.Get(url)
resp, err := client.Post(url, contentType, body)
resp, err := client.Put(url, contentType, body)
resp, err := client.Delete(url)
// Custom requests
resp, err := client.Do(req)// Change namespace dynamically
client.SetNamespace("new-service")
// Toggle logging on/off
client.SetEnabled(false) // Disable logging
client.SetEnabled(true) // Re-enable logging
// Check current state
namespace := client.GetNamespace()
enabled := client.IsEnabled()// Multiple clients with different namespaces
userClient, _ := slurpy.New(slurpy.Config{
Namespace: "user-service",
Enabled: true,
})
paymentClient, _ := slurpy.New(slurpy.Config{
Namespace: "payment-service",
Enabled: true,
})
// Custom requests with headers
req, _ := http.NewRequest("GET", "https://api.example.com/data", nil)
req.Header.Set("Authorization", "Bearer token")
req.Header.Set("X-API-Key", "secret")
resp, err := client.Do(req)| Key | Action |
|---|---|
β/k, β/j |
Navigate request list |
tab |
Switch between panels |
r |
Refresh requests |
c |
Clear current namespace |
? |
Toggle help |
q/esc |
Quit |
βββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β Request List β Request Details β
β β β
β β GET /api/users [200] β REQUEST β
β 10:30:45 β’ 45ms β’ my-app β Method: GET β
β β URL: https://api.../users β
β β POST /api/users [201] β Duration: 45ms β
β 10:30:50 β’ 123ms β’ my-app β β
β β Request Headers: β
β β PUT /api/users/1 [200] β Authorization: Bearer ... β
β 10:31:15 β’ 67ms β’ my-app β Content-Type: application β
β β β
β β RESPONSE β
β β Status: 200 β
β β Size: 1234 bytes β
β β β
β β Response Body: β
β β {"users": [...]} β
βββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββ
- Request List (Left Panel): Shows all HTTP requests with method, URL, status, and timing
- Request Details (Right Panel): Detailed view of headers, body, and response data
- Filtering: Built-in search and filter capabilities
- Color Coding: Visual status indicators (green=success, red=error, yellow=pending)
- Namespace Organization: Requests grouped by service/project namespace
slurpy/
βββ pkg/ # Shared data structures and utilities
β βββ models/ # Request/response models
β βββ storage/ # File system storage management
βββ sdk/ # Slurpy SDK for Go applications
βββ cli/ # Bubble Tea TUI application
β βββ ui/ # UI components and styling
βββ examples/ # Usage examples
β βββ basic/ # Simple usage example
β βββ advanced/ # Advanced features demo
βββ Makefile # Build and development commands
βββ test_slurpy.go # Comprehensive test suite
Requests are stored as JSON files in ~/.config/slurpy/logs/ with the naming convention:
{namespace}_{request_id}.json
{
"id": "abc123def456",
"timestamp": "2024-01-15T10:30:00Z",
"method": "GET",
"url": "https://api.example.com/users",
"headers": {"Authorization": "Bearer token"},
"body": "",
"response": {
"status_code": 200,
"headers": {"Content-Type": "application/json"},
"body": "{\"users\": []}",
"size": 123
},
"duration": "45ms",
"namespace": "my-app",
"error": ""
}# Development
make build # Build the CLI
make cli # Build and run CLI
make example # Run basic example to generate test data
make run-example # Run example then start CLI
make deps # Install dependencies
# Testing & Cleanup
make test # Run tests
make clean # Clean built artifacts and logs
make help # Show available commands# Run comprehensive test suite
go run test_slurpy.go
# Generate test data with examples
go run ./examples/basic
go run ./examples/advanced# Build CLI
go build -o slurpy ./cli
# Build for different platforms
GOOS=linux GOARCH=amd64 go build -o slurpy-linux ./cli
GOOS=windows GOARCH=amd64 go build -o slurpy.exe ./cliSee examples/basic/main.go for a simple integration example.
See examples/advanced/main.go for:
- Multiple namespaces
- Runtime configuration changes
- Custom headers and requests
- CRUD operations
- Error handling
// In your existing application
func NewHTTPClient() *http.Client {
if debug {
client, _ := slurpy.New(slurpy.Config{
Namespace: "my-service",
Enabled: true,
})
return client.Client
}
return &http.Client{}
}While Slurpy doesn't use environment variables directly, you can integrate them:
client, err := slurpy.New(slurpy.Config{
Namespace: os.Getenv("SERVICE_NAME"),
Enabled: os.Getenv("DEBUG") == "true",
})Default: ~/.config/slurpy/logs/
To use a custom location, modify the storage package or implement your own storage backend.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Go best practices and conventions
- Add tests for new features
- Update documentation as needed
- Keep the CLI responsive and user-friendly
- Maintain backward compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
- Bubble Tea - Amazing TUI framework
- Lip Gloss - Beautiful styling
- Bubbles - TUI components
- Inspired by browser developer tools and network debugging needs
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Documentation: This README and inline code docs
Happy debugging! πΉβ¨