cli-z-develop 0.16.1 → 0.16.3

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 +627 -610
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,31 +1,31 @@
1
1
  import { program as P } from "commander";
2
- import Zt from "node:child_process";
3
- import { existsSync as T, readdirSync as Kt, lstatSync as Yt, createWriteStream as Xt, writeFileSync as ve, readFileSync as mt, mkdirSync as Qt, mkdtempSync as ea, rmSync as ta } from "node:fs";
4
- import { readdir as Ge, mkdir as fe, writeFile as _, rename as dt, readFile as ze, stat as aa } from "node:fs/promises";
5
- import f, { resolve as pe, isAbsolute as sa, normalize as na, sep as ia } from "node:path";
6
- import me, { AxiosError as ft } from "axios";
2
+ import Yt from "node:child_process";
3
+ import { existsSync as j, readdirSync as Xt, lstatSync as Qt, createWriteStream as ea, writeFileSync as ve, readFileSync as dt, mkdirSync as ta, mkdtempSync as aa, rmSync as sa } from "node:fs";
4
+ import { readdir as Ue, mkdir as fe, writeFile as _, rename as ft, readFile as _e, stat as na } from "node:fs/promises";
5
+ import f, { resolve as pe, isAbsolute as ia, normalize as ra, sep as oa } from "node:path";
6
+ import me, { AxiosError as gt } from "axios";
7
7
  import A from "chalk";
8
- import ra from "dayjs";
8
+ import ca from "dayjs";
9
9
  import N from "shelljs";
10
- import oa, { tmpdir as ca } from "node:os";
11
- import et from "child_process";
12
- import { confirm as Le, select as k, input as F, password as la, checkbox as Re, number as tt } from "@inquirer/prompts";
10
+ import la, { tmpdir as ua } from "node:os";
11
+ import tt from "child_process";
12
+ import { confirm as Le, select as E, input as F, password as pa, checkbox as Re, number as at } from "@inquirer/prompts";
13
13
  import y from "ora";
14
14
  import L from "fs-extra";
