traderclaw-cli 1.0.98 → 1.0.99

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.
@@ -6,7 +6,7 @@ import { dirname, join } from "path";
6
6
  import { fileURLToPath, pathToFileURL } from "url";
7
7
  import { homedir } from "os";
8
8
  import { randomUUID, createPrivateKey, sign as cryptoSign } from "crypto";
9
- import { execFile, execSync } from "child_process";
9
+ import { execFile, execFileSync, execSync } from "child_process";
10
10
  import { promisify } from "util";
11
11
  import { createServer } from "http";
12
12
  import { resolvePluginPackageRoot } from "./resolve-plugin-root.mjs";
@@ -4175,7 +4175,12 @@ Commands:
4175
4175
  status Check connection health and wallet status
4176
4176
  config View and manage configuration
4177
4177
  test-session Test session auth flow (refresh, rotation, challenge) without reinstalling
4178
- update Update to the latest version and restart the gateway
4178
+ update Update global traderclaw-cli, re-sync the OpenClaw plugin (openclaw.json), and restart the gateway
4179
+
4180
+ Update options (traderclaw update):
4181
+ --beta Use the npm dist-tag "beta" for traderclaw-cli (default: "latest")
4182
+ --dry-run Show / simulate actions without fully applying (where supported)
4183
+ --skip-plugins Do not run "openclaw plugins update" (only npm + gateway restart)
4179
4184
 
4180
4185
  Setup options:
4181
4186
  --api-key, -k API key (skip interactive prompt)
@@ -4245,14 +4250,20 @@ Examples:
4245
4250
  traderclaw test-session --wallet-private-key <base58_key>
4246
4251
  traderclaw update
4247
4252
  traderclaw update --beta
