@lark-apaas/openclaw-scripts-diagnose-cli 0.1.1-alpha.26 → 0.1.1-alpha.27
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 +50 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -682,6 +682,27 @@ FeishuChannelRule = _FeishuChannelRule = __decorate([Rule({
|
|
|
682
682
|
repairMode: "standard"
|
|
683
683
|
})], FeishuChannelRule);
|
|
684
684
|
//#endregion
|
|
685
|
+
//#region src/rules/feishu-default-account.ts
|
|
686
|
+
let FeishuDefaultAccountRule = class FeishuDefaultAccountRule extends DiagnoseRule {
|
|
687
|
+
validate(ctx) {
|
|
688
|
+
const feishu = getNestedMap(ctx.config, "channels", "feishu");
|
|
689
|
+
if (feishu && "defaultAccount" in feishu) return {
|
|
690
|
+
pass: false,
|
|
691
|
+
message: "channels.feishu.defaultAccount should be removed"
|
|
692
|
+
};
|
|
693
|
+
return { pass: true };
|
|
694
|
+
}
|
|
695
|
+
repair(ctx) {
|
|
696
|
+
const feishu = getNestedMap(ctx.config, "channels", "feishu");
|
|
697
|
+
if (feishu && "defaultAccount" in feishu) delete feishu.defaultAccount;
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
FeishuDefaultAccountRule = __decorate([Rule({
|
|
701
|
+
key: "feishu_default_account",
|
|
702
|
+
dependsOn: ["config_syntax_check"],
|
|
703
|
+
repairMode: "standard"
|
|
704
|
+
})], FeishuDefaultAccountRule);
|
|
705
|
+
//#endregion
|
|
685
706
|
//#region src/rules/gateway.ts
|
|
686
707
|
var _GatewayRule;
|
|
687
708
|
let GatewayRule = class GatewayRule extends DiagnoseRule {
|
|
@@ -1410,7 +1431,32 @@ function moveSafe(src, dst) {
|
|
|
1410
1431
|
node_fs.default.renameSync(src, dst);
|
|
1411
1432
|
} catch (e) {
|
|
1412
1433
|
if (e?.code !== "EXDEV") throw e;
|
|
1413
|
-
(
|
|
1434
|
+
execCaptureErr(`mv ${shellQuote(src)} ${shellQuote(dst)}`);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Run a shell command, re-throwing with stderr attached on failure.
|
|
1439
|
+
*
|
|
1440
|
+
* Node's `execSync(..., { stdio: 'ignore' })` swallows stderr entirely —
|
|
1441
|
+
* callers only see "Command failed: <cmd>" with no hint of the real error
|
|
1442
|
+
* (ENOSPC, EROFS, "unrecognized option", etc.). Production debugging on
|
|
1443
|
+
* sandboxed boxes is painful without the underlying message, so we pipe
|
|
1444
|
+
* stderr, capture it, and embed it in the thrown Error. stdout stays
|
|
1445
|
+
* suppressed because the commands we run here (tar/mv) are silent on
|
|
1446
|
+
* success.
|
|
1447
|
+
*/
|
|
1448
|
+
function execCaptureErr(cmd) {
|
|
1449
|
+
try {
|
|
1450
|
+
(0, node_child_process.execSync)(cmd, { stdio: [
|
|
1451
|
+
"ignore",
|
|
1452
|
+
"ignore",
|
|
1453
|
+
"pipe"
|
|
1454
|
+
] });
|
|
1455
|
+
} catch (e) {
|
|
1456
|
+
const stderr = e?.stderr;
|
|
1457
|
+
const stderrStr = (typeof stderr === "string" ? stderr : stderr?.toString("utf8") ?? "").trim();
|
|
1458
|
+
const base = e?.message ?? "command failed";
|
|
1459
|
+
throw new Error(stderrStr ? `${base}\nstderr: ${stderrStr}` : base);
|
|
1414
1460
|
}
|
|
1415
1461
|
}
|
|
1416
1462
|
/** POSIX single-quote shell escape. Paths with embedded quotes are rare but
|
|
@@ -1546,7 +1592,7 @@ async function installOpenclaw(openclawTag, ossFileMap, opts = {}) {
|
|
|
1546
1592
|
if (hadExisting) moveSafe(targetDir, bakDir);
|
|
1547
1593
|
try {
|
|
1548
1594
|
node_fs.default.mkdirSync(targetDir, { recursive: true });
|
|
1549
|
-
(
|
|
1595
|
+
execCaptureErr(`tar -xzf '${tarball}' -C '${targetDir}' --strip-components=1`);
|
|
1550
1596
|
if (!node_fs.default.existsSync(node_path.default.join(targetDir, "package.json"))) throw new Error("extracted tarball missing package.json");
|
|
1551
1597
|
} catch (e) {
|
|
1552
1598
|
try {
|
|
@@ -1644,7 +1690,7 @@ function installOne(pkg, tarball, homeBase) {
|
|
|
1644
1690
|
});
|
|
1645
1691
|
node_fs.default.mkdirSync(stagingDir);
|
|
1646
1692
|
try {
|
|
1647
|
-
(
|
|
1693
|
+
execCaptureErr(`tar -xzf '${tarball}' -C '${stagingDir}' --strip-components=1`);
|
|
1648
1694
|
if (!node_fs.default.existsSync(node_path.default.join(stagingDir, "package.json"))) throw new Error(`extension tarball missing package.json: ${pkg.name}`);
|
|
1649
1695
|
} catch (e) {
|
|
1650
1696
|
try {
|
|
@@ -1682,7 +1728,7 @@ async function downloadResource(tag, ossFileMap, opts) {
|
|
|
1682
1728
|
const format = (pkg.format ?? "").toLowerCase();
|
|
1683
1729
|
const lower = pkg.ossKey.toLowerCase();
|
|
1684
1730
|
if (format === "tgz" || lower.endsWith(".tgz") || lower.endsWith(".tar.gz")) {
|
|
1685
|
-
(
|
|
1731
|
+
execCaptureErr(`tar -xzf '${file}' -C '${extractDir}'`);
|
|
1686
1732
|
console.error(`[download-resource] ${opts.role}/${opts.name}: extracted to ${extractDir}`);
|
|
1687
1733
|
} else {
|
|
1688
1734
|
const basename = node_path.default.posix.basename(pkg.ossKey);
|
package/package.json
CHANGED