bfi-cli 0.1.64 → 0.1.65
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/cli.mjs +36 -6
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -7517,7 +7517,7 @@ function showHelp$2() {
|
|
|
7517
7517
|
console.log(` publish <path> Publish a plugin to SkillHub`);
|
|
7518
7518
|
console.log(` list, ls List plugins on SkillHub`);
|
|
7519
7519
|
console.log(` info <id> Show plugin details`);
|
|
7520
|
-
console.log(` install <ref> Install a plugin (
|
|
7520
|
+
console.log(` install <ref> Install a plugin (slug, plugin id, or local .zip)`);
|
|
7521
7521
|
console.log();
|
|
7522
7522
|
}
|
|
7523
7523
|
async function createScaffold(args) {
|
|
@@ -7692,7 +7692,7 @@ async function info$1(args, globalOpts) {
|
|
|
7692
7692
|
async function install(args, globalOpts) {
|
|
7693
7693
|
const ref = args[0];
|
|
7694
7694
|
if (!ref) {
|
|
7695
|
-
console.error("用法:bfi plugin install <
|
|
7695
|
+
console.error("用法:bfi plugin install <slug|插件ID|./plugin.zip>");
|
|
7696
7696
|
process.exit(1);
|
|
7697
7697
|
}
|
|
7698
7698
|
const homeSkills = path$1.join(os$1.homedir(), ".claude", "skills");
|
|
@@ -7706,7 +7706,17 @@ async function install(args, globalOpts) {
|
|
|
7706
7706
|
}
|
|
7707
7707
|
const { registry, token } = resolveConfig(globalOpts);
|
|
7708
7708
|
const api = new SkillHubAPI(registry, token);
|
|
7709
|
-
|
|
7709
|
+
let plugin;
|
|
7710
|
+
if (/^\d+$/.test(ref)) plugin = await api.getPlugin(Number(ref));
|
|
7711
|
+
else {
|
|
7712
|
+
const list = await api.listPlugins();
|
|
7713
|
+
const match = (Array.isArray(list) ? list : list?.content ?? list?.data ?? []).find((p) => p.slug === ref || p.displayName === ref);
|
|
7714
|
+
if (!match) {
|
|
7715
|
+
console.error(`未找到插件:${ref}(支持传 slug 或插件 ID)`);
|
|
7716
|
+
process.exit(1);
|
|
7717
|
+
}
|
|
7718
|
+
plugin = await api.getPlugin(match.id);
|
|
7719
|
+
}
|
|
7710
7720
|
const slug = plugin.slug ?? `plugin-${plugin.id}`;
|
|
7711
7721
|
if (!plugin.latestVersionId) {
|
|
7712
7722
|
console.error(`插件 ${slug} 尚无已发布版本,无法安装`);
|
|
@@ -8318,7 +8328,19 @@ async function runYmc(args, globalOpts) {
|
|
|
8318
8328
|
const v = opt(rest, name);
|
|
8319
8329
|
if (v) body[k] = v;
|
|
8320
8330
|
}
|
|
8321
|
-
emit(await api.call("ymc/warningSql", body), jsonMode,
|
|
8331
|
+
emit(await api.call("ymc/warningSql", body), jsonMode, (data) => {
|
|
8332
|
+
const d = data;
|
|
8333
|
+
const rows = Array.isArray(d) ? d : d.rows ?? d.data ?? [];
|
|
8334
|
+
const n = rows.length;
|
|
8335
|
+
const lines = [`✓ 慢 SQL: ${n} 条(耗时降序)`];
|
|
8336
|
+
for (const x of rows.slice(0, 5)) {
|
|
8337
|
+
const sql = String(x.sqlStr ?? "").replace(/\s+/g, " ").slice(0, 120);
|
|
8338
|
+
const stack1 = String(x.sqlStack ?? "").split("\n")[0]?.slice(0, 80) ?? "";
|
|
8339
|
+
lines.push(`- ${x.curAppCode} ${x.costTime}ms rows=${x.rowCount ?? "?"} md5=${String(x.md5Sql ?? "").slice(0, 8)} trace=${x.traceId ?? "?"}\n ${sql}\n stack: ${stack1}`);
|
|
8340
|
+
}
|
|
8341
|
+
if (n > 5) lines.push(`… 其余 ${n - 5} 条用 --json 获取`);
|
|
8342
|
+
return lines.join("\n");
|
|
8343
|
+
});
|
|
8322
8344
|
break;
|
|
8323
8345
|
}
|
|
8324
8346
|
case "slowcall": {
|
|
@@ -8339,7 +8361,15 @@ async function runYmc(args, globalOpts) {
|
|
|
8339
8361
|
}
|
|
8340
8362
|
const cost = opt(rest, "--min-cost");
|
|
8341
8363
|
if (cost) body.costTime = [Number(cost), 999999];
|
|
8342
|
-
emit(await api.call("ymc/warningCall", body), jsonMode,
|
|
8364
|
+
emit(await api.call("ymc/warningCall", body), jsonMode, (data) => {
|
|
8365
|
+
const d = data;
|
|
8366
|
+
const rows = Array.isArray(d) ? d : d.rows ?? d.data ?? [];
|
|
8367
|
+
const n = rows.length;
|
|
8368
|
+
const lines = [`✓ 慢调用: ${n} 条(耗时降序)`];
|
|
8369
|
+
for (const x of rows.slice(0, 5)) lines.push(`- ${x.curAppCode} ${x.costTime}ms (sql${x.sqlCostTime ?? 0}/rpc${x.rpcCostTime ?? 0}/redis${x.redisCostTime ?? 0})\n ${x.remoteCallMethod ?? "?"} trace=${x.traceId ?? "?"} pod=${x.podId ?? "?"}`);
|
|
8370
|
+
if (n > 5) lines.push(`… 其余 ${n - 5} 条用 --json 获取`);
|
|
8371
|
+
return lines.join("\n");
|
|
8372
|
+
});
|
|
8343
8373
|
break;
|
|
8344
8374
|
}
|
|
8345
8375
|
case "exceptions": {
|
|
@@ -8809,7 +8839,7 @@ ${BOLD}━━━ 插件管理 ━━━${RESET}
|
|
|
8809
8839
|
plugin publish <dir|zip|tgz> 发布插件到 SkillHub
|
|
8810
8840
|
plugin list 列出插件
|
|
8811
8841
|
plugin info <id> 查看插件详情
|
|
8812
|
-
plugin install <id|file.zip>
|
|
8842
|
+
plugin install <slug|id|file.zip> 安装插件(名称 / ID / 本地压缩包)
|
|
8813
8843
|
|
|
8814
8844
|
${BOLD}━━━ MCP 服务器 ━━━${RESET}
|
|
8815
8845
|
mcp list 列出 MCP 服务器
|