Agent-first CLI for SUNAT tax automation. Built for AI agents as primary consumers.
- RHE emission — Batch emit Recibos por Honorarios via browser automation
- F616 declaration — Monthly 4ta categoria tax declarations
- OAuth2 API — Verify emissions via SUNAT REST API
- Schema introspection — Agents self-serve field definitions at runtime
- Bun v1.2+
- agent-browser v0.22+
- Chrome or Chromium (agent-browser uses it via CDP)
bun add -g @crafter/sunat-cli# Login (no CAPTCHA)
sunat-cli login
# Introspect schema
sunat-cli schema rhe
# Dry-run first
sunat-cli rhe emit --dry-run --json '{"empresa":"Acme Corp.","tipoDoc":"SIN DOCUMENTO","descripcion":"Servicios de desarrollo","monto":5000,"moneda":"PEN","medioPago":"TRANSFERENCIA"}'
# Batch emit
sunat-cli rhe emit --batch ./data/example.csv
# OAuth2 token
sunat-cli api token --output jsonFollows Agent DX principles and agentskills.io specification.
--jsonpayloads over bespoke flags--dry-runfor all mutations--output jsonby default (NDJSON when piped)- Input hardening against hallucinations
SKILL.mdwith progressive disclosure
3 SUNAT portals reverse-engineered. F616 input mask cracked via raw CDP WebSocket. reCAPTCHA bypassed through OAuth state exploitation. Full findings in RESEARCH.md.
packages/
cli/ @crafter/sunat-cli — the CLI tool
website/ Astro landing page (sunat-cli.crafter.ing)
MIT — Crafter Station, Lima, Peru