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