cli-z-develop 0.13.0 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +44 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import St from "dayjs";
9
9
  import O from "shelljs";
10
10
  import kt from "node:os";
11
11
  import Me from "child_process";
12
- import { confirm as Ue, select as k, input as F, password as Tt, checkbox as Ce, number as ze } from "@inquirer/prompts";
12
+ import { confirm as Ue, select as k, input as J, password as Tt, checkbox as Ce, number as ze } from "@inquirer/prompts";
13
13
  import y from "ora";
14
14
  import x from "fs-extra";
15
15
  import { select as ae } from "inquirer-select-pro";
@@ -80,7 +80,7 @@ const Bt = [
80
80
  value: "case"
81
81
  /* CASE */
82
82
  }
83
- ], Jt = ".z", Ft = "develop-config.json", Z = ".z", _t = ".commit-msg-tpl", Ut = "project.json";
83
+ ], Ft = ".z", Jt = "develop-config.json", Z = ".z", _t = ".commit-msg-tpl", Ut = "project.json";
84
84
  function C(e = "") {
85
85
  return p.join(Z, e);
86
86
  }
@@ -94,10 +94,10 @@ function Ze() {
94
94
  Me.spawnSync("git", ["config", "core.hooksPath", C()]), Me.spawnSync("git", ["config", "commit.template", Ne()]);
95
95
  }
96
96
  function he(e = "") {
97
- return p.resolve(kt.homedir(), Jt, e);
97
+ return p.resolve(kt.homedir(), Ft, e);
98
98
  }
99
99
  function be() {
100
- return he(Ft);
100
+ return he(Jt);
101
101
  }
