@lark-apaas/openclaw-scripts-diagnose-cli 0.1.18-alpha.5 → 0.1.18-alpha.7

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.
Files changed (2) hide show
  1. package/dist/index.cjs +68 -45
  2. 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.5";
55
+ return "0.1.18-alpha.7";
56
56
  }
57
57
  //#endregion
58
58
  //#region src/rule-engine/base.ts
@@ -3347,6 +3347,14 @@ function cleanupLegacyResiduals(ctx) {
3347
3347
  //#endregion
3348
3348
  //#region src/version-compat.ts
3349
3349
  const VERSION_COMPAT_MAP = Object.freeze([
3350
+ {
3351
+ openclawLarkVersion: "2026.5.20",
3352
+ minOpenclawVersion: "2026.5.7"
3353
+ },
3354
+ {
3355
+ openclawLarkVersion: "2026.5.13",
3356
+ minOpenclawVersion: "2026.5.7"
3357
+ },
3350
3358
  {
3351
3359
  openclawLarkVersion: "2026.5.12",
3352
3360
  minOpenclawVersion: "2026.5.7"
@@ -3448,24 +3456,36 @@ function compareCalVer(a, b) {
3448
3456
  return semver.default.compare(coerceCalVer(a), coerceCalVer(b));
3449
3457
  }
3450
3458
  /**
3451
- * Infer the effective upper bound for a compat entry that has no explicit maxOpenclawVersion.
3459
+ * 该条目的有效上界——开区间(EXCLUSIVE):openclaw 此值即不兼容。
3460
+ * undefined = 最高档,无上界。
3452
3461
  *
3453
- * Scans toward higher plugin versions (lower indices in the descending table) and returns
3454
- * the first entry whose minOpenclawVersion differs from the current entry's.
3455
- * That minOpenclawVersion becomes an EXCLUSIVE upper bound — the openclaw version that
3456
- * starts a new incompatible range.
3462
+ * 上界一律为开区间,两种来源:
3463
+ * - 有显式 maxOpenclawVersion 直接用它(它本身就是「首个不兼容的 openclaw 版本」)。
3464
+ * - 无显式 max 向更高插件版本(表降序,index 更小)扫描,取首个「严格更高 min」的
3465
+ * minOpenclawVersion,即下一不兼容区间的起点。
3457
3466
  *
3458
- * Returns undefined for the topmost entry (no upper bound).
3467
+ * 只接受严格更高的 min(跳过相同 min 的同档;跳过更低 min 防止非单调表产生空区间
3468
+ * [min, max) 把本条目永久判为不兼容)。
3459
3469
  */
3460
3470
  function inferEffectiveMax(index) {
3461
3471
  const cur = VERSION_COMPAT_MAP[index];
3462
- if (cur.maxOpenclawVersion != null) return {
3463
- max: cur.maxOpenclawVersion,
3464
- exclusive: false
3465
- };
3466
- for (let i = index - 1; i >= 0; i--) if (compareCalVer(VERSION_COMPAT_MAP[i].minOpenclawVersion, cur.minOpenclawVersion) > 0) return {
3467
- max: VERSION_COMPAT_MAP[i].minOpenclawVersion,
3468
- exclusive: true
3472
+ if (cur.maxOpenclawVersion != null) return cur.maxOpenclawVersion;
3473
+ for (let i = index - 1; i >= 0; i--) if (compareCalVer(VERSION_COMPAT_MAP[i].minOpenclawVersion, cur.minOpenclawVersion) > 0) return VERSION_COMPAT_MAP[i].minOpenclawVersion;
3474
+ }
3475
+ /**
3476
+ * 单一真相源:floor 匹配 + 有效上界,得到某插件版本的半开兼容区间 [min, max)(含命中条目)。
3477
+ * evaluateVersionRange / findClosestEntry / effectiveCompatRange 全部基于它,
3478
+ * 避免 floor 匹配与 inferEffectiveMax 在多处重复。max 一律为开区间上界(EXCLUSIVE);
3479
+ * 最高档 max 为 undefined(无上界)。undefined = 版本比全表都旧(无 floor 条目)。
3480
+ */
3481
+ function resolveRange(pluginVersion) {
3482
+ const index = VERSION_COMPAT_MAP.findIndex((e) => compareCalVer(e.openclawLarkVersion, pluginVersion) <= 0);
3483
+ if (index === -1) return void 0;
3484
+ const entry = VERSION_COMPAT_MAP[index];
3485
+ return {
3486
+ entry,
3487
+ min: entry.minOpenclawVersion,
3488
+ max: inferEffectiveMax(index)
3469
3489
  };
3470
3490
  }
3471
3491
  /**
@@ -3475,38 +3495,33 @@ function inferEffectiveMax(index) {
3475
3495
  *
3476
3496
  * - index === -1(插件版本比全表都旧,无 floor 条目)→ 无区间可判,视为插件过旧 → 'lark'
3477
3497
  * - oc < entry.minOpenclawVersion → 'openclaw'
3478
- * - oc ≥ 推断/显式上界 'lark'
3498
+ * - oc ≥ 有效上界(开区间)→ 'lark'
3479
3499
  * - 否则兼容
3480
3500
  *
3481
- * 上界语义:显式 maxOpenclawVersion INCLUSIVE;推断上界为 EXCLUSIVE
3501
+ * 区间统一为半开 [min, max):min 闭、max 开(显式与推断上界一律 EXCLUSIVE)。
3482
3502
  */
3483
3503
  function evaluateVersionRange(pluginVersion, openclawVersion) {
3484
- const index = VERSION_COMPAT_MAP.findIndex((e) => compareCalVer(e.openclawLarkVersion, pluginVersion) <= 0);
3485
- if (index === -1) return {
3504
+ const r = resolveRange(pluginVersion);
3505
+ if (!r) return {
3486
3506
  compatible: false,
3487
3507
  direction: "lark",
3488
3508
  entry: void 0
3489
3509
  };
3490
- const entry = VERSION_COMPAT_MAP[index];
3491
3510
  const oc = coerceCalVer(openclawVersion);
3492
- if (semver.default.lt(oc, coerceCalVer(entry.minOpenclawVersion))) return {
3511
+ if (semver.default.lt(oc, coerceCalVer(r.min))) return {
3493
3512
  compatible: false,
3494
3513
  direction: "openclaw",
3495
- entry
3514
+ entry: r.entry
3515
+ };
3516
+ if (r.max !== void 0 && semver.default.gte(oc, coerceCalVer(r.max))) return {
3517
+ compatible: false,
3518
+ direction: "lark",
3519
+ entry: r.entry
3496
3520
  };
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
3521
  return {
3507
3522
  compatible: true,
3508
3523
  direction: null,
3509
- entry
3524
+ entry: r.entry
3510
3525
  };
3511
3526
  }
3512
3527
  /**
@@ -3522,15 +3537,16 @@ function evaluateVersionRange(pluginVersion, openclawVersion) {
3522
3537
  /** fork 对标的官方 openclaw-lark 版本(与 VERSION_COMPAT_MAP 强耦合,故留在此处)。 */
3523
3538
  const FORK_LARK_PLUGIN_PINNED_VERSION = "2026.4.1";
3524
3539
  /**
3525
- * Floor match: find the entry with the largest openclawLarkVersion that is
3526
- * pluginVersion ("closest lower-or-equal version").
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.
3540
+ * 返回某插件版本(floor 匹配后)的有效兼容区间 [min, max),含 evaluateVersionRange 所用的
3541
+ * (显式或推断的)开区间上界——区别于仅暴露显式 maxOpenclawVersion findClosestEntry。
3542
+ * undefined = 版本比全表都旧(无 floor 条目)。
3531
3543
  */
3532
- function findClosestEntry(pluginVersion) {
3533
- return VERSION_COMPAT_MAP.find((e) => compareCalVer(e.openclawLarkVersion, pluginVersion) <= 0);
3544
+ function effectiveCompatRange(pluginVersion) {
3545
+ const r = resolveRange(pluginVersion);
3546
+ return r ? {
3547
+ min: r.min,
3548
+ max: r.max
3549
+ } : void 0;
3534
3550
  }
3535
3551
  /** "@scope/name" → "name";无 scope 原样返回。 */
3536
3552
  function extractBaseName(name) {
@@ -3701,12 +3717,19 @@ function isLegacyPlugin(p) {
3701
3717
  function buildCompatPrefix(installed, ocCur, isLegacy) {
3702
3718
  const desc = describePlugin(installed);
3703
3719
  if (isLegacy) return `检测到已弃用的旧包 ${desc}(包名 "${installed.allowName}" 已停止维护,需替换为 "openclaw-lark")`;
3704
- return `飞书插件 ${desc} 与当前 openclaw@${ocCur} 不兼容(${describeCompatConstraint(installed.version ? findClosestEntry(installed.version) : void 0, installed.version)})`;
3720
+ return `飞书插件 ${desc} 与当前 openclaw@${ocCur} 不兼容(${describeCompatConstraint(installed.version)})`;
3705
3721
  }
3706
- function describeCompatConstraint(entry, pluginVersion) {
3707
- if (!entry) return `插件版本 ${pluginVersion ?? "未知"} 不在版本兼容表中`;
3708
- if (entry.maxOpenclawVersion) return `该插件版本要求 openclaw ∈ [${entry.minOpenclawVersion}, ${entry.maxOpenclawVersion}]`;
3709
- return `该插件版本要求 openclaw ${entry.minOpenclawVersion}`;
3722
+ /**
3723
+ * 兼容区间文案,体现上下界(半开 [min, max):下界闭、上界开)。用 effectiveCompatRange
3724
+ * 取「含推断/显式开区间上界」的区间,避免无显式 maxOpenclawVersion 的条目漏掉上限。
3725
+ * 有上界 openclaw [min, max)
3726
+ * 最高档无上界 → openclaw ≥ min
3727
+ */
3728
+ function describeCompatConstraint(pluginVersion) {
3729
+ if (!pluginVersion) return `插件版本未知,不在版本兼容表中`;
3730
+ const range = effectiveCompatRange(pluginVersion);
3731
+ if (!range) return `插件版本 ${pluginVersion} 不在版本兼容表中`;
3732
+ return range.max === void 0 ? `该插件版本要求 openclaw ≥ ${range.min}` : `该插件版本要求 openclaw ∈ [${range.min}, ${range.max})`;
3710
3733
  }
3711
3734
  function describePlugin(p) {
3712
3735
  return (p.fullName ?? p.allowName) + (p.version ? `@${p.version}` : "");
@@ -11221,7 +11244,7 @@ async function reportCliRun(opts) {
11221
11244
  //#region src/help.ts
11222
11245
  const BIN = "mclaw-diagnose";
11223
11246
  function versionBanner() {
11224
- return `v0.1.18-alpha.5`;
11247
+ return `v0.1.18-alpha.7`;
11225
11248
  }
11226
11249
  const COMMANDS = [
11227
11250
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/openclaw-scripts-diagnose-cli",
3
- "version": "0.1.18-alpha.5",
3
+ "version": "0.1.18-alpha.7",
4
4
  "description": "CLI for OpenClaw config diagnose and repair with JSON5 support",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {