bfi-cli 0.1.11 → 0.1.13

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 +17 -19
  2. package/package.json +1 -1
package/dist/cli.mjs CHANGED
@@ -6765,31 +6765,29 @@ async function runWhoami(globalOpts) {
6765
6765
  console.error("未认证。运行:bfi auth login --token <token>");
6766
6766
  process.exit(1);
6767
6767
  }
6768
- const api = new SkillHubAPI(registry, token);
6769
- const response = await api.whoami();
6768
+ const response = await new SkillHubAPI(registry, token).whoami();
6770
6769
  const user = response.user || response;
6770
+ const namespaces = response.namespaces || [];
6771
6771
  const displayName = user.displayName || user.name || "N/A";
6772
6772
  const userId = user.handle || user.id || "N/A";
6773
6773
  console.log(`\n用户名: ${displayName}`);
6774
6774
  console.log(`用户ID: ${userId}`);
6775
- try {
6776
- const nsResponse = await api.myNamespaces();
6777
- const namespaces = nsResponse.data || nsResponse;
6778
- if (Array.isArray(namespaces) && namespaces.length > 0) {
6779
- console.log(`\n命名空间 (${namespaces.length}):`);
6780
- for (const ns of namespaces) {
6781
- const role = ns.currentUserRole || "MEMBER";
6782
- const roleLabel = {
6783
- OWNER: "拥有者",
6784
- ADMIN: "管理员",
6785
- MEMBER: "成员",
6786
- VIEWER: "访客"
6787
- }[role] || role;
6788
- console.log(` @${ns.slug} ${ns.displayName || ""} [${roleLabel}]`);
6789
- }
6775
+ if (Array.isArray(namespaces) && namespaces.length > 0) {
6776
+ const maxSlug = Math.max(...namespaces.map((ns) => String(ns.slug || "").length), 4);
6777
+ const maxName = Math.max(...namespaces.map((ns) => String(ns.displayName || "").length), 4);
6778
+ console.log(`\n命名空间 (${namespaces.length}):`);
6779
+ for (const ns of namespaces) {
6780
+ const role = ns.role || "MEMBER";
6781
+ const roleLabel = {
6782
+ OWNER: "拥有者",
6783
+ ADMIN: "管理员",
6784
+ MEMBER: "成员",
6785
+ VIEWER: "访客"
6786
+ };
6787
+ const slug = String(ns.slug || "").padEnd(maxSlug);
6788
+ const name = String(ns.displayName || "").padEnd(maxName);
6789
+ console.log(` @${slug} ${name} ${roleLabel[role] || role}`);
6790
6790
  }
6791
- } catch (e) {
6792
- console.error(` 命名空间获取失败:${e.message || e}`);
6793
6791
  }
6794
6792
  console.log();
6795
6793
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bfi-cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "用友大业财BFI统一命令行工具,支持技能,技能包,元数据,UI元数据等",
5
5
  "type": "module",
6
6
  "bin": {