cli-z-develop 0.13.0 → 0.13.2

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