Agent-first CLI for Peru's election results API. Query mesas, actas, ubigeos, and summaries. Dual JSON/human output. Built for AI agents as primary consumers.
$ bun add -g @crafter/onpe-cli
# Install globally
$ bun add -g @crafter/onpe-cli
# Check API status
$ onpe doctor
[OK] proceso-activo: EG2026
[OK] elecciones: 9 elecciones
[OK] resumen-general: 86664 actas
[OK] buscar-mesa: mesa 000001 accesible
All checks passed
# Look up any mesa
$ onpe mesa 900001 --json
# NDJSON output for agents
# Drill down geography
$ onpe ubigeos 2 150000
150101 LIMA
150102 ANCON
...Commands
Query any mesa by code. Works with regular (000001-088064) and rural centros poblados (900001-904703).
$ onpe mesa 044739
Mesa 044739
Local: IE MIGUEL GRAU SEMINARIO
Habiles: 300 Emitidos: 237
Estado: Contabilizada (C)Full vote breakdown per party with percentages. Includes file IDs for PDF download.
$ onpe acta 12345 --json | jq .detalle
# Returns all party votes, candidates,
# percentages, and acta file referencesDrill down departments, provinces, and districts. 3 levels matching ONPE's geographic hierarchy.
$ onpe ubigeos 1
010000 AMAZONAS
020000 ANCASH
030000 APURIMAC
...Real-time totals: actas counted, participation rate, JEE pipeline status.
$ onpe resumen
Actas contabilizadas: 86664 (93.6%)
Total actas: 92767
Participacion: 79.2%Design philosophy
Built with cligentic blocks for structured agent output. NDJSON to stdout, next-step hints on stderr, typed error codes with recovery suggestions. The agent is the primary consumer.