@bgicli/bgicli 2.2.1 → 2.2.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/bgi.js +46 -38
- package/package.json +1 -1
package/dist/bgi.js
CHANGED
|
@@ -14690,8 +14690,8 @@ function installBundledData() {
|
|
|
14690
14690
|
if (!(0, import_fs4.existsSync)(bundledData)) return;
|
|
14691
14691
|
ensureDirs();
|
|
14692
14692
|
const targets = [
|
|
14693
|
-
{ src: (0, import_path4.join)(bundledData, "workflows"), dest: WORKFLOWS_DIR, name: "\u5DE5\u4F5C\u6D41" },
|
|
14694
|
-
{ src: (0, import_path4.join)(bundledData, "skills"), dest: SKILLS_DIR, name: "
|
|
14693
|
+
{ src: (0, import_path4.join)(bundledData, "workflows"), dest: WORKFLOWS_DIR, name: "Skills (\u751F\u4FE1\u5DE5\u4F5C\u6D41)" },
|
|
14694
|
+
{ src: (0, import_path4.join)(bundledData, "skills"), dest: SKILLS_DIR, name: "Skills (\u533B\u5B66\u4E13\u79D1)" },
|
|
14695
14695
|
{ src: (0, import_path4.join)(bundledData, "tools"), dest: TOOLS_DIR, name: "\u5DE5\u5177" }
|
|
14696
14696
|
];
|
|
14697
14697
|
let installed = false;
|
|
@@ -14738,9 +14738,9 @@ function printHelp() {
|
|
|
14738
14738
|
console.log(` ${source_default.cyan("/save")} [\u6587\u4EF6\u540D] \u4FDD\u5B58\u5BF9\u8BDD\u4E3A Markdown \u6587\u4EF6`);
|
|
14739
14739
|
console.log(` ${source_default.cyan("/think")} [on|off] \u5207\u6362\u601D\u8003\u6A21\u5F0F (Qwen3 /think \u524D\u7F00)`);
|
|
14740
14740
|
console.log();
|
|
14741
|
-
console.log(source_default.bold.cyan("\u2500\u2500\u2500 Skills
|
|
14742
|
-
console.log(` ${source_default.cyan("/cat")} \u6309\u9886\u57DF\u6D4F\u89C8\
|
|
14743
|
-
console.log(` ${source_default.cyan("/sk")} \u5217\u51FA\u5168\u90E8 Skills
|
|
14741
|
+
console.log(source_default.bold.cyan("\u2500\u2500\u2500 Skills \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
14742
|
+
console.log(` ${source_default.cyan("/cat")} \u6309\u9886\u57DF\u6D4F\u89C8 Skills \u5206\u7C7B\u76EE\u5F55`);
|
|
14743
|
+
console.log(` ${source_default.cyan("/sk")} \u5217\u51FA\u5168\u90E8 Skills`);
|
|
14744
14744
|
console.log(` ${source_default.cyan("/sk")} <\u5173\u952E\u8BCD> \u6A21\u7CCA\u641C\u7D22\uFF0C\u5339\u914D\u5219\u6CE8\u5165\uFF0C\u5426\u5219\u5217\u51FA\u5019\u9009`);
|
|
14745
14745
|
console.log(` ${source_default.cyan("/wf")} \u540C /sk\uFF0C\u522B\u540D`);
|
|
14746
14746
|
console.log(source_default.dim(" \u793A\u4F8B: /cat /sk deseq2 /sk pubmed /sk alphafold /sk crispr"));
|
|
@@ -14851,13 +14851,13 @@ function collectAllSkills() {
|
|
|
14851
14851
|
});
|
|
14852
14852
|
};
|
|
14853
14853
|
addFrom(SKILLS_DIR, "skill");
|
|
14854
|
-
addFrom(WORKFLOWS_DIR, "
|
|
14854
|
+
addFrom(WORKFLOWS_DIR, "skill");
|
|
14855
14855
|
return entries;
|
|
14856
14856
|
}
|
|
14857
14857
|
function listSkills(keyword) {
|
|
14858
14858
|
const all = collectAllSkills();
|
|
14859
14859
|
if (all.length === 0) {
|
|
14860
|
-
console.log(source_default.yellow("\u6682\u65E0\u5DF2\u5B89\u88C5\u7684 Skills
|
|
14860
|
+
console.log(source_default.yellow("\u6682\u65E0\u5DF2\u5B89\u88C5\u7684 Skills"));
|
|
14861
14861
|
return;
|
|
14862
14862
|
}
|
|
14863
14863
|
const matched = keyword ? all.filter((e2) => e2.id.toLowerCase().includes(keyword.toLowerCase())) : all;
|
|
@@ -14866,20 +14866,11 @@ function listSkills(keyword) {
|
|
|
14866
14866
|
console.log(source_default.dim("\u63D0\u793A: \u4F7F\u7528\u66F4\u7B80\u77ED\u7684\u5173\u952E\u8BCD\uFF0C\u5982 alphafold\u3001pubmed\u3001rnaseq\u3001crispr\u3001deseq2"));
|
|
14867
14867
|
return;
|
|
14868
14868
|
}
|
|
14869
|
-
const title = keyword ? `\u641C\u7D22\u7ED3\u679C "${keyword}" (${matched.length} \u4E2A) \u2014 \u4F7F\u7528 /sk <id> \u52A0\u8F7D:` : `\u5168\u90E8 Skills
|
|
14869
|
+
const title = keyword ? `\u641C\u7D22\u7ED3\u679C "${keyword}" (${matched.length} \u4E2A) \u2014 \u4F7F\u7528 /sk <id> \u52A0\u8F7D:` : `\u5168\u90E8 Skills (${matched.length} \u4E2A) \u2014 \u4F7F\u7528 /sk <id> \u52A0\u8F7D:`;
|
|
14870
14870
|
console.log(source_default.bold(title));
|
|
14871
|
-
const
|
|
14872
|
-
|
|
14873
|
-
if (
|
|
14874
|
-
console.log(source_default.dim(" \u2500\u2500 \u751F\u7269\u4FE1\u606F\u5B66\u5DE5\u4F5C\u6D41 \u2500\u2500"));
|
|
14875
|
-
workflows.forEach((e2) => console.log(` ${source_default.green(e2.id)}`));
|
|
14876
|
-
}
|
|
14877
|
-
if (skills.length > 0) {
|
|
14878
|
-
console.log(source_default.dim(" \u2500\u2500 OpenClaw Medical Skills \u2500\u2500"));
|
|
14879
|
-
const show = skills.slice(0, 35);
|
|
14880
|
-
show.forEach((e2) => console.log(` ${source_default.cyan(e2.id)}`));
|
|
14881
|
-
if (skills.length > 35) console.log(source_default.dim(` ... \u8FD8\u6709 ${skills.length - 35} \u4E2A\uFF0C\u8BF7\u7528\u5173\u952E\u8BCD\u7B5B\u9009`));
|
|
14882
|
-
}
|
|
14871
|
+
const show = matched.slice(0, 50);
|
|
14872
|
+
show.forEach((e2) => console.log(` ${source_default.cyan(e2.id)}`));
|
|
14873
|
+
if (matched.length > 50) console.log(source_default.dim(` ... \u8FD8\u6709 ${matched.length - 50} \u4E2A\uFF0C\u8BF7\u7528\u5173\u952E\u8BCD\u7B5B\u9009`));
|
|
14883
14874
|
console.log();
|
|
14884
14875
|
}
|
|
14885
14876
|
function injectSkill(id, history) {
|
|
@@ -14896,10 +14887,9 @@ function injectSkill(id, history) {
|
|
|
14896
14887
|
return false;
|
|
14897
14888
|
}
|
|
14898
14889
|
const content = (0, import_fs4.readFileSync)(skillPath, "utf8");
|
|
14899
|
-
const label = match.tag === "workflow" ? "\u751F\u7269\u4FE1\u606F\u5B66\u5DE5\u4F5C\u6D41" : "OpenClaw Skill";
|
|
14900
14890
|
history.push({
|
|
14901
14891
|
role: "user",
|
|
14902
|
-
content: `[
|
|
14892
|
+
content: `[Skill \u5DF2\u52A0\u8F7D: ${match.id}]
|
|
14903
14893
|
|
|
14904
14894
|
\u4EE5\u4E0B\u662F\u8BE5\u6280\u80FD\u7684\u64CD\u4F5C\u6307\u5357\uFF0C\u8BF7\u4E25\u683C\u6309\u7167\u8BF4\u660E\u6267\u884C\uFF1A
|
|
14905
14895
|
|
|
@@ -14907,9 +14897,9 @@ ${content}`
|
|
|
14907
14897
|
});
|
|
14908
14898
|
history.push({
|
|
14909
14899
|
role: "assistant",
|
|
14910
|
-
content: `\u2713
|
|
14900
|
+
content: `\u2713 Skill **${match.id}** \u5DF2\u52A0\u8F7D\u3002\u6211\u5DF2\u9605\u8BFB\u6307\u5357\uFF0C\u968F\u65F6\u53EF\u4EE5\u5F00\u59CB\u3002\u8BF7\u544A\u8BC9\u6211\u60A8\u7684\u5177\u4F53\u6570\u636E\u548C\u9700\u6C42\u3002`
|
|
14911
14901
|
});
|
|
14912
|
-
console.log(source_default.green(`\u2713
|
|
14902
|
+
console.log(source_default.green(`\u2713 Skill ${match.id} \u5DF2\u6CE8\u5165\u5230\u5F53\u524D\u5BF9\u8BDD\u4E0A\u4E0B\u6587`));
|
|
14913
14903
|
return true;
|
|
14914
14904
|
}
|
|
14915
14905
|
function expandFileRefs(input) {
|
|
@@ -15154,14 +15144,34 @@ ${summary}` },
|
|
|
15154
15144
|
case "sk": {
|
|
15155
15145
|
if (!arg) {
|
|
15156
15146
|
listSkills();
|
|
15147
|
+
break;
|
|
15148
|
+
}
|
|
15149
|
+
const allSkills = collectAllSkills();
|
|
15150
|
+
const idMatch = allSkills.find((e2) => e2.id === arg || e2.id.startsWith(arg) || e2.id.includes(arg));
|
|
15151
|
+
if (idMatch) {
|
|
15152
|
+
injectSkill(arg, history);
|
|
15153
|
+
break;
|
|
15154
|
+
}
|
|
15155
|
+
const { routes, topScore } = routeSkill(arg);
|
|
15156
|
+
if (routes.length === 0 || topScore < 4) {
|
|
15157
|
+
listSkills(arg);
|
|
15158
|
+
break;
|
|
15159
|
+
}
|
|
15160
|
+
if (routes.length === 1 || topScore >= 10) {
|
|
15161
|
+
console.log(source_default.dim(`\u6839\u636E\u63CF\u8FF0\u5339\u914D\u5230: ${routes[0].id}`));
|
|
15162
|
+
injectSkill(routes[0].id, history);
|
|
15157
15163
|
} else {
|
|
15158
|
-
|
|
15159
|
-
|
|
15160
|
-
|
|
15161
|
-
|
|
15162
|
-
|
|
15163
|
-
|
|
15164
|
-
|
|
15164
|
+
console.log(source_default.bold(`
|
|
15165
|
+
\u6839\u636E\u63CF\u8FF0\u63A8\u8350\u4EE5\u4E0B Skills:
|
|
15166
|
+
`));
|
|
15167
|
+
routes.forEach((r2, i2) => {
|
|
15168
|
+
const marker = i2 === 0 ? source_default.green("\u25B6") : source_default.dim(" ");
|
|
15169
|
+
console.log(` ${marker} ${source_default.cyan(r2.id)} \u2014 ${r2.name}`);
|
|
15170
|
+
if (i2 > 0) console.log(source_default.dim(` /sk ${r2.id} \u53EF\u6FC0\u6D3B\u6B64\u9879`));
|
|
15171
|
+
});
|
|
15172
|
+
console.log();
|
|
15173
|
+
console.log(source_default.dim("\u5DF2\u81EA\u52A8\u6FC0\u6D3B\u7B2C\u4E00\u4E2A\uFF0C\u5982\u9700\u5207\u6362\u8BF7\u4F7F\u7528\u4E0A\u65B9\u547D\u4EE4"));
|
|
15174
|
+
injectSkill(routes[0].id, history);
|
|
15165
15175
|
}
|
|
15166
15176
|
break;
|
|
15167
15177
|
}
|
|
@@ -15178,8 +15188,7 @@ ${summary}` },
|
|
|
15178
15188
|
console.log(` ${meta.icon} ${source_default.bold(meta.label)}`);
|
|
15179
15189
|
for (const item of items) {
|
|
15180
15190
|
const route = SKILL_ROUTES.find((r2) => r2.id === item.id);
|
|
15181
|
-
|
|
15182
|
-
console.log(` ${tag} ${source_default.white(item.id)} ${source_default.dim("\u2014 " + route.name)}`);
|
|
15191
|
+
console.log(` ${source_default.cyan(item.id)} ${source_default.dim("\u2014 " + route.name)}`);
|
|
15183
15192
|
}
|
|
15184
15193
|
console.log();
|
|
15185
15194
|
}
|
|
@@ -15187,8 +15196,8 @@ ${summary}` },
|
|
|
15187
15196
|
const allInstalled = collectAllSkills();
|
|
15188
15197
|
const unrouted = allInstalled.filter((e2) => !routedIds.has(e2.id));
|
|
15189
15198
|
if (unrouted.length > 0) {
|
|
15190
|
-
console.log(` \u{1F4E6} ${source_default.bold("\u66F4\u591A
|
|
15191
|
-
console.log(source_default.dim("
|
|
15199
|
+
console.log(` \u{1F4E6} ${source_default.bold("\u66F4\u591A Skills")} ${source_default.dim(`(${unrouted.length} \u4E2A\uFF0C\u4F7F\u7528\u5173\u952E\u8BCD\u641C\u7D22)`)}`);
|
|
15200
|
+
console.log(source_default.dim(" /sk <\u5173\u952E\u8BCD>\uFF0C\u4F8B: /sk ehr /sk clinical /sk imaging"));
|
|
15192
15201
|
console.log();
|
|
15193
15202
|
}
|
|
15194
15203
|
break;
|
|
@@ -15249,7 +15258,7 @@ async function main() {
|
|
|
15249
15258
|
console.log(source_default.bold.cyan("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
15250
15259
|
console.log(` ${source_default.bold("\u670D\u52A1\u5546:")} ${prov?.name ?? cfg.provider}`);
|
|
15251
15260
|
console.log(` ${source_default.bold("\u6A21\u578B:")} ${source_default.green(cfg.model)}`);
|
|
15252
|
-
console.log(` ${source_default.bold("Skills:")} ${totalSkills > 0 ? source_default.green(`${totalSkills} \u4E2A`) : source_default.yellow("\u672A\u5B89\u88C5")} ${source_default.dim("(
|
|
15261
|
+
console.log(` ${source_default.bold("Skills:")} ${totalSkills > 0 ? source_default.green(`${totalSkills} \u4E2A`) : source_default.yellow("\u672A\u5B89\u88C5")} ${source_default.dim("(/sk \u641C\u7D22 /cat \u5206\u7C7B\u76EE\u5F55)")}`);
|
|
15253
15262
|
console.log(` ${source_default.bold("\u5DE5\u5177:")} bash \xB7 read_file \xB7 write_file \xB7 list_dir \xB7 search_files`);
|
|
15254
15263
|
console.log(source_default.bold.cyan("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
15255
15264
|
console.log(source_default.dim(" \u8F93\u5165\u95EE\u9898\u5F00\u59CB\u5BF9\u8BDD /help \u67E5\u770B\u547D\u4EE4 /cat \u6280\u80FD\u5206\u7C7B @\u6587\u4EF6\u8DEF\u5F84 \u5185\u5D4C\u6587\u4EF6"));
|
|
@@ -15296,8 +15305,7 @@ async function main() {
|
|
|
15296
15305
|
} else if (newRoutes.length >= 2 && topScore >= 4) {
|
|
15297
15306
|
console.log(source_default.dim("\n\u{1F4A1} \u68C0\u6D4B\u5230\u76F8\u5173\u6280\u80FD\uFF0C\u8F93\u5165 /sk <id> \u6FC0\u6D3B:"));
|
|
15298
15307
|
newRoutes.slice(0, 3).forEach((r2) => {
|
|
15299
|
-
|
|
15300
|
-
console.log(source_default.dim(` /sk ${r2.id} ${tag} ${r2.name}`));
|
|
15308
|
+
console.log(source_default.dim(` /sk ${r2.id} \u2014 ${r2.name}`));
|
|
15301
15309
|
});
|
|
15302
15310
|
console.log();
|
|
15303
15311
|
}
|