@itpay/cli 0.1.0 → 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 +41 -246
- package/bin/itp +56 -57
- package/docs/agent/buyer/cart-checkout.json +1 -1
- package/docs/agent/buyer/human-claim-ui.json +2 -1
- package/docs/agent/buyer/vault-agent-read.json +5 -3
- package/package.json +1 -4
- package/skills/itpay-buyer/SKILL.md +8 -2
- package/e2e-local.sh +0 -134
- package/skills/voltagent/SKILL.md +0 -603
- package/smoke.sh +0 -426
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ It does not contain the closed-source SaaS backend, database files, payment keys
|
|
|
15
15
|
|
|
16
16
|
## What This CLI Does
|
|
17
17
|
|
|
18
|
-
`itp` lets a developer or coding agent discover ItPay services, create cart-first checkouts, show QR payments, wait for verified payment, report secure human delivery status,
|
|
18
|
+
`itp` lets a developer or coding agent discover ItPay services, create cart-first checkouts, show QR payments, wait for verified payment, report secure human delivery status, create one-time human account portal links, and read human-approved Vault grants without exposing raw keys or protected content to the agent.
|
|
19
19
|
|
|
20
20
|
Main flow:
|
|
21
21
|
|
|
@@ -31,7 +31,7 @@ claude-code
|
|
|
31
31
|
openclaw
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
Default
|
|
34
|
+
Default API endpoint:
|
|
35
35
|
|
|
36
36
|
```text
|
|
37
37
|
http://localhost:3000
|
|
@@ -42,7 +42,6 @@ Override it for ItPay staging or production:
|
|
|
42
42
|
```bash
|
|
43
43
|
export ITPAY_API_BASE=https://your-itpay-core.example.com
|
|
44
44
|
export ITPAY_CORE_BASE_URL=https://your-itpay-core.example.com
|
|
45
|
-
export VOLTAGENT_API_BASE=https://your-api.example.com
|
|
46
45
|
```
|
|
47
46
|
|
|
48
47
|
## Repository Layout
|
|
@@ -51,7 +50,6 @@ export VOLTAGENT_API_BASE=https://your-api.example.com
|
|
|
51
50
|
.
|
|
52
51
|
├── bin/itp # Node.js CLI entrypoint
|
|
53
52
|
├── skills/itpay-buyer/SKILL.md # Buyer agent quick-start skill
|
|
54
|
-
├── skills/voltagent/SKILL.md # Legacy VoltaGent compatibility skill
|
|
55
53
|
├── docs/agent/buyer/*.json # Agent-readable docs graph
|
|
56
54
|
├── install.sh # Unix user-level installer
|
|
57
55
|
├── install.ps1 # Windows PowerShell installer
|
|
@@ -85,7 +83,7 @@ Non-interactive agent hosts such as Codex automatically use file storage to
|
|
|
85
83
|
avoid OS keychain prompts. To force file storage anywhere:
|
|
86
84
|
|
|
87
85
|
```bash
|
|
88
|
-
ITP_CREDENTIAL_STORE=file itp
|
|
86
|
+
ITP_CREDENTIAL_STORE=file itp buyer auth status --json
|
|
89
87
|
```
|
|
90
88
|
|
|
91
89
|
If native credential storage is unavailable, the CLI falls back to:
|
|
@@ -108,10 +106,8 @@ The agent should give the returned `login_url` to the human and must not open or
|
|
|
108
106
|
|
|
109
107
|
## Install From npm
|
|
110
108
|
|
|
111
|
-
After publishing:
|
|
112
|
-
|
|
113
109
|
```bash
|
|
114
|
-
npm install -g
|
|
110
|
+
npm install -g @itpay/cli
|
|
115
111
|
```
|
|
116
112
|
|
|
117
113
|
Verify all command aliases:
|
|
@@ -125,7 +121,7 @@ itpay_cli --version
|
|
|
125
121
|
Run without installing globally:
|
|
126
122
|
|
|
127
123
|
```bash
|
|
128
|
-
npx
|
|
124
|
+
npx @itpay/cli --version
|
|
129
125
|
```
|
|
130
126
|
|
|
131
127
|
## Agent First Step
|
|
@@ -191,193 +187,56 @@ node ./bin/itp --version
|
|
|
191
187
|
Set API endpoint if not using local backend:
|
|
192
188
|
|
|
193
189
|
```bash
|
|
194
|
-
export
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
For the agent-native one-command flow, let the CLI authenticate, create the
|
|
198
|
-
checkout, wait for verified payment, and deliver the grant/API credential to
|
|
199
|
-
the local `itp` credential store:
|
|
200
|
-
|
|
201
|
-
```bash
|
|
202
|
-
itp setup --credits 100 --method alipay --json
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
This returns `status=grant_ready` with `base_url`, `openai_base_url`, and the
|
|
206
|
-
local token helper command. It does not write Codex, Claude Code, or OpenClaw
|
|
207
|
-
config by default.
|
|
208
|
-
|
|
209
|
-
Runtime config writing is opt-in:
|
|
210
|
-
|
|
211
|
-
```bash
|
|
212
|
-
itp setup --credits 100 --target codex --method alipay --install-runtime --json
|
|
190
|
+
export ITPAY_API_BASE=https://your-itpay-core.example.com
|
|
213
191
|
```
|
|
214
192
|
|
|
215
|
-
|
|
216
|
-
the
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
QR display is automatic in terminals and machine-readable for chat agents:
|
|
193
|
+
For the current buyer commerce flow, search the catalog, create a cart/checkout,
|
|
194
|
+
show the human QR/payment entry, wait for verified payment, and report only
|
|
195
|
+
redacted secure delivery status:
|
|
220
196
|
|
|
221
197
|
```bash
|
|
222
|
-
itp
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
198
|
+
itp buyer catalog search --query 企业工商 --json
|
|
199
|
+
itp buyer cart create --variant var_itpay_enterprise_fuzzy_search_cny01 --input company_name=阿里 --json
|
|
200
|
+
itp buyer checkout create --cart <cart_id> --email buyer@example.com --json
|
|
201
|
+
itp buyer payment wait <payment_intent_id> --json
|
|
202
|
+
itp buyer checkout status <checkout_id> --json
|
|
226
203
|
```
|
|
227
204
|
|
|
228
|
-
|
|
205
|
+
For the one-command buyer helper:
|
|
229
206
|
|
|
230
207
|
```bash
|
|
231
|
-
itp
|
|
232
|
-
itp resume --json
|
|
208
|
+
itp buy var_itpay_enterprise_fuzzy_search_cny01 --email buyer@example.com --input company_name=阿里 --json
|
|
233
209
|
```
|
|
234
210
|
|
|
235
|
-
|
|
236
|
-
`--method alipay`. Fake/mock/offline flows are developer-only simulation hooks
|
|
237
|
-
and are intentionally omitted from the normal user flow.
|
|
238
|
-
|
|
239
|
-
For the ItPay sandbox buyer flow, agents should use the public buyer commands:
|
|
211
|
+
For multi-item cart tests:
|
|
240
212
|
|
|
241
213
|
```bash
|
|
242
|
-
itp buyer catalog search --query "吃鸡 情侣皮肤" --json
|
|
243
|
-
itp buyer cart create --variant var_pubg_couple_skin_cny20 --json
|
|
244
214
|
itp buyer cart create --variants var_itpay_enterprise_precise_lookup_cny05,var_itpay_enterprise_fuzzy_search_cny01 --quantities 1,1 --json
|
|
245
215
|
itp buyer cart show <cart_id> --json
|
|
246
216
|
itp buyer cart add <cart_id> --variant var_itpay_enterprise_fuzzy_search_cny01 --quantity 1 --json
|
|
247
217
|
itp buyer cart remove <cart_id> --line <cart_line_item_id> --json
|
|
248
|
-
itp buyer checkout create --cart <cart_id> --email buyer@example.com --phone +8613800000000 --json
|
|
249
|
-
itp buy var_pubg_couple_skin_cny20 --sandbox --email buyer@example.com --phone +8613800000000 --no-wait --json
|
|
250
|
-
itp buyer payment wait <payment_intent_id> --json
|
|
251
|
-
itp buyer checkout status <checkout_id> --json
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
Alipay sandbox responses expose a stable `payment_entry_url` for browser/status
|
|
255
|
-
fallback and a tokenized `qr_image_url` for the human scanner. Render or download
|
|
256
|
-
`qr_image_url`; do not turn `payment_entry_url` into a QR code. If the Alipay
|
|
257
|
-
sandbox app reports "order not found", ask the API for a fresh display QR:
|
|
258
|
-
|
|
259
|
-
```bash
|
|
260
|
-
itp buyer payment refresh-qr <payment_intent_id> --reason order-not-found --json
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
`wait.timeout` from `/events/wait` is one long-poll cycle timing out, not a
|
|
264
|
-
payment failure. The CLI heartbeat reports this as `still_waiting` and continues
|
|
265
|
-
until the overall command timeout or a verified payment event. Ops-only sandbox
|
|
266
|
-
commands such as `itp ops sandbox worker run-once --json` require the sandbox ops
|
|
267
|
-
token and are not part of normal buyer/agent authority.
|
|
268
|
-
|
|
269
|
-
Live checkpoint on 2026-06-08: `itp buy ... --no-wait --json` created an Alipay
|
|
270
|
-
sandbox payment intent, the human scanned the `qr_image_url` SVG directly with
|
|
271
|
-
the Alipay sandbox app, public notify reached `/v1/alipay/sandbox/notify`, and
|
|
272
|
-
`itp buyer payment wait` returned `payment_intent.verified` without query
|
|
273
|
-
recovery.
|
|
274
|
-
|
|
275
|
-
Manual flow starts with Alipay-bound agent authentication:
|
|
276
|
-
|
|
277
|
-
```bash
|
|
278
|
-
itp auth register --runtime codex --json
|
|
279
218
|
```
|
|
280
219
|
|
|
281
|
-
|
|
282
|
-
scan approval, stores the returned session, and then returns the saved account
|
|
283
|
-
metadata as JSON.
|
|
284
|
-
|
|
285
|
-
The response includes the actual saved `username`. Keep it if you plan to log in
|
|
286
|
-
later with a password.
|
|
287
|
-
|
|
288
|
-
Set the first Web login password:
|
|
289
|
-
|
|
290
|
-
```bash
|
|
291
|
-
printf 'your-password\n' | itp account set-password --password-stdin --json
|
|
292
|
-
```
|
|
220
|
+
Payment QR rules:
|
|
293
221
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
List available plans:
|
|
302
|
-
|
|
303
|
-
```bash
|
|
304
|
-
itp plans --json
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
Create a checkout:
|
|
308
|
-
|
|
309
|
-
```bash
|
|
310
|
-
itp checkout create --credits 100 --method alipay --json
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
Wait for verified payment and grant delivery:
|
|
314
|
-
|
|
315
|
-
```bash
|
|
316
|
-
itp payment wait <checkout_id> --timeout 120 --json
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
Install the grant credential:
|
|
320
|
-
|
|
321
|
-
```bash
|
|
322
|
-
itp grants install <grant_id> --target codex --json
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
Optionally install runtime config:
|
|
326
|
-
|
|
327
|
-
```bash
|
|
328
|
-
itp install codex --grant <grant_id> --json
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
For local no-network config writing:
|
|
332
|
-
|
|
333
|
-
```bash
|
|
334
|
-
itp install codex --grant <grant_id> --offline --no-test --json
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
Check balance, usage, and orders:
|
|
338
|
-
|
|
339
|
-
```bash
|
|
340
|
-
itp balance --json
|
|
341
|
-
itp usage --grant <grant_id> --json
|
|
342
|
-
itp checkout list --limit 20 --json
|
|
343
|
-
```
|
|
344
|
-
|
|
345
|
-
Rotate or revoke a grant:
|
|
346
|
-
|
|
347
|
-
```bash
|
|
348
|
-
itp keys rotate --grant <grant_id> --json
|
|
349
|
-
itp grants revoke <grant_id> --json
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
## Runtime Notes
|
|
353
|
-
|
|
354
|
-
### Codex
|
|
355
|
-
|
|
356
|
-
The CLI writes:
|
|
357
|
-
|
|
358
|
-
```text
|
|
359
|
-
~/.codex/config.toml
|
|
360
|
-
~/.itp/voltagent.env
|
|
361
|
-
```
|
|
222
|
+
- Show `local_qr_path` first when the CLI provides it.
|
|
223
|
+
- Otherwise render the ItPay-hosted `qr_png_url` / `preferred_qr_url`.
|
|
224
|
+
- Use `mobile_wallet_url` only as a human mobile fallback.
|
|
225
|
+
- Do not generate your own QR from payment URLs.
|
|
226
|
+
- Treat only `payment_intent.verified` as payment success.
|
|
362
227
|
|
|
363
|
-
|
|
228
|
+
If the human wants the agent to analyze delivered content, the human must reveal
|
|
229
|
+
the artifact in the ItPay account portal with Passkey and choose "Give to
|
|
230
|
+
Agent". The agent then discovers the approved grant itself:
|
|
364
231
|
|
|
365
232
|
```bash
|
|
366
|
-
|
|
233
|
+
itp buyer vault grants list --checkout <checkout_id> --json
|
|
234
|
+
itp buyer vault grants read <agent_read_grant_id> --json
|
|
235
|
+
itp buyer vault read --order <order_id> --artifact <vault_artifact_id> --json
|
|
367
236
|
```
|
|
368
237
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
The CLI writes the configured Anthropic-compatible base URL and credential through the target profile.
|
|
372
|
-
|
|
373
|
-
### OpenClaw
|
|
374
|
-
|
|
375
|
-
The CLI supports `openclaw` as an install target. Use:
|
|
376
|
-
|
|
377
|
-
```bash
|
|
378
|
-
itp grants install <grant_id> --target openclaw --json
|
|
379
|
-
itp install openclaw --grant <grant_id> --json
|
|
380
|
-
```
|
|
238
|
+
Agents must not ask humans to paste claim links, claim tokens, raw API results,
|
|
239
|
+
provider keys, or grant ids into chat.
|
|
381
240
|
|
|
382
241
|
## Agent Skill And Docs
|
|
383
242
|
|
|
@@ -395,15 +254,10 @@ Repository files:
|
|
|
395
254
|
|
|
396
255
|
```text
|
|
397
256
|
skills/itpay-buyer/SKILL.md
|
|
398
|
-
skills/voltagent/SKILL.md
|
|
399
257
|
docs/agent/buyer/*.json
|
|
400
258
|
```
|
|
401
259
|
|
|
402
|
-
Agents should use the buyer skill when the user asks to search, buy, pay, or receive an ItPay service.
|
|
403
|
-
|
|
404
|
-
```bash
|
|
405
|
-
itp skill show --role voltagent --json
|
|
406
|
-
```
|
|
260
|
+
Agents should use the buyer skill when the user asks to search, buy, pay, or receive an ItPay service.
|
|
407
261
|
|
|
408
262
|
The skill rules are strict:
|
|
409
263
|
|
|
@@ -416,10 +270,10 @@ The skill rules are strict:
|
|
|
416
270
|
|
|
417
271
|
## Local Backend E2E
|
|
418
272
|
|
|
419
|
-
When a local
|
|
273
|
+
When a local ItPay backend is running on `http://localhost:3000`:
|
|
420
274
|
|
|
421
275
|
```bash
|
|
422
|
-
|
|
276
|
+
ITPAY_API_BASE=http://localhost:3000 ./e2e-local.sh
|
|
423
277
|
```
|
|
424
278
|
|
|
425
279
|
The E2E script uses a temporary HOME, so it does not touch your real:
|
|
@@ -429,24 +283,7 @@ The E2E script uses a temporary HOME, so it does not touch your real:
|
|
|
429
283
|
~/.codex
|
|
430
284
|
```
|
|
431
285
|
|
|
432
|
-
The script covers
|
|
433
|
-
|
|
434
|
-
```text
|
|
435
|
-
server health
|
|
436
|
-
plans
|
|
437
|
-
auth register
|
|
438
|
-
account password setup
|
|
439
|
-
Alipay checkout
|
|
440
|
-
payment wait
|
|
441
|
-
grant install
|
|
442
|
-
codex offline install
|
|
443
|
-
balance
|
|
444
|
-
checkout list
|
|
445
|
-
usage
|
|
446
|
-
key rotation
|
|
447
|
-
token issue
|
|
448
|
-
grant revoke
|
|
449
|
-
```
|
|
286
|
+
The script covers the current buyer CLI smoke path and local backend contracts.
|
|
450
287
|
|
|
451
288
|
## Development Checks
|
|
452
289
|
|
|
@@ -467,7 +304,8 @@ e2e-local.sh
|
|
|
467
304
|
install.ps1
|
|
468
305
|
install.sh
|
|
469
306
|
package.json
|
|
470
|
-
skills/
|
|
307
|
+
skills/itpay-buyer/SKILL.md
|
|
308
|
+
docs/agent/buyer/*.json
|
|
471
309
|
smoke.sh
|
|
472
310
|
```
|
|
473
311
|
|
|
@@ -488,19 +326,13 @@ npm login
|
|
|
488
326
|
Check package name:
|
|
489
327
|
|
|
490
328
|
```bash
|
|
491
|
-
npm view
|
|
329
|
+
npm view @itpay/cli name
|
|
492
330
|
```
|
|
493
331
|
|
|
494
332
|
If the package is not published yet, npm returns a not-found error.
|
|
495
333
|
|
|
496
334
|
Publish:
|
|
497
335
|
|
|
498
|
-
```bash
|
|
499
|
-
npm publish
|
|
500
|
-
```
|
|
501
|
-
|
|
502
|
-
For a scoped package:
|
|
503
|
-
|
|
504
336
|
```bash
|
|
505
337
|
npm publish --access public
|
|
506
338
|
```
|
|
@@ -509,7 +341,7 @@ Post-publish install test:
|
|
|
509
341
|
|
|
510
342
|
```bash
|
|
511
343
|
TMP_PREFIX=$(mktemp -d)
|
|
512
|
-
npm install -g --prefix "$TMP_PREFIX"
|
|
344
|
+
npm install -g --prefix "$TMP_PREFIX" @itpay/cli
|
|
513
345
|
"$TMP_PREFIX/bin/itp" --version
|
|
514
346
|
"$TMP_PREFIX/bin/itp" skill show --role buyer --json
|
|
515
347
|
"$TMP_PREFIX/bin/itp" docs show quickstart --role buyer --json
|
|
@@ -517,41 +349,6 @@ npm install -g --prefix "$TMP_PREFIX" itpay_cli
|
|
|
517
349
|
"$TMP_PREFIX/bin/itpay_cli" --version
|
|
518
350
|
```
|
|
519
351
|
|
|
520
|
-
## Backend Contract
|
|
521
|
-
|
|
522
|
-
The CLI expects a VoltaGent-compatible backend that exposes:
|
|
523
|
-
|
|
524
|
-
```text
|
|
525
|
-
GET /api/status
|
|
526
|
-
GET /api/itp/plans
|
|
527
|
-
POST /api/itp/auth/register
|
|
528
|
-
POST /api/itp/auth/login
|
|
529
|
-
POST /api/itp/auth/device/start
|
|
530
|
-
POST /api/itp/auth/device/:auth_id/poll
|
|
531
|
-
GET /api/itp/auth/status
|
|
532
|
-
GET /api/itp/account
|
|
533
|
-
POST /api/itp/account/password
|
|
534
|
-
POST /api/itp/checkout
|
|
535
|
-
GET /api/itp/checkout/:id
|
|
536
|
-
POST /api/itp/payments/alipay/notify
|
|
537
|
-
GET /api/itp/orders
|
|
538
|
-
GET /api/itp/balance
|
|
539
|
-
GET /api/itp/usage
|
|
540
|
-
GET /api/itp/grants
|
|
541
|
-
POST /api/itp/grants/:id/install
|
|
542
|
-
POST /api/itp/grants/:id/install-ack
|
|
543
|
-
POST /api/itp/grants/:id/rotate
|
|
544
|
-
POST /api/itp/grants/:id/revoke
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
Relay base URLs returned by the backend:
|
|
548
|
-
|
|
549
|
-
```text
|
|
550
|
-
/openai/v1
|
|
551
|
-
/anthropic/v1
|
|
552
|
-
/gemini/v1beta
|
|
553
|
-
```
|
|
554
|
-
|
|
555
352
|
## Safety and Secrets
|
|
556
353
|
|
|
557
354
|
Never commit:
|
|
@@ -562,7 +359,7 @@ Never commit:
|
|
|
562
359
|
~/.itp
|
|
563
360
|
~/.codex
|
|
564
361
|
credentials.json
|
|
565
|
-
|
|
362
|
+
itpay.env
|
|
566
363
|
*.pem
|
|
567
364
|
*.key
|
|
568
365
|
*.p12
|
|
@@ -588,7 +385,7 @@ Typical update flow:
|
|
|
588
385
|
```bash
|
|
589
386
|
git pull
|
|
590
387
|
npm run check
|
|
591
|
-
# edit bin/itp, skills/itpay-buyer/SKILL.md, docs/agent/buyer/*.json
|
|
388
|
+
# edit bin/itp, skills/itpay-buyer/SKILL.md, or docs/agent/buyer/*.json
|
|
592
389
|
npm run check
|
|
593
390
|
npm pack --dry-run
|
|
594
391
|
git status --short
|
|
@@ -603,7 +400,6 @@ For behavior changes, update both:
|
|
|
603
400
|
bin/itp
|
|
604
401
|
docs/agent/buyer/*.json
|
|
605
402
|
skills/itpay-buyer/SKILL.md
|
|
606
|
-
skills/voltagent/SKILL.md
|
|
607
403
|
```
|
|
608
404
|
|
|
609
405
|
If the backend contract changes, update:
|
|
@@ -613,5 +409,4 @@ README.md
|
|
|
613
409
|
e2e-local.sh
|
|
614
410
|
docs/agent/buyer/*.json
|
|
615
411
|
skills/itpay-buyer/SKILL.md
|
|
616
|
-
skills/voltagent/SKILL.md
|
|
617
412
|
```
|