@lark-apaas/openclaw-scripts-diagnose-cli 0.1.8-alpha.1 → 0.1.8-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 +66 -8
- 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.
|
|
55
|
+
return "0.1.8-alpha.3";
|
|
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: "
|
|
2468
|
+
profile: "standard"
|
|
2469
2469
|
})], MiaodaPluginAllowRule);
|
|
2470
2470
|
function getAllow(config) {
|
|
2471
2471
|
const plugins = config.plugins;
|
|
@@ -2916,6 +2916,22 @@ function ensureRecord(obj, key) {
|
|
|
2916
2916
|
//#endregion
|
|
2917
2917
|
//#region src/version-compat.ts
|
|
2918
2918
|
const VERSION_COMPAT_MAP = Object.freeze([
|
|
2919
|
+
{
|
|
2920
|
+
openclawLarkVersion: "2026.5.12",
|
|
2921
|
+
minOpenclawVersion: "2026.5.7"
|
|
2922
|
+
},
|
|
2923
|
+
{
|
|
2924
|
+
openclawLarkVersion: "2026.5.7",
|
|
2925
|
+
minOpenclawVersion: "2026.5.6"
|
|
2926
|
+
},
|
|
2927
|
+
{
|
|
2928
|
+
openclawLarkVersion: "2026.4.10",
|
|
2929
|
+
minOpenclawVersion: "2026.4.27"
|
|
2930
|
+
},
|
|
2931
|
+
{
|
|
2932
|
+
openclawLarkVersion: "2026.4.9",
|
|
2933
|
+
minOpenclawVersion: "2026.3.28"
|
|
2934
|
+
},
|
|
2919
2935
|
{
|
|
2920
2936
|
openclawLarkVersion: "2026.4.8",
|
|
2921
2937
|
minOpenclawVersion: "2026.3.28"
|
|
@@ -6369,7 +6385,6 @@ async function installClis(tag, ossFileMap, opts) {
|
|
|
6369
6385
|
const homeBase = resolveHomeBase(opts.homeBase);
|
|
6370
6386
|
if (opts.names.length === 0) throw new Error("install-cli: must provide at least one --cli=<name>");
|
|
6371
6387
|
const manifest = await fetchManifest(ossFileMap, tag);
|
|
6372
|
-
console.error(`[install-cli] manifest=${JSON.stringify(manifest)}`);
|
|
6373
6388
|
const allClis = manifest.packages.filter((p) => p.role === "cli" && p.name !== "openclaw");
|
|
6374
6389
|
const wanted = new Set(opts.names);
|
|
6375
6390
|
const targets = allClis.filter((p) => wanted.has(p.name) || p.packageName != null && wanted.has(p.packageName));
|
|
@@ -6396,7 +6411,8 @@ async function installClis(tag, ossFileMap, opts) {
|
|
|
6396
6411
|
console.error(`[install-cli] ${pkg.name}: installed`);
|
|
6397
6412
|
}
|
|
6398
6413
|
if (targets.some((p) => p.name === LARK_CLI_NAME)) {
|
|
6399
|
-
await installAgentSkills(manifest, ossFileMap, opts, homeBase, opts.tmpRoot);
|
|
6414
|
+
const skillsInstallPath = await installAgentSkills(manifest, ossFileMap, opts, homeBase, opts.tmpRoot);
|
|
6415
|
+
if (skillsInstallPath) linkAgentSkills(homeBase, skillsInstallPath);
|
|
6400
6416
|
const appIds = collectFeishuAppIds();
|
|
6401
6417
|
console.error(`[install-cli] lark-cli installed — running lark-cli-init for ${appIds.length} appId(s): [${appIds.join(", ")}]`);
|
|
6402
6418
|
for (const appId of appIds) {
|
|
@@ -6406,7 +6422,12 @@ async function installClis(tag, ossFileMap, opts) {
|
|
|
6406
6422
|
feishuAppSecret: opts.feishuAppSecret
|
|
6407
6423
|
});
|
|
6408
6424
|
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
|
-
|
|
6425
|
+
const outputText = [
|
|
6426
|
+
result.error,
|
|
6427
|
+
result.configInitStdout,
|
|
6428
|
+
result.configInitStderr
|
|
6429
|
+
].join(" ");
|
|
6430
|
+
if (/error/i.test(outputText)) reportError({
|
|
6410
6431
|
error: `lark-cli-init failed for appId=${appId}: ${result.error ?? "unknown"}`,
|
|
6411
6432
|
extraCategories: {
|
|
6412
6433
|
event: "install_cli_lark_init_failed",
|
|
@@ -6453,7 +6474,7 @@ async function installAgentSkills(manifest, ossFileMap, downloadOpts, homeBase,
|
|
|
6453
6474
|
const pkg = manifest.packages.find((p) => p.role === "template" && p.name === AGENT_SKILLS_NAME);
|
|
6454
6475
|
if (!pkg) {
|
|
6455
6476
|
console.error(`[install-cli] installAgentSkills: ${AGENT_SKILLS_NAME} not found in manifest (tag may not bundle it) — skipping skill install`);
|
|
6456
|
-
return;
|
|
6477
|
+
return null;
|
|
6457
6478
|
}
|
|
6458
6479
|
console.error(`[install-cli] installAgentSkills: downloading ${pkg.name}@${pkg.version}`);
|
|
6459
6480
|
const tarball = await downloadWithCache(pkg, ossFileMap, downloadOpts);
|
|
@@ -6498,6 +6519,7 @@ async function installAgentSkills(manifest, ossFileMap, downloadOpts, homeBase,
|
|
|
6498
6519
|
force: true
|
|
6499
6520
|
});
|
|
6500
6521
|
console.error(`[install-cli] installAgentSkills: done — skills installed to ${targetDir}`);
|
|
6522
|
+
return pkg.installPath;
|
|
6501
6523
|
} finally {
|
|
6502
6524
|
if (node_fs.default.existsSync(tmpStage)) try {
|
|
6503
6525
|
node_fs.default.rmSync(tmpStage, {
|
|
@@ -6507,6 +6529,39 @@ async function installAgentSkills(manifest, ossFileMap, downloadOpts, homeBase,
|
|
|
6507
6529
|
} catch {}
|
|
6508
6530
|
}
|
|
6509
6531
|
}
|
|
6532
|
+
/**
|
|
6533
|
+
* (Re)create workspace/agent/skills/<name> → ../<installPath>/<name> symlinks so
|
|
6534
|
+
* the agent workspace sees agent-skills under the conventional skills/ directory.
|
|
6535
|
+
*
|
|
6536
|
+
* Both sides share workspace/agent/ as parent, so the relative link form is stable
|
|
6537
|
+
* regardless of where homeBase is mounted.
|
|
6538
|
+
*
|
|
6539
|
+
* @param homeBase Root directory (default /home/gem). installPath is relative to
|
|
6540
|
+
* <homeBase>/workspace/agent/.
|
|
6541
|
+
* @param installPath Relative path of the extracted skills dir under workspace/agent
|
|
6542
|
+
* (e.g. ".agents/skills").
|
|
6543
|
+
*/
|
|
6544
|
+
function linkAgentSkills(homeBase, installPath) {
|
|
6545
|
+
const targetDir = node_path.default.join(homeBase, WORKSPACE_AGENT_REL, installPath);
|
|
6546
|
+
const skillsLinkDir = node_path.default.join(homeBase, WORKSPACE_AGENT_REL, "skills");
|
|
6547
|
+
if (!node_fs.default.existsSync(targetDir)) {
|
|
6548
|
+
console.error(`[install-cli] linkAgentSkills: targetDir=${targetDir} does not exist — skipping`);
|
|
6549
|
+
return;
|
|
6550
|
+
}
|
|
6551
|
+
const skillDirs = node_fs.default.readdirSync(targetDir, { withFileTypes: true }).filter((e) => e.isDirectory());
|
|
6552
|
+
console.error(`[install-cli] linkAgentSkills: creating ${skillDirs.length} symlinks in ${skillsLinkDir}`);
|
|
6553
|
+
node_fs.default.mkdirSync(skillsLinkDir, { recursive: true });
|
|
6554
|
+
for (const entry of skillDirs) {
|
|
6555
|
+
const relTarget = node_path.default.join("..", installPath, entry.name);
|
|
6556
|
+
const symlinkPath = node_path.default.join(skillsLinkDir, entry.name);
|
|
6557
|
+
try {
|
|
6558
|
+
node_fs.default.unlinkSync(symlinkPath);
|
|
6559
|
+
} catch {}
|
|
6560
|
+
node_fs.default.symlinkSync(relTarget, symlinkPath);
|
|
6561
|
+
console.error(`[install-cli] linkAgentSkills: ${entry.name} -> ${relTarget}`);
|
|
6562
|
+
}
|
|
6563
|
+
console.error(`[install-cli] linkAgentSkills: done — ${skillDirs.length} skill(s) symlinked from ${skillsLinkDir}`);
|
|
6564
|
+
}
|
|
6510
6565
|
function installOne(pkg, tarball, homeBase, tmpRoot) {
|
|
6511
6566
|
const targetDir = node_path.default.join(homeBase, pkg.installPath);
|
|
6512
6567
|
const bakDir = targetDir + ".bak";
|
|
@@ -9735,7 +9790,7 @@ async function reportCliRun(opts) {
|
|
|
9735
9790
|
//#region src/help.ts
|
|
9736
9791
|
const BIN = "mclaw-diagnose";
|
|
9737
9792
|
function versionBanner() {
|
|
9738
|
-
return `v0.1.8-alpha.
|
|
9793
|
+
return `v0.1.8-alpha.3`;
|
|
9739
9794
|
}
|
|
9740
9795
|
const COMMANDS = [
|
|
9741
9796
|
{
|
|
@@ -10611,6 +10666,10 @@ async function main() {
|
|
|
10611
10666
|
node_process.default.exit(1);
|
|
10612
10667
|
}
|
|
10613
10668
|
const names = getMultiFlag(args, "cli");
|
|
10669
|
+
if (names.length === 0) {
|
|
10670
|
+
console.error("Usage: install-cli <tag> --cli=<name>... [--home_base=<dir>] [--ctx=<base64> | --oss_file_map=<base64>]");
|
|
10671
|
+
node_process.default.exit(1);
|
|
10672
|
+
}
|
|
10614
10673
|
const homeBase = getFlag(args, "home_base");
|
|
10615
10674
|
const ossFileMapFlag = getFlag(args, "oss_file_map");
|
|
10616
10675
|
let installOssFileMap;
|
|
@@ -10627,7 +10686,6 @@ async function main() {
|
|
|
10627
10686
|
ossFileMapFlag,
|
|
10628
10687
|
installOssFileMap
|
|
10629
10688
|
});
|
|
10630
|
-
console.error(`[install-cli] ossFileMap=${JSON.stringify(ossFileMap)}`);
|
|
10631
10689
|
let feishuAppSecret;
|
|
10632
10690
|
if (names.includes("lark-cli")) feishuAppSecret = normalizeCtx(await fetchCtxViaInnerApi({
|
|
10633
10691
|
populate: { app: ["feishuAppSecret"] },
|