cli-z-develop 0.13.2 → 0.14.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.
Files changed (2) hide show
  1. package/dist/index.js +665 -593
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,43 +1,43 @@
1
- import { program as O } from "commander";
2
- import wt from "node:child_process";
3
- import { existsSync as v, readdirSync as yt, lstatSync as $t, createWriteStream as vt } from "node:fs";
4
- import { readdir as Ce, mkdir as le, writeFile as I, rename as _e, readFile as Te, stat as Nt } from "node:fs/promises";
1
+ import { program as D } from "commander";
2
+ import $t from "node:child_process";
3
+ import { existsSync as $, readdirSync as Nt, lstatSync as bt, createWriteStream as At } from "node:fs";
4
+ import { readdir as Re, mkdir as pe, writeFile as L, rename as _e, readFile as Ce, stat as jt } from "node:fs/promises";
5
5
  import p from "node:path";
6
- import ce, { AxiosError as bt } from "axios";
7
- import j from "chalk";
8
- import At from "dayjs";
9
- import L from "shelljs";
10
- import jt from "node:os";
11
- import Me from "child_process";
12
- import { confirm as Ue, select as k, input as J, password as St, checkbox as Ee, number as ze } from "@inquirer/prompts";
6
+ import le, { AxiosError as St } from "axios";
7
+ import S from "chalk";
8
+ import kt from "dayjs";
9
+ import P from "shelljs";
10
+ import Tt from "node:os";
11
+ import ze from "child_process";
12
+ import { confirm as Ge, select as b, input as B, password as Et, checkbox as ve, number as Je } from "@inquirer/prompts";
13
13
  import y from "ora";
14
- import R from "fs-extra";
15
- import { select as ae } from "inquirer-select-pro";
16
- import kt from "lint-staged";
17
- import Tt from "semver";
18
- import { run as Et } from "npm-check-updates";
19
- import Ct from "p-limit";
20
- import Rt from "minimist";
21
- const Ge = "dev", We = "test", Ve = "release", xt = "production", It = "master";
22
- var D = /* @__PURE__ */ ((e) => (e[e.DEV = Ge] = "DEV", e[e.TEST = We] = "TEST", e[e.RELEASE = Ve] = "RELEASE", e[e.PROD = xt] = "PROD", e))(D || {}), $ = /* @__PURE__ */ ((e) => (e[e.DEV = Ge] = "DEV", e[e.TEST = We] = "TEST", e[e.RELEASE = Ve] = "RELEASE", e[e.MASTER = It] = "MASTER", e))($ || {}), G = /* @__PURE__ */ ((e) => (e.H5 = "h5", e.NPM = "npm", e.SERVER = "server", e))(G || {});
23
- const Dt = [
14
+ import I from "fs-extra";
15
+ import { select as ne } from "inquirer-select-pro";
16
+ import Ct from "lint-staged";
17
+ import Rt from "semver";
18
+ import { run as It } from "npm-check-updates";
19
+ import xt from "p-limit";
20
+ import Dt from "minimist";
21
+ const We = "dev", Ve = "test", qe = "release", Lt = "production", Pt = "master";
22
+ var C = /* @__PURE__ */ ((e) => (e[e.DEV = We] = "DEV", e[e.TEST = Ve] = "TEST", e[e.RELEASE = qe] = "RELEASE", e[e.PROD = Lt] = "PROD", e))(C || {}), v = /* @__PURE__ */ ((e) => (e[e.DEV = We] = "DEV", e[e.TEST = Ve] = "TEST", e[e.RELEASE = qe] = "RELEASE", e[e.MASTER = Pt] = "MASTER", e))(v || {}), W = /* @__PURE__ */ ((e) => (e.H5 = "h5", e.NPM = "npm", e.SERVER = "server", e))(W || {});
23
+ const He = [
24
24
  {
25
- name: `开发环境 - ${D.DEV}`,
26
- value: D.DEV
25
+ name: `开发环境 - ${C.DEV}`,
26
+ value: C.DEV
27
27
  },
28
28
  {
29
- name: `测试环境 - ${D.TEST}`,
30
- value: D.TEST
29
+ name: `测试环境 - ${C.TEST}`,
30
+ value: C.TEST
31
31
  },
32
32
  {
33
- name: `预发环境 - ${D.RELEASE}`,
34
- value: D.RELEASE
33
+ name: `预发环境 - ${C.RELEASE}`,
34
+ value: C.RELEASE
35
35
  },
36
36
  {
37
- name: `正式环境 - ${D.PROD}`,
38
- value: D.PROD
37
+ name: `正式环境 - ${C.PROD}`,
38
+ value: C.PROD
39
39
  }
40
- ], Lt = [
40
+ ], Ot = [
41
41
  {
42
42
  name: "网页 - h5",
43
43
  value: "h5"
@@ -54,8 +54,8 @@ const Dt = [
54
54
  /* SERVER */
55
55
  }
56
56
  ];
57
- var de = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e))(de || {}), oe = /* @__PURE__ */ ((e) => (e.FRONT_END = "fe", e.BACK_END = "be", e.QUALITY_ASSURANCE = "qa", e))(oe || {}), w = /* @__PURE__ */ ((e) => (e.JAVA = "Java", e.JAVASCRIPT = "JavaScript", e.PYTHON = "Python", e.MARKDOWN = "Markdown", e))(w || {});
58
- const Ot = {
57
+ var de = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e))(de || {}), ue = /* @__PURE__ */ ((e) => (e.FRONT_END = "fe", e.BACK_END = "be", e.QUALITY_ASSURANCE = "qa", e))(ue || {}), w = /* @__PURE__ */ ((e) => (e.JAVA = "Java", e.JAVASCRIPT = "JavaScript", e.PYTHON = "Python", e.MARKDOWN = "Markdown", e))(w || {});
58
+ const Mt = {
59
59
  1: "研发",
60
60
  2: "测试",
61
61
  3: "产品",
@@ -65,11 +65,11 @@ const Ot = {
65
65
  7: "行政",
66
66
  8: "财务",
67
67
  9: "其他"
68
- }, fe = "http://git.cxlqd.com", Pt = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
69
- var A = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e.CHORE = "chore", e.CI = "ci", e.Break = "BREAKING CHANGE", e))(A || {});
70
- const Mt = "fe-biz7tvsd", qe = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
71
- var C = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(C || {});
72
- const zt = [
68
+ }, fe = "http://git.cxlqd.com", zt = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
69
+ var j = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e.CHORE = "chore", e.CI = "ci", e.Break = "BREAKING CHANGE", e))(j || {});
70
+ const Jt = "fe-biz7tvsd", Ke = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
71
+ var R = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(R || {});
72
+ const Ut = [
73
73
  {
74
74
  name: "模块",
75
75
  value: "module"
@@ -80,32 +80,32 @@ const zt = [
80
80
  value: "case"
81
81
  /* CASE */
82
82
  }
83
- ], Bt = ".z", Ft = "develop-config.json", Z = ".z", Jt = ".commit-msg-tpl", _t = "project.json";
83
+ ], Bt = ".z", Ft = "develop-config.json", Y = ".z", _t = ".commit-msg-tpl", Gt = "project.json";
84
84
  function E(e = "") {
85
- return p.join(Z, e);
85
+ return p.join(Y, e);
86
86
  }
