@agenzo/token-cli 0.3.0 → 0.3.2
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 +37 -16
- package/dist/index.js +233 -421
- package/dist/index.js.map +1 -1
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
# @agenzo/token-cli
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@agenzo/token-cli) [](../../LICENSE) 
|
|
4
|
+
|
|
3
5
|
> The **payment credential CLI** (runtime plane) for the Agenzo platform. Agents use it to manage payment methods (card details + 3DS verification) and to issue payment tokens (VCN / Network Token / X402) before a transaction.
|
|
4
6
|
|
|
7
|
+
**[Installation](#installation)** · **[Authentication](#authentication)** · **[Commands](#command-matrix)** · **[payment-methods](#payment-methods)** · **[payment-tokens](#payment-tokens)** · **[Errors](#output-and-errors)**
|
|
8
|
+
|
|
5
9
|
Binary: `agenzo-token-cli` | Auth: API Key (`X-Api-Key`)
|
|
6
10
|
|
|
7
11
|
## Installation
|
|
@@ -10,7 +14,7 @@ Binary: `agenzo-token-cli` | Auth: API Key (`X-Api-Key`)
|
|
|
10
14
|
npm install -g @agenzo/token-cli
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
The `agenzo-token-cli` command is available after installation. Requires Node.js ≥
|
|
17
|
+
The `agenzo-token-cli` command is available after installation. Requires Node.js ≥ 22. Upgrade later with `npm install -g @agenzo/token-cli@latest`.
|
|
14
18
|
|
|
15
19
|
## Authentication
|
|
16
20
|
|
|
@@ -30,7 +34,7 @@ agenzo-admin-cli keys create --developer-id <dev_id> --key-name "Prod Key" --sco
|
|
|
30
34
|
token-cli reuses the environment configuration (API host / path) written by admin-cli; it has no environment-management commands of its own. The default target is production `https://agent.everonet.com`. Switch environments via admin-cli:
|
|
31
35
|
|
|
32
36
|
```bash
|
|
33
|
-
agenzo-admin-cli config set-host https://agent-
|
|
37
|
+
agenzo-admin-cli config set-host https://agent-dev.agenzo.com # switch to the test environment
|
|
34
38
|
agenzo-admin-cli config show # show current host / path
|
|
35
39
|
```
|
|
36
40
|
|
|
@@ -38,8 +42,8 @@ agenzo-admin-cli config show # show curren
|
|
|
38
42
|
|
|
39
43
|
| Option | Description |
|
|
40
44
|
|---|---|
|
|
41
|
-
| `--format <json\|table>` | Output format.
|
|
42
|
-
| `--yes` | Skip all confirmation prompts (
|
|
45
|
+
| `--format <json\|table>` | Output format. Defaults to `table`; pass `json` (or set `AGENZO_FORMAT=json`) for machine-readable output |
|
|
46
|
+
| `--yes` | Skip all confirmation prompts (non-interactive automation) |
|
|
43
47
|
| `--verbose` | Print verbose logs to stderr |
|
|
44
48
|
| `--version` | Print the CLI version |
|
|
45
49
|
|
|
@@ -49,7 +53,7 @@ agenzo-admin-cli config show # show curren
|
|
|
49
53
|
|
|
50
54
|
| Noun | Verb | Purpose | Write/Read |
|
|
51
55
|
|---|---|---|---|
|
|
52
|
-
| `payment-methods` | `add` | Add a payment method
|
|
56
|
+
| `payment-methods` | `add` | Add a payment method via `--mode manual` (collect card + 3DS, default) or `--mode dropin` (Drop-in session), then auto-poll verification | W |
|
|
53
57
|
| `payment-methods` | `list` | List payment methods under the current API Key | R |
|
|
54
58
|
| `payment-methods` | `get <pm_id>` | Show details of a single payment method | R |
|
|
55
59
|
| `payment-methods` | `disable <pm_id>` | Disable a payment method (cascades to revoke its issued tokens) | W |
|
|
@@ -60,7 +64,14 @@ agenzo-admin-cli config show # show curren
|
|
|
60
64
|
|
|
61
65
|
## payment-methods
|
|
62
66
|
|
|
63
|
-
### add — add a payment method
|
|
67
|
+
### add — add a payment method
|
|
68
|
+
|
|
69
|
+
Two modes, selected with `--mode`:
|
|
70
|
+
|
|
71
|
+
- **`manual`** (default): the CLI collects card details and polls 3DS verification.
|
|
72
|
+
- **`dropin`**: the CLI mints a Drop-in session and polls until the user finishes adding the payment method in their browser — no card details are entered at the terminal.
|
|
73
|
+
|
|
74
|
+
#### Manual mode (default)
|
|
64
75
|
|
|
65
76
|
```bash
|
|
66
77
|
agenzo-token-cli payment-methods add \
|
|
@@ -75,14 +86,33 @@ agenzo-token-cli payment-methods add \
|
|
|
75
86
|
| Flag | Required | Description |
|
|
76
87
|
|---|---|---|
|
|
77
88
|
| `--api-key` | Yes | Prompted interactively when omitted |
|
|
89
|
+
| `--mode` | No | `manual` (default) or `dropin` |
|
|
78
90
|
| `--type` | No | Payment method type, defaults to `card` |
|
|
79
91
|
| `--email` | Yes | Used to deliver the 3DS email challenge |
|
|
80
92
|
| `--card-number` | Yes | Card number |
|
|
81
93
|
| `--expiry` | Yes | Expiry date in `MMYY` format (note: not `MM/YY`) |
|
|
82
94
|
| `--cvv` | Yes | CVV; piping via stdin is recommended to keep it out of shell history |
|
|
95
|
+
| `--idempotency-key` | Yes (in `--yes`) | Forwarded verbatim as the `Idempotency-Key` header |
|
|
83
96
|
|
|
84
97
|
Returns a `PM ID` with `PENDING` status immediately, then auto-polls 3DS verification (3s interval, 15 min timeout). On success it prints `ACTIVE` status plus card brand, first six and last four. On timeout it suggests continuing with `payment-methods get`.
|
|
85
98
|
|
|
99
|
+
#### Drop-in mode
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
agenzo-token-cli payment-methods add \
|
|
103
|
+
--api-key <api_key> \
|
|
104
|
+
--mode dropin \
|
|
105
|
+
--email user@example.com
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Flag | Required | Description |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| `--api-key` | Yes | Prompted interactively when omitted |
|
|
111
|
+
| `--mode` | Yes | Set to `dropin` |
|
|
112
|
+
| `--email` | Yes | Reference for the Drop-in session |
|
|
113
|
+
|
|
114
|
+
Mints a Drop-in session and prints a `Session ID`. Initialise the add-payment UI in your own front-end with that `Session ID` (the user enters card details and completes verification in the browser). The CLI then polls the same verification endpoint (5s interval, 30 min timeout) and prints `ACTIVE` with brand / first six / last four on success. If the payment method is not added it reports `FAILED` / `EXPIRED` (or a 30-minute timeout) with the `PM ID` and exits non-zero — re-run with the same email to resume. Card flags (`--card-number` / `--expiry` / `--cvv`) and `--idempotency-key` are not used in this mode.
|
|
115
|
+
|
|
86
116
|
### list
|
|
87
117
|
|
|
88
118
|
```bash
|
|
@@ -170,7 +200,7 @@ Revokes immediately and prints `REVOKED` plus the revocation time; X402 tokens u
|
|
|
170
200
|
|
|
171
201
|
## Output and errors
|
|
172
202
|
|
|
173
|
-
- **Success**: `table` mode prints
|
|
203
|
+
- **Success**: `table` mode prints formatted text; `json` mode emits the structured payload to stdout.
|
|
174
204
|
- **Failure**: an error envelope is written to stderr. In `json` mode it is `{ "error": { "code", "code_num", "message", "request_id?" } }`; in `table` mode it is `✗ [<code_num>] <message>`.
|
|
175
205
|
- **Exit codes**: `0` on success, `1`–`5` for different error categories (e.g. user cancellation = `5`).
|
|
176
206
|
|
|
@@ -178,13 +208,4 @@ Common error codes: `KEY_INVALID` (invalid API Key), `KEY_SCOPE_DENIED` (scope l
|
|
|
178
208
|
|
|
179
209
|
## Related
|
|
180
210
|
|
|
181
|
-
- Full field-level specification: internal design doc `architecture-upgrade/v1/cli-design.md` §3.
|
|
182
211
|
- Control plane (login / organizations / developers / API Key management): [`@agenzo/admin-cli`](https://www.npmjs.com/package/@agenzo/admin-cli).
|
|
183
|
-
|
|
184
|
-
## Development
|
|
185
|
-
|
|
186
|
-
```bash
|
|
187
|
-
npm install # install dependencies from the monorepo root
|
|
188
|
-
npm run build # build (tsup, output at dist/index.js)
|
|
189
|
-
npm test # run tests (vitest)
|
|
190
|
-
```
|