mine-auto-cli 2.7.5 → 2.8.1

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/index.js CHANGED
@@ -1,373 +1,501 @@
1
- import { program as g } from "commander";
2
- import l from "chalk";
3
- import { readFileSync as h, writeFileSync as v, existsSync as $, readdirSync as je, cpSync as _, rmSync as Ce } from "fs";
4
- import { join as y, resolve as f } from "path";
5
- import oe from "log-symbols";
6
- import we from "ora";
7
- import { execSync as k } from "child_process";
8
- import be from "js-yaml";
9
- import ke from "strip-json-comments";
10
- import Oe from "pacote";
11
- import { parseRange as D } from "semver-utils";
12
- import xe from "download-git-repo";
13
- import q from "inquirer";
14
- import se from "os";
15
- import Ae from "update-notifier";
16
- const re = "mine-auto-cli", ce = "2.7.5", Ne = "./dist/index.js", Pe = "./dist/index.js", Ie = "module", Ee = { auto: "bin/mine-auto-cli.js" }, Je = { name: "biaov", email: "biaov@qq.com", url: "https://biaov.cn" }, Me = "一个将多个命令简化成一个命令的工具 😆", Le = { start: "npm run dev", dev: "npm run build -- --watch", build: "vite build", prettier: "prettier --write '**/*.{js,ts,md,json}'", tag: "node scripts/tag" }, Re = { registry: "https://registry.npmjs.org/", "engine-strict": !0, provenance: !0 }, De = { node: ">=24.x" }, Ve = ["auto", "cli", "vite", "typescript"], Te = { type: "git", url: "git+https://github.com/biaov/mine-auto-cli.git" }, _e = "https://github.com/biaov/mine-auto-cli.git", Fe = { url: "https://github.com/biaov/mine-auto-cli/issues" }, Ue = "ISC", He = [{ name: "biaov", email: "biaov@qq.com" }], qe = { chalk: "^5.6.2", commander: "^14.0.3", "download-git-repo": "^3.0.2", inquirer: "^13.3.0", "js-yaml": "^4.1.1", "log-symbols": "^7.0.1", ora: "^9.3.0", pacote: "^21.4.0", "semver-utils": "^1.1.4", "strip-json-comments": "^5.0.3", "update-notifier": "^7.3.1" }, Be = { "@types/js-yaml": "^4.0.9", "@types/node": "^25.3.3", "@types/pacote": "^11.1.8", "@types/semver-utils": "^1.1.3", "@types/update-notifier": "^6.0.8", prettier: "^3.8.1", typescript: "^5.9.3", vite: "^7.3.1" }, I = {
17
- name: re,
18
- private: !1,
19
- version: ce,
20
- exports: Ne,
21
- main: Pe,
22
- type: Ie,
23
- bin: Ee,
24
- author: Je,
25
- description: Me,
26
- scripts: Le,
27
- publishConfig: Re,
28
- engines: De,
29
- keywords: Ve,
30
- repository: Te,
31
- homepage: _e,
32
- bugs: Fe,
33
- license: Ue,
34
- contributors: He,
35
- dependencies: qe,
36
- devDependencies: Be
37
- }, u = (e) => {
38
- console.log(`${oe.success} ${l.green("SUCCESS")} ${e}`);
1
+ import { program as e } from "commander";
2
+ import t from "chalk";
3
+ import { cpSync as n, existsSync as r, readFileSync as i, readdirSync as a, rmSync as o, writeFileSync as s } from "fs";
4
+ import { join as c, resolve as l } from "path";
5
+ import u from "log-symbols";
6
+ import d from "ora";
7
+ import { execSync as f } from "child_process";
8
+ import * as p from "js-yaml";
9
+ import ee from "strip-json-comments";
10
+ import te from "pacote";
11
+ import { parseRange as m } from "semver-utils";
12
+ import ne from "download-git-repo";
13
+ import h from "inquirer";
14
+ import g from "os";
15
+ import re from "update-notifier";
16
+ //#region package.json
17
+ var ie = "mine-auto-cli", ae = "2.8.1", _ = {
18
+ name: ie,
19
+ private: !1,
20
+ version: ae,
21
+ exports: "./dist/index.js",
22
+ main: "./dist/index.js",
23
+ type: "module",
24
+ bin: { auto: "bin/mine-auto-cli.js" },
25
+ author: {
26
+ name: "biaov",
27
+ email: "biaov@qq.com",
28
+ url: "https://biaov.cn"
29
+ },
30
+ description: "一个将多个命令简化成一个命令的工具 😆",
31
+ scripts: {
32
+ start: "npm run dev",
33
+ dev: "npm run build -- --watch",
34
+ build: "vite build",
35
+ prettier: "prettier --write '**/*.{js,ts,md,json}'",
36
+ tag: "node scripts/tag"
37
+ },
38
+ publishConfig: {
39
+ registry: "https://registry.npmjs.org/",
40
+ "engine-strict": !0,
41
+ provenance: !0
42
+ },
43
+ engines: { node: ">=24.18.0" },
44
+ keywords: [
45
+ "auto",
46
+ "cli",
47
+ "vite",
48
+ "typescript"
49
+ ],
50
+ repository: {
51
+ type: "git",
52
+ url: "git+https://github.com/biaov/mine-auto-cli.git"
53
+ },
54
+ homepage: "https://github.com/biaov/mine-auto-cli.git",
55
+ bugs: { url: "https://github.com/biaov/mine-auto-cli/issues" },
56
+ license: "ISC",
57
+ contributors: [{
58
+ name: "biaov",
59
+ email: "biaov@qq.com"
60
+ }],
61
+ dependencies: {
62
+ chalk: "^5.6.2",
63
+ commander: "^15.0.0",
64
+ "download-git-repo": "^3.0.2",
65
+ inquirer: "^14.0.2",
66
+ "js-yaml": "^5.1.0",
67
+ "log-symbols": "^7.0.1",
68
+ ora: "^9.4.1",
69
+ pacote: "^22.0.0",
70
+ "semver-utils": "^1.1.4",
71
+ "strip-json-comments": "^5.0.3",
72
+ "update-notifier": "^7.3.1"
73
+ },
74
+ devDependencies: {
75
+ "@types/js-yaml": "^4.0.9",
76
+ "@types/node": "^26.0.0",
77
+ "@types/pacote": "^11.1.8",
78
+ "@types/semver-utils": "^1.1.3",
79
+ "@types/update-notifier": "^6.0.8",
80
+ prettier: "^3.8.4",
81
+ typescript: "^6.0.3",
82
+ vite: "^8.1.0"
83
+ }
84
+ }, v = (e) => {
85
+ console.log(`${u.success} ${t.green("SUCCESS")} ${e}`);
86
+ }, y = (e) => {
87
+ console.log(`${ie} ${u.error} ${t.red("ERROR")} ${e}`);
88
+ }, b = (e) => {
89
+ console.log(e ?? "");
90
+ }, oe = (e) => {
91
+ b(`开始执行 ${t.cyanBright(e)} 命令`);
92
+ let n = d({
93
+ text: "正在执行命令中...",
94
+ color: "yellow"
95
+ });
96
+ n.start(), b(f(e, { cwd: process.cwd() }).toString()), n.succeed(`${t.green(e)} 命令执行成功`), b();
97
+ }, se = (e) => [
98
+ "git add -A",
99
+ `git commit -m ${e}`,
100
+ "git push"
101
+ ], ce = (e, t) => [
102
+ `npm run ${e}`,
103
+ "git add -A",
104
+ `git commit -m ${t}`,
105
+ "git push"
106
+ ], le = async (e, n = "打包") => {
107
+ b(), b(`${t.yellow(">>")} 开始依次执行命令...`), b(), ce(e, n).map(oe), v("全部命令执行完成"), b();
108
+ }, x = (t) => {
109
+ b(), y(`\`${t}\` 命令错误,请检查你的命令`), b(), e.help();
39
110
  }, S = (e) => {
40
- console.log(`${re} ${oe.error} ${l.red("ERROR")} ${e}`);
41
- }, a = (e) => {
42
- console.log(e ?? "");
43
- }, ie = (e) => {
44
- a(`开始执行 ${l.cyanBright(e)} 命令`);
45
- const t = we({ text: "正在执行命令中...", color: "yellow" });
46
- t.start();
47
- const s = k(e, { cwd: process.cwd() });
48
- a(s.toString()), t.succeed(`${l.green(e)} 命令执行成功`), a();
49
- }, Ge = (e) => ["git add -A", `git commit -m ${e}`, "git push"], ze = (e, t) => [`npm run ${e}`, "git add -A", `git commit -m ${t}`, "git push"], Ke = async (e, t = "打包") => {
50
- a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(), ze(e, t).map(ie), u("全部命令执行完成"), a();
51
- }, B = (e) => {
52
- a(), S(`\`${e}\` 命令错误,请检查你的命令`), a(), g.help();
53
- }, G = (e) => {
54
- const t = ["package.json", "README.md"].map((r) => {
55
- const c = y(process.cwd(), r), i = h(c).toString();
56
- return { path: c, content: i };
57
- }), [s, n] = t, o = JSON.parse(s.content);
58
- if (e)
59
- o.version = e;
60
- else {
61
- const r = o.version.split(".").reduce((c, i, p, m) => c + (p === m.length - 1 ? +i + 1 : `${i}.`), "");
62
- o.version = r;
63
- }
64
- v(s.path, JSON.stringify(o, null, 2)), n.content = n.content.replace(/version\-v.+\-blue/, () => `version-v${o.version}-blue`), v(n.path, n.content);
65
- }, Ye = async (e) => {
66
- const t = e.split("version")[1];
67
- if (!t) return B(e);
68
- const s = JSON.parse(h(y(process.cwd(), "package.json")).toString());
69
- if (t === "++") {
70
- const o = s.version.split(".").reduce((r, c, i, p) => r + (i === p.length - 1 ? +c + 1 : `${c}.`), "");
71
- G(o), a(), u("命令执行完成");
72
- return;
73
- }
74
- const n = t.split("@")[1];
75
- n ? (G(n), a(), u("命令执行完成")) : B(e);
76
- }, Ze = (e, t) => {
77
- if (e.includes("build")) return Ke(e, t);
78
- if (e.includes("version")) return Ye(e);
79
- S(l.hex("#f56c6c")(`\`auto ${e}${t ? ` ${t}` : ""}\` 命令不存在`)), g.help();
80
- }, b = "https://gitee.com/biaovorg/project-template.git", Qe = {
81
- vue: b,
82
- react: b,
83
- "uni-app": b,
84
- electron: b,
85
- node: b,
86
- "node-simple": b
87
- }, We = Object.keys(Qe);
88
- We.reduce((e, t, s) => e + (s ? ", " : "") + t, "");
89
- const C = (e = "jsonc") => `auto-cli.${e}`;
90
- f(import.meta.dirname, "./presetData.json");
91
- const F = (e, t = !1) => {
92
- if (!$(e)) return t ? {} : "";
93
- const s = h(e).toString();
94
- return t ? JSON.parse(ke(s)) : s;
95
- }, Xe = (e) => {
96
- if (!$(e)) return {};
97
- const t = h(e).toString();
98
- try {
99
- return be.load(t);
100
- } catch {
101
- return {};
102
- }
103
- }, ae = (e = !1) => F(f(import.meta.dirname, C()), e), le = () => {
104
- const [e, t] = [C(), C("yml")].map((n) => f(process.cwd(), n)), s = ae(!0);
105
- try {
106
- Object.assign(s, Xe(t), F(e, !0));
107
- } catch {
108
- }
109
- return s;
110
- }, et = (e, t = !1) => {
111
- let s = ae(t);
112
- return t && (s = JSON.stringify(s, null, 2)), e.includes(".yml") ? s.trim().split(`
113
- `).slice(1, -1).reduce((n, o) => n + o.trim().replace(/[",]/g, "").replace("// ", "# ") + `
114
- `, "") : s;
115
- }, pe = (e, t, s = " ") => Array.from({ length: t - e }, () => s).join(""), tt = ({ yml: e, uncomment: t, force: s }) => {
116
- a();
117
- const n = C(e ? "yml" : "jsonc"), o = f(process.cwd(), n);
118
- if ($(o) && !s) {
119
- a(l.yellow(`${n} 文件已存在`)), a(), a(l.yellow(`文件目录 ${o}`));
120
- return;
121
- }
122
- v(o, et(n, t)), u(`${n} 文件创建成功`), a(), a(l.green(`文件目录 ${o}`));
123
- };
124
- g.command("init").option("-f, --force", `强制替换 ${C()} 文件内容`, !1).option("--unc, --uncomment", `取消生成 ${C()} 带注释`, !1).option("-y, --yml", `生成 ${C("yml")} 文件`, !1).description("初始化配置文件").action(tt);
125
- const nt = async (e = "更新代码") => {
126
- a(), a(`${l.yellow(">>")} 开始依次执行命令...`), a(), Ge(e).forEach(ie), u("全部命令执行完成"), a();
127
- };
128
- g.command("git [描述]").description("简化 Git 提交命令").action(nt);
129
- const z = ["dist", "node_modules", ".git", "miniprogram_npm"];
130
- let J = 0, me = !1, V = !1, de = 20;
131
- const K = ({ prev: e, i: t, index: s, arr: n, curText: o }) => {
132
- const r = Array.from({ length: t }).reduce((m) => m + `${t === 1 && s === n.length - 1 ? "└ " : "│ "} `, ""), c = e + r, i = (r + o).length, p = Array.from({ length: de + J - i }).reduce((m) => `${m}-`, " ");
133
- return !me && (J = Math.max(J, i)), `${c}${o}${V ? p : ""}
134
- `;
135
- }, T = (e, t = 0) => e.reduce((s, n, o, r) => {
136
- let c;
137
- return n.children ? (c = `├── ${n.name}`, K({ prev: s, i: t, index: o, arr: r, curText: c }) + T(n.children, t + 1)) : (c = `${o === r.length - 1 ? "└── " : "├── "}${n.name}`, K({ prev: s, i: t, index: o, arr: r, curText: c }));
138
- }, ""), Y = (e) => je(e, { withFileTypes: !0 }).sort((t, s) => +s.isDirectory() - +t.isDirectory()), ot = ({ line: e, name: t }) => {
139
- V = !!e, typeof e == "string" && (de = +e);
140
- const s = process.cwd(), n = y(s, ".gitignore");
141
- if ($(n)) {
142
- const p = h(n).toString().split(`\r
143
- `);
144
- z.push(...p);
145
- }
146
- const o = s.split("\\").at(-1), c = Y(s).map((p) => {
147
- const { name: m } = p, d = { name: m };
148
- return !z.includes(m) && p.isDirectory() && (d.children = Y(y(p.path, m)).map(({ name: O }) => ({ name: O }))), d;
149
- }), i = [{ name: o, children: c }];
150
- V && (T(i), me = !0), v(y(s, `${typeof t == "string" && t || "directory"}.md`), T(i));
151
- };
152
- g.command("mkdir").option("-l, --line [数量]", "数量", !1).option("-n, --name [文件名称]", "文件名称", !1).option("-d, --depth [深度值]", "深度值", "3").description("生成目录结构文件").action(ot);
153
- const x = le(), [M] = ["package.json"].map((e) => f(process.cwd(), e)), st = (e, t) => {
154
- const s = Array.from({ length: t }, (c, i) => i < e ? "=" : " ").join(""), n = ~~(e / t * 100), o = `\r查找进度:[${s}] ${e}/${t} ${n}%\r`, r = e === t ? l.green(o) : l.yellow(o);
155
- process.stdout.write(r);
156
- }, rt = (e, t, s) => {
157
- let n = "latest";
158
- x.resolve.some((r) => {
159
- const c = r.lastIndexOf("@");
160
- if (c <= 0) return !0;
161
- const i = r.slice(0, c), p = r.slice(c + 1);
162
- if (e === i)
163
- return n = p, !0;
164
- });
165
- const o = x.prefix + s[n];
166
- return { name: e, value: t, newVersion: o, tag: n };
167
- }, ct = (e, t) => (+!t + 1) * e.length, Z = (e) => {
168
- const [{ major: t = 0, minor: s = 0, patch: n = 0, release: o = "" }] = D(e);
169
- return [+t, +s, +n, o];
170
- }, L = (e, t) => e ? "-" + l[t](e) : "", it = (e, t) => {
171
- const [s, n, o, r] = Z(e), [c, i, p, m] = Z(t);
172
- return c > s ? l.red(t) : c < s ? !1 : i > n ? `${c}.${l.yellow(i)}.${l.yellow(p)}${L(m, "yellow")}` : i < n ? !1 : p > o ? `${c}.${i}.${l.green(p)}${L(m, "green")}` : p === o && m && m !== r ? `${c}.${i}.${p}${L(m, "green")}` : !1;
173
- }, at = (e) => {
174
- const t = {};
175
- e.forEach((n) => {
176
- Object.entries(n).forEach(([o, r]) => {
177
- t[o] = Math.max(r.length, t[o] ?? 0);
178
- });
179
- }), e.unshift({ name: "包名", value: "版本", newVersion: "新版本", tag: "标签" });
180
- const s = [];
181
- e.forEach(({ name: n, value: o, newVersion: r, tag: c }, i) => {
182
- const [p, m, d, O] = Object.entries({ name: n, value: o, newVersion: r, tag: c }).map(([N, Se]) => pe(ct(Se, i), t[N]));
183
- let w = l.yellow("→"), H = !0;
184
- if (i) {
185
- const N = it(o, r);
186
- N ? r = N : H = !1;
187
- } else
188
- n = l.green(n), o = l.green(o), r = l.green(r), c = l.green(c), w = " ";
189
- const ve = `${n + p} ${m + o} ${w} ${d + r} ${O + c}`;
190
- H && s.push(ve);
191
- }), s.length > 1 ? s.forEach(a) : u("所有版本已是最新");
192
- }, lt = async (e, t, s) => {
193
- a();
194
- let n = 0;
195
- const o = [], r = Object.entries(e), c = r.map(async ([i, p]) => {
196
- const m = await Oe.packument(i, { registry: x.registry }), d = rt(i, p, m["dist-tags"]);
197
- o.push(d), t.forEach((O) => {
198
- const w = s[O];
199
- w && w[i] && (w[i] = d.newVersion);
200
- }), n++, await st(n, r.length);
201
- });
202
- return await Promise.all(c), a(), a(), o;
203
- }, pt = async ({ update: e }) => {
204
- if (!$(M)) return S("package.json 文件不存在");
205
- const t = e || x.check, s = h(M).toString(), n = JSON.parse(s), o = ["dependencies", "devDependencies", "optionalDependencies"], r = {}, c = JSON.parse(s);
206
- o.forEach((p) => {
207
- n[p] && Object.entries(n[p]).forEach(([m, d]) => {
208
- !x.reject.includes(m) && (r[m] = d);
209
- });
210
- });
211
- const i = await lt(r, o, c);
212
- t ? (v(M, JSON.stringify(c, null, 2)), u("文件 package.json 已更新"), a()) : at(i);
213
- };
214
- g.command("check").option("-u, --update", "更新 package.json 依赖内容", !1).description("升级 package.json 依赖版本").action(pt);
215
- const mt = le(), ge = "comment.md", dt = ["package.json", ge], [Q, W] = dt.map((e) => f(process.cwd(), e)), gt = () => {
216
- if (!$(Q)) return S("package.json 文件不存在");
217
- const e = h(Q).toString(), t = JSON.parse(e), s = ["dependencies", "devDependencies", "optionalDependencies"];
218
- let n = `### 依赖解析
219
-
220
- `;
221
- s.forEach((o) => {
222
- t[o] && (n += `#### ${o}
223
-
224
- `, Object.keys(t[o]).forEach((r) => {
225
- n += `- \`${r}\`: ${mt.comment[r] || ""}
226
- `;
227
- }), n += `
228
- `);
229
- }), n = n.slice(0, -1), v(W, n), a(), u(`${ge} 文件创建成功`), a(), a(l.green(`文件目录 ${W}`));
111
+ let [t, n] = ["package.json", "README.md"].map((e) => {
112
+ let t = c(process.cwd(), e);
113
+ return {
114
+ path: t,
115
+ content: i(t).toString()
116
+ };
117
+ }), r = JSON.parse(t.content);
118
+ e ? r.version = e : r.version = r.version.split(".").reduce((e, t, n, r) => e + (n === r.length - 1 ? +t + 1 : `${t}.`), ""), s(t.path, JSON.stringify(r, null, 2)), n.content = n.content.replace(/version\-v.+\-blue/, () => `version-v${r.version}-blue`), s(n.path, n.content);
119
+ }, ue = async (e) => {
120
+ let t = e.split("version")[1];
121
+ if (!t) return x(e);
122
+ let n = JSON.parse(i(c(process.cwd(), "package.json")).toString());
123
+ if (t === "++") {
124
+ S(n.version.split(".").reduce((e, t, n, r) => e + (n === r.length - 1 ? +t + 1 : `${t}.`), "")), b(), v("命令执行完成");
125
+ return;
126
+ }
127
+ let r = t.split("@")[1];
128
+ r ? (S(r), b(), v("命令执行完成")) : x(e);
129
+ }, de = (n, r) => {
130
+ if (n.includes("build")) return le(n, r);
131
+ if (n.includes("version")) return ue(n);
132
+ y(t.hex("#f56c6c")(`\`auto ${n}${r ? ` ${r}` : ""}\` 命令不存在`)), e.help();
133
+ }, C = "https://gitee.com/biaovorg/project-template.git";
134
+ Object.keys({
135
+ vue: C,
136
+ react: C,
137
+ "uni-app": C,
138
+ electron: C,
139
+ node: C,
140
+ "node-simple": C
141
+ }).reduce((e, t, n) => e + (n ? ", " : "") + t, "");
142
+ var w = (e = "jsonc") => `auto-cli.${e}`;
143
+ l(import.meta.dirname, "./presetData.json");
144
+ var T = (e, t = !1) => {
145
+ if (!r(e)) return t ? {} : "";
146
+ let n = i(e).toString();
147
+ return t ? JSON.parse(ee(n)) : n;
148
+ }, fe = (e) => {
149
+ if (!r(e)) return {};
150
+ let t = i(e).toString();
151
+ try {
152
+ return p.load(t);
153
+ } catch {
154
+ return {};
155
+ }
156
+ }, E = (e = !1) => T(l(import.meta.dirname, w()), e), D = () => {
157
+ let [e, t] = [w(), w("yml")].map((e) => l(process.cwd(), e)), n = E(!0);
158
+ try {
159
+ Object.assign(n, fe(t), T(e, !0));
160
+ } catch {}
161
+ return n;
162
+ }, pe = (e, t = !1) => {
163
+ let n = E(t);
164
+ return t && (n = JSON.stringify(n, null, 2)), e.includes(".yml") ? n.trim().split("\n").slice(1, -1).reduce((e, t) => e + t.trim().replace(/[",]/g, "").replace("// ", "# ") + "\n", "") : n;
165
+ }, O = (e, t, n = " ") => Array.from({ length: t - e }, () => n).join("");
166
+ e.command("init").option("-f, --force", `强制替换 ${w()} 文件内容`, !1).option("--unc, --uncomment", `取消生成 ${w()} 带注释`, !1).option("-y, --yml", `生成 ${w("yml")} 文件`, !1).description("初始化配置文件").action(({ yml: e, uncomment: n, force: i }) => {
167
+ b();
168
+ let a = w(e ? "yml" : "jsonc"), o = l(process.cwd(), a);
169
+ if (r(o) && !i) {
170
+ b(t.yellow(`${a} 文件已存在`)), b(), b(t.yellow(`文件目录 ${o}`));
171
+ return;
172
+ }
173
+ s(o, pe(a, n)), v(`${a} 文件创建成功`), b(), b(t.green(`文件目录 ${o}`));
174
+ }), e.command("git [描述]").description("简化 Git 提交命令").action(async (e = "更新代码") => {
175
+ b(), b(`${t.yellow(">>")} 开始依次执行命令...`), b(), se(e).forEach(oe), v("全部命令执行完成"), b();
176
+ });
177
+ //#endregion
178
+ //#region src/commander/commands/mkdir.ts
179
+ var k = [
180
+ "dist",
181
+ "node_modules",
182
+ ".git",
183
+ "miniprogram_npm"
184
+ ], A = 0, j = !1, M = !1, N = 20, P = ({ prev: e, i: t, index: n, arr: r, curText: i }) => {
185
+ let a = Array.from({ length: t }).reduce((e) => e + `${t === 1 && n === r.length - 1 ? "└ " : "│ "} `, ""), o = e + a, s = (a + i).length, c = Array.from({ length: N + A - s }).reduce((e) => `${e}-`, " ");
186
+ return !j && (A = Math.max(A, s)), `${o}${i}${M ? c : ""}\n`;
187
+ }, F = (e, t = 0) => e.reduce((e, n, r, i) => {
188
+ let a;
189
+ return n.children ? (a = `├── ${n.name}`, P({
190
+ prev: e,
191
+ i: t,
192
+ index: r,
193
+ arr: i,
194
+ curText: a
195
+ }) + F(n.children, t + 1)) : (a = `${r === i.length - 1 ? "└── " : "├── "}${n.name}`, P({
196
+ prev: e,
197
+ i: t,
198
+ index: r,
199
+ arr: i,
200
+ curText: a
201
+ }));
202
+ }, ""), I = (e) => a(e, { withFileTypes: !0 }).sort((e, t) => t.isDirectory() - +e.isDirectory());
203
+ e.command("mkdir").option("-l, --line [数量]", "数量", !1).option("-n, --name [文件名称]", "文件名称", !1).option("-d, --depth [深度值]", "深度值", "3").description("生成目录结构文件").action(({ line: e, name: t }) => {
204
+ M = !!e, typeof e == "string" && (N = +e);
205
+ let n = process.cwd(), a = c(n, ".gitignore");
206
+ if (r(a)) {
207
+ let e = i(a).toString().split("\r\n");
208
+ k.push(...e);
209
+ }
210
+ let o = [{
211
+ name: n.split("\\").at(-1),
212
+ children: I(n).map((e) => {
213
+ let { name: t } = e, n = { name: t };
214
+ return !k.includes(t) && e.isDirectory() && (n.children = I(c(e.path, t)).map(({ name: e }) => ({ name: e }))), n;
215
+ })
216
+ }];
217
+ M && (F(o), j = !0), s(c(n, `${typeof t == "string" && t || "directory"}.md`), F(o));
218
+ });
219
+ //#endregion
220
+ //#region src/commander/commands/check.ts
221
+ var L = D(), [R] = ["package.json"].map((e) => l(process.cwd(), e)), me = (e, n) => {
222
+ let r = `\r查找进度:[${Array.from({ length: n }, (t, n) => n < e ? "=" : " ").join("")}] ${e}/${n} ${~~(e / n * 100)}%\r`, i = e === n ? t.green(r) : t.yellow(r);
223
+ process.stdout.write(i);
224
+ }, he = (e, t, n) => {
225
+ let r = "latest";
226
+ return L.resolve.some((t) => {
227
+ let n = t.lastIndexOf("@");
228
+ if (n <= 0) return !0;
229
+ let i = t.slice(0, n), a = t.slice(n + 1);
230
+ if (e === i) return r = a, !0;
231
+ }), {
232
+ name: e,
233
+ value: t,
234
+ newVersion: L.prefix + n[r],
235
+ tag: r
236
+ };
237
+ }, ge = (e, t) => (+!t + 1) * e.length, z = (e) => {
238
+ let [{ major: t = 0, minor: n = 0, patch: r = 0, release: i = "" }] = m(e);
239
+ return [
240
+ +t,
241
+ +n,
242
+ +r,
243
+ i
244
+ ];
245
+ }, B = (e, n) => e ? "-" + t[n](e) : "", _e = (e, n) => {
246
+ let [r, i, a, o] = z(e), [s, c, l, u] = z(n);
247
+ return s > r ? t.red(n) : s < r ? !1 : c > i ? `${s}.${t.yellow(c)}.${t.yellow(l)}${B(u, "yellow")}` : c < i ? !1 : l > a ? `${s}.${c}.${t.green(l)}${B(u, "green")}` : l === a && u && u !== o ? `${s}.${c}.${l}${B(u, "green")}` : !1;
248
+ }, ve = (e) => {
249
+ let n = {};
250
+ e.forEach((e) => {
251
+ Object.entries(e).forEach(([e, t]) => {
252
+ n[e] = Math.max(t.length, n[e] ?? 0);
253
+ });
254
+ }), e.unshift({
255
+ name: "包名",
256
+ value: "版本",
257
+ newVersion: "新版本",
258
+ tag: "标签"
259
+ });
260
+ let r = [];
261
+ e.forEach(({ name: e, value: i, newVersion: a, tag: o }, s) => {
262
+ let [c, l, u, d] = Object.entries({
263
+ name: e,
264
+ value: i,
265
+ newVersion: a,
266
+ tag: o
267
+ }).map(([e, t]) => O(ge(t, s), n[e])), f = t.yellow("→"), p = !0;
268
+ if (s) {
269
+ let e = _e(i, a);
270
+ e ? a = e : p = !1;
271
+ } else e = t.green(e), i = t.green(i), a = t.green(a), o = t.green(o), f = " ";
272
+ let ee = `${e + c} ${l + i} ${f} ${u + a} ${d + o}`;
273
+ p && r.push(ee);
274
+ }), r.length > 1 ? r.forEach(b) : v("所有版本已是最新");
275
+ }, ye = async (e, t, n) => {
276
+ b();
277
+ let r = 0, i = [], a = Object.entries(e), o = a.map(async ([e, o]) => {
278
+ let s = he(e, o, (await te.packument(e, { registry: L.registry }))["dist-tags"]);
279
+ i.push(s), t.forEach((t) => {
280
+ let r = n[t];
281
+ r && r[e] && (r[e] = s.newVersion);
282
+ }), r++, await me(r, a.length);
283
+ });
284
+ return await Promise.all(o), b(), b(), i;
230
285
  };
231
- g.command("comment").description("生成依赖注释文件").action(gt);
232
- const X = { recursive: !0, force: !0 }, ut = () => {
233
- const e = `${+/* @__PURE__ */ new Date()}`, t = y(process.cwd()), s = y(t, e);
234
- xe("direct:https://gitee.com/biaovorg/vscode-config.git#master", s, { clone: !0 }, async (n) => {
235
- !n && _(y(s, ".vscode"), y(t, ".vscode"), X), Ce(s, X);
236
- });
286
+ e.command("check").option("-u, --update", "更新 package.json 依赖内容", !1).description("升级 package.json 依赖版本").action(async ({ update: e }) => {
287
+ if (!r(R)) return y("package.json 文件不存在");
288
+ let t = e || L.check, n = i(R).toString(), a = JSON.parse(n), o = [
289
+ "dependencies",
290
+ "devDependencies",
291
+ "optionalDependencies"
292
+ ], c = {}, l = JSON.parse(n);
293
+ o.forEach((e) => {
294
+ a[e] && Object.entries(a[e]).forEach(([e, t]) => {
295
+ !L.reject.includes(e) && (c[e] = t);
296
+ });
297
+ });
298
+ let u = await ye(c, o, l);
299
+ t ? (s(R, JSON.stringify(l, null, 2)), v("文件 package.json 已更新"), b()) : ve(u);
300
+ });
301
+ //#endregion
302
+ //#region src/commander/commands/comment.ts
303
+ var be = D(), V = "comment.md", [H, U] = ["package.json", V].map((e) => l(process.cwd(), e));
304
+ e.command("comment").description("生成依赖注释文件").action(() => {
305
+ if (!r(H)) return y("package.json 文件不存在");
306
+ let e = i(H).toString(), n = JSON.parse(e), a = [
307
+ "dependencies",
308
+ "devDependencies",
309
+ "optionalDependencies"
310
+ ], o = "### 依赖解析\n\n";
311
+ a.forEach((e) => {
312
+ n[e] && (o += `#### ${e}\n\n`, Object.keys(n[e]).forEach((e) => {
313
+ o += `- \`${e}\`: ${be.comment[e] || ""}\n`;
314
+ }), o += "\n");
315
+ }), o = o.slice(0, -1), s(U, o), b(), v(`${V} 文件创建成功`), b(), b(t.green(`文件目录 ${U}`));
316
+ });
317
+ //#endregion
318
+ //#region src/commander/commands/vscode.ts
319
+ var W = {
320
+ recursive: !0,
321
+ force: !0
237
322
  };
238
- g.command("vscode-config").description("更新 .vscode 配置文件").action(ut);
239
- const ue = (e, t, s) => {
240
- const n = Object.entries(t), o = n.findIndex(([i]) => e === i), [r, c] = n[o];
241
- if (c) {
242
- if (s[r] === c) return o === n.length - 1 ? !0 : ue(n[o + 1][0], t, s);
243
- } else
244
- return !0;
245
- }, ee = (e) => {
246
- e && (k(`nvm use ${e}`), a(), u(`切换成功 当前版本:${e}`), a());
247
- }, R = (e) => {
248
- e && k(`nvm install ${e}`);
249
- }, ft = (e, t) => {
250
- const s = k("nvm ls").toString(), n = D(s), [{ major: o, minor: r, patch: c }] = D(e), i = [], p = n.find((m) => {
251
- if (m.major === o)
252
- return i.push(m), ue("minor", { minor: r, patch: c }, m);
253
- });
254
- if (p)
255
- ee(p.semver);
256
- else if (a(), a(l.red(`输入的版本 ${e} 不存在`)), a(), i.length) {
257
- const m = i.map((d) => d.semver);
258
- q.prompt({
259
- type: "list",
260
- name: "preset",
261
- message: "请选择相似版本或输入版本进行安装:",
262
- choices: [...m, e, "取消"]
263
- }).then(({ preset: d }) => {
264
- if (d !== "取消")
265
- if (d === e) {
266
- if (!c) return;
267
- R(d);
268
- } else
269
- ee(d);
270
- });
271
- } else {
272
- if (!c) return;
273
- if (t.install) {
274
- R(e);
275
- return;
276
- }
277
- q.prompt({
278
- type: "confirm",
279
- name: "isInstall",
280
- message: `是否安装 ${e}?`
281
- }).then(({ isInstall: m }) => {
282
- m && R(e);
283
- });
284
- }
323
+ e.command("vscode-config").description("更新 .vscode 配置文件").action(() => {
324
+ let e = `${+/* @__PURE__ */ new Date()}`, t = c(process.cwd()), r = c(t, e);
325
+ ne("direct:https://gitee.com/biaovorg/vscode-config.git#master", r, { clone: !0 }, async (e) => {
326
+ !e && n(c(r, ".vscode"), c(t, ".vscode"), W), o(r, W);
327
+ });
328
+ });
329
+ //#endregion
330
+ //#region src/commander/commands/node.ts
331
+ var G = (e, t, n) => {
332
+ let r = Object.entries(t), i = r.findIndex(([t]) => e === t), [a, o] = r[i];
333
+ if (o) {
334
+ if (n[a] === o) return i === r.length - 1 ? !0 : G(r[i + 1][0], t, n);
335
+ } else return !0;
336
+ }, K = (e) => {
337
+ e && (f(`nvm use ${e}`), b(), v(`切换成功 当前版本:${e}`), b());
338
+ }, q = (e) => {
339
+ e && f(`nvm install ${e}`);
285
340
  };
286
- g.command("node [版本号]").option("-i, --install", "是否安装此版本", !1).description("切换 node 版本,默认选择第一个版本").action(ft);
287
- const U = ["ANTHROPIC_AUTH_TOKEN", "ANTHROPIC_BASE_URL", "ANTHROPIC_MODEL", "ANTHROPIC_SMALL_FAST_MODEL"], fe = F(f(import.meta.dirname, "ai.jsonc"), !0), te = Object.entries(fe)[0], E = f(se.homedir(), ".claude/settings.json"), j = f(se.homedir(), ".ai-model.json"), he = () => {
288
- $(E) || (S(`${E} 文件不存在,请先检查或者去安装 Claude Code`), process.exit(1));
289
- const e = JSON.parse(h(E).toString());
290
- return !e.env && (e.env = {}), e;
291
- }, $e = () => {
292
- a(), $(j) || (S("配置不存在,请先使用 `ai init` 初始化 AI 模型配置"), process.exit(1));
293
- const e = JSON.parse(h(j).toString()), t = Object.entries(e).filter(([s, n]) => {
294
- if (s === te[0]) return !1;
295
- const o = n.env, r = te[1].env;
296
- return !(!o || U.some((i) => !o[i] || o[i] === r[i]));
297
- });
298
- return t.length || (a(`暂无已配置的 AI 模型,请先配置,路径 ${l.green(j)}`), process.exit(1)), [t, e];
299
- }, ht = () => {
300
- if (a(), $(j)) {
301
- a(`配置已存在,路径 ${l.green(j)}`);
302
- return;
303
- }
304
- v(j, JSON.stringify(fe, null, 2)), u(`配置已初始化,路径 ${l.green(j)}`);
305
- }, ne = (e) => e.replace(/[\u4e00-\u9fa5]/g, "aa").length, $t = () => {
306
- const [e] = $e();
307
- let t = 0, s = -1;
308
- const n = he();
309
- e.forEach(([o, r], c) => {
310
- t = Math.max(t, ne(o)), s < 0 && !U.some((i) => n.env[i] !== r.env[i]) && (s = c);
311
- }), e.forEach(([o, r], c) => {
312
- const { ANTHROPIC_BASE_URL: i } = r.env, p = c === s ? l.green("*") : " ", m = pe(ne(o), t + 4, "-"), d = `${p} ${o} ${m} ${i}`;
313
- a(d);
314
- });
315
- }, yt = async (e) => {
316
- const t = he(), [s, n] = $e();
317
- s.some(([o]) => o === e) || (a(`模型 ${l.red(e)} 不存在`), process.exit(1)), U.some((o) => t.env[o] !== n[e].env[o]) ? (t.env = n[e].env, v(E, JSON.stringify(t, null, 2)), u(`模型 ${l.green(e)} 已切换`)) : a(`当前正处于 ${l.green(e)} 模型,无需切换`);
318
- }, ye = () => {
319
- const e = "@anthropic-ai/claude-code";
320
- try {
321
- k(`npm list -g ${e} --depth=0`).toString().trim().includes(e) || (S(l.red(`请使用 nodejs 安装 ${e}`)), process.exit(1));
322
- const n = k("npm root -g").toString().trim(), o = f(n, e, "cli.js"), r = f(n, e, "cli.bak.js");
323
- return !$(r) && _(o, r), { cliPath: o, cliPathBak: r };
324
- } catch {
325
- S(l.red(`请使用 nodejs 安装 ${e}`)), process.exit(1);
326
- }
327
- }, vt = async () => {
328
- a(), a("开始汉化 Claude Code");
329
- const { cliPath: e } = ye(), t = h(e).toString(), s = (await import("./keyword-CJ3Dr1_B.js")).default, n = Object.entries(s).reduce((o, [r, c]) => {
330
- const i = r.replace(/\n/g, "\\\\n").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), p = c.replace(/\n/g, "\\n");
331
- return ["`", "\\"].includes(i[0]) ? o.replace(new RegExp(i, "g"), c) : o.replace(new RegExp(`"${i}"`, "g"), `"${p}"`).replace(new RegExp(`('${i}')`, "g"), `'${p}'`);
332
- }, t);
333
- v(e, n), u("Claude Code 已汉化");
334
- }, St = () => {
335
- a(), a("开始恢复 Claude Code");
336
- const { cliPath: e, cliPathBak: t } = ye();
337
- _(t, e), u("Claude Code 已恢复成英文");
338
- }, A = g.command("ai").description("AI 命令,详细操作请查看 ai -h").helpOption("-h, --help", "输出所有命令").helpCommand(!1);
339
- A.command("init").description("初始化 AI 模型配置").action(ht);
340
- A.command("ls").description("查看当前已配置的 AI 模型").action($t);
341
- A.command("use <模型>").description("切换 AI 模型").action(yt);
342
- A.command("zh").description("汉化 Claude Code").action(vt);
343
- A.command("zh-restore").description("恢复汉化 Claude Code").action(St);
344
- g.usage("[commands] [options]").version(ce, "-v, --version", "输出版本号").helpOption("-h, --help", "输出所有命令");
345
- g.command("build[:环境] [描述]").description("简化打包提交命令");
346
- g.command("version<[++]|[@<版本号>]>").description("例如:version++ 或者 version@1.0.0;自动更新 package.json 版本号,自动更新 `README.md` 中的 `version-v<version>-blue` 图标版本");
347
- g.arguments("<cmd> [env]").action((e, t) => {
348
- Ze(e, t);
341
+ e.command("node [版本号]").option("-i, --install", "是否安装此版本", !1).description("切换 node 版本,默认选择第一个版本").action((e, n) => {
342
+ let r = m(f("nvm ls").toString()), [{ major: i, minor: a, patch: o }] = m(e), s = [], c = r.find((e) => {
343
+ if (e.major === i) return s.push(e), G("minor", {
344
+ minor: a,
345
+ patch: o
346
+ }, e);
347
+ });
348
+ if (c) K(c.semver);
349
+ else if (b(), b(t.red(`输入的版本 ${e} 不存在`)), b(), s.length) {
350
+ let t = s.map((e) => e.semver);
351
+ h.prompt({
352
+ type: "list",
353
+ name: "preset",
354
+ message: "请选择相似版本或输入版本进行安装:",
355
+ choices: [
356
+ ...t,
357
+ e,
358
+ "取消"
359
+ ]
360
+ }).then(({ preset: t }) => {
361
+ if (t !== "取消") if (t === e) {
362
+ if (!o) return;
363
+ q(t);
364
+ } else K(t);
365
+ });
366
+ } else {
367
+ if (!o) return;
368
+ if (n.install) {
369
+ q(e);
370
+ return;
371
+ }
372
+ h.prompt({
373
+ type: "confirm",
374
+ name: "isInstall",
375
+ message: `是否安装 ${e}?`
376
+ }).then(({ isInstall: t }) => {
377
+ t && q(e);
378
+ });
379
+ }
380
+ });
381
+ //#endregion
382
+ //#region src/commander/commands/ai.ts
383
+ var J = [
384
+ "ANTHROPIC_AUTH_TOKEN",
385
+ "ANTHROPIC_BASE_URL",
386
+ "ANTHROPIC_MODEL",
387
+ "ANTHROPIC_SMALL_FAST_MODEL"
388
+ ], xe = T(l(import.meta.dirname, "ai.jsonc"), !0), Se = Object.entries(xe)[0], Y = l(g.homedir(), ".claude/settings.json"), X = l(g.homedir(), ".claude/settings.local.json"), Z = l(g.homedir(), ".ai-model.json"), Ce = () => {
389
+ r(Y) || (y(`${Y} 文件不存在,请先检查或者去安装 Claude Code`), process.exit(1));
390
+ let e = JSON.parse(i(Y).toString());
391
+ return !e.env && (e.env = {}), e;
392
+ }, we = () => {
393
+ b(), r(Z) || (y("配置不存在,请先使用 `ai init` 初始化 AI 模型配置"), process.exit(1));
394
+ let e = JSON.parse(i(Z).toString()), n = Object.entries(e).filter(([e, t]) => {
395
+ if (e === Se[0]) return !1;
396
+ let n = t.env, r = Se[1].env;
397
+ return !(!n || J.some((e) => !n[e] || n[e] === r[e]));
398
+ });
399
+ return n.length || (b(`暂无已配置的 AI 模型,请先配置,路径 ${t.green(Z)}`), process.exit(1)), [n, e];
400
+ }, Te = () => {
401
+ if (b(), r(Z)) {
402
+ b(`配置已存在,路径 ${t.green(Z)}`);
403
+ return;
404
+ }
405
+ s(Z, JSON.stringify(xe, null, 2)), v(`配置已初始化,路径 ${t.green(Z)}`);
406
+ }, Ee = (e) => e.replace(/[\u4e00-\u9fa5]/g, "aa").length, De = () => {
407
+ let [e] = we(), n = 0, r = -1, i = Ce();
408
+ e.forEach(([e, t], a) => {
409
+ n = Math.max(n, Ee(e)), r < 0 && !J.some((e) => i.env[e] !== t.env[e]) && (r = a);
410
+ }), e.forEach(([e, i], a) => {
411
+ let { ANTHROPIC_BASE_URL: o } = i.env;
412
+ b(`${a === r ? t.green("*") : " "} ${e} ${O(Ee(e), n + 4, "-")} ${o}`);
413
+ });
414
+ }, Oe = async (e) => {
415
+ let n = Ce(), [r, i] = we();
416
+ r.some(([t]) => t === e) || (b(`模型 ${t.red(e)} 不存在`), process.exit(1)), J.some((t) => n.env[t] !== i[e].env[t]) ? (n.env = i[e].env, s(Y, JSON.stringify(n, null, 2)), v(`模型 ${t.green(e)} 已切换`)) : b(`当前正处于 ${t.green(e)} 模型,无需切换`);
417
+ }, ke = () => {
418
+ let e = "@anthropic-ai/claude-code";
419
+ try {
420
+ f(`npm list -g ${e} --depth=0`).toString().trim().includes(e) || (y(t.red(`请使用 nodejs 安装 ${e}`)), process.exit(1));
421
+ let i = f("npm root -g").toString().trim(), a = l(i, e, "cli.js"), o = l(i, e, "cli.bak.js"), s = l(i, e, "bin/claude.exe"), c = l(i, e, "bin/claude.bak.exe"), u = !1;
422
+ return r(s) ? (!r(c) && n(s, c), u = !0) : !r(o) && n(a, o), {
423
+ cliPath: a,
424
+ cliPathBak: o,
425
+ exePath: s,
426
+ exePathBak: c,
427
+ isExistExe: u
428
+ };
429
+ } catch {
430
+ y(t.red(`请使用 nodejs 安装 ${e}`)), process.exit(1);
431
+ }
432
+ }, Ae = async () => {
433
+ b(), b("开始汉化 Claude Code");
434
+ let { cliPath: e, exePath: t, exePathBak: n, isExistExe: r } = ke();
435
+ if (r) {
436
+ let e = i(n), r = (await import("./keyword-latest-Bj5j_G4f.js")).default;
437
+ Object.entries(r).forEach(([t, n]) => {
438
+ let r = Buffer.from(t, "utf8"), i = Buffer.from(n, "utf8");
439
+ if (!e.includes(r) || i.length > r.length) return;
440
+ let a = 0;
441
+ for (; (a = e.indexOf(r, a)) !== -1;) i.copy(e, a), e.fill(32, a + i.length, a + r.length), a += r.length;
442
+ }), s(t, e);
443
+ } else {
444
+ let t = i(e).toString(), n = (await import("./keyword-Bs4ml7oW.js")).default;
445
+ s(e, Object.entries(n).reduce((e, [t, n]) => {
446
+ let r = t.replace(/\n/g, "\\\\n").replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), i = n.replace(/\n/g, "\\n");
447
+ return ["`", "\\"].includes(r[0]) ? e.replace(new RegExp(r, "g"), n) : e.replace(RegExp(`\"${r}\"`, "g"), `\"${i}\"`).replace(RegExp(`(\'${r}\')`, "g"), `\'${i}\'`);
448
+ }, t));
449
+ }
450
+ v("Claude Code 已汉化");
451
+ }, je = () => {
452
+ b(), b("开始恢复 Claude Code");
453
+ let { cliPath: e, cliPathBak: t, exePath: r, exePathBak: i, isExistExe: a } = ke();
454
+ a ? n(i, r) : n(t, e), v("Claude Code 已恢复成英文");
455
+ }, Me = async () => {
456
+ b();
457
+ let e = (await import("./claude.settings-BShJAaF1.js")).default;
458
+ s(X, JSON.stringify(e, null, 2)), v(`Claude Code 配置成功,请前往查看:${t.yellow(X)}`);
459
+ }, Ne = async () => {
460
+ if (b(), b("开始配置 Claude Code 默认权限"), b(), !r(X)) {
461
+ Me();
462
+ return;
463
+ }
464
+ h.prompt({
465
+ type: "confirm",
466
+ name: "isOk",
467
+ message: "存在本地配置文件,继续配置会直接覆盖本地配置文件,是否继续 ?"
468
+ }).then(({ isOk: e }) => {
469
+ e && Me();
470
+ });
471
+ }, Q = e.command("ai").description("AI 命令,详细操作请查看 ai -h").helpOption("-h, --help", "输出所有命令").helpCommand(!1);
472
+ Q.command("init").description("初始化 AI 模型配置").action(Te), Q.command("ls").description("查看当前已配置的 AI 模型").action(De), Q.command("use <模型>").description("切换 AI 模型").action(Oe), Q.command("zh").description("汉化 Claude Code").action(Ae), Q.command("zh-restore").description("恢复汉化 Claude Code").action(je), Q.command("config").description("配置 Claude Code 默认权限").action(Ne), e.usage("[commands] [options]").version(ae, "-v, --version", "输出版本号").helpOption("-h, --help", "输出所有命令"), e.command("build[:环境] [描述]").description("简化打包提交命令"), e.command("version<[++]|[@<版本号>]>").description("例如:version++ 或者 version@1.0.0;自动更新 package.json 版本号,自动更新 `README.md` 中的 `version-v<version>-blue` 图标版本"), e.arguments("<cmd> [env]").action((e, t) => {
473
+ de(e, t);
474
+ }), process.argv.length < 3 ? e.help() : e.parse(process.argv);
475
+ //#endregion
476
+ //#region src/update.ts
477
+ var $ = re({
478
+ pkg: _,
479
+ updateCheckInterval: 1e3 * 1
349
480
  });
350
- process.argv.length < 3 ? g.help() : g.parse(process.argv);
351
- const P = Ae({ pkg: I, updateCheckInterval: 1e3 * 1 });
352
- if (P.update && P.update.latest !== I.version) {
353
- let e = "";
354
- switch (P.update.type) {
355
- case "major":
356
- e = l.red("{latestVersion}");
357
- break;
358
- case "minor":
359
- e = l.yellow("{latestVersion}");
360
- break;
361
- default:
362
- e = l.green("{latestVersion}");
363
- break;
364
- }
365
- const t = `https://github.com/biaov/${I.name}/compare/v${I.version}...v{latestVersion}`;
366
- P.notify({
367
- defer: !1,
368
- isGlobal: !0,
369
- message: `有更新 ${l.dim("{currentVersion}")}${l.reset(" → ")}${e}
370
- 运行 ${l.cyan("{updateCommand}@latest")} 命令更新
371
- ${l.dim.underline(t)}`
372
- });
481
+ if ($.update && $.update.latest !== _.version) {
482
+ let e = "";
483
+ switch ($.update.type) {
484
+ case "major":
485
+ e = t.red("{latestVersion}");
486
+ break;
487
+ case "minor":
488
+ e = t.yellow("{latestVersion}");
489
+ break;
490
+ default:
491
+ e = t.green("{latestVersion}");
492
+ break;
493
+ }
494
+ let n = `https://github.com/biaov/${_.name}/compare/v${_.version}...v{latestVersion}`;
495
+ $.notify({
496
+ defer: !1,
497
+ isGlobal: !0,
498
+ message: `有更新 ${t.dim("{currentVersion}")}${t.reset(" → ")}${e}\n运行 ${t.cyan("{updateCommand}@latest")} 命令更新\n${t.dim.underline(n)}`
499
+ });
373
500
  }
501
+ //#endregion