87
- function He() {
88
- return E(_t);
87
+ function Ze() {
88
+ return E(Gt);
89
89
  }
90
90
  function Ne() {
91
- return E(Jt);
91
+ return E(_t);
92
92
  }
93
- function Ke() {
94
- Me.spawnSync("git", ["config", "core.hooksPath", E()]), Me.spawnSync("git", ["config", "commit.template", Ne()]);
93
+ function Ye() {
94
+ ze.spawnSync("git", ["config", "core.hooksPath", E()]), ze.spawnSync("git", ["config", "commit.template", Ne()]);
95
95
  }
96
96
  function he(e = "") {
97
- return p.resolve(jt.homedir(), Bt, e);
97
+ return p.resolve(Tt.homedir(), Bt, e);
98
98
  }
99
99
  function be() {
100
100
  return he(Ft);
101
101
  }
102
- function Ut() {
103
- return v(he());
102
+ function Wt() {
103
+ return $(he());
104
104
  }
105
- function Ze() {
106
- return Ut() && v(be());
105
+ function Xe() {
106
+ return Wt() && $(be());
107
107
  }
108
- function $e(e) {
108
+ function X(e) {
109
109
  let t = e.trim();
110
110
  const i = t.match(/^git@([^:]+):(.+)$/);
111
111
  if (i)
@@ -116,33 +116,33 @@ function $e(e) {
116
116
  }
117
117
  return encodeURIComponent(t.replace(/\.git$/, ""));
118
118
  }
119
- const { red: Be, green: Gt, blue: bn, magenta: Wt, yellow: An } = j;
119
+ const { red: Ue, green: Vt, blue: Tn, magenta: qt, yellow: En } = S;
120
120
  function ye(...e) {
121
121
  }
122
- function W(...e) {
123
- console.log(Gt(...e));
122
+ function V(...e) {
123
+ console.log(Vt(...e));
124
124
  }
125
- function Ye(e) {
126
- e instanceof Error && (e.name === "ExitPromptError" || e.message.includes("User force closed the prompt with")) && (console.log(), console.log(j.cyan(" 👋 下次见~")), console.log(), process.exit(1));
125
+ function Qe(e) {
126
+ e instanceof Error && (e.name === "ExitPromptError" || e.message.includes("User force closed the prompt with")) && (console.log(), console.log(S.cyan(" 👋 下次见~")), console.log(), process.exit(1));
127
127
  }
128
- function m(e, t = !1) {
129
- Ye(e);
128
+ function l(e, t = !1) {
129
+ Qe(e);
130
130
  let i = e;
131
- e instanceof Error ? (i = e.message, ce.isAxiosError(e) && (i = `请求失败:${e.message}`), console.log(Be(i)), console.log(Wt(e.stack))) : console.log(Be(e)), t || process.exit(1);
131
+ e instanceof Error ? (i = e.message, le.isAxiosError(e) && (i = `请求失败:${e.message}`), console.log(Ue(i)), console.log(qt(e.stack))) : console.log(Ue(e)), t || process.exit(1);
132
132
  }
133
- function Fe(e) {
134
- return v(e) ? $t(e).isDirectory() : !1;
133
+ function Be(e) {
134
+ return $(e) ? bt(e).isDirectory() : !1;
135
135
  }
136
- function Xe(e = process.cwd()) {
137
- return Fe(e) ? yt(e).filter((i) => Fe(p.resolve(e, i))) : [];
136
+ function et(e = process.cwd()) {
137
+ return Be(e) ? Nt(e).filter((i) => Be(p.resolve(e, i))) : [];
138
138
  }
139
- async function l(e, t = {
139
+ async function m(e, t = {
140
140
  removeTailLinkBreak: !0,
141
141
  silent: !0
142
142
  }) {
143
143
  let i = await new Promise((n, a) => {
144
144
  try {
145
- const s = L.exec(e, {
145
+ const s = P.exec(e, {
146
146
  silent: t.silent
147
147
  });
148
148
  n(s);
@@ -152,46 +152,46 @@ async function l(e, t = {
152
152
  });
153
153
  return i = i.toString(), t.removeTailLinkBreak && (i = i.replace(/\n$/, "")), i;
154
154
  }
155
- function Vt(e) {
156
- wt.execSync(e, {
155
+ function Ht(e) {
156
+ $t.execSync(e, {
157
157
  stdio: "inherit"
158
158
  });
159
159
  }
160
- function Qe() {
161
- return At(Date.now()).format("YYMMDD");
160
+ function tt() {
161
+ return kt(Date.now()).format("YYMMDD");
162
162
  }
163
- function qt(e, t) {
163
+ function Kt(e, t) {
164
164
  for (const i of t)
165
165
  if (!e.includes(i))
166
166
  return !1;
167
167
  return !0;
168
168
  }
169
- function ne() {
170
- v(E()) || m("当前不在项目根目录。请切换到项目根目录");
169
+ function ee() {
170
+ $(E()) || l("当前不在项目根目录。请切换到项目根目录");
171
171
  }
172
- function Q() {
173
- v(p.resolve(".git")) || m("当前不是git项目根目录,请先执行git init,或切换到根目录");
172
+ function H() {
173
+ $(p.resolve(".git")) || l("当前不是git项目根目录,请先执行git init,或切换到根目录");
174
174
  }
175
- async function me() {
176
- await l("git status -s") !== "" && m("请先提交代码变动,再进行操作");
175
+ async function Ae() {
176
+ await m("git status -s") !== "" && l("请先提交代码变动,再进行操作");
177
177
  }
178
- function Ht(e) {
179
- return e === $.MASTER ? D.PROD : e;
178
+ function Zt(e) {
179
+ return e === v.MASTER ? C.PROD : e;
180
180
  }
181
- function Kt(e) {
182
- return e === D.PROD ? $.MASTER : e;
181
+ function Yt(e) {
182
+ return e === C.PROD ? v.MASTER : e;
183
183
  }
184
- async function B(e, ...t) {
184
+ async function z(e, ...t) {
185
185
  try {
186
186
  await e(...t);
187
187
  } catch (i) {
188
- throw Ye(i), i;
188
+ throw Qe(i), i;
189
189
  }
190
190
  }
191
- async function Zt(e) {
192
- return (await Ce(e)).length === 0;
191
+ async function Xt(e) {
192
+ return (await Re(e)).length === 0;
193
193
  }
194
- function Yt(e = "项目中文名", t = "项目描述") {
194
+ function Qt(e = "项目中文名", t = "项目描述") {
195
195
  return `
196
196
  # ${e}
197
197
  ${t}
@@ -248,7 +248,7 @@ ${t}
248
248
  在此处放入飞书文档链接。请在[前端团队-项目手册](https://hxhtbr8t8uy.feishu.cn/drive/folder/QfQ7favVWljQk7d63Prc8mUGnJf)中按照分类新建文档。
249
249
  `;
250
250
  }
251
- const Xt = {
251
+ const ei = {
252
252
  [w.JAVA]: {
253
253
  "**/*.{java}": "java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml"
254
254
  },
@@ -266,17 +266,17 @@ const Xt = {
266
266
  "**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix",
267
267
  "**/*.md": "markdownlint --fix"
268
268
  }
269
- }, Qt = "cli-z-develop", ei = "0.13.2", ti = "技术团队开发流程管理工具", ii = "dist/index.js", ai = { z: "bin/z.js", "z-develop": "bin/z.js" }, ni = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", eslint: "eslint '**/*.{ts,js}' --fix", prettier: "prettier -wu .", upload: "npm run build && npm publish --access public --registry https://registry.npmjs.org/", "upload:patch": "npm version patch && npm run upload", "upload:minor": "npm version minor && npm run upload", "upload:major": "npm version major && npm run upload" }, si = "module", ri = "z", oi = { "@lonely9/eslint-config-team": "^1.3.8", "@tsconfig/node22": "^22.0.5", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.9", "@types/minimist": "^1.2.5", "@types/node": "^22.15.29", "@types/semver": "^7.7.1", "@types/shelljs": "^0.10.0", "@typescript-eslint/eslint-plugin": "^8.58.2", "@typescript-eslint/parser": "^8.58.2", eslint: "^9.39.2", jiti: "^2.6.1", prettier: "^3.8.2", typescript: "^5.9.3", vite: "^7.3.1", "vue-tsc": "^3.2.6" }, ci = { "@inquirer/prompts": "^8.4.1", axios: "^1.15.0", chalk: "^5.6.2", commander: "^14.0.3", dayjs: "^1.11.20", "fs-extra": "^11.3.4", "inquirer-select-pro": "^1.0.0-alpha.9", "lint-staged": "^16.4.0", minimist: "^1.2.8", "npm-check-updates": "^19.3.1", ora: "^9.3.0", "p-limit": "^7.3.0", semver: "^7.7.4", shelljs: "^0.10.0" }, ie = {
270
- name: Qt,
271
- version: ei,
272
- description: ti,
273
- main: ii,
274
- bin: ai,
275
- scripts: ni,
276
- type: si,
277
- author: ri,
278
- devDependencies: oi,
279
- dependencies: ci
269
+ }, ti = "cli-z-develop", ii = "0.14.1", ai = "技术团队开发流程管理工具", ni = "dist/index.js", si = { z: "bin/z.js", "z-develop": "bin/z.js" }, ri = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", eslint: "eslint '**/*.{ts,js}' --fix", prettier: "prettier -wu .", upload: "npm run build && npm publish --access public --registry https://registry.npmjs.org/", "upload:patch": "npm version patch && npm run upload", "upload:minor": "npm version minor && npm run upload", "upload:major": "npm version major && npm run upload" }, oi = "module", ci = "z", ui = { "@lonely9/eslint-config-team": "^1.3.8", "@tsconfig/node22": "^22.0.5", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.9", "@types/minimist": "^1.2.5", "@types/node": "^22.15.29", "@types/semver": "^7.7.1", "@types/shelljs": "^0.10.0", "@typescript-eslint/eslint-plugin": "^8.58.2", "@typescript-eslint/parser": "^8.58.2", eslint: "^9.39.2", jiti: "^2.6.1", prettier: "^3.8.2", typescript: "^5.9.3", vite: "^7.3.1", "vue-tsc": "^3.2.6" }, li = { "@inquirer/prompts": "^8.4.1", axios: "^1.15.0", chalk: "^5.6.2", commander: "^14.0.3", dayjs: "^1.11.20", "fs-extra": "^11.3.4", "inquirer-select-pro": "^1.0.0-alpha.9", "lint-staged": "^16.4.0", minimist: "^1.2.8", "npm-check-updates": "^19.3.1", ora: "^9.3.0", "p-limit": "^7.3.0", semver: "^7.7.4", shelljs: "^0.10.0" }, ae = {
270
+ name: ti,
271
+ version: ii,
272
+ description: ai,
273
+ main: ni,
274
+ bin: si,
275
+ scripts: ri,
276
+ type: oi,
277
+ author: ci,
278
+ devDependencies: ui,
279
+ dependencies: li
280
280
  }, x = {
281
281
  // 个人数据
282
282
  profile: {
@@ -289,13 +289,13 @@ const Xt = {
289
289
  gitEmail: "",
290
290
  weWorkName: "",
291
291
  weWorkUserId: "",
292
- jobType: oe.FRONT_END,
292
+ jobType: ue.FRONT_END,
293
293
  zenTaoToken: "",
294
294
  k8sToken: ""
295
295
  },
296
296
  // 包数据
297
297
  main: {
298
- version: ie.version,
298
+ version: ae.version,
299
299
  latestCheckVersionTimestamp: 0,
300
300
  // 3天检查一次
301
301
  versionCheckDuring: 3,
@@ -317,60 +317,60 @@ function T(e) {
317
317
  function ge(e) {
318
318
  return e ? x.main[e] : x.main;
319
319
  }
320
- function q(e) {
320
+ function F(e) {
321
321
  return e ? x.constants[e] : x.constants;
322
322
  }
323
- let _ = null, U = null;
324
- function Re() {
323
+ let _ = null, G = null;
324
+ function Ie() {
325
325
  if (_)
326
326
  return _;
327
327
  const e = p.join("package.json");
328
- return v(e) || m(`当前目录(${L.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), _ = R.readJsonSync(e), _;
329
- }
330
- function pe() {
331
- if (U)
332
- return U;
333
- const e = He();
334
- return v(e) || m(
335
- `当前目录(${L.pwd()})不存在${e}文件,请在项目根目录执行该命令,或者初始化项目(z init .)。`
336
- ), U = R.readJsonSync(e), U;
337
- }
338
- function ui(e) {
339
- U ? U = {
340
- ...U,
328
+ return $(e) || l(`当前目录(${P.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), _ = I.readJsonSync(e), _;
329
+ }
330
+ function se() {
331
+ if (G)
332
+ return G;
333
+ const e = Ze();
334
+ return $(e) || l(
335
+ `当前目录(${P.pwd()})不存在${e}文件,请在项目根目录执行该命令,或者初始化项目(z init .)。`
336
+ ), G = I.readJsonSync(e), G;
337
+ }
338
+ function it(e) {
339
+ G ? G = {
340
+ ...G,
341
341
  ...e
342
- } : U = e, R.writeJSONSync(He(), U, { spaces: 2 });
342
+ } : G = e, I.writeJSONSync(Ze(), G, { spaces: 2 });
343
343
  }
344
- function li(e) {
344
+ function mi(e) {
345
345
  _ ? _ = {
346
346
  ..._,
347
347
  ...e
348
- } : _ = e, R.writeJSONSync(p.join("package.json"), _, { spaces: 2 });
348
+ } : _ = e, I.writeJSONSync(p.join("package.json"), _, { spaces: 2 });
349
349
  }
350
- const K = {
350
+ const Z = {
351
351
  id: 0,
352
352
  path: "",
353
353
  group: "",
354
354
  sourceBranch: "",
355
355
  mergeRequestUrl: ""
356
356
  };
357
- async function mi() {
358
- if (!K.id)
357
+ async function pi() {
358
+ if (!Z.id)
359
359
  try {
360
- const e = pe(), t = $e(e.repository.url), i = await it(t);
361
- K.id = i.id, K.path = t, K.group = i.namespace.full_path, K.mergeRequestUrl = `${i.web_url}/merge_requests`;
360
+ const e = se(), t = X(e.repository.url), i = await st(t);
361
+ Z.id = i.id, Z.path = t, Z.group = i.namespace.full_path, Z.mergeRequestUrl = `${i.web_url}/merge_requests`;
362
362
  } catch (e) {
363
- m(e);
363
+ l(e);
364
364
  }
365
- return K.sourceBranch || (K.sourceBranch = await l("git branch --show-current")), K;
365
+ return Z.sourceBranch || (Z.sourceBranch = await m("git branch --show-current")), Z;
366
366
  }
367
- function se() {
368
- R.writeJSONSync(
367
+ function re() {
368
+ I.writeJSONSync(
369
369
  be(),
370
370
  {
371
371
  main: ge(),
372
372
  profile: T(),
373
- constants: q()
373
+ constants: F()
374
374
  },
375
375
  {
376
376
  spaces: 2
@@ -383,19 +383,19 @@ function M(e, t) {
383
383
  ...e
384
384
  };
385
385
  }
386
- function xe(e, t) {
386
+ function je(e, t) {
387
387
  x.constants = {
388
388
  ...x.constants,
389
389
  ...e
390
390
  };
391
391
  }
392
- function ue(e, t) {
392
+ function me(e, t) {
393
393
  t !== void 0 ? x.main[e] = t : x.main = {
394
394
  ...x.main,
395
395
  ...e
396
396
  };
397
397
  }
398
- async function Y(e) {
398
+ async function oe(e) {
399
399
  const t = e.method || "get", i = e.headers || {}, n = e.data || {}, a = e.dataKey ?? (["GET", "get"].includes(t) ? "params" : "data");
400
400
  try {
401
401
  const s = {
@@ -405,19 +405,19 @@ async function Y(e) {
405
405
  headers: i,
406
406
  responseType: e?.responseType || "json"
407
407
  };
408
- ye(j.magenta(s.method.toUpperCase()), j.yellow(s.url), JSON.stringify(s.headers)), ye(j.gray(JSON.stringify(s[a], null, 2)));
409
- const o = await ce(s);
410
- return ye(j.green("Response"), j.grey(JSON.stringify(o.data, null, 2))), Promise.resolve(o.data);
408
+ ye(S.magenta(s.method.toUpperCase()), S.yellow(s.url), JSON.stringify(s.headers)), ye(S.gray(JSON.stringify(s[a], null, 2)));
409
+ const o = await le(s);
410
+ return ye(S.green("Response"), S.grey(JSON.stringify(o.data, null, 2))), Promise.resolve(o.data);
411
411
  } catch (s) {
412
- return s instanceof bt && ye(j.red("Error"), j.grey(JSON.stringify(s?.response?.data))), Promise.reject(s);
412
+ return s instanceof St && ye(S.red("Error"), S.grey(JSON.stringify(s?.response?.data))), Promise.reject(s);
413
413
  }
414
414
  }
415
- async function pi() {
415
+ async function di() {
416
416
  const e = T("gitToken");
417
417
  if (e)
418
418
  return e;
419
419
  {
420
- const { access_token: t } = await Y({
420
+ const { access_token: t } = await oe({
421
421
  url: `${fe}/oauth/token`,
422
422
  method: "post",
423
423
  data: {
@@ -426,38 +426,38 @@ async function pi() {
426
426
  password: T("ldapPassword")
427
427
  }
428
428
  }), i = `Bearer ${t}`;
429
- return M("gitToken", i), se(), i;
429
+ return M("gitToken", i), re(), i;
430
430
  }
431
431
  }
432
432
  async function N(e) {
433
- return Y({
433
+ return oe({
434
434
  ...e,
435
435
  headers: {
436
- Authorization: await pi()
436
+ Authorization: await di()
437
437
  }
438
438
  });
439
439
  }
440
- async function di() {
440
+ async function fi() {
441
441
  const e = T("zenTaoToken");
442
442
  if (e)
443
443
  return e;
444
444
  {
445
- const { token: t } = await Y({
446
- url: `${q("ZenTaoDomain")}/api.php/v1/tokens`,
445
+ const { token: t } = await oe({
446
+ url: `${F("ZenTaoDomain")}/api.php/v1/tokens`,
447
447
  method: "post",
448
448
  data: {
449
449
  account: T("ldapAccount"),
450
450
  password: T("ldapPassword")
451
451
  }
452
452
  });
453
- return M("zenTaoToken", t), se(), t;
453
+ return M("zenTaoToken", t), re(), t;
454
454
  }
455
455
  }
456
- async function ve(e) {
457
- const t = await Y({
456
+ async function $e(e) {
457
+ const t = await oe({
458
458
  ...e,
459
459
  headers: {
460
- Token: await di()
460
+ Token: await fi()
461
461
  }
462
462
  });
463
463
  if (e.url.includes("local")) {
@@ -466,27 +466,27 @@ async function ve(e) {
466
466
  return JSON.parse(i.data);
467
467
  }
468
468
  if (typeof t == "object")
469
- return t.error === "Unauthorized" || t.data.indexOf("<script>") < 0 ? (M("zenTaoToken", ""), ve({
469
+ return t.error === "Unauthorized" || t.data.indexOf("<script>") < 0 ? (M("zenTaoToken", ""), $e({
470
470
  ...e
471
471
  })) : t;
472
472
  } else {
473
473
  const { status: i, data: n } = t;
474
474
  if (i === "success") {
475
475
  const a = JSON.parse(n);
476
- return a.title === "用户登录" ? (M("zenTaoToken", ""), ve({
476
+ return a.title === "用户登录" ? (M("zenTaoToken", ""), $e({
477
477
  ...e
478
478
  })) : a;
479
479
  } else
480
480
  return {};
481
481
  }
482
482
  }
483
- async function fi() {
483
+ async function gi() {
484
484
  const e = T("k8sToken");
485
485
  if (e)
486
486
  return e;
487
487
  {
488
- const { access_token: t } = await Y({
489
- url: `${q("K8sDomain")}/oauth/login/LDAP`,
488
+ const { access_token: t } = await oe({
489
+ url: `${F("K8sDomain")}/oauth/login/LDAP`,
490
490
  method: "post",
491
491
  headers: {
492
492
  "Content-Type": "application/x-www-form-urlencoded"
@@ -496,24 +496,24 @@ async function fi() {
496
496
  password: T("ldapPassword")
497
497
  }
498
498
  }), i = `Bearer ${t}`;
499
- return M("k8sToken", i), se(), i;
499
+ return M("k8sToken", i), re(), i;
500
500
  }
501
501
  }
502
- async function et(e) {
503
- const t = await Y({
502
+ async function at(e) {
503
+ const t = await oe({
504
504
  ...e,
505
505
  headers: {
506
- Authorization: await fi()
506
+ Authorization: await gi()
507
507
  }
508
508
  });
509
- return t.code === 401 ? (M("k8sToken", ""), et({
509
+ return t.code === 401 ? (M("k8sToken", ""), at({
510
510
  ...e
511
511
  })) : t;
512
512
  }
513
- async function gi(e, t) {
513
+ async function hi(e, t) {
514
514
  try {
515
- const i = vt(t, { mode: 493 });
516
- return (await ce({
515
+ const i = At(t, { mode: 493 });
516
+ return (await le({
517
517
  method: "get",
518
518
  url: e,
519
519
  responseType: "stream",
@@ -527,87 +527,87 @@ async function gi(e, t) {
527
527
  throw console.error("下载失败:", i), i;
528
528
  }
529
529
  }
530
- const z = () => `${fe}/api/v4`, F = (e) => `${z()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
531
- function hi() {
530
+ const J = () => `${fe}/api/v4`, U = (e) => `${J()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
531
+ function wi() {
532
532
  return N({
533
- url: F("src/data/template-projects.json")
533
+ url: U("src/data/template-projects.json")
534
534
  });
535
535
  }
536
- function wi() {
536
+ function nt() {
537
537
  return N({
538
- url: F("src/data/java-project-module.json")
538
+ url: U("src/data/java-project-module.json")
539
539
  });
540
540
  }
541
- function tt() {
541
+ function xe() {
542
542
  return N({
543
- url: F("src/data/z-develop-config.json")
543
+ url: U("src/data/z-develop-config.json")
544
544
  });
545
545
  }
546
546
  function yi() {
547
547
  return N({
548
- url: F("src/assets/tsconfig.browser.json")
548
+ url: U("src/assets/tsconfig.browser.json")
549
549
  });
550
550
  }
551
- function $i() {
551
+ function vi() {
552
552
  return N({
553
- url: F("src/assets/tsconfig.node.json")
553
+ url: U("src/assets/tsconfig.node.json")
554
554
  });
555
555
  }
556
- function vi() {
556
+ function $i() {
557
557
  return N({
558
- url: F("src/assets/.prettierignore")
558
+ url: U("src/assets/.prettierignore")
559
559
  });
560
560
  }
561
561
  function Ni() {
562
562
  return N({
563
- url: F("src/assets/.prettierrc.json")
563
+ url: U("src/assets/.prettierrc.json")
564
564
  });
565
565
  }
566
566
  function bi() {
567
567
  return N({
568
- url: F("src/assets/data.yaml")
568
+ url: U("src/assets/data.yaml")
569
569
  });
570
570
  }
571
571
  function Ai() {
572
572
  return N({
573
- url: F("src/assets/main.py")
573
+ url: U("src/assets/main.py")
574
574
  });
575
575
  }
576
576
  function ji() {
577
577
  return N({
578
- url: F("src/assets/checkstyle.xml")
578
+ url: U("src/assets/checkstyle.xml")
579
579
  });
580
580
  }
581
581
  function Si() {
582
582
  return N({
583
- url: F("src/data/project-group-chats.json")
583
+ url: U("src/data/project-group-chats.json")
584
584
  });
585
585
  }
586
586
  function ki() {
587
587
  return N({
588
- url: `${z()}/user`
588
+ url: `${J()}/user`
589
589
  });
590
590
  }
591
591
  function Ti() {
592
592
  return N({
593
- url: `${z()}/groups`
593
+ url: `${J()}/groups`
594
594
  });
595
595
  }
596
596
  function Ei(e) {
597
597
  return N({
598
- url: `${z()}/projects`,
598
+ url: `${J()}/projects`,
599
599
  method: "post",
600
600
  data: e
601
601
  });
602
602
  }
603
- function it(e) {
603
+ function st(e) {
604
604
  return N({
605
- url: `${z()}/projects/${e}`
605
+ url: `${J()}/projects/${e}`
606
606
  });
607
607
  }
608
608
  function Ci(e) {
609
609
  return N({
610
- url: `${z()}/projects`,
610
+ url: `${J()}/projects`,
611
611
  data: {
612
612
  search: e,
613
613
  search_namespaces: !0
@@ -616,48 +616,48 @@ function Ci(e) {
616
616
  }
617
617
  function Ri(e) {
618
618
  return N({
619
- url: `${z()}/projects/${e.id}/merge_requests`,
619
+ url: `${J()}/projects/${e.id}/merge_requests`,
620
620
  method: "post",
621
621
  data: e
622
622
  });
623
623
  }
624
- function xi(e) {
624
+ function Ii(e) {
625
625
  return N({
626
- url: `${z()}/projects/${e.id}/merge_requests/${e.iid}/merge`,
626
+ url: `${J()}/projects/${e.id}/merge_requests/${e.iid}/merge`,
627
627
  method: "put"
628
628
  });
629
629
  }
630
- function Ii(e) {
630
+ function xi(e) {
631
631
  return N({
632
- url: `${z()}/projects/${e.id}/merge_requests/${e.iid}`,
632
+ url: `${J()}/projects/${e.id}/merge_requests/${e.iid}`,
633
633
  method: "put",
634
634
  data: e
635
635
  });
636
636
  }
637
637
  function Di(e) {
638
638
  return N({
639
- url: `${z()}/projects/${e.id}/merge_requests/${e.iid}`,
639
+ url: `${J()}/projects/${e.id}/merge_requests/${e.iid}`,
640
640
  method: "get"
641
641
  });
642
642
  }
643
643
  function Li(e) {
644
644
  return N({
645
- url: `${z()}/projects/${e.id}/repository/branches`,
645
+ url: `${J()}/projects/${e.id}/repository/branches`,
646
646
  method: "post",
647
647
  data: e
648
648
  });
649
649
  }
650
- function Oi(e) {
650
+ function Pi(e) {
651
651
  return N({
652
- url: `${z()}/projects/${e}/repository/branches`
652
+ url: `${J()}/projects/${e}/repository/branches`
653
653
  });
654
654
  }
655
- function Pi() {
655
+ function Oi() {
656
656
  const e = he("fe-groups.json");
657
- return v(e) ? R.readJSONSync(e) : { groups: [] };
657
+ return $(e) ? I.readJSONSync(e) : { groups: [] };
658
658
  }
659
659
  async function Mi() {
660
- const e = await Ti(), t = Pt.map((i) => {
660
+ const e = await Ti(), t = zt.map((i) => {
661
661
  const n = e.find((a) => a.name === i);
662
662
  return n ? {
663
663
  name: n.name,
@@ -665,50 +665,48 @@ async function Mi() {
665
665
  description: n.description
666
666
  } : !1;
667
667
  }).filter((i) => !!i);
668
- R.writeJSONSync(he("fe-groups.json"), { groups: t }, { spaces: 2 });
668
+ I.writeJSONSync(he("fe-groups.json"), { groups: t }, { spaces: 2 });
669
669
  }
670
- async function b(e) {
671
- const t = `${q("FEServerDomain")}/api`, { data: i } = await Y({
672
- url: `${t}/auth/z-develop/login`,
673
- method: "post"
674
- }), n = await Y({
670
+ async function A(e) {
671
+ const t = `${F("FEServerDomain")}/api`, i = await oe({
675
672
  url: t + e.url,
676
673
  headers: {
677
- Authorization: `Bearer ${i}`
674
+ "the-key-one": "z-develop",
675
+ "the-key-two": F("ZDevelopPassword")
678
676
  },
679
677
  data: e.data,
680
678
  method: e.method || "post"
681
679
  });
682
- return n.code !== 0 && m(`${n.code}: ${n.message}`), n.data;
680
+ return i.code !== 0 && l(`${i.code}: ${i.message}`), i.data;
683
681
  }
684
682
  function zi() {
685
- return b({
683
+ return A({
686
684
  url: "/user/list2"
687
685
  });
688
686
  }
689
- function Bi() {
690
- return b({
687
+ function Ji() {
688
+ return A({
691
689
  url: "/zen/testcase/product/list"
692
690
  });
693
691
  }
694
- function at(e) {
695
- return b({
692
+ function rt(e) {
693
+ return A({
696
694
  url: "/zen/testcase/product/module/list",
697
695
  data: {
698
696
  product: e
699
697
  }
700
698
  });
701
699
  }
702
- function Fi(e) {
703
- return b({
700
+ function Ui(e) {
701
+ return A({
704
702
  url: "/zen/testcase/product/name",
705
703
  data: {
706
704
  product: e
707
705
  }
708
706
  });
709
707
  }
710
- function Ji(e, t) {
711
- return b({
708
+ function Bi(e, t) {
709
+ return A({
712
710
  url: "/zen/testcase/product/auto-case/list",
713
711
  data: {
714
712
  product: e,
@@ -716,81 +714,81 @@ function Ji(e, t) {
716
714
  }
717
715
  });
718
716
  }
719
- function _i(e) {
720
- return b({
717
+ function Fi(e) {
718
+ return A({
721
719
  url: "/zen/testcase/step/list",
722
720
  data: {
723
721
  id: e
724
722
  }
725
723
  });
726
724
  }
727
- function Ui(e) {
728
- return b({
725
+ function _i(e) {
726
+ return A({
729
727
  url: "/zen/testcase/module/create",
730
728
  data: e
731
729
  });
732
730
  }
733
731
  function Gi(e) {
734
- return b({
732
+ return A({
735
733
  url: "/zen/testcase/create",
736
734
  data: e
737
735
  });
738
736
  }
739
737
  function Wi(e) {
740
- return b({
738
+ return A({
741
739
  url: "/zen/testcase/step/create",
742
740
  data: e
743
741
  });
744
742
  }
745
743
  function Vi(e) {
746
- return b({
744
+ return A({
747
745
  url: "/zen/testcase/modules/remove",
748
746
  data: e
749
747
  });
750
748
  }
751
749
  function qi(e) {
752
- return b({
750
+ return A({
753
751
  url: "/zen/testcase/cases/remove",
754
752
  data: e
755
753
  });
756
754
  }
757
755
  function Hi(e) {
758
- return b({
756
+ return A({
759
757
  url: "/zen/testcase/module/update/name",
760
758
  data: e
761
759
  });
762
760
  }
763
761
  function Ki(e) {
764
- return b({
762
+ return A({
765
763
  url: "/zen/testcase/case/update/name",
766
764
  data: e
767
765
  });
768
766
  }
769
767
  function Zi(e) {
770
- return b({
768
+ return A({
771
769
  url: "/zen/testcase/case/update/priority",
772
770
  data: e
773
771
  });
774
772
  }
775
773
  function Yi(e) {
776
- return b({
774
+ return A({
777
775
  url: "/zen/testcase/case/update/precondition",
778
776
  data: e
779
777
  });
780
778
  }
781
779
  function Xi(e) {
782
- return b({
780
+ return A({
783
781
  url: "/zen/testcase/case/result/create",
784
782
  data: e
785
783
  });
786
784
  }
787
785
  function Qi() {
788
- return b({
786
+ return A({
789
787
  url: "/zen/testcase/project/list"
790
788
  });
791
789
  }
792
790
  function ea(e) {
793
- return b({
791
+ return A({
794
792
  url: "/zen/testcase/project/execution/list",
795
793
  data: {
796
794
  project: e
@@ -798,7 +796,7 @@ function ea(e) {
798
796
  });
799
797
  }
800
798
  function ta(e) {
801
- return b({
799
+ return A({
802
800
  url: "/zen/testcase/execution/build/list",
803
801
  data: {
804
802
  id: e
@@ -806,7 +804,7 @@ function ta(e) {
806
804
  });
807
805
  }
808
806
  function ia(e) {
809
- return b({
807
+ return A({
810
808
  url: "/common/ai/talk",
811
809
  data: e
812
810
  });
@@ -823,13 +821,13 @@ function aa(e, t) {
823
821
  ...s,
824
822
  usageCount: 1
825
823
  });
826
- }), ue({
824
+ }), me({
827
825
  weWorkListCache: n.sort((s, o) => o.usageCount - s.usageCount)
828
- }), se();
826
+ }), re();
829
827
  }
830
- async function nt() {
828
+ async function ot() {
831
829
  const t = (await zi()).filter((s) => [1, 2, 3, 4, 5].includes(s.title)).map((s) => ({
832
- name: `${s.nick} - ${Ot[s.title]}`,
830
+ name: `${s.nick} - ${Mt[s.title]}`,
833
831
  value: s.weWorkUserId
834
832
  })), i = ge("weWorkListCache"), n = i.map((s) => s.value), a = [];
835
833
  return t.forEach((s) => {
@@ -840,9 +838,9 @@ async function nt() {
840
838
  });
841
839
  }), a.sort((s, o) => o.usageCount - s.usageCount);
842
840
  }
843
- async function st(e, t, i) {
844
- const n = await nt();
845
- let a = await ae({
841
+ async function ct(e, t, i) {
842
+ const n = await ot();
843
+ let a = await ne({
846
844
  message: e,
847
845
  loop: !0,
848
846
  pageSize: n.length || 5,
@@ -858,7 +856,7 @@ async function na(e, t, i) {
858
856
  name: o.name,
859
857
  value: o.url
860
858
  }));
861
- let s = await ae({
859
+ let s = await ne({
862
860
  message: e,
863
861
  loop: !0,
864
862
  pageSize: a.length || 5,
@@ -871,44 +869,44 @@ async function na(e, t, i) {
871
869
  }
872
870
  async function sa() {
873
871
  try {
874
- Ze() && (await Ue({
872
+ Xe() && (await Ge({
875
873
  message: "系统中已存在z的配置文件,确认重新配置?"
876
- }) ? L.rm("-rf", be()) : process.exit(0)), await le(he(), { recursive: !0 });
877
- const t = await k({
874
+ }) ? P.rm("-rf", be()) : process.exit(0)), await pe(he(), { recursive: !0 });
875
+ const t = await b({
878
876
  message: "请选择岗位类型",
879
877
  choices: [
880
878
  {
881
879
  name: "前端",
882
- value: oe.FRONT_END
880
+ value: ue.FRONT_END
883
881
  },
884
882
  {
885
883
  name: "后端",
886
- value: oe.BACK_END
884
+ value: ue.BACK_END
887
885
  },
888
886
  {
889
887
  name: "测试",
890
- value: oe.QUALITY_ASSURANCE
888
+ value: ue.QUALITY_ASSURANCE
891
889
  }
892
890
  ]
893
891
  });
894
- let i = await J({
892
+ let i = await B({
895
893
  message: "请输入LDAP账号:"
896
894
  });
897
895
  i = i.trim();
898
- let n = await St({
896
+ let n = await Et({
899
897
  message: "请输入LDAP密码:",
900
898
  mask: !0
901
899
  });
902
900
  n = n.trim(), M("jobType", t), M("ldapAccount", i), M("ldapPassword", n);
903
- const a = await tt();
904
- xe(a);
905
- const s = await nt(), o = await st("请选择你自己(用于企微通知):", (u) => u.length > 1 ? "只能选一个" : u.length < 1 ? "请选一个" : !0), { name: r, value: c } = s.find((u) => u.value === o[0]);
901
+ const a = await xe();
902
+ je(a);
903
+ const s = await ot(), o = await ct("请选择你自己(用于企微通知):", (u) => u.length > 1 ? "只能选一个" : u.length < 1 ? "请选一个" : !0), { name: r, value: c } = s.find((u) => u.value === o[0]);
906
904
  M({
907
905
  weWorkName: r,
908
906
  weWorkUserId: c
909
907
  });
910
908
  } catch (t) {
911
- m(t);
909
+ l(t);
912
910
  }
913
911
  const e = y("配置信息初始化中").start();
914
912
  try {
@@ -918,38 +916,38 @@ async function sa() {
918
916
  gitName: t.name,
919
917
  gitEnglishName: t.username,
920
918
  gitEmail: t.email
921
- }), ue("latestCheckVersionTimestamp", Date.now()), se(), T("jobType") === oe.FRONT_END && await Mi(), e.succeed("配置信息初始化完成"), process.exit(0);
919
+ }), me("latestCheckVersionTimestamp", Date.now()), re(), T("jobType") === ue.FRONT_END && await Mi(), e.succeed("配置信息初始化完成"), process.exit(0);
922
920
  } catch (t) {
923
- e.fail("配置信息初始化失败"), ce.isAxiosError(t) && m("请检查你的域名及令牌配置"), m(t);
921
+ e.fail("配置信息初始化失败"), le.isAxiosError(t) && l("请检查你的域名及令牌配置"), l(t);
924
922
  }
925
923
  }
926
924
  async function ra() {
927
- await I(Ne(), "", { mode: 493 }), await I(E(".gitignore"), `.commit-msg-tpl
928
- `, { mode: 493 }), await I(E("commit-msg"), `#!/usr/bin/env sh
929
- z run commit-msg`, { mode: 493 }), await I(E("pre-commit"), `#!/usr/bin/env sh
925
+ await L(Ne(), "", { mode: 493 }), await L(E(".gitignore"), `.commit-msg-tpl
926
+ `, { mode: 493 }), await L(E("commit-msg"), `#!/usr/bin/env sh
927
+ z run commit-msg`, { mode: 493 }), await L(E("pre-commit"), `#!/usr/bin/env sh
930
928
  z run commit-files`, { mode: 493 });
931
- const { language: e } = pe();
932
- if ([w.JAVASCRIPT, w.MARKDOWN].includes(e) && (await I(
929
+ const { language: e } = se();
930
+ if ([w.JAVASCRIPT, w.MARKDOWN].includes(e) && (await L(
933
931
  E(".prettierrc.json"),
934
932
  `${JSON.stringify(await Ni(), null, 2)}
935
933
  `,
936
934
  {
937
935
  mode: 493
938
936
  }
939
- ), await I(E(".prettierignore"), await vi(), { mode: 493 }), await I(E("tsconfig.node.json"), await $i(), { mode: 493 }), await I(E("tsconfig.browser.json"), await yi(), { mode: 493 })), e === w.JAVA) {
940
- await gi(`${q("FECDNDomain")}/file/vgnlfbfHRF.jar`, E("checkstyle.jar")), await I(E("checkstyle.xml"), await ji(), { mode: 493 });
937
+ ), await L(E(".prettierignore"), await $i(), { mode: 493 }), await L(E("tsconfig.node.json"), await vi(), { mode: 493 }), await L(E("tsconfig.browser.json"), await yi(), { mode: 493 })), e === w.JAVA) {
938
+ await hi(`${F("FECDNDomain")}/file/vgnlfbfHRF.jar`, E("checkstyle.jar")), await L(E("checkstyle.xml"), await ji(), { mode: 493 });
941
939
  const t = p.join("package.json");
942
- v(t) || await I(t, JSON.stringify({ version: "0.0.1" }, null, 2), {
940
+ $(t) || await L(t, JSON.stringify({ version: "0.0.1" }, null, 2), {
943
941
  mode: 493
944
942
  });
945
943
  }
946
- Ke();
944
+ Ye();
947
945
  }
948
946
  async function oa(e, t) {
949
- const i = await l("git remote get-url --push origin");
950
- i || m("获取项目远程git地址失败,请配置后重试");
947
+ const i = await m("git remote get-url --push origin");
948
+ i || l("获取项目远程git地址失败,请配置后重试");
951
949
  let n = e;
952
- n || (n = await k({
950
+ n || (n = await b({
953
951
  message: "请选择项目语言",
954
952
  choices: [
955
953
  {
@@ -972,40 +970,40 @@ async function oa(e, t) {
972
970
  }));
973
971
  let a = t;
974
972
  if (!a) {
975
- const s = $e(i), o = await it(s);
973
+ const s = X(i), o = await st(s);
976
974
  if (!o)
977
- return m(`未找到项目,请确认项目${i}是否存在,或者当前账号权限`);
975
+ return l(`未找到项目,请确认项目${i}是否存在,或者当前账号权限`);
978
976
  a = o.namespace.full_path;
979
977
  }
980
- ui({
978
+ it({
981
979
  language: n,
982
- "lint-staged": Xt[n],
980
+ "lint-staged": ei[n],
983
981
  repository: {
984
982
  url: i,
985
983
  group: a
986
984
  }
987
985
  });
988
986
  }
989
- async function Ie(e, t) {
990
- e ? L.rm("-rf", Z) : v(E()) && (await Ue({
991
- message: `当前项目中已存在配置文件夹${Z},确认重新配置?`
992
- }) ? L.rm("-rf", Z) : process.exit(0)), await le(E(), { recursive: !0 }), await oa(e, t);
987
+ async function De(e, t) {
988
+ e ? P.rm("-rf", Y) : $(E()) && (await Ge({
989
+ message: `当前项目中已存在配置文件夹${Y},确认重新配置?`
990
+ }) ? P.rm("-rf", Y) : process.exit(0)), await pe(E(), { recursive: !0 }), await oa(e, t);
993
991
  const i = y("项目初始化中...").start();
994
992
  await ra(), i.succeed("项目初始化完成");
995
993
  }
996
994
  async function ca() {
997
- v(E()) && v(Ne()) ? Ke() : await Ie(), process.exit(0);
995
+ $(E()) && $(Ne()) ? Ye() : await De(), process.exit(0);
998
996
  }
999
997
  async function ua(e, t) {
1000
- t.projectLanguage && !Object.values(w).includes(t.projectLanguage) && m("项目语言不支持"), e ? (Q(), e === "." ? (await Ie(t.projectLanguage, void 0), process.exit(0)) : e === "prepare" ? await ca() : m("参数错误。执行 z init -h 查看帮助。")) : await sa();
998
+ t.projectLanguage && !Object.values(w).includes(t.projectLanguage) && l("项目语言不支持"), e ? (H(), e === "." ? (await De(t.projectLanguage, void 0), process.exit(0)) : e === "prepare" ? await ca() : l("参数错误。执行 z init -h 查看帮助。")) : await sa();
1001
999
  }
1002
- O.command("init").alias("i").description("初始化工具配置、项目配置").argument("[type]", "非必填。不传为初始化全局配置;传 . 为初始化当前项目;传 prepare 为初始化GIT HOOKS").option("--project-language", `项目语言。可选值:${Object.values(w).join("/")} `).action((...e) => B(ua, ...e));
1000
+ D.command("init").alias("i").description("初始化工具配置、项目配置").argument("[type]", "非必填。不传为初始化全局配置;传 . 为初始化当前项目;传 prepare 为初始化GIT HOOKS").option("--project-language", `项目语言。可选值:${Object.values(w).join("/")} `).action((...e) => z(ua, ...e));
1003
1001
  async function la(e, t) {
1004
1002
  if (!e)
1005
1003
  return "不能为空";
1006
1004
  if (!/^[a-z0-9-]+$/.test(e))
1007
1005
  return "格式为小写字母、中横线(可选)、数字(不推荐)。如apple, apple-tree";
1008
- if (Xe().includes(e))
1006
+ if (et().includes(e))
1009
1007
  return "当前目录下已存在同名文件夹,请先处理。";
1010
1008
  const a = (await Ci(e)).find((s) => s.path_with_namespace === `${t}/${e}`);
1011
1009
  return a ? `远程仓库中已存在同名项目(${a.http_url_to_repo}),请更名后重试` : !0;
@@ -1017,9 +1015,9 @@ function pa(e) {
1017
1015
  return e ? /^[a-zA-Z0-9.]+$/.test(e) ? !0 : "格式为大小写字母、数字、小数点,小驼峰命名。如userInfo、systemRouter3" : "不能为空";
1018
1016
  }
1019
1017
  async function da(e) {
1020
- ne(), Q(), await me();
1018
+ ee(), H(), await Ae();
1021
1019
  let t, i;
1022
- e.branchType ? t = e.branchType : t = await k({
1020
+ e.branchType ? t = e.branchType : t = await b({
1023
1021
  message: "请选择创建分支的类型",
1024
1022
  choices: [
1025
1023
  {
@@ -1035,17 +1033,17 @@ async function da(e) {
1035
1033
  value: de.REFACTOR
1036
1034
  }
1037
1035
  ]
1038
- }), e.branchPurpose ? i = e.branchPurpose : (i = await J({
1036
+ }), e.branchPurpose ? i = e.branchPurpose : (i = await B({
1039
1037
  message: "请输入创建分支的目的(大小写字母、数字,小驼峰式命名。如userInfo)",
1040
1038
  validate: pa
1041
1039
  }), i = i.trim());
1042
- const n = `${t}_${i}_${Qe()}`;
1043
- await l(`git fetch origin ${$.MASTER}`), await l(`git checkout -b ${n} origin/${$.MASTER}`), await l(`git push -u origin ${n}`), process.exit(0);
1040
+ const n = `${t}_${i}_${tt()}`;
1041
+ await m(`git fetch origin ${v.MASTER}`), await m(`git checkout -b ${n} origin/${v.MASTER}`), await m(`git push -u origin ${n}`), process.exit(0);
1044
1042
  }
1045
- const rt = (e) => `${q("ZenTaoDomain")}${e}`;
1043
+ const ut = (e) => `${F("ZenTaoDomain")}${e}`;
1046
1044
  async function fa() {
1047
- const e = await ve({
1048
- url: rt("/my-work-task.json?tid=mrrferp8"),
1045
+ const e = await $e({
1046
+ url: ut("/my-work-task.json?tid=mrrferp8"),
1049
1047
  method: "get"
1050
1048
  });
1051
1049
  return e?.tasks ? e.tasks.filter((t) => t.status !== "done").map(({ id: t, name: i }) => ({
@@ -1057,8 +1055,8 @@ async function fa() {
1057
1055
  })) : [];
1058
1056
  }
1059
1057
  async function ga() {
1060
- const e = await ve({
1061
- url: rt("/my-work-bug.json?tid=mrrferp8"),
1058
+ const e = await $e({
1059
+ url: ut("/my-work-bug.json?tid=mrrferp8"),
1062
1060
  method: "get"
1063
1061
  });
1064
1062
  return e?.bugs ? Object.values(e.bugs).map(({ id: t, title: i }) => ({
@@ -1069,9 +1067,9 @@ async function ga() {
1069
1067
  }
1070
1068
  })) : [];
1071
1069
  }
1072
- async function Je(e) {
1073
- const t = await l("git diff HEAD");
1074
- t || m("git暂存区没有内容,请先git add添加文件到暂存区");
1070
+ async function Fe(e) {
1071
+ const t = await m("git diff HEAD");
1072
+ t || l("git暂存区没有内容,请先git add添加文件到暂存区");
1075
1073
  const i = await ia({
1076
1074
  type: "commit-message-v2",
1077
1075
  input: t
@@ -1079,45 +1077,45 @@ async function Je(e) {
1079
1077
  });
1080
1078
  return e + i;
1081
1079
  }
1082
- async function ke(e, t, i) {
1080
+ async function Ee(e, t, i) {
1083
1081
  const n = y("🤖 生成提交信息中...").start();
1084
1082
  let a = "", s = !0;
1085
- if ([A.FEAT, A.FIX, A.REFACTOR].includes(e)) {
1083
+ if ([j.FEAT, j.FIX, j.REFACTOR].includes(e)) {
1086
1084
  const o = t.map((r) => r.value).join(",");
1087
- if (i || (a = await Je(`${e}(${o}): `)), !a) {
1085
+ if (i || (a = await Fe(`${e}(${o}): `)), !a) {
1088
1086
  const r = t.map((c) => c.name).join(";");
1089
1087
  a = `${e}(${o}): ${r}`, s = !1;
1090
1088
  }
1091
1089
  }
1092
- e === A.CHORE && (t ? a = `${e}: ${t}` : a = await Je(`${e}: `)), await I(Ne(), a, "utf-8"), s || i ? n.succeed("提交信息已生成(↓),可以进行提交了!") : n.warn("AI生成提交信息失败,已使用默认模板(↓),可以进行提交了!"), console.log(j.yellow(a));
1090
+ e === j.CHORE && (t ? a = `${e}: ${t}` : a = await Fe(`${e}: `)), await L(Ne(), a, "utf-8"), s || i ? n.succeed("提交信息已生成(↓),可以进行提交了!") : n.warn("AI生成提交信息失败,已使用默认模板(↓),可以进行提交了!"), console.log(S.yellow(a));
1093
1091
  }
1094
1092
  async function ha(e) {
1095
- const t = await k({
1093
+ const t = await b({
1096
1094
  message: "请选择你要创建的模板类型",
1097
1095
  choices: [
1098
1096
  {
1099
1097
  name: "feat - 业务需求/功能开发/BUG修复",
1100
- value: A.FEAT
1098
+ value: j.FEAT
1101
1099
  },
1102
1100
  {
1103
1101
  name: "fix - bug修复",
1104
- value: A.FIX
1102
+ value: j.FIX
1105
1103
  },
1106
1104
  {
1107
1105
  name: "refactor - 技术重构/性能优化/代码规范",
1108
- value: A.REFACTOR
1106
+ value: j.REFACTOR
1109
1107
  },
1110
1108
  {
1111
1109
  name: "chore - 其他",
1112
- value: A.CHORE
1110
+ value: j.CHORE
1113
1111
  }
1114
1112
  ]
1115
1113
  });
1116
- if ([A.FEAT, A.REFACTOR].includes(t)) {
1114
+ if ([j.FEAT, j.REFACTOR].includes(t)) {
1117
1115
  const i = await fa();
1118
1116
  if (!i.length)
1119
- return W("🤷 暂无开发任务");
1120
- const n = await Ee({
1117
+ return V("🤷 暂无开发任务");
1118
+ const n = await ve({
1121
1119
  message: "请关联开发任务(可多选):",
1122
1120
  validate: (a) => a.length === 0 ? "请选择项" : !0,
1123
1121
  choices: i.map((a) => ({
@@ -1126,13 +1124,13 @@ async function ha(e) {
1126
1124
  })),
1127
1125
  pageSize: i.length
1128
1126
  });
1129
- await ke(A.FEAT, n, e);
1127
+ await Ee(j.FEAT, n, e);
1130
1128
  }
1131
- if (t === A.FIX) {
1129
+ if (t === j.FIX) {
1132
1130
  const i = await ga();
1133
1131
  if (!i.length)
1134
- return W("🤷 暂无BUG");
1135
- const n = await Ee({
1132
+ return V("🤷 暂无BUG");
1133
+ const n = await ve({
1136
1134
  message: "请关联Bug(可多选):",
1137
1135
  validate: (a) => a.length === 0 ? "请选择项" : !0,
1138
1136
  choices: i.map((a) => ({
@@ -1141,59 +1139,59 @@ async function ha(e) {
1141
1139
  })),
1142
1140
  pageSize: i.length
1143
1141
  });
1144
- await ke(A.FIX, n, e);
1142
+ await Ee(j.FIX, n, e);
1145
1143
  }
1146
- if (t === A.CHORE) {
1144
+ if (t === j.CHORE) {
1147
1145
  let i = "";
1148
- e && (i = await J({
1146
+ e && (i = await B({
1149
1147
  message: "请输入commit msg:",
1150
1148
  validate: (n) => n.length === 0 ? "请输入commit msg" : !0
1151
- }), i = i.trim()), await ke(A.CHORE, i);
1149
+ }), i = i.trim()), await Ee(j.CHORE, i);
1152
1150
  }
1153
1151
  process.exit(0);
1154
1152
  }
1155
1153
  async function wa() {
1156
1154
  try {
1157
1155
  const e = {}, t = async () => {
1158
- const P = Xe(), { projects: te } = await hi(), H = te.map((re) => {
1159
- const Pe = {
1160
- name: `${re.name} [${re.desc}]`,
1161
- value: re.name,
1156
+ const O = et(), { projects: ie } = await wi(), K = ie.map((ce) => {
1157
+ const Me = {
1158
+ name: `${ce.name} [${ce.desc}]`,
1159
+ value: ce.name,
1162
1160
  disabled: !1
1163
1161
  };
1164
- return P.includes(re.name) && (Pe.disabled = "目录下已存在同名文件夹"), Pe;
1165
- }), ht = await k({
1162
+ return O.includes(ce.name) && (Me.disabled = "目录下已存在同名文件夹"), Me;
1163
+ }), vt = await b({
1166
1164
  message: "请选择一个项目模板",
1167
- choices: H
1168
- }), Se = te.find((re) => re.name === ht);
1169
- e.tplName = Se.name, e.tplUrl = Se.url, e.tplLanguage = Se.language;
1165
+ choices: K
1166
+ }), Te = ie.find((ce) => ce.name === vt);
1167
+ e.tplName = Te.name, e.tplUrl = Te.url, e.tplLanguage = Te.language;
1170
1168
  }, i = async () => {
1171
- const { groups: P } = Pi(), te = await k({
1169
+ const { groups: O } = Oi(), ie = await b({
1172
1170
  message: "请选择一个分组",
1173
- choices: P.map((H) => ({
1174
- name: `${H.name} [${H.description}]`,
1175
- value: H.id,
1176
- short: H.name
1171
+ choices: O.map((K) => ({
1172
+ name: `${K.name} [${K.description}]`,
1173
+ value: K.id,
1174
+ short: K.name
1177
1175
  }))
1178
1176
  });
1179
1177
  e.group = {
1180
- id: te,
1181
- name: P.find((H) => H.id === te)?.name
1178
+ id: ie,
1179
+ name: O.find((K) => K.id === ie)?.name
1182
1180
  };
1183
1181
  }, n = async () => {
1184
- e.projectName = await J({
1182
+ e.projectName = await B({
1185
1183
  message: "请输入项目名称",
1186
- validate: (P) => la(P, e.group?.name || "")
1187
- }), e.projectName = e.projectName.trim(), e.projectDesc = await J({
1184
+ validate: (O) => la(O, e.group?.name || "")
1185
+ }), e.projectName = e.projectName.trim(), e.projectDesc = await B({
1188
1186
  message: "请输入项目描述",
1189
1187
  validate: ma
1190
1188
  }), e.projectDesc = e.projectDesc.trim();
1191
1189
  };
1192
1190
  await t(), await i(), await n();
1193
1191
  const a = `${fe}/${e.group?.name}/${e.projectName}.git`, s = y("模版初始化中").start();
1194
- await l(`git clone --depth=1 ${e.tplUrl}`), await _e(e.tplName, e.projectName), L.cd(e.projectName), L.rm("-rf", ".git"), await l(`git init --initial-branch=${$.MASTER}`), await l(`git remote add origin ${a}`), await l(`git config user.name ${T("gitName")}`), await l(`git config user.email ${T("gitEmail")}`);
1195
- const o = Re();
1196
- li({
1192
+ await m(`git clone --depth=1 ${e.tplUrl}`), await _e(e.tplName, e.projectName), P.cd(e.projectName), P.rm("-rf", ".git"), await m(`git init --initial-branch=${v.MASTER}`), await m(`git remote add origin ${a}`), await m(`git config user.name ${T("gitName")}`), await m(`git config user.email ${T("gitEmail")}`);
1193
+ const o = Ie();
1194
+ mi({
1197
1195
  ...o,
1198
1196
  name: e.projectName,
1199
1197
  description: e.projectDesc,
@@ -1201,11 +1199,11 @@ async function wa() {
1201
1199
  ...o.scripts,
1202
1200
  prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'"
1203
1201
  }
1204
- }), await R.writeFile(p.resolve("README.md"), Yt(e.projectName, e.projectDesc)), s.succeed("模版初始化完成"), await Ie(e.tplLanguage, e.group?.name);
1202
+ }), await I.writeFile(p.resolve("README.md"), Qt(e.projectName, e.projectDesc)), s.succeed("模版初始化完成"), await De(e.tplLanguage, e.group?.name);
1205
1203
  const r = y("依赖安装中").start();
1206
- await l("npm install --registry https://registry.npmmirror.com/"), r.succeed("依赖安装完成");
1204
+ await m("npm install --registry https://registry.npmmirror.com/"), r.succeed("依赖安装完成");
1207
1205
  const c = y("项目推送中").start();
1208
- await l('git add . && git commit -m "chore: 项目初始化"'), await l("git tag v0.0.1");
1206
+ await m('git add . && git commit -m "chore: 项目初始化"'), await m("git tag v0.0.1");
1209
1207
  const u = await Ei({
1210
1208
  name: e.projectName,
1211
1209
  description: e.projectDesc,
@@ -1213,23 +1211,23 @@ async function wa() {
1213
1211
  visibility: "private",
1214
1212
  namespace_id: e.group?.id
1215
1213
  });
1216
- await l(`git push -u origin ${$.MASTER}`), await l(`git push origin HEAD:${$.MASTER} --tags`), c.succeed(`项目已推送到远程,地址: ${j.blue(a)}`);
1217
- const d = y("初始化分支中").start(), f = `feat_init_${Qe()}`, g = [$.DEV, $.TEST, $.RELEASE, f], h = await Promise.allSettled(
1214
+ await m(`git push -u origin ${v.MASTER}`), await m(`git push origin HEAD:${v.MASTER} --tags`), c.succeed(`项目已推送到远程,地址: ${S.blue(a)}`);
1215
+ const d = y("初始化分支中").start(), f = `feat_init_${tt()}`, g = [v.DEV, v.TEST, v.RELEASE, f], h = await Promise.allSettled(
1218
1216
  g.map(
1219
- (P) => Li({
1217
+ (O) => Li({
1220
1218
  id: u.id,
1221
- branch: P,
1222
- ref: $.MASTER
1219
+ branch: O,
1220
+ ref: v.MASTER
1223
1221
  })
1224
1222
  )
1225
- ), S = [];
1226
- h.forEach(({ status: P }, te) => {
1227
- P === "fulfilled" && S.push(g[te]);
1228
- }), await l("git pull"), S.includes(f) ? (await l(`git checkout -b ${f} origin/${f}`), d.succeed(`项目已切换到初始分支: ${j.blue(f)}`)) : d.warn("开发分支检出失败!项目当前在主分支,请自行检出开发分支。");
1229
- const ee = `cd ${e.projectName} && z start`;
1230
- console.log(`输入 ${j.green(ee)} 开始开发吧~`), process.exit(0);
1223
+ ), k = [];
1224
+ h.forEach(({ status: O }, ie) => {
1225
+ O === "fulfilled" && k.push(g[ie]);
1226
+ }), await m("git pull"), k.includes(f) ? (await m(`git checkout -b ${f} origin/${f}`), d.succeed(`项目已切换到初始分支: ${S.blue(f)}`)) : d.warn("开发分支检出失败!项目当前在主分支,请自行检出开发分支。");
1227
+ const te = `cd ${e.projectName} && z start`;
1228
+ console.log(`输入 ${S.green(te)} 开始开发吧~`), process.exit(0);
1231
1229
  } catch (e) {
1232
- m(e);
1230
+ l(e);
1233
1231
  }
1234
1232
  }
1235
1233
  async function ya(e, t) {
@@ -1246,7 +1244,7 @@ async function ya(e, t) {
1246
1244
  "commit-msg",
1247
1245
  "cm"
1248
1246
  /* CommitMsgAbbr */
1249
- ].includes(e) ? i = "commit-msg" : m("参数输入错误") : i = await k({
1247
+ ].includes(e) ? i = "commit-msg" : l("参数输入错误") : i = await b({
1250
1248
  message: "请选择你要创建的类型",
1251
1249
  choices: [
1252
1250
  {
@@ -1265,20 +1263,20 @@ async function ya(e, t) {
1265
1263
  /* Project */
1266
1264
  }
1267
1265
  ]
1268
- }), i === "project" ? await wa() : (ne(), Q(), i === "branch" ? (await me(), await da(t)) : i === "commit-msg" && (await l("git status -s") ? await ha(t.commitMessageCloseAi) : m("没有要变动的文件,无法生成提交信息")));
1266
+ }), i === "project" ? await wa() : (ee(), H(), i === "branch" ? await da(t) : i === "commit-msg" && (await m("git status -s") ? await ha(t.commitMessageCloseAi) : l("没有要变动的文件,无法生成提交信息")));
1269
1267
  }
1270
- O.command("create").alias("c").description("创建项目/分支/提交信息").argument("[type]", "可选值为project|pr, branch|b, commit-msg|cm").option("--branch-type <type>", `分支类型。可选值:${Object.values(de).join(", ")}`).option("--branch-purpose <purpose>", "创建分支的目的").option("--commit-message-close-ai", "创建提交信息时,是否关闭AI生成").action((...e) => B(ya, ...e));
1271
- function $a(e) {
1272
- return et({
1273
- url: `${q("K8sDomain")}/kapis/clusters/youshou-local/devops.kubesphere.io/v1alpha3/namespaces/${e.groupName}/pipelines/${e.projectName}/pipelineruns?branch=${e.branchName}`,
1268
+ D.command("create").alias("c").description("创建项目/分支/提交信息").argument("[type]", "可选值为project|pr, branch|b, commit-msg|cm").option("--branch-type <type>", `分支类型。可选值:${Object.values(de).join(", ")}`).option("--branch-purpose <purpose>", "创建分支的目的").option("--commit-message-close-ai", "创建提交信息时,是否关闭AI生成").action((...e) => z(ya, ...e));
1269
+ function va(e) {
1270
+ return at({
1271
+ url: `${F("K8sDomain")}/kapis/clusters/youshou-local/devops.kubesphere.io/v1alpha3/namespaces/${e.groupName}/pipelines/${e.projectName}/pipelineruns?branch=${e.branchName}`,
1274
1272
  method: "post",
1275
1273
  data: e.params
1276
1274
  });
1277
1275
  }
1278
- async function va(e) {
1276
+ async function $a(e) {
1279
1277
  const t = y("部署任务创建中").start(), { targetBranch: i, notify: n, projectName: a } = e, s = n ? [.../* @__PURE__ */ new Set([T("weWorkUserId"), ...n])] : [T("weWorkUserId")];
1280
1278
  try {
1281
- const { metadata: o, spec: r } = await $a({
1279
+ const { metadata: o, spec: r } = await va({
1282
1280
  projectName: a,
1283
1281
  branchName: i,
1284
1282
  groupName: e.groupName,
@@ -1294,47 +1292,47 @@ async function va(e) {
1294
1292
  }
1295
1293
  ]
1296
1294
  }
1297
- }), c = `${q("K8SWebDomain")}/youshou-local/clusters/youshou-local/devops/${o.namespace}/pipelines/${r.pipelineRef.name}/branch/${r.scm.refName}/run/${o.name}/task-status`;
1298
- t.succeed("部署任务创建完成"), console.log(`如有需要,可在k8s中查看 ${j.blue(c)}`), process.exit(0);
1295
+ }), c = `${F("K8SWebDomain")}/youshou-local/clusters/youshou-local/devops/${o.namespace}/pipelines/${r.pipelineRef.name}/branch/${r.scm.refName}/run/${o.name}/task-status`;
1296
+ t.succeed("部署任务创建完成"), console.log(`如有需要,可在k8s中查看 ${S.blue(c)}`), process.exit(0);
1299
1297
  } catch (o) {
1300
- t.fail("部署任务创建失败"), m(o);
1298
+ t.fail("部署任务创建失败"), l(o);
1301
1299
  }
1302
1300
  }
1303
1301
  function Na(e, t) {
1304
- const i = Re();
1305
- if (pe()?.repository?.url || m(".z/project.json中缺少repository.url"), t === G.H5) {
1302
+ const i = Ie();
1303
+ if (se()?.repository?.url || l(".z/project.json中缺少repository.url"), t === W.H5) {
1306
1304
  const a = `build:${e}`;
1307
- i?.scripts[a] || m(`项目package.json文件scripts不存在命令${a}。`);
1305
+ i?.scripts[a] || l(`项目package.json文件scripts不存在命令${a}。`);
1308
1306
  }
1309
- t === G.NPM && (i?.scripts.build || m("项目package.json文件scripts不存在命令build。")), t === G.SERVER && (i?.scripts.build || m("项目package.json文件scripts不存在命令build。"));
1307
+ t === W.NPM && (i?.scripts.build || l("项目package.json文件scripts不存在命令build。")), t === W.SERVER && (i?.scripts.build || l("项目package.json文件scripts不存在命令build。"));
1310
1308
  }
1311
- async function ot(e, t) {
1312
- ne(), Q(), await me();
1309
+ async function lt(e, t) {
1310
+ ee(), H();
1313
1311
  let i = e, n = t.platform;
1314
- const a = pe();
1315
- if (a.language === w.JAVA && (n = G.SERVER), i && !Object.values($).includes(i) && m("仅支持发布指定环境分支"), n && !Object.values(G).includes(n) && m("发布平台错误"), n || (n = await k({
1312
+ const a = se();
1313
+ if (a.language === w.JAVA && (n = W.SERVER), i && !Object.values(v).includes(i) && l("仅支持发布指定环境分支"), n && !Object.values(W).includes(n) && l("发布平台错误"), n || (n = await b({
1316
1314
  message: "请选择平台",
1317
- choices: Lt
1318
- })), n === G.NPM && (i = $.MASTER), !i) {
1319
- const u = await k({
1315
+ choices: Ot
1316
+ })), n === W.NPM && (i = v.MASTER), !i) {
1317
+ const u = await b({
1320
1318
  message: "请选择部署环境",
1321
- choices: Dt
1319
+ choices: He
1322
1320
  });
1323
- i = Kt(u);
1321
+ i = Yt(u);
1324
1322
  }
1325
1323
  let s = "";
1326
- a.language === w.JAVASCRIPT && (s = Mt);
1324
+ a.language === w.JAVASCRIPT && (s = Jt);
1327
1325
  let o = "";
1328
1326
  if (a.language === w.JAVASCRIPT) {
1329
- const u = Re();
1330
- u.name.startsWith("@") && u.name.includes("/") ? o = u.name.split("/").reverse()[0] : o = u.name;
1327
+ const u = Ie();
1328
+ u.name.startsWith("@") && u.name.includes("/") ? o = u.name.split("/").pop() || "" : o = u.name;
1331
1329
  }
1332
1330
  if (a.language === w.JAVA) {
1333
- const { projects: u } = await wi(), d = u.find(
1334
- (f) => $e(f.url) === $e(a.repository.url)
1331
+ const { projects: u } = await nt(), d = u.find(
1332
+ (f) => X(f.url) === X(a.repository.url)
1335
1333
  );
1336
1334
  if (!d)
1337
- m("未找到项目对应的模块信息");
1335
+ l("未找到项目对应的模块信息");
1338
1336
  else {
1339
1337
  s = d["k8s-group-name"];
1340
1338
  const f = d.modules.map(({ name: g, desc: h }) => ({
@@ -1345,20 +1343,20 @@ async function ot(e, t) {
1345
1343
  const g = f.find((h) => h.value === t.module);
1346
1344
  g && (o = g.value);
1347
1345
  }
1348
- o = await k({
1346
+ o = await b({
1349
1347
  message: "请选择部署模块",
1350
1348
  choices: f
1351
1349
  });
1352
1350
  }
1353
1351
  }
1354
1352
  let r = [];
1355
- t.skipSelectionNotification || (r = await st("请选择部署成功要通知的人员:", () => !0, !0));
1353
+ t.skipSelectionNotification || (r = await ct("请选择部署成功要通知的人员:", () => !0, !0));
1356
1354
  let c = [];
1357
1355
  if (t.skipGroupNotification || (c = await na("请选择部署成功要通知的群组:", () => !0, !0)), a.language === w.JAVASCRIPT) {
1358
- const u = Ht(i);
1356
+ const u = Zt(i);
1359
1357
  Na(u, n);
1360
1358
  }
1361
- await va({
1359
+ await $a({
1362
1360
  projectName: o,
1363
1361
  groupName: s,
1364
1362
  targetBranch: i,
@@ -1366,7 +1364,7 @@ async function ot(e, t) {
1366
1364
  notifyGroup: c
1367
1365
  });
1368
1366
  }
1369
- async function ct(e, t, i, n) {
1367
+ async function mt(e, t, i, n) {
1370
1368
  const a = y(`分支合并中,${e} -> ${t}`).start();
1371
1369
  let s = 0;
1372
1370
  try {
@@ -1376,26 +1374,26 @@ async function ct(e, t, i, n) {
1376
1374
  source_branch: e,
1377
1375
  target_branch: t,
1378
1376
  // 合到主分支上的分支需要在合并完成后被移除
1379
- remove_source_branch: n ? !1 : $.MASTER === t
1377
+ remove_source_branch: n ? !1 : v.MASTER === t
1380
1378
  });
1381
1379
  s = r;
1382
1380
  } catch (r) {
1383
- ce.isAxiosError(r) && r?.response?.status === 409 && m(`存在重复的合并请求,前往查看${i.mergeRequestUrl}`), m(r);
1381
+ le.isAxiosError(r) && r?.response?.status === 409 && l(`存在重复的合并请求,前往查看${i.mergeRequestUrl}`), l(r);
1384
1382
  }
1385
1383
  const o = async () => {
1386
1384
  try {
1387
1385
  await new Promise((r) => {
1388
1386
  setTimeout(r, 5e3);
1389
- }), await xi({
1387
+ }), await Ii({
1390
1388
  id: i.id,
1391
1389
  iid: s
1392
1390
  }), a.succeed(`分支${e}已合并到分支${t}`);
1393
1391
  } catch (r) {
1394
- ce.isAxiosError(r) || m(r);
1392
+ le.isAxiosError(r) || l(r);
1395
1393
  const c = r?.response?.status;
1396
1394
  if (c === 406)
1397
1395
  return await o();
1398
- if (await Ii({
1396
+ if (await xi({
1399
1397
  id: i.id,
1400
1398
  iid: s,
1401
1399
  state_event: "close"
@@ -1415,69 +1413,69 @@ async function ct(e, t, i, n) {
1415
1413
  await o();
1416
1414
  }
1417
1415
  async function ba(e, t) {
1418
- const i = `origin/${e.sourceBranch}`, n = await l(`git log -b origin/${$.MASTER} -1 --format=%H`), a = await l(`git log -b origin/${e.sourceBranch} -1 --format=%H`), s = await l(
1416
+ const i = `origin/${e.sourceBranch}`, n = await m(`git log -b origin/${v.MASTER} -1 --format=%H`), a = await m(`git log -b origin/${e.sourceBranch} -1 --format=%H`), s = await m(
1419
1417
  `git log ${n}...${a} -b ${i}`
1420
1418
  );
1421
- if (s || m(`分支${e.sourceBranch}上不存在新的commit,不需要合并。`), await l(
1419
+ if (s || l(`分支${e.sourceBranch}上不存在新的commit,不需要合并。`), await m(
1422
1420
  `git branch --contains ${n} -r ${i}`
1423
- ) || (console.log(j.yellow("注意:当前分支上不存在远程主分支最新代码,将在自动合入后继续。")), await ct($.MASTER, e.sourceBranch, e)), t === $.MASTER) {
1421
+ ) || (console.log(S.yellow("注意:当前分支上不存在远程主分支最新代码,将在自动合入后继续。")), await mt(v.MASTER, e.sourceBranch, e)), t === v.MASTER) {
1424
1422
  const r = s.split(`
1425
- `).filter((f) => f), c = await l(`git log -b origin/${D.TEST} -1 --format=%H`), d = (await l(
1426
- `git log ${n}...${c} -b origin/${D.TEST}`
1423
+ `).filter((f) => f), c = await m(`git log -b origin/${C.TEST} -1 --format=%H`), d = (await m(
1424
+ `git log ${n}...${c} -b origin/${C.TEST}`
1427
1425
  )).split(`
1428
1426
  `).filter((f) => f);
1429
- qt(d, r) || m("请先在测试环境发布要部署的代码");
1427
+ Kt(d, r) || l("请先在测试环境发布要部署的代码");
1430
1428
  }
1431
1429
  }
1432
1430
  async function Aa(e, t) {
1433
- ne(), Q(), await me();
1434
- const i = await mi();
1435
- Object.values($).includes(i.sourceBranch) && m(`当前分支${i.sourceBranch}不可作为源分支合并到目标分支。`);
1436
- const a = (await Oi(i.id)).filter((c) => ![i.sourceBranch].includes(c.name)).map((c) => {
1431
+ ee(), H(), await Ae();
1432
+ const i = await pi();
1433
+ Object.values(v).includes(i.sourceBranch) && l(`当前分支${i.sourceBranch}不可作为源分支合并到目标分支。`);
1434
+ const a = (await Pi(i.id)).filter((c) => ![i.sourceBranch].includes(c.name)).map((c) => {
1437
1435
  let u = c.name;
1438
- return Object.values($).includes(u) && (u = j.bold.blue(u)), {
1436
+ return Object.values(v).includes(u) && (u = S.bold.blue(u)), {
1439
1437
  name: u,
1440
1438
  value: c.name
1441
1439
  };
1442
1440
  });
1443
1441
  let s;
1444
- e && !a.filter((c) => c.value === e).length && m(`未找到目标分支${e}`), e ? s = e : s = await k({
1442
+ e && !a.filter((c) => c.value === e).length && l(`未找到目标分支${e}`), e ? s = e : s = await b({
1445
1443
  message: "请选择要合并到的目标分支:",
1446
1444
  choices: a
1447
1445
  });
1448
1446
  const o = y(`本地分支${i.sourceBranch}检测中`).start();
1449
- if (await l(`git ls-remote --heads origin ${i.sourceBranch}`)) {
1450
- o.text = `存在远程分支origin/${i.sourceBranch}`, await l("git fetch");
1451
- const c = await l(`git rev-parse ${i.sourceBranch}`), u = await l(`git rev-parse origin/${i.sourceBranch}`);
1452
- await l(`git merge-base ${u} HEAD`) === u ? (await l(`git push -u origin ${i.sourceBranch}`), o.succeed(`本地分支${i.sourceBranch}已推送到远程分支origin/${i.sourceBranch}`)) : await l(`git merge-base ${c} ${u}`) === c ? (await l("git pull"), o.succeed(`本地分支${i.sourceBranch}已更新`)) : (o.fail(
1447
+ if (await m(`git ls-remote --heads origin ${i.sourceBranch}`)) {
1448
+ o.text = `存在远程分支origin/${i.sourceBranch}`, await m("git fetch");
1449
+ const c = await m(`git rev-parse ${i.sourceBranch}`), u = await m(`git rev-parse origin/${i.sourceBranch}`);
1450
+ await m(`git merge-base ${u} HEAD`) === u ? (await m(`git push -u origin ${i.sourceBranch}`), o.succeed(`本地分支${i.sourceBranch}已推送到远程分支origin/${i.sourceBranch}`)) : await m(`git merge-base ${c} ${u}`) === c ? (await m("git pull"), o.succeed(`本地分支${i.sourceBranch}已更新`)) : (o.fail(
1453
1451
  `远程分支origin/${i.sourceBranch}和本地分支${i.sourceBranch}都有新的提交,请手动合并后再试。`
1454
1452
  ), process.exit(1));
1455
1453
  } else
1456
- await l(`git push -u origin ${i.sourceBranch}`), o.succeed(`本地分支${i.sourceBranch}已推送到远程分支origin/${i.sourceBranch}`);
1457
- await ba(i, s), await ct(i.sourceBranch, s, i, t.keepBranchAfterMergeMaster), $.MASTER === s && !t.keepBranchAfterMergeMaster && (await l(`git checkout ${$.MASTER}`), await l(`git pull origin ${$.MASTER}`), await l(`git branch -d ${i.sourceBranch}`), W(
1458
- `${i.sourceBranch}分支已移除,当前已切换到最新的${$.MASTER}。如需继续开发,请检出新分支(z c b)。`
1459
- )), Object.values($).includes(s) && await ot(s, {
1454
+ await m(`git push -u origin ${i.sourceBranch}`), o.succeed(`本地分支${i.sourceBranch}已推送到远程分支origin/${i.sourceBranch}`);
1455
+ await ba(i, s), await mt(i.sourceBranch, s, i, t.keepBranchAfterMergeMaster), v.MASTER === s && !t.keepBranchAfterMergeMaster && (await m(`git checkout ${v.MASTER}`), await m(`git pull origin ${v.MASTER}`), await m(`git branch -d ${i.sourceBranch}`), V(
1456
+ `${i.sourceBranch}分支已移除,当前已切换到最新的${v.MASTER}。如需继续开发,请检出新分支(z c b)。`
1457
+ )), Object.values(v).includes(s) && await lt(s, {
1460
1458
  platform: t.deployPlatform,
1461
1459
  skipSelectionNotification: t.deploySkipSelectionNotification,
1462
1460
  skipGroupNotification: t.skipGroupNotification
1463
1461
  });
1464
1462
  }
1465
- O.command("merge").alias("m").description("合并当前分支到指定远程分支,并部署。").argument("[branch]", "目标分支名称").option("--deploy-platform <platform>", `合并成功后要部署的平台。可选值:${Object.values(G).join("/")}`).option("--deploy-skip-selection-notification", "部署时,是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").option("--keep-branch-after-merge-master", "在合并到主分支之后,是否保留分支。默认否").action((...e) => B(Aa, ...e));
1466
- O.command("deploy").alias("d").description("部署到指定环境").argument("[branchName]", `部署环境。可选值:${Object.values($).join("/")}`).option("--platform <platform>", `部署平台。可选值:${Object.values(G).join("/")}`).option("--module <module>", "部署模块。Java项目适用,填入要部署的模块名称").option("--skip-selection-notification", "是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").action((...e) => B(ot, ...e));
1463
+ D.command("merge").alias("m").description("合并当前分支到指定远程分支,并部署。").argument("[branch]", "目标分支名称").option("--deploy-platform <platform>", `合并成功后要部署的平台。可选值:${Object.values(W).join("/")}`).option("--deploy-skip-selection-notification", "部署时,是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").option("--keep-branch-after-merge-master", "在合并到主分支之后,是否保留分支。默认否").action((...e) => z(Aa, ...e));
1464
+ D.command("deploy").alias("d").description("部署到指定环境").argument("[branchName]", `部署环境。可选值:${Object.values(v).join("/")}`).option("--platform <platform>", `部署平台。可选值:${Object.values(W).join("/")}`).option("--module <module>", "部署模块。Java项目适用,填入要部署的模块名称").option("--skip-selection-notification", "是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").action((...e) => z(lt, ...e));
1467
1465
  async function ja() {
1468
1466
  try {
1469
- await l("java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml .", {
1467
+ await m("java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml .", {
1470
1468
  silent: !1
1471
- }), W("checkstyle执行完毕"), process.exit(0);
1469
+ }), V("checkstyle执行完毕"), process.exit(0);
1472
1470
  } catch {
1473
- m("checkstyle执行出错"), process.exit(1);
1471
+ l("checkstyle执行出错"), process.exit(1);
1474
1472
  }
1475
1473
  }
1476
1474
  async function Sa() {
1477
- v(p.resolve("node_modules", ".bin", "markdownlint")) || m("该项目未安装markdownlint,请安装后重试");
1475
+ $(p.resolve("node_modules", ".bin", "markdownlint")) || l("该项目未安装markdownlint,请安装后重试");
1478
1476
  const e = y("markdownlint执行中...").start();
1479
1477
  try {
1480
- await l('npx markdownlint "**/*.md" --fix', {
1478
+ await m('npx markdownlint "**/*.md" --fix', {
1481
1479
  silent: !1
1482
1480
  }), e.succeed("markdownlint执行成功"), process.exit(0);
1483
1481
  } catch {
@@ -1485,14 +1483,14 @@ async function Sa() {
1485
1483
  }
1486
1484
  }
1487
1485
  function ka() {
1488
- const e = pe();
1486
+ const e = se();
1489
1487
  if (e["lint-staged"])
1490
1488
  return e["lint-staged"];
1491
1489
  throw new Error("未找到lint配置");
1492
1490
  }
1493
1491
  async function Ta() {
1494
1492
  const e = y("代码风格检测中...").start();
1495
- await kt({
1493
+ await Ct({
1496
1494
  concurrent: 4,
1497
1495
  debug: !1,
1498
1496
  config: ka(),
@@ -1501,21 +1499,21 @@ async function Ta() {
1501
1499
  }) ? (e.succeed("代码风格检测通过!"), process.exit(0)) : (e.fail("代码风格检测未通过!"), process.exit(1));
1502
1500
  }
1503
1501
  function Ea(e) {
1504
- if (e.includes("Merge") && e.includes("# Conflicts:") || Tt.valid(e))
1502
+ if (e.includes("Merge") && e.includes("# Conflicts:") || Rt.valid(e))
1505
1503
  return !0;
1506
1504
  const t = e.split(": ");
1507
1505
  if (t.length === 1)
1508
1506
  return "body前缺少「: 」";
1509
1507
  const i = t[0];
1510
- return /^(feat|fix|refactor)/.test(i) ? /\(\d+(?:,\d+)*\)/.test(i) ? !0 : "ID缺少或者格式不正确。" : /^(chore|ci)/.test(i) ? [A.CHORE, A.CI].includes(i) ? !0 : "chore/ci类型无需填写ID。" : A.Break === i ? !0 : "不存在的提交类型。";
1508
+ return /^(feat|fix|refactor)/.test(i) ? /\(\d+(?:,\d+)*\)/.test(i) ? !0 : "ID缺少或者格式不正确。" : /^(chore|ci)/.test(i) ? [j.CHORE, j.CI].includes(i) ? !0 : "chore/ci类型无需填写ID。" : j.Break === i ? !0 : "不存在的提交类型。";
1511
1509
  }
1512
1510
  async function Ca() {
1513
- const e = await Te(p.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = y("提交信息格式校验中...").start(), i = Ea(e);
1511
+ const e = await Ce(p.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = y("提交信息格式校验中...").start(), i = Ea(e);
1514
1512
  i === !0 ? (t.succeed("提交信息格式校验通过"), process.exit(0)) : (t.fail(`提交信息格式校验失败。${i}`), process.exit(1));
1515
1513
  }
1516
1514
  async function Ra() {
1517
- await me();
1518
- const e = await Et({
1515
+ await Ae();
1516
+ const e = await It({
1519
1517
  // 分组,展示仓库链接
1520
1518
  format: ["group", "repo"],
1521
1519
  // 交互式弹窗
@@ -1526,29 +1524,29 @@ async function Ra() {
1526
1524
  install: "always"
1527
1525
  });
1528
1526
  if (e && Object.keys(e).length) {
1529
- W("升级完成 🎉");
1527
+ V("升级完成 🎉");
1530
1528
  const t = Object.entries(e).map(([i, n]) => `${i}@${n}`).join("; ");
1531
- await l(`git add . && git commit -m "chore: 依赖升级。${t}"`);
1529
+ await m(`git add . && git commit -m "chore: 依赖升级。${t}"`);
1532
1530
  }
1533
1531
  process.exit(0);
1534
1532
  }
1535
- async function xa(e) {
1536
- v(p.resolve("node_modules", ".bin", "eslint")) || m("该项目未安装eslint,请安装后重试");
1533
+ async function Ia(e) {
1534
+ $(p.resolve("node_modules", ".bin", "eslint")) || l("该项目未安装eslint,请安装后重试");
1537
1535
  const t = y("eslint执行中...").start();
1538
1536
  try {
1539
1537
  let i = "npx eslint '**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}' --fix";
1540
- process.platform === "win32" && (i = 'npx eslint "**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}" --fix'), e.quiet && (i += " --quiet"), e.maxWarnings && !isNaN(Number(e.maxWarnings)) ? i += ` --max-warnings ${Number(e.maxWarnings)}` : i += " --max-warnings 100", await l(i, {
1538
+ process.platform === "win32" && (i = 'npx eslint "**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}" --fix'), e.quiet && (i += " --quiet"), e.maxWarnings && !isNaN(Number(e.maxWarnings)) ? i += ` --max-warnings ${Number(e.maxWarnings)}` : i += " --max-warnings 100", await m(i, {
1541
1539
  silent: !1
1542
1540
  }), t.succeed("eslint执行成功"), process.exit(0);
1543
1541
  } catch {
1544
1542
  t.fail("eslint校验出错"), process.exit(1);
1545
1543
  }
1546
1544
  }
1547
- async function Ia() {
1548
- v(p.resolve("node_modules", ".bin", "prettier")) || m("该项目未安装prettier,请安装后重试");
1545
+ async function xa() {
1546
+ $(p.resolve("node_modules", ".bin", "prettier")) || l("该项目未安装prettier,请安装后重试");
1549
1547
  const e = y("prettier执行中...").start();
1550
1548
  try {
1551
- await l(
1549
+ await m(
1552
1550
  "npx prettier --write . --config .z/.prettierrc.json --ignore-path .z/.prettierignore --ignore-unknown --no-error-on-unmatched-pattern",
1553
1551
  {
1554
1552
  silent: !1
@@ -1559,11 +1557,11 @@ async function Ia() {
1559
1557
  }
1560
1558
  }
1561
1559
  function Da() {
1562
- v(p.resolve("./node_modules/.bin/vue-tsc")) || m("请先安装vue-tsc。推荐命令: npm i -D vue-tsc"), Vt("npx vue-tsc --build"), process.exit(0);
1560
+ $(p.resolve("./node_modules/.bin/vue-tsc")) || l("请先安装vue-tsc。推荐命令: npm i -D vue-tsc"), Ht("npx vue-tsc --build"), process.exit(0);
1563
1561
  }
1564
1562
  async function La(e, t) {
1565
- ne(), Q();
1566
- const i = pe();
1563
+ ee(), H();
1564
+ const i = se();
1567
1565
  let n;
1568
1566
  if (e)
1569
1567
  [
@@ -1598,7 +1596,7 @@ async function La(e, t) {
1598
1596
  "markdown-lint",
1599
1597
  "ml"
1600
1598
  /* MarkdownLintAbbr */
1601
- ].includes(e) ? n = "markdown-lint" : m("参数输入错误");
1599
+ ].includes(e) ? n = "markdown-lint" : l("参数输入错误");
1602
1600
  else {
1603
1601
  const a = [
1604
1602
  {
@@ -1648,24 +1646,26 @@ async function La(e, t) {
1648
1646
  value: "dependency-check"
1649
1647
  /* DependencyCheck */
1650
1648
  }
1651
- ), n = await k({
1649
+ ), n = await b({
1652
1650
  message: "请选择你要执行的操作",
1653
1651
  choices: a
1654
1652
  });
1655
1653
  }
1656
- n === "commit-msg" ? await Ca() : n === "commit-files" ? await Ta() : n === "prettier" ? await Ia() : n === "eslint" && [w.JAVASCRIPT, w.MARKDOWN].includes(i.language) ? await xa(t) : n === "type-check" && [w.JAVASCRIPT, w.MARKDOWN].includes(i.language) ? Da() : n === "dependency-check" && [w.JAVASCRIPT, w.MARKDOWN].includes(i.language) ? await Ra() : n === "checkstyle" && i.language === w.JAVA ? await ja() : n === "markdown-lint" && i.language === w.MARKDOWN && await Sa();
1654
+ n === "commit-msg" ? await Ca() : n === "commit-files" ? await Ta() : n === "prettier" ? await xa() : n === "eslint" && [w.JAVASCRIPT, w.MARKDOWN].includes(i.language) ? await Ia(t) : n === "type-check" && [w.JAVASCRIPT, w.MARKDOWN].includes(i.language) ? Da() : n === "dependency-check" && [w.JAVASCRIPT, w.MARKDOWN].includes(i.language) ? await Ra() : n === "checkstyle" && i.language === w.JAVA ? await ja() : n === "markdown-lint" && i.language === w.MARKDOWN && await Sa();
1657
1655
  }
1658
- O.command("run").alias("r").description("执行 eslint / prettier / type-check / dependency-check / checkstyle / markdown-lint。").argument(
1656
+ D.command("run").alias("r").description("执行 eslint / prettier / type-check / dependency-check / checkstyle / markdown-lint。").argument(
1659
1657
  "[type]",
1660
1658
  "非必填。可选值为commit-msg|cm, commit-files|cf, prettier|p, eslint|e, type-check|tc, dependency-check|dc, checkstyle|cs, markdown-lint|ml。"
1661
- ).option("--quiet", "eslint只打印error").option("--max-warnings [VALUE]", "eslint结果warn超过多少个会异常退出,默认为100", parseInt).action((...e) => B(La, ...e));
1662
- async function ut(e = "latest") {
1659
+ ).option("--quiet", "eslint只打印error").option("--max-warnings [VALUE]", "eslint结果warn超过多少个会异常退出,默认为100", parseInt).action((...e) => z(La, ...e));
1660
+ async function pt(e = "latest") {
1663
1661
  const t = y("安装中...").start();
1664
- await l(`npm i -g ${ie.name}@${e} --registry https://registry.npmmirror.com/`), t.text = "本地配置更新中...", ue("latestCheckVersionTimestamp", Date.now()), ue("version", e), se(), t.succeed(`升级完成,当前版本${e}`), process.exit(0);
1662
+ await m(`npm i -g ${ae.name}@${e} --registry https://registry.npmmirror.com/`), t.text = "本地配置更新中...", me("latestCheckVersionTimestamp", Date.now()), me("version", e);
1663
+ const i = await xe();
1664
+ je(i), re(), t.succeed(`升级完成,当前版本${e}`), process.exit(0);
1665
1665
  }
1666
- O.command("update").alias("u").description("升级").argument("[version]", "版本号", "latest").action((...e) => B(ut, ...e));
1667
- const De = /Thumbs\.db|\.git|DS_Store|idea/, lt = "testcase";
1668
- function mt(e) {
1666
+ D.command("update").alias("u").description("升级").argument("[version]", "版本号", "latest").action((...e) => z(pt, ...e));
1667
+ const Le = /Thumbs\.db|\.git|DS_Store|idea/, dt = "testcase";
1668
+ function ft(e) {
1669
1669
  const t = e.match(/^(.*[^[])?\[(\d+)]$/);
1670
1670
  if (t && !e.startsWith("["))
1671
1671
  return {
@@ -1684,15 +1684,15 @@ function mt(e) {
1684
1684
  displayName: e
1685
1685
  };
1686
1686
  }
1687
- async function X(e, t = {}) {
1688
- const { exclude: i = De } = t, n = [];
1687
+ async function Q(e, t = {}) {
1688
+ const { exclude: i = Le } = t, n = [];
1689
1689
  async function a(s) {
1690
1690
  const o = p.basename(s);
1691
- if ((await Nt(s)).isFile())
1691
+ if ((await jt(s)).isFile())
1692
1692
  return null;
1693
- const c = await Ce(s, { withFileTypes: !0 }), u = (await Promise.all(
1694
- c.filter((S) => S.isDirectory() && !i.test(S.name)).map((S) => a(p.join(s, S.name)))
1695
- )).filter(Boolean), { type: d, id: f, displayName: g } = mt(o), h = {
1693
+ const c = await Re(s, { withFileTypes: !0 }), u = (await Promise.all(
1694
+ c.filter((k) => k.isDirectory() && !i.test(k.name)).map((k) => a(p.join(s, k.name)))
1695
+ )).filter(Boolean), { type: d, id: f, displayName: g } = ft(o), h = {
1696
1696
  name: o,
1697
1697
  id: f,
1698
1698
  displayName: g,
@@ -1704,13 +1704,13 @@ async function X(e, t = {}) {
1704
1704
  }
1705
1705
  return await a(p.resolve(e)), n;
1706
1706
  }
1707
- async function pt(e, t = {}) {
1708
- const { exclude: i = De } = t;
1707
+ async function gt(e, t = {}) {
1708
+ const { exclude: i = Le } = t;
1709
1709
  try {
1710
- const n = await Ce(p.resolve(e), { withFileTypes: !0 });
1710
+ const n = await Re(p.resolve(e), { withFileTypes: !0 });
1711
1711
  return await Promise.all(
1712
1712
  n.filter((a) => a.isDirectory() && !i.test(a.name)).map((a) => {
1713
- const s = p.join(e, a.name), { type: o, id: r, displayName: c } = mt(a.name);
1713
+ const s = p.join(e, a.name), { type: o, id: r, displayName: c } = ft(a.name);
1714
1714
  return {
1715
1715
  name: a.name,
1716
1716
  id: r,
@@ -1721,10 +1721,10 @@ async function pt(e, t = {}) {
1721
1721
  })
1722
1722
  );
1723
1723
  } catch (n) {
1724
- return m(`读取目录失败: ${e} : ${n}`), [];
1724
+ return l(`读取目录失败: ${e} : ${n}`), [];
1725
1725
  }
1726
1726
  }
1727
- function V(e, t, i) {
1727
+ function q(e, t, i) {
1728
1728
  switch (e) {
1729
1729
  case "module":
1730
1730
  return i ? `${t}[${i}]` : t;
@@ -1736,39 +1736,39 @@ function V(e, t, i) {
1736
1736
  }
1737
1737
  async function we(e, t, i, n) {
1738
1738
  try {
1739
- const a = p.basename(e), s = V(i, t, n);
1739
+ const a = p.basename(e), s = q(i, t, n);
1740
1740
  if (a === s)
1741
1741
  return !0;
1742
1742
  const o = p.dirname(e), r = p.join(o, s);
1743
- return await Zt(e) ? await _e(e, r) : (await l(`git mv "${e}" "${r}"`), await l("git add .")), !0;
1743
+ return await Xt(e) ? await _e(e, r) : (await m(`git mv "${e}" "${r}"`), await m("git add .")), !0;
1744
1744
  } catch (a) {
1745
- return m(`重命名文件夹失败: ${e} -> ${t}。${a}`), !1;
1745
+ return l(`重命名文件夹失败: ${e} -> ${t}。${a}`), !1;
1746
1746
  }
1747
1747
  }
1748
- async function Oa(e, t, i = {}) {
1749
- const { exclude: n = De } = i;
1748
+ async function Pa(e, t, i = {}) {
1749
+ const { exclude: n = Le } = i;
1750
1750
  async function a(s, o) {
1751
1751
  if (!s || s.length === 0) return;
1752
- const r = await pt(o, { exclude: n });
1752
+ const r = await gt(o, { exclude: n });
1753
1753
  for (const c of s) {
1754
- const u = String(c.value), d = V("module", c.label, u), f = r.find((h) => h.id === u);
1754
+ const u = String(c.value), d = q("module", c.label, u), f = r.find((h) => h.id === u);
1755
1755
  let g = f?.path || p.join(o, d);
1756
- f ? f.displayName !== c.label && await we(f.path, c.label, "module", u) && (g = p.join(o, d)) : (await le(g, { recursive: !0 }), await l(`git add "${g}"`)), c.children && c.children.length > 0 && await a(c.children, g);
1756
+ f ? f.displayName !== c.label && await we(f.path, c.label, "module", u) && (g = p.join(o, d)) : (await pe(g, { recursive: !0 }), await m(`git add "${g}"`)), c.children && c.children.length > 0 && await a(c.children, g);
1757
1757
  }
1758
1758
  }
1759
1759
  await a(e, p.resolve(t));
1760
1760
  }
1761
- async function dt(e) {
1761
+ async function ht(e) {
1762
1762
  const t = {
1763
1763
  id: 0,
1764
1764
  name: "",
1765
1765
  path: ""
1766
1766
  };
1767
1767
  if (e)
1768
- Number.isNaN(Number(e)) && m("请输入正确的产品ID"), t.id = Number(e);
1768
+ Number.isNaN(Number(e)) && l("请输入正确的产品ID"), t.id = Number(e);
1769
1769
  else {
1770
- const i = await Bi();
1771
- t.id = await k({
1770
+ const i = await Ji();
1771
+ t.id = await b({
1772
1772
  message: "请选择产品",
1773
1773
  choices: i.map((n) => ({
1774
1774
  name: `${n.label}[${n.value}]`,
@@ -1776,30 +1776,30 @@ async function dt(e) {
1776
1776
  }))
1777
1777
  });
1778
1778
  }
1779
- return t.name = await Fi(t.id), t.path = p.join(lt, V("module", t.name, String(t.id))), t;
1779
+ return t.name = await Ui(t.id), t.path = p.join(dt, q("module", t.name, String(t.id))), t;
1780
1780
  }
1781
- async function Le(e) {
1782
- return (await pt(lt)).find((i) => Number(i.id) === e.id);
1781
+ async function Pe(e) {
1782
+ return (await gt(dt)).find((i) => Number(i.id) === e.id);
1783
1783
  }
1784
- async function ft(e, t) {
1784
+ async function wt(e, t) {
1785
1785
  const i = {
1786
1786
  precondition: e.precondition,
1787
1787
  priority: e.pri,
1788
1788
  steps: []
1789
1789
  };
1790
- i.steps = await _i(e.id), R.writeJSONSync(t, i, {
1790
+ i.steps = await Fi(e.id), I.writeJSONSync(t, i, {
1791
1791
  spaces: 2
1792
1792
  });
1793
1793
  }
1794
- async function gt(e, t) {
1795
- await le(t, {
1794
+ async function yt(e, t) {
1795
+ await pe(t, {
1796
1796
  recursive: !0
1797
- }), await ft(e, p.join(t, "config.json")), R.ensureFileSync(p.join(t, "data.yaml")), await I(
1797
+ }), await wt(e, p.join(t, "config.json")), I.ensureFileSync(p.join(t, "data.yaml")), await L(
1798
1798
  p.join(t, "data.yaml"),
1799
- v(p.resolve(Z, "data.yaml")) ? await Te(p.resolve(Z, "data.yaml")) : await bi()
1800
- ), R.ensureFileSync(p.join(t, "main.py")), await I(
1799
+ $(p.resolve(Y, "data.yaml")) ? await Ce(p.resolve(Y, "data.yaml")) : await bi()
1800
+ ), I.ensureFileSync(p.join(t, "main.py")), await L(
1801
1801
  p.join(t, "main.py"),
1802
- v(p.resolve(Z, "main.py")) ? await Te(p.resolve(Z, "main.py")) : await Ai()
1802
+ $(p.resolve(Y, "main.py")) ? await Ce(p.resolve(Y, "main.py")) : await Ai()
1803
1803
  );
1804
1804
  }
1805
1805
  function Oe(e) {
@@ -1808,74 +1808,74 @@ function Oe(e) {
1808
1808
  const n = Number(i);
1809
1809
  return Number.isInteger(n) && n > 0;
1810
1810
  }).map((i) => Number(i));
1811
- return t.length === 0 ? (m('未找到有效的ID,请输入格式如 "1,2,3,4" 的正整数ID'), []) : t;
1811
+ return t.length === 0 ? (l('未找到有效的ID,请输入格式如 "1,2,3,4" 的正整数ID'), []) : t;
1812
1812
  }
1813
1813
  return [];
1814
1814
  }
1815
- async function Ae(e, t) {
1816
- ne(), Q(), await me();
1815
+ async function Se(e, t) {
1816
+ ee(), H(), await Ae();
1817
1817
  let i;
1818
- t ? ([C.MODULE, C.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${C.MODULE} 或者 ${C.CASE}。`), i = t) : i = await k({
1818
+ t ? ([R.MODULE, R.CASE].includes(t) || l(`不支持的参数${t}。参数值应为 ${R.MODULE} 或者 ${R.CASE}。`), i = t) : i = await b({
1819
1819
  message: `请选择要${e}的数据类型`,
1820
- choices: zt
1820
+ choices: Ut
1821
1821
  });
1822
- const n = i === C.MODULE ? "模块" : C.CASE === i ? "用例" : "";
1822
+ const n = i === R.MODULE ? "模块" : R.CASE === i ? "用例" : "";
1823
1823
  return {
1824
1824
  type: i,
1825
1825
  typeStr: n
1826
1826
  };
1827
1827
  }
1828
- async function je(e) {
1829
- const t = await dt(e), i = await Le(t);
1830
- return i || m(`本地未找到产品【${t.name}[${t.id}]】`), {
1828
+ async function ke(e) {
1829
+ const t = await ht(e), i = await Pe(t);
1830
+ return i || l(`本地未找到产品【${t.name}[${t.id}]】`), {
1831
1831
  product: t,
1832
1832
  localProduct: i
1833
1833
  };
1834
1834
  }
1835
- async function Pa(e, t, i) {
1836
- e.text = "查找本地产品目录...", await Le(t) || m(`本地未找到产品【${t.name}[${t.id}]】`), e.text = "解析ID参数...";
1835
+ async function Oa(e, t, i) {
1836
+ e.text = "查找本地产品目录...", await Pe(t) || l(`本地未找到产品【${t.name}[${t.id}]】`), e.text = "解析ID参数...";
1837
1837
  const a = Oe(i);
1838
- let s = await X(t.path);
1838
+ let s = await Q(t.path);
1839
1839
  e.text = "获取远程用例列表...";
1840
- const o = await Ji(t.id, a);
1840
+ const o = await Bi(t.id, a);
1841
1841
  e.text = "本地用例同步中...";
1842
1842
  for (const r of o) {
1843
1843
  let c;
1844
1844
  if (r.module === 0 ? c = p.resolve(t.path) : c = s.find((d) => Number(d.id) === r.module)?.path || "", !c)
1845
- return m(`用例${r.title}[${r.id}]未找到所属模块(${r.module}),请先拉取模块`);
1845
+ return l(`用例${r.title}[${r.id}]未找到所属模块(${r.module}),请先拉取模块`);
1846
1846
  const u = s.find(({ id: d }) => r.id === Number(d));
1847
1847
  if (u)
1848
- u.displayName !== r.title && await we(u.path, r.title, u.type, u.id) && W(`重命名成功: ${u.displayName} -> ${r.title}`), s = await X(t.path), r.module === 0 ? c = p.resolve(t.path) : c = s.find((d) => Number(d.id) === r.module)?.path || "", await ft(
1848
+ u.displayName !== r.title && await we(u.path, r.title, u.type, u.id) && V(`重命名成功: ${u.displayName} -> ${r.title}`), s = await Q(t.path), r.module === 0 ? c = p.resolve(t.path) : c = s.find((d) => Number(d.id) === r.module)?.path || "", await wt(
1849
1849
  r,
1850
- p.join(c, V("case", r.title, String(r.id)), "config.json")
1850
+ p.join(c, q("case", r.title, String(r.id)), "config.json")
1851
1851
  );
1852
1852
  else {
1853
- const d = p.join(c, V("case", r.title, String(r.id)));
1854
- await gt(r, d);
1853
+ const d = p.join(c, q("case", r.title, String(r.id)));
1854
+ await yt(r, d);
1855
1855
  }
1856
1856
  }
1857
1857
  }
1858
1858
  async function Ma(e, t) {
1859
1859
  e.text = "本地产品目录查找中...";
1860
- const i = await Le(t);
1861
- i ? (e.text = "找到产品目录。开始重命名...", i.displayName !== t.name && await we(i.path, t.name, i.type, i.id) && (e.text = `重命名成功: ${i.displayName} -> ${t.name}`)) : (e.text = "未找到。开始创建产品目录...", await le(t.path, { recursive: !0 }), await l("git add .")), e.text = "获取远程模块列表...";
1862
- const n = await at(t.id);
1863
- e.text = "本地同步模块中...", await Oa(n || [], t.path);
1860
+ const i = await Pe(t);
1861
+ i ? (e.text = "找到产品目录。开始重命名...", i.displayName !== t.name && await we(i.path, t.name, i.type, i.id) && (e.text = `重命名成功: ${i.displayName} -> ${t.name}`)) : (e.text = "未找到。开始创建产品目录...", await pe(t.path, { recursive: !0 }), await m("git add .")), e.text = "获取远程模块列表...";
1862
+ const n = await rt(t.id);
1863
+ e.text = "本地同步模块中...", await Pa(n || [], t.path);
1864
1864
  }
1865
1865
  async function za(e, t) {
1866
- const { type: i, typeStr: n } = await Ae("拉取", e), a = await dt(t.productId), s = y(`${n}同步中...`).start();
1867
- if (C.MODULE === i && await Ma(s, a), C.CASE === i && await Pa(s, a, t.caseIds), s.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await l("git status -s")) {
1866
+ const { type: i, typeStr: n } = await Se("拉取", e), a = await ht(t.productId), s = y(`${n}同步中...`).start();
1867
+ if (R.MODULE === i && await Ma(s, a), R.CASE === i && await Oa(s, a, t.caseIds), s.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await m("git status -s")) {
1868
1868
  const o = y("代码提交中...").start();
1869
1869
  try {
1870
- await l(`git add . && git commit -m "chore: 同步禅道${n}数据"`), o.succeed("代码已提交 ✅");
1870
+ await m(`git add . && git commit -m "chore: 同步禅道${n}数据"`), o.succeed("代码已提交 ✅");
1871
1871
  } catch (r) {
1872
1872
  o.fail(`提交失败,${r}`), process.exit(1);
1873
1873
  }
1874
1874
  }
1875
1875
  }
1876
- O.command("qa-pull").alias("qp").description("将禅道中的模块或者用例同步到本地").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "type=case时,可传指定用例ID(可传N个,逗号隔开);不传则为产品下全部用例").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => B(za, ...e));
1877
- async function Ba(e, t, i) {
1878
- let n = await J({
1876
+ D.command("qa-pull").alias("qp").description("将禅道中的模块或者用例同步到本地").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "type=case时,可传指定用例ID(可传N个,逗号隔开);不传则为产品下全部用例").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(za, ...e));
1877
+ async function Ja(e, t, i) {
1878
+ let n = await B({
1879
1879
  message: "请输入你要创建的用例的前置条件(可不填)"
1880
1880
  });
1881
1881
  n = n.trim();
@@ -1896,8 +1896,8 @@ async function Ba(e, t, i) {
1896
1896
  desc: "按照预期执行",
1897
1897
  expect: "正常执行,符合预期"
1898
1898
  }), a.text = "本地用例创建中...";
1899
- const o = p.join(t.path, V("case", i, String(s)));
1900
- return v(o) ? W(`${o}已存在,请检查是否对应,本地不再创建。`) : (await gt(
1899
+ const o = p.join(t.path, q("case", i, String(s)));
1900
+ return $(o) ? V(`${o}已存在,请检查是否对应,本地不再创建。`) : (await yt(
1901
1901
  {
1902
1902
  id: s,
1903
1903
  pri: 3,
@@ -1906,24 +1906,24 @@ async function Ba(e, t, i) {
1906
1906
  o
1907
1907
  ), a.succeed(`用例【[${o}】创建完成 🎉`), o);
1908
1908
  }
1909
- async function Fa(e, t, i) {
1909
+ async function Ua(e, t, i) {
1910
1910
  const n = y(`模块【${i}】开始创建...`).start();
1911
1911
  n.text = "远程模块创建中...";
1912
- const a = await Ui({
1912
+ const a = await _i({
1913
1913
  root: Number(e.id),
1914
1914
  name: i,
1915
1915
  // 如果父模块是产品根目录,parent=0
1916
1916
  parent: p.resolve(e?.path) === t?.path ? 0 : Number(t?.id || 0)
1917
1917
  });
1918
1918
  n.text = "本地模块创建中...";
1919
- const s = p.join(t.path, V("module", i, String(a)));
1920
- if (v(s))
1921
- return W(`${s}已存在,请检查是否对应,本地不再创建。`);
1922
- await le(s, {
1919
+ const s = p.join(t.path, q("module", i, String(a)));
1920
+ if ($(s))
1921
+ return V(`${s}已存在,请检查是否对应,本地不再创建。`);
1922
+ await pe(s, {
1923
1923
  recursive: !0
1924
1924
  }), n.succeed(`模块【${s}】创建完成 🎉`);
1925
1925
  }
1926
- function Ja(e) {
1926
+ function Ba(e) {
1927
1927
  function t(n) {
1928
1928
  if (!n.children || n.children.length === 0) return;
1929
1929
  const a = n.children[0];
@@ -1936,7 +1936,7 @@ function Ja(e) {
1936
1936
  });
1937
1937
  }
1938
1938
  async function i(n, a = []) {
1939
- const s = a.length ? `请选择层级(当前:${a.join(" / ")})` : "请选择层级", o = await k({
1939
+ const s = a.length ? `请选择层级(当前:${a.join(" / ")})` : "请选择层级", o = await b({
1940
1940
  message: s,
1941
1941
  choices: n.map((r) => ({
1942
1942
  name: `${r.tempTitle ? r.tempTitle : r.label} ${r.children?.length ? "(有子级)" : ""}`,
@@ -1947,35 +1947,35 @@ function Ja(e) {
1947
1947
  }
1948
1948
  return i(e);
1949
1949
  }
1950
- async function _a(e, t) {
1951
- const { type: i, typeStr: n } = await Ae("创建", e), { product: a, localProduct: s } = await je(t.productId), o = await at(a.id), r = await Ja(o), c = V("module", r.label, String(r.value)), d = (await X(a.path, { hasRoot: !0 })).find((h) => h.name === c);
1952
- if (!d?.path || !v(d.path))
1953
- return m(`本地不存在${c}模块`);
1954
- let f = await J({
1950
+ async function Fa(e, t) {
1951
+ const { type: i, typeStr: n } = await Se("创建", e), { product: a, localProduct: s } = await ke(t.productId), o = await rt(a.id), r = await Ba(o), c = q("module", r.label, String(r.value)), d = (await Q(a.path, { hasRoot: !0 })).find((h) => h.name === c);
1952
+ if (!d?.path || !$(d.path))
1953
+ return l(`本地不存在${c}模块`);
1954
+ let f = await B({
1955
1955
  message: `请输入你要创建的${n}名称`,
1956
1956
  required: !0,
1957
1957
  validate: (h) => h.length > 0 && h.length < 255
1958
1958
  });
1959
1959
  f = f.trim();
1960
1960
  let g = "";
1961
- if (C.MODULE === i && await Fa(s, d, f), C.CASE === i && (g = await Ba(s, d, f)), !t.disableAutoCommit && C.CASE === i) {
1961
+ if (R.MODULE === i && await Ua(s, d, f), R.CASE === i && (g = await Ja(s, d, f)), !t.disableAutoCommit && R.CASE === i) {
1962
1962
  const h = y("代码提交中...").start();
1963
1963
  try {
1964
- await l(`git add . && git commit -m "chore: 创建了用例${p.basename(g)}"`), h.succeed("代码已提交 ✅");
1965
- } catch (S) {
1966
- h.fail(`提交失败,${S}`), process.exit(1);
1964
+ await m(`git add . && git commit -m "chore: 创建了用例${p.basename(g)}"`), h.succeed("代码已提交 ✅");
1965
+ } catch (k) {
1966
+ h.fail(`提交失败,${k}`), process.exit(1);
1967
1967
  }
1968
1968
  }
1969
1969
  }
1970
- O.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => B(_a, ...e));
1971
- async function Ua(e, t) {
1972
- const n = (await X(e.path)).filter((r) => r.type === "case");
1970
+ D.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(Fa, ...e));
1971
+ async function _a(e, t) {
1972
+ const n = (await Q(e.path)).filter((r) => r.type === "case");
1973
1973
  let a = [];
1974
1974
  if (t.length)
1975
1975
  a = n.filter((r) => t.includes(Number(r.id))).map((r) => ({
1976
1976
  id: Number(r.id),
1977
1977
  path: r.path
1978
- })), a.length || m(`未找到对应用例,请确认输入的用例ID(${t.join(", ")})是否正确`);
1978
+ })), a.length || l(`未找到对应用例,请确认输入的用例ID(${t.join(", ")})是否正确`);
1979
1979
  else {
1980
1980
  const r = n.map((c) => ({
1981
1981
  value: {
@@ -1984,7 +1984,7 @@ async function Ua(e, t) {
1984
1984
  },
1985
1985
  name: c.path.replace(p.resolve(e.path), "")
1986
1986
  }));
1987
- a = await ae({
1987
+ a = await ne({
1988
1988
  message: "选择要删除的用例",
1989
1989
  pageSize: 100,
1990
1990
  loop: !1,
@@ -2000,17 +2000,17 @@ async function Ua(e, t) {
2000
2000
  caseIds: o
2001
2001
  }), s.text = "本地用例删除中...";
2002
2002
  for (const r of a)
2003
- v(r.path) && L.rm("-rf", r.path);
2003
+ $(r.path) && P.rm("-rf", r.path);
2004
2004
  return s.succeed("用例删除完成"), o;
2005
2005
  }
2006
2006
  async function Ga(e, t) {
2007
- const n = (await X(e.path)).filter((r) => r.type === "module");
2007
+ const n = (await Q(e.path)).filter((r) => r.type === "module");
2008
2008
  let a = [];
2009
2009
  if (t.length)
2010
2010
  a = n.filter((r) => t.includes(Number(r.id))).map((r) => ({
2011
2011
  id: Number(r.id),
2012
2012
  path: r.path
2013
- })), a.length || m(`未找到对应模块,请确认输入的模块ID(${t.join(", ")})是否正确`);
2013
+ })), a.length || l(`未找到对应模块,请确认输入的模块ID(${t.join(", ")})是否正确`);
2014
2014
  else {
2015
2015
  const r = n.map((c) => ({
2016
2016
  value: {
@@ -2019,7 +2019,7 @@ async function Ga(e, t) {
2019
2019
  },
2020
2020
  name: c.path.replace(p.resolve(e.path), "")
2021
2021
  }));
2022
- a = await ae({
2022
+ a = await ne({
2023
2023
  message: "选择要删除的模块",
2024
2024
  pageSize: 100,
2025
2025
  loop: !1,
@@ -2036,28 +2036,28 @@ async function Ga(e, t) {
2036
2036
  moduleIds: o
2037
2037
  }), s.text = "本地模块删除中...";
2038
2038
  for (const r of a)
2039
- v(r.path) && L.rm("-rf", r.path);
2039
+ $(r.path) && P.rm("-rf", r.path);
2040
2040
  return s.succeed("模块删除完成"), o;
2041
2041
  }
2042
2042
  async function Wa(e, t) {
2043
- const { type: i, typeStr: n } = await Ae("删除", e), { localProduct: a } = await je(t.productId), s = Oe(t.targetIds);
2043
+ const { type: i, typeStr: n } = await Se("删除", e), { localProduct: a } = await ke(t.productId), s = Oe(t.targetIds);
2044
2044
  let o = [];
2045
- if (C.MODULE === i ? o = await Ga(a, s) : C.CASE === i && (o = await Ua(a, s)), !t.disableAutoCommit && await l("git status -s")) {
2045
+ if (R.MODULE === i ? o = await Ga(a, s) : R.CASE === i && (o = await _a(a, s)), !t.disableAutoCommit && await m("git status -s")) {
2046
2046
  const r = y("代码提交中...").start();
2047
2047
  try {
2048
- await l(`git add . && git commit -m 'chore: 删除了一些${n}(${o.join(", ")})'`), r.succeed("代码已提交 ✅");
2048
+ await m(`git add . && git commit -m 'chore: 删除了一些${n}(${o.join(", ")})'`), r.succeed("代码已提交 ✅");
2049
2049
  } catch (c) {
2050
2050
  r.fail(`提交失败,${c}`), process.exit(1);
2051
2051
  }
2052
2052
  }
2053
2053
  }
2054
- O.command("qa-remove").alias("qr").description("删除模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--target-ids <targetIds>", "可传指定目标(用例/模块)ID。可传N个,逗号隔开").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => B(Wa, ...e));
2054
+ D.command("qa-remove").alias("qr").description("删除模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--target-ids <targetIds>", "可传指定目标(用例/模块)ID。可传N个,逗号隔开").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(Wa, ...e));
2055
2055
  async function Va(e, t) {
2056
- const n = (await X(e.path)).filter((g) => g.type === "case");
2056
+ const n = (await Q(e.path)).filter((g) => g.type === "case");
2057
2057
  let a;
2058
2058
  if (t.targetId) {
2059
2059
  if (a = n.find((g) => Number(g.id) === Number(t.targetId)), !a)
2060
- return m(`未找到对应用例,请确认输入的用例ID(${t.targetId})是否正确`);
2060
+ return l(`未找到对应用例,请确认输入的用例ID(${t.targetId})是否正确`);
2061
2061
  } else {
2062
2062
  const g = n.map((h) => ({
2063
2063
  value: {
@@ -2067,18 +2067,18 @@ async function Va(e, t) {
2067
2067
  },
2068
2068
  name: h.path.replace(p.resolve(e.path), "")
2069
2069
  }));
2070
- [a] = await ae({
2070
+ [a] = await ne({
2071
2071
  message: "选择要更新的用例",
2072
2072
  pageSize: 100,
2073
2073
  loop: !1,
2074
2074
  multiple: void 0,
2075
- options: (h) => h ? g.filter((S) => S.name.includes(h)) : g,
2075
+ options: (h) => h ? g.filter((k) => k.name.includes(h)) : g,
2076
2076
  validate(h) {
2077
2077
  return h.length > 1 ? "只能选一个" : h.length < 1 ? "请选一个" : !0;
2078
2078
  }
2079
2079
  });
2080
2080
  }
2081
- let s = await J({
2081
+ let s = await B({
2082
2082
  message: "修改用例名称",
2083
2083
  default: a.displayName,
2084
2084
  required: !0,
@@ -2090,16 +2090,16 @@ async function Va(e, t) {
2090
2090
  s !== a.displayName ? (await Ki({
2091
2091
  id: Number(a.id),
2092
2092
  name: s
2093
- }), await we(a.path, s, "case", String(a.id)) && o.succeed(`用例重命名成功: ${a.displayName} -> ${s}`), a.displayName = s, a.path = p.join(p.dirname(a.path), V("case", s, String(a.id)))) : o.succeed("用例名称无变动");
2094
- let r = R.readJsonSync(p.join(a.path, "config.json")), c;
2095
- t.casePriority ? Number.isInteger(t.casePriority) && Number(t.casePriority) > 0 && Number(t.casePriority) < 6 ? c = Number(t.casePriority) : c = await ze({
2093
+ }), await we(a.path, s, "case", String(a.id)) && o.succeed(`用例重命名成功: ${a.displayName} -> ${s}`), a.displayName = s, a.path = p.join(p.dirname(a.path), q("case", s, String(a.id)))) : o.succeed("用例名称无变动");
2094
+ let r = I.readJsonSync(p.join(a.path, "config.json")), c;
2095
+ t.casePriority ? Number.isInteger(t.casePriority) && Number(t.casePriority) > 0 && Number(t.casePriority) < 6 ? c = Number(t.casePriority) : c = await Je({
2096
2096
  message: "修改用例优先级",
2097
2097
  min: 1,
2098
2098
  max: 5,
2099
2099
  required: !0,
2100
2100
  default: r.priority,
2101
2101
  validate: (g) => g > 0 && g < 6
2102
- }) : c = await ze({
2102
+ }) : c = await Je({
2103
2103
  message: "修改用例优先级",
2104
2104
  min: 1,
2105
2105
  max: 5,
@@ -2111,16 +2111,16 @@ async function Va(e, t) {
2111
2111
  c !== r.priority ? (await Zi({
2112
2112
  id: Number(a.id),
2113
2113
  priority: c
2114
- }), R.writeJSONSync(
2114
+ }), I.writeJSONSync(
2115
2115
  p.join(a.path, "config.json"),
2116
2116
  {
2117
2117
  ...r,
2118
2118
  priority: c
2119
2119
  },
2120
2120
  { spaces: 2 }
2121
- ), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = R.readJsonSync(p.join(a.path, "config.json"));
2121
+ ), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = I.readJsonSync(p.join(a.path, "config.json"));
2122
2122
  let d;
2123
- t.casePrecondition ? d = t.casePrecondition : (d = await J({
2123
+ t.casePrecondition ? d = t.casePrecondition : (d = await B({
2124
2124
  message: "修改用例前置条件",
2125
2125
  default: r.precondition,
2126
2126
  prefill: "editable"
@@ -2129,7 +2129,7 @@ async function Va(e, t) {
2129
2129
  return d !== r.precondition ? (await Yi({
2130
2130
  id: Number(a.id),
2131
2131
  precondition: d
2132
- }), R.writeJSONSync(
2132
+ }), I.writeJSONSync(
2133
2133
  p.join(a.path, "config.json"),
2134
2134
  {
2135
2135
  ...r,
@@ -2139,11 +2139,11 @@ async function Va(e, t) {
2139
2139
  ), f.succeed(`用例前置条件修改成功:${r.precondition} -> ${d}`)) : f.succeed("用例前置条件无变动"), a.id;
2140
2140
  }
2141
2141
  async function qa(e, t) {
2142
- const n = (await X(e.path)).filter((r) => r.type === "module");
2142
+ const n = (await Q(e.path)).filter((r) => r.type === "module");
2143
2143
  let a;
2144
2144
  if (t.targetId) {
2145
2145
  if (a = n.find((r) => Number(r.id) === Number(t.targetId)), !a)
2146
- return m(`未找到对应模块,请确认输入的模块ID(${t.targetId})是否正确`);
2146
+ return l(`未找到对应模块,请确认输入的模块ID(${t.targetId})是否正确`);
2147
2147
  } else {
2148
2148
  const r = n.map((c) => ({
2149
2149
  value: {
@@ -2153,7 +2153,7 @@ async function qa(e, t) {
2153
2153
  },
2154
2154
  name: c.path.replace(p.resolve(e.path), "")
2155
2155
  }));
2156
- [a] = await ae({
2156
+ [a] = await ne({
2157
2157
  message: "选择要更新的模块",
2158
2158
  pageSize: 100,
2159
2159
  loop: !1,
@@ -2164,7 +2164,7 @@ async function qa(e, t) {
2164
2164
  }
2165
2165
  });
2166
2166
  }
2167
- let s = await J({
2167
+ let s = await B({
2168
2168
  message: "修改模块名称",
2169
2169
  default: a.displayName,
2170
2170
  required: !0,
@@ -2179,43 +2179,43 @@ async function qa(e, t) {
2179
2179
  }), await we(a.path, s, "module", String(a.id)) && o.succeed(`模块重命名成功: ${a.displayName} -> ${s}`)) : o.succeed("模块名称无变动"), a.id;
2180
2180
  }
2181
2181
  async function Ha(e, t) {
2182
- const { type: i, typeStr: n } = await Ae("修改", e), { localProduct: a } = await je(t.productId);
2182
+ const { type: i, typeStr: n } = await Se("修改", e), { localProduct: a } = await ke(t.productId);
2183
2183
  let s;
2184
- if (C.MODULE === i ? s = await qa(a, t) : C.CASE === i && (s = await Va(a, t)), !t.disableAutoCommit && await l("git status -s")) {
2184
+ if (R.MODULE === i ? s = await qa(a, t) : R.CASE === i && (s = await Va(a, t)), !t.disableAutoCommit && await m("git status -s")) {
2185
2185
  const o = y("代码提交中...").start();
2186
2186
  try {
2187
- await l(`git add . && git commit -m 'chore: 修改了一个${n}(${s})'`), o.succeed("代码已提交 ✅");
2187
+ await m(`git add . && git commit -m 'chore: 修改了一个${n}(${s})'`), o.succeed("代码已提交 ✅");
2188
2188
  } catch (r) {
2189
2189
  o.fail(`提交失败,${r}`), process.exit(1);
2190
2190
  }
2191
2191
  }
2192
2192
  }
2193
- O.command("qa-update").alias("qu").description("修改模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--target-id <targetId>", "可传指定目标(用例/模块)ID").option("--target-name <targetName>", "可传指定目标(用例/模块)修改后的名称").option("--case-priority <casePriority>", "如果是用例,指定修改后的优先级").option("--case-precondition <casePrecondition>", "如果是用例,指定修改后的前置条件").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => B(Ha, ...e));
2193
+ D.command("qa-update").alias("qu").description("修改模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--target-id <targetId>", "可传指定目标(用例/模块)ID").option("--target-name <targetName>", "可传指定目标(用例/模块)修改后的名称").option("--case-priority <casePriority>", "如果是用例,指定修改后的优先级").option("--case-precondition <casePrecondition>", "如果是用例,指定修改后的前置条件").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(Ha, ...e));
2194
2194
  async function Ka(e, t) {
2195
2195
  if (!e.length)
2196
2196
  return [];
2197
- const i = Ct(20), n = e.map(
2197
+ const i = xt(20), n = e.map(
2198
2198
  (a) => i(async () => {
2199
2199
  try {
2200
- const s = t.env || "production", o = await l(`python ${a.path}/main.py --env ${s}`);
2200
+ const s = t.env || "production", o = await m(`python ${a.path}/main.py --env ${s}`);
2201
2201
  try {
2202
2202
  a.result = JSON.parse(o);
2203
2203
  } catch {
2204
- m(`用例${a.displayName}[${a.id}]返回格式错误:${o}`);
2204
+ l(`用例${a.displayName}[${a.id}]返回格式错误:${o}`);
2205
2205
  }
2206
2206
  } catch (s) {
2207
2207
  const o = s instanceof Error ? s.message : String(s);
2208
- m(`用例${a.displayName}[${a.id}]执行失败: ${o}`);
2208
+ l(`用例${a.displayName}[${a.id}]执行失败: ${o}`);
2209
2209
  }
2210
2210
  })
2211
2211
  );
2212
2212
  return await Promise.all(n), e;
2213
2213
  }
2214
2214
  async function Za(e) {
2215
- ne(), Q();
2216
- const { localProduct: t } = await je(e.productId);
2215
+ ee(), H();
2216
+ const { localProduct: t } = await ke(e.productId);
2217
2217
  let i = [];
2218
- const a = (await X(t.path)).filter((c) => c.type === "case");
2218
+ const a = (await Q(t.path)).filter((c) => c.type === "case");
2219
2219
  if (e.all)
2220
2220
  i = a.map((c) => ({
2221
2221
  id: Number(c.id),
@@ -2239,7 +2239,7 @@ async function Za(e) {
2239
2239
  },
2240
2240
  name: d.path.replace(p.resolve(t.path), "")
2241
2241
  }));
2242
- i = await ae({
2242
+ i = await ne({
2243
2243
  message: "选择要执行的用例",
2244
2244
  pageSize: 100,
2245
2245
  loop: !1,
@@ -2255,20 +2255,20 @@ async function Za(e) {
2255
2255
  s.succeed("所有用例执行通过 🎉");
2256
2256
  else {
2257
2257
  if (e.processStep === "1")
2258
- return W("执行报告如下:"), console.log(JSON.stringify(r, null, 2)), process.exit(0);
2258
+ return V("执行报告如下:"), console.log(JSON.stringify(r, null, 2)), process.exit(0);
2259
2259
  const c = r.reduce((f, g) => f + g.result.length, 0);
2260
2260
  s.warn(`【${r.length}】个用例执行出错,【${c}】个BUG将创建。`);
2261
2261
  let u = 0;
2262
2262
  if (e.executionId)
2263
- Number.isNaN(Number(e.executionId)) && m(`executionId ${e.executionId}不是正整数`), u = Number(e.executionId);
2263
+ Number.isNaN(Number(e.executionId)) && l(`executionId ${e.executionId}不是正整数`), u = Number(e.executionId);
2264
2264
  else {
2265
- const f = await Qi(), g = await k({
2265
+ const f = await Qi(), g = await b({
2266
2266
  message: "请选择用例执行出错后,BUG所属的项目",
2267
- choices: f.map(({ id: S, name: ee }) => ({ name: ee, value: S }))
2267
+ choices: f.map(({ id: k, name: te }) => ({ name: te, value: k }))
2268
2268
  }), h = await ea(g);
2269
- u = await k({
2269
+ u = await b({
2270
2270
  message: "请选择用例执行出错后,BUG所属的执行",
2271
- choices: h.map(({ id: S, name: ee }) => ({ name: ee, value: S }))
2271
+ choices: h.map(({ id: k, name: te }) => ({ name: te, value: k }))
2272
2272
  });
2273
2273
  }
2274
2274
  let d;
@@ -2277,12 +2277,12 @@ async function Za(e) {
2277
2277
  else {
2278
2278
  const f = await ta(Number(u));
2279
2279
  if (f.length) {
2280
- const g = await Ee({
2280
+ const g = await ve({
2281
2281
  message: "请选择BUG关联的构建版本(可多选;非必选,默认主干)",
2282
2282
  required: !1,
2283
- choices: f.map(({ id: h, name: S, date: ee, builder: P }) => ({
2283
+ choices: f.map(({ id: h, name: k, date: te, builder: O }) => ({
2284
2284
  value: h,
2285
- name: `${S} ${P} ${ee}`
2285
+ name: `${k} ${O} ${te}`
2286
2286
  }))
2287
2287
  });
2288
2288
  g.length ? d = g.join(",") : d = "";
@@ -2300,21 +2300,93 @@ async function Za(e) {
2300
2300
  openedBuild: d
2301
2301
  });
2302
2302
  s.succeed(
2303
- `用例执行完成。查看相关BUG(${q("ZenTaoDomain")}/zentao/execution-bug-${u}.html}) `
2303
+ `用例执行完成。查看相关BUG(${F("ZenTaoDomain")}/zentao/execution-bug-${u}.html}) `
2304
2304
  );
2305
2305
  }
2306
2306
  }
2307
- O.command("qa-exec").alias("qe").description("执行用例").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "可传指定用例ID。可传N个,逗号隔开").option("--all", "执行产品下所有用例").option("--concurrency <concurrency>", "最多并行执行脚本数。默认20").option("--process-step <step>", "不传默认2。 1. 仅在本地返回执行报告; 2. 执行出错的结果提交到禅道用例并提交BUG。").option("--env <env>", "环境变量,会作为参数传递给执行脚本。默认production").option("--execution-id <executionId>", "提bug时,要关联的禅道执行ID").option("--build-id <buildId>", "提bug时,要关联的禅道执行构建ID。默认主干(trunk)").action((...e) => B(Za, ...e));
2308
- function Ya() {
2307
+ D.command("qa-exec").alias("qe").description("执行用例").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "可传指定用例ID。可传N个,逗号隔开").option("--all", "执行产品下所有用例").option("--concurrency <concurrency>", "最多并行执行脚本数。默认20").option("--process-step <step>", "不传默认2。 1. 仅在本地返回执行报告; 2. 执行出错的结果提交到禅道用例并提交BUG。").option("--env <env>", "环境变量,会作为参数传递给执行脚本。默认production").option("--execution-id <executionId>", "提bug时,要关联的禅道执行ID").option("--build-id <buildId>", "提bug时,要关联的禅道执行构建ID。默认主干(trunk)").action((...e) => z(Za, ...e));
2308
+ async function Ya() {
2309
+ const { projects: e } = await nt(), t = se();
2310
+ if (t.serverProjectURL) {
2311
+ const n = e.find(
2312
+ (a) => X(a.url) === X(t.serverProjectURL)
2313
+ );
2314
+ if (n)
2315
+ return {
2316
+ projectId: decodeURIComponent(X(t.serverProjectURL)),
2317
+ moduleList: n.modules || []
2318
+ };
2319
+ }
2320
+ const i = await b({
2321
+ message: "请选择本项目对应的服务端项目",
2322
+ choices: e.map((n) => ({
2323
+ name: `${n.name}(${n.url})`,
2324
+ value: n.url
2325
+ }))
2326
+ });
2327
+ return it({ ...t, serverProjectURL: i }), {
2328
+ projectId: decodeURIComponent(X(i)),
2329
+ moduleList: e.find((n) => n.url === i)?.modules || []
2330
+ };
2331
+ }
2332
+ async function Xa(e) {
2333
+ if (e) {
2334
+ if (["service", "controller", "single"].includes(e))
2335
+ return e;
2336
+ l("type值错误");
2337
+ } else
2338
+ return await b({
2339
+ message: "请选择生成API的范围(服务 ≥ 模块 ≥ 接口)",
2340
+ choices: [
2341
+ {
2342
+ name: "单个服务",
2343
+ value: "service"
2344
+ },
2345
+ {
2346
+ name: "单个模块",
2347
+ value: "controller"
2348
+ },
2349
+ {
2350
+ name: "单个接口",
2351
+ value: "single"
2352
+ }
2353
+ ]
2354
+ });
2355
+ }
2356
+ async function Qa(e, t) {
2357
+ return e ? e.split(",").filter((i) => t.map((n) => n.name).includes(i.trim())) : await ve({
2358
+ message: "请选择对应的后端服务,不选默认全部",
2359
+ choices: t.map((i) => ({
2360
+ name: `${i.name}(${i.desc})`,
2361
+ value: i.name
2362
+ })),
2363
+ required: !1,
2364
+ pageSize: 20,
2365
+ loop: !0
2366
+ });
2367
+ }
2368
+ async function en(e) {
2369
+ return [C.DEV, C.TEST, C.RELEASE].includes(e.trim()) ? e : await b({
2370
+ message: "请选择对应的环境,不选默认全部",
2371
+ choices: He
2372
+ });
2373
+ }
2374
+ async function tn(e, t) {
2375
+ ee(), H();
2376
+ const i = await Xa(e), { projectId: n, moduleList: a } = await Ya(), s = await Qa(t.module, a), o = await en(t.env);
2377
+ i === "service" && console.log(n, s, o);
2378
+ }
2379
+ D.command("api").alias("a").description("选择对应的服务端项目,获取接口并转成ts接口代码及类型").argument("[type]", "可选值为service单个服务, controller单个controller, single单个接口").option("--module [module]", "模块名称。多个使用逗号隔开").option("--env [env]", "指定环境。dev/test/release").option("--controller-name [controllerName]", "controller名称").option("--api-name [apiName]", "api名称").action((...e) => z(tn, ...e));
2380
+ function an() {
2309
2381
  process.on("unhandledRejection", (e) => {
2310
2382
  }), process.on("uncaughtException", (e) => {
2311
- }), L.config.fatal = !0, L.config.silent = !0, L.config.verbose = !1;
2383
+ }), P.config.fatal = !0, P.config.silent = !0, P.config.verbose = !1;
2312
2384
  }
2313
- async function Xa() {
2385
+ async function nn() {
2314
2386
  const e = ge("latestCheckVersionTimestamp"), t = ge("versionCheckDuring");
2315
2387
  if (Date.now() - Number(e) > Number(t) * 24 * 3600 * 1e3) {
2316
- const i = await tt();
2317
- xe(i);
2388
+ const i = await xe();
2389
+ je(i);
2318
2390
  let n;
2319
2391
  try {
2320
2392
  const a = "TIME_OUT", s = new Promise((o) => {
@@ -2322,24 +2394,24 @@ async function Xa() {
2322
2394
  });
2323
2395
  n = await Promise.race([
2324
2396
  s,
2325
- l(`npm view ${ie.name} version --registry https://registry.npmmirror.com/`)
2326
- ]), n !== a && n !== ie.version && (console.log(`${j.blue(ie.name)}本地版本为${ie.version},低于线上版本${n},开始升级`), await ut(n)), ue("latestCheckVersionTimestamp", Date.now()), se();
2397
+ m(`npm view ${ae.name} version --registry https://registry.npmmirror.com/`)
2398
+ ]), n !== a && n !== ae.version && (console.log(`${S.blue(ae.name)}本地版本为${ae.version},低于线上版本${n},开始升级`), await pt(n)), me("latestCheckVersionTimestamp", Date.now()), re();
2327
2399
  } catch (a) {
2328
- console.log("升级出错!请重试,或者手动升级"), m(a);
2400
+ console.log("升级出错!请重试,或者手动升级"), l(a);
2329
2401
  }
2330
2402
  }
2331
2403
  }
2332
- async function Qa() {
2333
- const e = Rt(process.argv.slice(2));
2404
+ async function sn() {
2405
+ const e = Dt(process.argv.slice(2));
2334
2406
  if (!(e.h || e.help || e.v || e.version) && !(["init", "i"].includes(e._[0]) && ![".", "prepare"].includes(e._[1])))
2335
- if (Ze()) {
2336
- const t = R.readJSONSync(be());
2337
- M(t.profile), ue(t.main), xe(t.constants), await Xa();
2407
+ if (Xe()) {
2408
+ const t = I.readJSONSync(be());
2409
+ M(t.profile), me(t.main), je(t.constants), await nn();
2338
2410
  } else
2339
- m(`请先初始化z-develop(执行 z i)。更多见${qe}`);
2411
+ l(`请先初始化z-develop(执行 z i)。更多见${Ke}`);
2340
2412
  }
2341
- async function en() {
2342
- Ya(), await Qa();
2413
+ async function rn() {
2414
+ an(), await sn();
2343
2415
  }
2344
- O.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${j.blue(qe)}`).usage("<command> [options]").hook("preAction", en).version(ie.version, "-v, --version", "当前版本号").helpOption("-h, --help", "帮助").showHelpAfterError("可以使用z -h查看帮助。");
2345
- O.parse();
2416
+ D.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${S.blue(Ke)}`).usage("<command> [options]").hook("preAction", rn).version(ae.version, "-v, --version", "当前版本号").helpOption("-h, --help", "帮助").showHelpAfterError("可以使用z -h查看帮助。");
2417
+ D.parse();