15
- import ua from "open";
16
- import { select as W } from "inquirer-select-pro";
17
- import pa from "lint-staged";
18
- import ma from "semver";
19
- import { run as da } from "npm-check-updates";
20
- import fa from "p-limit";
21
- import { validateSwagger as ga, getParsedSwagger as ha, generatePythonBundleApi as wa, generatePythonApi as ya, generateTypescriptBundleApi as $a, generateTypescriptApi as va } from "@lonely9/api-generate";
22
- import { highlight as gt } from "cli-highlight";
23
- import { ESLint as ht } from "eslint";
24
- import Aa from "prettier";
25
- import ba from "minimist";
26
- const wt = "dev", yt = "test", $t = "release", Sa = "production", Na = "master";
27
- var O = /* @__PURE__ */ ((e) => (e[e.DEV = wt] = "DEV", e[e.TEST = yt] = "TEST", e[e.RELEASE = $t] = "RELEASE", e[e.PROD = Sa] = "PROD", e))(O || {}), w = /* @__PURE__ */ ((e) => (e[e.DEV = wt] = "DEV", e[e.TEST = yt] = "TEST", e[e.RELEASE = $t] = "RELEASE", e[e.MASTER = Na] = "MASTER", e))(w || {}), Y = /* @__PURE__ */ ((e) => (e.H5 = "h5", e.NPM = "npm", e.SERVER = "server", e))(Y || {});
28
- const vt = [
15
+ import ma from "open";
16
+ import { select as V } from "inquirer-select-pro";
17
+ import da from "lint-staged";
18
+ import fa from "semver";
19
+ import { run as ga } from "npm-check-updates";
20
+ import ha from "p-limit";
21
+ import { validateSwagger as wa, getParsedSwagger as ya, generatePythonBundleApi as $a, generatePythonApi as va, generateTypescriptBundleApi as Aa, generateTypescriptApi as ba } from "@lonely9/api-generate";
22
+ import { highlight as ht } from "cli-highlight";
23
+ import { ESLint as wt } from "eslint";
24
+ import Sa from "prettier";
25
+ import Na from "minimist";
26
+ const yt = "dev", $t = "test", vt = "release", ja = "production", Ta = "master";
27
+ var O = /* @__PURE__ */ ((e) => (e[e.DEV = yt] = "DEV", e[e.TEST = $t] = "TEST", e[e.RELEASE = vt] = "RELEASE", e[e.PROD = ja] = "PROD", e))(O || {}), w = /* @__PURE__ */ ((e) => (e[e.DEV = yt] = "DEV", e[e.TEST = $t] = "TEST", e[e.RELEASE = vt] = "RELEASE", e[e.MASTER = Ta] = "MASTER", e))(w || {}), Y = /* @__PURE__ */ ((e) => (e.H5 = "h5", e.NPM = "npm", e.SERVER = "server", e))(Y || {});
28
+ const At = [
29
29
  {
30
30
  name: `开发环境 - ${O.DEV}`,
31
31
  value: O.DEV
@@ -42,7 +42,7 @@ const vt = [
42
42
  name: `正式环境 - ${O.PROD}`,
43
43
  value: O.PROD
44
44
  }
45
- ], Ta = [
45
+ ], ka = [
46
46
  {
47
47
  name: "网页 - h5",
48
48
  value: "h5"
@@ -60,7 +60,7 @@ const vt = [
60
60
  }
61
61
  ];
62
62
  var $e = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e))($e || {}), ue = /* @__PURE__ */ ((e) => (e.FRONT_END = "fe", e.BACK_END = "be", e.QUALITY_ASSURANCE = "qa", e))(ue || {}), $ = /* @__PURE__ */ ((e) => (e.JAVA = "Java", e.JAVASCRIPT = "JavaScript", e.PYTHON = "Python", e.MARKDOWN = "Markdown", e))($ || {});
63
- const ja = {
63
+ const Ea = {
64
64
  1: "研发",
65
65
  2: "测试",
66
66
  3: "产品",
@@ -70,11 +70,11 @@ const ja = {
70
70
  7: "行政",
71
71
  8: "财务",
72
72
  9: "其他"
73
- }, Ae = "http://git.cxlqd.com", ka = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
74
- 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 || {});
75
- const Ea = "fe-biz7tvsd", At = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
73
+ }, Ae = "http://git.cxlqd.com", Ia = ["fe-biz", "fe-base", "fe-tpl", "fe-component", "fe-demo"];
74
+ var T = /* @__PURE__ */ ((e) => (e.FEAT = "feat", e.FIX = "fix", e.REFACTOR = "refactor", e.CHORE = "chore", e.CI = "ci", e.Break = "BREAKING CHANGE", e))(T || {});
75
+ const Ra = "fe-biz7tvsd", bt = "https://hxhtbr8t8uy.feishu.cn/wiki/LWW5wAQFPiXkmRkKcjOcyDDknLg";
76
76
  var C = /* @__PURE__ */ ((e) => (e.MODULE = "module", e.CASE = "case", e))(C || {});
77
- const Ia = [
77
+ const Ca = [
78
78
  {
79
79
  name: "模块",
80
80
  value: "module"
@@ -85,30 +85,30 @@ const Ia = [
85
85
  value: "case"
86
86
  /* CASE */
87
87
  }
88
- ], Ra = 150 * 1024, at = 0.8 * 1024 * 1024, _e = ",", Ca = ".z", La = "develop-config.json", K = ".z", xa = ".commit-msg-tpl", Pa = "project.json";
88
+ ], La = 150 * 1024, st = 0.8 * 1024 * 1024, Fe = ",", xa = ".z", Pa = "develop-config.json", K = ".z", Da = ".commit-msg-tpl", Oa = "project.json";
89
89
  function x(e = "") {
90
90
  return f.join(K, e);
91
91
  }
92
- function bt() {
93
- return x(Pa);
92
+ function St() {
93
+ return x(Oa);
94
94
  }
95
95
  function Se() {
96
- return x(xa);
96
+ return x(Da);
97
97
  }
98
- function St() {
99
- et.spawnSync("git", ["config", "core.hooksPath", x()]), et.spawnSync("git", ["config", "commit.template", Se()]);
98
+ function Nt() {
99
+ tt.spawnSync("git", ["config", "core.hooksPath", x()]), tt.spawnSync("git", ["config", "commit.template", Se()]);
100
100
  }
101
101
  function Ne(e = "") {
102
- return f.resolve(oa.homedir(), Ca, e);
102
+ return f.resolve(la.homedir(), xa, e);
103
103
  }
104
104
  function xe() {
105
- return Ne(La);
105
+ return Ne(Pa);
106
106
  }
107
- function Da() {
108
- return T(Ne());
107
+ function Ma() {
108
+ return j(Ne());
109
109
  }
110
- function Nt() {
111
- return Da() && T(xe());
110
+ function jt() {
111
+ return Ma() && j(xe());
112
112
  }
113
113
  function se(e, t = !0) {
114
114
  let a = e.trim();
@@ -122,17 +122,17 @@ function se(e, t = !0) {
122
122
  const s = a.replace(/\.git$/, "");
123
123
  return t ? encodeURIComponent(s) : s;
124
124
  }
125
- function Ue(e, t) {
125
+ function Pe(e, t) {
126
126
  return se(e) === se(t);
127
127
  }
128
- const { red: st, green: Oa, blue: vr, magenta: Ma, yellow: Ba } = A;
129
- function je(...e) {
128
+ const { red: nt, green: Ba, blue: Ar, magenta: za, yellow: _a } = A;
129
+ function Te(...e) {
130
130
  }
131
- function G(...e) {
132
- console.log(Ba(...e));
131
+ function J(...e) {
132
+ console.log(_a(...e));
133
133
  }
134
134
  function U(...e) {
135
- console.log(Oa(...e));
135
+ console.log(Ba(...e));
136
136
  }
137
137
  function Tt(e) {
138
138
  e instanceof Error && (e.name === "ExitPromptError" || e.message.includes("User force closed the prompt with")) && (console.log(), console.log(A.cyan(" 👋 下次见~")), console.log(), process.exit(1));
@@ -140,13 +140,13 @@ function Tt(e) {
140
140
  function m(e, t = !1) {
141
141
  Tt(e);
142
142
  let a = e;
143
- e instanceof Error ? (a = e.message, me.isAxiosError(e) && (a = `请求失败:${e.message}`), console.log(st(a)), console.log(Ma(e.stack))) : console.log(st(e)), t || process.exit(1);
143
+ e instanceof Error ? (a = e.message, me.isAxiosError(e) && (a = `请求失败:${e.message}`), console.log(nt(a)), console.log(za(e.stack))) : console.log(nt(e)), t || process.exit(1);
144
144
  }
145
- function nt(e) {
146
- return T(e) ? Yt(e).isDirectory() : !1;
145
+ function it(e) {
146
+ return j(e) ? Qt(e).isDirectory() : !1;
147
147
  }
148
- function jt(e = process.cwd()) {
149
- return nt(e) ? Kt(e).filter((a) => nt(f.resolve(e, a))) : [];
148
+ function kt(e = process.cwd()) {
149
+ return it(e) ? Xt(e).filter((a) => it(f.resolve(e, a))) : [];
150
150
  }
151
151
  async function p(e, t = {}) {
152
152
  const a = {
@@ -167,26 +167,26 @@ async function p(e, t = {}) {
167
167
  return n = n.toString(), a.removeTailLinkBreak && (n = n.replace(/\n$/, "")), n;
168
168
  }
169
169
  function Ve(e) {
170
- Zt.execSync(e, {
170
+ Yt.execSync(e, {
171
171
  stdio: "inherit"
172
172
  });
173
173
  }
174
- function kt() {
175
- return ra(Date.now()).format("YYMMDD");
174
+ function Et() {
175
+ return ca(Date.now()).format("YYMMDD");
176
176
  }
177
177
  function ee() {
178
- T(x()) || m("当前不在项目根目录。请切换到项目根目录");
178
+ j(x()) || m("当前不在项目根目录。请切换到项目根目录");
179
179
  }
180
180
  function H() {
181
- T(f.resolve(".git")) || m("当前不是git项目根目录,请先执行git init,或切换到根目录");
181
+ j(f.resolve(".git")) || m("当前不是git项目根目录,请先执行git init,或切换到根目录");
182
182
  }
183
183
  async function ge() {
184
184
  await p("git status -s") !== "" && m("请先提交代码变动,再进行操作");
185
185
  }
186
- function za(e) {
186
+ function Fa(e) {
187
187
  return e === w.MASTER ? O.PROD : e;
188
188
  }
189
- function _a(e) {
189
+ function Ga(e) {
190
190
  return e === O.PROD ? w.MASTER : e;
191
191
  }
192
192
  async function B(e, ...t) {
@@ -196,10 +196,10 @@ async function B(e, ...t) {
196
196
  throw Tt(a), a;
197
197
  }
198
198
  }
199
- async function Fa(e) {
200
- return (await Ge(e)).length === 0;
199
+ async function Ja(e) {
200
+ return (await Ue(e)).length === 0;
201
201
  }
202
- function Ja(e = "项目中文名", t = "项目描述") {
202
+ function Ua(e = "项目中文名", t = "项目描述") {
203
203
  return `
204
204
  # ${e}
205
205
  ${t}
@@ -256,7 +256,7 @@ ${t}
256
256
  在此处放入飞书文档链接。请在[前端团队-项目手册](https://hxhtbr8t8uy.feishu.cn/drive/folder/QfQ7favVWljQk7d63Prc8mUGnJf)中按照分类新建文档。
257
257
  `;
258
258
  }
259
- const Ga = {
259
+ const Va = {
260
260
  [$.JAVA]: {
261
261
  "**/*.{java}": "java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml"
262
262
  },
@@ -274,17 +274,17 @@ const Ga = {
274
274
  "**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix",
275
275
  "**/*.md": "markdownlint --fix"
276
276
  }
277
- }, Ua = "cli-z-develop", Va = "0.16.1", Wa = "技术团队开发流程管理工具", Ha = "dist/index.js", qa = { z: "bin/z.js", "z-develop": "bin/z.js" }, Za = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", test: "bun src/main.ts", "test:debug": "DEBUG=true bun src/main.ts", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", "build:w": "vite build --watch", 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" }, Ka = "module", Ya = "z", Xa = { "@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" }, Qa = { "@inquirer/prompts": "^8.4.1", "@lonely9/api-generate": "^0.2.13", axios: "^1.15.0", chalk: "^5.6.2", "cli-highlight": "^2.1.11", commander: "^14.0.3", dayjs: "^1.11.20", eslint: "^9.39.2", "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", open: "^11.0.2", ora: "^9.3.0", "p-limit": "^7.3.0", prettier: "^3.8.2", semver: "^7.7.4", shelljs: "^0.10.0" }, ce = {
278
- name: Ua,
279
- version: Va,
280
- description: Wa,
281
- main: Ha,
282
- bin: qa,
283
- scripts: Za,
284
- type: Ka,
285
- author: Ya,
286
- devDependencies: Xa,
287
- dependencies: Qa
277
+ }, Wa = "cli-z-develop", Ha = "0.16.3", qa = "技术团队开发流程管理工具", Za = "dist/index.js", Ka = { z: "bin/z.js", "z-develop": "bin/z.js" }, Ya = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", test: "bun src/main.ts", "test:debug": "DEBUG=true bun src/main.ts", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", "build:w": "vite build --watch", 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" }, Xa = "module", Qa = "z", es = { "@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" }, ts = { "@inquirer/prompts": "^8.4.1", "@lonely9/api-generate": "^0.2.13", axios: "^1.15.0", chalk: "^5.6.2", "cli-highlight": "^2.1.11", commander: "^14.0.3", dayjs: "^1.11.20", eslint: "^9.39.2", "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", open: "^11.0.2", ora: "^9.3.0", "p-limit": "^7.3.0", prettier: "^3.8.2", semver: "^7.7.4", shelljs: "^0.10.0" }, ce = {
278
+ name: Wa,
279
+ version: Ha,
280
+ description: qa,
281
+ main: Za,
282
+ bin: Ka,
283
+ scripts: Ya,
284
+ type: Xa,
285
+ author: Qa,
286
+ devDependencies: es,
287
+ dependencies: ts
288
288
  }, M = {
289
289
  // 个人数据
290
290
  profile: {
@@ -333,23 +333,23 @@ function We() {
333
333
  if (q)
334
334
  return q;
335
335
  const e = f.join("package.json");
336
- return T(e) || m(`当前目录(${N.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), q = L.readJsonSync(e), q;
336
+ return j(e) || m(`当前目录(${N.pwd()})不存在${e}文件,请在项目根目录执行该命令。`), q = L.readJsonSync(e), q;
337
337
  }
338
- function V() {
338
+ function W() {
339
339
  if (Z)
340
340
  return Z;
341
- const e = bt();
342
- return T(e) || m(
341
+ const e = St();
342
+ return j(e) || m(
343
343
  `当前目录(${N.pwd()})不存在${e}文件,请在项目根目录执行该命令,或者初始化项目(z init .)。`
344
344
  ), Z = L.readJsonSync(e), Z;
345
345
  }
346
- function Et(e) {
346
+ function It(e) {
347
347
  Z ? Z = {
348
348
  ...Z,
349
349
  ...e
350
- } : Z = e, L.writeJSONSync(bt(), Z, { spaces: 2 });
350
+ } : Z = e, L.writeJSONSync(St(), Z, { spaces: 2 });
351
351
  }
352
- function es(e) {
352
+ function as(e) {
353
353
  q ? q = {
354
354
  ...q,
355
355
  ...e
@@ -362,10 +362,10 @@ const ae = {
362
362
  sourceBranch: "",
363
363
  mergeRequestUrl: ""
364
364
  };
365
- async function ts() {
365
+ async function ss() {
366
366
  if (!ae.id)
367
367
  try {
368
- const e = V(), t = se(e.repository.url), a = await Ct(t);
368
+ const e = W(), t = se(e.repository.url), a = await Lt(t);
369
369
  ae.id = a.id, ae.path = t, ae.group = a.namespace.full_path, ae.mergeRequestUrl = `${a.web_url}/merge_requests`;
370
370
  } catch (e) {
371
371
  m(e);
@@ -385,13 +385,13 @@ function X() {
385
385
  }
386
386
  );
387
387
  }
388
- function E(e, t) {
388
+ function k(e, t) {
389
389
  t !== void 0 ? M.profile[e] = t : M.profile = {
390
390
  ...M.profile,
391
391
  ...e
392
392
  };
393
393
  }
394
- function Pe(e, t) {
394
+ function De(e, t) {
395
395
  M.constants = {
396
396
  ...M.constants,
397
397
  ...e
@@ -415,7 +415,7 @@ async function b(e) {
415
415
  });
416
416
  return t.code !== 0 && (m(`${t.code}: ${t.message}`, e.stopBubble), e.stopBubble) ? Promise.reject(t) : t.data;
417
417
  }
418
- async function as(e) {
418
+ async function ns(e) {
419
419
  return await ne({
420
420
  url: "https://pai.zxfqf.com/api" + e.url,
421
421
  headers: {
@@ -426,17 +426,17 @@ async function as(e) {
426
426
  method: e.method || "post"
427
427
  });
428
428
  }
429
- function ss() {
429
+ function is() {
430
430
  return b({
431
431
  url: "/user/list2"
432
432
  });
433
433
  }
434
- function ns() {
434
+ function rs() {
435
435
  return b({
436
436
  url: "/zen/testcase/product/list"
437
437
  });
438
438
  }
439
- function It(e) {
439
+ function Rt(e) {
440
440
  return b({
441
441
  url: "/zen/testcase/product/module/list",
442
442
  data: {
@@ -444,7 +444,7 @@ function It(e) {
444
444
  }
445
445
  });
446
446
  }
447
- function is(e) {
447
+ function os(e) {
448
448
  return b({
449
449
  url: "/zen/testcase/product/name",
450
450
  data: {
@@ -452,7 +452,7 @@ function is(e) {
452
452
  }
453
453
  });
454
454
  }
455
- function rs(e, t) {
455
+ function cs(e, t) {
456
456
  return b({
457
457
  url: "/zen/testcase/product/auto-case/list",
458
458
  data: {
@@ -461,7 +461,7 @@ function rs(e, t) {
461
461
  }
462
462
  });
463
463
  }
464
- function os(e) {
464
+ function ls(e) {
465
465
  return b({
466
466
  url: "/zen/testcase/step/list",
467
467
  data: {
@@ -469,72 +469,72 @@ function os(e) {
469
469
  }
470
470
  });
471
471
  }
472
- function cs(e) {
472
+ function us(e) {
473
473
  return b({
474
474
  url: "/zen/testcase/module/create",
475
475
  data: e
476
476
  });
477
477
  }
478
- function ls(e) {
478
+ function ps(e) {
479
479
  return b({
480
480
  url: "/zen/testcase/create",
481
481
  data: e
482
482
  });
483
483
  }
484
- function us(e) {
484
+ function ms(e) {
485
485
  return b({
486
486
  url: "/zen/testcase/step/create",
487
487
  data: e
488
488
  });
489
489
  }
490
- function ps(e) {
490
+ function ds(e) {
491
491
  return b({
492
492
  url: "/zen/testcase/modules/remove",
493
493
  data: e
494
494
  });
495
495
  }
496
- function ms(e) {
496
+ function fs(e) {
497
497
  return b({
498
498
  url: "/zen/testcase/cases/remove",
499
499
  data: e
500
500
  });
501
501
  }
502
- function ds(e) {
502
+ function gs(e) {
503
503
  return b({
504
504
  url: "/zen/testcase/module/update/name",
505
505
  data: e
506
506
  });
507
507
  }
508
- function fs(e) {
508
+ function hs(e) {
509
509
  return b({
510
510
  url: "/zen/testcase/case/update/name",
511
511
  data: e
512
512
  });
513
513
  }
514
- function gs(e) {
514
+ function ws(e) {
515
515
  return b({
516
516
  url: "/zen/testcase/case/update/priority",
517
517
  data: e
518
518
  });
519
519
  }
520
- function hs(e) {
520
+ function ys(e) {
521
521
  return b({
522
522
  url: "/zen/testcase/case/update/precondition",
523
523
  data: e
524
524
  });
525
525
  }
526
- function ws(e) {
526
+ function $s(e) {
527
527
  return b({
528
528
  url: "/zen/testcase/case/result/create",
529
529
  data: e
530
530
  });
531
531
  }
532
- function ys() {
532
+ function vs() {
533
533
  return b({
534
534
  url: "/zen/testcase/project/list"
535
535
  });
536
536
  }
537
- function $s(e) {
537
+ function As(e) {
538
538
  return b({
539
539
  url: "/zen/testcase/project/execution/list",
540
540
  data: {
@@ -542,7 +542,7 @@ function $s(e) {
542
542
  }
543
543
  });
544
544
  }
545
- function vs(e) {
545
+ function bs(e) {
546
546
  return b({
547
547
  url: "/zen/testcase/execution/build/list",
548
548
  data: {
@@ -550,25 +550,25 @@ function vs(e) {
550
550
  }
551
551
  });
552
552
  }
553
- function it(e) {
553
+ function rt(e) {
554
554
  return b({
555
555
  url: "/common/ai/talk",
556
556
  data: e
557
557
  });
558
558
  }
559
- function As(e) {
560
- return as({
559
+ function Ss(e) {
560
+ return ns({
561
561
  url: "/common/notify/group/send",
562
562
  data: e
563
563
  });
564
564
  }
565
- function bs(e) {
565
+ function Ns(e) {
566
566
  return b({
567
567
  url: "/deploy/create/chain",
568
568
  data: e
569
569
  });
570
570
  }
571
- function Ss(e) {
571
+ function js(e) {
572
572
  return b({
573
573
  url: "/zen/product/execution/list",
574
574
  data: {
@@ -576,18 +576,18 @@ function Ss(e) {
576
576
  }
577
577
  });
578
578
  }
579
- function Ns(e) {
579
+ function Ts(e) {
580
580
  return b({
581
581
  url: "/zen/execution/build/createOrUpdate",
582
582
  data: e
583
583
  });
584
584
  }
585
- function Ts() {
585
+ function ks() {
586
586
  return b({
587
587
  url: "/auth/gitlab/oauth/authorize"
588
588
  });
589
589
  }
590
- function js(e) {
590
+ function Es(e) {
591
591
  return b({
592
592
  url: "/auth/gitlab/oauth/token",
593
593
  data: {
@@ -596,7 +596,7 @@ function js(e) {
596
596
  stopBubble: !0
597
597
  });
598
598
  }
599
- function ks(e) {
599
+ function Is(e) {
600
600
  return b({
601
601
  url: "/auth/gitlab/oauth/token/refresh",
602
602
  data: {
@@ -605,7 +605,7 @@ function ks(e) {
605
605
  stopBubble: !0
606
606
  });
607
607
  }
608
- class Es {
608
+ class Rs {
609
609
  /**
610
610
  * 生成带 Bearer 前缀的 Token
611
611
  */
@@ -618,7 +618,7 @@ class Es {
618
618
  */
619
619
  saveToken(t) {
620
620
  const a = Date.now() + t.expires_in * 1e3;
621
- E("gitToken", this.generateBearerToken(t.access_token, t.token_type)), E("gitLabRefreshToken", t.refresh_token), E("gitTokenExpiry", a), X();
621
+ k("gitToken", this.generateBearerToken(t.access_token, t.token_type)), k("gitLabRefreshToken", t.refresh_token), k("gitTokenExpiry", a), X();
622
622
  }
623
623
  /**
624
624
  * 使用 refresh_token 刷新 Access Token
@@ -626,22 +626,22 @@ class Es {
626
626
  * @private
627
627
  */
628
628
  async refreshAccessToken(t) {
629
- const a = await ks(t);
629
+ const a = await Is(t);
630
630
  return this.saveToken(a), this.generateBearerToken(a.access_token, a.token_type);
631
631
  }
632
632
  /**
633
633
  * 执行完整的 OAuth 授权流程
634
634
  */
635
635
  async auth() {
636
- const t = await Ts(), a = `${Ae}/oauth/authorize?${new URLSearchParams({
636
+ const t = await ks(), a = `${Ae}/oauth/authorize?${new URLSearchParams({
637
637
  ...t
638
638
  })}`;
639
639
  return console.log(A.cyan("正在打开浏览器进行 GitLab 授权,如果浏览器未自动打开,请访问: ")), console.log(A.blue(a)), new Promise((n) => {
640
- js(t.state).then((s) => {
640
+ Es(t.state).then((s) => {
641
641
  s ? (console.log(A.green("✅ GitLab 授权成功!")), this.saveToken(s), n(this.generateBearerToken(s.access_token, s.token_type))) : m("❌ GitLab 授权失败!");
642
642
  }).catch((s) => {
643
643
  m(`❌ GitLab 授权失败:${s.message}`);
644
- }), ua(a);
644
+ }), ma(a);
645
645
  });
646
646
  }
647
647
  /**
@@ -660,12 +660,12 @@ class Es {
660
660
  try {
661
661
  return await this.refreshAccessToken(n);
662
662
  } catch {
663
- console.log(A.yellow("⚠️ Token 刷新失败,需要重新授权")), E("gitToken", ""), E("gitLabRefreshToken", ""), E("gitTokenExpiry", ""), X();
663
+ console.log(A.yellow("⚠️ Token 刷新失败,需要重新授权")), k("gitToken", ""), k("gitLabRefreshToken", ""), k("gitTokenExpiry", ""), X();
664
664
  }
665
665
  return await this.auth();
666
666
  }
667
667
  }
668
- const rt = new Es();
668
+ const ot = new Rs();
669
669
  async function ne(e) {
670
670
  const t = e.method || "get", a = e.headers || {}, n = e.data || {}, s = e.dataKey ?? (["GET", "get"].includes(t) ? "params" : "data");
671
671
  try {
@@ -676,11 +676,11 @@ async function ne(e) {
676
676
  headers: a,
677
677
  responseType: e?.responseType || "json"
678
678
  };
679
- je(A.magenta(i.method.toUpperCase()), A.yellow(i.url), JSON.stringify(i.headers)), je(A.gray(JSON.stringify(i[s], null, 2)));
679
+ Te(A.magenta(i.method.toUpperCase()), A.yellow(i.url), JSON.stringify(i.headers)), Te(A.gray(JSON.stringify(i[s], null, 2)));
680
680
  const o = await me(i);
681
- return je(A.green("Response"), A.grey(JSON.stringify(o.data, null, 2))), Promise.resolve(o.data);
681
+ return Te(A.green("Response"), A.grey(JSON.stringify(o.data, null, 2))), Promise.resolve(o.data);
682
682
  } catch (i) {
683
- return i instanceof ft && je(A.red("Error"), A.grey(JSON.stringify(i?.response?.data))), Promise.reject(i);
683
+ return i instanceof gt && Te(A.red("Error"), A.grey(JSON.stringify(i?.response?.data))), Promise.reject(i);
684
684
  }
685
685
  }
686
686
  async function S(e) {
@@ -688,21 +688,21 @@ async function S(e) {
688
688
  return await ne({
689
689
  ...e,
690
690
  headers: {
691
- Authorization: await rt.getToken()
691
+ Authorization: await ot.getToken()
692
692
  }
693
693
  });
694
694
  } catch (t) {
695
- if (t instanceof ft && t.response?.status === 401)
696
- return console.log(A.yellow("⚠️ GitLab Token 已失效,正在重新授权...")), E("gitToken", ""), E("gitLabRefreshToken", ""), E("gitTokenExpiry", ""), X(), ne({
695
+ if (t instanceof gt && t.response?.status === 401)
696
+ return console.log(A.yellow("⚠️ GitLab Token 已失效,正在重新授权...")), k("gitToken", ""), k("gitLabRefreshToken", ""), k("gitTokenExpiry", ""), X(), ne({
697
697
  ...e,
698
698
  headers: {
699
- Authorization: await rt.getToken()
699
+ Authorization: await ot.getToken()
700
700
  }
701
701
  });
702
702
  throw t;
703
703
  }
704
704
  }
705
- async function Is() {
705
+ async function Cs() {
706
706
  const e = I("zenTaoToken");
707
707
  if (e)
708
708
  return e;
@@ -715,14 +715,14 @@ async function Is() {
715
715
  password: I("ldapPassword")
716
716
  }
717
717
  });
718
- return E("zenTaoToken", t), X(), t;
718
+ return k("zenTaoToken", t), X(), t;
719
719
  }
720
720
  }
721
721
  async function Ce(e) {
722
722
  const t = await ne({
723
723
  ...e,
724
724
  headers: {
725
- Token: await Is()
725
+ Token: await Cs()
726
726
  }
727
727
  });
728
728
  if (e.url.includes("local")) {
@@ -731,21 +731,21 @@ async function Ce(e) {
731
731
  return JSON.parse(a.data);
732
732
  }
733
733
  if (typeof t == "object")
734
- return t.error === "Unauthorized" || t.data.indexOf("<script>") < 0 ? (E("zenTaoToken", ""), Ce({
734
+ return t.error === "Unauthorized" || t.data.indexOf("<script>") < 0 ? (k("zenTaoToken", ""), Ce({
735
735
  ...e
736
736
  })) : t;
737
737
  } else {
738
738
  const { status: a, data: n } = t;
739
739
  if (a === "success") {
740
740
  const s = JSON.parse(n);
741
- return s.title === "用户登录" ? (E("zenTaoToken", ""), Ce({
741
+ return s.title === "用户登录" ? (k("zenTaoToken", ""), Ce({
742
742
  ...e
743
743
  })) : s;
744
744
  } else
745
745
  return {};
746
746
  }
747
747
  }
748
- async function Rs() {
748
+ async function Ls() {
749
749
  const e = I("k8sToken");
750
750
  if (e)
751
751
  return e;
@@ -761,12 +761,12 @@ async function Rs() {
761
761
  password: I("ldapPassword")
762
762
  }
763
763
  }), a = `Bearer ${t}`;
764
- return E("k8sToken", a), X(), a;
764
+ return k("k8sToken", a), X(), a;
765
765
  }
766
766
  }
767
- async function Cs(e, t) {
767
+ async function xs(e, t) {
768
768
  try {
769
- const a = Xt(t, { mode: 493 });
769
+ const a = ea(t, { mode: 493 });
770
770
  return (await me({
771
771
  method: "get",
772
772
  url: e,
@@ -781,18 +781,18 @@ async function Cs(e, t) {
781
781
  throw console.error("下载失败:", a), a;
782
782
  }
783
783
  }
784
- const J = () => `${Ae}/api/v4`, z = (e) => `${J()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
785
- function Ls() {
784
+ const G = () => `${Ae}/api/v4`, z = (e) => `${G()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
785
+ function Ps() {
786
786
  return S({
787
787
  url: z("src/data/template-projects.json")
788
788
  });
789
789
  }
790
- function xs() {
790
+ function Ds() {
791
791
  return S({
792
792
  url: z("src/data/java-project-module.json")
793
793
  });
794
794
  }
795
- function Ps() {
795
+ function Os() {
796
796
  return S({
797
797
  url: z("src/data/java-project-api.json")
798
798
  });
@@ -802,126 +802,126 @@ function He() {
802
802
  url: z("src/data/z-develop-config.json")
803
803
  });
804
804
  }
805
- function Ds() {
805
+ function Ms() {
806
806
  return S({
807
807
  url: z("src/assets/tsconfig.browser.json")
808
808
  });
809
809
  }
810
- function Os() {
810
+ function Bs() {
811
811
  return S({
812
812
  url: z("src/assets/tsconfig.node.json")
813
813
  });
814
814
  }
815
- function Ms() {
815
+ function zs() {
816
816
  return S({
817
817
  url: z("src/assets/.prettierignore")
818
818
  });
819
819
  }
820
- function Bs() {
820
+ function _s() {
821
821
  return S({
822
822
  url: z("src/assets/.prettierrc.json")
823
823
  });
824
824
  }
825
- function zs() {
825
+ function Fs() {
826
826
  return S({
827
827
  url: z("src/assets/data.yaml")
828
828
  });
829
829
  }
830
- function _s() {
830
+ function Gs() {
831
831
  return S({
832
832
  url: z("src/assets/main.py")
833
833
  });
834
834
  }
835
- function Fs() {
835
+ function Js() {
836
836
  return S({
837
837
  url: z("src/assets/checkstyle.xml")
838
838
  });
839
839
  }
840
- function Rt() {
840
+ function Ct() {
841
841
  return S({
842
842
  url: z("src/data/project-group-chats.json")
843
843
  });
844
844
  }
845
- function Js() {
845
+ function Us() {
846
846
  return S({
847
847
  url: z("src/data/project-zen-tao-id.json")
848
848
  });
849
849
  }
850
- function Gs() {
850
+ function Vs() {
851
851
  return S({
852
- url: `${J()}/user`
852
+ url: `${G()}/user`
853
853
  });
854
854
  }
855
- function Us() {
855
+ function Ws() {
856
856
  return S({
857
- url: `${J()}/groups`
857
+ url: `${G()}/groups`
858
858
  });
859
859
  }
860
- function Vs(e) {
860
+ function Hs(e) {
861
861
  return S({
862
- url: `${J()}/projects`,
862
+ url: `${G()}/projects`,
863
863
  method: "post",
864
864
  data: e
865
865
  });
866
866
  }
867
- function Ct(e) {
867
+ function Lt(e) {
868
868
  return S({
869
- url: `${J()}/projects/${e}`
869
+ url: `${G()}/projects/${e}`
870
870
  });
871
871
  }
872
- function Ws(e) {
872
+ function qs(e) {
873
873
  return S({
874
- url: `${J()}/projects`,
874
+ url: `${G()}/projects`,
875
875
  data: {
876
876
  search: e,
877
877
  search_namespaces: !0
878
878
  }
879
879
  });
880
880
  }
881
- function Hs(e) {
881
+ function Zs(e) {
882
882
  return S({
883
- url: `${J()}/projects/${e.id}/merge_requests`,
883
+ url: `${G()}/projects/${e.id}/merge_requests`,
884
884
  method: "post",
885
885
  data: e
886
886
  });
887
887
  }
888
- function qs(e) {
888
+ function Ks(e) {
889
889
  return S({
890
- url: `${J()}/projects/${e.id}/merge_requests/${e.iid}/merge`,
890
+ url: `${G()}/projects/${e.id}/merge_requests/${e.iid}/merge`,
891
891
  method: "put"
892
892
  });
893
893
  }
894
- function Zs(e) {
894
+ function Ys(e) {
895
895
  return S({
896
- url: `${J()}/projects/${e.id}/merge_requests/${e.iid}`,
896
+ url: `${G()}/projects/${e.id}/merge_requests/${e.iid}`,
897
897
  method: "put",
898
898
  data: e
899
899
  });
900
900
  }
901
- function Ks(e) {
901
+ function Xs(e) {
902
902
  return S({
903
- url: `${J()}/projects/${e.id}/merge_requests/${e.iid}`,
903
+ url: `${G()}/projects/${e.id}/merge_requests/${e.iid}`,
904
904
  method: "get"
905
905
  });
906
906
  }
907
- function Ys(e) {
907
+ function Qs(e) {
908
908
  return S({
909
- url: `${J()}/projects/${e.id}/repository/branches`,
909
+ url: `${G()}/projects/${e.id}/repository/branches`,
910
910
  method: "post",
911
911
  data: e
912
912
  });
913
913
  }
914
- function Xs(e) {
914
+ function en(e) {
915
915
  return S({
916
- url: `${J()}/projects/${e}/repository/branches`
916
+ url: `${G()}/projects/${e}/repository/branches`
917
917
  });
918
918
  }
919
- function Qs() {
919
+ function tn() {
920
920
  const e = Ne("fe-groups.json");
921
- return T(e) ? L.readJSONSync(e) : { groups: [] };
921
+ return j(e) ? L.readJSONSync(e) : { groups: [] };
922
922
  }
923
- async function en() {
924
- const e = await Us(), t = ka.map((a) => {
923
+ async function an() {
924
+ const e = await Ws(), t = Ia.map((a) => {
925
925
  const n = e.find((s) => s.name === a);
926
926
  return n ? {
927
927
  name: n.name,
@@ -931,7 +931,7 @@ async function en() {
931
931
  }).filter((a) => !!a);
932
932
  L.writeJSONSync(Ne("fe-groups.json"), { groups: t }, { spaces: 2 });
933
933
  }
934
- function tn(e, t) {
934
+ function sn(e, t) {
935
935
  const a = [];
936
936
  t.forEach((i) => {
937
937
  e.includes(i.value) && a.push(i);
@@ -947,9 +947,9 @@ function tn(e, t) {
947
947
  weWorkListCache: n.sort((i, o) => o.usageCount - i.usageCount)
948
948
  }), X();
949
949
  }
950
- async function Lt() {
951
- const t = (await ss()).filter((i) => [1, 2, 3, 4, 5].includes(i.title)).map((i) => ({
952
- name: `${i.nick} - ${ja[i.title]}`,
950
+ async function xt() {
951
+ const t = (await is()).filter((i) => [1, 2, 3, 4, 5].includes(i.title)).map((i) => ({
952
+ name: `${i.nick} - ${Ea[i.title]}`,
953
953
  value: i.weWorkUserId
954
954
  })), a = be("weWorkListCache"), n = a.map((i) => i.value), s = [];
955
955
  return t.forEach((i) => {
@@ -960,9 +960,9 @@ async function Lt() {
960
960
  });
961
961
  }), s.sort((i, o) => o.usageCount - i.usageCount);
962
962
  }
963
- async function xt(e, t, a) {
964
- const n = await Lt();
965
- let s = await W({
963
+ async function Pt(e, t, a) {
964
+ const n = await xt();
965
+ let s = await V({
966
966
  message: e,
967
967
  loop: !0,
968
968
  pageSize: n.length || 5,
@@ -971,14 +971,14 @@ async function xt(e, t, a) {
971
971
  options: (i) => i ? n.filter((o) => o.name.includes(i)) : n,
972
972
  validate: t
973
973
  });
974
- return s = Array.isArray(s) ? s : [s], tn(s, n), s;
974
+ return s = Array.isArray(s) ? s : [s], sn(s, n), s;
975
975
  }
976
- async function an(e, t, a) {
977
- const { groups: n } = await Rt(), s = n.map((o) => ({
976
+ async function nn(e, t, a) {
977
+ const { groups: n } = await Ct(), s = n.map((o) => ({
978
978
  name: o.name,
979
979
  value: o.url
980
980
  }));
981
- let i = await W({
981
+ let i = await V({
982
982
  message: e,
983
983
  loop: !0,
984
984
  pageSize: s.length || 5,
@@ -989,12 +989,12 @@ async function an(e, t, a) {
989
989
  });
990
990
  return i = Array.isArray(i) ? i : [i], i;
991
991
  }
992
- async function sn() {
992
+ async function rn() {
993
993
  try {
994
- Nt() && (await Le({
994
+ jt() && (await Le({
995
995
  message: "系统中已存在z的配置文件,确认重新配置?"
996
996
  }) ? N.rm("-rf", xe()) : process.exit(0)), await fe(Ne(), { recursive: !0 });
997
- const t = await k({
997
+ const t = await E({
998
998
  message: "请选择岗位类型",
999
999
  choices: [
1000
1000
  {
@@ -1015,15 +1015,15 @@ async function sn() {
1015
1015
  message: "请输入LDAP账号:"
1016
1016
  });
1017
1017
  a = a.trim();
1018
- let n = await la({
1018
+ let n = await pa({
1019
1019
  message: "请输入LDAP密码:",
1020
1020
  mask: !0
1021
1021
  });
1022
- n = n.trim(), E("jobType", t), E("ldapAccount", a), E("ldapPassword", n);
1022
+ n = n.trim(), k("jobType", t), k("ldapAccount", a), k("ldapPassword", n);
1023
1023
  const s = await He();
1024
- Pe(s);
1025
- const i = await Lt(), o = await xt("请选择你自己(用于企微通知):", (u) => u.length > 1 ? "只能选一个" : u.length < 1 ? "请选一个" : !0), { name: r, value: c } = i.find((u) => u.value === o[0]);
1026
- E({
1024
+ De(s);
1025
+ const i = await xt(), o = await Pt("请选择你自己(用于企微通知):", (u) => u.length > 1 ? "只能选一个" : u.length < 1 ? "请选一个" : !0), { name: r, value: c } = i.find((u) => u.value === o[0]);
1026
+ k({
1027
1027
  weWorkName: r,
1028
1028
  weWorkUserId: c
1029
1029
  });
@@ -1032,13 +1032,13 @@ async function sn() {
1032
1032
  }
1033
1033
  const e = y("配置信息初始化中").start();
1034
1034
  try {
1035
- const t = await Gs();
1036
- E({
1035
+ const t = await Vs();
1036
+ k({
1037
1037
  gitUserId: t.id,
1038
1038
  gitName: t.name,
1039
1039
  gitEnglishName: t.username,
1040
1040
  gitEmail: t.email
1041
- }), de("latestCheckVersionTimestamp", Date.now()), X(), I("jobType") === ue.FRONT_END && await en(), e.succeed("配置信息初始化完成"), process.exit(0);
1041
+ }), de("latestCheckVersionTimestamp", Date.now()), X(), I("jobType") === ue.FRONT_END && await an(), e.succeed("配置信息初始化完成"), process.exit(0);
1042
1042
  } catch (t) {
1043
1043
  e.fail("配置信息初始化失败"), me.isAxiosError(t) && m("请检查你的域名及令牌配置"), m(t);
1044
1044
  }
@@ -1053,34 +1053,34 @@ const ke = (e, t, a) => {
1053
1053
  ve(x(e), n, {
1054
1054
  mode: 493
1055
1055
  });
1056
- }, nn = () => {
1056
+ }, on = () => {
1057
1057
  ke("commit-msg", "z run commit-msg"), ke("pre-commit", "z run commit-files"), ke("pre-rebase", "z run not-allow-rebase"), ke("pre-push", "z run detect-push");
1058
1058
  };
1059
- async function rn() {
1059
+ async function cn() {
1060
1060
  await _(Se(), "", { mode: 493 }), await _(x(".gitignore"), `.commit-msg-tpl
1061
- `, { mode: 493 }), nn();
1062
- const { language: e } = V();
1061
+ `, { mode: 493 }), on();
1062
+ const { language: e } = W();
1063
1063
  if ([$.JAVASCRIPT, $.MARKDOWN].includes(e) && (await _(
1064
1064
  x(".prettierrc.json"),
1065
- `${JSON.stringify(await Bs(), null, 2)}
1065
+ `${JSON.stringify(await _s(), null, 2)}
1066
1066
  `,
1067
1067
  {
1068
1068
  mode: 493
1069
1069
  }
1070
- ), await _(x(".prettierignore"), await Ms(), { mode: 493 }), await _(x("tsconfig.node.json"), await Os(), { mode: 493 }), await _(x("tsconfig.browser.json"), await Ds(), { mode: 493 })), e === $.JAVA) {
1071
- await Cs(`${re("FECDNDomain")}/file/vgnlfbfHRF.jar`, x("checkstyle.jar")), await _(x("checkstyle.xml"), await Fs(), { mode: 493 });
1070
+ ), await _(x(".prettierignore"), await zs(), { mode: 493 }), await _(x("tsconfig.node.json"), await Bs(), { mode: 493 }), await _(x("tsconfig.browser.json"), await Ms(), { mode: 493 })), e === $.JAVA) {
1071
+ await xs(`${re("FECDNDomain")}/file/vgnlfbfHRF.jar`, x("checkstyle.jar")), await _(x("checkstyle.xml"), await Js(), { mode: 493 });
1072
1072
  const t = f.join("package.json");
1073
- T(t) || await _(t, JSON.stringify({ version: "0.0.1" }, null, 2), {
1073
+ j(t) || await _(t, JSON.stringify({ version: "0.0.1" }, null, 2), {
1074
1074
  mode: 493
1075
1075
  });
1076
1076
  }
1077
- St(), await p(`git add ${K}`);
1077
+ Nt(), await p(`git add ${K}`);
1078
1078
  }
1079
- async function on(e, t) {
1079
+ async function ln(e, t) {
1080
1080
  const a = await p("git remote get-url --push origin");
1081
1081
  a || m("获取项目远程git地址失败,请配置后重试");
1082
1082
  let n = e;
1083
- n || (n = await k({
1083
+ n || (n = await E({
1084
1084
  message: "请选择项目语言",
1085
1085
  choices: [
1086
1086
  {
@@ -1103,7 +1103,7 @@ async function on(e, t) {
1103
1103
  }));
1104
1104
  let s = t;
1105
1105
  if (!s) {
1106
- const o = se(a), r = await Ct(o);
1106
+ const o = se(a), r = await Lt(o);
1107
1107
  if (!r)
1108
1108
  return m(`未找到项目,请确认项目${a}是否存在,或者当前账号权限`);
1109
1109
  s = r.namespace.full_path;
@@ -1117,11 +1117,11 @@ async function on(e, t) {
1117
1117
  message: `⚠️警告:请再次确认本项目允许直接推送代码到环境分支!!这意味着本项目可以在环境分支上进行开发,这一般用于与部署环境无关、或者单一部署环境的项目。
1118
1118
  请输入【是/yes/y/Y】以确认;输入其他或者不输入则表示不允许直接推送:`
1119
1119
  });
1120
- i = ["是", "yes", "y", "Y"].includes(o), i || G("✅ 已修改为不允许直接推送代码到分支环境");
1120
+ i = ["是", "yes", "y", "Y"].includes(o), i || J("✅ 已修改为不允许直接推送代码到分支环境");
1121
1121
  }
1122
- Et({
1122
+ It({
1123
1123
  language: n,
1124
- "lint-staged": Ga[n],
1124
+ "lint-staged": Va[n],
1125
1125
  repository: {
1126
1126
  url: a,
1127
1127
  group: s
@@ -1130,39 +1130,39 @@ async function on(e, t) {
1130
1130
  });
1131
1131
  }
1132
1132
  async function qe(e, t) {
1133
- e ? N.rm("-rf", K) : T(x()) && (await Le({
1133
+ e ? N.rm("-rf", K) : j(x()) && (await Le({
1134
1134
  message: `当前项目中已存在配置文件夹${K},确认重新配置?`
1135
- }) ? N.rm("-rf", K) : process.exit(0)), await fe(x(), { recursive: !0 }), await on(e, t);
1135
+ }) ? N.rm("-rf", K) : process.exit(0)), await fe(x(), { recursive: !0 }), await ln(e, t);
1136
1136
  const a = y("项目初始化中...").start();
1137
- await rn(), a.succeed("项目初始化完成");
1137
+ await cn(), a.succeed("项目初始化完成");
1138
1138
  }
1139
- async function cn() {
1140
- T(x()) && T(Se()) ? St() : await qe(), process.exit(0);
1139
+ async function un() {
1140
+ j(x()) && j(Se()) ? Nt() : await qe(), process.exit(0);
1141
1141
  }
1142
- async function ln(e, t) {
1143
- t.projectLanguage && !Object.values($).includes(t.projectLanguage) && m("项目语言不支持"), e ? (H(), e === "." ? (await qe(t.projectLanguage, void 0), process.exit(0)) : e === "prepare" ? await cn() : m("参数错误。执行 z init -h 查看帮助。")) : await sn();
1142
+ async function pn(e, t) {
1143
+ t.projectLanguage && !Object.values($).includes(t.projectLanguage) && m("项目语言不支持"), e ? (H(), e === "." ? (await qe(t.projectLanguage, void 0), process.exit(0)) : e === "prepare" ? await un() : m("参数错误。执行 z init -h 查看帮助。")) : await rn();
1144
1144
  }
1145
- P.command("init").alias("i").description("初始化工具配置、项目配置").argument("[type]", "非必填。不传为初始化全局配置;传 . 为初始化当前项目;传 prepare 为初始化GIT HOOKS").option("--project-language", `项目语言。可选值:${Object.values($).join("/")} `).action((...e) => B(ln, ...e));
1146
- async function un(e, t) {
1145
+ P.command("init").alias("i").description("初始化工具配置、项目配置").argument("[type]", "非必填。不传为初始化全局配置;传 . 为初始化当前项目;传 prepare 为初始化GIT HOOKS").option("--project-language", `项目语言。可选值:${Object.values($).join("/")} `).action((...e) => B(pn, ...e));
1146
+ async function mn(e, t) {
1147
1147
  if (!e)
1148
1148
  return "不能为空";
1149
1149
  if (!/^[a-z0-9-]+$/.test(e))
1150
1150
  return "格式为小写字母、中横线(可选)、数字(不推荐)。如apple, apple-tree";
1151
- if (jt().includes(e))
1151
+ if (kt().includes(e))
1152
1152
  return "当前目录下已存在同名文件夹,请先处理。";
1153
- const s = (await Ws(e)).find((i) => i.path_with_namespace === `${t}/${e}`);
1153
+ const s = (await qs(e)).find((i) => i.path_with_namespace === `${t}/${e}`);
1154
1154
  return s ? `远程仓库中已存在同名项目(${s.http_url_to_repo}),请更名后重试` : !0;
1155
1155
  }
1156
- function pn(e) {
1156
+ function dn(e) {
1157
1157
  return e ? !0 : "不能为空";
1158
1158
  }
1159
- function mn(e) {
1159
+ function fn(e) {
1160
1160
  return e ? /^[a-zA-Z0-9.]+$/.test(e) ? !0 : "格式为大小写字母、数字、小数点,小驼峰命名。如userInfo、systemRouter3" : "不能为空";
1161
1161
  }
1162
- async function dn(e) {
1162
+ async function gn(e) {
1163
1163
  ee(), H(), await ge();
1164
1164
  let t, a;
1165
- e.branchType ? t = e.branchType : t = await k({
1165
+ e.branchType ? t = e.branchType : t = await E({
1166
1166
  message: "请选择创建分支的类型",
1167
1167
  choices: [
1168
1168
  {
@@ -1180,15 +1180,15 @@ async function dn(e) {
1180
1180
  ]
1181
1181
  }), e.branchPurpose ? a = e.branchPurpose : (a = await F({
1182
1182
  message: "请输入创建分支的目的(大小写字母、数字,小驼峰式命名。如userInfo)",
1183
- validate: mn
1183
+ validate: fn
1184
1184
  }), a = a.trim());
1185
- const n = `${t}_${a}_${kt()}`;
1185
+ const n = `${t}_${a}_${Et()}`;
1186
1186
  await p(`git fetch origin ${w.MASTER}`), await p(`git checkout -b ${n} origin/${w.MASTER}`), await p(`git push -u origin ${n}`), process.exit(0);
1187
1187
  }
1188
- const Pt = (e) => `${re("ZenTaoDomain")}${e}`;
1189
- async function fn() {
1188
+ const Dt = (e) => `${re("ZenTaoDomain")}${e}`;
1189
+ async function hn() {
1190
1190
  const e = await Ce({
1191
- url: Pt("/my-work-task.json?tid=mrrferp8"),
1191
+ url: Dt("/my-work-task.json?tid=mrrferp8"),
1192
1192
  method: "get"
1193
1193
  });
1194
1194
  return e?.tasks ? e.tasks.filter((t) => t.status !== "done").map(({ id: t, name: a }) => ({
@@ -1199,9 +1199,9 @@ async function fn() {
1199
1199
  name: a
1200
1200
  })) : [];
1201
1201
  }
1202
- async function gn() {
1202
+ async function wn() {
1203
1203
  const e = await Ce({
1204
- url: Pt("/my-work-bug.json?tid=mrrferp8"),
1204
+ url: Dt("/my-work-bug.json?tid=mrrferp8"),
1205
1205
  method: "get"
1206
1206
  });
1207
1207
  return e?.bugs ? Object.values(e.bugs).map(({ id: t, title: a }) => ({
@@ -1212,16 +1212,16 @@ async function gn() {
1212
1212
  }
1213
1213
  })) : [];
1214
1214
  }
1215
- const Fe = async () => (await F({
1215
+ const Ge = async () => (await F({
1216
1216
  message: "请输入commit msg:",
1217
1217
  validate: (t) => t.length === 0 ? "请输入commit msg" : !0
1218
1218
  })).trim();
1219
- async function ot(e, t) {
1219
+ async function ct(e, t) {
1220
1220
  const a = await p("git diff HEAD", {
1221
1221
  removeTailLinkBreak: !1
1222
1222
  });
1223
- if (a || m("git暂存区没有内容,请先git add添加文件到暂存区"), Buffer.byteLength(a, "utf-8") < at) {
1224
- const u = await it({
1223
+ if (a || m("git暂存区没有内容,请先git add添加文件到暂存区"), Buffer.byteLength(a, "utf-8") < st) {
1224
+ const u = await rt({
1225
1225
  type: "commit-message-v2",
1226
1226
  input: a
1227
1227
  // modelName: "qwen-turbo",
@@ -1238,58 +1238,58 @@ async function ot(e, t) {
1238
1238
  const l = u.replace(/(["\\$`])/g, "\\$1"), d = await p(`git diff HEAD -- "${l}"`, {
1239
1239
  removeTailLinkBreak: !1
1240
1240
  });
1241
- d && Buffer.byteLength(d, "utf-8") < Ra && (i.push(u), o.push(d));
1241
+ d && Buffer.byteLength(d, "utf-8") < La && (i.push(u), o.push(d));
1242
1242
  } catch {
1243
1243
  }
1244
1244
  const r = o.join(`
1245
1245
  `);
1246
- if (i.length === 0 || Buffer.byteLength(r, "utf-8") > at)
1247
- return G("变更内容太大,无法自动生成commit msg"), t.stop(), await Fe();
1246
+ if (i.length === 0 || Buffer.byteLength(r, "utf-8") > st)
1247
+ return J("变更内容太大,无法自动生成commit msg"), t.stop(), await Ge();
1248
1248
  if (!r)
1249
- return G("无法获取文件差异信息"), t.stop(), await Fe();
1250
- const c = await it({
1249
+ return J("无法获取文件差异信息"), t.stop(), await Ge();
1250
+ const c = await rt({
1251
1251
  type: "commit-message-v2",
1252
1252
  input: r
1253
1253
  // modelName: "qwen-turbo",
1254
1254
  });
1255
1255
  return e + c;
1256
1256
  }
1257
- async function Be(e, t, a) {
1257
+ async function ze(e, t, a) {
1258
1258
  const n = y("🤖 生成提交信息中...").start();
1259
1259
  let s = "", i = !0;
1260
- if ([j.FEAT, j.FIX, j.REFACTOR].includes(e)) {
1260
+ if ([T.FEAT, T.FIX, T.REFACTOR].includes(e)) {
1261
1261
  const o = t.map((r) => r.value).join(",");
1262
- if (a || (s = await ot(`${e}(${o}): `, n)), !s) {
1262
+ if (a || (s = await ct(`${e}(${o}): `, n)), !s) {
1263
1263
  const r = t.map((c) => c.name).join(";");
1264
1264
  s = `${e}(${o}): ${r}`, i = !1;
1265
1265
  }
1266
1266
  }
1267
- e === j.CHORE && (t ? s = `${e}: ${t}` : s = await ot(`${e}: `, n)), await _(Se(), s, "utf-8"), i || a ? n.succeed("提交信息已生成(↓),可以进行提交了!") : n.warn("AI生成提交信息失败,已使用默认模板(↓),可以进行提交了!"), console.log(A.yellow(s));
1267
+ e === T.CHORE && (t ? s = `${e}: ${t}` : s = await ct(`${e}: `, n)), await _(Se(), s, "utf-8"), i || a ? n.succeed("提交信息已生成(↓),可以进行提交了!") : n.warn("AI生成提交信息失败,已使用默认模板(↓),可以进行提交了!"), console.log(A.yellow(s));
1268
1268
  }
1269
- async function hn({ commitMessageCloseAi: e, commitMessageUseChoreType: t }) {
1269
+ async function yn({ commitMessageCloseAi: e, commitMessageUseChoreType: t }) {
1270
1270
  let a;
1271
- if (t ? a = j.CHORE : a = await k({
1271
+ if (t ? a = T.CHORE : a = await E({
1272
1272
  message: "请选择你要创建的模板类型",
1273
1273
  choices: [
1274
1274
  {
1275
1275
  name: "feat - 业务需求/功能开发/BUG修复",
1276
- value: j.FEAT
1276
+ value: T.FEAT
1277
1277
  },
1278
1278
  {
1279
1279
  name: "fix - bug修复",
1280
- value: j.FIX
1280
+ value: T.FIX
1281
1281
  },
1282
1282
  {
1283
1283
  name: "refactor - 技术重构/性能优化/代码规范",
1284
- value: j.REFACTOR
1284
+ value: T.REFACTOR
1285
1285
  },
1286
1286
  {
1287
1287
  name: "chore - 其他",
1288
- value: j.CHORE
1288
+ value: T.CHORE
1289
1289
  }
1290
1290
  ]
1291
- }), [j.FEAT, j.REFACTOR].includes(a)) {
1292
- const n = await fn();
1291
+ }), [T.FEAT, T.REFACTOR].includes(a)) {
1292
+ const n = await hn();
1293
1293
  if (!n.length)
1294
1294
  return U("🤷 暂无开发任务");
1295
1295
  const s = await Re({
@@ -1301,10 +1301,10 @@ async function hn({ commitMessageCloseAi: e, commitMessageUseChoreType: t }) {
1301
1301
  })),
1302
1302
  pageSize: n.length
1303
1303
  });
1304
- await Be(j.FEAT, s, e);
1304
+ await ze(T.FEAT, s, e);
1305
1305
  }
1306
- if (a === j.FIX) {
1307
- const n = await gn();
1306
+ if (a === T.FIX) {
1307
+ const n = await wn();
1308
1308
  if (!n.length)
1309
1309
  return U("🤷 暂无BUG");
1310
1310
  const s = await Re({
@@ -1316,31 +1316,31 @@ async function hn({ commitMessageCloseAi: e, commitMessageUseChoreType: t }) {
1316
1316
  })),
1317
1317
  pageSize: n.length
1318
1318
  });
1319
- await Be(j.FIX, s, e);
1319
+ await ze(T.FIX, s, e);
1320
1320
  }
1321
- if (a === j.CHORE) {
1321
+ if (a === T.CHORE) {
1322
1322
  let n = "";
1323
- e && (n = await Fe()), await Be(j.CHORE, n);
1323
+ e && (n = await Ge()), await ze(T.CHORE, n);
1324
1324
  }
1325
1325
  process.exit(0);
1326
1326
  }
1327
- async function wn() {
1327
+ async function $n() {
1328
1328
  try {
1329
1329
  const e = {}, t = async () => {
1330
- const D = jt(), { projects: oe } = await Ls(), te = oe.map((le) => {
1331
- const Qe = {
1330
+ const D = kt(), { projects: oe } = await Ps(), te = oe.map((le) => {
1331
+ const et = {
1332
1332
  name: `${le.name} [${le.desc}]`,
1333
1333
  value: le.name,
1334
1334
  disabled: !1
1335
1335
  };
1336
- return D.includes(le.name) && (Qe.disabled = "目录下已存在同名文件夹"), Qe;
1337
- }), qt = await k({
1336
+ return D.includes(le.name) && (et.disabled = "目录下已存在同名文件夹"), et;
1337
+ }), Kt = await E({
1338
1338
  message: "请选择一个项目模板",
1339
1339
  choices: te
1340
- }), Me = oe.find((le) => le.name === qt);
1341
- e.tplName = Me.name, e.tplUrl = Me.url, e.tplLanguage = Me.language;
1340
+ }), Be = oe.find((le) => le.name === Kt);
1341
+ e.tplName = Be.name, e.tplUrl = Be.url, e.tplLanguage = Be.language;
1342
1342
  }, a = async () => {
1343
- const { groups: D } = Qs(), oe = await k({
1343
+ const { groups: D } = tn(), oe = await E({
1344
1344
  message: "请选择一个分组",
1345
1345
  choices: D.map((te) => ({
1346
1346
  name: `${te.name} [${te.description}]`,
@@ -1355,17 +1355,17 @@ async function wn() {
1355
1355
  }, n = async () => {
1356
1356
  e.projectName = await F({
1357
1357
  message: "请输入项目名称",
1358
- validate: (D) => un(D, e.group?.name || "")
1358
+ validate: (D) => mn(D, e.group?.name || "")
1359
1359
  }), e.projectName = e.projectName.trim(), e.projectDesc = await F({
1360
1360
  message: "请输入项目描述",
1361
- validate: pn
1361
+ validate: dn
1362
1362
  }), e.projectDesc = e.projectDesc.trim();
1363
1363
  };
1364
1364
  await t(), await a(), await n();
1365
1365
  const s = `${Ae}/${e.group?.name}/${e.projectName}.git`, i = y("模版初始化中").start();
1366
- await p(`git clone --depth=1 ${e.tplUrl}`), await dt(e.tplName, e.projectName), N.cd(e.projectName), N.rm("-rf", ".git"), await p(`git init --initial-branch=${w.MASTER}`), await p(`git remote add origin ${s}`), await p(`git config user.name ${I("gitName")}`), await p(`git config user.email ${I("gitEmail")}`);
1366
+ await p(`git clone --depth=1 ${e.tplUrl}`), await ft(e.tplName, e.projectName), N.cd(e.projectName), N.rm("-rf", ".git"), await p(`git init --initial-branch=${w.MASTER}`), await p(`git remote add origin ${s}`), await p(`git config user.name ${I("gitName")}`), await p(`git config user.email ${I("gitEmail")}`);
1367
1367
  const o = We();
1368
- es({
1368
+ as({
1369
1369
  ...o,
1370
1370
  name: e.projectName,
1371
1371
  description: e.projectDesc,
@@ -1373,12 +1373,12 @@ async function wn() {
1373
1373
  ...o.scripts,
1374
1374
  prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'"
1375
1375
  }
1376
- }), await L.writeFile(f.resolve("README.md"), Ja(e.projectName, e.projectDesc)), i.succeed("模版初始化完成"), await qe(e.tplLanguage, e.group?.name);
1376
+ }), await L.writeFile(f.resolve("README.md"), Ua(e.projectName, e.projectDesc)), i.succeed("模版初始化完成"), await qe(e.tplLanguage, e.group?.name);
1377
1377
  const r = y("依赖安装中").start();
1378
1378
  await p("npm install --registry https://registry.npmmirror.com/"), r.succeed("依赖安装完成");
1379
1379
  const c = y("项目推送中").start();
1380
1380
  await p('git add . && git commit -m "chore: 项目初始化"'), await p("git tag v0.0.1");
1381
- const u = await Vs({
1381
+ const u = await Hs({
1382
1382
  name: e.projectName,
1383
1383
  description: e.projectDesc,
1384
1384
  path: e.projectName,
@@ -1386,9 +1386,9 @@ async function wn() {
1386
1386
  namespace_id: e.group?.id
1387
1387
  });
1388
1388
  await p(`git push -u origin ${w.MASTER}`), await p(`git push origin HEAD:${w.MASTER} --tags`), c.succeed(`项目已推送到远程,地址: ${A.blue(s)}`);
1389
- const l = y("初始化分支中").start(), d = `feat_init_${kt()}`, g = [w.DEV, w.TEST, w.RELEASE, d], h = await Promise.allSettled(
1389
+ const l = y("初始化分支中").start(), d = `feat_init_${Et()}`, g = [w.DEV, w.TEST, w.RELEASE, d], h = await Promise.allSettled(
1390
1390
  g.map(
1391
- (D) => Ys({
1391
+ (D) => Qs({
1392
1392
  id: u.id,
1393
1393
  branch: D,
1394
1394
  ref: w.MASTER
@@ -1404,7 +1404,7 @@ async function wn() {
1404
1404
  m(e);
1405
1405
  }
1406
1406
  }
1407
- async function yn(e, t) {
1407
+ async function vn(e, t) {
1408
1408
  let a;
1409
1409
  e ? [
1410
1410
  "project",
@@ -1418,7 +1418,7 @@ async function yn(e, t) {
1418
1418
  "commit-msg",
1419
1419
  "cm"
1420
1420
  /* CommitMsgAbbr */
1421
- ].includes(e) ? a = "commit-msg" : m("参数输入错误") : a = await k({
1421
+ ].includes(e) ? a = "commit-msg" : m("参数输入错误") : a = await E({
1422
1422
  message: "请选择你要创建的类型",
1423
1423
  choices: [
1424
1424
  {
@@ -1437,77 +1437,90 @@ async function yn(e, t) {
1437
1437
  /* Project */
1438
1438
  }
1439
1439
  ]
1440
- }), a === "project" ? await wn() : (ee(), H(), a === "branch" ? await dn(t) : a === "commit-msg" && (await p("git status -s") ? await hn(t) : m("没有要变动的文件,无法生成提交信息")));
1440
+ }), a === "project" ? await $n() : (ee(), H(), a === "branch" ? await gn(t) : a === "commit-msg" && (await p("git status -s") ? await yn(t) : m("没有要变动的文件,无法生成提交信息")));
1441
1441
  }
1442
- P.command("create").alias("c").description("创建项目/分支/提交信息").argument("[type]", "可选值为project|pr, branch|b, commit-msg|cm").option("--branch-type <type>", `分支类型。可选值:${Object.values($e).join(", ")}`).option("--branch-purpose <purpose>", "创建分支的目的").option("--commit-message-close-ai", "创建提交信息时,是否关闭AI生成").option("-c, --commit-message-use-chore-type", "创建提交信息时,直接使用chore类型。").action((...e) => B(yn, ...e));
1443
- const $n = async (e) => {
1444
- const t = await Rs(), a = I("weWorkUserId"), { notifyUsers: n, notifyGroups: s, ...i } = e, o = y("部署任务创建中").start(), r = await bs({
1442
+ P.command("create").alias("c").description("创建项目/分支/提交信息").argument("[type]", "可选值为project|pr, branch|b, commit-msg|cm").option("--branch-type <type>", `分支类型。可选值:${Object.values($e).join(", ")}`).option("--branch-purpose <purpose>", "创建分支的目的").option("--commit-message-close-ai", "创建提交信息时,是否关闭AI生成").option("-c, --commit-message-use-chore-type", "创建提交信息时,直接使用chore类型。").action((...e) => B(vn, ...e));
1443
+ const An = async (e) => {
1444
+ const t = await Ls(), a = I("weWorkUserId"), { notifyUsers: n, notifyGroups: s, ...i } = e, o = y("部署任务创建中").start(), r = await Ns({
1445
1445
  ...i,
1446
1446
  userToken: t,
1447
1447
  userWeworkId: a,
1448
- notifyUsers: [.../* @__PURE__ */ new Set([a, ...n])].join(_e),
1449
- notifyGroups: s.join(_e)
1448
+ notifyUsers: [.../* @__PURE__ */ new Set([a, ...n])].join(Fe),
1449
+ notifyGroups: s.join(Fe)
1450
1450
  });
1451
1451
  i.moduleNames.length > 1 ? (o.succeed(`多模块部署任务创建完成,共 ${i.moduleNames.length} 个模块`), o.succeed(`当前已创建首个模块 ${A.blue(i.moduleNames[0])} 的 k8s 地址:`), console.log(A.blue(r)), o.info("后续模块会在前一个模块完成后依次部署,并通过企微通知下发对应地址。")) : (o.succeed("部署任务创建完成"), console.log(`如有需要,可在k8s中查看 ${A.blue(r)}`));
1452
- }, Dt = () => {
1453
- const e = V();
1452
+ }, Ze = () => {
1453
+ const e = W();
1454
1454
  return e.language || m("未找到当前项目的语言类型,请先通过 z . 对项目进行初始化!"), e.language;
1455
- }, vn = () => {
1456
- const e = V();
1455
+ }, Ot = () => {
1456
+ const e = W();
1457
1457
  return e.repository?.url || m("未找到当前项目的仓库地址,请先通过 z . 对项目进行初始化"), e.repository.url;
1458
+ }, Mt = async () => {
1459
+ const e = Ot(), t = Ze(), { groups: a } = await Us();
1460
+ return a.find((n) => {
1461
+ const s = $.JAVASCRIPT === t ? n.projects?.web : $.JAVA === t ? n.projects?.server : [];
1462
+ return s.length && s.some((i) => Pe(i.url, e)) && n.zenTaoProductId ? n.zenTaoProductId : !1;
1463
+ });
1464
+ }, bn = async () => {
1465
+ const e = await Mt();
1466
+ if (!e)
1467
+ return;
1468
+ const t = Ot(), a = Ze(), n = $.JAVASCRIPT === a ? e.projects?.web : $.JAVA === a ? e.projects?.server : [];
1469
+ return n.length ? n.find((i) => Pe(i.url, t))?.chatGroupWebhook ?? e.chatGroupWebhook : void 0;
1458
1470
  };
1459
- function An(e, t) {
1471
+ function Sn(e, t) {
1460
1472
  const a = We();
1461
- if (V()?.repository?.url || m(".z/project.json中缺少repository.url"), t === Y.H5) {
1473
+ if (W()?.repository?.url || m(".z/project.json中缺少repository.url"), t === Y.H5) {
1462
1474
  const s = `build:${e}`;
1463
1475
  a?.scripts[s] || m(`项目package.json文件scripts不存在命令${s}。`);
1464
1476
  }
1465
1477
  t === Y.NPM && (a?.scripts.build || m("项目package.json文件scripts不存在命令build。")), t === Y.SERVER && (a?.scripts.build || m("项目package.json文件scripts不存在命令build。"));
1466
1478
  }
1467
- const bn = async () => {
1468
- const e = vn(), t = Dt(), { groups: a } = await Js();
1469
- return a.find((n) => {
1470
- const s = $.JAVASCRIPT === t ? n.projects?.web : $.JAVA === t ? n.projects?.server : [];
1471
- return s.length && s.some((i) => Ue(i.url, e)) && n.zenTaoProductId ? n.zenTaoProductId : !1;
1472
- });
1473
- }, Sn = async () => {
1474
- const e = await bn();
1479
+ const Nn = async () => {
1480
+ const e = await Mt();
1475
1481
  if (!e) {
1476
- m("未找到关联的禅道产品!");
1482
+ m("未找到关联的禅道产品,请先关联禅道产品!");
1477
1483
  return;
1478
1484
  }
1479
- const t = y("查询禅道执行中...").start(), a = await Ss(Number(e.zenTaoProductId));
1485
+ const t = y("查询禅道执行中...").start(), a = await js(Number(e.zenTaoProductId));
1480
1486
  a.length || (t.fail("查询禅道执行失败"), m(`${e.name} 项目在禅道中未创建执行!`)), t.stop();
1481
- const n = await k({
1487
+ const n = await V({
1482
1488
  message: "请选择执行",
1483
- choices: a.map((s) => ({
1484
- name: s.label,
1485
- value: s.value
1486
- }))
1489
+ options: (s) => {
1490
+ const i = a.map((o) => ({
1491
+ name: o.label,
1492
+ value: o.value
1493
+ }));
1494
+ return s ? i.filter((o) => o.name.includes(s)) : i;
1495
+ },
1496
+ pageSize: 20,
1497
+ loop: !0,
1498
+ multiple: !1,
1499
+ filter: !0
1487
1500
  });
1488
- t.start("创建或更新执行构建..."), await Ns({
1501
+ t.start("创建或更新执行构建..."), await Ts({
1489
1502
  appName: e.name,
1490
1503
  executionId: Number(n),
1491
1504
  ldapAccount: I("ldapAccount")
1492
1505
  }), t.succeed("创建或更新执行构建成功");
1493
- }, Nn = [w.TEST, w.MASTER];
1494
- async function Ot(e, t) {
1506
+ }, jn = [w.TEST, w.MASTER];
1507
+ async function Bt(e, t) {
1495
1508
  ee(), H();
1496
1509
  let a = e, n = t.platform;
1497
- const s = V();
1498
- if (s.language === $.JAVA && (n = Y.SERVER), a && !Object.values(w).includes(a) && m("仅支持发布指定环境分支"), n && !Object.values(Y).includes(n) && m("发布平台错误"), n || (n = await k({
1510
+ const s = W();
1511
+ if (s.language === $.JAVA && (n = Y.SERVER), a && !Object.values(w).includes(a) && m("仅支持发布指定环境分支"), n && !Object.values(Y).includes(n) && m("发布平台错误"), n || (n = await E({
1499
1512
  message: "请选择平台",
1500
- choices: Ta
1513
+ choices: ka
1501
1514
  })), n === Y.NPM && (a = w.MASTER), !a) {
1502
- const l = await k({
1515
+ const l = await E({
1503
1516
  message: "请选择部署环境",
1504
- choices: vt
1517
+ choices: At
1505
1518
  });
1506
- a = _a(l);
1519
+ a = Ga(l);
1507
1520
  }
1508
- a === w.TEST && await Sn();
1521
+ a === w.TEST && await Nn();
1509
1522
  let i = "";
1510
- s.language === $.JAVASCRIPT && (i = Ea);
1523
+ s.language === $.JAVASCRIPT && (i = Ra);
1511
1524
  const o = [];
1512
1525
  if (s.language === $.JAVASCRIPT) {
1513
1526
  let l = "";
@@ -1515,7 +1528,7 @@ async function Ot(e, t) {
1515
1528
  d.name.startsWith("@") && d.name.includes("/") ? l = d.name.split("/").pop() || "" : l = d.name, l && o.push(l);
1516
1529
  }
1517
1530
  if (s.language === $.JAVA) {
1518
- const { projects: l } = await xs(), d = l.find(
1531
+ const { projects: l } = await Ds(), d = l.find(
1519
1532
  (g) => se(g.url) === se(s.repository.url)
1520
1533
  );
1521
1534
  if (!d)
@@ -1527,10 +1540,10 @@ async function Ot(e, t) {
1527
1540
  value: v
1528
1541
  }));
1529
1542
  if (t.module) {
1530
- const v = new Set(t.module.split(_e));
1543
+ const v = new Set(t.module.split(Fe));
1531
1544
  g.forEach((R) => v.has(R.value) && o.push(R.value));
1532
1545
  }
1533
- const h = await W({
1546
+ const h = await V({
1534
1547
  message: "请选择部署模块",
1535
1548
  options: (v) => v ? g.filter((R) => R.name.includes(v)) : g,
1536
1549
  pageSize: 20,
@@ -1549,14 +1562,18 @@ async function Ot(e, t) {
1549
1562
  }
1550
1563
  }
1551
1564
  let r = [];
1552
- const c = Nn.includes(a);
1553
- !t.skipSelectionNotification && !c && (r = await xt("请选择部署成功要通知的人员:", () => !0, !0));
1565
+ const c = jn.includes(a);
1566
+ !t.skipSelectionNotification && !c && (r = await Pt("请选择部署成功要通知的人员:", () => !0, !0));
1554
1567
  let u = [];
1555
- if (!t.skipGroupNotification && !c && (u = await an("请选择部署成功要通知的群组:", () => !0, !0)), s.language === $.JAVASCRIPT) {
1556
- const l = za(a);
1557
- An(l, n);
1568
+ if (!t.skipGroupNotification && !c && (u = await nn("请选择部署成功要通知的群组:", () => !0, !0)), c && !t.skipGroupNotification && !u.length) {
1569
+ const l = await bn();
1570
+ l && u.push(l);
1558
1571
  }
1559
- await $n({
1572
+ if (s.language === $.JAVASCRIPT) {
1573
+ const l = Fa(a);
1574
+ Sn(l, n);
1575
+ }
1576
+ await An({
1560
1577
  moduleNames: o,
1561
1578
  k8sGroupName: i,
1562
1579
  branchName: a,
@@ -1564,11 +1581,11 @@ async function Ot(e, t) {
1564
1581
  notifyGroups: u
1565
1582
  });
1566
1583
  }
1567
- async function Mt(e, t, a, n) {
1584
+ async function zt(e, t, a, n) {
1568
1585
  const s = y(`分支合并中,${e} -> ${t}`).start();
1569
1586
  let i = 0;
1570
1587
  try {
1571
- const { iid: r } = await Hs({
1588
+ const { iid: r } = await Zs({
1572
1589
  title: `${e} -> ${t} by z-develop`,
1573
1590
  id: a.id,
1574
1591
  source_branch: e,
@@ -1584,7 +1601,7 @@ async function Mt(e, t, a, n) {
1584
1601
  try {
1585
1602
  await new Promise((r) => {
1586
1603
  setTimeout(r, 5e3);
1587
- }), await qs({
1604
+ }), await Ks({
1588
1605
  id: a.id,
1589
1606
  iid: i
1590
1607
  }), s.succeed(`分支${e}已合并到分支${t}`);
@@ -1593,12 +1610,12 @@ async function Mt(e, t, a, n) {
1593
1610
  const c = r?.response?.status;
1594
1611
  if (c === 406)
1595
1612
  return await o();
1596
- if (await Zs({
1613
+ if (await Ys({
1597
1614
  id: a.id,
1598
1615
  iid: i,
1599
1616
  state_event: "close"
1600
1617
  }), c === 405) {
1601
- const u = await Ks({
1618
+ const u = await Xs({
1602
1619
  id: a.id,
1603
1620
  iid: i
1604
1621
  });
@@ -1618,23 +1635,23 @@ async function Tn(e, t) {
1618
1635
  `git log ${n}...${s} -b ${a}`
1619
1636
  ) || m(`分支${e.sourceBranch}上不存在新的commit,不需要合并。`), await p(
1620
1637
  `git branch --contains ${n} -r ${a}`
1621
- ) || (console.log(A.yellow("注意:当前分支上不存在远程主分支最新代码,将在自动合入后继续。")), await Mt(w.MASTER, e.sourceBranch, e)), t === w.MASTER && (await p(
1638
+ ) || (console.log(A.yellow("注意:当前分支上不存在远程主分支最新代码,将在自动合入后继续。")), await zt(w.MASTER, e.sourceBranch, e)), t === w.MASTER && (await p(
1622
1639
  `git cherry origin/${O.TEST} ${a} origin/${w.MASTER}`
1623
1640
  )).split(`
1624
1641
  `).some((c) => c.startsWith("+ ")) && m("请先在测试环境发布要部署的代码");
1625
1642
  }
1626
- const ct = async (e, t) => {
1643
+ const lt = async (e, t) => {
1627
1644
  try {
1628
1645
  await p(`git push -u origin ${e}`), t.succeed(`本地分支${e}已推送到远程分支origin/${e}`);
1629
1646
  } catch (a) {
1630
1647
  m(`合并到远程分支 ${e} 失败,${a}`);
1631
1648
  }
1632
1649
  };
1633
- async function jn(e, t) {
1650
+ async function kn(e, t) {
1634
1651
  ee(), H(), await ge();
1635
- const a = await ts();
1652
+ const a = await ss();
1636
1653
  Object.values(w).includes(a.sourceBranch) && m(`当前分支${a.sourceBranch}不可作为源分支合并到目标分支。`);
1637
- const s = (await Xs(a.id)).filter((c) => ![a.sourceBranch].includes(c.name)).map((c) => {
1654
+ const s = (await en(a.id)).filter((c) => ![a.sourceBranch].includes(c.name)).map((c) => {
1638
1655
  let u = c.name;
1639
1656
  return Object.values(w).includes(u) && (u = A.bold.blue(u)), {
1640
1657
  name: u,
@@ -1642,7 +1659,7 @@ async function jn(e, t) {
1642
1659
  };
1643
1660
  });
1644
1661
  let i;
1645
- e && !s.filter((c) => c.value === e).length && m(`未找到目标分支${e}`), e ? i = e : i = await k({
1662
+ e && !s.filter((c) => c.value === e).length && m(`未找到目标分支${e}`), e ? i = e : i = await E({
1646
1663
  message: "请选择要合并到的目标分支:",
1647
1664
  choices: s
1648
1665
  });
@@ -1650,22 +1667,22 @@ async function jn(e, t) {
1650
1667
  if (await p(`git ls-remote --heads origin ${a.sourceBranch}`)) {
1651
1668
  o.text = `存在远程分支origin/${a.sourceBranch}`, await p("git fetch");
1652
1669
  const c = await p(`git rev-parse ${a.sourceBranch}`), u = await p(`git rev-parse origin/${a.sourceBranch}`);
1653
- await p(`git merge-base ${u} HEAD`) === u ? await ct(a.sourceBranch, o) : await p(`git merge-base ${c} ${u}`) === c ? (await p("git pull"), o.succeed(`本地分支${a.sourceBranch}已更新`)) : (o.fail(
1670
+ await p(`git merge-base ${u} HEAD`) === u ? await lt(a.sourceBranch, o) : await p(`git merge-base ${c} ${u}`) === c ? (await p("git pull"), o.succeed(`本地分支${a.sourceBranch}已更新`)) : (o.fail(
1654
1671
  `远程分支origin/${a.sourceBranch}和本地分支${a.sourceBranch}都有新的提交,请手动合并后再试。`
1655
1672
  ), process.exit(1));
1656
1673
  } else
1657
- await ct(a.sourceBranch, o);
1658
- await Tn(a, i), await Mt(a.sourceBranch, i, a, t.keepBranchAfterMergeMaster), w.MASTER === i && !t.keepBranchAfterMergeMaster && (await p(`git checkout ${w.MASTER}`), await p(`git pull origin ${w.MASTER}`), await p(`git branch -d ${a.sourceBranch}`), U(
1674
+ await lt(a.sourceBranch, o);
1675
+ await Tn(a, i), await zt(a.sourceBranch, i, a, t.keepBranchAfterMergeMaster), w.MASTER === i && !t.keepBranchAfterMergeMaster && (await p(`git checkout ${w.MASTER}`), await p(`git pull origin ${w.MASTER}`), await p(`git branch -d ${a.sourceBranch}`), U(
1659
1676
  `${a.sourceBranch}分支已移除,当前已切换到最新的${w.MASTER}。如需继续开发,请检出新分支(z c b)。`
1660
- )), Object.values(w).includes(i) && await Ot(i, {
1677
+ )), Object.values(w).includes(i) && await Bt(i, {
1661
1678
  platform: t.deployPlatform,
1662
1679
  skipSelectionNotification: t.deploySkipSelectionNotification,
1663
1680
  skipGroupNotification: t.skipGroupNotification
1664
1681
  });
1665
1682
  }
1666
- P.command("merge").alias("m").description("合并当前分支到指定远程分支,并部署。").argument("[branch]", "目标分支名称").option("--deploy-platform <platform>", `合并成功后要部署的平台。可选值:${Object.values(Y).join("/")}`).option("--deploy-skip-selection-notification", "部署时,是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").option("--keep-branch-after-merge-master", "在合并到主分支之后,是否保留分支。默认否").action((...e) => B(jn, ...e));
1667
- P.command("deploy").alias("d").description("部署到指定环境").argument("[branchName]", `部署环境。可选值:${Object.values(w).join("/")}`).option("--platform <platform>", `部署平台。可选值:${Object.values(Y).join("/")}`).option("--module <module>", "部署模块。Java项目适用,填入要部署的模块名称,多个使用逗号分隔").option("--skip-selection-notification", "是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").action((...e) => B(Ot, ...e));
1668
- async function kn() {
1683
+ P.command("merge").alias("m").description("合并当前分支到指定远程分支,并部署。").argument("[branch]", "目标分支名称").option("--deploy-platform <platform>", `合并成功后要部署的平台。可选值:${Object.values(Y).join("/")}`).option("--deploy-skip-selection-notification", "部署时,是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").option("--keep-branch-after-merge-master", "在合并到主分支之后,是否保留分支。默认否").action((...e) => B(kn, ...e));
1684
+ P.command("deploy").alias("d").description("部署到指定环境").argument("[branchName]", `部署环境。可选值:${Object.values(w).join("/")}`).option("--platform <platform>", `部署平台。可选值:${Object.values(Y).join("/")}`).option("--module <module>", "部署模块。Java项目适用,填入要部署的模块名称,多个使用逗号分隔").option("--skip-selection-notification", "是否跳过选择部署通知人环节").option("--skip-group-notification", "是否跳过选择部署通知群聊环节").action((...e) => B(Bt, ...e));
1685
+ async function En() {
1669
1686
  try {
1670
1687
  await p("java -jar ./.z/checkstyle.jar -c ./.z/checkstyle.xml .", {
1671
1688
  silent: !1
@@ -1674,7 +1691,7 @@ async function kn() {
1674
1691
  m("checkstyle执行出错"), process.exit(1);
1675
1692
  }
1676
1693
  }
1677
- const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object.values(w), Ee = w.MASTER, Rn = async (e) => {
1694
+ const Ie = "origin/", In = Object.values(w).map((e) => `${Ie}${e}`), Rn = Object.values(w), Ee = w.MASTER, Cn = async (e) => {
1678
1695
  await p("git fetch --prune");
1679
1696
  const t = `${Ie}${e}`, a = await p(`git branch -r --merged ${t}`, {
1680
1697
  encoding: "utf8"
@@ -1684,7 +1701,7 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
1684
1701
  return a.split(`
1685
1702
  `).forEach((i) => {
1686
1703
  const o = i.trim();
1687
- if (o && o !== t && !o.startsWith(`${Ie}HEAD`) && !En.includes(o)) {
1704
+ if (o && o !== t && !o.startsWith(`${Ie}HEAD`) && !In.includes(o)) {
1688
1705
  const r = o.replace(new RegExp(`^${Ie}`), "");
1689
1706
  s.set(r, {
1690
1707
  name: r,
@@ -1696,7 +1713,7 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
1696
1713
  }), n.split(`
1697
1714
  `).forEach((i) => {
1698
1715
  const o = i.replace(/^\*?\s*/, "").trim();
1699
- if (o && o !== e && !In.includes(o)) {
1716
+ if (o && o !== e && !Rn.includes(o)) {
1700
1717
  const r = s.get(o);
1701
1718
  s.set(o, {
1702
1719
  name: o,
@@ -1709,7 +1726,7 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
1709
1726
  ...i,
1710
1727
  name: `${i.value}${i.hasRemote && i.hasLocal ? "(本地/远程)" : i.hasRemote ? "(远程)" : "(本地)"}`
1711
1728
  })).sort((i, o) => i.value.localeCompare(o.value));
1712
- }, Cn = (e) => W({
1729
+ }, Ln = (e) => V({
1713
1730
  message: "请选择需要删除的分支",
1714
1731
  options: (t) => t ? e.filter((a) => a.name.includes(t)) : e,
1715
1732
  pageSize: 20,
@@ -1723,41 +1740,41 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
1723
1740
  renderSelectedOptions: (t) => t.map((a) => a.value).join(", ")
1724
1741
  }
1725
1742
  }
1726
- }), Ln = async (e) => (await p(`git branch --list ${e}`)).trim() !== "", xn = (e) => {
1743
+ }), xn = async (e) => (await p(`git branch --list ${e}`)).trim() !== "", Pn = (e) => {
1727
1744
  Ve(`git push origin --delete ${e}`);
1728
- }, Pn = (e) => {
1745
+ }, Dn = (e) => {
1729
1746
  Ve(`git branch -d ${e}`);
1730
- }, Dn = async () => {
1747
+ }, On = async () => {
1731
1748
  await ge();
1732
- const e = y(`正在查询本地和远程已经合并到${Ee}的分支...`).start(), t = await Rn(Ee);
1749
+ const e = y(`正在查询本地和远程已经合并到${Ee}的分支...`).start(), t = await Cn(Ee);
1733
1750
  if (e.succeed(`查询到 ${t.length} 个已合并到 ${Ee} 的分支`), !t.length) {
1734
- G(`未查询到已合并到 ${Ee} 的可删除分支`);
1751
+ J(`未查询到已合并到 ${Ee} 的可删除分支`);
1735
1752
  return;
1736
1753
  }
1737
- const a = await Cn(t);
1754
+ const a = await Ln(t);
1738
1755
  if (!await Le({
1739
1756
  message: `确认删除选中的 ${a.length} 个分支对应的远程分支和本地分支?`,
1740
1757
  default: !1
1741
1758
  })) {
1742
- G("已取消删除");
1759
+ J("已取消删除");
1743
1760
  return;
1744
1761
  }
1745
1762
  const s = await p("git branch --show-current"), i = [], o = [], r = [], c = t.filter((l) => a.includes(l.value)), u = y("正在删除分支...").start();
1746
1763
  try {
1747
1764
  for (const l of c) {
1748
1765
  const { value: d, hasLocal: g, hasRemote: h } = l;
1749
- if (h && (u.text = `正在删除远程分支 ${d}...`, xn(d), o.push(d)), d === s) {
1766
+ if (h && (u.text = `正在删除远程分支 ${d}...`, Pn(d), o.push(d)), d === s) {
1750
1767
  g && i.push(d);
1751
1768
  continue;
1752
1769
  }
1753
- !g || !await Ln(d) || (u.text = `正在删除本地分支 ${d}...`, Pn(d), r.push(d));
1770
+ !g || !await xn(d) || (u.text = `正在删除本地分支 ${d}...`, Dn(d), r.push(d));
1754
1771
  }
1755
1772
  } catch (l) {
1756
1773
  throw u.fail("删除分支失败"), l;
1757
1774
  }
1758
- u.succeed("分支删除完成"), o.length && U(`远程分支删除完成:${o.join(", ")}`), r.length && U(`本地分支删除完成:${r.join(", ")}`), i.length && G(`${i.join(", ")} 为当前分支,无法删除本地分支`);
1759
- }, Bt = "0000000000000000000000000000000000000000", lt = "refs/heads/", On = async (e, t) => {
1760
- if (t === Bt) {
1775
+ u.succeed("分支删除完成"), o.length && U(`远程分支删除完成:${o.join(", ")}`), r.length && U(`本地分支删除完成:${r.join(", ")}`), i.length && J(`${i.join(", ")} 为当前分支,无法删除本地分支`);
1776
+ }, _t = "0000000000000000000000000000000000000000", ut = "refs/heads/", Mn = async (e, t) => {
1777
+ if (t === _t) {
1761
1778
  try {
1762
1779
  const a = await p(`git rev-parse --verify --quiet origin/${w.MASTER}`);
1763
1780
  if (a)
@@ -1767,14 +1784,14 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
1767
1784
  return null;
1768
1785
  }
1769
1786
  return `${t}..${e}`;
1770
- }, Mn = async (e) => {
1787
+ }, Bn = async (e) => {
1771
1788
  try {
1772
1789
  return (await p(`git log ${e} --grep="(cherry picked from commit" --format="%H"`)).split(`
1773
1790
  `).filter(Boolean);
1774
1791
  } catch {
1775
1792
  return [];
1776
1793
  }
1777
- }, Bn = async (e) => {
1794
+ }, zn = async (e) => {
1778
1795
  try {
1779
1796
  return (await p(`git log ${e} --format="%H %at %ct"`)).split(`
1780
1797
  `).flatMap((a) => {
@@ -1784,32 +1801,32 @@ const Ie = "origin/", En = Object.values(w).map((e) => `${Ie}${e}`), In = Object
1784
1801
  } catch {
1785
1802
  return [];
1786
1803
  }
1787
- }, zn = async () => {
1788
- const { skipGitPushLimit: e } = V(), t = Object.values(w), a = mt(0, "utf-8");
1804
+ }, _n = async () => {
1805
+ const { skipGitPushLimit: e } = W(), t = Object.values(w), a = dt(0, "utf-8");
1789
1806
  if (!a)
1790
1807
  return;
1791
1808
  const n = a.trim().split(`
1792
1809
  `), s = n.length;
1793
1810
  for (let i = 0; i < s; i++) {
1794
1811
  const [, o, r, c] = n[i].split(/\s+/);
1795
- if (!r.startsWith(lt) || o === Bt)
1812
+ if (!r.startsWith(ut) || o === _t)
1796
1813
  continue;
1797
- const u = r.replace(lt, "");
1814
+ const u = r.replace(ut, "");
1798
1815
  !e && t.includes(u) && m(`禁止直接 Push 到环境分支:${u}`);
1799
- const l = await On(o, c);
1816
+ const l = await Mn(o, c);
1800
1817
  if (!l)
1801
1818
  continue;
1802
1819
  const [d, g] = await Promise.all([
1803
- Mn(l),
1804
- Bn(l)
1820
+ Bn(l),
1821
+ zn(l)
1805
1822
  ]), h = [.../* @__PURE__ */ new Set([...d, ...g])];
1806
1823
  h.length > 0 && m(`以下提交中检测到包含 cherry-pick 特征,本次 Push 已被拒绝
1807
1824
  ${h.join(`
1808
1825
  `)}`);
1809
1826
  }
1810
1827
  };
1811
- async function _n() {
1812
- T(f.resolve("node_modules", ".bin", "markdownlint")) || m("该项目未安装markdownlint,请安装后重试");
1828
+ async function Fn() {
1829
+ j(f.resolve("node_modules", ".bin", "markdownlint")) || m("该项目未安装markdownlint,请安装后重试");
1813
1830
  const e = y("markdownlint执行中...").start();
1814
1831
  try {
1815
1832
  await p('npx markdownlint "**/*.md" --fix', {
@@ -1819,18 +1836,18 @@ async function _n() {
1819
1836
  e.fail("markdownlint校验出错"), process.exit(1);
1820
1837
  }
1821
1838
  }
1822
- const Fn = () => {
1839
+ const Gn = () => {
1823
1840
  m("禁止执行 rebase,请使用 git merge!");
1824
1841
  };
1825
1842
  function Jn() {
1826
- const e = V();
1843
+ const e = W();
1827
1844
  if (e["lint-staged"])
1828
1845
  return e["lint-staged"];
1829
1846
  throw new Error("未找到lint配置");
1830
1847
  }
1831
- async function Gn() {
1848
+ async function Un() {
1832
1849
  const e = y("代码风格检测中...").start();
1833
- await pa({
1850
+ await da({
1834
1851
  concurrent: 4,
1835
1852
  debug: !1,
1836
1853
  config: Jn(),
@@ -1838,22 +1855,22 @@ async function Gn() {
1838
1855
  relative: !0
1839
1856
  }) ? (e.succeed("代码风格检测通过!"), process.exit(0)) : (e.fail("代码风格检测未通过!"), process.exit(1));
1840
1857
  }
1841
- function Un(e) {
1842
- if (e.includes("Merge") && e.includes("# Conflicts:") || ma.valid(e))
1858
+ function Vn(e) {
1859
+ if (e.includes("Merge") && e.includes("# Conflicts:") || fa.valid(e))
1843
1860
  return !0;
1844
1861
  const t = e.split(": ");
1845
1862
  if (t.length === 1)
1846
1863
  return "body前缺少「: 」";
1847
1864
  const a = t[0];
1848
- return /^(feat|fix|refactor)/.test(a) ? /\(\d+(?:,\d+)*\)/.test(a) ? !0 : "ID缺少或者格式不正确。" : /^(chore|ci)/.test(a) ? [j.CHORE, j.CI].includes(a) ? !0 : "chore/ci类型无需填写ID。" : j.Break === a ? !0 : "不存在的提交类型。";
1865
+ return /^(feat|fix|refactor)/.test(a) ? /\(\d+(?:,\d+)*\)/.test(a) ? !0 : "ID缺少或者格式不正确。" : /^(chore|ci)/.test(a) ? [T.CHORE, T.CI].includes(a) ? !0 : "chore/ci类型无需填写ID。" : T.Break === a ? !0 : "不存在的提交类型。";
1849
1866
  }
1850
- async function Vn() {
1851
- const e = await ze(f.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = y("提交信息格式校验中...").start(), a = Un(e);
1867
+ async function Wn() {
1868
+ const e = await _e(f.resolve(".git", "COMMIT_EDITMSG"), "utf-8"), t = y("提交信息格式校验中...").start(), a = Vn(e);
1852
1869
  a === !0 ? (t.succeed("提交信息格式校验通过"), process.exit(0)) : (t.fail(`提交信息格式校验失败。${a}`), process.exit(1));
1853
1870
  }
1854
- async function Wn() {
1871
+ async function Hn() {
1855
1872
  await ge();
1856
- const e = await da({
1873
+ const e = await ga({
1857
1874
  // 分组,展示仓库链接
1858
1875
  format: ["group", "repo"],
1859
1876
  // 交互式弹窗
@@ -1870,8 +1887,8 @@ async function Wn() {
1870
1887
  }
1871
1888
  process.exit(0);
1872
1889
  }
1873
- async function Hn(e) {
1874
- T(f.resolve("node_modules", ".bin", "eslint")) || m("该项目未安装eslint,请安装后重试");
1890
+ async function qn(e) {
1891
+ j(f.resolve("node_modules", ".bin", "eslint")) || m("该项目未安装eslint,请安装后重试");
1875
1892
  const t = y("eslint执行中...").start();
1876
1893
  try {
1877
1894
  let a = "npx eslint '**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}' --fix";
@@ -1882,8 +1899,8 @@ async function Hn(e) {
1882
1899
  t.fail("eslint校验出错"), process.exit(1);
1883
1900
  }
1884
1901
  }
1885
- async function qn() {
1886
- T(f.resolve("node_modules", ".bin", "prettier")) || m("该项目未安装prettier,请安装后重试");
1902
+ async function Zn() {
1903
+ j(f.resolve("node_modules", ".bin", "prettier")) || m("该项目未安装prettier,请安装后重试");
1887
1904
  const e = y("prettier执行中...").start();
1888
1905
  try {
1889
1906
  await p(
@@ -1896,10 +1913,10 @@ async function qn() {
1896
1913
  e.fail("prettier校验出错"), process.exit(1);
1897
1914
  }
1898
1915
  }
1899
- function Zn() {
1900
- T(f.resolve("./node_modules/.bin/vue-tsc")) || m("请先安装vue-tsc。推荐命令: npm i -D vue-tsc"), Ve("npx vue-tsc --build"), process.exit(0);
1916
+ function Kn() {
1917
+ j(f.resolve("./node_modules/.bin/vue-tsc")) || m("请先安装vue-tsc。推荐命令: npm i -D vue-tsc"), Ve("npx vue-tsc --build"), process.exit(0);
1901
1918
  }
1902
- const Kn = [
1919
+ const Yn = [
1903
1920
  [
1904
1921
  "cm",
1905
1922
  "commit-msg"
@@ -1955,7 +1972,7 @@ const Kn = [
1955
1972
  "detect-push"
1956
1973
  /* DetectPush */
1957
1974
  ]
1958
- ], Yn = {
1975
+ ], Xn = {
1959
1976
  [$.JAVA]: [
1960
1977
  {
1961
1978
  name: "执行 check-style",
@@ -2002,30 +2019,30 @@ const Kn = [
2002
2019
  /* DependencyCheck */
2003
2020
  }
2004
2021
  ]
2005
- }, Xn = (e) => Reflect.get(Yn, e) ?? [], Qn = {
2006
- "commit-msg": Vn,
2007
- "commit-files": Gn,
2008
- prettier: qn,
2009
- eslint: Hn,
2010
- "type-check": Zn,
2011
- "dependency-check": Wn,
2012
- checkstyle: kn,
2013
- "markdown-lint": _n,
2014
- "delete-merged": Dn,
2015
- "not-allow-rebase": Fn,
2016
- "detect-push": zn
2017
- }, ei = async (e, t) => {
2018
- const a = Reflect.get(Qn, e);
2022
+ }, Qn = (e) => Reflect.get(Xn, e) ?? [], ei = {
2023
+ "commit-msg": Wn,
2024
+ "commit-files": Un,
2025
+ prettier: Zn,
2026
+ eslint: qn,
2027
+ "type-check": Kn,
2028
+ "dependency-check": Hn,
2029
+ checkstyle: En,
2030
+ "markdown-lint": Fn,
2031
+ "delete-merged": On,
2032
+ "not-allow-rebase": Gn,
2033
+ "detect-push": _n
2034
+ }, ti = async (e, t) => {
2035
+ const a = Reflect.get(ei, e);
2019
2036
  a && typeof a == "function" && await a(t);
2020
- }, ti = (e) => {
2021
- for (const [t, a] of Kn)
2037
+ }, ai = (e) => {
2038
+ for (const [t, a] of Yn)
2022
2039
  if (e === t || e === a)
2023
2040
  return a;
2024
2041
  m("参数输入错误");
2025
2042
  };
2026
- async function ai(e, t) {
2043
+ async function si(e, t) {
2027
2044
  ee(), H();
2028
- const a = V(), n = e ? ti(e) : await k({
2045
+ const a = W(), n = e ? ai(e) : await E({
2029
2046
  message: "请选择你要执行的操作",
2030
2047
  choices: [
2031
2048
  {
@@ -2033,7 +2050,7 @@ async function ai(e, t) {
2033
2050
  value: "prettier"
2034
2051
  /* Prettier */
2035
2052
  },
2036
- ...Xn(a.language),
2053
+ ...Qn(a.language),
2037
2054
  {
2038
2055
  name: "执行 delete-merged",
2039
2056
  value: "delete-merged"
@@ -2041,21 +2058,21 @@ async function ai(e, t) {
2041
2058
  }
2042
2059
  ]
2043
2060
  });
2044
- await ei(n, t);
2061
+ await ti(n, t);
2045
2062
  }
2046
2063
  P.command("run").alias("r").description("执行 eslint / prettier / type-check / dependency-check / checkstyle / markdown-lint / delete-merged。").argument(
2047
2064
  "[type]",
2048
2065
  "非必填。可选值为commit-msg|cm, commit-files|cf, prettier|p, eslint|e, type-check|tc, dependency-check|dc, checkstyle|cs, markdown-lint|ml, delete-merged|dm。"
2049
- ).option("--quiet", "eslint只打印error").option("--max-warnings [VALUE]", "eslint结果warn超过多少个会异常退出,默认为100", parseInt).action((...e) => B(ai, ...e));
2050
- async function zt(e = "latest") {
2066
+ ).option("--quiet", "eslint只打印error").option("--max-warnings [VALUE]", "eslint结果warn超过多少个会异常退出,默认为100", parseInt).action((...e) => B(si, ...e));
2067
+ async function Ft(e = "latest") {
2051
2068
  const t = y("安装中...").start();
2052
2069
  await p(`npm i -g ${ce.name}@${e} --registry https://registry.npmmirror.com/`), t.text = "本地配置更新中...", de("latestCheckVersionTimestamp", Date.now()), de("version", e);
2053
2070
  const a = await He();
2054
- Pe(a), X(), t.succeed(`升级完成,当前版本${e}`), process.exit(0);
2071
+ De(a), X(), t.succeed(`升级完成,当前版本${e}`), process.exit(0);
2055
2072
  }
2056
- P.command("update").alias("u").description("升级").argument("[version]", "版本号", "latest").action((...e) => B(zt, ...e));
2057
- const Ze = /Thumbs\.db|\.git|DS_Store|idea/, _t = "testcase";
2058
- function Ft(e) {
2073
+ P.command("update").alias("u").description("升级").argument("[version]", "版本号", "latest").action((...e) => B(Ft, ...e));
2074
+ const Ke = /Thumbs\.db|\.git|DS_Store|idea/, Gt = "testcase";
2075
+ function Jt(e) {
2059
2076
  const t = e.match(/^(.*[^[])?\[(\d+)]$/);
2060
2077
  if (t && !e.startsWith("["))
2061
2078
  return {
@@ -2075,14 +2092,14 @@ function Ft(e) {
2075
2092
  };
2076
2093
  }
2077
2094
  async function ie(e, t = {}) {
2078
- const { exclude: a = Ze } = t, n = [];
2095
+ const { exclude: a = Ke } = t, n = [];
2079
2096
  async function s(i) {
2080
2097
  const o = f.basename(i);
2081
- if ((await aa(i)).isFile())
2098
+ if ((await na(i)).isFile())
2082
2099
  return null;
2083
- const c = await Ge(i, { withFileTypes: !0 }), u = (await Promise.all(
2100
+ const c = await Ue(i, { withFileTypes: !0 }), u = (await Promise.all(
2084
2101
  c.filter((v) => v.isDirectory() && !a.test(v.name)).map((v) => s(f.join(i, v.name)))
2085
- )).filter(Boolean), { type: l, id: d, displayName: g } = Ft(o), h = {
2102
+ )).filter(Boolean), { type: l, id: d, displayName: g } = Jt(o), h = {
2086
2103
  name: o,
2087
2104
  id: d,
2088
2105
  displayName: g,
@@ -2094,13 +2111,13 @@ async function ie(e, t = {}) {
2094
2111
  }
2095
2112
  return await s(f.resolve(e)), n;
2096
2113
  }
2097
- async function Jt(e, t = {}) {
2098
- const { exclude: a = Ze } = t;
2114
+ async function Ut(e, t = {}) {
2115
+ const { exclude: a = Ke } = t;
2099
2116
  try {
2100
- const n = await Ge(f.resolve(e), { withFileTypes: !0 });
2117
+ const n = await Ue(f.resolve(e), { withFileTypes: !0 });
2101
2118
  return await Promise.all(
2102
2119
  n.filter((s) => s.isDirectory() && !a.test(s.name)).map((s) => {
2103
- const i = f.join(e, s.name), { type: o, id: r, displayName: c } = Ft(s.name);
2120
+ const i = f.join(e, s.name), { type: o, id: r, displayName: c } = Jt(s.name);
2104
2121
  return {
2105
2122
  name: s.name,
2106
2123
  id: r,
@@ -2124,31 +2141,31 @@ function Q(e, t, a) {
2124
2141
  return t;
2125
2142
  }
2126
2143
  }
2127
- async function Te(e, t, a, n) {
2144
+ async function je(e, t, a, n) {
2128
2145
  try {
2129
2146
  const s = f.basename(e), i = Q(a, t, n);
2130
2147
  if (s === i)
2131
2148
  return !0;
2132
2149
  const o = f.dirname(e), r = f.join(o, i);
2133
- return await Fa(e) ? await dt(e, r) : (await p(`git mv "${e}" "${r}"`), await p("git add .")), !0;
2150
+ return await Ja(e) ? await ft(e, r) : (await p(`git mv "${e}" "${r}"`), await p("git add .")), !0;
2134
2151
  } catch (s) {
2135
2152
  return m(`重命名文件夹失败: ${e} -> ${t}。${s}`), !1;
2136
2153
  }
2137
2154
  }
2138
- async function si(e, t, a = {}) {
2139
- const { exclude: n = Ze } = a;
2155
+ async function ni(e, t, a = {}) {
2156
+ const { exclude: n = Ke } = a;
2140
2157
  async function s(i, o) {
2141
2158
  if (!i || i.length === 0) return;
2142
- const r = await Jt(o, { exclude: n });
2159
+ const r = await Ut(o, { exclude: n });
2143
2160
  for (const c of i) {
2144
2161
  const u = String(c.value), l = Q("module", c.label, u), d = r.find((h) => h.id === u);
2145
2162
  let g = d?.path || f.join(o, l);
2146
- d ? d.displayName !== c.label && await Te(d.path, c.label, "module", u) && (g = f.join(o, l)) : (await fe(g, { recursive: !0 }), await p(`git add "${g}"`)), c.children && c.children.length > 0 && await s(c.children, g);
2163
+ d ? d.displayName !== c.label && await je(d.path, c.label, "module", u) && (g = f.join(o, l)) : (await fe(g, { recursive: !0 }), await p(`git add "${g}"`)), c.children && c.children.length > 0 && await s(c.children, g);
2147
2164
  }
2148
2165
  }
2149
2166
  await s(e, f.resolve(t));
2150
2167
  }
2151
- async function Gt(e) {
2168
+ async function Vt(e) {
2152
2169
  const t = {
2153
2170
  id: 0,
2154
2171
  name: "",
@@ -2157,8 +2174,8 @@ async function Gt(e) {
2157
2174
  if (e)
2158
2175
  Number.isNaN(Number(e)) && m("请输入正确的产品ID"), t.id = Number(e);
2159
2176
  else {
2160
- const a = await ns();
2161
- t.id = await k({
2177
+ const a = await rs();
2178
+ t.id = await E({
2162
2179
  message: "请选择产品",
2163
2180
  choices: a.map((n) => ({
2164
2181
  name: `${n.label}[${n.value}]`,
@@ -2166,33 +2183,33 @@ async function Gt(e) {
2166
2183
  }))
2167
2184
  });
2168
2185
  }
2169
- return t.name = await is(t.id), t.path = f.join(_t, Q("module", t.name, String(t.id))), t;
2186
+ return t.name = await os(t.id), t.path = f.join(Gt, Q("module", t.name, String(t.id))), t;
2170
2187
  }
2171
- async function Ke(e) {
2172
- return (await Jt(_t)).find((a) => Number(a.id) === e.id);
2188
+ async function Ye(e) {
2189
+ return (await Ut(Gt)).find((a) => Number(a.id) === e.id);
2173
2190
  }
2174
- async function Ut(e, t) {
2191
+ async function Wt(e, t) {
2175
2192
  const a = {
2176
2193
  precondition: e.precondition,
2177
2194
  priority: e.pri,
2178
2195
  steps: []
2179
2196
  };
2180
- a.steps = await os(e.id), L.writeJSONSync(t, a, {
2197
+ a.steps = await ls(e.id), L.writeJSONSync(t, a, {
2181
2198
  spaces: 2
2182
2199
  });
2183
2200
  }
2184
- async function Vt(e, t) {
2201
+ async function Ht(e, t) {
2185
2202
  await fe(t, {
2186
2203
  recursive: !0
2187
- }), await Ut(e, f.join(t, "config.json")), L.ensureFileSync(f.join(t, "data.yaml")), await _(
2204
+ }), await Wt(e, f.join(t, "config.json")), L.ensureFileSync(f.join(t, "data.yaml")), await _(
2188
2205
  f.join(t, "data.yaml"),
2189
- T(f.resolve(K, "data.yaml")) ? await ze(f.resolve(K, "data.yaml")) : await zs()
2206
+ j(f.resolve(K, "data.yaml")) ? await _e(f.resolve(K, "data.yaml")) : await Fs()
2190
2207
  ), L.ensureFileSync(f.join(t, "main.py")), await _(
2191
2208
  f.join(t, "main.py"),
2192
- T(f.resolve(K, "main.py")) ? await ze(f.resolve(K, "main.py")) : await _s()
2209
+ j(f.resolve(K, "main.py")) ? await _e(f.resolve(K, "main.py")) : await Gs()
2193
2210
  );
2194
2211
  }
2195
- function Ye(e) {
2212
+ function Xe(e) {
2196
2213
  if (e) {
2197
2214
  const t = e.split(",").map((a) => a.trim()).filter((a) => {
2198
2215
  const n = Number(a);
@@ -2202,12 +2219,12 @@ function Ye(e) {
2202
2219
  }
2203
2220
  return [];
2204
2221
  }
2205
- async function De(e, t) {
2222
+ async function Oe(e, t) {
2206
2223
  ee(), H(), await ge();
2207
2224
  let a;
2208
- t ? ([C.MODULE, C.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${C.MODULE} 或者 ${C.CASE}。`), a = t) : a = await k({
2225
+ t ? ([C.MODULE, C.CASE].includes(t) || m(`不支持的参数${t}。参数值应为 ${C.MODULE} 或者 ${C.CASE}。`), a = t) : a = await E({
2209
2226
  message: `请选择要${e}的数据类型`,
2210
- choices: Ia
2227
+ choices: Ca
2211
2228
  });
2212
2229
  const n = a === C.MODULE ? "模块" : C.CASE === a ? "用例" : "";
2213
2230
  return {
@@ -2215,19 +2232,19 @@ async function De(e, t) {
2215
2232
  typeStr: n
2216
2233
  };
2217
2234
  }
2218
- async function Oe(e) {
2219
- const t = await Gt(e), a = await Ke(t);
2235
+ async function Me(e) {
2236
+ const t = await Vt(e), a = await Ye(t);
2220
2237
  return a || m(`本地未找到产品【${t.name}[${t.id}]】`), {
2221
2238
  product: t,
2222
2239
  localProduct: a
2223
2240
  };
2224
2241
  }
2225
- async function ni(e, t, a) {
2226
- e.text = "查找本地产品目录...", await Ke(t) || m(`本地未找到产品【${t.name}[${t.id}]】`), e.text = "解析ID参数...";
2227
- const s = Ye(a);
2242
+ async function ii(e, t, a) {
2243
+ e.text = "查找本地产品目录...", await Ye(t) || m(`本地未找到产品【${t.name}[${t.id}]】`), e.text = "解析ID参数...";
2244
+ const s = Xe(a);
2228
2245
  let i = await ie(t.path);
2229
2246
  e.text = "获取远程用例列表...";
2230
- const o = await rs(t.id, s);
2247
+ const o = await cs(t.id, s);
2231
2248
  e.text = "本地用例同步中...";
2232
2249
  for (const r of o) {
2233
2250
  let c;
@@ -2235,26 +2252,26 @@ async function ni(e, t, a) {
2235
2252
  return m(`用例${r.title}[${r.id}]未找到所属模块(${r.module}),请先拉取模块`);
2236
2253
  const u = i.find(({ id: l }) => r.id === Number(l));
2237
2254
  if (u)
2238
- u.displayName !== r.title && await Te(u.path, r.title, u.type, u.id) && U(`重命名成功: ${u.displayName} -> ${r.title}`), i = await ie(t.path), r.module === 0 ? c = f.resolve(t.path) : c = i.find((l) => Number(l.id) === r.module)?.path || "", await Ut(
2255
+ u.displayName !== r.title && await je(u.path, r.title, u.type, u.id) && U(`重命名成功: ${u.displayName} -> ${r.title}`), i = await ie(t.path), r.module === 0 ? c = f.resolve(t.path) : c = i.find((l) => Number(l.id) === r.module)?.path || "", await Wt(
2239
2256
  r,
2240
2257
  f.join(c, Q("case", r.title, String(r.id)), "config.json")
2241
2258
  );
2242
2259
  else {
2243
2260
  const l = f.join(c, Q("case", r.title, String(r.id)));
2244
- await Vt(r, l);
2261
+ await Ht(r, l);
2245
2262
  }
2246
2263
  }
2247
2264
  }
2248
- async function ii(e, t) {
2249
- e.text = "本地产品目录查找中...";
2250
- const a = await Ke(t);
2251
- a ? (e.text = "找到产品目录。开始重命名...", a.displayName !== t.name && await Te(a.path, t.name, a.type, a.id) && (e.text = `重命名成功: ${a.displayName} -> ${t.name}`)) : (e.text = "未找到。开始创建产品目录...", await fe(t.path, { recursive: !0 }), await p("git add .")), e.text = "获取远程模块列表...";
2252
- const n = await It(t.id);
2253
- e.text = "本地同步模块中...", await si(n || [], t.path);
2254
- }
2255
2265
  async function ri(e, t) {
2256
- const { type: a, typeStr: n } = await De("拉取", e), s = await Gt(t.productId), i = y(`${n}同步中...`).start();
2257
- if (C.MODULE === a && await ii(i, s), C.CASE === a && await ni(i, s, t.caseIds), i.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await p("git status -s")) {
2266
+ e.text = "本地产品目录查找中...";
2267
+ const a = await Ye(t);
2268
+ a ? (e.text = "找到产品目录。开始重命名...", a.displayName !== t.name && await je(a.path, t.name, a.type, a.id) && (e.text = `重命名成功: ${a.displayName} -> ${t.name}`)) : (e.text = "未找到。开始创建产品目录...", await fe(t.path, { recursive: !0 }), await p("git add .")), e.text = "获取远程模块列表...";
2269
+ const n = await Rt(t.id);
2270
+ e.text = "本地同步模块中...", await ni(n || [], t.path);
2271
+ }
2272
+ async function oi(e, t) {
2273
+ const { type: a, typeStr: n } = await Oe("拉取", e), s = await Vt(t.productId), i = y(`${n}同步中...`).start();
2274
+ if (C.MODULE === a && await ri(i, s), C.CASE === a && await ii(i, s, t.caseIds), i.succeed(`${n}同步完成 🎉`), !t.disableAutoCommit && await p("git status -s")) {
2258
2275
  const o = y("代码提交中...").start();
2259
2276
  try {
2260
2277
  await p(`git add . && git commit -m "chore: 同步禅道${n}数据"`), o.succeed("代码已提交 ✅");
@@ -2263,15 +2280,15 @@ async function ri(e, t) {
2263
2280
  }
2264
2281
  }
2265
2282
  }
2266
- P.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(ri, ...e));
2267
- async function oi(e, t, a) {
2283
+ P.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(oi, ...e));
2284
+ async function ci(e, t, a) {
2268
2285
  let n = await F({
2269
2286
  message: "请输入你要创建的用例的前置条件(可不填)"
2270
2287
  });
2271
2288
  n = n.trim();
2272
2289
  const s = y(`用例【${a}】开始创建...`).start();
2273
2290
  s.text = "远程用例创建中...";
2274
- const i = await ls({
2291
+ const i = await ps({
2275
2292
  product: Number(e.id),
2276
2293
  // 如果父模块是产品根目录,parent=0
2277
2294
  module: f.resolve(e?.path) === t?.path ? 0 : Number(t?.id || 0),
@@ -2280,14 +2297,14 @@ async function oi(e, t, a) {
2280
2297
  openedBy: I("ldapAccount"),
2281
2298
  precondition: n || ""
2282
2299
  });
2283
- s.text = "远程用例步骤创建中...", await us({
2300
+ s.text = "远程用例步骤创建中...", await ms({
2284
2301
  case: i,
2285
2302
  type: "step",
2286
2303
  desc: "按照预期执行",
2287
2304
  expect: "正常执行,符合预期"
2288
2305
  }), s.text = "本地用例创建中...";
2289
2306
  const o = f.join(t.path, Q("case", a, String(i)));
2290
- return T(o) ? U(`${o}已存在,请检查是否对应,本地不再创建。`) : (await Vt(
2307
+ return j(o) ? U(`${o}已存在,请检查是否对应,本地不再创建。`) : (await Ht(
2291
2308
  {
2292
2309
  id: i,
2293
2310
  pri: 3,
@@ -2296,10 +2313,10 @@ async function oi(e, t, a) {
2296
2313
  o
2297
2314
  ), s.succeed(`用例【[${o}】创建完成 🎉`), o);
2298
2315
  }
2299
- async function ci(e, t, a) {
2316
+ async function li(e, t, a) {
2300
2317
  const n = y(`模块【${a}】开始创建...`).start();
2301
2318
  n.text = "远程模块创建中...";
2302
- const s = await cs({
2319
+ const s = await us({
2303
2320
  root: Number(e.id),
2304
2321
  name: a,
2305
2322
  // 如果父模块是产品根目录,parent=0
@@ -2307,13 +2324,13 @@ async function ci(e, t, a) {
2307
2324
  });
2308
2325
  n.text = "本地模块创建中...";
2309
2326
  const i = f.join(t.path, Q("module", a, String(s)));
2310
- if (T(i))
2327
+ if (j(i))
2311
2328
  return U(`${i}已存在,请检查是否对应,本地不再创建。`);
2312
2329
  await fe(i, {
2313
2330
  recursive: !0
2314
2331
  }), n.succeed(`模块【${i}】创建完成 🎉`);
2315
2332
  }
2316
- function li(e) {
2333
+ function ui(e) {
2317
2334
  function t(n) {
2318
2335
  if (!n.children || n.children.length === 0) return;
2319
2336
  const s = n.children[0];
@@ -2326,7 +2343,7 @@ function li(e) {
2326
2343
  });
2327
2344
  }
2328
2345
  async function a(n, s = []) {
2329
- const i = s.length ? `请选择层级(当前:${s.join(" / ")})` : "请选择层级", o = await k({
2346
+ const i = s.length ? `请选择层级(当前:${s.join(" / ")})` : "请选择层级", o = await E({
2330
2347
  message: i,
2331
2348
  choices: n.map((r) => ({
2332
2349
  name: `${r.tempTitle ? r.tempTitle : r.label} ${r.children?.length ? "(有子级)" : ""}`,
@@ -2337,9 +2354,9 @@ function li(e) {
2337
2354
  }
2338
2355
  return a(e);
2339
2356
  }
2340
- async function ui(e, t) {
2341
- const { type: a, typeStr: n } = await De("创建", e), { product: s, localProduct: i } = await Oe(t.productId), o = await It(s.id), r = await li(o), c = Q("module", r.label, String(r.value)), l = (await ie(s.path, { hasRoot: !0 })).find((h) => h.name === c);
2342
- if (!l?.path || !T(l.path))
2357
+ async function pi(e, t) {
2358
+ const { type: a, typeStr: n } = await Oe("创建", e), { product: s, localProduct: i } = await Me(t.productId), o = await Rt(s.id), r = await ui(o), c = Q("module", r.label, String(r.value)), l = (await ie(s.path, { hasRoot: !0 })).find((h) => h.name === c);
2359
+ if (!l?.path || !j(l.path))
2343
2360
  return m(`本地不存在${c}模块`);
2344
2361
  let d = await F({
2345
2362
  message: `请输入你要创建的${n}名称`,
@@ -2348,7 +2365,7 @@ async function ui(e, t) {
2348
2365
  });
2349
2366
  d = d.trim();
2350
2367
  let g = "";
2351
- if (C.MODULE === a && await ci(i, l, d), C.CASE === a && (g = await oi(i, l, d)), !t.disableAutoCommit && C.CASE === a) {
2368
+ if (C.MODULE === a && await li(i, l, d), C.CASE === a && (g = await ci(i, l, d)), !t.disableAutoCommit && C.CASE === a) {
2352
2369
  const h = y("代码提交中...").start();
2353
2370
  try {
2354
2371
  await p(`git add . && git commit -m "chore: 创建了用例${f.basename(g)}"`), h.succeed("代码已提交 ✅");
@@ -2357,8 +2374,8 @@ async function ui(e, t) {
2357
2374
  }
2358
2375
  }
2359
2376
  }
2360
- P.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => B(ui, ...e));
2361
- async function pi(e, t) {
2377
+ P.command("qa-create").alias("qc").description("创建模块或者用例").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => B(pi, ...e));
2378
+ async function mi(e, t) {
2362
2379
  const n = (await ie(e.path)).filter((r) => r.type === "case");
2363
2380
  let s = [];
2364
2381
  if (t.length)
@@ -2374,7 +2391,7 @@ async function pi(e, t) {
2374
2391
  },
2375
2392
  name: c.path.replace(f.resolve(e.path), "")
2376
2393
  }));
2377
- s = await W({
2394
+ s = await V({
2378
2395
  message: "选择要删除的用例",
2379
2396
  pageSize: 100,
2380
2397
  loop: !1,
@@ -2385,15 +2402,15 @@ async function pi(e, t) {
2385
2402
  });
2386
2403
  }
2387
2404
  const i = y("远程用例删除中...").start(), o = s.map((r) => r.id);
2388
- await ms({
2405
+ await fs({
2389
2406
  product: Number(e.id),
2390
2407
  caseIds: o
2391
2408
  }), i.text = "本地用例删除中...";
2392
2409
  for (const r of s)
2393
- T(r.path) && N.rm("-rf", r.path);
2410
+ j(r.path) && N.rm("-rf", r.path);
2394
2411
  return i.succeed("用例删除完成"), o;
2395
2412
  }
2396
- async function mi(e, t) {
2413
+ async function di(e, t) {
2397
2414
  const n = (await ie(e.path)).filter((r) => r.type === "module");
2398
2415
  let s = [];
2399
2416
  if (t.length)
@@ -2409,7 +2426,7 @@ async function mi(e, t) {
2409
2426
  },
2410
2427
  name: c.path.replace(f.resolve(e.path), "")
2411
2428
  }));
2412
- s = await W({
2429
+ s = await V({
2413
2430
  message: "选择要删除的模块",
2414
2431
  pageSize: 100,
2415
2432
  loop: !1,
@@ -2421,18 +2438,18 @@ async function mi(e, t) {
2421
2438
  }
2422
2439
  s = s.sort((r, c) => r.path.localeCompare(c.path));
2423
2440
  const i = y("远程模块删除中...").start(), o = s.map((r) => r.id);
2424
- await ps({
2441
+ await ds({
2425
2442
  product: Number(e.id),
2426
2443
  moduleIds: o
2427
2444
  }), i.text = "本地模块删除中...";
2428
2445
  for (const r of s)
2429
- T(r.path) && N.rm("-rf", r.path);
2446
+ j(r.path) && N.rm("-rf", r.path);
2430
2447
  return i.succeed("模块删除完成"), o;
2431
2448
  }
2432
- async function di(e, t) {
2433
- const { type: a, typeStr: n } = await De("删除", e), { localProduct: s } = await Oe(t.productId), i = Ye(t.targetIds);
2449
+ async function fi(e, t) {
2450
+ const { type: a, typeStr: n } = await Oe("删除", e), { localProduct: s } = await Me(t.productId), i = Xe(t.targetIds);
2434
2451
  let o = [];
2435
- if (C.MODULE === a ? o = await mi(s, i) : C.CASE === a && (o = await pi(s, i)), !t.disableAutoCommit && await p("git status -s")) {
2452
+ if (C.MODULE === a ? o = await di(s, i) : C.CASE === a && (o = await mi(s, i)), !t.disableAutoCommit && await p("git status -s")) {
2436
2453
  const r = y("代码提交中...").start();
2437
2454
  try {
2438
2455
  await p(`git add . && git commit -m 'chore: 删除了一些${n}(${o.join(", ")})'`), r.succeed("代码已提交 ✅");
@@ -2441,8 +2458,8 @@ async function di(e, t) {
2441
2458
  }
2442
2459
  }
2443
2460
  }
2444
- P.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(di, ...e));
2445
- async function fi(e, t) {
2461
+ P.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(fi, ...e));
2462
+ async function gi(e, t) {
2446
2463
  const n = (await ie(e.path)).filter((g) => g.type === "case");
2447
2464
  let s;
2448
2465
  if (t.targetId) {
@@ -2457,7 +2474,7 @@ async function fi(e, t) {
2457
2474
  },
2458
2475
  name: h.path.replace(f.resolve(e.path), "")
2459
2476
  }));
2460
- [s] = await W({
2477
+ [s] = await V({
2461
2478
  message: "选择要更新的用例",
2462
2479
  pageSize: 100,
2463
2480
  loop: !1,
@@ -2477,19 +2494,19 @@ async function fi(e, t) {
2477
2494
  });
2478
2495
  i = i.trim();
2479
2496
  const o = y("用例重命名中...").start();
2480
- i !== s.displayName ? (await fs({
2497
+ i !== s.displayName ? (await hs({
2481
2498
  id: Number(s.id),
2482
2499
  name: i
2483
- }), await Te(s.path, i, "case", String(s.id)) && o.succeed(`用例重命名成功: ${s.displayName} -> ${i}`), s.displayName = i, s.path = f.join(f.dirname(s.path), Q("case", i, String(s.id)))) : o.succeed("用例名称无变动");
2500
+ }), await je(s.path, i, "case", String(s.id)) && o.succeed(`用例重命名成功: ${s.displayName} -> ${i}`), s.displayName = i, s.path = f.join(f.dirname(s.path), Q("case", i, String(s.id)))) : o.succeed("用例名称无变动");
2484
2501
  let r = L.readJsonSync(f.join(s.path, "config.json")), c;
2485
- t.casePriority ? Number.isInteger(t.casePriority) && Number(t.casePriority) > 0 && Number(t.casePriority) < 6 ? c = Number(t.casePriority) : c = await tt({
2502
+ t.casePriority ? Number.isInteger(t.casePriority) && Number(t.casePriority) > 0 && Number(t.casePriority) < 6 ? c = Number(t.casePriority) : c = await at({
2486
2503
  message: "修改用例优先级",
2487
2504
  min: 1,
2488
2505
  max: 5,
2489
2506
  required: !0,
2490
2507
  default: r.priority,
2491
2508
  validate: (g) => g > 0 && g < 6
2492
- }) : c = await tt({
2509
+ }) : c = await at({
2493
2510
  message: "修改用例优先级",
2494
2511
  min: 1,
2495
2512
  max: 5,
@@ -2498,7 +2515,7 @@ async function fi(e, t) {
2498
2515
  validate: (g) => g > 0 && g < 6
2499
2516
  });
2500
2517
  const u = y("用例优先级设置中...").start();
2501
- c !== r.priority ? (await gs({
2518
+ c !== r.priority ? (await ws({
2502
2519
  id: Number(s.id),
2503
2520
  priority: c
2504
2521
  }), L.writeJSONSync(
@@ -2516,7 +2533,7 @@ async function fi(e, t) {
2516
2533
  prefill: "editable"
2517
2534
  }), l = l.trim());
2518
2535
  const d = y("用例前置条件设置中...").start();
2519
- return l !== r.precondition ? (await hs({
2536
+ return l !== r.precondition ? (await ys({
2520
2537
  id: Number(s.id),
2521
2538
  precondition: l
2522
2539
  }), L.writeJSONSync(
@@ -2528,7 +2545,7 @@ async function fi(e, t) {
2528
2545
  { spaces: 2 }
2529
2546
  ), d.succeed(`用例前置条件修改成功:${r.precondition} -> ${l}`)) : d.succeed("用例前置条件无变动"), s.id;
2530
2547
  }
2531
- async function gi(e, t) {
2548
+ async function hi(e, t) {
2532
2549
  const n = (await ie(e.path)).filter((r) => r.type === "module");
2533
2550
  let s;
2534
2551
  if (t.targetId) {
@@ -2543,7 +2560,7 @@ async function gi(e, t) {
2543
2560
  },
2544
2561
  name: c.path.replace(f.resolve(e.path), "")
2545
2562
  }));
2546
- [s] = await W({
2563
+ [s] = await V({
2547
2564
  message: "选择要更新的模块",
2548
2565
  pageSize: 100,
2549
2566
  loop: !1,
@@ -2563,15 +2580,15 @@ async function gi(e, t) {
2563
2580
  });
2564
2581
  i = i.trim();
2565
2582
  const o = y("模块重命名中...").start();
2566
- return i !== s.displayName ? (await ds({
2583
+ return i !== s.displayName ? (await gs({
2567
2584
  id: Number(s.id),
2568
2585
  name: i
2569
- }), await Te(s.path, i, "module", String(s.id)) && o.succeed(`模块重命名成功: ${s.displayName} -> ${i}`)) : o.succeed("模块名称无变动"), s.id;
2586
+ }), await je(s.path, i, "module", String(s.id)) && o.succeed(`模块重命名成功: ${s.displayName} -> ${i}`)) : o.succeed("模块名称无变动"), s.id;
2570
2587
  }
2571
- async function hi(e, t) {
2572
- const { type: a, typeStr: n } = await De("修改", e), { localProduct: s } = await Oe(t.productId);
2588
+ async function wi(e, t) {
2589
+ const { type: a, typeStr: n } = await Oe("修改", e), { localProduct: s } = await Me(t.productId);
2573
2590
  let i;
2574
- if (C.MODULE === a ? i = await gi(s, t) : C.CASE === a && (i = await fi(s, t)), !t.disableAutoCommit && await p("git status -s")) {
2591
+ if (C.MODULE === a ? i = await hi(s, t) : C.CASE === a && (i = await gi(s, t)), !t.disableAutoCommit && await p("git status -s")) {
2575
2592
  const o = y("代码提交中...").start();
2576
2593
  try {
2577
2594
  await p(`git add . && git commit -m 'chore: 修改了一个${n}(${i})'`), o.succeed("代码已提交 ✅");
@@ -2580,11 +2597,11 @@ async function hi(e, t) {
2580
2597
  }
2581
2598
  }
2582
2599
  }
2583
- P.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(hi, ...e));
2584
- async function wi(e, t) {
2600
+ P.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(wi, ...e));
2601
+ async function yi(e, t) {
2585
2602
  if (!e.length)
2586
2603
  return [];
2587
- const a = fa(20), n = e.map(
2604
+ const a = ha(20), n = e.map(
2588
2605
  (s) => a(async () => {
2589
2606
  try {
2590
2607
  const i = t.env || "production", o = await p(`python ${s.path}/main.py --env ${i}`);
@@ -2601,9 +2618,9 @@ async function wi(e, t) {
2601
2618
  );
2602
2619
  return await Promise.all(n), e;
2603
2620
  }
2604
- async function yi(e) {
2621
+ async function $i(e) {
2605
2622
  ee(), H();
2606
- const { localProduct: t } = await Oe(e.productId);
2623
+ const { localProduct: t } = await Me(e.productId);
2607
2624
  let a = [];
2608
2625
  const s = (await ie(t.path)).filter((c) => c.type === "case");
2609
2626
  if (e.all)
@@ -2613,7 +2630,7 @@ async function yi(e) {
2613
2630
  displayName: c.displayName
2614
2631
  }));
2615
2632
  else {
2616
- const c = Ye(e.caseIds);
2633
+ const c = Xe(e.caseIds);
2617
2634
  if (c.length)
2618
2635
  a = s.filter((u) => c.includes(Number(u.id))).map((u) => ({
2619
2636
  id: Number(u.id),
@@ -2629,7 +2646,7 @@ async function yi(e) {
2629
2646
  },
2630
2647
  name: l.path.replace(f.resolve(t.path), "")
2631
2648
  }));
2632
- a = await W({
2649
+ a = await V({
2633
2650
  message: "选择要执行的用例",
2634
2651
  pageSize: 100,
2635
2652
  loop: !1,
@@ -2640,7 +2657,7 @@ async function yi(e) {
2640
2657
  });
2641
2658
  }
2642
2659
  }
2643
- const i = y("用例执行中...").start(), r = (await wi(a, e)).filter((c) => c.result.length);
2660
+ const i = y("用例执行中...").start(), r = (await yi(a, e)).filter((c) => c.result.length);
2644
2661
  if (r.length === 0)
2645
2662
  i.succeed("所有用例执行通过 🎉");
2646
2663
  else {
@@ -2652,11 +2669,11 @@ async function yi(e) {
2652
2669
  if (e.executionId)
2653
2670
  Number.isNaN(Number(e.executionId)) && m(`executionId ${e.executionId}不是正整数`), u = Number(e.executionId);
2654
2671
  else {
2655
- const d = await ys(), g = await k({
2672
+ const d = await vs(), g = await E({
2656
2673
  message: "请选择用例执行出错后,BUG所属的项目",
2657
2674
  choices: d.map(({ id: v, name: R }) => ({ name: R, value: v }))
2658
- }), h = await $s(g);
2659
- u = await k({
2675
+ }), h = await As(g);
2676
+ u = await E({
2660
2677
  message: "请选择用例执行出错后,BUG所属的执行",
2661
2678
  choices: h.map(({ id: v, name: R }) => ({ name: R, value: v }))
2662
2679
  });
@@ -2665,7 +2682,7 @@ async function yi(e) {
2665
2682
  if (e.buildId)
2666
2683
  l = e.buildId;
2667
2684
  else {
2668
- const d = await vs(Number(u));
2685
+ const d = await bs(Number(u));
2669
2686
  if (d.length) {
2670
2687
  const g = await Re({
2671
2688
  message: "请选择BUG关联的构建版本(可多选;非必选,默认主干)",
@@ -2681,7 +2698,7 @@ async function yi(e) {
2681
2698
  }
2682
2699
  i.start("上传中...");
2683
2700
  for (const d of r)
2684
- await ws({
2701
+ await $s({
2685
2702
  caseId: d.id,
2686
2703
  caseResult: "fail",
2687
2704
  stepResults: d.result,
@@ -2694,12 +2711,12 @@ async function yi(e) {
2694
2711
  );
2695
2712
  }
2696
2713
  }
2697
- P.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(yi, ...e));
2698
- const $i = async () => {
2699
- const { projects: e } = await Ps(), t = V();
2714
+ P.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($i, ...e));
2715
+ const vi = async () => {
2716
+ const { projects: e } = await Os(), t = W();
2700
2717
  if (t.serverProjectURL) {
2701
2718
  const n = e.find(
2702
- (s) => Ue(s.url, t.serverProjectURL)
2719
+ (s) => Pe(s.url, t.serverProjectURL)
2703
2720
  );
2704
2721
  if (n)
2705
2722
  return {
@@ -2707,18 +2724,18 @@ const $i = async () => {
2707
2724
  moduleList: n.modules || []
2708
2725
  };
2709
2726
  }
2710
- const a = await k({
2727
+ const a = await E({
2711
2728
  message: "请选择本项目对应的服务端项目",
2712
2729
  choices: e.map((n) => ({
2713
2730
  name: `${n.name}(${n.url})`,
2714
2731
  value: n.url
2715
2732
  }))
2716
2733
  });
2717
- return Et({ ...t, serverProjectURL: a }), {
2734
+ return It({ ...t, serverProjectURL: a }), {
2718
2735
  projectId: decodeURIComponent(se(a)),
2719
2736
  moduleList: e.find((n) => n.url === a)?.modules || []
2720
2737
  };
2721
- }, vi = async (e, t) => {
2738
+ }, Ai = async (e, t) => {
2722
2739
  const a = t ? t.split(",").filter((s) => e.map((i) => i.name).includes(s.trim())) : [];
2723
2740
  if (a.length)
2724
2741
  return a;
@@ -2733,42 +2750,42 @@ const $i = async () => {
2733
2750
  loop: !0
2734
2751
  });
2735
2752
  return n?.length ? n : e.map((s) => s.name);
2736
- }, ut = [O.DEV, O.TEST], Ai = async (e) => e && ut.includes(e.trim()) ? e : await k({
2753
+ }, pt = [O.DEV, O.TEST], bi = async (e) => e && pt.includes(e.trim()) ? e : await E({
2737
2754
  message: "请选择对应的环境",
2738
- choices: vt.filter((t) => ut.includes(t.value))
2739
- }), Xe = (e) => {
2755
+ choices: At.filter((t) => pt.includes(t.value))
2756
+ }), Qe = (e) => {
2740
2757
  const t = /^https?:\/\/[^/]+\/api\/([^/]+)\/v3\//;
2741
2758
  return e.match(t)?.[1];
2742
- }, bi = async (e, t) => {
2759
+ }, Si = async (e, t) => {
2743
2760
  try {
2744
2761
  const a = await ne({
2745
2762
  url: e,
2746
2763
  method: "get"
2747
- }), n = Xe(e);
2764
+ }), n = Qe(e);
2748
2765
  return n && (a.paths = Object.fromEntries(
2749
2766
  Object.entries(a.paths).map(([s, i]) => [`/${n}${s}`, i])
2750
- )), ga(a, {
2767
+ )), wa(a, {
2751
2768
  throwOnValidateError: !t
2752
2769
  });
2753
2770
  } catch (a) {
2754
2771
  throw m(`Error fetching Swagger JSON: ${a.message}`), a;
2755
2772
  }
2756
- }, Si = (e) => {
2773
+ }, Ni = (e) => {
2757
2774
  const t = (a) => {
2758
2775
  const { reason: n, url: s } = a;
2759
- return `## ${Xe(s)}服务接口文档校验失败
2776
+ return `## ${Qe(s)}服务接口文档校验失败
2760
2777
  ${n.message}`;
2761
2778
  };
2762
2779
  return `# 服务端接口文档校验失败
2763
2780
  ${e.map(t).join(`
2764
2781
  `)}`;
2765
- }, Ni = async (e, t) => {
2766
- const a = Si(e), n = V(), { groups: s } = await Rt(), i = s.find(
2767
- (c) => c.projects.some((u) => Ue(u, n.serverProjectURL))
2782
+ }, ji = async (e, t) => {
2783
+ const a = Ni(e), n = W(), { groups: s } = await Ct(), i = s.find(
2784
+ (c) => c.projects.some((u) => Pe(u, n.serverProjectURL))
2768
2785
  );
2769
2786
  t.fail("API数据解析失败"), i || (t.fail("未找到对应的项目群聊组!"), process.stdout.write(`${A.red(a)}
2770
2787
  `), process.exit(1));
2771
- const { code: o, message: r } = await As({
2788
+ const { code: o, message: r } = await Ss({
2772
2789
  content: a,
2773
2790
  webhooks: [i.url]
2774
2791
  });
@@ -2784,11 +2801,11 @@ ${e.map(t).join(`
2784
2801
  });
2785
2802
  if (!o.length)
2786
2803
  throw new Error("Failed to fetch Swagger JSON");
2787
- const r = y("API数据请求中...").start(), c = await Promise.allSettled(o.map((l) => bi(l, s))), u = c.flatMap(
2804
+ const r = y("API数据请求中...").start(), c = await Promise.allSettled(o.map((l) => Si(l, s))), u = c.flatMap(
2788
2805
  (l, d) => l.status === "rejected" ? [{ reason: l.reason, url: o[d] }] : []
2789
2806
  );
2790
- return u.length && await Ni(u, r), r.succeed("API数据请求成功"), c.flatMap((l, d) => l.status === "fulfilled" ? [{ serverName: Xe(o[d]), swaggerJson: l.value }] : []);
2791
- }, ji = () => k({
2807
+ return u.length && await ji(u, r), r.succeed("API数据请求成功"), c.flatMap((l, d) => l.status === "fulfilled" ? [{ serverName: Qe(o[d]), swaggerJson: l.value }] : []);
2808
+ }, ki = () => E({
2792
2809
  message: "请选择生成API的范围",
2793
2810
  choices: [
2794
2811
  {
@@ -2809,7 +2826,7 @@ ${e.map(t).join(`
2809
2826
  formatShowToValue: i
2810
2827
  }) => {
2811
2828
  const o = i ? typeof i == "function" ? i : (r) => r.map((c) => String(c.value)).join(", ") : void 0;
2812
- return W({
2829
+ return V({
2813
2830
  message: e,
2814
2831
  pageSize: n,
2815
2832
  clearInputWhenSelected: !0,
@@ -2824,28 +2841,28 @@ ${e.map(t).join(`
2824
2841
  }
2825
2842
  } : void 0
2826
2843
  });
2827
- }, pt = (e) => {
2844
+ }, mt = (e) => {
2828
2845
  const t = e.trim();
2829
2846
  if (!t)
2830
2847
  return "请输入生成目录";
2831
2848
  if (t.includes("\0"))
2832
2849
  return "路径格式不合法";
2833
- if (sa(t))
2850
+ if (ia(t))
2834
2851
  return "只允许输入相对路径";
2835
- const a = na(t);
2836
- return !a || a === "." || a === ".." ? "请输入有效的目录路径" : a.startsWith(`..${ia}`) ? "路径不能跳出当前项目" : !0;
2837
- }, ki = (e) => {
2852
+ const a = ra(t);
2853
+ return !a || a === "." || a === ".." ? "请输入有效的目录路径" : a.startsWith(`..${oa}`) ? "路径不能跳出当前项目" : !0;
2854
+ }, Ei = (e) => {
2838
2855
  if (e) {
2839
- const t = pt(e);
2856
+ const t = mt(e);
2840
2857
  return t !== !0 && m(t), e;
2841
2858
  }
2842
2859
  return F({
2843
2860
  message: "请输入 API 输出目录,默认为 src/services",
2844
2861
  default: "src/services",
2845
- validate: pt
2862
+ validate: mt
2846
2863
  });
2847
2864
  };
2848
- class Wt {
2865
+ class qt {
2849
2866
  o;
2850
2867
  options;
2851
2868
  async generateApi(t) {
@@ -2857,7 +2874,7 @@ class Wt {
2857
2874
  const t = [], a = this.options.remoteSwaggerJsons.map((n) => n.swaggerJson);
2858
2875
  this.o.text = "获取 API 列表...";
2859
2876
  for (const n of a) {
2860
- const { apis: s } = await ha(n, {
2877
+ const { apis: s } = await ya(n, {
2861
2878
  throwOnValidateError: !this.options.skipSwaggerValidate
2862
2879
  });
2863
2880
  t.push(...s.map((i) => ({ name: `${i.path}${i.summary ? `(${i.summary})` : ""}`, value: i.path })));
@@ -2879,8 +2896,8 @@ class Wt {
2879
2896
  async startGenerateAllApi() {
2880
2897
  const t = await this.generateAllApi();
2881
2898
  this.o.stop();
2882
- const a = await ki(this.options.dir), n = pe(a);
2883
- Qt(n, { recursive: !0 });
2899
+ const a = await Ei(this.options.dir), n = pe(a);
2900
+ ta(n, { recursive: !0 });
2884
2901
  const s = [];
2885
2902
  this.o.start(), this.o.text = "API 生成中...";
2886
2903
  for (const i of t) {
@@ -2890,13 +2907,13 @@ class Wt {
2890
2907
  this.o.text = "开始格式化代码", await this.formatApiContent(s), this.o.text = "代码格式化完成", this.o.succeed(`API 已生成到 ${a} 目录下`);
2891
2908
  }
2892
2909
  }
2893
- class Ei extends Wt {
2910
+ class Ii extends qt {
2894
2911
  formatApiContent() {
2895
2912
  return this.o.succeed("yaml 暂无格式化配置"), Promise.resolve();
2896
2913
  }
2897
2914
  generateAllApi() {
2898
2915
  const t = this.options.remoteSwaggerJsons.map((a) => a.swaggerJson);
2899
- return wa(
2916
+ return $a(
2900
2917
  t.map((a) => ({
2901
2918
  swaggerJson: a,
2902
2919
  throwOnValidateError: !this.options.skipSwaggerValidate
@@ -2908,26 +2925,26 @@ class Ei extends Wt {
2908
2925
  for (const { swaggerJson: s, serverName: i } of a) {
2909
2926
  if (!t.some((r) => r.startsWith(`/${i}`)))
2910
2927
  continue;
2911
- const o = await ya({
2928
+ const o = await va({
2912
2929
  swaggerJson: s,
2913
2930
  controller: t,
2914
2931
  throwOnValidateError: !n,
2915
2932
  showHeaderComment: !1
2916
2933
  });
2917
- console.log(gt(o, { language: "typescript", ignoreIllegals: !0 }));
2934
+ console.log(ht(o, { language: "typescript", ignoreIllegals: !0 }));
2918
2935
  }
2919
2936
  }
2920
2937
  }
2921
- const Ii = new ht({
2938
+ const Ri = new wt({
2922
2939
  fix: !0
2923
2940
  });
2924
- class Ri extends Wt {
2941
+ class Ci extends qt {
2925
2942
  async formatApiContent(t) {
2926
2943
  try {
2927
- const a = await Ii.lintFiles(t);
2928
- await ht.outputFixes(a);
2944
+ const a = await Ri.lintFiles(t);
2945
+ await wt.outputFixes(a);
2929
2946
  for (const n of t) {
2930
- const s = pe(n), i = mt(s, "utf-8"), o = await Aa.format(i, {
2947
+ const s = pe(n), i = dt(s, "utf-8"), o = await Sa.format(i, {
2931
2948
  filepath: s
2932
2949
  });
2933
2950
  ve(s, o);
@@ -2938,7 +2955,7 @@ class Ri extends Wt {
2938
2955
  }
2939
2956
  generateAllApi() {
2940
2957
  const t = this.options.remoteSwaggerJsons.map((a) => a.swaggerJson);
2941
- return $a(
2958
+ return Aa(
2942
2959
  t.map((a) => ({
2943
2960
  swaggerJson: a,
2944
2961
  throwOnValidateError: !this.options.skipSwaggerValidate
@@ -2950,45 +2967,45 @@ class Ri extends Wt {
2950
2967
  for (const { swaggerJson: s, serverName: i } of a) {
2951
2968
  if (!t.some((r) => r.startsWith(`/${i}`)))
2952
2969
  continue;
2953
- const o = await va({
2970
+ const o = await ba({
2954
2971
  swaggerJson: s,
2955
2972
  merge: !0,
2956
2973
  controller: t,
2957
2974
  throwOnValidateError: !n,
2958
2975
  importMethods: !1
2959
2976
  });
2960
- console.log(gt(o, { language: "typescript", ignoreIllegals: !0 }));
2977
+ console.log(ht(o, { language: "typescript", ignoreIllegals: !0 }));
2961
2978
  }
2962
2979
  }
2963
2980
  }
2964
- const Ci = (e) => {
2981
+ const Li = (e) => {
2965
2982
  switch (e) {
2966
2983
  case $.JAVASCRIPT:
2967
- return Ri;
2984
+ return Ci;
2968
2985
  case $.PYTHON:
2969
- return Ei;
2986
+ return Ii;
2970
2987
  }
2971
- }, Li = async (e) => {
2972
- const { apiType: t } = e, a = Ci(t);
2988
+ }, xi = async (e) => {
2989
+ const { apiType: t } = e, a = Li(t);
2973
2990
  a ? await new a().generateApi(e) : m(`不支持 ${t} 语言`);
2974
2991
  };
2975
- async function xi(e) {
2992
+ async function Pi(e) {
2976
2993
  ee(), H();
2977
- const { moduleList: t } = await $i(), { services: a, env: n, skipSwaggerValidate: s = !1 } = e, i = await vi(t, a), o = Dt(), r = await Ai(n), c = await Ti({
2994
+ const { moduleList: t } = await vi(), { services: a, env: n, skipSwaggerValidate: s = !1 } = e, i = await Ai(t, a), o = Ze(), r = await bi(n), c = await Ti({
2978
2995
  moduleList: t,
2979
2996
  services: i,
2980
2997
  env: r,
2981
2998
  skipSwaggerValidate: s
2982
- }), u = await ji();
2983
- await Li({
2999
+ }), u = await ki();
3000
+ await xi({
2984
3001
  remoteSwaggerJsons: c,
2985
3002
  ...e,
2986
3003
  scope: u,
2987
3004
  apiType: o
2988
3005
  }), process.exit(0);
2989
3006
  }
2990
- P.command("api").alias("a").description("选择对应的服务端项目,获取接口并转成ts接口代码及类型").option("--services [services]", "指定需要生成的服务。多个使用逗号隔开").option("--env [env]", "指定环境。dev/test/release").option("--dir [dir]", "输出的目录。默认为 src/services").option("--skip-swagger-validate", "是否跳过 swagger 校验").action((...e) => B(xi, ...e));
2991
- const Pi = 10, Di = async () => {
3007
+ P.command("api").alias("a").description("选择对应的服务端项目,获取接口并转成ts接口代码及类型").option("--services [services]", "指定需要生成的服务。多个使用逗号隔开").option("--env [env]", "指定环境。dev/test/release").option("--dir [dir]", "输出的目录。默认为 src/services").option("--skip-swagger-validate", "是否跳过 swagger 校验").action((...e) => B(Pi, ...e));
3008
+ const Di = 10, Oi = async () => {
2992
3009
  const e = await p("git branch --show-current"), t = [
2993
3010
  w.MASTER,
2994
3011
  // 本地当前分支
@@ -3003,8 +3020,8 @@ const Pi = 10, Di = async () => {
3003
3020
  name: n,
3004
3021
  value: n
3005
3022
  }));
3006
- }, Oi = async (e) => (await p(
3007
- `git log ${e} -n ${Pi} --format="%H%x1f%s%x1f%an%x1f%ae%x1f%aI" --no-merges`
3023
+ }, Mi = async (e) => (await p(
3024
+ `git log ${e} -n ${Di} --format="%H%x1f%s%x1f%an%x1f%ae%x1f%aI" --no-merges`
3008
3025
  )).trim().split(`
3009
3026
  `).filter((a) => a.trim() !== "").map((a) => {
3010
3027
  const [n = "", s = "", i = "", o = "", r = ""] = a.split("");
@@ -3015,7 +3032,7 @@ const Pi = 10, Di = async () => {
3015
3032
  authorEmail: o,
3016
3033
  authorDate: r
3017
3034
  };
3018
- }), Mi = (e) => p(`git show -s --format=%B ${e}`, { removeTailLinkBreak: !1 }), he = (e) => typeof e == "string" ? e : "", we = (e, t = {}) => {
3035
+ }), Bi = (e) => p(`git show -s --format=%B ${e}`, { removeTailLinkBreak: !1 }), he = (e) => typeof e == "string" ? e : "", we = (e, t = {}) => {
3019
3036
  const a = N.config.fatal;
3020
3037
  N.config.fatal = !1;
3021
3038
  try {
@@ -3025,15 +3042,15 @@ const Pi = 10, Di = async () => {
3025
3042
  }
3026
3043
  }, ye = (e, t) => {
3027
3044
  e.text = t, e.render();
3028
- }, Bi = (e) => /with conflicts|merge conflict|CONFLICT|patch does not apply/i.test(e), zi = async () => {
3045
+ }, zi = (e) => /with conflicts|merge conflict|CONFLICT|patch does not apply/i.test(e), _i = async () => {
3029
3046
  try {
3030
3047
  return (await p("git diff --name-only --diff-filter=U")).split(`
3031
3048
  `).map((t) => t.trim()).filter(Boolean);
3032
3049
  } catch {
3033
3050
  return [];
3034
3051
  }
3035
- }, _i = async (e, t) => {
3036
- const a = ea(pe(ca(), "z-pick-commit-")), n = pe(a, `${e.hash}.patch`), s = pe(a, `${e.hash}.message`);
3052
+ }, Fi = async (e, t) => {
3053
+ const a = aa(pe(ua(), "z-pick-commit-")), n = pe(a, `${e.hash}.patch`), s = pe(a, `${e.hash}.message`);
3037
3054
  try {
3038
3055
  ye(t, `正在生成 patch: ${e.hash.slice(0, 8)} ${e.message}`);
3039
3056
  const i = we(`git format-patch -1 ${e.hash} --stdout --binary --full-index`, {
@@ -3044,7 +3061,7 @@ const Pi = 10, Di = async () => {
3044
3061
  status: "failed",
3045
3062
  message: he(i.stderr) || `生成 patch 失败: ${e.hash}`
3046
3063
  };
3047
- if (ve(n, he(i.stdout)), ve(s, await Mi(e.hash)), ye(t, `正在检查 patch 是否已存在: ${e.hash.slice(0, 8)} ${e.message}`), we(`git apply --reverse --check "${n}"`, {
3064
+ if (ve(n, he(i.stdout)), ve(s, await Bi(e.hash)), ye(t, `正在检查 patch 是否已存在: ${e.hash.slice(0, 8)} ${e.message}`), we(`git apply --reverse --check "${n}"`, {
3048
3065
  silent: !0
3049
3066
  }).code === 0)
3050
3067
  return {
@@ -3057,10 +3074,10 @@ const Pi = 10, Di = async () => {
3057
3074
  });
3058
3075
  if (r.code !== 0) {
3059
3076
  const l = he(r.stderr) || `应用 patch 失败: ${e.hash}`;
3060
- return Bi(l) ? {
3077
+ return zi(l) ? {
3061
3078
  status: "conflict",
3062
3079
  message: l,
3063
- conflictFiles: await zi()
3080
+ conflictFiles: await _i()
3064
3081
  } : {
3065
3082
  status: "failed",
3066
3083
  message: l
@@ -3086,20 +3103,20 @@ const Pi = 10, Di = async () => {
3086
3103
  status: "success"
3087
3104
  };
3088
3105
  } finally {
3089
- delete N.env.GIT_AUTHOR_NAME, delete N.env.GIT_AUTHOR_EMAIL, delete N.env.GIT_AUTHOR_DATE, ta(a, {
3106
+ delete N.env.GIT_AUTHOR_NAME, delete N.env.GIT_AUTHOR_EMAIL, delete N.env.GIT_AUTHOR_DATE, sa(a, {
3090
3107
  force: !0,
3091
3108
  recursive: !0
3092
3109
  });
3093
3110
  }
3094
- }, Ht = (e) => e.slice(0, 8), Fi = (e) => e.replace("T", " ").slice(0, 16), Ji = (e) => `${Fi(e.authorDate)} ${e.authorName} ${Ht(e.hash)} ${e.message}`, Gi = (e, t) => t.map((a) => e.find((n) => n.hash === a)).filter((a) => !!a).sort((a, n) => {
3111
+ }, Zt = (e) => e.slice(0, 8), Gi = (e) => e.replace("T", " ").slice(0, 16), Ji = (e) => `${Gi(e.authorDate)} ${e.authorName} ${Zt(e.hash)} ${e.message}`, Ui = (e, t) => t.map((a) => e.find((n) => n.hash === a)).filter((a) => !!a).sort((a, n) => {
3095
3112
  const s = e.indexOf(a);
3096
3113
  return e.indexOf(n) - s;
3097
3114
  });
3098
- async function Ui() {
3115
+ async function Vi() {
3099
3116
  ee(), H(), await ge();
3100
3117
  const e = y("获取分支列表中...").start();
3101
3118
  await p("git fetch -p");
3102
- const t = await Di();
3119
+ const t = await Oi();
3103
3120
  e.succeed("获取分支列表成功");
3104
3121
  const a = await Je({
3105
3122
  message: "选择需要pick的分支",
@@ -3109,7 +3126,7 @@ async function Ui() {
3109
3126
  });
3110
3127
  if (!a)
3111
3128
  return;
3112
- const n = await Oi(a), s = n.map((r) => ({
3129
+ const n = await Mi(a), s = n.map((r) => ({
3113
3130
  name: Ji(r),
3114
3131
  value: r.hash
3115
3132
  })), i = await Je({
@@ -3118,43 +3135,43 @@ async function Ui() {
3118
3135
  emptyValidateMsg: "至少选择一个commit",
3119
3136
  formatShowToValue: (r) => r.map((c) => {
3120
3137
  const u = n.find((l) => l.hash === c.value);
3121
- return u ? Ht(u.hash) : String(c.value);
3138
+ return u ? Zt(u.hash) : String(c.value);
3122
3139
  }).join(", ")
3123
3140
  });
3124
3141
  if (!i?.length)
3125
3142
  return;
3126
- const o = Gi(n, i);
3143
+ const o = Ui(n, i);
3127
3144
  e.start(`开始处理分支 ${a} 的 commit...`);
3128
3145
  for (const r of o) {
3129
- const c = await _i(r, e);
3146
+ const c = await Fi(r, e);
3130
3147
  if (c.status === "skipped")
3131
3148
  e.warn(c.reason);
3132
3149
  else if (c.status === "success")
3133
3150
  e.succeed(`已提交: ${r.hash.slice(0, 8)} ${r.message}`);
3134
3151
  else if (c.status === "conflict") {
3135
- e.fail(`处理失败: ${r.hash.slice(0, 8)} ${r.message}`), G("检测到 patch 冲突,已停止后续 commit 处理。"), G(`冲突提交: ${r.hash.slice(0, 8)} ${r.message}`), c.conflictFiles.length && G(`冲突文件:
3152
+ e.fail(`处理失败: ${r.hash.slice(0, 8)} ${r.message}`), J("检测到 patch 冲突,已停止后续 commit 处理。"), J(`冲突提交: ${r.hash.slice(0, 8)} ${r.message}`), c.conflictFiles.length && J(`冲突文件:
3136
3153
  ${c.conflictFiles.join(`
3137
- `)}`), G("请先手动解决冲突并处理当前工作区,再重新执行 pick-commit。"), await _(Se(), r.message, "utf-8");
3154
+ `)}`), J("请先手动解决冲突并处理当前工作区,再重新执行 pick-commit。"), await _(Se(), r.message, "utf-8");
3138
3155
  return;
3139
3156
  } else {
3140
- e.fail(`处理失败: ${r.hash.slice(0, 8)} ${r.message}`), G(c.message);
3157
+ e.fail(`处理失败: ${r.hash.slice(0, 8)} ${r.message}`), J(c.message);
3141
3158
  return;
3142
3159
  }
3143
3160
  e.start(`继续处理分支 ${a} 的下一个 commit...`);
3144
3161
  }
3145
3162
  e.succeed(`分支 ${a} 处理完成`), e.succeed("pick commit 完成");
3146
3163
  }
3147
- P.command("pick").alias("p").description("从其他分支选择并应用 Commit内容 到当前分支").action((...e) => B(Ui, ...e));
3148
- function Vi() {
3164
+ P.command("pick").alias("p").description("从其他分支选择并应用 Commit内容 到当前分支").action((...e) => B(Vi, ...e));
3165
+ function Wi() {
3149
3166
  process.on("unhandledRejection", (e) => {
3150
3167
  }), process.on("uncaughtException", (e) => {
3151
3168
  }), N.config.fatal = !0, N.config.silent = !0, N.config.verbose = !1;
3152
3169
  }
3153
- async function Wi() {
3170
+ async function Hi() {
3154
3171
  const e = be("latestCheckVersionTimestamp"), t = be("versionCheckDuring");
3155
3172
  if (Date.now() - Number(e) > Number(t) * 24 * 3600 * 1e3) {
3156
3173
  const a = await He();
3157
- Pe(a);
3174
+ De(a);
3158
3175
  let n;
3159
3176
  try {
3160
3177
  const s = "TIME_OUT", i = new Promise((o) => {
@@ -3163,23 +3180,23 @@ async function Wi() {
3163
3180
  n = await Promise.race([
3164
3181
  i,
3165
3182
  p(`npm view ${ce.name} version --registry https://registry.npmmirror.com/`)
3166
- ]), n !== s && n !== ce.version && (console.log(`${A.blue(ce.name)}本地版本为${ce.version},低于线上版本${n},开始升级`), await zt(n)), de("latestCheckVersionTimestamp", Date.now()), X();
3183
+ ]), n !== s && n !== ce.version && (console.log(`${A.blue(ce.name)}本地版本为${ce.version},低于线上版本${n},开始升级`), await Ft(n)), de("latestCheckVersionTimestamp", Date.now()), X();
3167
3184
  } catch (s) {
3168
3185
  console.log("升级出错!请重试,或者手动升级"), m(s);
3169
3186
  }
3170
3187
  }
3171
3188
  }
3172
- async function Hi() {
3173
- const e = ba(process.argv.slice(2));
3189
+ async function qi() {
3190
+ const e = Na(process.argv.slice(2));
3174
3191
  if (!(e.h || e.help || e.v || e.version) && !(["init", "i"].includes(e._[0]) && ![".", "prepare"].includes(e._[1])))
3175
- if (Nt()) {
3192
+ if (jt()) {
3176
3193
  const t = L.readJSONSync(xe());
3177
- E(t.profile), de(t.main), Pe(t.constants), await Wi();
3194
+ k(t.profile), de(t.main), De(t.constants), await Hi();
3178
3195
  } else
3179
- m(`请先初始化z-develop(执行 z i)。更多见${At}`);
3196
+ m(`请先初始化z-develop(执行 z i)。更多见${bt}`);
3180
3197
  }
3181
- async function qi() {
3182
- Vi(), await Hi();
3198
+ async function Zi() {
3199
+ Wi(), await qi();
3183
3200
  }
3184
- P.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${A.blue(At)}`).usage("<command> [options]").hook("preAction", qi).version(ce.version, "-v, --version", "当前版本号").helpOption("-h, --help", "帮助").showHelpAfterError("可以使用z -h查看帮助。");
3201
+ P.name("z-develop").alias("z").description(`z-develop, 开发流程管理工具。了解更多: ${A.blue(bt)}`).usage("<command> [options]").hook("preAction", Zi).version(ce.version, "-v, --version", "当前版本号").helpOption("-h, --help", "帮助").showHelpAfterError("可以使用z -h查看帮助。");
3185
3202
  P.parse();