@collectui/cli 0.2.4 → 0.2.6
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/banner.mjs +7 -6
- package/src/commands/login.mjs +17 -5
- package/src/login.mjs +1 -1
- package/src/update.mjs +1 -1
package/package.json
CHANGED
package/src/banner.mjs
CHANGED
|
@@ -10,17 +10,17 @@ import { CLI_VERSION } from "./version.mjs";
|
|
|
10
10
|
const GLYPH = [
|
|
11
11
|
" ██████╗ ██╗ ██╗██╗",
|
|
12
12
|
"██╔════╝ ██║ ██║██║",
|
|
13
|
-
"██║
|
|
14
|
-
"██║ ██║██║
|
|
13
|
+
"██║ ██║ ██║██║",
|
|
14
|
+
"██║ ██║ ██║██║",
|
|
15
15
|
"╚██████╔╝╚██████╔╝██║",
|
|
16
16
|
" ╚═════╝ ╚═════╝ ╚═╝",
|
|
17
17
|
];
|
|
18
18
|
|
|
19
19
|
const TAGLINE = "One CLI for every shadcn library";
|
|
20
20
|
|
|
21
|
-
//
|
|
22
|
-
const FROM = [
|
|
23
|
-
const TO = [
|
|
21
|
+
// 亮绿 → 深绿(emerald-400 → green-700)
|
|
22
|
+
const FROM = [52, 211, 153];
|
|
23
|
+
const TO = [21, 128, 61];
|
|
24
24
|
|
|
25
25
|
const GRAY = "\x1b[90m";
|
|
26
26
|
const RESET = "\x1b[0m";
|
|
@@ -44,7 +44,8 @@ function rgbColor(at, text) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
function ansi256(at, text) {
|
|
47
|
-
|
|
47
|
+
// emerald 系近似:亮端 80/79/78(#5fd7d7→#5fafaf),深端 36/35/29(#00d7af→#00af5f)
|
|
48
|
+
const codes = [80, 79, 78, 36, 35, 29];
|
|
48
49
|
return `\x1b[38;5;${codes[Math.min(at, codes.length - 1)]}m${text}${RESET}`;
|
|
49
50
|
}
|
|
50
51
|
|
package/src/commands/login.mjs
CHANGED
|
@@ -13,11 +13,23 @@ export async function loginCmd(flags, rest, reporter) {
|
|
|
13
13
|
skipVerify: Boolean(flags["no-verify"]),
|
|
14
14
|
pat: Boolean(flags.pat),
|
|
15
15
|
});
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
// 交互模式:只显示人要看的(账号已在 success 行里,这里补数量与下一步);
|
|
17
|
+
// --json / headless 才给完整结构(Agent 消费 uid / 库清单 / key 数)
|
|
18
|
+
if (reporter.headless) {
|
|
19
|
+
reporter.result({
|
|
20
|
+
account: {
|
|
21
|
+
uid: me?.account?.uid ?? null,
|
|
22
|
+
username: me?.account?.username ?? null,
|
|
23
|
+
},
|
|
24
|
+
libraries: (me?.sites ?? []).map((s) => s.slug),
|
|
25
|
+
keys: (me?.keys ?? []).length,
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
reporter.result({
|
|
29
|
+
libraries: (me?.sites ?? []).length,
|
|
30
|
+
keys: (me?.keys ?? []).length,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
21
33
|
}
|
|
22
34
|
|
|
23
35
|
export function logoutCmd(flags, rest, reporter) {
|
package/src/login.mjs
CHANGED
|
@@ -26,7 +26,7 @@ export function saveSession(token, me, { reporter } = {}) {
|
|
|
26
26
|
});
|
|
27
27
|
reporter?.success(
|
|
28
28
|
account?.username
|
|
29
|
-
? `Logged in as ${account.username}
|
|
29
|
+
? `Logged in as ${account.username}.`
|
|
30
30
|
: "Logged in. Token saved locally."
|
|
31
31
|
);
|
|
32
32
|
return account;
|
package/src/update.mjs
CHANGED
|
@@ -151,7 +151,7 @@ export function startBackgroundUpdate(reporter, deps = {}) {
|
|
|
151
151
|
writeUpdateCache({ spawnedAt: Date.now(), spawnTo: ok ? to : null });
|
|
152
152
|
reporter.info(
|
|
153
153
|
ok
|
|
154
|
-
? `⬆ ${NPM_PACKAGE} ${CLI_VERSION} → ${to}: updating in background — takes effect on next run.`
|
|
154
|
+
? `⬆ ${NPM_PACKAGE} ${CLI_VERSION} → ${to}: updating in background — takes effect on next run (the binary blinks out for a few seconds while npm installs).`
|
|
155
155
|
: `⬆ ${NPM_PACKAGE} ${to} available (auto-update failed; run \`npm i -g ${NPM_PACKAGE}\`).`
|
|
156
156
|
);
|
|
157
157
|
} else {
|