cfdi-cli
Parse, validate and convert Mexican CFDI 4.0 electronic invoices from your terminal.
A fast, single-binary CLI tool for working with Mexican CFDI 4.0 XML invoices. No internet required, no API keys, no runtime dependencies. Built with Rust for maximum performance.
Installation
Download binary (recommended)
Grab the latest release for your platform from GitHub Releases:
| Platform | Download |
|---|---|
| Windows x86_64 | cfdi-cli-windows-x86_64.zip |
| Linux x86_64 | cfdi-cli-linux-x86_64.tar.gz |
| macOS Apple Silicon | cfdi-cli-macos-aarch64.tar.gz |
| macOS Intel | cfdi-cli-macos-x86_64.tar.gz |
Install from crates.io
Build from source
# Binary at target/release/cfdi-cli
Usage
Quick info
==================================================
)
==================================================
Parse to JSON
{
}
Parse to table
============================================================
)
============================================================
Parse to CSV
Validate
If there are issues:
)
Bulk process a directory
# Exports all XMLs as a single CSV file
# Output as JSON array to stdout
Summary
==================================================
==================================================
Commands
| Command | Description |
|---|---|
info <file> |
Quick metadata: UUID, emisor, receptor, total |
parse <file> -o json|csv|table |
Parse CFDI to structured output |
validate <file> |
Validate structure, RFC, required fields, totals |
bulk <dir> -o <file> -f csv|json|table |
Batch process a directory |
summary <dir> |
Totals by type, IVA, by RFC emisor |
CFDI fields extracted
- Comprobante: UUID, fecha, serie, folio, tipo, moneda, tipo de cambio, metodo/forma de pago
- Emisor: RFC, nombre, regimen fiscal
- Receptor: RFC, nombre, uso CFDI, domicilio fiscal
- Conceptos: clave producto, cantidad, unidad, descripcion, valor unitario, importe
- Impuestos: IVA trasladado, IVA retenido, ISR retenido
- Timbre: UUID, fecha timbrado, sello SAT, certificado SAT
WebAssembly
The parser core compiles to WebAssembly for use in web applications:
Exports: parseCfdi, parseCfdiPretty, validateCfdi, infoCfdi, parseCfdiBulk
import init from './pkg/cfdi_cli.js';
await ;
const json = ;
const result = JSON.;
// { valid: true, errors: [], warnings: [] }
Performance
- Single XML: < 1ms
- 10,000 XMLs: < 5 seconds
- Binary size: ~3 MB
- WASM size: ~210 KB
License
MIT - Built by Orbita POS