@web42/cli 0.2.11 → 0.2.13

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.
@@ -0,0 +1,2 @@
1
+ import { Command } from "commander";
2
+ export declare const registerCommand: Command;
@@ -0,0 +1,61 @@
1
+ import { Command } from "commander";
2
+ import chalk from "chalk";
3
+ import ora from "ora";
4
+ import { requireAuth } from "../utils/config.js";
5
+ export const registerCommand = new Command("register")
6
+ .description("Register an agent with the Web42 marketplace")
7
+ .argument("<url>", "Public URL of the running agent (must serve /.well-known/agent-card.json)")
8
+ .option("--price <cents>", "Price in cents (default: 0 = free)")
9
+ .option("--license <license>", "License (e.g. MIT, Apache-2.0)")
10
+ .option("--visibility <vis>", "Visibility: public or private", "public")
11
+ .option("--tags <tags>", "Comma-separated tags")
12
+ .option("--categories <cats>", "Comma-separated categories")
13
+ .action(async (url, opts) => {
14
+ const config = requireAuth();
15
+ const web42ApiUrl = config.apiUrl ?? "https://web42.ai";
16
+ const spinner = ora("Registering agent...").start();
17
+ const body = { url };
18
+ if (opts.price !== undefined)
19
+ body.price_cents = parseInt(opts.price, 10);
20
+ if (opts.license)
21
+ body.license = opts.license;
22
+ if (opts.visibility)
23
+ body.visibility = opts.visibility;
24
+ if (opts.tags)
25
+ body.tags = opts.tags.split(",").map((t) => t.trim());
26
+ if (opts.categories)
27
+ body.categories = opts.categories.split(",").map((c) => c.trim());
28
+ try {
29
+ const res = await fetch(`${web42ApiUrl}/api/agents`, {
30
+ method: "POST",
31
+ headers: {
32
+ Authorization: `Bearer ${config.token}`,
33
+ "Content-Type": "application/json",
34
+ },
35
+ body: JSON.stringify(body),
36
+ });
37
+ if (!res.ok) {
38
+ const errBody = (await res.json().catch(() => ({})));
39
+ spinner.fail("Registration failed");
40
+ console.error(chalk.red(errBody.error ?? `HTTP ${res.status}`));
41
+ process.exit(1);
42
+ }
43
+ const data = (await res.json());
44
+ const slug = data.agent?.slug ?? "unknown";
45
+ const name = data.agent?.agent_card?.name ?? slug;
46
+ const displaySlug = slug.replace("~", "/");
47
+ if (data.created) {
48
+ spinner.succeed(`Registered "${name}" (${displaySlug})`);
49
+ }
50
+ else {
51
+ spinner.succeed(`Updated "${name}" (${displaySlug})`);
52
+ }
53
+ console.log(chalk.dim(` Send: web42 send ${slug} "hello"`));
54
+ console.log(chalk.dim(` View: ${web42ApiUrl}/${displaySlug.replace("@", "")}`));
55
+ }
56
+ catch (err) {
57
+ spinner.fail("Registration failed");
58
+ console.error(chalk.red(String(err)));
59
+ process.exit(1);
60
+ }
61
+ });
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
3
  import { authCommand } from "./commands/auth.js";
4
+ import { registerCommand } from "./commands/register.js";
4
5
  import { searchCommand } from "./commands/search.js";
5
6
  import { sendCommand } from "./commands/send.js";
6
7
  import { serveCommand } from "./commands/serve.js";
@@ -19,6 +20,7 @@ program
19
20
  }
20
21
  });
21
22
  program.addCommand(authCommand);
23
+ program.addCommand(registerCommand);
22
24
  program.addCommand(searchCommand);
23
25
  program.addCommand(sendCommand);
24
26
  program.addCommand(serveCommand);
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const CLI_VERSION = "0.2.11";
1
+ export declare const CLI_VERSION = "0.2.13";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.2.11";
1
+ export const CLI_VERSION = "0.2.13";
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@web42/cli",
3
- "version": "0.2.11",
3
+ "version": "0.2.13",
4
4
  "description": "CLI for the Web42 Agent Marketplace - push, install, and remix OpenClaw agent packages",
5
5
  "type": "module",
6
6
  "bin": {
7
- "web42": "./dist/index.js"
7
+ "web42": "./dist/index.js",
8
+ "w42": "./dist/index.js"
8
9
  },
9
10
  "scripts": {
10
11
  "embed-skills": "bun scripts/embed-skills.ts",