@jecpdev/cli 0.4.0 → 0.5.1

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/cli.js CHANGED
@@ -12,7 +12,7 @@ program.name("jecp").description("Command-line interface for JECP \u2014 Joint E
12
12
  if (cmd.opts().baseUrl) process.env.JECP_BASE_URL = cmd.opts().baseUrl;
13
13
  });
14
14
  program.command("register").description("Register a new agent (interactive or with flags)").option("-n, --name <name>", "Agent name (display label)").option("-t, --type <type>", "Agent type (research, coder, demo, etc.)").option("-d, --description <description>", "Optional description").action(async (opts) => {
15
- const { registerCmd } = await import("./register-XWWS42Z7.js");
15
+ const { registerCmd } = await import("./register-VZIIVYD7.js");
16
16
  await registerCmd(opts);
17
17
  });
18
18
  program.command("login").description("Save existing agent credentials to ~/.jecp/config.json").option("--agent-id <id>", "Agent ID").option("--api-key <key>", "API key").option("--base-url <url>", "Override Hub URL").action(async (opts) => {
@@ -0,0 +1,86 @@
1
+ import {
2
+ bold,
3
+ dim,
4
+ emit,
5
+ fail,
6
+ info,
7
+ success
8
+ } from "./chunk-AHQEKKK7.js";
9
+ import {
10
+ configFilePath,
11
+ loadConfig,
12
+ saveConfig
13
+ } from "./chunk-DZLDBWTB.js";
14
+
15
+ // src/commands/register.ts
16
+ import { JecpClient } from "@jecpdev/sdk";
17
+ import prompts from "prompts";
18
+ async function registerCmd(opts) {
19
+ let { name, type, description } = opts;
20
+ if (!name) {
21
+ const ans = await prompts([
22
+ { type: "text", name: "name", message: "Agent name (display label)", validate: (v) => v.length > 0 },
23
+ { type: "text", name: "type", message: "Agent type (e.g. research, coder, demo)", initial: "demo" },
24
+ { type: "text", name: "description", message: "Short description (optional)" }
25
+ ]);
26
+ if (!ans.name) fail("aborted");
27
+ name = ans.name;
28
+ type = ans.type;
29
+ description = ans.description;
30
+ }
31
+ info(`Registering agent ${bold(name)}...`);
32
+ const baseUrl = process.env.JECP_BASE_URL ?? "https://jecp.dev";
33
+ const reg = await JecpClient.register(
34
+ {
35
+ name,
36
+ ...type && { agent_type: type },
37
+ ...description && { description }
38
+ },
39
+ baseUrl
40
+ );
41
+ const cfg = loadConfig();
42
+ cfg.agent_id = reg.agent_id;
43
+ cfg.api_key = reg.api_key;
44
+ if (baseUrl !== "https://jecp.dev") cfg.base_url = baseUrl;
45
+ saveConfig(cfg);
46
+ success(`Agent registered. Credentials auto-saved to ${bold(configFilePath())} (mode 0600)`);
47
+ info(dim(` \u2192 All subsequent jecp commands authenticate automatically. No env-var setup needed.`));
48
+ info("");
49
+ const freeCalls = reg.free_calls_remaining ?? reg.benefits?.free_api_calls ?? 100;
50
+ info(bold("Credentials (api_key shown ONLY ONCE \u2014 store externally if you need it elsewhere):"));
51
+ info(` AGENT_ID: ${reg.agent_id}`);
52
+ info(` API_KEY: ${reg.api_key}`);
53
+ info(` Free calls: ${freeCalls}`);
54
+ info("");
55
+ info(bold("Next steps:"));
56
+ info(` 1. Browse the capability catalog (always free):`);
57
+ info(` ${dim("$")} jecp catalog`);
58
+ info("");
59
+ info(` 2. Make your first invocation. ${dim("Each call costs ~$0.005 USDC from your wallet.")}`);
60
+ info(` ${dim("$")} jecp topup 5 ${dim("# add $5 to wallet (Stripe Checkout)")}`);
61
+ info(` ${dim("$")} jecp invoke jobdonebot/content-factory translate \\`);
62
+ info(` --input '{"text":"Hello","target_lang":"JA"}'`);
63
+ info("");
64
+ info(` 3. Check your status anytime:`);
65
+ info(` ${dim("$")} jecp status`);
66
+ info("");
67
+ emit({
68
+ agent_id: reg.agent_id,
69
+ api_key: reg.api_key,
70
+ name,
71
+ free_calls_remaining: freeCalls,
72
+ config_file: configFilePath(),
73
+ next_steps: [
74
+ { command: "jecp catalog", description: "Browse capabilities (free)" },
75
+ { command: "jecp topup 5", description: "Add $5 USDC to wallet via Stripe" },
76
+ {
77
+ command: `jecp invoke jobdonebot/content-factory translate --input '{"text":"Hello","target_lang":"JA"}'`,
78
+ description: "Make your first invocation (~$0.005 USDC)"
79
+ },
80
+ { command: "jecp status", description: "Check agent state and balance" }
81
+ ]
82
+ });
83
+ }
84
+ export {
85
+ registerCmd
86
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jecpdev/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "Command-line interface for JECP — register agents, invoke capabilities, manage Providers from your terminal.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,62 +0,0 @@
1
- import {
2
- bold,
3
- emit,
4
- fail,
5
- info,
6
- success
7
- } from "./chunk-AHQEKKK7.js";
8
- import {
9
- loadConfig,
10
- saveConfig
11
- } from "./chunk-DZLDBWTB.js";
12
-
13
- // src/commands/register.ts
14
- import { JecpClient } from "@jecpdev/sdk";
15
- import prompts from "prompts";
16
- async function registerCmd(opts) {
17
- let { name, type, description } = opts;
18
- if (!name) {
19
- const ans = await prompts([
20
- { type: "text", name: "name", message: "Agent name (display label)", validate: (v) => v.length > 0 },
21
- { type: "text", name: "type", message: "Agent type (e.g. research, coder, demo)", initial: "demo" },
22
- { type: "text", name: "description", message: "Short description (optional)" }
23
- ]);
24
- if (!ans.name) fail("aborted");
25
- name = ans.name;
26
- type = ans.type;
27
- description = ans.description;
28
- }
29
- info(`Registering agent ${bold(name)}...`);
30
- const baseUrl = process.env.JECP_BASE_URL ?? "https://jecp.dev";
31
- const reg = await JecpClient.register(
32
- {
33
- name,
34
- ...type && { agent_type: type },
35
- ...description && { description }
36
- },
37
- baseUrl
38
- );
39
- success(`Agent registered.`);
40
- info("");
41
- info(bold("Save these credentials \u2014 the api_key is shown only once:"));
42
- info("");
43
- info(` AGENT_ID: ${reg.agent_id}`);
44
- info(` API_KEY: ${reg.api_key}`);
45
- info(` Free calls: ${reg.free_calls_remaining}`);
46
- info("");
47
- const cfg = loadConfig();
48
- cfg.agent_id = reg.agent_id;
49
- cfg.api_key = reg.api_key;
50
- if (baseUrl !== "https://jecp.dev") cfg.base_url = baseUrl;
51
- saveConfig(cfg);
52
- success(`Credentials saved to ~/.jecp/config.json (mode 0600)`);
53
- emit({
54
- agent_id: reg.agent_id,
55
- api_key: reg.api_key,
56
- name: reg.name,
57
- free_calls_remaining: reg.free_calls_remaining
58
- });
59
- }
60
- export {
61
- registerCmd
62
- };