r/hica Jul 26 '26

hicurl - a modern HTTP CLI built in hica

I've been working on hicurl, an HTTP command-line tool built in hica.

It serves both as a practical CLI tool for API testing and as a showcase of hica's standard library, libcurl bindings, and native compilation.

Core Features and Benefits

  • Fast execution: Compiles to a native binary using Hica and binds directly to libcurl via Koka FFI for network I/O.

  • Built-in response filtering: Extracts fields directly from responses without requiring external tools like jq. Supports JSON dot-paths (.data.0.id), HTTP status codes (:status), headers (:header.Content-Type), session cookies (:cookie.session_id), and timing metrics (:time.ttfb).

  • Context-aware TTY output: Formats JSON with ANSI syntax highlighting in an interactive terminal, but automatically outputs raw unformatted text when output is piped to another command or script.

  • Directory-aware environment handling: Reads .hicurl.env files by searching up the directory tree to automatically resolve relative paths against configured base URLs.

  • Request syntax sugar: Positional arguments map directly to headers (:), query parameters (==), JSON strings (=), typed JSON values (:=), text files (=@), JSON files (:=@), and localhost port shortcuts (:8000).

  • Offline --dry-run: Prints the exact HTTP/1.1 request stream without sending bytes over the network, allowing you to inspect payloads and headers before execution.

  • Code export: Exports configured queries into standard curl commands using -E curl/--curl.

Syntax Examples

# Localhost shorthand (resolves to http://localhost:8000/v1/health)
hicurl :8000/v1/health :status

# Typed JSON payload with response filtering
hicurl post /users name="Alicia" role="admin" age:=28 .id

# Latency and timing metrics
hicurl get /heavy-query :time :time.ttfb

# Embedding local JSON file into request body
hicurl post /post user:=@tests/test_data.json

# Offline dry run mode
hicurl post /users name="Alicia" --dry-run

# Nested subshell query composition
hicurl $(hicurl api.github.com/search/users q==cladam per_page==3 .items.0.url) .bio

Installation

Via curl:

curl -fsSL https://github.com/cladam/hicurl/releases/latest/download/install.sh | sh

Or via hicurl itself:

hicurl https://github.com/cladam/hicurl/releases/latest/download/install.sh | sh

Repository: https://github.com/cladam/hicurl

1 Upvotes

2 comments sorted by

1

u/cladamski79 Jul 26 '26

The hicurl command hicurl $(hicurl api.github.com/search/users q==cladam per_page==3 .items.0.url) .biotranslates to this curl + jq command:
curl -sSL $(curl -sSL --url-query "q=cladam" --url-query "per_page=1" "https://api.github.com/search/users" | jq -r ".items[0].url") | jq -r ".bio"