@collectui/cli 0.2.13 → 0.2.14
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/package.json +1 -1
- package/src/commands/libs.mjs +12 -30
package/package.json
CHANGED
package/src/commands/libs.mjs
CHANGED
|
@@ -1,29 +1,20 @@
|
|
|
1
|
-
import * as p from "@clack/prompts";
|
|
2
1
|
import { LIBS, ownedLibs, resolveLibKeys } from "../catalog.mjs";
|
|
3
2
|
import { formatTable } from "../report.mjs";
|
|
4
3
|
import { loadMe } from "./common.mjs";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
|
-
* cui libs
|
|
8
|
-
* cui libs --verbose 完整表格(registries/MCP server
|
|
6
|
+
* cui libs 精简三列:SITE + CLI KEY + MCP KEY(MCP 值区分专属 bound / 通用 generic)
|
|
7
|
+
* cui libs --verbose 完整表格(registries/MCP server 名等内部细节)
|
|
8
|
+
* 加载态用静态提示行——clack spinner 每帧整行重绘,部分终端观感闪烁。
|
|
9
9
|
*/
|
|
10
10
|
export async function libsCmd(flags, rest, reporter) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!reporter.headless && !reporter.json) {
|
|
14
|
-
spinner = p.spinner();
|
|
15
|
-
spinner.start("Loading your account from Dash…");
|
|
16
|
-
}
|
|
11
|
+
const interactive = !reporter.headless && !reporter.json;
|
|
12
|
+
if (interactive) reporter.info("Loading your account from Dash…");
|
|
17
13
|
let me = null;
|
|
18
14
|
try {
|
|
19
15
|
me = await loadMe(flags, reporter, { required: false });
|
|
20
16
|
} catch (error) {
|
|
21
|
-
|
|
22
|
-
spinner = null;
|
|
23
|
-
} finally {
|
|
24
|
-
spinner?.stop(
|
|
25
|
-
me?.account?.username ? `Account ${me.account.username}` : "Catalog (not logged in)"
|
|
26
|
-
);
|
|
17
|
+
reporter.warn(`Could not load account (${error.message}); showing catalog only.`);
|
|
27
18
|
}
|
|
28
19
|
|
|
29
20
|
const owned = me ? new Set(ownedLibs(me).map((lib) => lib.site)) : null;
|
|
@@ -31,23 +22,13 @@ export async function libsCmd(flags, rest, reporter) {
|
|
|
31
22
|
|
|
32
23
|
for (const lib of LIBS) {
|
|
33
24
|
const keys = me ? resolveLibKeys(lib, me) : { cli: null, mcp: null };
|
|
34
|
-
const
|
|
35
|
-
keys.cli ? "cli" : null,
|
|
36
|
-
keys.mcp ? "mcp" : null,
|
|
37
|
-
].filter(Boolean);
|
|
25
|
+
const isOwned = owned ? owned.has(lib.site) : null;
|
|
38
26
|
rows.push({
|
|
39
27
|
site: lib.site,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
? keyBits.length
|
|
43
|
-
? `owned · ${keyBits.join(" + ")} key${keyBits.length > 1 ? "s" : ""}`
|
|
44
|
-
: "owned · no keys bound"
|
|
45
|
-
: "—"
|
|
46
|
-
: "?",
|
|
28
|
+
cli: isOwned === false ? "not owned" : keys.cli ? "bound" : "—",
|
|
29
|
+
mcp: isOwned === false ? "—" : keys.mcp ? "bound" : lib.mcp ? "—" : "generic",
|
|
47
30
|
name: lib.siteName,
|
|
48
|
-
owned:
|
|
49
|
-
cli: keys.cli ? "bound" : "—",
|
|
50
|
-
mcp: keys.mcp ? "bound" : "—",
|
|
31
|
+
owned: isOwned === null ? "?" : isOwned ? "yes" : "no",
|
|
51
32
|
registries: (lib.registries ?? []).map((r) => r.scope).join(", ") || "—",
|
|
52
33
|
mcpServer: lib.mcp ?? (lib.shadcnUiMcp ? "shadcn (generic)" : "—"),
|
|
53
34
|
});
|
|
@@ -73,7 +54,8 @@ export async function libsCmd(flags, rest, reporter) {
|
|
|
73
54
|
])
|
|
74
55
|
: formatTable(rows, [
|
|
75
56
|
{ key: "site", header: "SITE" },
|
|
76
|
-
{ key: "
|
|
57
|
+
{ key: "cli", header: "CLI KEY" },
|
|
58
|
+
{ key: "mcp", header: "MCP KEY" },
|
|
77
59
|
])
|
|
78
60
|
);
|
|
79
61
|
if (!me) {
|