@lark-apaas/openclaw-scripts-diagnose-cli 0.1.4-alpha.2 → 0.1.4-alpha.3
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 +27 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -53,7 +53,7 @@ let json_diff = require("json-diff");
|
|
|
53
53
|
* it terse and parseable.
|
|
54
54
|
*/
|
|
55
55
|
function getVersion() {
|
|
56
|
-
return "0.1.4-alpha.
|
|
56
|
+
return "0.1.4-alpha.3";
|
|
57
57
|
}
|
|
58
58
|
//#endregion
|
|
59
59
|
//#region src/rule-engine/base.ts
|
|
@@ -1420,19 +1420,24 @@ OldMiaodaPluginsCleanupRule = __decorate([Rule({
|
|
|
1420
1420
|
//#endregion
|
|
1421
1421
|
//#region src/rules/lark-plugin-allow.ts
|
|
1422
1422
|
const LARK_PLUGIN = "openclaw-lark";
|
|
1423
|
-
const
|
|
1423
|
+
const LEGACY_LARK_PLUGIN = "feishu-openclaw-plugin";
|
|
1424
|
+
const LARK_PLUGIN_NAMES = [LARK_PLUGIN, LEGACY_LARK_PLUGIN];
|
|
1424
1425
|
let LarkPluginAllowRule = class LarkPluginAllowRule extends DiagnoseRule {
|
|
1425
1426
|
validate(ctx) {
|
|
1426
1427
|
const allow = getAllow(ctx.config);
|
|
1427
1428
|
if (LARK_PLUGIN_NAMES.some((name) => allow.includes(name))) return { pass: true };
|
|
1429
|
+
const installed = detectInstalledLarkPlugin(getExtensionsDir(ctx.configPath));
|
|
1430
|
+
if (installed == null) return { pass: true };
|
|
1428
1431
|
return {
|
|
1429
1432
|
pass: false,
|
|
1430
|
-
message: `plugins.allow 缺少飞书插件
|
|
1433
|
+
message: `plugins.allow 缺少飞书插件 ${installed}(已在 extensions/ 下装但未启用)`
|
|
1431
1434
|
};
|
|
1432
1435
|
}
|
|
1433
1436
|
repair(ctx) {
|
|
1437
|
+
const installed = detectInstalledLarkPlugin(getExtensionsDir(ctx.configPath));
|
|
1438
|
+
if (installed == null) return;
|
|
1434
1439
|
if (ctx.config.plugins == null || typeof ctx.config.plugins !== "object" || Array.isArray(ctx.config.plugins)) {
|
|
1435
|
-
ctx.config.plugins = { allow: [
|
|
1440
|
+
ctx.config.plugins = { allow: [installed] };
|
|
1436
1441
|
return;
|
|
1437
1442
|
}
|
|
1438
1443
|
const pluginsMap = ctx.config.plugins;
|
|
@@ -1440,7 +1445,7 @@ let LarkPluginAllowRule = class LarkPluginAllowRule extends DiagnoseRule {
|
|
|
1440
1445
|
const original = Array.isArray(rawAllow) ? rawAllow : [];
|
|
1441
1446
|
const stringAllow = original.filter((e) => typeof e === "string");
|
|
1442
1447
|
if (LARK_PLUGIN_NAMES.some((name) => stringAllow.includes(name))) return;
|
|
1443
|
-
original.push(
|
|
1448
|
+
original.push(installed);
|
|
1444
1449
|
pluginsMap.allow = original;
|
|
1445
1450
|
}
|
|
1446
1451
|
};
|
|
@@ -1456,6 +1461,22 @@ function getAllow(config) {
|
|
|
1456
1461
|
if (!Array.isArray(allow)) return [];
|
|
1457
1462
|
return allow.filter((e) => typeof e === "string");
|
|
1458
1463
|
}
|
|
1464
|
+
/**
|
|
1465
|
+
* fs-only 检测:`<extDir>/<name>/package.json` 存在即视为已装。
|
|
1466
|
+
* 优先级 openclaw-lark(新版)> feishu-openclaw-plugin(legacy)。
|
|
1467
|
+
* 不读 package.json 内容,只判存在性,避开 JSON 损坏。
|
|
1468
|
+
*/
|
|
1469
|
+
function detectInstalledLarkPlugin(extDir) {
|
|
1470
|
+
for (const name of [LARK_PLUGIN, LEGACY_LARK_PLUGIN]) if (pluginPackageJsonExists(extDir, name)) return name;
|
|
1471
|
+
return null;
|
|
1472
|
+
}
|
|
1473
|
+
function pluginPackageJsonExists(extDir, pluginDir) {
|
|
1474
|
+
try {
|
|
1475
|
+
return node_fs.default.existsSync(node_path.default.join(extDir, pluginDir, "package.json"));
|
|
1476
|
+
} catch {
|
|
1477
|
+
return false;
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1459
1480
|
//#endregion
|
|
1460
1481
|
//#region src/fs-utils.ts
|
|
1461
1482
|
/**
|
|
@@ -4276,7 +4297,7 @@ async function reportCliRun(opts) {
|
|
|
4276
4297
|
//#region src/help.ts
|
|
4277
4298
|
const BIN = "mclaw-diagnose";
|
|
4278
4299
|
function versionBanner() {
|
|
4279
|
-
return `v0.1.4-alpha.
|
|
4300
|
+
return `v0.1.4-alpha.3`;
|
|
4280
4301
|
}
|
|
4281
4302
|
const COMMANDS = [
|
|
4282
4303
|
{
|