@keypro/cli 0.1.3 → 0.1.5
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/LICENSE +21 -0
- package/README.md +122 -35
- package/dist/index.js +87 -19
- package/package.json +6 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 InstaSoft Informatikai Zrt. (https://keypro.hu)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,55 +1,142 @@
|
|
|
1
1
|
# @keypro/cli
|
|
2
2
|
|
|
3
|
-
Parancssori
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Parancssori eszköz és MCP-szerver a [KeyPro.hu](https://keypro.hu) B2B
|
|
4
|
+
szoftverlicenc-webshophoz: rendelés leadása, visszamondása, fizetési mód
|
|
5
|
+
módosítása, rendelések / számlák / termékkulcsok lekérdezése, KEP-egyenleg és
|
|
6
|
+
profil kezelése. Regisztrált (jóváhagyott) viszonteladó fiók szükséges.
|
|
6
7
|
|
|
7
|
-
AI
|
|
8
|
-
`keypro mcp`
|
|
9
|
-
|
|
10
|
-
agent-docs` vagy a csomagban levo AGENTS.md.
|
|
8
|
+
AI-ügynök barát: minden parancs támogatja a `--json` kimenetet, és a
|
|
9
|
+
`keypro mcp` beépített MCP stdio szerverként natív tool-okat ad a Claude Code /
|
|
10
|
+
Claude Desktop / Codex típusú ügynököknek.
|
|
11
11
|
|
|
12
|
-
##
|
|
12
|
+
## Biztonság és átláthatóság
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
- **Nyílt forrás.** Ez a repó a teljes forráskód — ellenőrizhető, hogy a
|
|
15
|
+
csomag semmi rejtettet nem tartalmaz.
|
|
16
|
+
- **Vékony kliens.** Csak a HTTP API-t hívja; nincs benne titok, nincs
|
|
17
|
+
telemetria, nem gyűjt és nem küld semmit rajtad kívül máshova.
|
|
18
|
+
- **Csak az általad megadott szerverhez beszél** (alap: `https://keypro.hu`).
|
|
19
|
+
- **A kulcs a tiéd.** `Authorization: Bearer` fejlécben megy, te hozod létre és
|
|
20
|
+
bármikor visszavonhatod a fiókod `/api-keys` oldalán.
|
|
21
|
+
- **Provenance.** Az npm csomag GitHub Actions-ből, `--provenance` jelöléssel
|
|
22
|
+
publikálódik, így kriptográfiailag igazolható, hogy a közzétett csomag ebből a
|
|
23
|
+
forrásból, ebből a commitból épült.
|
|
24
|
+
|
|
25
|
+
## Telepítés
|
|
26
|
+
|
|
27
|
+
```bash
|
|
15
28
|
npm install -g @keypro/cli
|
|
16
29
|
```
|
|
17
30
|
|
|
18
|
-
|
|
31
|
+
Node.js 20+ szükséges.
|
|
32
|
+
|
|
33
|
+
## Gyors kezdés
|
|
19
34
|
|
|
35
|
+
```bash
|
|
36
|
+
keypro setup
|
|
20
37
|
```
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
keypro
|
|
27
|
-
keypro
|
|
28
|
-
keypro invoices list
|
|
29
|
-
keypro wallet transactions
|
|
30
|
-
keypro profile set billing.city=Budapest
|
|
38
|
+
|
|
39
|
+
A `setup` végigvezet: megkérdezi a szervert, majd a hitelesítést — **API kulcs**
|
|
40
|
+
(ajánlott) vagy **email + jelszó**. Utána:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
keypro whoami
|
|
44
|
+
keypro products search windows --limit 5
|
|
31
45
|
```
|
|
32
46
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
## Hitelesítés
|
|
48
|
+
|
|
49
|
+
Négyféleképp adhatod meg a kulcsot (erősebb elöl):
|
|
36
50
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
51
|
+
```bash
|
|
52
|
+
keypro --api-key kp_live_... whoami # per-parancs kapcsoló
|
|
53
|
+
export KEYPRO_API_KEY=kp_live_... # környezeti változó (agentnek jó)
|
|
54
|
+
keypro config set api-key kp_live_... # elmenti a configba
|
|
55
|
+
keypro login # email + jelszó -> új kulcsot ment
|
|
56
|
+
```
|
|
40
57
|
|
|
41
|
-
|
|
58
|
+
- Kulcsot a weben a fiók **API kulcsok** (`/api-keys`) oldalán készíthetsz,
|
|
59
|
+
scope-okkal (olvasás / rendelés / profil) és lejárattal.
|
|
60
|
+
- A config a `~/.config/keypro/config.json` fájlban van (0600 jog).
|
|
42
61
|
|
|
43
|
-
|
|
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`
|
|
62
|
+
## Szerver (API cím)
|
|
47
63
|
|
|
48
|
-
|
|
64
|
+
Alapértelmezés a production (`https://keypro.hu`). Váltás:
|
|
49
65
|
|
|
66
|
+
```bash
|
|
67
|
+
keypro config set api-base https://dev.keypro.hu
|
|
68
|
+
# vagy: KEYPRO_API_BASE=https://dev.keypro.hu, vagy --api-base
|
|
50
69
|
```
|
|
51
|
-
|
|
70
|
+
|
|
71
|
+
## Parancsok
|
|
72
|
+
|
|
73
|
+
| Parancs | Leírás |
|
|
74
|
+
|---|---|
|
|
75
|
+
| `keypro setup` | interaktív beállítás (szerver + hitelesítés) |
|
|
76
|
+
| `keypro whoami` | a bejelentkezett fiók adatai |
|
|
77
|
+
| `keypro rate` | aktuális EUR/HUF árfolyam (amit a shop használ) |
|
|
78
|
+
| `keypro products search <szó>` / `products get <sku\|id>` | termékkeresés / részletek |
|
|
79
|
+
| `keypro order preview --item <sku>=<db> --payment <mód>` | rendelés előnézete (összegek + confirmToken) |
|
|
80
|
+
| `keypro order create --item ... --payment ... --yes` | rendelés leadása |
|
|
81
|
+
| `keypro order list [--status ...]` / `order get <id>` | rendelések |
|
|
82
|
+
| `keypro order cancel <id>` | fizetetlen rendelés visszamondása |
|
|
83
|
+
| `keypro order change-payment <id> --payment <mód> [--yes]` | fizetési mód módosítása |
|
|
84
|
+
| `keypro keys list [--order <id>]` | kézbesített termékkulcsok |
|
|
85
|
+
| `keypro invoices list [--order <id>]` / `invoices get <id>` | számlák / díjbekérők (PDF link) |
|
|
86
|
+
| `keypro wallet [transactions]` | KEP-egyenleg + tranzakciók |
|
|
87
|
+
| `keypro profile get` / `profile set billing.city=... ` | profil |
|
|
88
|
+
| `keypro cards list` | mentett bankkártyák |
|
|
89
|
+
| `keypro parcelshops search <város\|irsz>` | GLS csomagpontok |
|
|
90
|
+
| `keypro key list` / `config get` / `logout` | kulcsok, config, kijelentkezés |
|
|
91
|
+
| `keypro agent-docs` | részletes AI-ügynök útmutató (stdout) |
|
|
92
|
+
|
|
93
|
+
Fizetési módok: `bacs` (átutalás / díjbekérő), `cheque` (8 napos, +5%),
|
|
94
|
+
`cod` (utánvét), `wallet` (KEP-egyenleg), `stripe` (bankkártya).
|
|
95
|
+
|
|
96
|
+
Rendelés-biztonság: a `create` és a `change-payment` mindig előnézetet kér
|
|
97
|
+
(összegekkel) és csak a preview-ból származó `confirmToken`-nel hajtódik végre,
|
|
98
|
+
így véletlen rendelés nem történhet.
|
|
99
|
+
|
|
100
|
+
## Gépi (JSON) kimenet
|
|
101
|
+
|
|
102
|
+
Minden parancs támogatja a `--json`-t: a stdout-ra gépi adat, a hibák a
|
|
103
|
+
stderr-re mennek stabil `error.code`-dal (snake_case, angol). Példa:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
keypro --json whoami
|
|
52
107
|
```
|
|
53
108
|
|
|
54
|
-
|
|
55
|
-
|
|
109
|
+
## MCP (AI ügynök) bekötés
|
|
110
|
+
|
|
111
|
+
**Claude Desktop** — Settings → Developer → Edit Config:
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"mcpServers": {
|
|
116
|
+
"keypro": { "command": "npx", "args": ["-y", "@keypro/cli", "mcp"] }
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
**Claude Code:**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
claude mcp add keypro -- npx -y @keypro/cli mcp
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Az MCP a beállított kulcsot (`keypro setup` / config / `KEYPRO_API_KEY`)
|
|
128
|
+
használja. A webes claude.ai számára a shop külön **távoli MCP connectort** ad
|
|
129
|
+
(OAuth-tal); azt a fiókod `/api-keys` oldala írja le.
|
|
130
|
+
|
|
131
|
+
## Fejlesztés
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pnpm install
|
|
135
|
+
pnpm build # tsup -> dist/
|
|
136
|
+
pnpm typecheck
|
|
137
|
+
pnpm test # vitest
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Licenc
|
|
141
|
+
|
|
142
|
+
MIT — lásd [LICENSE](./LICENSE).
|
package/dist/index.js
CHANGED
|
@@ -256,13 +256,15 @@ utmutato AI-agenteknek (Claude Code, Codex) szol.
|
|
|
256
256
|
|
|
257
257
|
## Setup
|
|
258
258
|
|
|
259
|
-
1. The user needs a KeyPro account (approved reseller) and an API key.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
-
|
|
263
|
-
-
|
|
264
|
-
|
|
265
|
-
|
|
259
|
+
1. The user needs a KeyPro account (approved reseller) and an API key. Easiest:
|
|
260
|
+
\`keypro setup\` - interactive wizard (asks the server, then API key [default]
|
|
261
|
+
or email+password). Alternatives:
|
|
262
|
+
- \`keypro login\` (email + password, mints + stores a fresh key)
|
|
263
|
+
- a key made on the website under "API kulcsok", stored via
|
|
264
|
+
\`keypro config set api-key kp_live_...\`, the KEYPRO_API_KEY env var
|
|
265
|
+
(recommended for agents), or ~/.config/keypro/config.json
|
|
266
|
+
2. API base URL: production is the default. For the dev site use \`keypro setup\`,
|
|
267
|
+
KEYPRO_API_BASE=https://dev.keypro.hu, or \`keypro config set api-base ...\`.
|
|
266
268
|
3. Verify with: \`keypro whoami --json\`
|
|
267
269
|
|
|
268
270
|
## Output contract
|
|
@@ -717,7 +719,7 @@ function registerKeyproTools(server, client) {
|
|
|
717
719
|
|
|
718
720
|
// src/mcp.ts
|
|
719
721
|
async function runMcpServer(client) {
|
|
720
|
-
const server = new McpServer({ name: "keypro", version: "0.1.
|
|
722
|
+
const server = new McpServer({ name: "keypro", version: "0.1.5" });
|
|
721
723
|
registerKeyproTools(server, client);
|
|
722
724
|
const transport = new StdioServerTransport();
|
|
723
725
|
await server.connect(transport);
|
|
@@ -778,7 +780,7 @@ async function promptHidden(question) {
|
|
|
778
780
|
var program = new Command();
|
|
779
781
|
program.name("keypro").description(
|
|
780
782
|
"KeyPro.hu B2B licencshop CLI - rendeles, szamlak, term\xE9kkulcsok, profil. AI-agent utmutato: keypro agent-docs"
|
|
781
|
-
).version("0.1.
|
|
783
|
+
).version("0.1.5").option("--json", "gepi (JSON) kimenet a stdout-ra", false).option("--api-key <kulcs>", "API kulcs (felulirja az env/config erteket)").option("--api-base <url>", "API kiszolgalo cime (alap: eles bolt)").hook("preAction", (thisCommand) => {
|
|
782
784
|
setJsonMode(Boolean(thisCommand.optsWithGlobals().json));
|
|
783
785
|
});
|
|
784
786
|
function resolved(cmd) {
|
|
@@ -858,6 +860,61 @@ program.command("whoami").description("a bejelentkezett fiok adatai").action(asy
|
|
|
858
860
|
fail(err);
|
|
859
861
|
}
|
|
860
862
|
});
|
|
863
|
+
program.command("setup").description("interaktiv beallitas: szerver + hitelesites (API kulcs vagy jelszo)").action(async (_opts, cmd) => {
|
|
864
|
+
try {
|
|
865
|
+
const current = resolveConfig({});
|
|
866
|
+
const baseInput = (await promptText(`API szerver [${current.apiBase}]: `)).trim();
|
|
867
|
+
const apiBase = (baseInput || current.apiBase).replace(/\/$/, "");
|
|
868
|
+
if (!/^https?:\/\//.test(apiBase)) {
|
|
869
|
+
usageError("Az API szerver http(s) URL kell legyen, pl. https://keypro.hu");
|
|
870
|
+
}
|
|
871
|
+
const method = (await promptText(
|
|
872
|
+
"Hiteles\xEDt\xE9s - [1] API kulcs (aj\xE1nlott) [2] Email + jelsz\xF3 [1]: "
|
|
873
|
+
)).trim();
|
|
874
|
+
let apiKey;
|
|
875
|
+
if (method === "2") {
|
|
876
|
+
const email = await promptText("Email: ");
|
|
877
|
+
const password = await promptHidden("Jelsz\xF3: ");
|
|
878
|
+
const result = await createClient({ apiBase }).login(
|
|
879
|
+
email,
|
|
880
|
+
password,
|
|
881
|
+
"CLI setup"
|
|
882
|
+
);
|
|
883
|
+
apiKey = result.token;
|
|
884
|
+
} else {
|
|
885
|
+
const key2 = (await promptHidden("API kulcs (kp_live_...): ")).trim();
|
|
886
|
+
if (!key2.startsWith("kp_live_")) {
|
|
887
|
+
usageError(
|
|
888
|
+
"\xC9rv\xE9nytelen kulcs form\xE1tum (kp_live_...). Kulcsot a weben az /api-keys oldalon k\xE9sz\xEDthetsz."
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
apiKey = key2;
|
|
892
|
+
}
|
|
893
|
+
writeConfig({ apiBase, apiKey });
|
|
894
|
+
const me = await createClient({ apiBase, apiKey }).me();
|
|
895
|
+
output(
|
|
896
|
+
{
|
|
897
|
+
apiBase,
|
|
898
|
+
configPath: configPath(),
|
|
899
|
+
account: { id: me.id, email: me.email, role: me.role }
|
|
900
|
+
},
|
|
901
|
+
() => {
|
|
902
|
+
process.stdout.write(
|
|
903
|
+
`
|
|
904
|
+
Be\xE1ll\xEDtva.
|
|
905
|
+
Szerver: ${apiBase}
|
|
906
|
+
Fi\xF3k: ${me.email} (#${me.id}, ${me.role})
|
|
907
|
+
Config: ${configPath()}
|
|
908
|
+
|
|
909
|
+
Pr\xF3b\xE1ld ki: keypro whoami
|
|
910
|
+
`
|
|
911
|
+
);
|
|
912
|
+
}
|
|
913
|
+
);
|
|
914
|
+
} catch (err) {
|
|
915
|
+
fail(err);
|
|
916
|
+
}
|
|
917
|
+
});
|
|
861
918
|
var config = program.command("config").description("CLI beallitasok");
|
|
862
919
|
config.command("get").description("aktualis beallitasok").action((_opts, cmd) => {
|
|
863
920
|
const cfg = resolved(cmd);
|
|
@@ -879,18 +936,29 @@ config.command("get").description("aktualis beallitasok").action((_opts, cmd) =>
|
|
|
879
936
|
}
|
|
880
937
|
);
|
|
881
938
|
});
|
|
882
|
-
config.command("set <kulcs> <ertek>").description("beallitas mentese (tamogatott kulcs: api-base)").action((key2, value) => {
|
|
883
|
-
if (key2
|
|
884
|
-
|
|
939
|
+
config.command("set <kulcs> <ertek>").description("beallitas mentese (tamogatott kulcs: api-base, api-key)").action((key2, value) => {
|
|
940
|
+
if (key2 === "api-base") {
|
|
941
|
+
if (!/^https?:\/\//.test(value)) {
|
|
942
|
+
usageError("Az api-base http(s) URL kell legyen, pl. https://keypro.hu");
|
|
943
|
+
}
|
|
944
|
+
const next = writeConfig({ apiBase: value.replace(/\/$/, "") });
|
|
945
|
+
output({ apiBase: next.apiBase }, () => {
|
|
946
|
+
process.stdout.write(`API c\xEDm be\xE1ll\xEDtva: ${next.apiBase}
|
|
947
|
+
`);
|
|
948
|
+
});
|
|
949
|
+
return;
|
|
885
950
|
}
|
|
886
|
-
if (
|
|
887
|
-
|
|
951
|
+
if (key2 === "api-key") {
|
|
952
|
+
if (!value.startsWith("kp_live_")) {
|
|
953
|
+
usageError("\xC9rv\xE9nytelen kulcs form\xE1tum (kp_live_...).");
|
|
954
|
+
}
|
|
955
|
+
writeConfig({ apiKey: value });
|
|
956
|
+
output({ apiKeySet: true, configPath: configPath() }, () => {
|
|
957
|
+
process.stdout.write("API kulcs elmentve a configba.\n");
|
|
958
|
+
});
|
|
959
|
+
return;
|
|
888
960
|
}
|
|
889
|
-
|
|
890
|
-
output({ apiBase: next.apiBase }, () => {
|
|
891
|
-
process.stdout.write(`API c\xEDm be\xE1ll\xEDtva: ${next.apiBase}
|
|
892
|
-
`);
|
|
893
|
-
});
|
|
961
|
+
usageError(`Ismeretlen be\xE1ll\xEDt\xE1s: ${key2}. T\xE1mogatott: api-base, api-key`);
|
|
894
962
|
});
|
|
895
963
|
var key = program.command("key").description("API kulcsok kezelese");
|
|
896
964
|
key.command("list").description("a fiok API kulcsai").action(async (_opts, cmd) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keypro/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "KeyPro.hu B2B szoftverlicenc webshop CLI: rendeles leadas, rendelesek/szamlak/termekkulcsok lekerdezese, profil kezeles. AI-ugynok (Claude Code, Codex) barat: --json kimenet es beepitett MCP szerver (keypro mcp).",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -33,8 +33,10 @@
|
|
|
33
33
|
},
|
|
34
34
|
"repository": {
|
|
35
35
|
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/InstaSoft-hu/keypro-
|
|
37
|
-
|
|
36
|
+
"url": "git+https://github.com/InstaSoft-hu/keypro-cli.git"
|
|
37
|
+
},
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/InstaSoft-hu/keypro-cli/issues"
|
|
38
40
|
},
|
|
39
41
|
"keywords": [
|
|
40
42
|
"keypro",
|
|
@@ -56,5 +58,5 @@
|
|
|
56
58
|
"vitest": "^4.1.10"
|
|
57
59
|
},
|
|
58
60
|
"author": "InstaSoft Informatikai Zrt. (https://keypro.hu)",
|
|
59
|
-
"homepage": "https://
|
|
61
|
+
"homepage": "https://github.com/InstaSoft-hu/keypro-cli#readme"
|
|
60
62
|
}
|