cli-z-develop 0.12.3 → 0.13.0

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 +232 -196
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7,19 +7,19 @@ import ce, { AxiosError as jt } from "axios";
7
7
  import S from "chalk";
8
8
  import St from "dayjs";
9
9
  import O from "shelljs";
10
- import Tt from "node:os";
10
+ import kt from "node:os";
11
11
  import Me from "child_process";
12
- import { confirm as Ue, select as T, input as F, password as kt, checkbox as Ce, number as ze } from "@inquirer/prompts";
12
+ import { confirm as Ue, select as k, input as F, password as Tt, checkbox as Ce, number as ze } from "@inquirer/prompts";
13
13
  import y from "ora";
14
- import I from "fs-extra";
14
+ import x from "fs-extra";
15
15
  import { select as ae } from "inquirer-select-pro";
16
16
  import Et from "lint-staged";
17
17
  import Ct from "semver";
18
18
  import { run as Rt } from "npm-check-updates";
19
- import It from "p-limit";
20
- import xt from "minimist";
21
- const Ge = "dev", Ve = "test", We = "release", Dt = "production", Lt = "master";
22
- var b = /* @__PURE__ */ ((e) => (e[e.DEV = Ge] = "DEV", e[e.TEST = Ve] = "TEST", e[e.RELEASE = We] = "RELEASE", e[e.PROD = Dt] = "PROD", e))(b || {}), $ = /* @__PURE__ */ ((e) => (e[e.DEV = Ge] = "DEV", e[e.TEST = Ve] = "TEST", e[e.RELEASE = We] = "RELEASE", e[e.MASTER = Lt] = "MASTER", e))($ || {}), G = /* @__PURE__ */ ((e) => (e.H5 = "h5", e.NPM = "npm", e.SERVER = "server", e))(G || {});
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
23
  const qe = [
24
24
  {
25
25
  name: `开发环境 - ${b.DEV}`,
@@ -67,7 +67,7 @@ const Pt = {
67
67
  9: "其他"
68
68
  }, fe = "http://git.cxlqd.com", Mt = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
69
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", He = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
70
+ const zt = "fe-biz7tvsd", Ke = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
71
71
  var R = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(R || {});
72
72
  const Bt = [
73
73
  {
@@ -80,21 +80,21 @@ const Bt = [
80
80
  value: "case"
81
81
  /* CASE */
82
82
  }
83
- ], Jt = ".z", Ft = "develop-config.json", K = ".z", _t = ".commit-msg-tpl", Ut = "project.json";
83
+ ], Jt = ".z", Ft = "develop-config.json", Z = ".z", _t = ".commit-msg-tpl", Ut = "project.json";
84
84
  function C(e = "") {
85
- return p.join(K, e);
85
+ return p.join(Z, e);
86
86
  }
87
- function Ze() {
87
+ function He() {
88
88
  return C(Ut);
89
89
  }
90
90
  function Ne() {
91
91
  return C(_t);
92
92
  }
93
- function Ke() {
93
+ function Ze() {
94
94
  Me.spawnSync("git", ["config", "core.hooksPath", C()]), Me.spawnSync("git", ["config", "commit.template", Ne()]);
95
95
  }
96
96
  function he(e = "") {
97
- return p.resolve(Tt.homedir(), Jt, e);
97
+ return p.resolve(kt.homedir(), Jt, e);
98
98
  }
99
99
  function be() {
100
100
  return he(Ft);
@@ -116,11 +116,11 @@ function $e(e) {
116
116
  }
117
117
  return encodeURIComponent(t.replace(/\.git$/, ""));
118
118
  }
119
- const { red: Be, green: Vt, blue: bn, magenta: Wt, yellow: An } = S;
119
+ const { red: Be, green: Wt, blue: An, magenta: Vt, yellow: jn } = S;
120
120
  function ye(...e) {
121
121
  }
122
- function V(...e) {
123
- console.log(Vt(...e));
122
+ function W(...e) {
123
+ console.log(Wt(...e));
124
124
  }
125
125
  function Xe(e) {
126
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));
@@ -128,7 +128,7 @@ function Xe(e) {
128
128
  function l(e, t = !1) {
129
129
  Xe(e);
130
130
  let i = e;
131
- e instanceof Error ? (i = e.message, ce.isAxiosError(e) && (i = `请求失败:${e.message}`), console.log(Be(i)), console.log(Wt(e.stack))) : console.log(Be(e)), t || process.exit(1);
131
+ e instanceof Error ? (i = e.message, ce.isAxiosError(e) && (i = `请求失败:${e.message}`), console.log(Be(i)), console.log(Vt(e.stack))) : console.log(Be(e)), t || process.exit(1);
132
132
  }
133
133
  function Je(e) {
134
134
  return v(e) ? Nt(e).isDirectory() : !1;
@@ -175,10 +175,10 @@ function Q() {
175
175
  async function me() {
176
176
  await m("git status -s") !== "" && l("请先提交代码变动,再进行操作");
177
177
  }
178
- function Ht(e) {
178
+ function Kt(e) {
179
179
  return e === $.MASTER ? b.PROD : e;
180
180
  }
181
- function Zt(e) {
181
+ function Ht(e) {
182
182
  return e === b.PROD ? $.MASTER : e;
183
183
  }
184
184
  async function z(e, ...t) {
@@ -188,7 +188,7 @@ async function z(e, ...t) {
188
188
  throw Xe(i), i;
189
189
  }
190
190
  }
191
- async function Kt(e) {
191
+ async function Zt(e) {
192
192
  return (await Re(e)).length === 0;
193
193
  }
194
194
  function Yt(e = "项目中文名", t = "项目描述") {
@@ -262,11 +262,11 @@ const Xt = {
262
262
  "**/*.{py}": "echo 'todo'"
263
263
  },
264
264
  [w.MARKDOWN]: {
265
- "**/*.md": "markdownlint --fix",
265
+ "*": "prettier -wu",
266
266
  "**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix",
267
- "*": "prettier -wu"
267
+ "**/*.md": "markdownlint --fix"
268
268
  }
269
- }, Qt = "cli-z-develop", ei = "0.12.3", 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.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 = {
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
- }, x = {
280
+ }, I = {
281
281
  // 个人数据
282
282
  profile: {
283
283
  ldapAccount: "",
@@ -312,42 +312,42 @@ const Xt = {
312
312
  }
313
313
  };
314
314
  function E(e) {
315
- return e ? x.profile[e] : x.profile;
315
+ return e ? I.profile[e] : I.profile;
316
316
  }
317
317
  function ge(e) {
318
- return e ? x.main[e] : x.main;
318
+ return e ? I.main[e] : I.main;
319
319
  }
320
320
  function q(e) {
321
- return e ? x.constants[e] : x.constants;
321
+ return e ? I.constants[e] : I.constants;
322
322
  }
323
323
  let _ = null, U = null;
324
324
  function Ae() {
325
325
  if (_)
326
326
  return _;
327
327
  const e = p.join("package.json");
328
- return v(e) || l(`当前目录(${O.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), _ = I.readJsonSync(e), _;
328
+ return v(e) || l(`当前目录(${O.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), _ = x.readJsonSync(e), _;
329
329
  }
330
330
  function pe() {
331
331
  if (U)
332
332
  return U;
333
- const e = Ze();
333
+ const e = He();
334
334
  return v(e) || l(
335
335
  `当前目录(${O.pwd()})不存在${e}文件,请在项目根目录执行该命令,或者初始化项目(z init .)。`
336
- ), U = I.readJsonSync(e), U;
336
+ ), U = x.readJsonSync(e), U;
337
337
  }
338
338
  function ui(e) {
339
339
  U ? U = {
340
340
  ...U,
341
341
  ...e
342
- } : U = e, I.writeJSONSync(Ze(), U, { spaces: 2 });
342
+ } : U = e, x.writeJSONSync(He(), U, { spaces: 2 });
343
343
  }
344
344
  function li(e) {
345
345
  _ ? _ = {
346
346
  ..._,
347
347
  ...e
348
- } : _ = e, I.writeJSONSync(p.join("package.json"), _, { spaces: 2 });
348
+ } : _ = e, x.writeJSONSync(p.join("package.json"), _, { spaces: 2 });
349
349
  }
350
- const Z = {
350
+ const H = {
351
351
  id: 0,
352
352
  path: "",
353
353
  group: "",
@@ -355,17 +355,17 @@ const Z = {
355
355
  mergeRequestUrl: ""
356
356
  };
357
357
  async function mi() {
358
- if (!Z.id)
358
+ if (!H.id)
359
359
  try {
360
360
  const e = pe(), t = $e(e.repository.url), i = await nt(t);
361
- Z.id = i.id, Z.path = t, Z.group = i.namespace.full_path, Z.mergeRequestUrl = `${i.web_url}/merge_requests`;
361
+ H.id = i.id, H.path = t, H.group = i.namespace.full_path, H.mergeRequestUrl = `${i.web_url}/merge_requests`;
362
362
  } catch (e) {
363
363
  l(e);
364
364
  }
365
- return Z.sourceBranch || (Z.sourceBranch = await m("git branch --show-current")), Z;
365
+ return H.sourceBranch || (H.sourceBranch = await m("git branch --show-current")), H;
366
366
  }
367
367
  function se() {
368
- I.writeJSONSync(
368
+ x.writeJSONSync(
369
369
  be(),
370
370
  {
371
371
  main: ge(),
@@ -378,20 +378,20 @@ function se() {
378
378
  );
379
379
  }
380
380
  function M(e, t) {
381
- t !== void 0 ? x.profile[e] = t : x.profile = {
382
- ...x.profile,
381
+ t !== void 0 ? I.profile[e] = t : I.profile = {
382
+ ...I.profile,
383
383
  ...e
384
384
  };
385
385
  }
386
- function Ie(e, t) {
387
- x.constants = {
388
- ...x.constants,
386
+ function xe(e, t) {
387
+ I.constants = {
388
+ ...I.constants,
389
389
  ...e
390
390
  };
391
391
  }
392
392
  function ue(e, t) {
393
- t !== void 0 ? x.main[e] = t : x.main = {
394
- ...x.main,
393
+ t !== void 0 ? I.main[e] = t : I.main = {
394
+ ...I.main,
395
395
  ...e
396
396
  };
397
397
  }
@@ -583,12 +583,12 @@ function Si() {
583
583
  url: J("src/data/project-group-chats.json")
584
584
  });
585
585
  }
586
- function Ti() {
586
+ function ki() {
587
587
  return N({
588
588
  url: `${B()}/user`
589
589
  });
590
590
  }
591
- function ki() {
591
+ function Ti() {
592
592
  return N({
593
593
  url: `${B()}/groups`
594
594
  });
@@ -621,13 +621,13 @@ function Ri(e) {
621
621
  data: e
622
622
  });
623
623
  }
624
- function Ii(e) {
624
+ function xi(e) {
625
625
  return N({
626
626
  url: `${B()}/projects/${e.id}/merge_requests/${e.iid}/merge`,
627
627
  method: "put"
628
628
  });
629
629
  }
630
- function xi(e) {
630
+ function Ii(e) {
631
631
  return N({
632
632
  url: `${B()}/projects/${e.id}/merge_requests/${e.iid}`,
633
633
  method: "put",
@@ -654,10 +654,10 @@ function Oi(e) {
654
654
  }
655
655
  function Pi() {
656
656
  const e = he("fe-groups.json");
657
- return v(e) ? I.readJSONSync(e) : { groups: [] };
657
+ return v(e) ? x.readJSONSync(e) : { groups: [] };
658
658
  }
659
659
  async function Mi() {
660
- const e = await ki(), t = Mt.map((i) => {
660
+ const e = await Ti(), t = Mt.map((i) => {
661
661
  const n = e.find((a) => a.name === i);
662
662
  return n ? {
663
663
  name: n.name,
@@ -665,7 +665,7 @@ async function Mi() {
665
665
  description: n.description
666
666
  } : !1;
667
667
  }).filter((i) => !!i);
668
- I.writeJSONSync(he("fe-groups.json"), { groups: t }, { spaces: 2 });
668
+ x.writeJSONSync(he("fe-groups.json"), { groups: t }, { spaces: 2 });
669
669
  }
670
670
  async function A(e) {
671
671
  const t = `${q("FEServerDomain")}/api`, { data: i } = await Y({
@@ -736,13 +736,13 @@ function Gi(e) {
736
736
  data: e
737
737
  });
738
738
  }
739
- function Vi(e) {
739
+ function Wi(e) {
740
740
  return A({
741
741
  url: "/zen/testcase/step/create",
742
742
  data: e
743
743
  });
744
744
  }
745
- function Wi(e) {
745
+ function Vi(e) {
746
746
  return A({
747
747
  url: "/zen/testcase/modules/remove",
748
748
  data: e
@@ -754,19 +754,19 @@ function qi(e) {
754
754
  data: e
755
755
  });
756
756
  }
757
- function Hi(e) {
757
+ function Ki(e) {
758
758
  return A({
759
759
  url: "/zen/testcase/module/update/name",
760
760
  data: e
761
761
  });
762
762
  }
763
- function Zi(e) {
763
+ function Hi(e) {
764
764
  return A({
765
765
  url: "/zen/testcase/case/update/name",
766
766
  data: e
767
767
  });
768
768
  }
769
- function Ki(e) {
769
+ function Zi(e) {
770
770
  return A({
771
771
  url: "/zen/testcase/case/update/priority",
772
772
  data: e
@@ -874,7 +874,7 @@ async function sa() {
874
874
  Ye() && (await Ue({
875
875
  message: "系统中已存在z的配置文件,确认重新配置?"
876
876
  }) ? O.rm("-rf", be()) : process.exit(0)), await le(he(), { recursive: !0 });
877
- const t = await T({
877
+ const t = await k({
878
878
  message: "请选择岗位类型",
879
879
  choices: [
880
880
  {
@@ -895,13 +895,13 @@ async function sa() {
895
895
  message: "请输入LDAP账号:"
896
896
  });
897
897
  i = i.trim();
898
- let n = await kt({
898
+ let n = await Tt({
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
903
  const a = await at();
904
- Ie(a);
904
+ xe(a);
905
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]);
906
906
  M({
907
907
  weWorkName: r,
@@ -912,7 +912,7 @@ async function sa() {
912
912
  }
913
913
  const e = y("配置信息初始化中").start();
914
914
  try {
915
- const t = await Ti();
915
+ const t = await ki();
916
916
  M({
917
917
  gitUserId: t.id,
918
918
  gitName: t.name,
@@ -943,13 +943,13 @@ z run commit-files`, { mode: 493 });
943
943
  mode: 493
944
944
  });
945
945
  }
946
- Ke();
946
+ Ze();
947
947
  }
948
948
  async function oa(e, t) {
949
949
  const i = await m("git remote get-url --push origin");
950
950
  i || l("获取项目远程git地址失败,请配置后重试");
951
951
  let n = e;
952
- n || (n = await T({
952
+ n || (n = await k({
953
953
  message: "请选择项目语言",
954
954
  choices: [
955
955
  {
@@ -986,18 +986,18 @@ async function oa(e, t) {
986
986
  }
987
987
  });
988
988
  }
989
- async function xe(e, t) {
990
- e ? O.rm("-rf", K) : v(C()) && (await Ue({
991
- message: `当前项目中已存在配置文件夹${K},确认重新配置?`
992
- }) ? O.rm("-rf", K) : process.exit(0)), await le(C(), { recursive: !0 }), await oa(e, t);
989
+ async function Ie(e, t) {
990
+ e ? O.rm("-rf", Z) : v(C()) && (await Ue({
991
+ message: `当前项目中已存在配置文件夹${Z},确认重新配置?`
992
+ }) ? O.rm("-rf", Z) : process.exit(0)), await le(C(), { 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()) ? Ke() : await xe(), process.exit(0);
997
+ v(C()) && v(Ne()) ? Ze() : 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 xe(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) && l("项目语言不支持"), e ? (Q(), e === "." ? (await Ie(t.projectLanguage, void 0), process.exit(0)) : e === "prepare" ? await ca() : l("参数错误。执行 z init -h 查看帮助。")) : await sa();
1001
1001
  }
1002
1002
  D.command("init").alias("i").description("初始化工具配置、项目配置").argument("[type]", "非必填。不传为初始化全局配置;传 . 为初始化当前项目;传 prepare 为初始化GIT HOOKS").option("--project-language", `项目语言。可选值:${Object.values(w).join("/")} `).action((...e) => z(ua, ...e));
1003
1003
  async function la(e, t) {
@@ -1019,7 +1019,7 @@ function pa(e) {
1019
1019
  async function da(e) {
1020
1020
  ne(), Q(), await me();
1021
1021
  let t, i;
1022
- e.branchType ? t = e.branchType : t = await T({
1022
+ e.branchType ? t = e.branchType : t = await k({
1023
1023
  message: "请选择创建分支的类型",
1024
1024
  choices: [
1025
1025
  {
@@ -1079,7 +1079,7 @@ async function Fe(e) {
1079
1079
  });
1080
1080
  return e + i;
1081
1081
  }
1082
- async function ke(e, t, i) {
1082
+ async function Te(e, t, i) {
1083
1083
  const n = y("🤖 生成提交信息中...").start();
1084
1084
  let a = "", s = !0;
1085
1085
  if ([j.FEAT, j.FIX, j.REFACTOR].includes(e)) {
@@ -1092,7 +1092,7 @@ async function ke(e, t, i) {
1092
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));
1093
1093
  }
1094
1094
  async function ha(e) {
1095
- const t = await T({
1095
+ const t = await k({
1096
1096
  message: "请选择你要创建的模板类型",
1097
1097
  choices: [
1098
1098
  {
@@ -1116,7 +1116,7 @@ async function ha(e) {
1116
1116
  if ([j.FEAT, j.REFACTOR].includes(t)) {
1117
1117
  const i = await fa();
1118
1118
  if (!i.length)
1119
- return V("🤷 暂无开发任务");
1119
+ return W("🤷 暂无开发任务");
1120
1120
  const n = await Ce({
1121
1121
  message: "请关联开发任务(可多选):",
1122
1122
  validate: (a) => a.length === 0 ? "请选择项" : !0,
@@ -1126,12 +1126,12 @@ async function ha(e) {
1126
1126
  })),
1127
1127
  pageSize: i.length
1128
1128
  });
1129
- await ke(j.FEAT, n, e);
1129
+ await Te(j.FEAT, n, e);
1130
1130
  }
1131
1131
  if (t === j.FIX) {
1132
1132
  const i = await ga();
1133
1133
  if (!i.length)
1134
- return V("🤷 暂无BUG");
1134
+ return W("🤷 暂无BUG");
1135
1135
  const n = await Ce({
1136
1136
  message: "请关联Bug(可多选):",
1137
1137
  validate: (a) => a.length === 0 ? "请选择项" : !0,
@@ -1141,44 +1141,44 @@ async function ha(e) {
1141
1141
  })),
1142
1142
  pageSize: i.length
1143
1143
  });
1144
- await ke(j.FIX, n, e);
1144
+ await Te(j.FIX, n, e);
1145
1145
  }
1146
1146
  if (t === j.CHORE) {
1147
1147
  let i = "";
1148
1148
  e && (i = await F({
1149
1149
  message: "请输入commit msg:",
1150
1150
  validate: (n) => n.length === 0 ? "请输入commit msg" : !0
1151
- }), i = i.trim()), await ke(j.CHORE, i);
1151
+ }), i = i.trim()), await Te(j.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(), H = te.map((re) => {
1158
+ const P = Qe(), { projects: te } = await hi(), K = 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 T({
1165
+ }), yt = await k({
1166
1166
  message: "请选择一个项目模板",
1167
- choices: H
1168
- }), Te = te.find((re) => re.name === yt);
1169
- e.tplName = Te.name, e.tplUrl = Te.url, e.tplLanguage = Te.language;
1167
+ choices: K
1168
+ }), ke = te.find((re) => re.name === yt);
1169
+ e.tplName = ke.name, e.tplUrl = ke.url, e.tplLanguage = ke.language;
1170
1170
  }, i = async () => {
1171
- const { groups: P } = Pi(), te = await T({
1171
+ const { groups: P } = Pi(), te = await k({
1172
1172
  message: "请选择一个分组",
1173
- choices: P.map((H) => ({
1174
- name: `${H.name} [${H.description}]`,
1175
- value: H.id,
1176
- short: H.name
1173
+ choices: P.map((K) => ({
1174
+ name: `${K.name} [${K.description}]`,
1175
+ value: K.id,
1176
+ short: K.name
1177
1177
  }))
1178
1178
  });
1179
1179
  e.group = {
1180
1180
  id: te,
1181
- name: P.find((H) => H.id === te)?.name
1181
+ name: P.find((K) => K.id === te)?.name
1182
1182
  };
1183
1183
  }, n = async () => {
1184
1184
  e.projectName = await F({
@@ -1201,7 +1201,7 @@ 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 I.writeFile(p.resolve("README.md"), Yt(e.projectName, e.projectDesc)), s.succeed("模版初始化完成"), await xe(e.tplLanguage, e.group?.name);
1204
+ }), await x.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
1206
  await m("npm install --registry https://registry.npmmirror.com/"), r.succeed("依赖安装完成");
1207
1207
  const c = y("项目推送中").start();
@@ -1222,10 +1222,10 @@ async function wa() {
1222
1222
  ref: $.MASTER
1223
1223
  })
1224
1224
  )
1225
- ), k = [];
1225
+ ), T = [];
1226
1226
  h.forEach(({ status: P }, te) => {
1227
- P === "fulfilled" && k.push(g[te]);
1228
- }), await m("git pull"), k.includes(f) ? (await m(`git checkout -b ${f} origin/${f}`), d.succeed(`项目已切换到初始分支: ${S.blue(f)}`)) : d.warn("开发分支检出失败!项目当前在主分支,请自行检出开发分支。");
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("开发分支检出失败!项目当前在主分支,请自行检出开发分支。");
1229
1229
  const ee = `cd ${e.projectName} && z start`;
1230
1230
  console.log(`输入 ${S.green(ee)} 开始开发吧~`), process.exit(0);
1231
1231
  } catch (e) {
@@ -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 T({
1249
+ ].includes(e) ? i = "commit-msg" : l("参数输入错误") : i = await k({
1250
1250
  message: "请选择你要创建的类型",
1251
1251
  choices: [
1252
1252
  {
@@ -1312,15 +1312,15 @@ async function ut(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 T({
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({
1316
1316
  message: "请选择平台",
1317
1317
  choices: Ot
1318
1318
  })), n === G.NPM && (i = $.MASTER), !i) {
1319
- const u = await T({
1319
+ const u = await k({
1320
1320
  message: "请选择部署环境",
1321
1321
  choices: qe
1322
1322
  });
1323
- i = Zt(u);
1323
+ i = Ht(u);
1324
1324
  }
1325
1325
  let s = "";
1326
1326
  a.language === w.JAVASCRIPT && (s = zt);
@@ -1341,7 +1341,7 @@ async function ut(e, t) {
1341
1341
  const g = f.find((h) => h.value === t.module);
1342
1342
  g && (o = g.value);
1343
1343
  }
1344
- o = await T({
1344
+ o = await k({
1345
1345
  message: "请选择部署模块",
1346
1346
  choices: f
1347
1347
  });
@@ -1351,7 +1351,7 @@ async function ut(e, t) {
1351
1351
  t.skipSelectionNotification || (r = await ot("请选择部署成功要通知的人员:", () => !0, !0));
1352
1352
  let c = [];
1353
1353
  if (t.skipGroupNotification || (c = await na("请选择部署成功要通知的群组:", () => !0, !0)), a.language === w.JAVASCRIPT) {
1354
- const u = Ht(i);
1354
+ const u = Kt(i);
1355
1355
  Na(u, n);
1356
1356
  }
1357
1357
  await va({
@@ -1382,7 +1382,7 @@ async function lt(e, t, i, n) {
1382
1382
  try {
1383
1383
  await new Promise((r) => {
1384
1384
  setTimeout(r, 5e3);
1385
- }), await Ii({
1385
+ }), await xi({
1386
1386
  id: i.id,
1387
1387
  iid: s
1388
1388
  }), a.succeed(`分支${e}已合并到分支${t}`);
@@ -1391,7 +1391,7 @@ async function lt(e, t, i, n) {
1391
1391
  const c = r?.response?.status;
1392
1392
  if (c === 406)
1393
1393
  return await o();
1394
- if (await xi({
1394
+ if (await Ii({
1395
1395
  id: i.id,
1396
1396
  iid: s,
1397
1397
  state_event: "close"
@@ -1437,7 +1437,7 @@ async function Aa(e, t) {
1437
1437
  };
1438
1438
  });
1439
1439
  let s;
1440
- e && !a.filter((c) => c.value === e).length && l(`未找到目标分支${e}`), e ? s = e : s = await T({
1440
+ e && !a.filter((c) => c.value === e).length && l(`未找到目标分支${e}`), e ? s = e : s = await k({
1441
1441
  message: "请选择要合并到的目标分支:",
1442
1442
  choices: a
1443
1443
  });
@@ -1450,7 +1450,7 @@ async function Aa(e, t) {
1450
1450
  ), process.exit(1));
1451
1451
  } else
1452
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}`), V(
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(
1454
1454
  `${i.sourceBranch}分支已移除,当前已切换到最新的${$.MASTER}。如需继续开发,请检出新分支(z c b)。`
1455
1455
  )), Object.values($).includes(s) && await ut(s, {
1456
1456
  platform: t.deployPlatform,
@@ -1464,12 +1464,23 @@ async function ja() {
1464
1464
  try {
1465
1465
  await m("java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml .", {
1466
1466
  silent: !1
1467
- }), V("checkstyle执行完毕"), process.exit(0);
1467
+ }), W("checkstyle执行完毕"), process.exit(0);
1468
1468
  } catch {
1469
1469
  l("checkstyle执行出错"), process.exit(1);
1470
1470
  }
1471
1471
  }
1472
- function Sa() {
1472
+ async function Sa() {
1473
+ v(p.resolve("node_modules", ".bin", "markdownlint")) || l("该项目未安装markdownlint,请安装后重试");
1474
+ const e = y("markdownlint执行中...").start();
1475
+ try {
1476
+ await m('npx markdownlint "**/*.md" --fix', {
1477
+ silent: !1
1478
+ }), e.succeed("markdownlint执行成功"), process.exit(0);
1479
+ } catch {
1480
+ e.fail("markdownlint校验出错"), process.exit(1);
1481
+ }
1482
+ }
1483
+ function ka() {
1473
1484
  const e = pe();
1474
1485
  if (e["lint-staged"])
1475
1486
  return e["lint-staged"];
@@ -1480,12 +1491,12 @@ async function Ta() {
1480
1491
  await Et({
1481
1492
  concurrent: 4,
1482
1493
  debug: !1,
1483
- config: Sa(),
1494
+ config: ka(),
1484
1495
  quiet: !0,
1485
1496
  relative: !0
1486
1497
  }) ? (e.succeed("代码风格检测通过!"), process.exit(0)) : (e.fail("代码风格检测未通过!"), process.exit(1));
1487
1498
  }
1488
- function ka(e) {
1499
+ function Ea(e) {
1489
1500
  if (e.includes("Merge") && e.includes("# Conflicts:") || Ct.valid(e))
1490
1501
  return !0;
1491
1502
  const t = e.split(": ");
@@ -1494,11 +1505,11 @@ function ka(e) {
1494
1505
  const i = t[0];
1495
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 : "不存在的提交类型。";
1496
1507
  }
1497
- async function Ea() {
1498
- const e = await Ee(p.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = y("提交信息格式校验中...").start(), i = ka(e);
1508
+ async function Ca() {
1509
+ const e = await Ee(p.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = y("提交信息格式校验中...").start(), i = Ea(e);
1499
1510
  i === !0 ? (t.succeed("提交信息格式校验通过"), process.exit(0)) : (t.fail(`提交信息格式校验失败。${i}`), process.exit(1));
1500
1511
  }
1501
- async function Ca() {
1512
+ async function Ra() {
1502
1513
  await me();
1503
1514
  const e = await Rt({
1504
1515
  // 分组,展示仓库链接
@@ -1511,13 +1522,13 @@ async function Ca() {
1511
1522
  install: "always"
1512
1523
  });
1513
1524
  if (e && Object.keys(e).length) {
1514
- V("升级完成 🎉");
1525
+ W("升级完成 🎉");
1515
1526
  const t = Object.entries(e).map(([i, n]) => `${i}@${n}`).join("; ");
1516
1527
  await m(`git add . && git commit -m "chore: 依赖升级。${t}"`);
1517
1528
  }
1518
1529
  process.exit(0);
1519
1530
  }
1520
- async function Ra(e) {
1531
+ async function xa(e) {
1521
1532
  v(p.resolve("node_modules", ".bin", "eslint")) || l("该项目未安装eslint,请安装后重试");
1522
1533
  const t = y("eslint执行中...").start();
1523
1534
  try {
@@ -1543,10 +1554,10 @@ async function Ia() {
1543
1554
  e.fail("prettier校验出错"), process.exit(1);
1544
1555
  }
1545
1556
  }
1546
- function xa() {
1557
+ function Da() {
1547
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);
1548
1559
  }
1549
- async function Da(e, t) {
1560
+ async function La(e, t) {
1550
1561
  ne(), Q();
1551
1562
  const i = pe();
1552
1563
  let n;
@@ -1579,7 +1590,11 @@ async function Da(e, t) {
1579
1590
  "checkstyle",
1580
1591
  "cs"
1581
1592
  /* CheckStyleAbbr */
1582
- ].includes(e) ? n = "checkstyle" : l("参数输入错误");
1593
+ ].includes(e) ? n = "checkstyle" : [
1594
+ "markdown-lint",
1595
+ "ml"
1596
+ /* MarkdownLintAbbr */
1597
+ ].includes(e) ? n = "markdown-lint" : l("参数输入错误");
1583
1598
  else {
1584
1599
  const a = [
1585
1600
  {
@@ -1608,32 +1623,53 @@ async function Da(e, t) {
1608
1623
  value: "dependency-check"
1609
1624
  /* DependencyCheck */
1610
1625
  }
1611
- ), n = await T({
1626
+ ), i.language === w.MARKDOWN && a.push(
1627
+ {
1628
+ name: "执行markdown-lint",
1629
+ value: "markdown-lint"
1630
+ /* MarkdownLint */
1631
+ },
1632
+ {
1633
+ name: "执行 eslint",
1634
+ value: "eslint"
1635
+ /* Eslint */
1636
+ },
1637
+ {
1638
+ name: "执行 type-check",
1639
+ value: "type-check"
1640
+ /* TypeCheck */
1641
+ },
1642
+ {
1643
+ name: "执行 dependency-check",
1644
+ value: "dependency-check"
1645
+ /* DependencyCheck */
1646
+ }
1647
+ ), n = await k({
1612
1648
  message: "请选择你要执行的操作",
1613
1649
  choices: a
1614
1650
  });
1615
1651
  }
1616
- n === "commit-msg" ? await Ea() : n === "commit-files" ? await Ta() : n === "prettier" ? await Ia() : n === "eslint" && i.language === w.JAVASCRIPT ? await Ra(t) : n === "type-check" && i.language === w.JAVASCRIPT ? xa() : n === "dependency-check" && i.language === w.JAVASCRIPT ? await Ca() : n === "checkstyle" && i.language === w.JAVA && await ja();
1652
+ 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();
1617
1653
  }
1618
- D.command("run").alias("r").description("执行 eslint / prettier / type-check / dependency-check / checkstyle。").argument(
1654
+ D.command("run").alias("r").description("执行 eslint / prettier / type-check / dependency-check / checkstyle / markdown-lint。").argument(
1619
1655
  "[type]",
1620
- "非必填。可选值为commit-msg|cm, commit-files|cf, prettier|p, eslint|e, type-check|tc, dependency-check|dc, checkstyle|cs。"
1621
- ).option("--quiet", "eslint只打印error").option("--max-warnings [VALUE]", "eslint结果warn超过多少个会异常退出,默认为100", parseInt).action((...e) => z(Da, ...e));
1656
+ "非必填。可选值为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));
1622
1658
  async function mt(e = "latest") {
1623
1659
  const t = y("安装中...").start();
1624
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);
1625
1661
  }
1626
1662
  D.command("update").alias("u").description("升级").argument("[version]", "版本号", "latest").action((...e) => z(mt, ...e));
1627
- async function La(e) {
1663
+ async function Oa(e) {
1628
1664
  let t = e;
1629
- 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 T({
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({
1630
1666
  message: "请选择环境",
1631
1667
  choices: qe
1632
1668
  });
1633
1669
  const i = Ae(), n = `dev:${t}`;
1634
1670
  i.scripts[n] ? et(`npm run ${n}`) : l(`项目中(package.json > scripts)不存在命令${n},请先添加!`);
1635
1671
  }
1636
- D.command("start").alias("s").description("启动本地开发环境").argument("[env]", "业务环境。可选值 dev|d, test|t, release|r, prod|p").action((...e) => z(La, ...e));
1672
+ D.command("start").alias("s").description("启动本地开发环境").argument("[env]", "业务环境。可选值 dev|d, test|t, release|r, prod|p").action((...e) => z(Oa, ...e));
1637
1673
  const De = /Thumbs\.db|\.git|DS_Store|idea/, pt = "testcase";
1638
1674
  function dt(e) {
1639
1675
  const t = e.match(/^(.*[^[])?\[(\d+)]$/);
@@ -1661,7 +1697,7 @@ async function X(e, t = {}) {
1661
1697
  if ((await At(s)).isFile())
1662
1698
  return null;
1663
1699
  const c = await Re(s, { withFileTypes: !0 }), u = (await Promise.all(
1664
- c.filter((k) => k.isDirectory() && !i.test(k.name)).map((k) => a(p.join(s, k.name)))
1700
+ c.filter((T) => T.isDirectory() && !i.test(T.name)).map((T) => a(p.join(s, T.name)))
1665
1701
  )).filter(Boolean), { type: d, id: f, displayName: g } = dt(o), h = {
1666
1702
  name: o,
1667
1703
  id: f,
@@ -1694,7 +1730,7 @@ async function ft(e, t = {}) {
1694
1730
  return l(`读取目录失败: ${e} : ${n}`), [];
1695
1731
  }
1696
1732
  }
1697
- function W(e, t, i) {
1733
+ function V(e, t, i) {
1698
1734
  switch (e) {
1699
1735
  case "module":
1700
1736
  return i ? `${t}[${i}]` : t;
@@ -1706,22 +1742,22 @@ function W(e, t, i) {
1706
1742
  }
1707
1743
  async function we(e, t, i, n) {
1708
1744
  try {
1709
- const a = p.basename(e), s = W(i, t, n);
1745
+ const a = p.basename(e), s = V(i, t, n);
1710
1746
  if (a === s)
1711
1747
  return !0;
1712
1748
  const o = p.dirname(e), r = p.join(o, s);
1713
- return await Kt(e) ? await _e(e, r) : (await m(`git mv "${e}" "${r}"`), await m("git add .")), !0;
1749
+ return await Zt(e) ? await _e(e, r) : (await m(`git mv "${e}" "${r}"`), await m("git add .")), !0;
1714
1750
  } catch (a) {
1715
1751
  return l(`重命名文件夹失败: ${e} -> ${t}。${a}`), !1;
1716
1752
  }
1717
1753
  }
1718
- async function Oa(e, t, i = {}) {
1754
+ async function Pa(e, t, i = {}) {
1719
1755
  const { exclude: n = De } = i;
1720
1756
  async function a(s, o) {
1721
1757
  if (!s || s.length === 0) return;
1722
1758
  const r = await ft(o, { exclude: n });
1723
1759
  for (const c of s) {
1724
- const u = String(c.value), d = W("module", c.label, u), f = r.find((h) => h.id === u);
1760
+ const u = String(c.value), d = V("module", c.label, u), f = r.find((h) => h.id === u);
1725
1761
  let g = f?.path || p.join(o, d);
1726
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);
1727
1763
  }
@@ -1738,7 +1774,7 @@ async function gt(e) {
1738
1774
  Number.isNaN(Number(e)) && l("请输入正确的产品ID"), t.id = Number(e);
1739
1775
  else {
1740
1776
  const i = await Bi();
1741
- t.id = await T({
1777
+ t.id = await k({
1742
1778
  message: "请选择产品",
1743
1779
  choices: i.map((n) => ({
1744
1780
  name: `${n.label}[${n.value}]`,
@@ -1746,7 +1782,7 @@ async function gt(e) {
1746
1782
  }))
1747
1783
  });
1748
1784
  }
1749
- return t.name = await Ji(t.id), t.path = p.join(pt, W("module", t.name, String(t.id))), t;
1785
+ return t.name = await Ji(t.id), t.path = p.join(pt, V("module", t.name, String(t.id))), t;
1750
1786
  }
1751
1787
  async function Le(e) {
1752
1788
  return (await ft(pt)).find((i) => Number(i.id) === e.id);
@@ -1757,19 +1793,19 @@ async function ht(e, t) {
1757
1793
  priority: e.pri,
1758
1794
  steps: []
1759
1795
  };
1760
- i.steps = await _i(e.id), I.writeJSONSync(t, i, {
1796
+ i.steps = await _i(e.id), x.writeJSONSync(t, i, {
1761
1797
  spaces: 2
1762
1798
  });
1763
1799
  }
1764
1800
  async function wt(e, t) {
1765
1801
  await le(t, {
1766
1802
  recursive: !0
1767
- }), await ht(e, p.join(t, "config.json")), I.ensureFileSync(p.join(t, "data.yaml")), await L(
1803
+ }), await ht(e, p.join(t, "config.json")), x.ensureFileSync(p.join(t, "data.yaml")), await L(
1768
1804
  p.join(t, "data.yaml"),
1769
- v(p.resolve(K, "data.yaml")) ? await Ee(p.resolve(K, "data.yaml")) : await bi()
1770
- ), I.ensureFileSync(p.join(t, "main.py")), await L(
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(
1771
1807
  p.join(t, "main.py"),
1772
- v(p.resolve(K, "main.py")) ? await Ee(p.resolve(K, "main.py")) : await Ai()
1808
+ v(p.resolve(Z, "main.py")) ? await Ee(p.resolve(Z, "main.py")) : await Ai()
1773
1809
  );
1774
1810
  }
1775
1811
  function Oe(e) {
@@ -1785,7 +1821,7 @@ function Oe(e) {
1785
1821
  async function je(e, t) {
1786
1822
  ne(), Q(), await me();
1787
1823
  let i;
1788
- t ? ([R.MODULE, R.CASE].includes(t) || l(`不支持的参数${t}。参数值应为 ${R.MODULE} 或者 ${R.CASE}。`), i = t) : i = await T({
1824
+ t ? ([R.MODULE, R.CASE].includes(t) || l(`不支持的参数${t}。参数值应为 ${R.MODULE} 或者 ${R.CASE}。`), i = t) : i = await k({
1789
1825
  message: `请选择要${e}的数据类型`,
1790
1826
  choices: Bt
1791
1827
  });
@@ -1802,7 +1838,7 @@ async function Se(e) {
1802
1838
  localProduct: i
1803
1839
  };
1804
1840
  }
1805
- async function Pa(e, t, i) {
1841
+ async function Ma(e, t, i) {
1806
1842
  e.text = "查找本地产品目录...", await Le(t) || l(`本地未找到产品【${t.name}[${t.id}]】`), e.text = "解析ID参数...";
1807
1843
  const a = Oe(i);
1808
1844
  let s = await X(t.path);
@@ -1815,26 +1851,26 @@ async function Pa(e, t, i) {
1815
1851
  return l(`用例${r.title}[${r.id}]未找到所属模块(${r.module}),请先拉取模块`);
1816
1852
  const u = s.find(({ id: d }) => r.id === Number(d));
1817
1853
  if (u)
1818
- u.displayName !== r.title && await we(u.path, r.title, u.type, u.id) && V(`重命名成功: ${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(
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(
1819
1855
  r,
1820
- p.join(c, W("case", r.title, String(r.id)), "config.json")
1856
+ p.join(c, V("case", r.title, String(r.id)), "config.json")
1821
1857
  );
1822
1858
  else {
1823
- const d = p.join(c, W("case", r.title, String(r.id)));
1859
+ const d = p.join(c, V("case", r.title, String(r.id)));
1824
1860
  await wt(r, d);
1825
1861
  }
1826
1862
  }
1827
1863
  }
1828
- async function Ma(e, t) {
1864
+ async function za(e, t) {
1829
1865
  e.text = "本地产品目录查找中...";
1830
1866
  const i = await Le(t);
1831
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 = "获取远程模块列表...";
1832
1868
  const n = await st(t.id);
1833
- e.text = "本地同步模块中...", await Oa(n || [], t.path);
1869
+ e.text = "本地同步模块中...", await Pa(n || [], t.path);
1834
1870
  }
1835
- async function za(e, t) {
1871
+ async function Ba(e, t) {
1836
1872
  const { type: i, typeStr: n } = await je("拉取", e), a = await gt(t.productId), s = y(`${n}同步中...`).start();
1837
- if (R.MODULE === i && await Ma(s, a), R.CASE === i && await Pa(s, a, t.caseIds), s.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await m("git status -s")) {
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")) {
1838
1874
  const o = y("代码提交中...").start();
1839
1875
  try {
1840
1876
  await m(`git add . && git commit -m "chore: 同步禅道${n}数据"`), o.succeed("代码已提交 ✅");
@@ -1843,8 +1879,8 @@ async function za(e, t) {
1843
1879
  }
1844
1880
  }
1845
1881
  }
1846
- D.command("qa-pull").alias("qp").description("将禅道中的模块或者用例同步到本地").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "type=case时,可传指定用例ID(可传N个,逗号隔开);不传则为产品下全部用例").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(za, ...e));
1847
- async function Ba(e, t, i) {
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) {
1848
1884
  let n = await F({
1849
1885
  message: "请输入你要创建的用例的前置条件(可不填)"
1850
1886
  });
@@ -1860,14 +1896,14 @@ async function Ba(e, t, i) {
1860
1896
  openedBy: E("ldapAccount"),
1861
1897
  precondition: n || ""
1862
1898
  });
1863
- a.text = "远程用例步骤创建中...", await Vi({
1899
+ a.text = "远程用例步骤创建中...", await Wi({
1864
1900
  case: s,
1865
1901
  type: "step",
1866
1902
  desc: "按照预期执行",
1867
1903
  expect: "正常执行,符合预期"
1868
1904
  }), a.text = "本地用例创建中...";
1869
- const o = p.join(t.path, W("case", i, String(s)));
1870
- return v(o) ? V(`${o}已存在,请检查是否对应,本地不再创建。`) : (await wt(
1905
+ const o = p.join(t.path, V("case", i, String(s)));
1906
+ return v(o) ? W(`${o}已存在,请检查是否对应,本地不再创建。`) : (await wt(
1871
1907
  {
1872
1908
  id: s,
1873
1909
  pri: 3,
@@ -1876,7 +1912,7 @@ async function Ba(e, t, i) {
1876
1912
  o
1877
1913
  ), a.succeed(`用例【[${o}】创建完成 🎉`), o);
1878
1914
  }
1879
- async function Ja(e, t, i) {
1915
+ async function Fa(e, t, i) {
1880
1916
  const n = y(`模块【${i}】开始创建...`).start();
1881
1917
  n.text = "远程模块创建中...";
1882
1918
  const a = await Ui({
@@ -1886,14 +1922,14 @@ async function Ja(e, t, i) {
1886
1922
  parent: p.resolve(e?.path) === t?.path ? 0 : Number(t?.id || 0)
1887
1923
  });
1888
1924
  n.text = "本地模块创建中...";
1889
- const s = p.join(t.path, W("module", i, String(a)));
1925
+ const s = p.join(t.path, V("module", i, String(a)));
1890
1926
  if (v(s))
1891
- return V(`${s}已存在,请检查是否对应,本地不再创建。`);
1927
+ return W(`${s}已存在,请检查是否对应,本地不再创建。`);
1892
1928
  await le(s, {
1893
1929
  recursive: !0
1894
1930
  }), n.succeed(`模块【${s}】创建完成 🎉`);
1895
1931
  }
1896
- function Fa(e) {
1932
+ function _a(e) {
1897
1933
  function t(n) {
1898
1934
  if (!n.children || n.children.length === 0) return;
1899
1935
  const a = n.children[0];
@@ -1906,7 +1942,7 @@ function Fa(e) {
1906
1942
  });
1907
1943
  }
1908
1944
  async function i(n, a = []) {
1909
- const s = a.length ? `请选择层级(当前:${a.join(" / ")})` : "请选择层级", o = await T({
1945
+ const s = a.length ? `请选择层级(当前:${a.join(" / ")})` : "请选择层级", o = await k({
1910
1946
  message: s,
1911
1947
  choices: n.map((r) => ({
1912
1948
  name: `${r.tempTitle ? r.tempTitle : r.label} ${r.children?.length ? "(有子级)" : ""}`,
@@ -1917,8 +1953,8 @@ function Fa(e) {
1917
1953
  }
1918
1954
  return i(e);
1919
1955
  }
1920
- async function _a(e, t) {
1921
- const { type: i, typeStr: n } = await je("创建", e), { product: a, localProduct: s } = await Se(t.productId), o = await st(a.id), r = await Fa(o), c = W("module", r.label, String(r.value)), d = (await X(a.path, { hasRoot: !0 })).find((h) => h.name === c);
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);
1922
1958
  if (!d?.path || !v(d.path))
1923
1959
  return l(`本地不存在${c}模块`);
1924
1960
  let f = await F({
@@ -1928,17 +1964,17 @@ async function _a(e, t) {
1928
1964
  });
1929
1965
  f = f.trim();
1930
1966
  let g = "";
1931
- if (R.MODULE === i && await Ja(s, d, f), R.CASE === i && (g = await Ba(s, d, f)), !t.disableAutoCommit && R.CASE === i) {
1967
+ if (R.MODULE === i && await Fa(s, d, f), R.CASE === i && (g = await Ja(s, d, f)), !t.disableAutoCommit && R.CASE === i) {
1932
1968
  const h = y("代码提交中...").start();
1933
1969
  try {
1934
1970
  await m(`git add . && git commit -m "chore: 创建了用例${p.basename(g)}"`), h.succeed("代码已提交 ✅");
1935
- } catch (k) {
1936
- h.fail(`提交失败,${k}`), process.exit(1);
1971
+ } catch (T) {
1972
+ h.fail(`提交失败,${T}`), process.exit(1);
1937
1973
  }
1938
1974
  }
1939
1975
  }
1940
- D.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(_a, ...e));
1941
- async function Ua(e, t) {
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) {
1942
1978
  const n = (await X(e.path)).filter((r) => r.type === "case");
1943
1979
  let a = [];
1944
1980
  if (t.length)
@@ -1973,7 +2009,7 @@ async function Ua(e, t) {
1973
2009
  v(r.path) && O.rm("-rf", r.path);
1974
2010
  return s.succeed("用例删除完成"), o;
1975
2011
  }
1976
- async function Ga(e, t) {
2012
+ async function Wa(e, t) {
1977
2013
  const n = (await X(e.path)).filter((r) => r.type === "module");
1978
2014
  let a = [];
1979
2015
  if (t.length)
@@ -2001,7 +2037,7 @@ async function Ga(e, t) {
2001
2037
  }
2002
2038
  a = a.sort((r, c) => r.path.localeCompare(c.path));
2003
2039
  const s = y("远程模块删除中...").start(), o = a.map((r) => r.id);
2004
- await Wi({
2040
+ await Vi({
2005
2041
  product: Number(e.id),
2006
2042
  moduleIds: o
2007
2043
  }), s.text = "本地模块删除中...";
@@ -2012,7 +2048,7 @@ async function Ga(e, t) {
2012
2048
  async function Va(e, t) {
2013
2049
  const { type: i, typeStr: n } = await je("删除", e), { localProduct: a } = await Se(t.productId), s = Oe(t.targetIds);
2014
2050
  let o = [];
2015
- if (R.MODULE === i ? o = await Ga(a, s) : R.CASE === i && (o = await Ua(a, s)), !t.disableAutoCommit && await m("git status -s")) {
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")) {
2016
2052
  const r = y("代码提交中...").start();
2017
2053
  try {
2018
2054
  await m(`git add . && git commit -m 'chore: 删除了一些${n}(${o.join(", ")})'`), r.succeed("代码已提交 ✅");
@@ -2022,7 +2058,7 @@ async function Va(e, t) {
2022
2058
  }
2023
2059
  }
2024
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));
2025
- async function Wa(e, t) {
2061
+ async function qa(e, t) {
2026
2062
  const n = (await X(e.path)).filter((g) => g.type === "case");
2027
2063
  let a;
2028
2064
  if (t.targetId) {
@@ -2042,7 +2078,7 @@ async function Wa(e, t) {
2042
2078
  pageSize: 100,
2043
2079
  loop: !1,
2044
2080
  multiple: void 0,
2045
- options: (h) => h ? g.filter((k) => k.name.includes(h)) : g,
2081
+ options: (h) => h ? g.filter((T) => T.name.includes(h)) : g,
2046
2082
  validate(h) {
2047
2083
  return h.length > 1 ? "只能选一个" : h.length < 1 ? "请选一个" : !0;
2048
2084
  }
@@ -2057,11 +2093,11 @@ async function Wa(e, t) {
2057
2093
  });
2058
2094
  s = s.trim();
2059
2095
  const o = y("用例重命名中...").start();
2060
- s !== a.displayName ? (await Zi({
2096
+ s !== a.displayName ? (await Hi({
2061
2097
  id: Number(a.id),
2062
2098
  name: s
2063
- }), 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), W("case", s, String(a.id)))) : o.succeed("用例名称无变动");
2064
- let r = I.readJsonSync(p.join(a.path, "config.json")), c;
2099
+ }), 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;
2065
2101
  t.casePriority ? Number.isInteger(t.casePriority) && Number(t.casePriority) > 0 && Number(t.casePriority) < 6 ? c = Number(t.casePriority) : c = await ze({
2066
2102
  message: "修改用例优先级",
2067
2103
  min: 1,
@@ -2078,17 +2114,17 @@ async function Wa(e, t) {
2078
2114
  validate: (g) => g > 0 && g < 6
2079
2115
  });
2080
2116
  const u = y("用例优先级设置中...").start();
2081
- c !== r.priority ? (await Ki({
2117
+ c !== r.priority ? (await Zi({
2082
2118
  id: Number(a.id),
2083
2119
  priority: c
2084
- }), I.writeJSONSync(
2120
+ }), x.writeJSONSync(
2085
2121
  p.join(a.path, "config.json"),
2086
2122
  {
2087
2123
  ...r,
2088
2124
  priority: c
2089
2125
  },
2090
2126
  { spaces: 2 }
2091
- ), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = I.readJsonSync(p.join(a.path, "config.json"));
2127
+ ), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = x.readJsonSync(p.join(a.path, "config.json"));
2092
2128
  let d;
2093
2129
  t.casePrecondition ? d = t.casePrecondition : (d = await F({
2094
2130
  message: "修改用例前置条件",
@@ -2099,7 +2135,7 @@ async function Wa(e, t) {
2099
2135
  return d !== r.precondition ? (await Yi({
2100
2136
  id: Number(a.id),
2101
2137
  precondition: d
2102
- }), I.writeJSONSync(
2138
+ }), x.writeJSONSync(
2103
2139
  p.join(a.path, "config.json"),
2104
2140
  {
2105
2141
  ...r,
@@ -2108,7 +2144,7 @@ async function Wa(e, t) {
2108
2144
  { spaces: 2 }
2109
2145
  ), f.succeed(`用例前置条件修改成功:${r.precondition} -> ${d}`)) : f.succeed("用例前置条件无变动"), a.id;
2110
2146
  }
2111
- async function qa(e, t) {
2147
+ async function Ka(e, t) {
2112
2148
  const n = (await X(e.path)).filter((r) => r.type === "module");
2113
2149
  let a;
2114
2150
  if (t.targetId) {
@@ -2143,7 +2179,7 @@ async function qa(e, t) {
2143
2179
  });
2144
2180
  s = s.trim();
2145
2181
  const o = y("模块重命名中...").start();
2146
- return s !== a.displayName ? (await Hi({
2182
+ return s !== a.displayName ? (await Ki({
2147
2183
  id: Number(a.id),
2148
2184
  name: s
2149
2185
  }), await we(a.path, s, "module", String(a.id)) && o.succeed(`模块重命名成功: ${a.displayName} -> ${s}`)) : o.succeed("模块名称无变动"), a.id;
@@ -2151,7 +2187,7 @@ async function qa(e, t) {
2151
2187
  async function Ha(e, t) {
2152
2188
  const { type: i, typeStr: n } = await je("修改", e), { localProduct: a } = await Se(t.productId);
2153
2189
  let s;
2154
- if (R.MODULE === i ? s = await qa(a, t) : R.CASE === i && (s = await Wa(a, t)), !t.disableAutoCommit && await m("git status -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")) {
2155
2191
  const o = y("代码提交中...").start();
2156
2192
  try {
2157
2193
  await m(`git add . && git commit -m 'chore: 修改了一个${n}(${s})'`), o.succeed("代码已提交 ✅");
@@ -2164,7 +2200,7 @@ D.command("qa-update").alias("qu").description("修改模块或者用例").argum
2164
2200
  async function Za(e, t) {
2165
2201
  if (!e.length)
2166
2202
  return [];
2167
- const i = It(20), n = e.map(
2203
+ const i = xt(20), n = e.map(
2168
2204
  (a) => i(async () => {
2169
2205
  try {
2170
2206
  const s = t.env || "production", o = await m(`python ${a.path}/main.py --env ${s}`);
@@ -2181,7 +2217,7 @@ async function Za(e, t) {
2181
2217
  );
2182
2218
  return await Promise.all(n), e;
2183
2219
  }
2184
- async function Ka(e) {
2220
+ async function Ya(e) {
2185
2221
  ne(), Q();
2186
2222
  const { localProduct: t } = await Se(e.productId);
2187
2223
  let i = [];
@@ -2225,20 +2261,20 @@ async function Ka(e) {
2225
2261
  s.succeed("所有用例执行通过 🎉");
2226
2262
  else {
2227
2263
  if (e.processStep === "1")
2228
- return V("执行报告如下:"), console.log(JSON.stringify(r, null, 2)), process.exit(0);
2264
+ return W("执行报告如下:"), console.log(JSON.stringify(r, null, 2)), process.exit(0);
2229
2265
  const c = r.reduce((f, g) => f + g.result.length, 0);
2230
2266
  s.warn(`【${r.length}】个用例执行出错,【${c}】个BUG将创建。`);
2231
2267
  let u = 0;
2232
2268
  if (e.executionId)
2233
2269
  Number.isNaN(Number(e.executionId)) && l(`executionId ${e.executionId}不是正整数`), u = Number(e.executionId);
2234
2270
  else {
2235
- const f = await Qi(), g = await T({
2271
+ const f = await Qi(), g = await k({
2236
2272
  message: "请选择用例执行出错后,BUG所属的项目",
2237
- choices: f.map(({ id: k, name: ee }) => ({ name: ee, value: k }))
2273
+ choices: f.map(({ id: T, name: ee }) => ({ name: ee, value: T }))
2238
2274
  }), h = await ea(g);
2239
- u = await T({
2275
+ u = await k({
2240
2276
  message: "请选择用例执行出错后,BUG所属的执行",
2241
- choices: h.map(({ id: k, name: ee }) => ({ name: ee, value: k }))
2277
+ choices: h.map(({ id: T, name: ee }) => ({ name: ee, value: T }))
2242
2278
  });
2243
2279
  }
2244
2280
  let d;
@@ -2250,9 +2286,9 @@ async function Ka(e) {
2250
2286
  const g = await Ce({
2251
2287
  message: "请选择BUG关联的构建版本(可多选;非必选,默认主干)",
2252
2288
  required: !1,
2253
- choices: f.map(({ id: h, name: k, date: ee, builder: P }) => ({
2289
+ choices: f.map(({ id: h, name: T, date: ee, builder: P }) => ({
2254
2290
  value: h,
2255
- name: `${k} ${P} ${ee}`
2291
+ name: `${T} ${P} ${ee}`
2256
2292
  }))
2257
2293
  });
2258
2294
  g.length ? d = g.join(",") : d = "";
@@ -2274,17 +2310,17 @@ async function Ka(e) {
2274
2310
  );
2275
2311
  }
2276
2312
  }
2277
- 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(Ka, ...e));
2278
- function Ya() {
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() {
2279
2315
  process.on("unhandledRejection", (e) => {
2280
2316
  }), process.on("uncaughtException", (e) => {
2281
2317
  }), O.config.fatal = !0, O.config.silent = !0, O.config.verbose = !1;
2282
2318
  }
2283
- async function Xa() {
2319
+ async function Qa() {
2284
2320
  const e = ge("latestCheckVersionTimestamp"), t = ge("versionCheckDuring");
2285
2321
  if (Date.now() - Number(e) > Number(t) * 24 * 3600 * 1e3) {
2286
2322
  const i = await at();
2287
- Ie(i);
2323
+ xe(i);
2288
2324
  let n;
2289
2325
  try {
2290
2326
  const a = "TIME_OUT", s = new Promise((o) => {
@@ -2299,17 +2335,17 @@ async function Xa() {
2299
2335
  }
2300
2336
  }
2301
2337
  }
2302
- async function Qa() {
2303
- const e = xt(process.argv.slice(2));
2338
+ async function en() {
2339
+ const e = It(process.argv.slice(2));
2304
2340
  if (!(e.h || e.help || e.v || e.version) && !(["init", "i"].includes(e._[0]) && ![".", "prepare"].includes(e._[1])))
2305
2341
  if (Ye()) {
2306
- const t = I.readJSONSync(be());
2307
- M(t.profile), ue(t.main), Ie(t.constants), await Xa();
2342
+ const t = x.readJSONSync(be());
2343
+ M(t.profile), ue(t.main), xe(t.constants), await Qa();
2308
2344
  } else
2309
- l(`请先初始化z-develop(执行 z i)。更多见${He}`);
2345
+ l(`请先初始化z-develop(执行 z i)。更多见${Ke}`);
2310
2346
  }
2311
- async function en() {
2312
- Ya(), await Qa();
2347
+ async function tn() {
2348
+ Xa(), await en();
2313
2349
  }
2314
- D.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${S.blue(He)}`).usage("<command> [options]").hook("preAction", en).version(ie.version, "-v, --version", "当前版本号").helpOption("-h, --help", "帮助").showHelpAfterError("可以使用z -h查看帮助。");
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查看帮助。");
2315
2351
  D.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-z-develop",
3
- "version": "0.12.3",
3
+ "version": "0.13.0",
4
4
  "description": "技术团队开发流程管理工具",
5
5
  "main": "dist/index.js",
6
6
  "bin": {