@lark-apaas/openclaw-scripts-diagnose-cli 0.1.18-alpha.4 → 0.1.18-alpha.6
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 +66 -50
- 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.18-alpha.
|
|
55
|
+
return "0.1.18-alpha.6";
|
|
56
56
|
}
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/rule-engine/base.ts
|
|
@@ -3448,24 +3448,36 @@ function compareCalVer(a, b) {
|
|
|
3448
3448
|
return semver.default.compare(coerceCalVer(a), coerceCalVer(b));
|
|
3449
3449
|
}
|
|
3450
3450
|
/**
|
|
3451
|
-
*
|
|
3451
|
+
* 该条目的有效上界——开区间(EXCLUSIVE):openclaw ≥ 此值即不兼容。
|
|
3452
|
+
* undefined = 最高档,无上界。
|
|
3452
3453
|
*
|
|
3453
|
-
*
|
|
3454
|
-
*
|
|
3455
|
-
*
|
|
3456
|
-
*
|
|
3454
|
+
* 上界一律为开区间,两种来源:
|
|
3455
|
+
* - 有显式 maxOpenclawVersion → 直接用它(它本身就是「首个不兼容的 openclaw 版本」)。
|
|
3456
|
+
* - 无显式 max → 向更高插件版本(表降序,index 更小)扫描,取首个「严格更高 min」的
|
|
3457
|
+
* minOpenclawVersion,即下一不兼容区间的起点。
|
|
3457
3458
|
*
|
|
3458
|
-
*
|
|
3459
|
+
* 只接受严格更高的 min(跳过相同 min 的同档;跳过更低 min 防止非单调表产生空区间
|
|
3460
|
+
* [min, max) 把本条目永久判为不兼容)。
|
|
3459
3461
|
*/
|
|
3460
3462
|
function inferEffectiveMax(index) {
|
|
3461
3463
|
const cur = VERSION_COMPAT_MAP[index];
|
|
3462
|
-
if (cur.maxOpenclawVersion != null) return
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3464
|
+
if (cur.maxOpenclawVersion != null) return cur.maxOpenclawVersion;
|
|
3465
|
+
for (let i = index - 1; i >= 0; i--) if (compareCalVer(VERSION_COMPAT_MAP[i].minOpenclawVersion, cur.minOpenclawVersion) > 0) return VERSION_COMPAT_MAP[i].minOpenclawVersion;
|
|
3466
|
+
}
|
|
3467
|
+
/**
|
|
3468
|
+
* 单一真相源:floor 匹配 + 有效上界,得到某插件版本的半开兼容区间 [min, max)(含命中条目)。
|
|
3469
|
+
* evaluateVersionRange / findClosestEntry / effectiveCompatRange 全部基于它,
|
|
3470
|
+
* 避免 floor 匹配与 inferEffectiveMax 在多处重复。max 一律为开区间上界(EXCLUSIVE);
|
|
3471
|
+
* 最高档 max 为 undefined(无上界)。undefined = 版本比全表都旧(无 floor 条目)。
|
|
3472
|
+
*/
|
|
3473
|
+
function resolveRange(pluginVersion) {
|
|
3474
|
+
const index = VERSION_COMPAT_MAP.findIndex((e) => compareCalVer(e.openclawLarkVersion, pluginVersion) <= 0);
|
|
3475
|
+
if (index === -1) return void 0;
|
|
3476
|
+
const entry = VERSION_COMPAT_MAP[index];
|
|
3477
|
+
return {
|
|
3478
|
+
entry,
|
|
3479
|
+
min: entry.minOpenclawVersion,
|
|
3480
|
+
max: inferEffectiveMax(index)
|
|
3469
3481
|
};
|
|
3470
3482
|
}
|
|
3471
3483
|
/**
|
|
@@ -3475,38 +3487,33 @@ function inferEffectiveMax(index) {
|
|
|
3475
3487
|
*
|
|
3476
3488
|
* - index === -1(插件版本比全表都旧,无 floor 条目)→ 无区间可判,视为插件过旧 → 'lark'
|
|
3477
3489
|
* - oc < entry.minOpenclawVersion → 'openclaw'
|
|
3478
|
-
* - oc ≥
|
|
3490
|
+
* - oc ≥ 有效上界(开区间)→ 'lark'
|
|
3479
3491
|
* - 否则兼容
|
|
3480
3492
|
*
|
|
3481
|
-
*
|
|
3493
|
+
* 区间统一为半开 [min, max):min 闭、max 开(显式与推断上界一律 EXCLUSIVE)。
|
|
3482
3494
|
*/
|
|
3483
3495
|
function evaluateVersionRange(pluginVersion, openclawVersion) {
|
|
3484
|
-
const
|
|
3485
|
-
if (
|
|
3496
|
+
const r = resolveRange(pluginVersion);
|
|
3497
|
+
if (!r) return {
|
|
3486
3498
|
compatible: false,
|
|
3487
3499
|
direction: "lark",
|
|
3488
3500
|
entry: void 0
|
|
3489
3501
|
};
|
|
3490
|
-
const entry = VERSION_COMPAT_MAP[index];
|
|
3491
3502
|
const oc = coerceCalVer(openclawVersion);
|
|
3492
|
-
if (semver.default.lt(oc, coerceCalVer(
|
|
3503
|
+
if (semver.default.lt(oc, coerceCalVer(r.min))) return {
|
|
3493
3504
|
compatible: false,
|
|
3494
3505
|
direction: "openclaw",
|
|
3495
|
-
entry
|
|
3506
|
+
entry: r.entry
|
|
3507
|
+
};
|
|
3508
|
+
if (r.max !== void 0 && semver.default.gte(oc, coerceCalVer(r.max))) return {
|
|
3509
|
+
compatible: false,
|
|
3510
|
+
direction: "lark",
|
|
3511
|
+
entry: r.entry
|
|
3496
3512
|
};
|
|
3497
|
-
const maxInfo = inferEffectiveMax(index);
|
|
3498
|
-
if (maxInfo) {
|
|
3499
|
-
const max = coerceCalVer(maxInfo.max);
|
|
3500
|
-
if (maxInfo.exclusive ? !semver.default.lt(oc, max) : semver.default.gt(oc, max)) return {
|
|
3501
|
-
compatible: false,
|
|
3502
|
-
direction: "lark",
|
|
3503
|
-
entry
|
|
3504
|
-
};
|
|
3505
|
-
}
|
|
3506
3513
|
return {
|
|
3507
3514
|
compatible: true,
|
|
3508
3515
|
direction: null,
|
|
3509
|
-
entry
|
|
3516
|
+
entry: r.entry
|
|
3510
3517
|
};
|
|
3511
3518
|
}
|
|
3512
3519
|
/**
|
|
@@ -3522,15 +3529,16 @@ function evaluateVersionRange(pluginVersion, openclawVersion) {
|
|
|
3522
3529
|
/** fork 对标的官方 openclaw-lark 版本(与 VERSION_COMPAT_MAP 强耦合,故留在此处)。 */
|
|
3523
3530
|
const FORK_LARK_PLUGIN_PINNED_VERSION = "2026.4.1";
|
|
3524
3531
|
/**
|
|
3525
|
-
*
|
|
3526
|
-
*
|
|
3527
|
-
*
|
|
3528
|
-
* The table is sorted descending, so the first entry whose version ≤
|
|
3529
|
-
* pluginVersion is the answer. Returns undefined only when pluginVersion
|
|
3530
|
-
* is older than every entry in the table.
|
|
3532
|
+
* 返回某插件版本(floor 匹配后)的有效兼容区间 [min, max),含 evaluateVersionRange 所用的
|
|
3533
|
+
* (显式或推断的)开区间上界——区别于仅暴露显式 maxOpenclawVersion 的 findClosestEntry。
|
|
3534
|
+
* undefined = 版本比全表都旧(无 floor 条目)。
|
|
3531
3535
|
*/
|
|
3532
|
-
function
|
|
3533
|
-
|
|
3536
|
+
function effectiveCompatRange(pluginVersion) {
|
|
3537
|
+
const r = resolveRange(pluginVersion);
|
|
3538
|
+
return r ? {
|
|
3539
|
+
min: r.min,
|
|
3540
|
+
max: r.max
|
|
3541
|
+
} : void 0;
|
|
3534
3542
|
}
|
|
3535
3543
|
/** "@scope/name" → "name";无 scope 原样返回。 */
|
|
3536
3544
|
function extractBaseName(name) {
|
|
@@ -3701,12 +3709,19 @@ function isLegacyPlugin(p) {
|
|
|
3701
3709
|
function buildCompatPrefix(installed, ocCur, isLegacy) {
|
|
3702
3710
|
const desc = describePlugin(installed);
|
|
3703
3711
|
if (isLegacy) return `检测到已弃用的旧包 ${desc}(包名 "${installed.allowName}" 已停止维护,需替换为 "openclaw-lark")`;
|
|
3704
|
-
return `飞书插件 ${desc} 与当前 openclaw@${ocCur} 不兼容(${describeCompatConstraint(installed.version
|
|
3712
|
+
return `飞书插件 ${desc} 与当前 openclaw@${ocCur} 不兼容(${describeCompatConstraint(installed.version)})`;
|
|
3705
3713
|
}
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3714
|
+
/**
|
|
3715
|
+
* 兼容区间文案,体现上下界(半开 [min, max):下界闭、上界开)。用 effectiveCompatRange
|
|
3716
|
+
* 取「含推断/显式开区间上界」的区间,避免无显式 maxOpenclawVersion 的条目漏掉上限。
|
|
3717
|
+
* 有上界 → openclaw ∈ [min, max)
|
|
3718
|
+
* 最高档无上界 → openclaw ≥ min
|
|
3719
|
+
*/
|
|
3720
|
+
function describeCompatConstraint(pluginVersion) {
|
|
3721
|
+
if (!pluginVersion) return `插件版本未知,不在版本兼容表中`;
|
|
3722
|
+
const range = effectiveCompatRange(pluginVersion);
|
|
3723
|
+
if (!range) return `插件版本 ${pluginVersion} 不在版本兼容表中`;
|
|
3724
|
+
return range.max === void 0 ? `该插件版本要求 openclaw ≥ ${range.min}` : `该插件版本要求 openclaw ∈ [${range.min}, ${range.max})`;
|
|
3710
3725
|
}
|
|
3711
3726
|
function describePlugin(p) {
|
|
3712
3727
|
return (p.fullName ?? p.allowName) + (p.version ? `@${p.version}` : "");
|
|
@@ -5536,7 +5551,8 @@ async function installExtension(tag, ossFileMap, opts = {}) {
|
|
|
5536
5551
|
configPath: opts.configPath ?? node_path.default.join(homeBase, DEFAULT_CONFIG_REL),
|
|
5537
5552
|
workspaceDir: node_path.default.join(homeBase, "workspace", "agent"),
|
|
5538
5553
|
ossFileMap,
|
|
5539
|
-
downloadOpts: opts
|
|
5554
|
+
downloadOpts: opts,
|
|
5555
|
+
backupBaseDir: opts.backupBaseDir
|
|
5540
5556
|
})) {
|
|
5541
5557
|
targets = targets.filter((p) => p.name !== LARK_PLUGIN_NAME);
|
|
5542
5558
|
if (targets.length === 0) {
|
|
@@ -5671,12 +5687,12 @@ async function installLarkPluginWithCompatCheck(opts) {
|
|
|
5671
5687
|
return false;
|
|
5672
5688
|
}
|
|
5673
5689
|
const compatResult = checkPluginCompat(pkg.packageName, pkg.version, ocCur);
|
|
5674
|
-
const compatible = compatResult.
|
|
5690
|
+
const compatible = compatResult.compatible;
|
|
5675
5691
|
console.error(`[install-extension] ${pkg.packageName ?? pkg.name}@${pkg.version ?? "unknown"} (compat-as ${compatResult.resolvedVersion ?? "unknown"}) vs openclaw@${ocCur}: ${compatible}`);
|
|
5676
5692
|
if (compatible) return false;
|
|
5677
5693
|
console.error(`[install-extension] openclaw-lark@${pkg.version} incompatible with openclaw@${ocCur} — using openclaw-lark-tools update`);
|
|
5678
5694
|
const log = (msg) => console.error(`[install-extension] ${msg}`);
|
|
5679
|
-
const backupDir = node_path.default.join(
|
|
5695
|
+
const backupDir = node_path.default.join(opts.backupBaseDir ?? "/tmp/openclaw-diagnose", `openclaw-lark-backup-${tag}-${Date.now()}`);
|
|
5680
5696
|
const backupOk = backupFeishuPlugins({
|
|
5681
5697
|
workspaceDir,
|
|
5682
5698
|
configPath,
|
|
@@ -10859,10 +10875,10 @@ async function runDoctor(rawCtx, opts) {
|
|
|
10859
10875
|
continue;
|
|
10860
10876
|
}
|
|
10861
10877
|
if (rule.meta.repairMode !== "standard") {
|
|
10862
|
-
console.error(`rule ${key}: validate -> failed
|
|
10878
|
+
console.error(`rule ${key}: validate -> failed, no auto-repair (repairMode=${rule.meta.repairMode}) -> skipped durationMs=${Date.now() - tValidate} message=${v1.message ?? ""}`);
|
|
10863
10879
|
results.push({
|
|
10864
10880
|
rule: key,
|
|
10865
|
-
status: "
|
|
10881
|
+
status: "skipped",
|
|
10866
10882
|
message: v1.message,
|
|
10867
10883
|
action: v1.action
|
|
10868
10884
|
});
|
|
@@ -11220,7 +11236,7 @@ async function reportCliRun(opts) {
|
|
|
11220
11236
|
//#region src/help.ts
|
|
11221
11237
|
const BIN = "mclaw-diagnose";
|
|
11222
11238
|
function versionBanner() {
|
|
11223
|
-
return `v0.1.18-alpha.
|
|
11239
|
+
return `v0.1.18-alpha.6`;
|
|
11224
11240
|
}
|
|
11225
11241
|
const COMMANDS = [
|
|
11226
11242
|
{
|
package/package.json
CHANGED