@lark-apaas/openclaw-scripts-diagnose-cli 0.1.13-alpha.2 → 0.1.13-alpha.4
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 +61 -32
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -52,7 +52,7 @@ node_assert = __toESM(node_assert);
|
|
|
52
52
|
* it terse and parseable.
|
|
53
53
|
*/
|
|
54
54
|
function getVersion() {
|
|
55
|
-
return "0.1.13-alpha.
|
|
55
|
+
return "0.1.13-alpha.4";
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/rule-engine/base.ts
|
|
@@ -10132,7 +10132,7 @@ async function reportCliRun(opts) {
|
|
|
10132
10132
|
//#region src/help.ts
|
|
10133
10133
|
const BIN = "mclaw-diagnose";
|
|
10134
10134
|
function versionBanner() {
|
|
10135
|
-
return `v0.1.13-alpha.
|
|
10135
|
+
return `v0.1.13-alpha.4`;
|
|
10136
10136
|
}
|
|
10137
10137
|
const COMMANDS = [
|
|
10138
10138
|
{
|
|
@@ -10834,9 +10834,17 @@ function runUpgradeLark(opts) {
|
|
|
10834
10834
|
log
|
|
10835
10835
|
};
|
|
10836
10836
|
const cliScript = opts.cliScript ?? process.argv[1];
|
|
10837
|
-
|
|
10837
|
+
const statusCheckDelayMs = opts.statusCheckDelayMs ?? 5e3;
|
|
10838
|
+
log(`${"=".repeat(60)}`);
|
|
10839
|
+
log(`upgrade-lark started runId=${opts.runId}`);
|
|
10840
|
+
log(` cwd : ${cwd}`);
|
|
10841
|
+
log(` configPath : ${configPath}`);
|
|
10842
|
+
log(`${"=".repeat(60)}`);
|
|
10843
|
+
log("");
|
|
10844
|
+
log("── [1/6] 升级前状态快照 ──────────────────────────────────");
|
|
10838
10845
|
log(`before-state: botCount=${countFeishuBots(configPath)}`);
|
|
10839
|
-
log("
|
|
10846
|
+
log("");
|
|
10847
|
+
log("── [2/6] 文件备份 ────────────────────────────────────────");
|
|
10840
10848
|
const backup = backupFiles(fsOpts);
|
|
10841
10849
|
if (!backup.ok) {
|
|
10842
10850
|
log(`ERROR: ${backup.error}`);
|
|
@@ -10848,7 +10856,8 @@ function runUpgradeLark(opts) {
|
|
|
10848
10856
|
}
|
|
10849
10857
|
log("backup: ok");
|
|
10850
10858
|
logVersionSnapshot("before-versions", snapshotVersions(cwd), log);
|
|
10851
|
-
log("
|
|
10859
|
+
log("");
|
|
10860
|
+
log("── [3/6] npx install (@larksuite/openclaw-lark-tools update) ──");
|
|
10852
10861
|
const npxResult = (0, node_child_process.spawnSync)("npx", [
|
|
10853
10862
|
"-y",
|
|
10854
10863
|
"@larksuite/openclaw-lark-tools",
|
|
@@ -10870,21 +10879,14 @@ function runUpgradeLark(opts) {
|
|
|
10870
10879
|
if (npxStderr) log(`npx stderr:\n${npxStderr}`);
|
|
10871
10880
|
log(`npx exit: ${npxExitCode}${npxResult.error ? ` error: ${npxResult.error.message}` : ""}`);
|
|
10872
10881
|
logVersionSnapshot("after-versions", snapshotVersions(cwd), log);
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
],
|
|
10882
|
-
timeout: 15e3
|
|
10883
|
-
});
|
|
10884
|
-
if (gatewayStatusResult.stdout?.trim()) log(`gateway stdout:\n${gatewayStatusResult.stdout.trim()}`);
|
|
10885
|
-
if (gatewayStatusResult.stderr?.trim()) log(`gateway stderr:\n${gatewayStatusResult.stderr.trim()}`);
|
|
10886
|
-
log(`gateway status exit: ${gatewayStatusResult.status ?? "null"}${gatewayStatusResult.error ? ` error: ${gatewayStatusResult.error.message}` : ""}`);
|
|
10887
|
-
log("--- doctor check ---");
|
|
10882
|
+
if (statusCheckDelayMs > 0) {
|
|
10883
|
+
log("");
|
|
10884
|
+
log(`── 等待 ${statusCheckDelayMs / 1e3}s(让 openclaw 服务完成重启) ─────────────`);
|
|
10885
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, statusCheckDelayMs);
|
|
10886
|
+
log("wait done");
|
|
10887
|
+
}
|
|
10888
|
+
log("");
|
|
10889
|
+
log("── [4/6] doctor check ────────────────────────────────────");
|
|
10888
10890
|
const doctorArgs = ["doctor"];
|
|
10889
10891
|
if (opts.scene) doctorArgs.push(`--scene=${opts.scene}`);
|
|
10890
10892
|
const doctorResult = (0, node_child_process.spawnSync)(process.execPath, [cliScript, ...doctorArgs], {
|
|
@@ -10901,7 +10903,8 @@ function runUpgradeLark(opts) {
|
|
|
10901
10903
|
if (doctorResult.stdout?.trim()) log(`doctor stdout:\n${doctorResult.stdout.trim()}`);
|
|
10902
10904
|
if (doctorResult.stderr?.trim()) log(`doctor stderr:\n${doctorResult.stderr.trim()}`);
|
|
10903
10905
|
log(`doctor exit: ${doctorResult.status ?? "null"}${doctorResult.error ? ` error: ${doctorResult.error.message}` : ""}`);
|
|
10904
|
-
log("
|
|
10906
|
+
log("");
|
|
10907
|
+
log("── [5/6] channels probe ──────────────────────────────────");
|
|
10905
10908
|
try {
|
|
10906
10909
|
const channelsResult = runChannelsProbe(3e4);
|
|
10907
10910
|
log(`channels available: ${channelsResult.available}`);
|
|
@@ -10912,7 +10915,25 @@ function runUpgradeLark(opts) {
|
|
|
10912
10915
|
} catch (e) {
|
|
10913
10916
|
log(`channels probe threw: ${e.message}`);
|
|
10914
10917
|
}
|
|
10915
|
-
log("
|
|
10918
|
+
log("");
|
|
10919
|
+
log("── [6/6] openclaw gateway status ────────────────────────");
|
|
10920
|
+
const gatewayStatusResult = (0, node_child_process.spawnSync)("openclaw", ["gateway", "status"], {
|
|
10921
|
+
cwd,
|
|
10922
|
+
encoding: "utf-8",
|
|
10923
|
+
stdio: [
|
|
10924
|
+
"ignore",
|
|
10925
|
+
"pipe",
|
|
10926
|
+
"pipe"
|
|
10927
|
+
],
|
|
10928
|
+
timeout: 15e3
|
|
10929
|
+
});
|
|
10930
|
+
if (gatewayStatusResult.stdout?.trim()) log(`gateway stdout:\n${gatewayStatusResult.stdout.trim()}`);
|
|
10931
|
+
if (gatewayStatusResult.stderr?.trim()) log(`gateway stderr:\n${gatewayStatusResult.stderr.trim()}`);
|
|
10932
|
+
log(`gateway status exit: ${gatewayStatusResult.status ?? "null"}${gatewayStatusResult.error ? ` error: ${gatewayStatusResult.error.message}` : ""}`);
|
|
10933
|
+
log("");
|
|
10934
|
+
log(`${"=".repeat(60)}`);
|
|
10935
|
+
log("upgrade-lark completed (validation disabled)");
|
|
10936
|
+
log(`${"=".repeat(60)}`);
|
|
10916
10937
|
return {
|
|
10917
10938
|
ok: true,
|
|
10918
10939
|
stdout: npxStdout,
|
|
@@ -11443,10 +11464,11 @@ async function main() {
|
|
|
11443
11464
|
runId: rc.runId,
|
|
11444
11465
|
scene
|
|
11445
11466
|
});
|
|
11467
|
+
const upgradeDurationMs = Date.now() - t0;
|
|
11446
11468
|
console.log(JSON.stringify(result));
|
|
11447
11469
|
reportUpgradeLarkToSlardar({
|
|
11448
11470
|
scene,
|
|
11449
|
-
durationMs:
|
|
11471
|
+
durationMs: upgradeDurationMs,
|
|
11450
11472
|
success: result.ok,
|
|
11451
11473
|
logFile: result.logFile,
|
|
11452
11474
|
exitCode: result.exitCode,
|
|
@@ -11454,15 +11476,22 @@ async function main() {
|
|
|
11454
11476
|
validationError: result.validationError,
|
|
11455
11477
|
error: result.error
|
|
11456
11478
|
});
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11479
|
+
try {
|
|
11480
|
+
await reportCliRun({
|
|
11481
|
+
command: "upgrade-lark",
|
|
11482
|
+
runId: rc.runId,
|
|
11483
|
+
version: getVersion(),
|
|
11484
|
+
invocation: args.join(" "),
|
|
11485
|
+
durationMs: upgradeDurationMs,
|
|
11486
|
+
caller: rc.caller,
|
|
11487
|
+
traceId: rc.traceId,
|
|
11488
|
+
success: result.ok,
|
|
11489
|
+
result,
|
|
11490
|
+
error: result.ok ? void 0 : { message: result.error ?? "upgrade-lark failed" }
|
|
11491
|
+
});
|
|
11492
|
+
} catch (e) {
|
|
11493
|
+
console.error(`[telemetry] reportCliRun failed: ${e.message}`);
|
|
11494
|
+
}
|
|
11466
11495
|
if (!result.ok) {
|
|
11467
11496
|
node_process.default.exitCode = 1;
|
|
11468
11497
|
return;
|
package/package.json
CHANGED