traderclaw-cli 1.0.98 → 1.0.100

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), force-install solana-traderclaw, and restart the gateway
4179
+
4180
+ Update options (traderclaw update):
4181
+ --beta Use the npm dist-tag "beta" for traderclaw-cli and solana-traderclaw (default: "latest")
4182
+ --dry-run Show / simulate actions without fully applying (where supported)
4183
+ --skip-plugins Do not run openclaw "plugins update" or "plugins install --force" (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,144 @@ 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}`);
4270
-
4271
- if (currentVersion !== "unknown" && latestVersion !== "unknown" && currentVersion === latestVersion) {
4272
- printSuccess(`\n Already on the ${tag} version (${currentVersion}). Nothing to do.\n`);
4273
- return;
4274
- }
4280
+ printInfo(` npm ${tag} tag resolves to:${" ".repeat(Math.max(1, 11 - tag.length))}${latestVersion}`);
4275
4281
 
4276
- print(`\n Installing traderclaw-cli@${tag}...\n`);
4282
+ /** Published solana-traderclaw version for openclaw plugins install …@version --force (matches CLI release in this monorepo). */
4283
+ let publishedPluginVersion = "unknown";
4277
4284
  try {
4278
- execSync(`npm install -g traderclaw-cli@${tag}`, { stdio: "inherit" });
4285
+ publishedPluginVersion = execSync(`npm view ${NPM_PACKAGE_NAME}@${tag} version`, { encoding: "utf-8" }).trim();
4279
4286
  } catch {
4280
- printError("npm install failed. Try running manually:");
4281
- print(` npm install -g traderclaw-cli@${tag}`);
4282
- process.exit(1);
4287
+ try {
4288
+ publishedPluginVersion = execSync(`npm view ${NPM_PACKAGE_NAME}@latest version`, { encoding: "utf-8" }).trim();
4289
+ } catch {
4290
+ /* leave unknown */
4291
+ }
4292
+ }
4293
+ if (publishedPluginVersion === "unknown" && latestVersion !== "unknown") {
4294
+ publishedPluginVersion = latestVersion;
4283
4295
  }
4296
+ printInfo(
4297
+ ` Target ${NPM_PACKAGE_NAME}@${tag}: ${publishedPluginVersion === "unknown" ? "unknown" : publishedPluginVersion}`,
4298
+ );
4284
4299
 
4285
- printSuccess(`\n Package updated.`);
4286
- print("\n Restarting gateway...\n");
4300
+ const cliUpToDate =
4301
+ currentVersion !== "unknown" && latestVersion !== "unknown" && currentVersion === latestVersion;
4302
+ const needNpmInstall = !cliUpToDate;
4287
4303
 
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");
4304
+ if (needNpmInstall) {
4305
+ if (dryRun) {
4306
+ print(`\n [dry-run] Would run: npm install -g traderclaw-cli@${tag}\n`);
4307
+ } else {
4308
+ print(`\n Installing traderclaw-cli@${tag} globally...\n`);
4309
+ try {
4310
+ execSync(`npm install -g traderclaw-cli@${tag}`, { stdio: "inherit" });
4311
+ printSuccess(`\n Global traderclaw-cli updated.`);
4312
+ } catch {
4313
+ printError("npm install failed. Try running manually:");
4314
+ print(` npm install -g traderclaw-cli@${tag}`);
4315
+ process.exit(1);
4316
+ }
4317
+ }
4318
+ } else {
4319
+ printSuccess(`\n Global traderclaw-cli is already on ${tag} (${currentVersion}).`);
4320
+ }
4321
+
4322
+ // OpenClaw still tracks a separate copy under extensions + plugins.installs in openclaw.json.
4323
+ // Always refresh that install so it matches the new CLI (spec / integrity / resolvedVersion).
4324
+ if (!skipPlugins) {
4325
+ if (!commandExists("openclaw")) {
4326
+ printWarn(`\n "openclaw" not found in PATH — cannot run "openclaw plugins update ${PLUGIN_ID}" or "plugins install … --force".`);
4327
+ print(" After installing the OpenClaw CLI, run (use the version from npm or this log):\n");
4328
+ print(` openclaw plugins update ${PLUGIN_ID}`);
4329
+ print(` openclaw plugins install ${NPM_PACKAGE_NAME}@${publishedPluginVersion !== "unknown" ? publishedPluginVersion : "<version>"} --force`);
4330
+ print(" Then: openclaw gateway restart");
4331
+ } else {
4332
+ const pluginUpdateArgs = ["plugins", "update", PLUGIN_ID];
4333
+ if (dryRun) {
4334
+ pluginUpdateArgs.push("--dry-run");
4335
+ }
4336
+ try {
4337
+ print(`\n Syncing OpenClaw plugin install (${PLUGIN_ID}, solana-traderclaw)...\n`);
4338
+ printInfo(
4339
+ ` (updates ~/.openclaw/… plugin files and ${CONFIG_FILE} plugins.installs — do not hand-edit those versions)\n`,
4340
+ );
4341
+ execFileSync("openclaw", pluginUpdateArgs, { stdio: "inherit" });
4342
+ if (!dryRun) {
4343
+ printSuccess(`\n OpenClaw plugin "${PLUGIN_ID}" update finished.`);
4344
+ }
4345
+
4346
+ if (publishedPluginVersion === "unknown") {
4347
+ printWarn(
4348
+ ` Skipped "openclaw plugins install ${NPM_PACKAGE_NAME}@<version> --force" (could not resolve version from npm).`,
4349
+ );
4350
+ } else {
4351
+ const installSpec = `${NPM_PACKAGE_NAME}@${publishedPluginVersion}`;
4352
+ const installArgs = ["plugins", "install", installSpec, "--force"];
4353
+ if (dryRun) {
4354
+ print(
4355
+ `\n [dry-run] Would run: openclaw plugins install ${installSpec} --force\n` +
4356
+ " (re-downloads the exact tarball, rewrites the extension, and re-syncs plugins.installs.)\n",
4357
+ );
4358
+ } else {
4359
+ try {
4360
+ print(
4361
+ `\n Forcing full integration: openclaw plugins install ${installSpec} --force\n` +
4362
+ " (extension on disk + plugins.installs / integrity.)\n",
4363
+ );
4364
+ execFileSync("openclaw", installArgs, { stdio: "inherit" });
4365
+ printSuccess(`\n Forced install complete: ${installSpec}.`);
4366
+ } catch {
4367
+ printError(`"openclaw plugins install ${installSpec} --force" failed. Try manually:`);
4368
+ print(` openclaw plugins install ${installSpec} --force`);
4369
+ process.exit(1);
4370
+ }
4371
+ }
4372
+ }
4373
+ } catch {
4374
+ if (dryRun) {
4375
+ printError(`openclaw plugins update ${PLUGIN_ID} --dry-run failed.`);
4376
+ } else {
4377
+ printError(`"openclaw plugins update ${PLUGIN_ID}" failed. You can try:`);
4378
+ print(` openclaw plugins update ${PLUGIN_ID}`);
4379
+ print(" or (all installed plugins) openclaw plugins update --all");
4380
+ }
4381
+ process.exit(1);
4382
+ }
4383
+ }
4384
+ } else {
4385
+ printWarn(
4386
+ `\n --skip-plugins: skipped "openclaw plugins update ${PLUGIN_ID}" and "openclaw plugins install ${NPM_PACKAGE_NAME}@… --force"; openclaw.json / extension may stay on an old version.`,
4387
+ );
4388
+ }
4389
+
4390
+ if (dryRun) {
4391
+ print(`\n [dry-run] Would run: openclaw gateway restart\n`);
4392
+ } else {
4393
+ if (!commandExists("openclaw")) {
4394
+ printWarn("\n Skipping gateway restart: openclaw not in PATH. After fixing PATH: openclaw gateway restart");
4395
+ } else {
4396
+ print("\n Restarting gateway...\n");
4397
+ try {
4398
+ execFileSync("openclaw", ["gateway", "restart"], { stdio: "inherit" });
4399
+ printSuccess(" Gateway restarted.");
4400
+ } catch {
4401
+ printWarn(" Gateway restart returned non-zero. Try manually: openclaw gateway restart");
4402
+ }
4403
+ }
4293
4404
  }
4294
4405
 
4295
4406
  print("\n" + "=".repeat(45));
4296
- printSuccess("\n Update complete!\n");
4407
+ if (dryRun) {
4408
+ printSuccess("\n Dry run finished. Re-run without --dry-run to apply.\n");
4409
+ } else {
4410
+ printSuccess("\n Update complete!\n");
4411
+ }
4297
4412
  }
4298
4413
 
4299
4414
  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.100",
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.100"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",