@agenzo/token-cli 0.1.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 ADDED
@@ -0,0 +1,190 @@
1
+ # @agenzo/token-cli
2
+
3
+ > 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
+
5
+ Binary: `agenzo-token-cli` | Auth: API Key (`X-Api-Key`)
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g @agenzo/token-cli
11
+ ```
12
+
13
+ The `agenzo-token-cli` command is available after installation. Requires Node.js ≥ 18.
14
+
15
+ ## Authentication
16
+
17
+ token-cli is a **runtime-plane** tool. Every command authenticates with `--api-key <api_key>` (prompted interactively when omitted).
18
+
19
+ API Keys are issued by the control-plane tool [`agenzo-admin-cli`](https://www.npmjs.com/package/@agenzo/admin-cli):
20
+
21
+ ```bash
22
+ agenzo-admin-cli keys create --developer-id <dev_id> --key-name "Prod Key" --scope token
23
+ ```
24
+
25
+ - The key's scope must include `token`, otherwise calls return `KEY_SCOPE_DENIED`.
26
+ - API Keys and admin-cli's Bearer Token are **not interchangeable**.
27
+
28
+ ## Environment configuration
29
+
30
+ 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
+
32
+ ```bash
33
+ agenzo-admin-cli config set-host https://agent-test.everonet.com # switch to test
34
+ agenzo-admin-cli config show # show current host / path
35
+ ```
36
+
37
+ ## Global options
38
+
39
+ | Option | Description |
40
+ |---|---|
41
+ | `--format <json\|table>` | Output format. Default `table` (human-readable); `json` for Agent / script parsing. Can also be set via the `AGENZO_FORMAT` environment variable |
42
+ | `--yes` | Skip all confirmation prompts (for automation / AI Agents) |
43
+ | `--verbose` | Print verbose logs to stderr |
44
+ | `--version` | Print the CLI version |
45
+
46
+ > Prompts and logs for write operations go to stderr; under `--format json`, stdout emits structured data only. Exit code `0` on success, `1`–`5` for different error categories.
47
+
48
+ ## Command matrix
49
+
50
+ | Noun | Verb | Purpose | Write/Read |
51
+ |---|---|---|---|
52
+ | `payment-methods` | `add` | Add a payment method, then auto-poll 3DS verification (up to 15 min) | W |
53
+ | `payment-methods` | `list` | List payment methods under the current API Key | R |
54
+ | `payment-methods` | `get <pm_id>` | Show details of a single payment method | R |
55
+ | `payment-methods` | `disable <pm_id>` | Disable a payment method (cascades to revoke its issued tokens) | W |
56
+ | `payment-tokens` | `create` | Issue a payment token (VCN / Network Token / X402, pick one) | W |
57
+ | `payment-tokens` | `list` | List payment tokens under the current API Key | R |
58
+ | `payment-tokens` | `get <payment_token_id>` | Show details of a single payment token | R |
59
+ | `payment-tokens` | `revoke <payment_token_id>` | Revoke a payment token (X402 uses delayed revocation) | W |
60
+
61
+ ## payment-methods
62
+
63
+ ### add — add a payment method + 3DS verification
64
+
65
+ ```bash
66
+ agenzo-token-cli payment-methods add \
67
+ --api-key <api_key> \
68
+ --type card \
69
+ --email user@example.com \
70
+ --card-number 4111111111111234 \
71
+ --expiry 1230 \
72
+ --cvv 123
73
+ ```
74
+
75
+ | Flag | Required | Description |
76
+ |---|---|---|
77
+ | `--api-key` | Yes | Prompted interactively when omitted |
78
+ | `--type` | No | Payment method type, defaults to `card` |
79
+ | `--email` | Yes | Used to deliver the 3DS email challenge |
80
+ | `--card-number` | Yes | Card number |
81
+ | `--expiry` | Yes | Expiry date in `MMYY` format (note: not `MM/YY`) |
82
+ | `--cvv` | Yes | CVV; piping via stdin is recommended to keep it out of shell history |
83
+
84
+ 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
+
86
+ ### list
87
+
88
+ ```bash
89
+ agenzo-token-cli payment-methods list --api-key <api_key> [--member <member_id>]
90
+ ```
91
+
92
+ Outputs a table of `ID / Type / Brand / First 6 / Last 4 / Status`; prints `No payment methods found` when empty.
93
+
94
+ ### get
95
+
96
+ ```bash
97
+ agenzo-token-cli payment-methods get <pm_id> --api-key <api_key>
98
+ ```
99
+
100
+ ### disable
101
+
102
+ ```bash
103
+ agenzo-token-cli payment-methods disable <pm_id> --api-key <api_key> [--idempotency-key <key>]
104
+ ```
105
+
106
+ Disables the payment method and cascades to revoke its issued payment tokens, printing `Status` and the `Revoked tokens` count. `--idempotency-key` is required in `--yes` mode.
107
+
108
+ ## payment-tokens
109
+
110
+ ### create — issue a payment token
111
+
112
+ The three types branch via `--type`: `vcn` / `network-token` / `x402`.
113
+
114
+ ```bash
115
+ # VCN (Virtual Card Number)
116
+ agenzo-token-cli payment-tokens create \
117
+ --api-key <api_key> --type vcn \
118
+ --payment-method-id <pm_id> \
119
+ --amount 25.00 \
120
+ --idempotency-key <unique_key>
121
+
122
+ # Network Token
123
+ agenzo-token-cli payment-tokens create \
124
+ --api-key <api_key> --type network-token \
125
+ --card 1234 \
126
+ --idempotency-key <unique_key>
127
+
128
+ # X402 (on-chain USDC payment signature)
129
+ agenzo-token-cli payment-tokens create \
130
+ --api-key <api_key> --type x402 \
131
+ --payment-method-id <pm_id> \
132
+ --amount 1.50 --pay-to 0x... --nonce <n> --network base-sepolia --deadline <unix_ts> \
133
+ --idempotency-key <unique_key>
134
+ ```
135
+
136
+ | Flag | Applies to | Description |
137
+ |---|---|---|
138
+ | `--api-key` | all | Prompted interactively when omitted |
139
+ | `--type` | all | `vcn` / `network-token` / `x402` |
140
+ | `--payment-method-id` | vcn / network-token | One of this or `--card`; takes priority over `--card` |
141
+ | `--card` | vcn / network-token | Match a payment method by its last 4 digits |
142
+ | `--member` | all | Associate a member (optional) |
143
+ | `--amount` | vcn / x402 | VCN: USD (`0.01`–`500.00`); X402: USDC amount |
144
+ | `--currency` | vcn | Omitted by default; the server applies its default currency |
145
+ | `--pay-to` / `--nonce` / `--network` / `--deadline` | x402 | Required X402 quadruple; `--deadline` is a Unix timestamp |
146
+ | `--external-tx-id` | all | Forwarded to the request body as `external_tx_id` (optional) |
147
+ | `--idempotency-key` | all | **Required**; forwarded verbatim as the `Idempotency-Key` HTTP header, retrying the same key returns the first result |
148
+
149
+ > Before writing, the freeze amount and service fee are shown and confirmation is requested; `--yes` skips confirmation (in which case `--idempotency-key` must be supplied explicitly).
150
+
151
+ ### list
152
+
153
+ ```bash
154
+ agenzo-token-cli payment-tokens list --api-key <api_key> [--type <type>] [--member <member_id>]
155
+ ```
156
+
157
+ ### get
158
+
159
+ ```bash
160
+ agenzo-token-cli payment-tokens get <payment_token_id> --api-key <api_key>
161
+ ```
162
+
163
+ ### revoke
164
+
165
+ ```bash
166
+ agenzo-token-cli payment-tokens revoke <payment_token_id> --api-key <api_key> [--idempotency-key <key>]
167
+ ```
168
+
169
+ Revokes immediately and prints `REVOKED` plus the revocation time; X402 tokens use delayed revocation (the cryptogram expires naturally), printing `ACTIVE` plus the expiry time. `--idempotency-key` is required in `--yes` mode.
170
+
171
+ ## Output and errors
172
+
173
+ - **Success**: `table` mode prints human-readable text; `json` mode emits the structured payload to stdout.
174
+ - **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
+ - **Exit codes**: `0` on success, `1`–`5` for different error categories (e.g. user cancellation = `5`).
176
+
177
+ Common error codes: `KEY_INVALID` (invalid API Key), `KEY_SCOPE_DENIED` (scope lacks `token`), `TOKEN_FEATURE_DISABLED` (token type not enabled), `PARAM_IDEMPOTENCY_KEY_REQUIRED` (missing `--idempotency-key`), `CLIENT_NO_PAYMENT_METHOD` / `CLIENT_CARD_NOT_MATCHED` (no usable payment method matched locally).
178
+
179
+ ## Related
180
+
181
+ - Full field-level specification: internal design doc `architecture-upgrade/v1/cli-design.md` §3.
182
+ - 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
+ ```
@@ -0,0 +1,2 @@
1
+
2
+ export { }