bfi-cli 0.1.40 → 0.1.42
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 +58 -14
- package/package.json +1 -1
- package/skills/skillhub-skills/SKILL.md +4 -0
package/dist/cli.mjs
CHANGED
|
@@ -5846,14 +5846,14 @@ async function runSearch(args, globalOpts) {
|
|
|
5846
5846
|
const query = parseSearchQuery(args);
|
|
5847
5847
|
const namespace = args.includes("--namespace") ? getOptionValue$2(args, "--namespace") : void 0;
|
|
5848
5848
|
const json = args.includes("--json");
|
|
5849
|
-
if (!query) {
|
|
5850
|
-
console.log(
|
|
5849
|
+
if (!query || query.trim() === "") {
|
|
5850
|
+
console.log(`${BOLD$5}bfi skills search <关键词> [选项]${RESET$8}`);
|
|
5851
5851
|
console.log();
|
|
5852
|
-
console.log(
|
|
5853
|
-
console.log(
|
|
5854
|
-
console.log(
|
|
5855
|
-
console.log(
|
|
5856
|
-
console.log(
|
|
5852
|
+
console.log(`${DIM$8}常用命令:${RESET$8}`);
|
|
5853
|
+
console.log(` bfi skills search react ${DIM$8}搜索 SkillHub${RESET$8}`);
|
|
5854
|
+
console.log(` bfi skills search react --marketplace ${DIM$8}搜索 skills.sh${RESET$8}`);
|
|
5855
|
+
console.log(` bfi skills search react --all ${DIM$8}搜索全部${RESET$8}`);
|
|
5856
|
+
console.log(` bfi skills search react --json ${DIM$8}JSON 输出${RESET$8}`);
|
|
5857
5857
|
return;
|
|
5858
5858
|
}
|
|
5859
5859
|
const useMarketplace = args.includes("--marketplace");
|
|
@@ -6672,6 +6672,9 @@ async function runPackage(args, globalOpts) {
|
|
|
6672
6672
|
case "search":
|
|
6673
6673
|
await handleSearch(args.slice(1), api, globalOpts);
|
|
6674
6674
|
break;
|
|
6675
|
+
case "info":
|
|
6676
|
+
await handleServerInfo(args.slice(1), api, globalOpts);
|
|
6677
|
+
break;
|
|
6675
6678
|
case "create":
|
|
6676
6679
|
await handleCreate(args.slice(1), api, globalOpts);
|
|
6677
6680
|
break;
|
|
@@ -6913,9 +6916,8 @@ async function handleSearch(args, api, globalOpts) {
|
|
|
6913
6916
|
}
|
|
6914
6917
|
const allPackages = [];
|
|
6915
6918
|
for (const ns of nsList) try {
|
|
6916
|
-
const
|
|
6917
|
-
|
|
6918
|
-
allPackages.push(...pkgs.map((p) => ({
|
|
6919
|
+
const pkgs = await api.listPackages(ns);
|
|
6920
|
+
if (Array.isArray(pkgs)) allPackages.push(...pkgs.map((p) => ({
|
|
6919
6921
|
...p,
|
|
6920
6922
|
_namespace: ns
|
|
6921
6923
|
})));
|
|
@@ -6928,12 +6930,23 @@ async function handleSearch(args, api, globalOpts) {
|
|
|
6928
6930
|
console.log("未找到任何技能包。");
|
|
6929
6931
|
return;
|
|
6930
6932
|
}
|
|
6933
|
+
const dw = (s) => {
|
|
6934
|
+
let w = 0;
|
|
6935
|
+
for (const ch of s) w += /[一-鿿]/.test(ch) ? 2 : 1;
|
|
6936
|
+
return w;
|
|
6937
|
+
};
|
|
6938
|
+
const pad = (s, w) => {
|
|
6939
|
+
let r = s;
|
|
6940
|
+
while (dw(r) < w) r += " ";
|
|
6941
|
+
return r;
|
|
6942
|
+
};
|
|
6943
|
+
const maxName = Math.max(...allPackages.map((p) => dw(p.displayName || p.name || p.slug || "")), 4);
|
|
6944
|
+
const maxSlug = Math.max(...allPackages.map((p) => dw(`@${p._namespace}/${p.slug}`)), 4);
|
|
6931
6945
|
console.log(`\n${BOLD$1}所有技能包(${allPackages.length} 个):${RESET$3}\n`);
|
|
6932
6946
|
for (const pkg of allPackages) {
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
console.log();
|
|
6947
|
+
const name = pad(pkg.displayName || pkg.name || pkg.slug || "", maxName);
|
|
6948
|
+
const ref = pad(`@${pkg._namespace}/${pkg.slug}`, maxSlug);
|
|
6949
|
+
console.log(` ${BOLD$1}${name}${RESET$3} ${DIM$3}${ref} ${pkg.visibility === "PUBLIC" ? "公开" : "私有"}${RESET$3}`);
|
|
6937
6950
|
}
|
|
6938
6951
|
}
|
|
6939
6952
|
}
|
|
@@ -7045,6 +7058,37 @@ async function handleRemoveSkills(args, api, globalOpts) {
|
|
|
7045
7058
|
process.exit(1);
|
|
7046
7059
|
}
|
|
7047
7060
|
}
|
|
7061
|
+
async function handleServerInfo(args, api, globalOpts) {
|
|
7062
|
+
const pkgRef = args[0];
|
|
7063
|
+
if (!pkgRef) {
|
|
7064
|
+
console.error("用法:bfi skills package info <package-ref>");
|
|
7065
|
+
process.exit(1);
|
|
7066
|
+
}
|
|
7067
|
+
const { namespace, slug } = parseSkillRef(pkgRef, globalOpts.namespace);
|
|
7068
|
+
const json = args.includes("--json");
|
|
7069
|
+
try {
|
|
7070
|
+
const result = await api.getPackage(namespace, slug);
|
|
7071
|
+
const pkg = result.data || result;
|
|
7072
|
+
if (json) {
|
|
7073
|
+
console.log(JSON.stringify(pkg, null, 2));
|
|
7074
|
+
return;
|
|
7075
|
+
}
|
|
7076
|
+
console.log(`\n${BOLD$1}${pkg.displayName || pkg.name || slug}${RESET$3}`);
|
|
7077
|
+
console.log(`${DIM$3}${"=".repeat(48)}${RESET$3}`);
|
|
7078
|
+
console.log(` ${BOLD$1}Slug:${RESET$3} ${toCanonicalSlug(namespace, slug)}`);
|
|
7079
|
+
console.log(` ${BOLD$1}命名空间:${RESET$3} @${namespace}`);
|
|
7080
|
+
console.log(` ${BOLD$1}可见性:${RESET$3} ${pkg.visibility || "PRIVATE"}`);
|
|
7081
|
+
const skills = pkg.skills || [];
|
|
7082
|
+
if (skills.length > 0) {
|
|
7083
|
+
console.log(`\n ${BOLD$1}技能(${skills.length} 个):${RESET$3}`);
|
|
7084
|
+
for (const s of skills) console.log(` ${DIM$3}- ${s.displayName || s.slug} (${s.namespace || namespace}--${s.slug})${RESET$3}`);
|
|
7085
|
+
}
|
|
7086
|
+
console.log();
|
|
7087
|
+
} catch (error) {
|
|
7088
|
+
console.error(`${RED$1}获取包信息失败:${error.message}${RESET$3}`);
|
|
7089
|
+
process.exit(1);
|
|
7090
|
+
}
|
|
7091
|
+
}
|
|
7048
7092
|
function getOptionValue(args, flag) {
|
|
7049
7093
|
const idx = args.indexOf(flag);
|
|
7050
7094
|
return idx !== -1 && args[idx + 1] ? args[idx + 1] : void 0;
|
package/package.json
CHANGED
|
@@ -62,7 +62,11 @@ bfi skills add <来源> -y # 跳过确认
|
|
|
62
62
|
### 1.4 技能包操作
|
|
63
63
|
```bash
|
|
64
64
|
bfi skills package search # 列出所有技能包
|
|
65
|
+
bfi skills package info @ns/pkg # 查看包详情
|
|
66
|
+
|
|
65
67
|
bfi skills package search <关键词> # 按关键词搜索
|
|
68
|
+
bfi skills package info @ns/pkg # 查看包详情
|
|
69
|
+
|
|
66
70
|
bfi skills package install @ns/pkg # 安装包(含全部技能)
|
|
67
71
|
bfi skills package list # 查看已安装的包
|
|
68
72
|
bfi skills package uninstall @ns/pkg # 卸载包(含全部技能)
|