bfi-cli 0.1.39 → 0.1.40
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 +57 -33
- package/package.json +1 -1
- package/skills/skillhub-skills/SKILL.md +10 -4
package/dist/cli.mjs
CHANGED
|
@@ -6670,7 +6670,7 @@ async function runPackage(args, globalOpts) {
|
|
|
6670
6670
|
await handleUpdate(args.slice(1), api, globalOpts);
|
|
6671
6671
|
break;
|
|
6672
6672
|
case "search":
|
|
6673
|
-
await handleSearch(args.slice(1), api);
|
|
6673
|
+
await handleSearch(args.slice(1), api, globalOpts);
|
|
6674
6674
|
break;
|
|
6675
6675
|
case "create":
|
|
6676
6676
|
await handleCreate(args.slice(1), api, globalOpts);
|
|
@@ -6878,40 +6878,64 @@ async function handleUpdate(args, api, globalOpts) {
|
|
|
6878
6878
|
}
|
|
6879
6879
|
console.log(`${GREEN$2}✓ 包更新完成${RESET$3}`);
|
|
6880
6880
|
}
|
|
6881
|
-
async function handleSearch(args, api) {
|
|
6882
|
-
const query = args.filter((a) => !a.startsWith("--")).join(" ");
|
|
6881
|
+
async function handleSearch(args, api, globalOpts) {
|
|
6882
|
+
const query = args.filter((a) => !a.startsWith("--")).join(" ") || void 0;
|
|
6883
6883
|
const json = args.includes("--json");
|
|
6884
|
-
if (
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
if (
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
}))
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
}
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6884
|
+
if (query) {
|
|
6885
|
+
const skills = (await api.searchSkills(query, { limit: 20 })).results || [];
|
|
6886
|
+
const namespaces = /* @__PURE__ */ new Map();
|
|
6887
|
+
for (const s of skills) {
|
|
6888
|
+
const { namespace } = parseSkillRef(s.slug, "global");
|
|
6889
|
+
if (!namespaces.has(namespace)) namespaces.set(namespace, []);
|
|
6890
|
+
namespaces.get(namespace).push(s);
|
|
6891
|
+
}
|
|
6892
|
+
if (json) {
|
|
6893
|
+
console.log(JSON.stringify({
|
|
6894
|
+
query,
|
|
6895
|
+
results: Array.from(namespaces.entries())
|
|
6896
|
+
}, null, 2));
|
|
6897
|
+
return;
|
|
6898
|
+
}
|
|
6899
|
+
console.log(`\n${BOLD$1}找到 ${skills.length} 个相关技能(按命名空间分组):${RESET$3}\n`);
|
|
6900
|
+
for (const [ns, sk] of namespaces) {
|
|
6901
|
+
console.log(` ${BOLD$1}@${ns}${RESET$3}(${sk.length} 个技能)`);
|
|
6902
|
+
for (const s of sk.slice(0, 5)) console.log(` ${DIM$3}- ${s.displayName || s.name} (${s.slug})${RESET$3}`);
|
|
6903
|
+
if (sk.length > 5) console.log(` ${DIM$3}... 还有 ${sk.length - 5} 个${RESET$3}`);
|
|
6904
|
+
console.log();
|
|
6905
|
+
}
|
|
6906
|
+
} else {
|
|
6907
|
+
const nsList = [];
|
|
6908
|
+
try {
|
|
6909
|
+
const whoami = await api.whoami();
|
|
6910
|
+
for (const ns of whoami.namespaces || []) nsList.push(ns.slug);
|
|
6911
|
+
} catch {
|
|
6912
|
+
nsList.push("global");
|
|
6913
|
+
}
|
|
6914
|
+
const allPackages = [];
|
|
6915
|
+
for (const ns of nsList) try {
|
|
6916
|
+
const result = await api.listPackages(ns);
|
|
6917
|
+
const pkgs = result.packages || result.data || [];
|
|
6918
|
+
allPackages.push(...pkgs.map((p) => ({
|
|
6919
|
+
...p,
|
|
6920
|
+
_namespace: ns
|
|
6921
|
+
})));
|
|
6922
|
+
} catch {}
|
|
6923
|
+
if (json) {
|
|
6924
|
+
console.log(JSON.stringify(allPackages, null, 2));
|
|
6925
|
+
return;
|
|
6926
|
+
}
|
|
6927
|
+
if (allPackages.length === 0) {
|
|
6928
|
+
console.log("未找到任何技能包。");
|
|
6929
|
+
return;
|
|
6930
|
+
}
|
|
6931
|
+
console.log(`\n${BOLD$1}所有技能包(${allPackages.length} 个):${RESET$3}\n`);
|
|
6932
|
+
for (const pkg of allPackages) {
|
|
6933
|
+
console.log(` ${BOLD$1}${pkg.displayName || pkg.name || pkg.slug}${RESET$3}`);
|
|
6934
|
+
console.log(` ${DIM$3}@${pkg._namespace}/${pkg.slug} | 可见性:${pkg.visibility || "PRIVATE"} | 技能数:${pkg.skillCount || "?"}${RESET$3}`);
|
|
6935
|
+
if (pkg.description) console.log(` ${DIM$3}${pkg.description.slice(0, 80)}${RESET$3}`);
|
|
6936
|
+
console.log();
|
|
6937
|
+
}
|
|
6913
6938
|
}
|
|
6914
|
-
console.log(`${DIM$3}使用 bfi skills package create <slug> --namespace <ns> 创建包,然后 add-skills 添加这些技能。${RESET$3}`);
|
|
6915
6939
|
}
|
|
6916
6940
|
async function handleCreate(args, api, globalOpts) {
|
|
6917
6941
|
const slug = args[0];
|
package/package.json
CHANGED
|
@@ -39,10 +39,11 @@ npm install -g bfi-cli
|
|
|
39
39
|
|
|
40
40
|
## 场景 1:使用技能
|
|
41
41
|
|
|
42
|
-
### 1.1
|
|
42
|
+
### 1.1 搜索技能
|
|
43
43
|
```bash
|
|
44
44
|
bfi skills search <关键词>
|
|
45
45
|
bfi skills search <关键词> --marketplace # skills.sh 公开市场
|
|
46
|
+
bfi skills search <关键词> --all # 所有技能
|
|
46
47
|
```
|
|
47
48
|
|
|
48
49
|
### 1.2 查看详情
|
|
@@ -58,12 +59,17 @@ bfi skills add github:owner/repo # GitHub
|
|
|
58
59
|
bfi skills add <来源> -y # 跳过确认
|
|
59
60
|
```
|
|
60
61
|
|
|
61
|
-
### 1.4
|
|
62
|
+
### 1.4 技能包操作
|
|
62
63
|
```bash
|
|
63
|
-
bfi skills package
|
|
64
|
+
bfi skills package search # 列出所有技能包
|
|
65
|
+
bfi skills package search <关键词> # 按关键词搜索
|
|
66
|
+
bfi skills package install @ns/pkg # 安装包(含全部技能)
|
|
67
|
+
bfi skills package list # 查看已安装的包
|
|
68
|
+
bfi skills package uninstall @ns/pkg # 卸载包(含全部技能)
|
|
69
|
+
bfi skills package update @ns/pkg # 更新包
|
|
64
70
|
```
|
|
65
71
|
|
|
66
|
-
### 1.5
|
|
72
|
+
### 1.5 查看已安装技能
|
|
67
73
|
```bash
|
|
68
74
|
bfi skills list
|
|
69
75
|
bfi skills ls -g # 全局
|