Drop HTML from your shell.
The thinnest possible client for the htmlbin API. One verb. Humans, CI, agents.
01Install
One npm install, one human auth step. After that, the agent owns it.
# requires node 20+ $ npm i -g @htmlbin/cli $ htmlbin login $ htmlbin publish ./out.html → https://htmlbin.dev/p/aB3xK7g
htmlbin login mints an API token via the GitHub device-code flow, ~30 seconds. The token lives at ./.htmlbin/token or ~/.config/htmlbin/token, in that order.
02Built for agents
htmlbin is an API for agents to share HTML; the CLI is the thin layer that lets them call it. Set CLAUDE_CODE, CURSOR_AGENT, CODEX, AIDER, CLINE, AMP_CODE, or DEVIN in the environment and the CLI auto-switches to single-line JSON. No flag needed.
$ CLAUDE_CODE=1 htmlbin publish ./out.html
{"url":"https://htmlbin.dev/p/aB3xK7g","slug":"aB3xK7g","version":1}
The full agent skill is served at htmlbin.dev/.well-known/agent-skills/htmlbin/SKILL.md — agents can fetch it before publishing to learn the rules.
03The PR-preview trick
Idempotent publishes, keyed by metadata. The pattern that makes pull-request previews click.
$ htmlbin publish ./out.html \
--upsert \
--metadata repo=u/r \
--metadata pr=42
First push creates the drop. Every push after updates it. The URL stays stable for the entire life of the PR. Tag with anything you want; --upsert finds the match and re-publishes in place.
04Three backends, one verb
The same publish command, three places it can land. Select with --to <name>, $HTMLBIN_BACKEND, or backend = "..." in ./.htmlbin/config.
- cloud
- Public previews on htmlbin.dev. The default. Authenticates with an
hb_*token. - gh-pages
- Org-internal previews behind GitHub SSO. Commits to a
gh-pagesbranch via the Git Data API. - cloudflare
- SSO-gated previews via Cloudflare Access. The free tier covers up to 50 users.
05Commands
- publish <file>
- publish a file, print the URL
- update <slug>
- mutate an existing drop (PUT new HTML or PATCH metadata)
- list
- list your drops; filter with
--metadata k=v - url <slug>
- print the URL for a slug
- delete <slug>
- remove a drop
- login
- cloud sign-in via GitHub device code
- setup
- one-time backend preparation
- patterns
- install reusable drop templates