@collectui/cli 0.2.3 → 0.2.5
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/cli.mjs +7 -2
- package/src/commands/setup.mjs +0 -2
- package/src/login.mjs +0 -2
- 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/cli.mjs
CHANGED
|
@@ -15,6 +15,7 @@ import { collectSecrets, readConfig, resolveToken } from "./config.mjs";
|
|
|
15
15
|
import { CliError, usageError } from "./errors.mjs";
|
|
16
16
|
import { createReporter } from "./report.mjs";
|
|
17
17
|
import { startBackgroundUpdate } from "./update.mjs";
|
|
18
|
+
import { showBanner } from "./banner.mjs";
|
|
18
19
|
import { loginCmd, logoutCmd } from "./commands/login.mjs";
|
|
19
20
|
import { whoamiCmd } from "./commands/whoami.mjs";
|
|
20
21
|
import { libsCmd } from "./commands/libs.mjs";
|
|
@@ -163,8 +164,12 @@ async function main() {
|
|
|
163
164
|
const reporter = makeReporter(flags, token);
|
|
164
165
|
if (token) reporter.addSecrets([token]);
|
|
165
166
|
|
|
166
|
-
//
|
|
167
|
-
|
|
167
|
+
showBanner(reporter); // 开机画面:任何子命令(headless/--version/help 已在前面分流)
|
|
168
|
+
// 自更新:交互 TTY 下后台检查/自动更(headless/CI 由门控静默跳过);
|
|
169
|
+
// 手动 update 命令自身不触发(避免与前台安装并发写全局目录)
|
|
170
|
+
if (name !== "update" && name !== "upgrade") {
|
|
171
|
+
startBackgroundUpdate(reporter, { config: readConfig() });
|
|
172
|
+
}
|
|
168
173
|
|
|
169
174
|
await command.run(flags, rest, reporter);
|
|
170
175
|
}
|
package/src/commands/setup.mjs
CHANGED
|
@@ -10,7 +10,6 @@ import { fetchMe } from "../dash.mjs";
|
|
|
10
10
|
import { planMcpConfig, describeEntries } from "../mcp.mjs";
|
|
11
11
|
import { detectPackageManager, planProjectConfig } from "../project.mjs";
|
|
12
12
|
import { planManifest, planScaffold } from "../scaffold.mjs";
|
|
13
|
-
import { showBanner } from "../banner.mjs";
|
|
14
13
|
import { selectLibs } from "./common.mjs";
|
|
15
14
|
|
|
16
15
|
const DEFAULT_CLIENTS = ["claude", "cursor", "vscode"];
|
|
@@ -61,7 +60,6 @@ function isNonEmptyDir(dir) {
|
|
|
61
60
|
*/
|
|
62
61
|
export async function runSetup({ flags, rest = [], reporter, mode }) {
|
|
63
62
|
reporter.intro(`CollectUI CLI · ${mode}`);
|
|
64
|
-
if (mode === "init") showBanner(reporter);
|
|
65
63
|
|
|
66
64
|
let token = resolveToken(flags);
|
|
67
65
|
if (!token) {
|
package/src/login.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
4
|
import * as p from "@clack/prompts";
|
|
5
|
-
import { showBanner } from "./banner.mjs";
|
|
6
5
|
import { clearConfig, configFile, dashUrl, writeConfig } from "./config.mjs";
|
|
7
6
|
import { authError } from "./errors.mjs";
|
|
8
7
|
import { jsonRequest } from "./http.mjs";
|
|
@@ -52,7 +51,6 @@ export async function login({
|
|
|
52
51
|
pat = false,
|
|
53
52
|
}) {
|
|
54
53
|
reporter.intro("CollectUI CLI · login");
|
|
55
|
-
showBanner(reporter);
|
|
56
54
|
|
|
57
55
|
let token = providedToken || process.env.COLLECTUI_TOKEN || process.env.DASH_PAT || "";
|
|
58
56
|
token = token.trim();
|
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 {
|