bfi-cli 0.1.40 → 0.1.41

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +24 -14
  2. package/package.json +1 -1
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("用法:bfi search <query> [--namespace <ns>] [--marketplace] [--json]");
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(" --namespace <ns> 按 SkillHub 命名空间筛选");
5854
- console.log(" --marketplace 仅搜索 skills.sh 市场");
5855
- console.log(" --all 同时搜索 SkillHub 和市场");
5856
- console.log(" --json 以 JSON 格式输出结果");
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");
@@ -6913,9 +6913,8 @@ async function handleSearch(args, api, globalOpts) {
6913
6913
  }
6914
6914
  const allPackages = [];
6915
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) => ({
6916
+ const pkgs = await api.listPackages(ns);
6917
+ if (Array.isArray(pkgs)) allPackages.push(...pkgs.map((p) => ({
6919
6918
  ...p,
6920
6919
  _namespace: ns
6921
6920
  })));
@@ -6928,12 +6927,23 @@ async function handleSearch(args, api, globalOpts) {
6928
6927
  console.log("未找到任何技能包。");
6929
6928
  return;
6930
6929
  }
6930
+ const dw = (s) => {
6931
+ let w = 0;
6932
+ for (const ch of s) w += /[一-鿿]/.test(ch) ? 2 : 1;
6933
+ return w;
6934
+ };
6935
+ const pad = (s, w) => {
6936
+ let r = s;
6937
+ while (dw(r) < w) r += " ";
6938
+ return r;
6939
+ };
6940
+ const maxName = Math.max(...allPackages.map((p) => dw(p.displayName || p.name || p.slug || "")), 4);
6941
+ const maxSlug = Math.max(...allPackages.map((p) => dw(`@${p._namespace}/${p.slug}`)), 4);
6931
6942
  console.log(`\n${BOLD$1}所有技能包(${allPackages.length} 个):${RESET$3}\n`);
6932
6943
  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();
6944
+ const name = pad(pkg.displayName || pkg.name || pkg.slug || "", maxName);
6945
+ const ref = pad(`@${pkg._namespace}/${pkg.slug}`, maxSlug);
6946
+ console.log(` ${BOLD$1}${name}${RESET$3} ${DIM$3}${ref} ${pkg.visibility === "PUBLIC" ? "公开" : "私有"}${RESET$3}`);
6937
6947
  }
6938
6948
  }
6939
6949
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {