traderclaw-cli 1.0.71 → 1.0.73

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.
@@ -442,6 +442,32 @@ function runCommandWithEvents(cmd, args = [], opts = {}) {
442
442
  });
443
443
  }
444
444
 
445
+ function getGlobalOpenClawPackageDir() {
446
+ const root = getCommandOutput("npm root -g");
447
+ if (!root) return null;
448
+ const dir = join(root.trim(), "openclaw");
449
+ return existsSync(join(dir, "package.json")) ? dir : null;
450
+ }
451
+
452
+ /**
453
+ * Re-run `npm install` inside the global OpenClaw package tree. Some hosts end up with an
454
+ * incomplete `node_modules` after `npm install -g` (hoisting, optional deps, or interrupted
455
+ * installs). OpenClaw then fails at runtime with `Cannot find module 'grammy'` while loading
456
+ * config. Installing from the package directory restores declared dependencies.
457
+ */
458
+ /** Runs `npm install` in the global `openclaw` package directory (fixes missing `grammy` etc.). */
459
+ export async function ensureOpenClawGlobalPackageDependencies() {
460
+ const dir = getGlobalOpenClawPackageDir();
461
+ if (!dir) {
462
+ return { skipped: true, reason: "global_openclaw_dir_not_found" };
463
+ }
464
+ await runCommandWithEvents("npm", ["install", "--omit=dev", "--registry", "https://registry.npmjs.org/"], {
465
+ cwd: dir,
466
+ shell: false,
467
+ });
468
+ return { repaired: true, dir };
469
+ }
470
+
445
471
  /**
446
472
  * Install or upgrade the global OpenClaw CLI. We always run npm even when `openclaw` is already
447
473
  * on PATH: bundled plugin manifests track a minimum OpenClaw version (e.g. >=2026.4.8). A stale
@@ -1987,6 +2013,9 @@ export class InstallerStepEngine {
1987
2013
  this.modeConfig,
1988
2014
  (evt) => this.emitLog("install_plugin_package", evt.type === "stderr" ? "warn" : "info", evt.text, evt.urls || []),
1989
2015
  ));
2016
+ await this.runStep("openclaw_global_deps", "Ensuring OpenClaw global package dependencies", async () =>
2017
+ ensureOpenClawGlobalPackageDependencies(),
2018
+ );
1990
2019
  await this.runStep(
1991
2020
  "activate_openclaw_plugin",
1992
2021
  "Installing and enabling TraderClaw inside OpenClaw",
@@ -3204,6 +3204,7 @@ Commands:
3204
3204
  signup Create a new account (alias for: setup --signup; run locally, not via the agent)
3205
3205
  precheck Run environment checks (dry-run or allow-install)
3206
3206
  install Launch installer flows (--wizard for localhost GUI)
3207
+ repair-openclaw Re-run npm install in the global openclaw package (fixes missing grammy after upgrade)
3207
3208
  gateway Gateway helpers (see subcommands below)
3208
3209
  login Re-authenticate (uses refresh token when valid; full challenge only if needed)
3209
3210
  logout Revoke current session and clear tokens
@@ -3248,6 +3249,7 @@ Examples:
3248
3249
  traderclaw precheck --allow-install
3249
3250
  traderclaw install --wizard
3250
3251
  traderclaw install --wizard --lane quick-local
3252
+ traderclaw repair-openclaw
3251
3253
  traderclaw gateway ensure-persistent
3252
3254
  traderclaw setup --signup --user-id my_agent_001 --referral-code ABCD1234
3253
3255
  traderclaw setup --api-key oc_xxx --url https://api.traderclaw.ai
@@ -3264,6 +3266,18 @@ Examples:
3264
3266
  `);
3265
3267
  }
3266
3268
 
3269
+ async function cmdRepairOpenclaw() {
3270
+ const { ensureOpenClawGlobalPackageDependencies } = await import("./installer-step-engine.mjs");
3271
+ printInfo("Repairing global OpenClaw npm dependencies (fixes missing grammy / MODULE_NOT_FOUND)...");
3272
+ const r = await ensureOpenClawGlobalPackageDependencies();
3273
+ if (r.skipped) {
3274
+ printError(`Could not find global OpenClaw package (${r.reason}). Install or upgrade: npm install -g openclaw@latest`);
3275
+ process.exit(1);
3276
+ }
3277
+ printSuccess(`Dependencies refreshed under ${r.dir}`);
3278
+ printInfo("Next: openclaw gateway restart");
3279
+ }
3280
+
3267
3281
  async function main() {
3268
3282
  const args = process.argv.slice(2);
3269
3283
  const command = args[0];
@@ -3295,6 +3309,9 @@ async function main() {
3295
3309
  case "install":
3296
3310
  await cmdInstall(args.slice(1));
3297
3311
  break;
3312
+ case "repair-openclaw":
3313
+ await cmdRepairOpenclaw();
3314
+ break;
3298
3315
  case "gateway":
3299
3316
  await cmdGateway(args.slice(1));
3300
3317
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traderclaw-cli",
3
- "version": "1.0.71",
3
+ "version": "1.0.73",
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.71"
20
+ "solana-traderclaw": "^1.0.73"
21
21
  },
22
22
  "keywords": [
23
23
  "traderclaw",