done-coding-git 0.6.3 → 0.6.4-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { c as m } from "./index-effed877.js";
3
- import "./index-d74ce497.js";
2
+ import { c as m } from "./index-660e765f.js";
3
+ import "./index-7d0e0561.js";
4
4
  import "@done-coding/cli-utils";
5
5
  import "node:child_process";
6
6
  import "node:fs";
package/es/helpers.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { g as s, G as n, a, h as m } from "./index-d74ce497.js";
2
+ import { g as s, G as n, a, h as m } from "./index-7d0e0561.js";
3
3
  import { xPrompts as e } from "@done-coding/cli-utils";
4
4
  import "node:child_process";
5
5
  import "node:fs";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as a, i as t } from "./index-d74ce497.js";
2
+ import { c as a, i as t } from "./index-7d0e0561.js";
3
3
  import { createMainCommand as r, createSubcommand as s } from "@done-coding/cli-utils";
4
4
  const {
5
5
  cliConfig: { moduleName: o }
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { lookForParentTarget as Y, log as i, decryptAES as Z, encryptAES as W, xPrompts as h, HooksNameEnum as m, addHuskyHooks as ee, initHandlerCommon as te, getConfigFileCommonOptions as I, readConfigFile as R, getCurrentBranchName as se, getCommitByHookName as oe, resolveMergeInfoByGitReflogAction as re, checkCurrentIsRebasing as ne, resolveMergeInfoByCommitMsg as ce, getCurrentBranchLastCommitList as ae, getLastReflogList as ie, createSubcommand as ge } from "@done-coding/cli-utils";
3
- import { execSync as B } from "node:child_process";
2
+ import { lookForParentTarget as Y, log as i, decryptAES as Z, encryptAES as W, xPrompts as h, HooksNameEnum as p, addHuskyHooks as ee, initHandlerCommon as te, getConfigFileCommonOptions as I, readConfigFile as R, getCurrentBranchName as se, getCommitByHookName as oe, resolveMergeInfoByGitReflogAction as re, checkCurrentIsRebasing as ne, resolveMergeInfoByCommitMsg as ce, getCurrentBranchLastCommitList as ae, getLastReflogList as ie, createSubcommand as ge, getRootScriptName as me } from "@done-coding/cli-utils";
3
+ import { execSync as N } from "node:child_process";
4
4
  import _ from "node:fs";
5
- import b from "node:path";
6
- import { createRequest as N } from "@done-coding/request-axios";
7
- import fe from "axios";
8
- var p = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(p || {}), d = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.CLONE_CONFIG = "cloneConfig", e))(d || {}), E = /* @__PURE__ */ ((e) => (e.GITHUB = "github", e.GITEE = "gitee", e))(E || {}), C = /* @__PURE__ */ ((e) => (e.REVERSE_MERGE = "reverseMerge", e))(C || {}), u = /* @__PURE__ */ ((e) => (e.REFLOG_ACTION = "reflog-action", e.COMMIT_MSG = "commit-msg", e.COMMIT_RECORD = "commit-record", e.PRE_REBASE = "pre-rebase", e))(u || {});
9
- const me = 3e4, w = Math.random(), L = {
10
- timeout: me,
5
+ import w from "node:path";
6
+ import { createRequest as L } from "@done-coding/request-axios";
7
+ import pe from "axios";
8
+ var l = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(l || {}), d = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.CLONE_CONFIG = "cloneConfig", e))(d || {}), E = /* @__PURE__ */ ((e) => (e.GITHUB = "github", e.GITEE = "gitee", e))(E || {}), C = /* @__PURE__ */ ((e) => (e.REVERSE_MERGE = "reverseMerge", e))(C || {}), u = /* @__PURE__ */ ((e) => (e.REFLOG_ACTION = "reflog-action", e.COMMIT_MSG = "commit-msg", e.COMMIT_RECORD = "commit-record", e.PRE_REBASE = "pre-rebase", e))(u || {});
9
+ const fe = 3e4, y = Math.random(), U = {
10
+ timeout: fe,
11
11
  getBusinessCode() {
12
- return w;
12
+ return y;
13
13
  },
14
14
  getBusinessMsg(e) {
15
15
  return e.statusText;
@@ -17,22 +17,22 @@ const me = 3e4, w = Math.random(), L = {
17
17
  getBusinessData(e) {
18
18
  return e.data;
19
19
  },
20
- businessSuccessCodeList: [w],
21
- axios: fe
22
- }, U = N({
20
+ businessSuccessCodeList: [y],
21
+ axios: pe
22
+ }, x = L({
23
23
  basePath: " https://gitee.com",
24
- ...L
25
- }), x = N({
24
+ ...U
25
+ }), A = L({
26
26
  basePath: "https://api.github.com",
27
- ...L
27
+ ...U
28
28
  }), le = ({
29
29
  username: e
30
- }) => U({
30
+ }) => x({
31
31
  url: `/api/v5/users/${e}/repos`,
32
32
  method: "GET"
33
- }), pe = ({
33
+ }), ue = ({
34
34
  accessToken: e
35
- }) => U({
35
+ }) => x({
36
36
  url: "/api/v5/user/repos",
37
37
  method: "GET",
38
38
  params: {
@@ -41,14 +41,14 @@ const me = 3e4, w = Math.random(), L = {
41
41
  page: 1,
42
42
  sort: "updated"
43
43
  }
44
- }), ue = ({
44
+ }), Ee = ({
45
45
  username: e
46
- }) => x({
46
+ }) => A({
47
47
  url: `/users/${e}/repos`,
48
48
  method: "GET"
49
- }), Ee = ({
49
+ }), he = ({
50
50
  accessToken: e
51
- }) => x({
51
+ }) => A({
52
52
  url: "/user/repos",
53
53
  method: "GET",
54
54
  headers: {
@@ -59,17 +59,20 @@ const me = 3e4, w = Math.random(), L = {
59
59
  page: 1,
60
60
  sort: "updated"
61
61
  }
62
- }), A = {
62
+ }), T = {
63
63
  name: "@done-coding/cli-git",
64
- version: "0.6.3",
64
+ version: "0.6.4-alpha.0",
65
65
  description: "git跨平台操作命令行工具",
66
+ bin: {
67
+ "dc-git": "es/cli.mjs"
68
+ },
66
69
  cliConfig: {
67
70
  namespaceDir: ".done-coding",
68
71
  moduleName: "git"
69
72
  }
70
73
  }, {
71
- cliConfig: { namespaceDir: he, moduleName: de }
72
- } = A, F = `./${he}/${de}`, T = `${F}.json`, H = (e) => `${F}/.${e}`, D = ({ platform: e, username: t }) => `${e}/${t}`, Re = (e) => {
74
+ cliConfig: { namespaceDir: de, moduleName: Re }
75
+ } = T, F = `./${de}/${Re}`, S = `${F}.json`, H = (e) => `${F}/.${e}`, D = ({ platform: e, username: t }) => `${e}/${t}`, Me = (e) => {
73
76
  const { platform: t } = e, s = H(t), r = Y(s, {
74
77
  isFindFarthest: !1
75
78
  });
@@ -83,7 +86,7 @@ const me = 3e4, w = Math.random(), L = {
83
86
  return;
84
87
  }
85
88
  return JSON.parse(g);
86
- }, Me = ({
89
+ }, Ce = ({
87
90
  rootDir: e,
88
91
  username: t,
89
92
  platform: s,
@@ -91,17 +94,17 @@ const me = 3e4, w = Math.random(), L = {
91
94
  }) => {
92
95
  const o = H(s), n = JSON.stringify({
93
96
  accessToken: r
94
- }), g = D({ platform: s, username: t }), l = W({ text: n, secretKey: g }), a = b.join(e, o);
95
- _.mkdirSync(b.dirname(a), {
97
+ }), g = D({ platform: s, username: t }), f = W({ text: n, secretKey: g }), a = w.join(e, o);
98
+ _.mkdirSync(w.dirname(a), {
96
99
  recursive: !0
97
- }), _.writeFileSync(a, l, "utf-8"), i.success(`配置信息保存成功 ${a}`);
98
- }, y = [
100
+ }), _.writeFileSync(a, f, "utf-8"), i.success(`配置信息保存成功 ${a}`);
101
+ }, B = [
99
102
  { title: "GitHub", value: E.GITHUB },
100
103
  { title: "Gitee", value: E.GITEE }
101
104
  ], v = (e) => {
102
105
  let t = 0;
103
106
  if (e) {
104
- const s = y.findIndex(
107
+ const s = B.findIndex(
105
108
  (r) => r.value === e
106
109
  );
107
110
  s >= 0 && (t = s);
@@ -110,7 +113,7 @@ const me = 3e4, w = Math.random(), L = {
110
113
  type: "select",
111
114
  name: "platform",
112
115
  message: "选择git平台",
113
- choices: y,
116
+ choices: B,
114
117
  initial: t
115
118
  };
116
119
  }, K = (e) => ({
@@ -120,13 +123,13 @@ const me = 3e4, w = Math.random(), L = {
120
123
  format: (t) => t.trim(),
121
124
  validate: (t) => t.length > 0 || "用户名不能为空",
122
125
  initial: e
123
- }), Ce = {
126
+ }), $e = {
124
127
  type: "password",
125
128
  name: "accessToken",
126
129
  message: "请输入git access token",
127
130
  format: (e) => e.trim(),
128
131
  validate: (e) => e.length > 0 || "access token不能为空"
129
- }, $e = async ({
132
+ }, Oe = async ({
130
133
  platform: e,
131
134
  username: t
132
135
  } = {}) => {
@@ -137,32 +140,32 @@ const me = 3e4, w = Math.random(), L = {
137
140
  e || (s.platform = (await h(v())).platform), t || (s.username = (await h(K())).username);
138
141
  const { platform: r, username: o } = s;
139
142
  let c = [];
140
- const n = Re({
143
+ const n = Me({
141
144
  username: o,
142
145
  platform: r
143
146
  });
144
147
  let g = n == null ? void 0 : n.accessToken;
145
148
  i.stage(`正在获取${o}的${r}仓库列表...`);
146
- const l = {
149
+ const f = {
147
150
  username: o,
148
151
  accessToken: g
149
152
  };
150
153
  switch (s.platform) {
151
154
  case E.GITHUB: {
152
- c = (await (l.accessToken ? Ee : ue)(l)).data.map((f) => ({
153
- name: f.name,
154
- httpUrl: f.clone_url,
155
- sshUrl: f.ssh_url,
156
- description: f.description || ""
155
+ c = (await (f.accessToken ? he : Ee)(f)).data.map((m) => ({
156
+ name: m.name,
157
+ httpUrl: m.clone_url,
158
+ sshUrl: m.ssh_url,
159
+ description: m.description || ""
157
160
  }));
158
161
  break;
159
162
  }
160
163
  case E.GITEE: {
161
- c = (await (l.accessToken ? pe : le)(l)).data.map((f) => ({
162
- name: f.name,
163
- httpUrl: f.html_url,
164
- sshUrl: f.ssh_url,
165
- description: f.description || ""
164
+ c = (await (f.accessToken ? ue : le)(f)).data.map((m) => ({
165
+ name: m.name,
166
+ httpUrl: m.html_url,
167
+ sshUrl: m.ssh_url,
168
+ description: m.description || ""
166
169
  }));
167
170
  break;
168
171
  }
@@ -178,40 +181,40 @@ const me = 3e4, w = Math.random(), L = {
178
181
  name: "repoUrl",
179
182
  type: "select",
180
183
  message: "选择仓库",
181
- choices: c.map((f) => ({
182
- title: `${f.name} ${f.description}`,
183
- value: f.sshUrl
184
+ choices: c.map((m) => ({
185
+ title: `${m.name} ${m.description}`,
186
+ value: m.sshUrl
184
187
  }))
185
188
  });
186
189
  return a;
187
- }, Oe = [
188
- m.PRE_COMMIT,
189
- m.PRE_MERGE_COMMIT,
190
- m.PREPARE_COMMIT_MSG,
191
- m.COMMIT_MSG,
192
- m.PRE_REBASE,
193
- m.POST_COMMIT,
194
- m.POST_MERGE,
195
- m.PRE_PUSH
196
- ], _e = [
197
- m.PRE_MERGE_COMMIT,
198
- m.PREPARE_COMMIT_MSG,
199
- m.POST_MERGE,
200
- m.PRE_PUSH,
201
- m.PRE_REBASE
190
+ }, _e = [
191
+ p.PRE_COMMIT,
192
+ p.PRE_MERGE_COMMIT,
193
+ p.PREPARE_COMMIT_MSG,
194
+ p.COMMIT_MSG,
195
+ p.PRE_REBASE,
196
+ p.POST_COMMIT,
197
+ p.POST_MERGE,
198
+ p.PRE_PUSH
199
+ ], Ie = [
200
+ p.PRE_MERGE_COMMIT,
201
+ p.PREPARE_COMMIT_MSG,
202
+ p.POST_MERGE,
203
+ p.PRE_PUSH,
204
+ p.PRE_REBASE
202
205
  ], $ = (e) => {
203
206
  const {
204
- [p.CHECK]: { [C.REVERSE_MERGE]: t }
207
+ [l.CHECK]: { [C.REVERSE_MERGE]: t }
205
208
  } = e;
206
209
  return t;
207
- }, Ie = (e) => Math.max(
210
+ }, Te = (e) => Math.max(
208
211
  0,
209
212
  ...Object.values(e).map(({ logCount: t }) => t)
210
- ), Te = (e, t) => Object.entries(e).reduce(
213
+ ), Se = (e, t) => Object.entries(e).reduce(
211
214
  (s, [r, { afterHash: o, logCount: c }]) => {
212
215
  let n = c - 1;
213
216
  if (o) {
214
- const g = t.findIndex((l) => l.hash === o);
217
+ const g = t.findIndex((f) => f.hash === o);
215
218
  g !== -1 && (i.info(
216
219
  `${r} 设置 只检测 ${o} 之后的日志 即 下标 [0 - ${g})`
217
220
  ), n = Math.min(n, g - 1));
@@ -238,7 +241,7 @@ const me = 3e4, w = Math.random(), L = {
238
241
  );
239
242
  return n || i.skip(`跳过: 允许${r} => ${o}`), n;
240
243
  }, Ge = {
241
- [p.CHECK]: {
244
+ [l.CHECK]: {
242
245
  [C.REVERSE_MERGE]: {
243
246
  [/^test$/.source]: {
244
247
  includeRebase: !0,
@@ -247,9 +250,9 @@ const me = 3e4, w = Math.random(), L = {
247
250
  }
248
251
  }
249
252
  }
250
- }, Se = () => ({
253
+ }, Pe = () => ({
251
254
  ...I({
252
- configPathDefault: T
255
+ configPathDefault: S
253
256
  }),
254
257
  type: {
255
258
  alias: "t",
@@ -257,26 +260,26 @@ const me = 3e4, w = Math.random(), L = {
257
260
  choices: [d.DEFAULT, d.CLONE_CONFIG],
258
261
  default: d.DEFAULT
259
262
  }
260
- }), Pe = (e) => {
261
- B(`npm pkg set scripts.postprepare="${e} init"`);
263
+ }), ke = (e) => {
264
+ N(`npm pkg set scripts.postprepare="${e} init"`);
262
265
  }, j = async (e) => {
263
266
  const { type: t } = e;
264
267
  switch (t) {
265
268
  case d.DEFAULT: {
266
269
  const { rootDir: s, isSubCommand: r, _: o } = e, c = `${e.$0}${r ? ` ${o[0]}` : ""}`;
267
270
  return await ee({
268
- hookNames: _e,
271
+ hookNames: Ie,
269
272
  rootDir: s,
270
273
  getCode: (n) => `npx ${c} hooks ${n} "$@"`
271
- }), await Pe(c), te(Ge, e, {
274
+ }), await ke(c), te(Ge, e, {
272
275
  onFileGenerated: (n) => {
273
276
  i.info(`文件生成成功: ${n}`);
274
277
  }
275
278
  });
276
279
  }
277
280
  case d.CLONE_CONFIG: {
278
- const { rootDir: s } = e, { platform: r } = await h(v()), { username: o } = await h(K()), { accessToken: c } = await h(Ce);
279
- return Me({
281
+ const { rootDir: s } = e, { platform: r } = await h(v()), { username: o } = await h(K()), { accessToken: c } = await h($e);
282
+ return Ce({
280
283
  rootDir: s,
281
284
  platform: r,
282
285
  username: o,
@@ -286,18 +289,18 @@ const me = 3e4, w = Math.random(), L = {
286
289
  default:
287
290
  throw new Error(`未知的初始化类型: ${t}`);
288
291
  }
289
- }, ke = {
290
- command: p.INIT,
292
+ }, be = {
293
+ command: l.INIT,
291
294
  describe: "初始化配置文件",
292
- options: Se(),
295
+ options: Pe(),
293
296
  handler: j
294
- }, be = () => ({
297
+ }, we = () => ({
295
298
  projectName: {
296
299
  type: "string",
297
300
  alias: "p",
298
301
  describe: "项目名称"
299
302
  }
300
- }), we = () => ({
303
+ }), ye = () => ({
301
304
  platform: {
302
305
  describe: "选择git平台",
303
306
  type: "string",
@@ -308,26 +311,26 @@ const me = 3e4, w = Math.random(), L = {
308
311
  type: "string"
309
312
  }
310
313
  }), V = async (e) => {
311
- const t = await $e(e), { projectName: s } = e;
312
- B(
314
+ const t = await Oe(e), { projectName: s } = e;
315
+ N(
313
316
  `git clone ${t} ${s ? `${s} ` : ""}--depth=1`,
314
317
  { stdio: "inherit" }
315
318
  ), i.success(`克隆${t}成功`);
316
- }, ye = {
317
- command: `${p.CLONE} <platform> <username>`,
319
+ }, Be = {
320
+ command: `${l.CLONE} <platform> <username>`,
318
321
  describe: "从选择的git平台克隆代码",
319
- options: be(),
320
- positionals: we(),
322
+ options: we(),
323
+ positionals: ye(),
321
324
  handler: V
322
- }, Be = () => I({
323
- configPathDefault: T
324
- }), Ne = () => ({
325
+ }, Ne = () => I({
326
+ configPathDefault: S
327
+ }), Le = () => ({
325
328
  type: {
326
329
  describe: "检测类型",
327
330
  type: "string",
328
331
  choices: [C.REVERSE_MERGE]
329
332
  }
330
- }), Le = ({
333
+ }), Ue = ({
331
334
  config: e,
332
335
  currentBranch: t
333
336
  }) => {
@@ -353,7 +356,7 @@ const me = 3e4, w = Math.random(), L = {
353
356
  `;
354
357
  return i.error(n), process.exit(1);
355
358
  }
356
- }, Ue = ({
359
+ }, xe = ({
357
360
  config: e,
358
361
  currentBranch: t,
359
362
  commitMsg: s,
@@ -367,7 +370,7 @@ const me = 3e4, w = Math.random(), L = {
367
370
  configMap: c,
368
371
  currentBranch: t
369
372
  })) {
370
- const { fromBranch: g, toBranch: l = t } = o, a = `禁止${g}被合并: ${g} => ${l}
373
+ const { fromBranch: g, toBranch: f = t } = o, a = `禁止${g}被合并: ${g} => ${f}
371
374
 
372
375
  --------- 建议 ---------
373
376
  可以通过
@@ -378,28 +381,28 @@ const me = 3e4, w = Math.random(), L = {
378
381
  `;
379
382
  return i.error(a), process.exit(1);
380
383
  }
381
- }, xe = ({
384
+ }, Ae = ({
382
385
  config: e,
383
386
  currentBranch: t
384
387
  }) => {
385
- const s = $(e), r = Ie(s);
388
+ const s = $(e), r = Te(s);
386
389
  if (!r)
387
390
  return;
388
- const o = ae({ count: r }), c = Te(s, o), n = o.map((a) => a.hash), l = ie({
391
+ const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash), f = ie({
389
392
  /** 考虑reflog存在往复切换 */
390
393
  count: r + 30,
391
394
  filterItem: (a) => n.includes(a.hash)
392
395
  }).reduce(
393
- (a, f) => (f.mergeInfo && (a[f.hash] = f), a),
396
+ (a, m) => (m.mergeInfo && (a[m.hash] = m), a),
394
397
  {}
395
398
  );
396
- o.forEach((a, f) => {
397
- var S;
398
- const O = a.mergeInfo || ((S = l[a.hash]) == null ? void 0 : S.mergeInfo);
399
- O && Object.entries(s).forEach(([P]) => {
400
- const k = c[P];
401
- if (f > k) {
402
- i.skip(`${P} 只检测${k + 1}条, 超出不再检测`);
399
+ o.forEach((a, m) => {
400
+ var P;
401
+ const O = a.mergeInfo || ((P = f[a.hash]) == null ? void 0 : P.mergeInfo);
402
+ O && Object.entries(s).forEach(([k]) => {
403
+ const b = c[k];
404
+ if (m > b) {
405
+ i.skip(`${k} 只检测${b + 1}条, 超出不再检测`);
403
406
  return;
404
407
  }
405
408
  const z = G({
@@ -425,7 +428,7 @@ const me = 3e4, w = Math.random(), L = {
425
428
  }
426
429
  });
427
430
  });
428
- }, Ae = ({
431
+ }, Fe = ({
429
432
  config: e,
430
433
  rebaseInfo: t
431
434
  }) => {
@@ -444,7 +447,7 @@ const me = 3e4, w = Math.random(), L = {
444
447
  const { config: t, way: s } = e, r = se();
445
448
  switch (s) {
446
449
  case u.REFLOG_ACTION: {
447
- Le({ config: t, currentBranch: r });
450
+ Ue({ config: t, currentBranch: r });
448
451
  break;
449
452
  }
450
453
  case u.COMMIT_MSG: {
@@ -452,7 +455,7 @@ const me = 3e4, w = Math.random(), L = {
452
455
  hookName: o,
453
456
  rootDir: c
454
457
  });
455
- Ue({
458
+ xe({
456
459
  config: t,
457
460
  currentBranch: r,
458
461
  commitMsg: n,
@@ -461,7 +464,7 @@ const me = 3e4, w = Math.random(), L = {
461
464
  break;
462
465
  }
463
466
  case u.COMMIT_RECORD: {
464
- xe({ config: t, currentBranch: r });
467
+ Ae({ config: t, currentBranch: r });
465
468
  break;
466
469
  }
467
470
  case u.PRE_REBASE: {
@@ -470,7 +473,7 @@ const me = 3e4, w = Math.random(), L = {
470
473
  /** 能进入 rebase 说明originBranch有值 或者 当前在某个分支上 */
471
474
  n = r
472
475
  ] = o;
473
- Ae({
476
+ Fe({
474
477
  config: t,
475
478
  rebaseInfo: {
476
479
  targetBranch: c,
@@ -496,24 +499,24 @@ const me = 3e4, w = Math.random(), L = {
496
499
  default:
497
500
  throw new Error(`不支持的检测类型${s}`);
498
501
  }
499
- }, Fe = {
500
- command: `${p.CHECK} <type>`,
502
+ }, He = {
503
+ command: `${l.CHECK} <type>`,
501
504
  describe: "检查git操作",
502
- options: Be(),
503
- positionals: Ne(),
505
+ options: Ne(),
506
+ positionals: Le(),
504
507
  handler: q
505
- }, He = () => I({
506
- configPathDefault: T
507
- }), De = () => ({
508
+ }, De = () => I({
509
+ configPathDefault: S
510
+ }), ve = () => ({
508
511
  name: {
509
512
  describe: "钩子名称",
510
513
  type: "string",
511
- choices: Oe
514
+ choices: _e
512
515
  }
513
516
  }), J = async (e) => {
514
517
  const { name: t, rootDir: s, args: r } = e;
515
518
  switch (t) {
516
- case m.PRE_MERGE_COMMIT: {
519
+ case p.PRE_MERGE_COMMIT: {
517
520
  const o = await R(e);
518
521
  M({
519
522
  config: o,
@@ -522,7 +525,7 @@ const me = 3e4, w = Math.random(), L = {
522
525
  });
523
526
  break;
524
527
  }
525
- case m.PREPARE_COMMIT_MSG: {
528
+ case p.PREPARE_COMMIT_MSG: {
526
529
  const o = await R(e);
527
530
  M({
528
531
  config: o,
@@ -532,8 +535,8 @@ const me = 3e4, w = Math.random(), L = {
532
535
  });
533
536
  break;
534
537
  }
535
- case m.POST_MERGE:
536
- case m.PRE_PUSH: {
538
+ case p.POST_MERGE:
539
+ case p.PRE_PUSH: {
537
540
  const o = await R(e);
538
541
  M({
539
542
  config: o,
@@ -542,7 +545,7 @@ const me = 3e4, w = Math.random(), L = {
542
545
  });
543
546
  break;
544
547
  }
545
- case m.PRE_REBASE: {
548
+ case p.PRE_REBASE: {
546
549
  const o = await R(e);
547
550
  M({
548
551
  config: o,
@@ -554,54 +557,55 @@ const me = 3e4, w = Math.random(), L = {
554
557
  default:
555
558
  i.error(`${t} 当前未支持处理`);
556
559
  }
557
- }, ve = {
558
- command: `${p.HOOKS} <name> [args...]`,
560
+ }, Ke = {
561
+ command: `${l.HOOKS} <name> [args...]`,
559
562
  describe: "git钩子回调",
560
- options: He(),
561
- positionals: De(),
563
+ options: De(),
564
+ positionals: ve(),
562
565
  handler: J
563
- }, Ye = async (e, t) => {
566
+ }, Ze = async (e, t) => {
564
567
  switch (e) {
565
- case p.INIT:
568
+ case l.INIT:
566
569
  return j(t);
567
- case p.CLONE:
570
+ case l.CLONE:
568
571
  return V(t);
569
- case p.HOOKS:
572
+ case l.HOOKS:
570
573
  return J(t);
571
- case p.CHECK:
574
+ case l.CHECK:
572
575
  return q(t);
573
576
  default:
574
577
  throw new Error(`不支持的命令 ${e}`);
575
578
  }
576
- }, { version: Ke, description: je } = A, Ze = {
577
- describe: je,
578
- version: Ke,
579
+ }, { version: je, description: Ve } = T, We = {
580
+ describe: Ve,
581
+ version: je,
579
582
  subcommands: [
580
- ke,
581
- ye,
582
- ve,
583
- Fe
583
+ be,
584
+ Be,
585
+ Ke,
586
+ He
584
587
  ].map(ge),
585
- demandCommandCount: 1
588
+ demandCommandCount: 1,
589
+ rootScriptName: me({ packageJson: T })
586
590
  };
587
591
  export {
588
592
  C,
589
593
  E as G,
590
594
  d as I,
591
- p as S,
595
+ l as S,
592
596
  K as a,
593
- $e as b,
594
- Ze as c,
597
+ Oe as b,
598
+ We as c,
595
599
  j as d,
596
- ke as e,
597
- ye as f,
600
+ be as e,
601
+ Be as f,
598
602
  v as g,
599
603
  V as h,
600
- A as i,
604
+ T as i,
601
605
  J as j,
602
- ve as k,
606
+ Ke as k,
603
607
  q as l,
604
- Fe as m,
605
- Ye as n,
608
+ He as m,
609
+ Ze as n,
606
610
  u as o
607
611
  };
package/es/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { o as t, C as l, G as d, I as c, S as C, m as p, l as f, f as h, h as u, c as k, b as I, n as E, k as b, j as H, e as g, d as y } from "./index-d74ce497.js";
3
- import { a as T } from "./index-effed877.js";
2
+ import { o as t, C as l, G as d, I as c, S as C, m as p, l as f, f as h, h as u, c as k, b as I, n as E, k as b, j as H, e as g, d as y } from "./index-7d0e0561.js";
3
+ import { a as T } from "./index-660e765f.js";
4
4
  import "@done-coding/cli-utils";
5
5
  import "node:child_process";
6
6
  import "node:fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "done-coding-git",
3
- "version": "0.6.3",
3
+ "version": "0.6.4-alpha.0",
4
4
  "description": "git跨平台操作命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -41,7 +41,7 @@
41
41
  "license": "MIT",
42
42
  "sideEffects": false,
43
43
  "devDependencies": {
44
- "@done-coding/cli-inject": "^0.5.11",
44
+ "@done-coding/cli-inject": "^0.5.12-alpha.0",
45
45
  "@types/node": "^18.0.0",
46
46
  "@types/yargs": "^17.0.28",
47
47
  "rimraf": "^6.0.1",
@@ -53,10 +53,10 @@
53
53
  "node": ">=18.0.0"
54
54
  },
55
55
  "dependencies": {
56
- "@done-coding/cli-utils": "^0.7.2",
56
+ "@done-coding/cli-utils": "^0.7.3-alpha.0",
57
57
  "@done-coding/request-axios": "^1.1.1",
58
58
  "axios": "^1.8.4"
59
59
  },
60
- "gitHead": "ad322da7f5d0897ee91a399aff9a14b111d62825",
60
+ "gitHead": "9d9a2e60f255038a0f065e3a4e6d6d35488408ae",
61
61
  "scripts": {}
62
62
  }