traderclaw-cli 1.0.93 → 1.0.95

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.
Files changed (2) hide show
  1. package/bin/cli.ts +61 -0
  2. package/package.json +2 -2
package/bin/cli.ts CHANGED
@@ -4,6 +4,7 @@ import { createInterface } from "readline";
4
4
  import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
5
5
  import { join } from "path";
6
6
  import { homedir } from "os";
7
+ import { spawnSync } from "child_process";
7
8
 
8
9
  const VERSION = "1.0.0";
9
10
  const PLUGIN_ID = "solana-trader";
@@ -611,6 +612,57 @@ async function cmdConfig(subArgs: string[]) {
611
612
  process.exit(1);
612
613
  }
613
614
 
615
+ async function cmdUpdate(args: string[]) {
616
+ const tag = args.includes("--beta") ? "beta" : "latest";
617
+
618
+ print("\nOpenClaw Trader — Update\n");
619
+ print("=".repeat(45));
620
+
621
+ let currentVersion = "unknown";
622
+ try {
623
+ const r = spawnSync("npm", ["list", "-g", "traderclaw-cli", "--json", "--depth=0"], { encoding: "utf-8" });
624
+ if (r.stdout) {
625
+ const data = JSON.parse(r.stdout) as { dependencies?: Record<string, { version?: string }> };
626
+ currentVersion = data?.dependencies?.["traderclaw-cli"]?.version ?? "unknown";
627
+ }
628
+ } catch {}
629
+ printInfo(` Current version: ${currentVersion}`);
630
+
631
+ let latestVersion = "unknown";
632
+ try {
633
+ const r = spawnSync("npm", ["view", `traderclaw-cli@${tag}`, "version"], { encoding: "utf-8" });
634
+ latestVersion = r.stdout?.trim() ?? "unknown";
635
+ } catch {}
636
+ printInfo(` Available (${tag}):${" ".repeat(Math.max(1, 9 - tag.length))}${latestVersion}`);
637
+
638
+ if (currentVersion !== "unknown" && latestVersion !== "unknown" && currentVersion === latestVersion) {
639
+ printSuccess(`\n Already on the ${tag} version (${currentVersion}). Nothing to do.\n`);
640
+ return;
641
+ }
642
+
643
+ print(`\n Installing traderclaw-cli@${tag}...\n`);
644
+
645
+ const install = spawnSync("npm", ["install", "-g", `traderclaw-cli@${tag}`], { stdio: "inherit" });
646
+ if (install.status !== 0) {
647
+ printError("npm install failed. Try running manually:");
648
+ print(` npm install -g traderclaw-cli@${tag}`);
649
+ process.exit(1);
650
+ }
651
+
652
+ printSuccess(`\n Package updated.`);
653
+ print("\n Restarting gateway...\n");
654
+
655
+ const restart = spawnSync("openclaw", ["gateway", "restart"], { stdio: "inherit" });
656
+ if (restart.status !== 0) {
657
+ printWarn(" Gateway restart returned non-zero. Restart manually: openclaw gateway restart");
658
+ } else {
659
+ printSuccess(" Gateway restarted.");
660
+ }
661
+
662
+ print("\n" + "=".repeat(45));
663
+ printSuccess("\n Update complete!\n");
664
+ }
665
+
614
666
  function printHelp() {
615
667
  print(`
616
668
  OpenClaw Solana Trader CLI v${VERSION}
@@ -621,6 +673,7 @@ Commands:
621
673
  setup Set up the plugin (API key, orchestrator, wallet)
622
674
  status Check connection health and wallet status
623
675
  config View and manage configuration
676
+ update Update to the latest version and restart the gateway
624
677
 
625
678
  Setup options:
626
679
  --api-key, -k API key (skip interactive prompt)
@@ -632,11 +685,16 @@ Config subcommands:
632
685
  config set <k> <v> Update a configuration value
633
686
  config reset Remove plugin configuration
634
687
 
688
+ Update options:
689
+ --beta Update to the latest beta version instead of stable
690
+
635
691
  Examples:
636
692
  openclaw-trader setup
637
693
  openclaw-trader setup --api-key sk_live_abc123 --url https://api.traderclaw.ai
638
694
  openclaw-trader setup --telegram-recipient @MyChannelOrUser
639
695
  openclaw-trader status
696
+ openclaw-trader update
697
+ openclaw-trader update --beta
640
698
  openclaw-trader config show
641
699
  openclaw-trader config set apiTimeout 60000
642
700
  `);
@@ -666,6 +724,9 @@ async function main() {
666
724
  case "config":
667
725
  await cmdConfig(args.slice(1));
668
726
  break;
727
+ case "update":
728
+ await cmdUpdate(args.slice(1));
729
+ break;
669
730
  default:
670
731
  printError(`Unknown command: ${command}`);
671
732
  printHelp();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.93",
3
+ "version": "1.0.95",
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.93"
20
+ "solana-traderclaw": "^1.0.95"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",