4253
+ traderclaw update --dry-run
4248
4254
  `);
4249
4255
  }
4250
4256
 
4251
4257
  async function cmdUpdate(args) {
4252
4258
  const tag = args.includes("--beta") ? "beta" : "latest";
4259
+ const dryRun = args.includes("--dry-run");
4260
+ const skipPlugins = args.includes("--skip-plugins");
4253
4261
 
4254
4262
  print("\nTraderClaw — Update\n");
4255
4263
  print("=".repeat(45));
4264
+ if (dryRun) {
4265
+ printInfo(" (dry-run: npm install and gateway restart are simulated where noted)\n");
4266
+ }
4256
4267
 
4257
4268
  let currentVersion = "unknown";
4258
4269
  try {
@@ -4260,40 +4271,95 @@ async function cmdUpdate(args) {
4260
4271
  const data = JSON.parse(out);
4261
4272
  currentVersion = data?.dependencies?.["traderclaw-cli"]?.version ?? "unknown";
4262
4273
  } catch {}
4263
- printInfo(` Current version: ${currentVersion}`);
4274
+ printInfo(` Global traderclaw-cli: ${currentVersion}`);
4264
4275
 
4265
4276
  let latestVersion = "unknown";
4266
4277
  try {
4267
4278
  latestVersion = execSync(`npm view traderclaw-cli@${tag} version`, { encoding: "utf-8" }).trim();
4268
4279
  } catch {}
4269
- printInfo(` Available (${tag}):${" ".repeat(Math.max(1, 9 - tag.length))}${latestVersion}`);
4280
+ printInfo(` npm ${tag} tag resolves to:${" ".repeat(Math.max(1, 11 - tag.length))}${latestVersion}`);
4270
4281
 
4271
- if (currentVersion !== "unknown" && latestVersion !== "unknown" && currentVersion === latestVersion) {
4272
- printSuccess(`\n Already on the ${tag} version (${currentVersion}). Nothing to do.\n`);
4273
- return;
4274
- }
4282
+ const cliUpToDate =
4283
+ currentVersion !== "unknown" && latestVersion !== "unknown" && currentVersion === latestVersion;
4284
+ const needNpmInstall = !cliUpToDate;
4275
4285
 
4276
- print(`\n Installing traderclaw-cli@${tag}...\n`);
4277
- try {
4278
- execSync(`npm install -g traderclaw-cli@${tag}`, { stdio: "inherit" });
4279
- } catch {
4280
- printError("npm install failed. Try running manually:");
4281
- print(` npm install -g traderclaw-cli@${tag}`);
4282
- process.exit(1);
4286
+ if (needNpmInstall) {
4287
+ if (dryRun) {
4288
+ print(`\n [dry-run] Would run: npm install -g traderclaw-cli@${tag}\n`);
4289
+ } else {
4290
+ print(`\n Installing traderclaw-cli@${tag} globally...\n`);
4291
+ try {
4292
+ execSync(`npm install -g traderclaw-cli@${tag}`, { stdio: "inherit" });
4293
+ printSuccess(`\n Global traderclaw-cli updated.`);
4294
+ } catch {
4295
+ printError("npm install failed. Try running manually:");
4296
+ print(` npm install -g traderclaw-cli@${tag}`);
4297
+ process.exit(1);
4298
+ }
4299
+ }
4300
+ } else {
4301
+ printSuccess(`\n Global traderclaw-cli is already on ${tag} (${currentVersion}).`);
4283
4302
  }
4284
4303
 
4285
- printSuccess(`\n Package updated.`);
4286
- print("\n Restarting gateway...\n");
4304
+ // OpenClaw still tracks a separate copy under extensions + plugins.installs in openclaw.json.
4305
+ // Always refresh that install so it matches the new CLI (spec / integrity / resolvedVersion).
4306
+ if (!skipPlugins) {
4307
+ if (!commandExists("openclaw")) {
4308
+ printWarn(`\n "openclaw" not found in PATH — cannot run "openclaw plugins update ${PLUGIN_ID}".`);
4309
+ print(" After installing the OpenClaw CLI, run:\n");
4310
+ print(` openclaw plugins update ${PLUGIN_ID}`);
4311
+ print(" Then: openclaw gateway restart");
4312
+ } else {
4313
+ const pluginUpdateArgs = ["plugins", "update", PLUGIN_ID];
4314
+ if (dryRun) {
4315
+ pluginUpdateArgs.push("--dry-run");
4316
+ }
4317
+ try {
4318
+ print(`\n Syncing OpenClaw plugin install (${PLUGIN_ID}, solana-traderclaw)...\n`);
4319
+ printInfo(
4320
+ ` (updates ~/.openclaw/… plugin files and ${CONFIG_FILE} plugins.installs — do not hand-edit those versions)\n`,
4321
+ );
4322
+ execFileSync("openclaw", pluginUpdateArgs, { stdio: "inherit" });
4323
+ if (!dryRun) {
4324
+ printSuccess(`\n OpenClaw plugin "${PLUGIN_ID}" update finished.`);
4325
+ }
4326
+ } catch {
4327
+ if (dryRun) {
4328
+ printError(`openclaw plugins update ${PLUGIN_ID} --dry-run failed.`);
4329
+ } else {
4330
+ printError(`"openclaw plugins update ${PLUGIN_ID}" failed. You can try:`);
4331
+ print(` openclaw plugins update ${PLUGIN_ID}`);
4332
+ print(" or (all installed plugins) openclaw plugins update --all");
4333
+ }
4334
+ process.exit(1);
4335
+ }
4336
+ }
4337
+ } else {
4338
+ printWarn(`\n --skip-plugins: skipped "openclaw plugins update ${PLUGIN_ID}"; openclaw.json may still show an old plugin version.`);
4339
+ }
4287
4340
 
4288
- try {
4289
- execSync("openclaw gateway restart", { stdio: "inherit" });
4290
- printSuccess(" Gateway restarted.");
4291
- } catch {
4292
- printWarn(" Gateway restart returned non-zero. Restart manually: openclaw gateway restart");
4341
+ if (dryRun) {
4342
+ print(`\n [dry-run] Would run: openclaw gateway restart\n`);
4343
+ } else {
4344
+ if (!commandExists("openclaw")) {
4345
+ printWarn("\n Skipping gateway restart: openclaw not in PATH. After fixing PATH: openclaw gateway restart");
4346
+ } else {
4347
+ print("\n Restarting gateway...\n");
4348
+ try {
4349
+ execFileSync("openclaw", ["gateway", "restart"], { stdio: "inherit" });
4350
+ printSuccess(" Gateway restarted.");
4351
+ } catch {
4352
+ printWarn(" Gateway restart returned non-zero. Try manually: openclaw gateway restart");
4353
+ }
4354
+ }
4293
4355
  }
4294
4356
 
4295
4357
  print("\n" + "=".repeat(45));
4296
- printSuccess("\n Update complete!\n");
4358
+ if (dryRun) {
4359
+ printSuccess("\n Dry run finished. Re-run without --dry-run to apply.\n");
4360
+ } else {
4361
+ printSuccess("\n Update complete!\n");
4362
+ }
4297
4363
  }
4298
4364
 
4299
4365
  async function cmdRepairOpenclaw() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.98",
3
+ "version": "1.0.99",
4
4
  "description": "Global TraderClaw CLI (install --wizard, setup, precheck). Installs solana-traderclaw as a dependency for OpenClaw plugin files.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,7 @@
17
17
  "node": ">=22"
18
18
  },
19
19
  "dependencies": {
20
- "solana-traderclaw": "^1.0.98"
20
+ "solana-traderclaw": "^1.0.99"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",