@lark-apaas/openclaw-scripts-diagnose-cli 0.1.14-alpha.4 → 0.1.14-alpha.5

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 +26 -38
  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.14-alpha.4";
55
+ return "0.1.14-alpha.5";
56
56
  }
57
57
  //#endregion
58
58
  //#region src/rule-engine/base.ts
@@ -3529,31 +3529,6 @@ function needsLarkUpgrade(ctx) {
3529
3529
  //#endregion
3530
3530
  //#region src/channels-probe.ts
3531
3531
  const FEISHU_INVALID_CONFIG_MSG = "channels.feishu: invalid config: must NOT have additional properties";
3532
- /**
3533
- * Run `openclaw status` and check whether the output contains the feishu
3534
- * channel config validation error. This error appears when openclaw.json
3535
- * has extra fields that are no longer recognised by the new plugin schema.
3536
- *
3537
- * Returns false on any execution error so callers can safely treat it as
3538
- * "error not present" rather than aborting.
3539
- */
3540
- function isFeishuChannelConfigInvalid(cwd, timeoutMs = 1e4) {
3541
- try {
3542
- return (0, node_child_process.execSync)("openclaw status", {
3543
- encoding: "utf-8",
3544
- timeout: timeoutMs,
3545
- cwd,
3546
- stdio: [
3547
- "ignore",
3548
- "pipe",
3549
- "pipe"
3550
- ]
3551
- }).includes(FEISHU_INVALID_CONFIG_MSG);
3552
- } catch (e) {
3553
- const err = e;
3554
- return ((err.stdout ?? "") + (err.stderr ?? "")).includes(FEISHU_INVALID_CONFIG_MSG);
3555
- }
3556
- }
3557
3532
  const CHANNEL_LINE_RE = /^-\s+Feishu\s+([^:]+):\s+(.+)$/;
3558
3533
  /**
3559
3534
  * Port of Python `_account_is_working` from the feishu-channel-success-rate skill.
@@ -3589,6 +3564,7 @@ function accountIsWorking(bits) {
3589
3564
  */
3590
3565
  function parseChannelsProbeOutput(text) {
3591
3566
  const gatewayReachable = text.includes("Gateway reachable");
3567
+ const feishuConfigInvalid = text.includes(FEISHU_INVALID_CONFIG_MSG);
3592
3568
  const accounts = [];
3593
3569
  let anyAccountWorking = false;
3594
3570
  for (const line of text.split("\n")) {
@@ -3607,6 +3583,7 @@ function parseChannelsProbeOutput(text) {
3607
3583
  }
3608
3584
  return {
3609
3585
  gatewayReachable,
3586
+ feishuConfigInvalid,
3610
3587
  accounts,
3611
3588
  anyAccountWorking
3612
3589
  };
@@ -3650,6 +3627,7 @@ function runChannelsProbe(timeoutMs = 6e4) {
3650
3627
  return {
3651
3628
  available: false,
3652
3629
  gatewayReachable: false,
3630
+ feishuConfigInvalid: false,
3653
3631
  accounts: [],
3654
3632
  anyAccountWorking: false,
3655
3633
  error: execError ?? "no output from openclaw channels status --probe"
@@ -3659,27 +3637,37 @@ function runChannelsProbe(timeoutMs = 6e4) {
3659
3637
  //#region src/rules/upgrade-lark-needed.ts
3660
3638
  /**
3661
3639
  * Detects the condition that warrants running `upgrade-lark`:
3662
- * - feishu plugin version incompatible with current openclaw, AND
3640
+ * - feishu plugin version incompatible with current openclaw, OR
3641
+ * - openclaw channels status --probe reports feishu channel config invalid; AND
3663
3642
  * - channels are not working.
3664
3643
  *
3665
- * Both conditions must be true simultaneously. If version is compatible or
3666
- * channels are working, the rule passes (no action needed).
3644
+ * Both conditions must be true simultaneously. If version is compatible and
3645
+ * feishu config is valid, or channels are working, the rule passes (no action needed).
3646
+ *
3647
+ * feishuConfigInvalid is read from the channels probe output rather than running a
3648
+ * separate `openclaw status` call, since only `openclaw channels status --probe`
3649
+ * reliably surfaces the schema validation error.
3667
3650
  *
3668
3651
  * profile: experimental — runs only in full sweep mode, not in standard doctor.
3669
3652
  * level: silent — telemetry/sweep-only, does not trigger page-level repair UI.
3670
3653
  */
3671
3654
  let UpgradeLarkNeededRule = class UpgradeLarkNeededRule extends DiagnoseRule {
3672
3655
  validate(ctx) {
3673
- const versionIncompatible = needsLarkUpgrade(ctx);
3674
- const feishuConfigInvalid = !versionIncompatible && isFeishuChannelConfigInvalid(node_path.default.dirname(ctx.configPath));
3675
- if (!(versionIncompatible || feishuConfigInvalid)) return { pass: true };
3676
- let anyAccountWorking = false;
3656
+ let versionIncompatible = false;
3677
3657
  try {
3678
- anyAccountWorking = runChannelsProbe(3e4).anyAccountWorking;
3658
+ versionIncompatible = needsLarkUpgrade(ctx);
3659
+ } catch {
3660
+ versionIncompatible = true;
3661
+ }
3662
+ let probeResult;
3663
+ try {
3664
+ probeResult = runChannelsProbe(3e4);
3679
3665
  } catch {
3680
3666
  return { pass: true };
3681
3667
  }
3682
- if (anyAccountWorking) return { pass: true };
3668
+ const feishuConfigInvalid = probeResult.feishuConfigInvalid;
3669
+ if (!(versionIncompatible || feishuConfigInvalid)) return { pass: true };
3670
+ if (probeResult.anyAccountWorking) return { pass: true };
3683
3671
  return {
3684
3672
  pass: false,
3685
3673
  action: "upgrade_lark",
@@ -10393,7 +10381,7 @@ async function reportCliRun(opts) {
10393
10381
  //#region src/help.ts
10394
10382
  const BIN = "mclaw-diagnose";
10395
10383
  function versionBanner() {
10396
- return `v0.1.14-alpha.4`;
10384
+ return `v0.1.14-alpha.5`;
10397
10385
  }
10398
10386
  const COMMANDS = [
10399
10387
  {
@@ -11167,7 +11155,7 @@ function runUpgradeLark(opts) {
11167
11155
  log("── [Pre-check A] channels probe(升级前)────────────────");
11168
11156
  const beforeChannels = probeChannels("before", log, 3e4);
11169
11157
  log("");
11170
- log("── [Pre-check B] 版本兼容预检 + feishu config 错误检测 ──");
11158
+ log("── [Pre-check B] 版本兼容预检 ───────────────────────────");
11171
11159
  let versionIncompatible = false;
11172
11160
  try {
11173
11161
  const rawConfig = node_fs.default.readFileSync(configPath, "utf-8");
@@ -11185,7 +11173,7 @@ function runUpgradeLark(opts) {
11185
11173
  log(` version-compat pre-check error: ${e.message} — treating as needs-upgrade`);
11186
11174
  versionIncompatible = true;
11187
11175
  }
11188
- const feishuConfigInvalid = !versionIncompatible && isFeishuChannelConfigInvalid(cwd);
11176
+ const feishuConfigInvalid = beforeChannels.feishuConfigInvalid;
11189
11177
  log(` feishu config invalid : ${feishuConfigInvalid}`);
11190
11178
  log("");
11191
11179
  log("── [Gate] 升级前置条件检查 ───────────────────────────────");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/openclaw-scripts-diagnose-cli",
3
- "version": "0.1.14-alpha.4",
3
+ "version": "0.1.14-alpha.5",
4
4
  "description": "CLI for OpenClaw config diagnose and repair with JSON5 support",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {