@done-coding/cli-git 0.6.14-alpha.2 → 0.6.14

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-7475a061.js";
3
- import "./index-9d4e7eeb.js";
2
+ import { c as m } from "./index-1c9dde81.js";
3
+ import "./index-d7ef8756.js";
4
4
  import "@done-coding/cli-utils";
5
5
  import "node:fs";
6
6
  import "node:path";
package/es/helpers.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { g as s, G as n, a as i, h as m } from "./index-9d4e7eeb.js";
2
+ import { g as s, G as n, a as i, h as m } from "./index-d7ef8756.js";
3
3
  import { outputConsole as o, xPrompts as r } from "@done-coding/cli-utils";
4
4
  import "node:fs";
5
5
  import "node:path";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as a, i as t } from "./index-9d4e7eeb.js";
2
+ import { c as a, i as t } from "./index-d7ef8756.js";
3
3
  import { createMainCommand as s, createSubcommand as r } from "@done-coding/cli-utils";
4
4
  const {
5
5
  cliConfig: { moduleName: o }
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { lookForParentTarget as Y, outputConsole as i, decryptAES as Z, encryptAES as W, xPrompts as h, HooksNameEnum as p, addHuskyHooks as ee, initHandlerCommon as te, getConfigFileCommonOptions as I, execSyncHijack as N, 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";
2
+ import { lookForParentTarget as Y, outputConsole as i, decryptAES as Z, encryptAES as W, xPrompts as d, HooksNameEnum as p, addHuskyHooks as ee, initHandlerCommon as te, getConfigFileCommonOptions as I, execSyncHijack as N, 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
3
  import _ from "node:fs";
4
4
  import w from "node:path";
5
5
  import { createRequest as L } from "@done-coding/request-axios";
6
6
  import pe from "axios";
7
- var f = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(f || {}), 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 || {});
8
- const le = 3e4, y = Math.random(), U = {
9
- timeout: le,
7
+ var l = /* @__PURE__ */ ((e) => (e.INIT = "init", e.CLONE = "clone", e.HOOKS = "hooks", e.CHECK = "check", e))(l || {}), h = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.CLONE_CONFIG = "cloneConfig", e))(h || {}), 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 || {});
8
+ const fe = 3e4, y = Math.random(), U = {
9
+ timeout: fe,
10
10
  getBusinessCode() {
11
11
  return y;
12
12
  },
@@ -24,7 +24,7 @@ const le = 3e4, y = Math.random(), U = {
24
24
  }), A = L({
25
25
  basePath: "https://api.github.com",
26
26
  ...U
27
- }), fe = ({
27
+ }), le = ({
28
28
  username: e
29
29
  }) => x({
30
30
  url: `/api/v5/users/${e}/repos`,
@@ -45,7 +45,7 @@ const le = 3e4, y = Math.random(), U = {
45
45
  }) => A({
46
46
  url: `/users/${e}/repos`,
47
47
  method: "GET"
48
- }), he = ({
48
+ }), de = ({
49
49
  accessToken: e
50
50
  }) => A({
51
51
  url: "/user/repos",
@@ -60,7 +60,7 @@ const le = 3e4, y = Math.random(), U = {
60
60
  }
61
61
  }), T = {
62
62
  name: "@done-coding/cli-git",
63
- version: "0.6.14-alpha.2",
63
+ version: "0.6.14",
64
64
  description: "git跨平台操作命令行工具",
65
65
  bin: {
66
66
  "dc-git": "es/cli.mjs"
@@ -70,8 +70,8 @@ const le = 3e4, y = Math.random(), U = {
70
70
  moduleName: "git"
71
71
  }
72
72
  }, {
73
- cliConfig: { namespaceDir: de, moduleName: Re }
74
- } = T, H = `./${de}/${Re}`, S = `${H}.json`, F = (e) => `${H}/.${e}`, D = ({ platform: e, username: t }) => `${e}/${t}`, Me = (e) => {
73
+ cliConfig: { namespaceDir: he, moduleName: Re }
74
+ } = T, H = `./${he}/${Re}`, S = `${H}.json`, F = (e) => `${H}/.${e}`, D = ({ platform: e, username: t }) => `${e}/${t}`, Me = (e) => {
75
75
  const { platform: t } = e, s = F(t), r = Y(s, {
76
76
  isFindFarthest: !1
77
77
  });
@@ -93,10 +93,10 @@ const le = 3e4, y = Math.random(), U = {
93
93
  }) => {
94
94
  const o = F(s), n = JSON.stringify({
95
95
  accessToken: r
96
- }), g = D({ platform: s, username: t }), l = W({ text: n, secretKey: g }), a = w.join(e, o);
96
+ }), g = D({ platform: s, username: t }), f = W({ text: n, secretKey: g }), a = w.join(e, o);
97
97
  _.mkdirSync(w.dirname(a), {
98
98
  recursive: !0
99
- }), _.writeFileSync(a, l, "utf-8"), i.success(`配置信息保存成功 ${a}`);
99
+ }), _.writeFileSync(a, f, "utf-8"), i.success(`配置信息保存成功 ${a}`);
100
100
  }, B = [
101
101
  { title: "GitHub", value: E.GITHUB },
102
102
  { title: "Gitee", value: E.GITEE }
@@ -136,7 +136,7 @@ const le = 3e4, y = Math.random(), U = {
136
136
  platform: e,
137
137
  username: t
138
138
  };
139
- e || (s.platform = (await h(v())).platform), t || (s.username = (await h(K())).username);
139
+ e || (s.platform = (await d(v())).platform), t || (s.username = (await d(K())).username);
140
140
  const { platform: r, username: o } = s;
141
141
  let c = [];
142
142
  const n = Me({
@@ -145,13 +145,13 @@ const le = 3e4, y = Math.random(), U = {
145
145
  });
146
146
  let g = n == null ? void 0 : n.accessToken;
147
147
  i.stage(`正在获取${o}的${r}仓库列表...`);
148
- const l = {
148
+ const f = {
149
149
  username: o,
150
150
  accessToken: g
151
151
  };
152
152
  switch (s.platform) {
153
153
  case E.GITHUB: {
154
- c = (await (l.accessToken ? he : Ee)(l)).data.map((m) => ({
154
+ c = (await (f.accessToken ? de : Ee)(f)).data.map((m) => ({
155
155
  name: m.name,
156
156
  httpUrl: m.clone_url,
157
157
  sshUrl: m.ssh_url,
@@ -160,7 +160,7 @@ const le = 3e4, y = Math.random(), U = {
160
160
  break;
161
161
  }
162
162
  case E.GITEE: {
163
- c = (await (l.accessToken ? ue : fe)(l)).data.map((m) => ({
163
+ c = (await (f.accessToken ? ue : le)(f)).data.map((m) => ({
164
164
  name: m.name,
165
165
  httpUrl: m.html_url,
166
166
  sshUrl: m.ssh_url,
@@ -176,7 +176,7 @@ const le = 3e4, y = Math.random(), U = {
176
176
  return;
177
177
  } else
178
178
  i.stage(`共${c.length}个仓库`);
179
- const { repoUrl: a } = await h({
179
+ const { repoUrl: a } = await d({
180
180
  name: "repoUrl",
181
181
  type: "select",
182
182
  message: "选择仓库",
@@ -203,7 +203,7 @@ const le = 3e4, y = Math.random(), U = {
203
203
  p.PRE_REBASE
204
204
  ], $ = (e) => {
205
205
  const {
206
- [f.CHECK]: { [C.REVERSE_MERGE]: t }
206
+ [l.CHECK]: { [C.REVERSE_MERGE]: t }
207
207
  } = e;
208
208
  return t;
209
209
  }, Te = (e) => Math.max(
@@ -213,7 +213,7 @@ const le = 3e4, y = Math.random(), U = {
213
213
  (s, [r, { afterHash: o, logCount: c }]) => {
214
214
  let n = c - 1;
215
215
  if (o) {
216
- const g = t.findIndex((l) => l.hash === o);
216
+ const g = t.findIndex((f) => f.hash === o);
217
217
  g !== -1 && (i.info(
218
218
  `${r} 设置 只检测 ${o} 之后的日志 即 下标 [0 - ${g})`
219
219
  ), n = Math.min(n, g - 1));
@@ -240,7 +240,7 @@ const le = 3e4, y = Math.random(), U = {
240
240
  );
241
241
  return n || i.skip(`跳过: 允许${r} => ${o}`), n;
242
242
  }, Ge = {
243
- [f.CHECK]: {
243
+ [l.CHECK]: {
244
244
  [C.REVERSE_MERGE]: {
245
245
  [/^test$/.source]: {
246
246
  includeRebase: !0,
@@ -256,15 +256,15 @@ const le = 3e4, y = Math.random(), U = {
256
256
  type: {
257
257
  alias: "t",
258
258
  describe: "初始化类型",
259
- choices: [d.DEFAULT, d.CLONE_CONFIG],
260
- default: d.DEFAULT
259
+ choices: [h.DEFAULT, h.CLONE_CONFIG],
260
+ default: h.DEFAULT
261
261
  }
262
262
  }), ke = (e) => {
263
263
  N(`npm pkg set scripts.postprepare="${e} init"`);
264
264
  }, j = async (e) => {
265
265
  const { type: t } = e;
266
266
  switch (t) {
267
- case d.DEFAULT: {
267
+ case h.DEFAULT: {
268
268
  const { rootDir: s, isSubCommand: r, _: o } = e, c = `${e.$0}${r ? ` ${o[0]}` : ""}`;
269
269
  return await ee({
270
270
  hookNames: Ie,
@@ -276,8 +276,8 @@ const le = 3e4, y = Math.random(), U = {
276
276
  }
277
277
  });
278
278
  }
279
- case d.CLONE_CONFIG: {
280
- const { rootDir: s } = e, { platform: r } = await h(v()), { username: o } = await h(K()), { accessToken: c } = await h($e);
279
+ case h.CLONE_CONFIG: {
280
+ const { rootDir: s } = e, { platform: r } = await d(v()), { username: o } = await d(K()), { accessToken: c } = await d($e);
281
281
  return Ce({
282
282
  rootDir: s,
283
283
  platform: r,
@@ -289,7 +289,7 @@ const le = 3e4, y = Math.random(), U = {
289
289
  throw new Error(`未知的初始化类型: ${t}`);
290
290
  }
291
291
  }, be = {
292
- command: f.INIT,
292
+ command: l.INIT,
293
293
  describe: "初始化配置文件",
294
294
  options: Pe(),
295
295
  handler: j
@@ -316,7 +316,7 @@ const le = 3e4, y = Math.random(), U = {
316
316
  { stdio: "inherit" }
317
317
  ), i.success(`克隆${t}成功`);
318
318
  }, Be = {
319
- command: `${f.CLONE} <platform> <username>`,
319
+ command: `${l.CLONE} <platform> <username>`,
320
320
  describe: "从选择的git平台克隆代码",
321
321
  options: we(),
322
322
  positionals: ye(),
@@ -369,7 +369,7 @@ const le = 3e4, y = Math.random(), U = {
369
369
  configMap: c,
370
370
  currentBranch: t
371
371
  })) {
372
- const { fromBranch: g, toBranch: l = t } = o, a = `禁止${g}被合并: ${g} => ${l}
372
+ const { fromBranch: g, toBranch: f = t } = o, a = `禁止${g}被合并: ${g} => ${f}
373
373
 
374
374
  --------- 建议 ---------
375
375
  可以通过
@@ -387,7 +387,7 @@ const le = 3e4, y = Math.random(), U = {
387
387
  const s = $(e), r = Te(s);
388
388
  if (!r)
389
389
  return;
390
- const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash), l = ie({
390
+ const o = ae({ count: r }), c = Se(s, o), n = o.map((a) => a.hash), f = ie({
391
391
  /** 考虑reflog存在往复切换 */
392
392
  count: r + 30,
393
393
  filterItem: (a) => n.includes(a.hash)
@@ -397,7 +397,7 @@ const le = 3e4, y = Math.random(), U = {
397
397
  );
398
398
  o.forEach((a, m) => {
399
399
  var P;
400
- const O = a.mergeInfo || ((P = l[a.hash]) == null ? void 0 : P.mergeInfo);
400
+ const O = a.mergeInfo || ((P = f[a.hash]) == null ? void 0 : P.mergeInfo);
401
401
  O && Object.entries(s).forEach(([k]) => {
402
402
  const b = c[k];
403
403
  if (m > b) {
@@ -501,7 +501,7 @@ const le = 3e4, y = Math.random(), U = {
501
501
  throw new Error(`不支持的检测类型${s}`);
502
502
  }
503
503
  }, Fe = {
504
- command: `${f.CHECK} <type>`,
504
+ command: `${l.CHECK} <type>`,
505
505
  describe: "检查git操作",
506
506
  options: Ne(),
507
507
  positionals: Le(),
@@ -559,20 +559,20 @@ const le = 3e4, y = Math.random(), U = {
559
559
  i.error(`${t} 当前未支持处理`);
560
560
  }
561
561
  }, Ke = {
562
- command: `${f.HOOKS} <name> [args...]`,
562
+ command: `${l.HOOKS} <name> [args...]`,
563
563
  describe: "git钩子回调",
564
564
  options: De(),
565
565
  positionals: ve(),
566
566
  handler: J
567
567
  }, Ye = async (e, t) => {
568
568
  switch (e) {
569
- case f.INIT:
569
+ case l.INIT:
570
570
  return j(t);
571
- case f.CLONE:
571
+ case l.CLONE:
572
572
  return V(t);
573
- case f.HOOKS:
573
+ case l.HOOKS:
574
574
  return J(t);
575
- case f.CHECK:
575
+ case l.CHECK:
576
576
  return q(t);
577
577
  default:
578
578
  throw new Error(`不支持的命令 ${e}`);
@@ -592,8 +592,8 @@ const le = 3e4, y = Math.random(), U = {
592
592
  export {
593
593
  C,
594
594
  E as G,
595
- d as I,
596
- f as S,
595
+ h as I,
596
+ l as S,
597
597
  K as a,
598
598
  Oe as b,
599
599
  Ze as c,
package/es/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { o as i, C as l, G as t, I as d, S as c, m as C, l as p, f, h, c as u, b as k, n as I, k as E, j as b, e as H, d as g } from "./index-9d4e7eeb.js";
3
- import { a as S } from "./index-7475a061.js";
2
+ import { o as i, C as l, G as t, I as d, S as c, m as C, l as p, f, h, c as u, b as k, n as I, k as E, j as b, e as H, d as g } from "./index-d7ef8756.js";
3
+ import { a as S } from "./index-1c9dde81.js";
4
4
  import "@done-coding/cli-utils";
5
5
  import "node:fs";
6
6
  import "node:path";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@done-coding/cli-git",
3
- "version": "0.6.14-alpha.2",
3
+ "version": "0.6.14",
4
4
  "description": "git跨平台操作命令行工具",
5
5
  "private": false,
6
6
  "module": "es/index.mjs",
@@ -49,7 +49,7 @@
49
49
  "license": "MIT",
50
50
  "sideEffects": false,
51
51
  "devDependencies": {
52
- "@done-coding/cli-inject": "0.5.22-alpha.2",
52
+ "@done-coding/cli-inject": "0.5.22",
53
53
  "@types/node": "^18.0.0",
54
54
  "@types/yargs": "^17.0.28",
55
55
  "typescript": "^5.8.3",
@@ -57,12 +57,12 @@
57
57
  "vite-plugin-dts": "^3.6.0"
58
58
  },
59
59
  "dependencies": {
60
- "@done-coding/cli-utils": "0.8.3-alpha.2",
60
+ "@done-coding/cli-utils": "0.8.3",
61
61
  "@done-coding/request-axios": "^1.2.2",
62
62
  "axios": "^1.8.4"
63
63
  },
64
64
  "engines": {
65
65
  "node": ">=18.0.0"
66
66
  },
67
- "gitHead": "57548a940adaa810d2d0c870df54d5013a86bfed"
67
+ "gitHead": "4893b466954ef5925151d8dfc8fc8aa558ce654c"
68
68
  }