102
102
  function Gt() {
103
103
  return v(he());
@@ -130,11 +130,11 @@ function l(e, t = !1) {
130
130
  let i = e;
131
131
  e instanceof Error ? (i = e.message, ce.isAxiosError(e) && (i = `请求失败:${e.message}`), console.log(Be(i)), console.log(Vt(e.stack))) : console.log(Be(e)), t || process.exit(1);
132
132
  }
133
- function Je(e) {
133
+ function Fe(e) {
134
134
  return v(e) ? Nt(e).isDirectory() : !1;
135
135
  }
136
136
  function Qe(e = process.cwd()) {
137
- return Je(e) ? vt(e).filter((i) => Je(p.resolve(e, i))) : [];
137
+ return Fe(e) ? vt(e).filter((i) => Fe(p.resolve(e, i))) : [];
138
138
  }
139
139
  async function m(e, t = {
140
140
  removeTailLinkBreak: !0,
@@ -266,7 +266,7 @@ const Xt = {
266
266
  "**/*.{vue,js,jsx,cjs,mjs,ts,tsx,cts,mts}": "eslint --fix",
267
267
  "**/*.md": "markdownlint --fix"
268
268
  }
269
- }, Qt = "cli-z-develop", ei = "0.13.0", ti = "技术团队开发流程管理工具", ii = "dist/index.js", ai = { z: "bin/z.js", "z-develop": "bin/z.js" }, ni = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", eslint: "eslint '**/*.{ts,js}' --fix", prettier: "prettier -wu .", upload: "npm run build && npm publish --access public --registry https://registry.npmjs.org/", "upload:patch": "npm version patch && npm run upload", "upload:minor": "npm version minor && npm run upload", "upload:major": "npm version major && npm run upload" }, si = "module", ri = "z", oi = { "@lonely9/eslint-config-team": "^1.3.8", "@tsconfig/node22": "^22.0.5", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.9", "@types/minimist": "^1.2.5", "@types/node": "^22.15.29", "@types/semver": "^7.7.1", "@types/shelljs": "^0.10.0", "@typescript-eslint/eslint-plugin": "^8.58.2", "@typescript-eslint/parser": "^8.58.2", eslint: "^9.39.2", jiti: "^2.6.1", prettier: "^3.8.2", typescript: "^5.9.3", vite: "^7.3.1", "vue-tsc": "^3.2.6" }, ci = { "@inquirer/prompts": "^8.4.1", axios: "^1.15.0", chalk: "^5.6.2", commander: "^14.0.3", dayjs: "^1.11.20", "fs-extra": "^11.3.4", "inquirer-select-pro": "^1.0.0-alpha.9", "lint-staged": "^16.4.0", minimist: "^1.2.8", "npm-check-updates": "^19.3.1", ora: "^9.3.0", "p-limit": "^7.3.0", semver: "^7.7.4", shelljs: "^0.10.0" }, ie = {
269
+ }, Qt = "cli-z-develop", ei = "0.13.1", ti = "技术团队开发流程管理工具", ii = "dist/index.js", ai = { z: "bin/z.js", "z-develop": "bin/z.js" }, ni = { prepare: "[ -n '$z' ] && z init prepare || echo 'Warning: z not exist at global'", dev: "vite build --watch", "dev:debug": "DEBUG=true vite build --watch", build: "vite build", eslint: "eslint '**/*.{ts,js}' --fix", prettier: "prettier -wu .", upload: "npm run build && npm publish --access public --registry https://registry.npmjs.org/", "upload:patch": "npm version patch && npm run upload", "upload:minor": "npm version minor && npm run upload", "upload:major": "npm version major && npm run upload" }, si = "module", ri = "z", oi = { "@lonely9/eslint-config-team": "^1.3.8", "@tsconfig/node22": "^22.0.5", "@types/fs-extra": "^11.0.4", "@types/inquirer": "^9.0.9", "@types/minimist": "^1.2.5", "@types/node": "^22.15.29", "@types/semver": "^7.7.1", "@types/shelljs": "^0.10.0", "@typescript-eslint/eslint-plugin": "^8.58.2", "@typescript-eslint/parser": "^8.58.2", eslint: "^9.39.2", jiti: "^2.6.1", prettier: "^3.8.2", typescript: "^5.9.3", vite: "^7.3.1", "vue-tsc": "^3.2.6" }, ci = { "@inquirer/prompts": "^8.4.1", axios: "^1.15.0", chalk: "^5.6.2", commander: "^14.0.3", dayjs: "^1.11.20", "fs-extra": "^11.3.4", "inquirer-select-pro": "^1.0.0-alpha.9", "lint-staged": "^16.4.0", minimist: "^1.2.8", "npm-check-updates": "^19.3.1", ora: "^9.3.0", "p-limit": "^7.3.0", semver: "^7.7.4", shelljs: "^0.10.0" }, ie = {
270
270
  name: Qt,
271
271
  version: ei,
272
272
  description: ti,
@@ -527,60 +527,60 @@ async function gi(e, t) {
527
527
  throw console.error("下载失败:", i), i;
528
528
  }
529
529
  }
530
- const B = () => `${fe}/api/v4`, J = (e) => `${B()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
530
+ const B = () => `${fe}/api/v4`, F = (e) => `${B()}/projects/100/repository/files/${encodeURIComponent(e)}/raw?ref=master`;
531
531
  function hi() {
532
532
  return N({
533
- url: J("src/data/template-projects.json")
533
+ url: F("src/data/template-projects.json")
534
534
  });
535
535
  }
536
536
  function wi() {
537
537
  return N({
538
- url: J("src/data/java-project-module.json")
538
+ url: F("src/data/java-project-module.json")
539
539
  });
540
540
  }
541
541
  function at() {
542
542
  return N({
543
- url: J("src/data/z-develop-config.json")
543
+ url: F("src/data/z-develop-config.json")
544
544
  });
545
545
  }
546
546
  function yi() {
547
547
  return N({
548
- url: J("src/assets/tsconfig.browser.json")
548
+ url: F("src/assets/tsconfig.browser.json")
549
549
  });
550
550
  }
551
551
  function $i() {
552
552
  return N({
553
- url: J("src/assets/tsconfig.node.json")
553
+ url: F("src/assets/tsconfig.node.json")
554
554
  });
555
555
  }
556
556
  function vi() {
557
557
  return N({
558
- url: J("src/assets/.prettierignore")
558
+ url: F("src/assets/.prettierignore")
559
559
  });
560
560
  }
561
561
  function Ni() {
562
562
  return N({
563
- url: J("src/assets/.prettierrc.json")
563
+ url: F("src/assets/.prettierrc.json")
564
564
  });
565
565
  }
566
566
  function bi() {
567
567
  return N({
568
- url: J("src/assets/data.yaml")
568
+ url: F("src/assets/data.yaml")
569
569
  });
570
570
  }
571
571
  function Ai() {
572
572
  return N({
573
- url: J("src/assets/main.py")
573
+ url: F("src/assets/main.py")
574
574
  });
575
575
  }
576
576
  function ji() {
577
577
  return N({
578
- url: J("src/assets/checkstyle.xml")
578
+ url: F("src/assets/checkstyle.xml")
579
579
  });
580
580
  }
581
581
  function Si() {
582
582
  return N({
583
- url: J("src/data/project-group-chats.json")
583
+ url: F("src/data/project-group-chats.json")
584
584
  });
585
585
  }
586
586
  function ki() {
@@ -699,7 +699,7 @@ function st(e) {
699
699
  }
700
700
  });
701
701
  }
702
- function Ji(e) {
702
+ function Fi(e) {
703
703
  return A({
704
704
  url: "/zen/testcase/product/name",
705
705
  data: {
@@ -707,7 +707,7 @@ function Ji(e) {
707
707
  }
708
708
  });
709
709
  }
710
- function Fi(e, t) {
710
+ function Ji(e, t) {
711
711
  return A({
712
712
  url: "/zen/testcase/product/auto-case/list",
713
713
  data: {
@@ -891,7 +891,7 @@ async function sa() {
891
891
  }
892
892
  ]
893
893
  });
894
- let i = await F({
894
+ let i = await J({
895
895
  message: "请输入LDAP账号:"
896
896
  });
897
897
  i = i.trim();
@@ -1035,7 +1035,7 @@ async function da(e) {
1035
1035
  value: de.REFACTOR
1036
1036
  }
1037
1037
  ]
1038
- }), e.branchPurpose ? i = e.branchPurpose : (i = await F({
1038
+ }), e.branchPurpose ? i = e.branchPurpose : (i = await J({
1039
1039
  message: "请输入创建分支的目的(大小写字母、数字,小驼峰式命名。如userInfo)",
1040
1040
  validate: pa
1041
1041
  }), i = i.trim());
@@ -1069,7 +1069,7 @@ async function ga() {
1069
1069
  }
1070
1070
  })) : [];
1071
1071
  }
1072
- async function Fe(e) {
1072
+ async function Je(e) {
1073
1073
  const t = await m("git diff HEAD");
1074
1074
  t || l("git暂存区没有内容,请先git add添加文件到暂存区");
1075
1075
  const i = await ia({
@@ -1084,12 +1084,12 @@ async function Te(e, t, i) {
1084
1084
  let a = "", s = !0;
1085
1085
  if ([j.FEAT, j.FIX, j.REFACTOR].includes(e)) {
1086
1086
  const o = t.map((r) => r.value).join(",");
1087
- if (i || (a = await Fe(`${e}(${o}): `)), !a) {
1087
+ if (i || (a = await Je(`${e}(${o}): `)), !a) {
1088
1088
  const r = t.map((c) => c.name).join(";");
1089
1089
  a = `${e}(${o}): ${r}`, s = !1;
1090
1090
  }
1091
1091
  }
1092
- e === j.CHORE && (t ? a = `${e}: ${t}` : a = await Fe(`${e}: `)), await L(Ne(), a, "utf-8"), s || i ? n.succeed("提交信息已生成(↓),可以进行提交了!") : n.warn("AI生成提交信息失败,已使用默认模板(↓),可以进行提交了!"), console.log(S.yellow(a));
1092
+ e === j.CHORE && (t ? a = `${e}: ${t}` : a = await Je(`${e}: `)), await L(Ne(), a, "utf-8"), s || i ? n.succeed("提交信息已生成(↓),可以进行提交了!") : n.warn("AI生成提交信息失败,已使用默认模板(↓),可以进行提交了!"), console.log(S.yellow(a));
1093
1093
  }
1094
1094
  async function ha(e) {
1095
1095
  const t = await k({
@@ -1145,7 +1145,7 @@ async function ha(e) {
1145
1145
  }
1146
1146
  if (t === j.CHORE) {
1147
1147
  let i = "";
1148
- e && (i = await F({
1148
+ e && (i = await J({
1149
1149
  message: "请输入commit msg:",
1150
1150
  validate: (n) => n.length === 0 ? "请输入commit msg" : !0
1151
1151
  }), i = i.trim()), await Te(j.CHORE, i);
@@ -1181,10 +1181,10 @@ async function wa() {
1181
1181
  name: P.find((K) => K.id === te)?.name
1182
1182
  };
1183
1183
  }, n = async () => {
1184
- e.projectName = await F({
1184
+ e.projectName = await J({
1185
1185
  message: "请输入项目名称",
1186
1186
  validate: (P) => la(P, e.group?.name || "")
1187
- }), e.projectName = e.projectName.trim(), e.projectDesc = await F({
1187
+ }), e.projectName = e.projectName.trim(), e.projectDesc = await J({
1188
1188
  message: "请输入项目描述",
1189
1189
  validate: ma
1190
1190
  }), e.projectDesc = e.projectDesc.trim();
@@ -1325,7 +1325,11 @@ async function ut(e, t) {
1325
1325
  let s = "";
1326
1326
  a.language === w.JAVASCRIPT && (s = zt);
1327
1327
  let o = "";
1328
- if (a.language === w.JAVASCRIPT && (o = Ae().name), a.language === w.JAVA) {
1328
+ if (a.language === w.JAVASCRIPT) {
1329
+ const u = Ae();
1330
+ u.name.startsWith("@") && u.name.includes("/") ? o = u.name.split("/").reverse()[0] : o = u.name;
1331
+ }
1332
+ if (a.language === w.JAVA) {
1329
1333
  const { projects: u } = await wi(), d = u.find(
1330
1334
  (f) => $e(f.url) === $e(a.repository.url)
1331
1335
  );
@@ -1782,7 +1786,7 @@ async function gt(e) {
1782
1786
  }))
1783
1787
  });
1784
1788
  }
1785
- return t.name = await Ji(t.id), t.path = p.join(pt, V("module", t.name, String(t.id))), t;
1789
+ return t.name = await Fi(t.id), t.path = p.join(pt, V("module", t.name, String(t.id))), t;
1786
1790
  }
1787
1791
  async function Le(e) {
1788
1792
  return (await ft(pt)).find((i) => Number(i.id) === e.id);
@@ -1843,7 +1847,7 @@ async function Ma(e, t, i) {
1843
1847
  const a = Oe(i);
1844
1848
  let s = await X(t.path);
1845
1849
  e.text = "获取远程用例列表...";
1846
- const o = await Fi(t.id, a);
1850
+ const o = await Ji(t.id, a);
1847
1851
  e.text = "本地用例同步中...";
1848
1852
  for (const r of o) {
1849
1853
  let c;
@@ -1880,8 +1884,8 @@ async function Ba(e, t) {
1880
1884
  }
1881
1885
  }
1882
1886
  D.command("qa-pull").alias("qp").description("将禅道中的模块或者用例同步到本地").argument("[type]", "可选值为module/case").option("--product-id <productId>", "指定产品ID").option("--case-ids <caseIds>", "type=case时,可传指定用例ID(可传N个,逗号隔开);不传则为产品下全部用例").option("--disable-auto-commit", "是否跳过自动将修改结果提交。").action((...e) => z(Ba, ...e));
1883
- async function Ja(e, t, i) {
1884
- let n = await F({
1887
+ async function Fa(e, t, i) {
1888
+ let n = await J({
1885
1889
  message: "请输入你要创建的用例的前置条件(可不填)"
1886
1890
  });
1887
1891
  n = n.trim();
@@ -1912,7 +1916,7 @@ async function Ja(e, t, i) {
1912
1916
  o
1913
1917
  ), a.succeed(`用例【[${o}】创建完成 🎉`), o);
1914
1918
  }
1915
- async function Fa(e, t, i) {
1919
+ async function Ja(e, t, i) {
1916
1920
  const n = y(`模块【${i}】开始创建...`).start();
1917
1921
  n.text = "远程模块创建中...";
1918
1922
  const a = await Ui({
@@ -1957,14 +1961,14 @@ async function Ua(e, t) {
1957
1961
  const { type: i, typeStr: n } = await je("创建", e), { product: a, localProduct: s } = await Se(t.productId), o = await st(a.id), r = await _a(o), c = V("module", r.label, String(r.value)), d = (await X(a.path, { hasRoot: !0 })).find((h) => h.name === c);
1958
1962
  if (!d?.path || !v(d.path))
1959
1963
  return l(`本地不存在${c}模块`);
1960
- let f = await F({
1964
+ let f = await J({
1961
1965
  message: `请输入你要创建的${n}名称`,
1962
1966
  required: !0,
1963
1967
  validate: (h) => h.length > 0 && h.length < 255
1964
1968
  });
1965
1969
  f = f.trim();
1966
1970
  let g = "";
1967
- if (R.MODULE === i && await Fa(s, d, f), R.CASE === i && (g = await Ja(s, d, f)), !t.disableAutoCommit && R.CASE === i) {
1971
+ if (R.MODULE === i && await Ja(s, d, f), R.CASE === i && (g = await Fa(s, d, f)), !t.disableAutoCommit && R.CASE === i) {
1968
1972
  const h = y("代码提交中...").start();
1969
1973
  try {
1970
1974
  await m(`git add . && git commit -m "chore: 创建了用例${p.basename(g)}"`), h.succeed("代码已提交 ✅");
@@ -2084,7 +2088,7 @@ async function qa(e, t) {
2084
2088
  }
2085
2089
  });
2086
2090
  }
2087
- let s = await F({
2091
+ let s = await J({
2088
2092
  message: "修改用例名称",
2089
2093
  default: a.displayName,
2090
2094
  required: !0,
@@ -2126,7 +2130,7 @@ async function qa(e, t) {
2126
2130
  { spaces: 2 }
2127
2131
  ), u.succeed(`用例优先级修改成功:${r.priority} -> ${c}`)) : u.succeed("用例优先级无变动"), r = x.readJsonSync(p.join(a.path, "config.json"));
2128
2132
  let d;
2129
- t.casePrecondition ? d = t.casePrecondition : (d = await F({
2133
+ t.casePrecondition ? d = t.casePrecondition : (d = await J({
2130
2134
  message: "修改用例前置条件",
2131
2135
  default: r.precondition,
2132
2136
  prefill: "editable"
@@ -2170,7 +2174,7 @@ async function Ka(e, t) {
2170
2174
  }
2171
2175
  });
2172
2176
  }
2173
- let s = await F({
2177
+ let s = await J({
2174
2178
  message: "修改模块名称",
2175
2179
  default: a.displayName,
2176
2180
  required: !0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cli-z-develop",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "description": "技术团队开发流程管理工具",
5
5
  "main": "dist/index.js",
6
6
  "bin": {