clawdock 0.2.4 → 0.2.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/dist/index.js +24 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,6 +6,9 @@ import * as fs from "fs";
|
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import * as os from "os";
|
|
8
8
|
import * as tar from "tar";
|
|
9
|
+
import { createRequire } from "module";
|
|
10
|
+
var require2 = createRequire(import.meta.url);
|
|
11
|
+
var PKG_VERSION = require2("../package.json").version;
|
|
9
12
|
var CONFIG_DIR = path.join(os.homedir(), ".clawdock");
|
|
10
13
|
var CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
11
14
|
var DEFAULT_REGISTRY = "https://clawhub-one.vercel.app";
|
|
@@ -44,7 +47,7 @@ async function apiRequest(method, endpoint, body, isForm) {
|
|
|
44
47
|
return res.json();
|
|
45
48
|
}
|
|
46
49
|
var program = new Command();
|
|
47
|
-
program.name("clawdock").description("ClawDock \u2014 the agent registry").version("
|
|
50
|
+
program.name("clawdock").description("ClawDock \u2014 the agent registry").version(PKG_VERSION, "-v, -V, --version");
|
|
48
51
|
program.command("login").description("Authenticate with ClawDock").option("--api-key <key>", "API key").option("--registry <url>", "Registry URL").action(async (opts) => {
|
|
49
52
|
const config = loadConfig();
|
|
50
53
|
if (opts.apiKey) {
|
|
@@ -487,4 +490,24 @@ program.command("run <bundle>").description("Pull and run an agent locally").opt
|
|
|
487
490
|
process.on("SIGTERM", () => child.kill("SIGTERM"));
|
|
488
491
|
}
|
|
489
492
|
});
|
|
493
|
+
program.command("update").description("Update clawdock CLI to the latest version").action(async () => {
|
|
494
|
+
const { execSync } = await import("child_process");
|
|
495
|
+
console.log(`Current version: ${PKG_VERSION}`);
|
|
496
|
+
console.log("\u{1F504} Checking for updates...");
|
|
497
|
+
try {
|
|
498
|
+
const latest = execSync("npm view clawdock version", { encoding: "utf-8" }).trim();
|
|
499
|
+
if (latest === PKG_VERSION) {
|
|
500
|
+
console.log(`\u2705 Already on latest version (${PKG_VERSION})`);
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
console.log(` New version available: ${latest}`);
|
|
504
|
+
console.log(" Installing...");
|
|
505
|
+
execSync("npm install -g clawdock@latest", { stdio: "inherit" });
|
|
506
|
+
console.log(`\u2705 Updated to clawdock@${latest}`);
|
|
507
|
+
} catch (err) {
|
|
508
|
+
console.error(`\u274C Update failed: ${err.message}`);
|
|
509
|
+
console.error(" Try manually: npm install -g clawdock@latest");
|
|
510
|
+
process.exit(1);
|
|
511
|
+
}
|
|
512
|
+
});
|
|
490
513
|
program.parse();
|