bfi-cli 0.1.18 → 0.1.20
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 +16 -3
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -4410,7 +4410,18 @@ async function installFromSkillHub(parsed, options, spinner) {
|
|
|
4410
4410
|
let slug;
|
|
4411
4411
|
if (restParts.length === 0) {
|
|
4412
4412
|
spinner.start(`正在 SkillHub 搜索 "${rawRef}"...`);
|
|
4413
|
-
const hits = ((await api.searchSkills(rawRef)).
|
|
4413
|
+
const hits = ((await api.searchSkills(rawRef)).results || []).map((h) => {
|
|
4414
|
+
const { namespace: ns, slug: s } = parseSkillRef(h.slug, "global");
|
|
4415
|
+
return {
|
|
4416
|
+
...h,
|
|
4417
|
+
namespace: ns,
|
|
4418
|
+
slug: s
|
|
4419
|
+
};
|
|
4420
|
+
}).sort((a, b) => {
|
|
4421
|
+
const aExact = a.slug === rawRef || a.name === rawRef;
|
|
4422
|
+
if (aExact !== (b.slug === rawRef || b.name === rawRef)) return aExact ? -1 : 1;
|
|
4423
|
+
return (b.score || 0) - (a.score || 0);
|
|
4424
|
+
}).slice(0, 20);
|
|
4414
4425
|
if (hits.length === 0) {
|
|
4415
4426
|
spinner.stop(import_picocolors.default.red("无结果"));
|
|
4416
4427
|
outro(import_picocolors.default.red(`No skills found on SkillHub for "${rawRef}".`));
|
|
@@ -6878,11 +6889,13 @@ async function searchSkillHub(query, namespace, globalOpts) {
|
|
|
6878
6889
|
for (const skill of skills) {
|
|
6879
6890
|
const name = skill.displayName || skill.name || skill.slug;
|
|
6880
6891
|
const desc = skill.summary || skill.description || "";
|
|
6892
|
+
const canonicalSlug = skill.slug || "";
|
|
6893
|
+
const displaySlug = canonicalSlug.indexOf("--") > 0 ? canonicalSlug : `global--${canonicalSlug}`;
|
|
6881
6894
|
console.log(` ${BOLD$5}${name}${RESET$8}`);
|
|
6882
6895
|
if (desc) console.log(` ${DIM$8}${truncate$2(desc, 100)}${RESET$8}`);
|
|
6883
|
-
console.log(` ${TEXT$7}slug: ${
|
|
6896
|
+
console.log(` ${TEXT$7}slug: ${displaySlug}${RESET$8}`);
|
|
6884
6897
|
if (skill.version) console.log(` ${DIM$8}version: ${skill.version}${RESET$8}`);
|
|
6885
|
-
console.log(` ${DIM$8}安装:${TEXT$7}bfi skills add ${
|
|
6898
|
+
console.log(` ${DIM$8}安装:${TEXT$7}bfi skills add ${displaySlug}${RESET$8}`);
|
|
6886
6899
|
console.log();
|
|
6887
6900
|
}
|
|
6888
6901
|
} catch (error) {
|