@getpeppr/cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +146 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# @getpeppr/cli
|
|
2
|
+
|
|
3
|
+
The first Peppol e-invoice validator on npm. Validate invoices offline against Peppol BIS 3.0 business rules, structure checks, and country-specific requirements.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Run directly (no install)
|
|
9
|
+
npx @getpeppr/cli validate invoice.json
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
12
|
+
npm install -g @getpeppr/cli
|
|
13
|
+
getpeppr validate invoice.json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Validate an invoice
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
getpeppr validate invoice.json
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Output:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Validating: invoice.json
|
|
28
|
+
|
|
29
|
+
── Structure ──────────────────────────────
|
|
30
|
+
✓ No errors
|
|
31
|
+
|
|
32
|
+
── Business Rules (Peppol BIS 3.0) ───────
|
|
33
|
+
✓ All rules passed
|
|
34
|
+
|
|
35
|
+
── Country Rules ────────────────────────────
|
|
36
|
+
⚠ No structured communication reference (BE-02)
|
|
37
|
+
|
|
38
|
+
── Summary ──────────────────────────────────
|
|
39
|
+
✓ Invoice is valid (1 warning)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Flags
|
|
43
|
+
|
|
44
|
+
| Flag | Description |
|
|
45
|
+
|------|-------------|
|
|
46
|
+
| `--json` | Machine-readable JSON output |
|
|
47
|
+
| `--quiet` | Exit code only, no output |
|
|
48
|
+
| `--version` | Show version number |
|
|
49
|
+
| `--help` | Show help |
|
|
50
|
+
|
|
51
|
+
### Exit codes
|
|
52
|
+
|
|
53
|
+
| Code | Meaning |
|
|
54
|
+
|------|---------|
|
|
55
|
+
| `0` | Invoice is valid (may have warnings) |
|
|
56
|
+
| `1` | Invoice has errors — non-compliant |
|
|
57
|
+
| `2` | File not found or invalid JSON |
|
|
58
|
+
|
|
59
|
+
### JSON output
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
getpeppr validate invoice.json --json
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Returns a structured result with errors and warnings grouped by category:
|
|
66
|
+
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"structure": { "errors": [], "warnings": [] },
|
|
70
|
+
"schematron": { "errors": [], "warnings": [] },
|
|
71
|
+
"countryRules": { "errors": [], "warnings": [] },
|
|
72
|
+
"totalErrors": 0,
|
|
73
|
+
"totalWarnings": 1,
|
|
74
|
+
"valid": true
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### CI/CD integration
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Fail pipeline if invoice is invalid
|
|
82
|
+
getpeppr validate invoice.json --quiet || exit 1
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## What it validates
|
|
86
|
+
|
|
87
|
+
The CLI runs three validation engines from the [@getpeppr/sdk](https://www.npmjs.com/package/@getpeppr/sdk):
|
|
88
|
+
|
|
89
|
+
1. **Structure** — Required fields, type checks, format validation
|
|
90
|
+
2. **Business Rules** — Peppol BIS 3.0 / EN 16931 compliance (BR-xx, BR-CO-xx, PEPPOL-xx rules)
|
|
91
|
+
3. **Country Rules** — Belgium (BE), France (FR), Italy (IT), Netherlands (NL), Germany (DE)
|
|
92
|
+
|
|
93
|
+
All validation runs offline — no API key or network connection required.
|
|
94
|
+
|
|
95
|
+
## Invoice format
|
|
96
|
+
|
|
97
|
+
The input file must be a JSON object matching the getpeppr `InvoiceInput` type:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"number": "INV-2026-001",
|
|
102
|
+
"date": "2026-04-07",
|
|
103
|
+
"dueDate": "2026-05-07",
|
|
104
|
+
"currency": "EUR",
|
|
105
|
+
"buyerReference": "PO-12345",
|
|
106
|
+
"to": {
|
|
107
|
+
"name": "Buyer Company",
|
|
108
|
+
"peppolId": "0208:BE0123456789",
|
|
109
|
+
"street": "123 Main St",
|
|
110
|
+
"city": "Brussels",
|
|
111
|
+
"postalCode": "1050",
|
|
112
|
+
"country": "BE"
|
|
113
|
+
},
|
|
114
|
+
"lines": [
|
|
115
|
+
{
|
|
116
|
+
"description": "Consulting services",
|
|
117
|
+
"quantity": 10,
|
|
118
|
+
"unitPrice": 150,
|
|
119
|
+
"vatRate": 21
|
|
120
|
+
}
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
See the [full type reference](https://getpeppr.dev/docs/types/) for all available fields.
|
|
126
|
+
|
|
127
|
+
## Ready to send?
|
|
128
|
+
|
|
129
|
+
Once your invoice validates, send it to the Peppol network with the getpeppr SDK:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
npm install @getpeppr/sdk
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
import { Peppol } from "@getpeppr/sdk";
|
|
137
|
+
|
|
138
|
+
const peppol = new Peppol({ apiKey: "your-api-key" });
|
|
139
|
+
const result = await peppol.invoices.send(invoice);
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Sign up at [getpeppr.dev](https://getpeppr.dev) to get your API key.
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT
|