Get Invoice Details
Let:
V := ~/.roxabi-vault/invoices
Goal: Extract structured data from an invoice → store as JSON in V.
Workflow
Phase 1 — Accept Input
- Accept invoice file path or pasted content via
$ARGUMENTS. - Input ∄ → ask user "Provide the path to the invoice file or paste the invoice content."
- Path given → verify file ∃.
Phase 2 — Extract Details
- Read invoice content. PDF → run extraction script:
python3 plugins/get-invoice-details/scripts/extract.py --input "<file_path>"
- Extract fields:
vendor|invoice_number|date(ISO 8601) |due_date(ISO 8601) |currency(3-letter) |subtotal|tax|total|line_items(array of{description, quantity, unit_price, amount}) |payment_terms|status("pending" | "paid" | "overdue")
Phase 3 — Save to Vault
- Create V on first use:
mkdir -p -m 700 ~/.roxabi-vault/invoices
- Save JSON →
V/<invoice_number>.json. vault_healthy()→ index in vault database. ∄ → save JSON only, inform user.
Phase 4 — Display Results
Display extracted details in readable format. Confirm save location. Report vault indexing status (indexed ∨ vault unavailable).
Self-Check
- V created automatically — ¬manual init required
- Extraction script handles text ∧ PDF
- Vault indexing optional — plugin works without vault
$ARGUMENTS