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.
- package/dist/cli.mjs +17 -19
- 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
|
|
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
|
-
|
|
6776
|
-
const
|
|
6777
|
-
const
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
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
|
}
|