@lark-apaas/openclaw-scripts-diagnose-cli 0.1.8-alpha.1 → 0.1.8-alpha.2

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 +50 -8
  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.8-alpha.1";
55
+ return "0.1.8-alpha.2";
56
56
  }
57
57
  //#endregion
58
58
  //#region src/rule-engine/base.ts
@@ -2465,7 +2465,7 @@ MiaodaPluginAllowRule = __decorate([Rule({
2465
2465
  description: "当 openclaw-extension-miaoda 已在磁盘安装但未在 allow 列表中时,将其添加到 plugins.allow(实验性)",
2466
2466
  dependsOn: ["config_syntax_check"],
2467
2467
  repairMode: "standard",
2468
- profile: "experimental"
2468
+ profile: "standard"
2469
2469
  })], MiaodaPluginAllowRule);
2470
2470
  function getAllow(config) {
2471
2471
  const plugins = config.plugins;
@@ -6369,7 +6369,6 @@ async function installClis(tag, ossFileMap, opts) {
6369
6369
  const homeBase = resolveHomeBase(opts.homeBase);
6370
6370
  if (opts.names.length === 0) throw new Error("install-cli: must provide at least one --cli=<name>");
6371
6371
  const manifest = await fetchManifest(ossFileMap, tag);
6372
- console.error(`[install-cli] manifest=${JSON.stringify(manifest)}`);
6373
6372
  const allClis = manifest.packages.filter((p) => p.role === "cli" && p.name !== "openclaw");
6374
6373
  const wanted = new Set(opts.names);
6375
6374
  const targets = allClis.filter((p) => wanted.has(p.name) || p.packageName != null && wanted.has(p.packageName));
@@ -6396,7 +6395,8 @@ async function installClis(tag, ossFileMap, opts) {
6396
6395
  console.error(`[install-cli] ${pkg.name}: installed`);
6397
6396
  }
6398
6397
  if (targets.some((p) => p.name === LARK_CLI_NAME)) {
6399
- await installAgentSkills(manifest, ossFileMap, opts, homeBase, opts.tmpRoot);
6398
+ const skillsInstallPath = await installAgentSkills(manifest, ossFileMap, opts, homeBase, opts.tmpRoot);
6399
+ if (skillsInstallPath) linkAgentSkills(homeBase, skillsInstallPath);
6400
6400
  const appIds = collectFeishuAppIds();
6401
6401
  console.error(`[install-cli] lark-cli installed — running lark-cli-init for ${appIds.length} appId(s): [${appIds.join(", ")}]`);
6402
6402
  for (const appId of appIds) {
@@ -6406,7 +6406,12 @@ async function installClis(tag, ossFileMap, opts) {
6406
6406
  feishuAppSecret: opts.feishuAppSecret
6407
6407
  });
6408
6408
  console.error(`[install-cli] lark-cli-init: appId=${appId} ok=${result.ok}` + (result.skipped ? ` skipped=true reason=${result.skipReason}` : "") + (result.error ? ` error=${result.error}` : ""));
6409
- if (!result.ok && !result.skipped) reportError({
6409
+ const outputText = [
6410
+ result.error,
6411
+ result.configInitStdout,
6412
+ result.configInitStderr
6413
+ ].join(" ");
6414
+ if (/error/i.test(outputText)) reportError({
6410
6415
  error: `lark-cli-init failed for appId=${appId}: ${result.error ?? "unknown"}`,
6411
6416
  extraCategories: {
6412
6417
  event: "install_cli_lark_init_failed",
@@ -6453,7 +6458,7 @@ async function installAgentSkills(manifest, ossFileMap, downloadOpts, homeBase,
6453
6458
  const pkg = manifest.packages.find((p) => p.role === "template" && p.name === AGENT_SKILLS_NAME);
6454
6459
  if (!pkg) {
6455
6460
  console.error(`[install-cli] installAgentSkills: ${AGENT_SKILLS_NAME} not found in manifest (tag may not bundle it) — skipping skill install`);
6456
- return;
6461
+ return null;
6457
6462
  }
6458
6463
  console.error(`[install-cli] installAgentSkills: downloading ${pkg.name}@${pkg.version}`);
6459
6464
  const tarball = await downloadWithCache(pkg, ossFileMap, downloadOpts);
@@ -6498,6 +6503,7 @@ async function installAgentSkills(manifest, ossFileMap, downloadOpts, homeBase,
6498
6503
  force: true
6499
6504
  });
6500
6505
  console.error(`[install-cli] installAgentSkills: done — skills installed to ${targetDir}`);
6506
+ return pkg.installPath;
6501
6507
  } finally {
6502
6508
  if (node_fs.default.existsSync(tmpStage)) try {
6503
6509
  node_fs.default.rmSync(tmpStage, {
@@ -6507,6 +6513,39 @@ async function installAgentSkills(manifest, ossFileMap, downloadOpts, homeBase,
6507
6513
  } catch {}
6508
6514
  }
6509
6515
  }
6516
+ /**
6517
+ * (Re)create workspace/agent/skills/<name> → ../<installPath>/<name> symlinks so
6518
+ * the agent workspace sees agent-skills under the conventional skills/ directory.
6519
+ *
6520
+ * Both sides share workspace/agent/ as parent, so the relative link form is stable
6521
+ * regardless of where homeBase is mounted.
6522
+ *
6523
+ * @param homeBase Root directory (default /home/gem). installPath is relative to
6524
+ * <homeBase>/workspace/agent/.
6525
+ * @param installPath Relative path of the extracted skills dir under workspace/agent
6526
+ * (e.g. ".agents/skills").
6527
+ */
6528
+ function linkAgentSkills(homeBase, installPath) {
6529
+ const targetDir = node_path.default.join(homeBase, WORKSPACE_AGENT_REL, installPath);
6530
+ const skillsLinkDir = node_path.default.join(homeBase, WORKSPACE_AGENT_REL, "skills");
6531
+ if (!node_fs.default.existsSync(targetDir)) {
6532
+ console.error(`[install-cli] linkAgentSkills: targetDir=${targetDir} does not exist — skipping`);
6533
+ return;
6534
+ }
6535
+ const skillDirs = node_fs.default.readdirSync(targetDir, { withFileTypes: true }).filter((e) => e.isDirectory());
6536
+ console.error(`[install-cli] linkAgentSkills: creating ${skillDirs.length} symlinks in ${skillsLinkDir}`);
6537
+ node_fs.default.mkdirSync(skillsLinkDir, { recursive: true });
6538
+ for (const entry of skillDirs) {
6539
+ const relTarget = node_path.default.join("..", installPath, entry.name);
6540
+ const symlinkPath = node_path.default.join(skillsLinkDir, entry.name);
6541
+ try {
6542
+ node_fs.default.unlinkSync(symlinkPath);
6543
+ } catch {}
6544
+ node_fs.default.symlinkSync(relTarget, symlinkPath);
6545
+ console.error(`[install-cli] linkAgentSkills: ${entry.name} -> ${relTarget}`);
6546
+ }
6547
+ console.error(`[install-cli] linkAgentSkills: done — ${skillDirs.length} skill(s) symlinked from ${skillsLinkDir}`);
6548
+ }
6510
6549
  function installOne(pkg, tarball, homeBase, tmpRoot) {
6511
6550
  const targetDir = node_path.default.join(homeBase, pkg.installPath);
6512
6551
  const bakDir = targetDir + ".bak";
@@ -9735,7 +9774,7 @@ async function reportCliRun(opts) {
9735
9774
  //#region src/help.ts
9736
9775
  const BIN = "mclaw-diagnose";
9737
9776
  function versionBanner() {
9738
- return `v0.1.8-alpha.1`;
9777
+ return `v0.1.8-alpha.2`;
9739
9778
  }
9740
9779
  const COMMANDS = [
9741
9780
  {
@@ -10611,6 +10650,10 @@ async function main() {
10611
10650
  node_process.default.exit(1);
10612
10651
  }
10613
10652
  const names = getMultiFlag(args, "cli");
10653
+ if (names.length === 0) {
10654
+ console.error("Usage: install-cli <tag> --cli=<name>... [--home_base=<dir>] [--ctx=<base64> | --oss_file_map=<base64>]");
10655
+ node_process.default.exit(1);
10656
+ }
10614
10657
  const homeBase = getFlag(args, "home_base");
10615
10658
  const ossFileMapFlag = getFlag(args, "oss_file_map");
10616
10659
  let installOssFileMap;
@@ -10627,7 +10670,6 @@ async function main() {
10627
10670
  ossFileMapFlag,
10628
10671
  installOssFileMap
10629
10672
  });
10630
- console.error(`[install-cli] ossFileMap=${JSON.stringify(ossFileMap)}`);
10631
10673
  let feishuAppSecret;
10632
10674
  if (names.includes("lark-cli")) feishuAppSecret = normalizeCtx(await fetchCtxViaInnerApi({
10633
10675
  populate: { app: ["feishuAppSecret"] },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/openclaw-scripts-diagnose-cli",
3
- "version": "0.1.8-alpha.1",
3
+ "version": "0.1.8-alpha.2",
4
4
  "description": "CLI for OpenClaw config diagnose and repair with JSON5 support",
5
5
  "main": "dist/index.cjs",
6
6
  "bin": {