@keypro/cli 0.1.3 → 0.1.4
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/dist/index.js +87 -19
- package/package.json +1 -1
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.4" });
|
|
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.4").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.4",
|
|
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",
|