Agent-first CLI for Peru's tax authority. CPE emission (UBL 2.1 + XAdES + SOAP), SIRE filing, GRE shipping notices, REST OAuth APIs, RHE/F616 — all under one binary.
$ bun add -g @crafter/sunat-cli
# Install globally
$ bun add -g @crafter/sunat-cli
# Introspect schema (agents self-serve)
$ sunat-cli schema cpe-factura --output json
{ "command": "cpe factura emit", "fields": {...} }
# Always dry-run first
$ sunat-cli cpe factura preview --params @factura.json
{ "dryRun": true, "hash": "sha256:...", "validacion": {"ok": true} }
# Ship it — UBL 2.1 + XAdES + SOAP, end-to-end
$ sunat-cli cpe factura emit --params @factura.json --yes
✓ Aceptado · CDR 0000 · F001-1234Capabilities
UBL 2.1 + XAdES-BES + SOAP directo a SUNAT. End-to-end verified against beta.
$ sunat-cli cpe factura emit \
--params '{"serie":"F001",...}' --yesREST API + JWT. Tracker idempotente, retries con backoff.
$ sunat-cli cpe gre emit \
--params @guia.json --yesPropuesta de ventas/compras, ticket polling, descarga ZIP, importar via TUS 1.0.0.
$ sunat-cli sire rvie propuesta \
--periodo 202504 --yesBoletas <S/700 batched, comunicación de baja con ticket polling.
$ sunat-cli cpe resumen send \
--fecha 2026-04-29 --yesBrowser automation sin CAPTCHA. RHE en batch, F616 mensual via CDP raw.
$ sunat-cli rhe emit --batch ./data.csvAgents self-serve field definitions at runtime. 25+ schemas exposed.
$ sunat-cli schema cpe-factura
# Returns JSON schema of all fieldsREST OAuth2 client_credentials. Padrón sync incremental, lookup local sub-ms.
$ sunat-cli api consulta \
--tipo 01 --serie F001 --numero 123Scrape diario, cache local, fallback a fecha hábil previa.
$ sunat-cli tipo-cambio --fecha hoy
# {compra: 3.752, venta: 3.758}Coverage
Per-domain breakdown of how much of each SUNAT surface is wrapped, validated against the beta endpoint, and exposed as an agent-callable command. Green = shipped & verified. Yellow = partial. Orange/Red = shaped or needs production credentials.
Roadmap
Design philosophy
Following Justin Poehnelt's "Rewrite Your CLI for AI Agents" principles and the agentskills.io specification. The agent is not a trusted operator.