@keypro/cli 0.1.0
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/AGENTS.md +85 -0
- package/README.md +55 -0
- package/dist/index.js +1473 -0
- package/package.json +54 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# KeyPro CLI - AI agent guide
|
|
2
|
+
|
|
3
|
+
Magyar: ez a KeyPro.hu B2B licencshop parancssori eszkoze; az alabbi angol
|
|
4
|
+
utmutato AI-agenteknek (Claude Code, Codex) szol.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
1. The user needs a KeyPro account (approved reseller) and an API key.
|
|
9
|
+
Either run `keypro login` (interactive email + password, stores a fresh
|
|
10
|
+
key) or create a key on the website under "API kulcsok" and store it:
|
|
11
|
+
- env var: KEYPRO_API_KEY=kp_live_... (recommended for agents)
|
|
12
|
+
- or config file: ~/.config/keypro/config.json
|
|
13
|
+
2. API base URL: production is the default. For the dev site use
|
|
14
|
+
KEYPRO_API_BASE=https://dev.keypro.hu or `keypro config set api-base ...`.
|
|
15
|
+
3. Verify with: `keypro whoami --json`
|
|
16
|
+
|
|
17
|
+
## Output contract
|
|
18
|
+
|
|
19
|
+
- Every command supports `--json`: machine-readable data on stdout.
|
|
20
|
+
- Errors go to stderr; in --json mode they are JSON with a stable
|
|
21
|
+
`error.code` (snake_case English). Key on `code`, not on the Hungarian
|
|
22
|
+
`message`.
|
|
23
|
+
- Exit codes: 0 success, 1 API/business error, 2 usage error, 3 auth error.
|
|
24
|
+
|
|
25
|
+
## Ordering flow (IMPORTANT)
|
|
26
|
+
|
|
27
|
+
Ordering is a two-step preview + confirm flow to prevent accidental orders:
|
|
28
|
+
|
|
29
|
+
1. `keypro order preview --item SKU=QTY --payment bacs --json`
|
|
30
|
+
Returns priced lines, fees, shipping, totals and a `confirmToken`
|
|
31
|
+
(valid 15 minutes, bound to items + payment method + gross total).
|
|
32
|
+
ALWAYS show the totals to the user before ordering.
|
|
33
|
+
2. `keypro order create --item SKU=QTY --payment bacs --yes --json`
|
|
34
|
+
Without `--yes` the command only prints the preview and exits with
|
|
35
|
+
code 1. With `--yes` it re-runs the preview and submits with the fresh
|
|
36
|
+
confirmToken. If prices changed between preview and create, the server
|
|
37
|
+
rejects with `confirm_token_invalid` and returns the new totals in
|
|
38
|
+
`error.details` - re-run preview and show the user the new total.
|
|
39
|
+
3. Retries: pass `--idempotency-key <any-unique-string>` - the same key
|
|
40
|
+
never creates a second order (the response has `idempotentReplay: true`).
|
|
41
|
+
|
|
42
|
+
Payment methods (`--payment`):
|
|
43
|
+
- `bacs` bank transfer: order goes on-hold, a proforma invoice
|
|
44
|
+
(dijbekero) is issued; keys are delivered after payment arrives.
|
|
45
|
+
- `cheque` 8-day payment terms (+5% fee on net product total).
|
|
46
|
+
- `cod` cash on delivery (physical shipments only, +1.5 EUR fee).
|
|
47
|
+
- `wallet` KEP balance (net total deducted immediately).
|
|
48
|
+
- `card` saved bank card (Stripe, off-session). If the bank requires
|
|
49
|
+
3DS or there is no saved card, the response contains `payment.paymentUrl`
|
|
50
|
+
- give this link to the user to open in a browser (valid ~1 hour).
|
|
51
|
+
Select a specific card with `--card pm_...` (see `keypro cards list`).
|
|
52
|
+
|
|
53
|
+
Physical products need `--shipping gls_hd|gls_parcelshop|combine_free`;
|
|
54
|
+
for gls_parcelshop also `--parcelshop <ID>`
|
|
55
|
+
(search: `keypro parcelshops search <city|zip>`).
|
|
56
|
+
|
|
57
|
+
## Queries
|
|
58
|
+
|
|
59
|
+
- `keypro products search <query>` / `keypro products get <sku|id>`
|
|
60
|
+
- `keypro order list [--status <status>]` / `keypro order get <id>`
|
|
61
|
+
- `keypro keys list [--order <id>]` - delivered license keys
|
|
62
|
+
- `keypro invoices list [--order <id>]` / `keypro invoices get <id>`
|
|
63
|
+
(each invoice has a public `downloadUrl` PDF link)
|
|
64
|
+
- `keypro wallet` / `keypro wallet transactions` - KEP balance + history
|
|
65
|
+
- `keypro profile get` / `keypro profile set billing.city=Budapest ...`
|
|
66
|
+
(sections: contact.*, billing.*, shipping.*)
|
|
67
|
+
- `keypro cards list` - saved cards (add new cards on the website only)
|
|
68
|
+
|
|
69
|
+
## MCP server mode
|
|
70
|
+
|
|
71
|
+
Register the CLI as a native MCP toolset (recommended for Claude Code):
|
|
72
|
+
|
|
73
|
+
claude mcp add keypro -- keypro mcp
|
|
74
|
+
|
|
75
|
+
Auth comes from KEYPRO_API_KEY / config; there is no login tool over MCP.
|
|
76
|
+
The keypro_order_create tool requires the confirmToken from
|
|
77
|
+
keypro_order_preview - same safety flow as the CLI.
|
|
78
|
+
|
|
79
|
+
## Error codes
|
|
80
|
+
|
|
81
|
+
unauthorized, forbidden_scope, rate_limited, validation_failed, not_found,
|
|
82
|
+
unknown_product, coupon_invalid, shipping_required, invalid_parcelshop,
|
|
83
|
+
insufficient_wallet_balance, confirm_required, confirm_token_invalid,
|
|
84
|
+
invalid_card, stripe_unavailable, account_pending, account_inactive,
|
|
85
|
+
invalid_credentials, network_error, internal
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @keypro/cli
|
|
2
|
+
|
|
3
|
+
Parancssori eszkoz a KeyPro.hu B2B szoftverlicenc webshophoz: rendeles
|
|
4
|
+
leadas, rendelesek / szamlak / termékkulcsok lekerdezese, profil es KEP
|
|
5
|
+
egyenleg kezeles. Regisztralt (jovahagyott) viszontelado fiok szukseges.
|
|
6
|
+
|
|
7
|
+
AI-ugynok barat: minden parancs tamogatja a `--json` kimenetet, es a
|
|
8
|
+
`keypro mcp` beepitett MCP stdio szerverkent nativ tool-okat ad a Claude
|
|
9
|
+
Code / Codex tipusu ugynokoknek. Reszletes agent-utmutato: `keypro
|
|
10
|
+
agent-docs` vagy a csomagban levo AGENTS.md.
|
|
11
|
+
|
|
12
|
+
## Telepites
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
npm install -g @keypro/cli
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Gyors kezdes
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
keypro login # email + jelszo, API kulcsot ment
|
|
22
|
+
keypro whoami # ellenorzes
|
|
23
|
+
keypro products search office
|
|
24
|
+
keypro order preview --item OFF2021=2 --payment bacs
|
|
25
|
+
keypro order create --item OFF2021=2 --payment bacs --yes
|
|
26
|
+
keypro order list
|
|
27
|
+
keypro keys list
|
|
28
|
+
keypro invoices list
|
|
29
|
+
keypro wallet transactions
|
|
30
|
+
keypro profile set billing.city=Budapest
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Fizetesi modok: `bacs` (banki atutalas / dijbekero), `cheque` (8 napos
|
|
34
|
+
fizetesi hatarido, +5%), `cod` (utanvet), `wallet` (KEP egyenleg), `card`
|
|
35
|
+
(mentett bankkartya; 3DS vagy hianyzo kartya eseten fizetesi linket kapsz).
|
|
36
|
+
|
|
37
|
+
A rendeles ket lepeses: az elonezet (preview) megmutatja a vegosszegeket es
|
|
38
|
+
megerosito tokent ad; a leadashoz `--yes` kell. Igy egy AI-ugynok sem tud
|
|
39
|
+
eszrevetlenul rendelni.
|
|
40
|
+
|
|
41
|
+
## Konfiguracio
|
|
42
|
+
|
|
43
|
+
- `~/.config/keypro/config.json` (a `keypro login` irja, 0600 joggal)
|
|
44
|
+
- Kornyezeti valtozok: `KEYPRO_API_KEY`, `KEYPRO_API_BASE`
|
|
45
|
+
- Kapcsolok: `--api-key`, `--api-base`
|
|
46
|
+
- Dev kornyezet: `keypro config set api-base https://dev.keypro.hu`
|
|
47
|
+
|
|
48
|
+
## MCP mod (Claude Code)
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
claude mcp add keypro -- keypro mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
A kulcsot a fenti konfiguracios forrasokbol veszi; MCP-n keresztul
|
|
55
|
+
bejelentkezni nem lehet (elobb `keypro login`).
|