@getpeppr/cli 0.2.2 → 0.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @getpeppr/cli
2
2
 
3
- Developer toolkit for Peppol e-invoicing. Scaffold invoices, validate against Peppol BIS 3.0, convert to UBL XML, and look up participants in the Peppol Directory — all from the command line.
3
+ Developer toolkit for Peppol e-invoicing. Scaffold invoices, validate against Peppol BIS 3.0, convert to UBL XML, look up participants in the Peppol Directory, and send invoices to the Peppol network — all from the command line.
4
4
 
5
5
  ## Installation
6
6
 
@@ -101,6 +101,70 @@ getpeppr lookup 0208:BE0685660237 --json
101
101
  | `--json` | Output results as JSON |
102
102
  | `--limit <n>` | Max results for search (default: 10) |
103
103
 
104
+ ### `getpeppr login` — Save your API key
105
+
106
+ Store a getpeppr API key in `~/.config/getpeppr/credentials.json` (mode `0600`). Sandbox and live keys can coexist.
107
+
108
+ ```bash
109
+ # Interactive (recommended) — prompts for the key with masked input
110
+ getpeppr login
111
+
112
+ # Explicit env (required in CI / non-TTY)
113
+ getpeppr login --key sk_sandbox_... --sandbox
114
+ getpeppr login --key sk_live_... --live
115
+ ```
116
+
117
+ | Flag | Description |
118
+ |------|-------------|
119
+ | `--key <key>` | API key. CI use only — visible in `ps`/shell history. Prefer the prompt or `GETPEPPR_API_KEY`. |
120
+ | `--sandbox` | Store as sandbox key (default) |
121
+ | `--live` | Store as live (production) key |
122
+
123
+ API key resolution order: `--key` flag → `GETPEPPR_API_KEY` env var → stored credentials.
124
+
125
+ ### `getpeppr send` — Send an invoice to Peppol
126
+
127
+ Send an invoice through the getpeppr API to the Peppol network. Targets sandbox by default; pass `--prod` for production.
128
+
129
+ ```bash
130
+ # Send a JSON file
131
+ getpeppr send invoice.json
132
+
133
+ # Quick test — synthesize an invoice from flags (no file needed)
134
+ getpeppr send --to 0208:BE0314595348 --amount 100 --desc "Test invoice"
135
+
136
+ # Watch delivery status until terminal (60s timeout)
137
+ getpeppr send invoice.json --watch
138
+
139
+ # Production send — requires confirmation (skip with -y)
140
+ getpeppr send invoice.json --prod
141
+ ```
142
+
143
+ | Flag | Description |
144
+ |------|-------------|
145
+ | `[file]` | Path to invoice JSON (mutex with `--to`/`--amount`/...) |
146
+ | `--prod` | Target production (uses live key + confirmation prompt) |
147
+ | `--local` | Target `http://localhost:3001` (dev server) |
148
+ | `--key <key>` | Override stored API key |
149
+ | `--to <peppol-id>` | Recipient Peppol ID (when no file) |
150
+ | `--amount <number>` | Line amount in major currency units |
151
+ | `--currency <iso>` | ISO 4217 code (default `EUR`) |
152
+ | `--desc <text>` | Line description |
153
+ | `--attachment` | Attach the bundled test PDF |
154
+ | `--watch` | Poll status until terminal (60s timeout) |
155
+ | `-y, --yes` | Skip the `--prod` confirmation prompt |
156
+ | `--no-validate` | Skip local pre-validation |
157
+ | `--json` | Machine-readable JSON output |
158
+ | `--quiet` | Exit code only, no output |
159
+
160
+ ### `getpeppr logout` — Remove stored credentials
161
+
162
+ ```bash
163
+ getpeppr logout
164
+ ```
165
+
166
+ Removes `~/.config/getpeppr/credentials.json`. No-op if the file doesn't exist.
167
+
104
168
  ## Exit codes
105
169
 
106
170
  | Code | Meaning |
@@ -117,6 +181,9 @@ getpeppr validate invoice.json --quiet || exit 1
117
181
 
118
182
  # Validate + convert in one step
119
183
  getpeppr convert invoice.json --validate -o output.xml
184
+
185
+ # Send via API key in env (no login state needed)
186
+ GETPEPPR_API_KEY=$SANDBOX_KEY getpeppr send invoice.json --json
120
187
  ```
121
188
 
122
189
  ## What it validates
@@ -127,7 +194,7 @@ The CLI runs three validation engines from the [@getpeppr/sdk](https://www.npmjs
127
194
  2. **Business Rules** — Peppol BIS 3.0 / EN 16931 compliance (BR-xx, BR-CO-xx, PEPPOL-xx rules)
128
195
  3. **Country Rules** — Belgium (BE), France (FR), Italy (IT), Netherlands (NL), Germany (DE)
129
196
 
130
- Validation runs offline — no API key or network connection required. Only `lookup` needs an internet connection.
197
+ Scaffolding (`init`), validation, and conversion run fully offline — no API key or network connection required. Only `lookup` and `send` need a network connection.
131
198
 
132
199
  ## Invoice format
133
200
 
@@ -180,7 +247,14 @@ This is the exact template generated by `getpeppr init`. See the [full type refe
180
247
 
181
248
  ## Ready to send?
182
249
 
183
- Once your invoice validates, send it to the Peppol network with the getpeppr SDK:
250
+ Once your invoice validates, send it to the Peppol network straight from the CLI:
251
+
252
+ ```bash
253
+ getpeppr login # store your sandbox key once
254
+ getpeppr send invoice.json --watch # send + poll delivery status
255
+ ```
256
+
257
+ Or, for programmatic use inside an app, install the SDK:
184
258
 
185
259
  ```bash
186
260
  npm install @getpeppr/sdk