@lark-apaas/openclaw-scripts-diagnose-cli 0.1.1-alpha.14 → 0.1.1-alpha.16
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.cjs +16 -10
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1345,34 +1345,40 @@ function waitForInitNpm(maxWaitMs, log) {
|
|
|
1345
1345
|
log(`deadline (${maxWaitMs}ms) hit after ${polls} poll(s), proceeding anyway`);
|
|
1346
1346
|
}
|
|
1347
1347
|
/**
|
|
1348
|
-
* Step 5:
|
|
1348
|
+
* Step 5: Ensure openclaw binary is at the template's recommended version.
|
|
1349
1349
|
*
|
|
1350
|
-
*
|
|
1351
|
-
*
|
|
1352
|
-
*
|
|
1353
|
-
*
|
|
1354
|
-
*
|
|
1350
|
+
* Fast path (common): if `openclaw --version` already matches the version
|
|
1351
|
+
* declared in the bundled template's openclaw.json, skip uninstall+install
|
|
1352
|
+
* entirely and just run `openclaw doctor --fix` to realign config state.
|
|
1353
|
+
*
|
|
1354
|
+
* Slow path (rare — only triggers if version mismatched or binary missing):
|
|
1355
|
+
* uninstall + reinstall + doctor --fix. This is intentionally kept as a
|
|
1356
|
+
* last resort because a transitive dep (matrix-sdk-crypto-nodejs) runs a
|
|
1357
|
+
* postinstall hook that downloads a 22MB native binary from GitHub
|
|
1358
|
+
* Releases, and the BOE sandbox's egress to objects.githubusercontent.com
|
|
1359
|
+
* is throttled to ~10KB/s — a full reinstall can legitimately take 30+
|
|
1360
|
+
* minutes. Hence we only pay that cost when version actually needs to change.
|
|
1355
1361
|
*/
|
|
1356
1362
|
function reinstallOpenclaw(srcDir, log) {
|
|
1357
1363
|
const targetVersion = loadJSON5().parse(node_fs.default.readFileSync(node_path.default.join(srcDir, "openclaw.json"), "utf-8")).meta?.lastTouchedVersion;
|
|
1358
1364
|
log(`target openclaw version: ${targetVersion ?? "<unset>"}`);
|
|
1359
1365
|
if (targetVersion && isOpenclawAtVersion(targetVersion)) {
|
|
1360
|
-
log("fast path: already at target version,
|
|
1366
|
+
log("fast path: openclaw already at target version, skipping uninstall+install");
|
|
1361
1367
|
const t = Date.now();
|
|
1362
1368
|
shell("openclaw doctor --fix", 10 * 6e4);
|
|
1363
1369
|
log(`doctor --fix done in ${Date.now() - t}ms`);
|
|
1364
1370
|
return;
|
|
1365
1371
|
}
|
|
1366
|
-
log("
|
|
1372
|
+
log("version mismatched or binary missing, running full reinstall (may take 30+ min under slow network)");
|
|
1367
1373
|
try {
|
|
1368
1374
|
const t = Date.now();
|
|
1369
1375
|
shell("npm uninstall -g openclaw 2>/dev/null || true", 6e4);
|
|
1370
1376
|
log(`npm uninstall done in ${Date.now() - t}ms`);
|
|
1371
1377
|
} catch {}
|
|
1372
|
-
const installCmd = `npm i -g openclaw@${targetVersion || "latest"}
|
|
1378
|
+
const installCmd = `npm i -g openclaw@${targetVersion || "latest"}`;
|
|
1373
1379
|
log(`running: ${installCmd}`);
|
|
1374
1380
|
const installStart = Date.now();
|
|
1375
|
-
shell(installCmd,
|
|
1381
|
+
shell(installCmd, 30 * 6e4);
|
|
1376
1382
|
log(`npm install done in ${Date.now() - installStart}ms`);
|
|
1377
1383
|
const docStart = Date.now();
|
|
1378
1384
|
shell("openclaw doctor --fix", 10 * 6e4);
|
package/package.json
CHANGED