bfi-cli 0.1.22 → 0.1.24
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 -5
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -4435,6 +4435,18 @@ async function handleWellKnownSkills(source, url, options, spinner) {
|
|
|
4435
4435
|
outro(import_picocolors.default.green("完成!") + import_picocolors.default.dim(" 使用前请审阅技能;技能以 Agent 的全部权限运行。"));
|
|
4436
4436
|
await promptForFindSkills(options, targetAgents);
|
|
4437
4437
|
}
|
|
4438
|
+
async function cloneWithGitHubFallback(url, ref, spinner) {
|
|
4439
|
+
try {
|
|
4440
|
+
spinner.start("正在克隆仓库...");
|
|
4441
|
+
return await cloneRepo(url, ref);
|
|
4442
|
+
} catch (error) {
|
|
4443
|
+
if (error instanceof GitCloneError && !url.includes("github.com")) {
|
|
4444
|
+
spinner.message(`GitLab 未找到,降级到 GitHub: ${url.replace(/https:\/\/[^/]+\//, "https://github.com/")}`);
|
|
4445
|
+
return await cloneRepo(url.replace(/https:\/\/[^/]+\//, "https://github.com/"), ref);
|
|
4446
|
+
}
|
|
4447
|
+
throw error;
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
4438
4450
|
async function installFromSkillHub(parsed, options, spinner) {
|
|
4439
4451
|
const config = resolveConfig();
|
|
4440
4452
|
const api = new SkillHubAPI(config.registry, config.token);
|
|
@@ -4659,8 +4671,7 @@ async function runAdd(args, options = {}) {
|
|
|
4659
4671
|
skills = blobResult.skills;
|
|
4660
4672
|
spinner$2.stop(`Found ${import_picocolors.default.green(skills.length)} skill${skills.length > 1 ? "s" : ""}`);
|
|
4661
4673
|
} else {
|
|
4662
|
-
spinner$2
|
|
4663
|
-
tempDir = await cloneRepo(parsed.url, parsed.ref);
|
|
4674
|
+
tempDir = await cloneWithGitHubFallback(parsed.url, parsed.ref, spinner$2);
|
|
4664
4675
|
spinner$2.stop("仓库克隆完成");
|
|
4665
4676
|
spinner$2.start("正在发现技能...");
|
|
4666
4677
|
skills = await discoverSkills(tempDir, parsed.subpath, {
|
|
@@ -4669,8 +4680,7 @@ async function runAdd(args, options = {}) {
|
|
|
4669
4680
|
});
|
|
4670
4681
|
}
|
|
4671
4682
|
} else {
|
|
4672
|
-
spinner$2
|
|
4673
|
-
tempDir = await cloneRepo(parsed.url, parsed.ref);
|
|
4683
|
+
tempDir = await cloneWithGitHubFallback(parsed.url, parsed.ref, spinner$2);
|
|
4674
4684
|
spinner$2.stop("仓库克隆完成");
|
|
4675
4685
|
spinner$2.start("正在发现技能...");
|
|
4676
4686
|
skills = await discoverSkills(tempDir, parsed.subpath, {
|
|
@@ -6957,9 +6967,10 @@ async function searchMarketplace(query) {
|
|
|
6957
6967
|
for (const skill of skills.slice(0, 12)) {
|
|
6958
6968
|
const installs = formatInstalls(skill.installs);
|
|
6959
6969
|
console.log(` ${BOLD$5}${skill.name}${RESET$8}`);
|
|
6960
|
-
if (skill.source) console.log(` ${DIM$8}
|
|
6970
|
+
if (skill.source) console.log(` ${DIM$8}来源:${skill.source}${RESET$8}`);
|
|
6961
6971
|
if (installs) console.log(` ${CYAN}${installs}${RESET$8}`);
|
|
6962
6972
|
console.log(` ${TEXT$7}https://skills.sh/${skill.id}${RESET$8}`);
|
|
6973
|
+
if (skill.source) console.log(` ${DIM$8}安装:${TEXT$7}BFI_GIT_HOST=github.com bfi skills add ${skill.source}${RESET$8}`);
|
|
6963
6974
|
console.log();
|
|
6964
6975
|
}
|
|
6965
6976
|
} catch {
|