gennady 0.8.4-draft.2 → 0.8.4-draft.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.
- package/ai/directives/sdd-v2/root.directive.xml +36 -3
- package/ai/directives/sdd-v2/router.directive.xml +22 -1
- package/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
- package/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
- package/ai/skills/agent-inbox/SKILL.md +1 -1
- package/ai/skills/sdd/SKILL.md +5 -3
- package/ai/skills/sdd-audit/SKILL.md +5 -2
- package/ai/skills/sdd-check/SKILL.md +2 -2
- package/ai/skills/sdd-code-review/SKILL.md +4 -1
- package/ai/skills/sdd-critic/SKILL.md +5 -2
- package/ai/skills/sdd-execute/SKILL.md +5 -2
- package/ai/skills/sdd-reconcile/SKILL.md +5 -2
- package/ai/skills/sdd-scaffold/SKILL.md +5 -2
- package/dist/ai/directives/sdd-v2/root.directive.xml +36 -3
- package/dist/ai/directives/sdd-v2/router.directive.xml +22 -1
- package/dist/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
- package/dist/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
- package/dist/ai/skills/agent-inbox/SKILL.md +1 -1
- package/dist/ai/skills/sdd/SKILL.md +5 -3
- package/dist/ai/skills/sdd-audit/SKILL.md +5 -2
- package/dist/ai/skills/sdd-check/SKILL.md +2 -2
- package/dist/ai/skills/sdd-code-review/SKILL.md +4 -1
- package/dist/ai/skills/sdd-critic/SKILL.md +5 -2
- package/dist/ai/skills/sdd-execute/SKILL.md +5 -2
- package/dist/ai/skills/sdd-reconcile/SKILL.md +5 -2
- package/dist/ai/skills/sdd-scaffold/SKILL.md +5 -2
- package/dist/chunks/{classify-mr-stage.logic-BiCHTmPp.js → classify-mr-stage.logic-CazmQDwZ.js} +2 -2
- package/dist/chunks/{config-index-9VHWSDQD.js → config-index-DU8-FEjq.js} +1 -1
- package/dist/chunks/{devtools-b0DwO1x_.js → devtools-1JmXJjUG.js} +1 -1
- package/dist/chunks/{eval.cmd-CwNPaNJd.js → eval.cmd-CBANnOFG.js} +1 -1
- package/dist/chunks/{help-D5cXtdMI.js → help-DVloaFF5.js} +1 -1
- package/dist/chunks/{index-BVnJEutp.js → index-2xhpqJtd.js} +2 -2
- package/dist/chunks/{index-RR5OUxje.js → index-AxsLBUAx.js} +14 -14
- package/dist/chunks/{index-CUkeTGqM.js → index-B7sydB0W.js} +2 -2
- package/dist/chunks/{index-CMCn9ErF.js → index-BKxk4zOz.js} +2 -2
- package/dist/chunks/{index-Db13NlHh.js → index-BNMmX_Mv.js} +21 -21
- package/dist/chunks/{index-CmQO-RmM.js → index-BPzldG3a.js} +2 -2
- package/dist/chunks/{index-BOQl7F_Z.js → index-BQlFDvKW.js} +2 -2
- package/dist/chunks/{index-RzkvIfJQ.js → index-Baq7RL1L.js} +3 -3
- package/dist/chunks/index-BbPiwvY9.js +2 -0
- package/dist/chunks/{index-ClJLPEUB.js → index-BreGNLJ_.js} +1 -1
- package/dist/chunks/{index-DjSafAkN.js → index-BslPwGtM.js} +2 -2
- package/dist/chunks/{index-DiMFxS0z.js → index-BtCUN2fZ.js} +16 -16
- package/dist/chunks/{index-CS0VbiLD.js → index-C10-EOdB.js} +1 -1
- package/dist/chunks/{index-2BOEcJIa.js → index-C4JmZLaj.js} +2 -2
- package/dist/chunks/index-CA-JKLr4.js +2 -0
- package/dist/chunks/{index-43GiH--T.js → index-CG_jJZVu.js} +2 -2
- package/dist/chunks/{index-BdkFKsMm.js → index-CGyP2uDE.js} +3 -3
- package/dist/chunks/{index-BOKv0b01.js → index-CPl1s9XJ.js} +2 -2
- package/dist/chunks/{index-DIPrBH-4.js → index-CSxE4cEm.js} +9 -9
- package/dist/chunks/{index-Cm7U1-fU.js → index-CWR5EzXx.js} +2 -2
- package/dist/chunks/{index-BwN5llCR.js → index-Camql5kL.js} +2 -2
- package/dist/chunks/{index-Drh-J9O7.js → index-CdUiTipO.js} +7 -7
- package/dist/chunks/{index-Cn029KTN.js → index-Crg61pK5.js} +2 -2
- package/dist/chunks/{index-Dja2O-hV.js → index-Cv9ZYXso.js} +1 -1
- package/dist/chunks/{index-Ck8v_Gv7.js → index-D7ADMlG3.js} +1 -1
- package/dist/chunks/index-DNl2gC8l.js +158 -0
- package/dist/chunks/{index-BYIzl-Ut.js → index-DVJA0qVm.js} +36 -36
- package/dist/chunks/{index-BAEIZVx0.js → index-DcFJhkY1.js} +2 -2
- package/dist/chunks/{index-Dx5_CB2E.js → index-DdEd-L3x.js} +2 -2
- package/dist/chunks/{index-DVmqMmgb.js → index-DkGA1eW_.js} +32 -32
- package/dist/chunks/{index-3k7mPX1e.js → index-Dnwxlti3.js} +1 -1
- package/dist/chunks/{index-CrizvxOJ.js → index-DqdEJDi2.js} +2 -2
- package/dist/chunks/{index-BIPebtDl.js → index-DqiwmBt4.js} +1 -1
- package/dist/chunks/{index-DS4MhAw-.js → index-PfuqBWjY.js} +2 -2
- package/dist/chunks/{index-BmFT1Kx2.js → index-SVP6RfVl.js} +2 -2
- package/dist/chunks/{index-CDxV4b81.js → index-Y8wu48Q0.js} +1 -1
- package/dist/chunks/index-_ewSKppm.js +2 -0
- package/dist/chunks/{index-Ctcr_Qeu.js → index-aBVtCLIJ.js} +2 -2
- package/dist/chunks/index-dNdz9j6d.js +2 -0
- package/dist/chunks/{index-BFUkVkSo.js → index-gskOpu3H.js} +16 -16
- package/dist/chunks/{index-CXpkT25O.js → index-pBSLMn5Q.js} +3 -3
- package/dist/chunks/index-sqPhX5Io.js +2 -0
- package/dist/chunks/{index-BzmR4Es2.js → index-vfrjhUD1.js} +39 -39
- package/dist/chunks/{index-J2NvjjDV.js → index-xGF5XC_i.js} +2 -2
- package/dist/chunks/{run-review-command.logic-CA2Rjymb.js → run-review-command.logic-B9GoCxh-.js} +24 -24
- package/dist/chunks/{serve.cmd-RxYS6WoN.js → serve.cmd-UXkaeaPI.js} +2 -2
- package/dist/chunks/{services-Csd556Tv.js → services-BYCeGBlO.js} +4 -4
- package/dist/chunks/{shared-B5CTGvpG.js → shared-B3cXL2Np.js} +1178 -1117
- package/dist/chunks/{stats-index-BLztvK69.js → stats-index-AIAnnp9S.js} +2 -2
- package/dist/gennady.js +46 -46
- package/dist/index.js +4 -4
- package/dist/shared/sdd/ladder.d.ts +42 -0
- package/dist/shared/sdd/module-specs.d.ts +7 -0
- package/dist/shared/sdd/tracker.d.ts +9 -0
- package/package.json +1 -1
- package/dist/chunks/classify-mr-stage.logic-ClmhzQPQ.js +0 -53
- package/dist/chunks/config-index-RFeqlDWs.js +0 -104
- package/dist/chunks/devtools-p8tmPuLn.js +0 -79
- package/dist/chunks/eval.cmd-ewU5lcUY.js +0 -34
- package/dist/chunks/help-DzGnMNi2.js +0 -7
- package/dist/chunks/index--AXFi0ty.js +0 -89
- package/dist/chunks/index-64TSesTc.js +0 -186
- package/dist/chunks/index-9Gv5trS_.js +0 -125
- package/dist/chunks/index-B1DQIryA.js +0 -2
- package/dist/chunks/index-B1PiBeQ3.js +0 -2
- package/dist/chunks/index-B4rzuhkt.js +0 -183
- package/dist/chunks/index-B97HJjkg.js +0 -159
- package/dist/chunks/index-BF6qypm0.js +0 -131
- package/dist/chunks/index-BK84ZQsh.js +0 -128
- package/dist/chunks/index-BRVIirjj.js +0 -141
- package/dist/chunks/index-BXnryCGW.js +0 -96
- package/dist/chunks/index-BaZm7Otb.js +0 -2
- package/dist/chunks/index-Bhk746A2.js +0 -129
- package/dist/chunks/index-Bi-eY_dY.js +0 -164
- package/dist/chunks/index-BjumU69g.js +0 -2
- package/dist/chunks/index-BkWXcpXU.js +0 -16979
- package/dist/chunks/index-BlY4jQIA.js +0 -168
- package/dist/chunks/index-C0iy7GxD.js +0 -140
- package/dist/chunks/index-CCBTXczb.js +0 -56
- package/dist/chunks/index-CDAfkSrr.js +0 -2
- package/dist/chunks/index-CDHymWzC.js +0 -102
- package/dist/chunks/index-CNfXJAao.js +0 -2
- package/dist/chunks/index-CQsae1nq.js +0 -207
- package/dist/chunks/index-CVmd0prf.js +0 -2
- package/dist/chunks/index-CZuTNeNm.js +0 -2
- package/dist/chunks/index-CasNhhrL.js +0 -96
- package/dist/chunks/index-Ce7GWENF.js +0 -377
- package/dist/chunks/index-Cf-02TAg.js +0 -265
- package/dist/chunks/index-CfjQWSrh.js +0 -52
- package/dist/chunks/index-Chr7gBBz.js +0 -443
- package/dist/chunks/index-Ci875Zlg.js +0 -346
- package/dist/chunks/index-CwA6RzIB.js +0 -3793
- package/dist/chunks/index-D1dI63ej.js +0 -46
- package/dist/chunks/index-DCS32A2i.js +0 -663
- package/dist/chunks/index-DOFoNxvb.js +0 -131
- package/dist/chunks/index-DVkCEuws.js +0 -136
- package/dist/chunks/index-DkadaaXq.js +0 -658
- package/dist/chunks/index-Dn11CLtk.js +0 -7
- package/dist/chunks/index-Do3spFJT.js +0 -340
- package/dist/chunks/index-DrFRZ0Yg.js +0 -2
- package/dist/chunks/index-DvEQhXi2.js +0 -1054
- package/dist/chunks/index-GiS0x6jg.js +0 -90
- package/dist/chunks/index-NacvqeQ5.js +0 -69
- package/dist/chunks/index-RNJhFzdr.js +0 -227
- package/dist/chunks/index-R_vUB6CL.js +0 -2
- package/dist/chunks/index-TQft1s5H.js +0 -20
- package/dist/chunks/index-ZmQRP38W.js +0 -26969
- package/dist/chunks/index-jdOZ4AkD.js +0 -143
- package/dist/chunks/index-kNa21kUI.js +0 -279
- package/dist/chunks/index-v4AV9kAc.js +0 -108
- package/dist/chunks/run-review-command.logic-CU1Slmc_.js +0 -331
- package/dist/chunks/serve.cmd-dWu_k_G_.js +0 -162
- package/dist/chunks/services-CwvXl2MB.js +0 -46832
- package/dist/chunks/shared-DSZTUx5b.js +0 -4509
- package/dist/chunks/stats-index-H6ALcjxy.js +0 -66
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
import { execFileSync as O } from "node:child_process";
|
|
2
|
-
import { mkdirSync as ie, writeFileSync as ye, readdirSync as ve } from "node:fs";
|
|
3
|
-
import { homedir as ke } from "node:os";
|
|
4
|
-
import { join as le } from "node:path";
|
|
5
|
-
import { s as V, r as Se, c as be } from "./shared-DSZTUx5b.js";
|
|
6
|
-
import { b as Ae, d as Re, c as xe, v as Ce, u as je, w as Pe, x as De, y as _e, z as He, W as Be, A as Me, B as Ee, C as Ne, P as Te, F as Oe, G as Ie, H as Le, I as Fe, J as ce, K as We, L as Ue } from "./services-CwvXl2MB.js";
|
|
7
|
-
import { b as qe, f as Ge, c as Je, a as ze, l as Ve } from "./classify-mr-stage.logic-BiCHTmPp.js";
|
|
8
|
-
function P(e, t) {
|
|
9
|
-
const n = e.find((a) => a.startsWith(`${t}=`));
|
|
10
|
-
if (n) return n.slice(t.length + 1);
|
|
11
|
-
const c = e.indexOf(t);
|
|
12
|
-
return c !== -1 ? e[c + 1] : void 0;
|
|
13
|
-
}
|
|
14
|
-
function I(e, t) {
|
|
15
|
-
return O("git", e, {
|
|
16
|
-
cwd: t,
|
|
17
|
-
encoding: "utf8",
|
|
18
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
19
|
-
}).trim();
|
|
20
|
-
}
|
|
21
|
-
const de = {
|
|
22
|
-
deps: [
|
|
23
|
-
/(^|\/)package\.json$/,
|
|
24
|
-
/(^|\/)package-lock\.json$/,
|
|
25
|
-
/(^|\/)yarn\.lock$/,
|
|
26
|
-
/(^|\/)pnpm-lock\.yaml$/,
|
|
27
|
-
/(^|\/)\.npmrc$/,
|
|
28
|
-
/(^|\/)npm-shrinkwrap\.json$/,
|
|
29
|
-
/(^|\/)go\.mod$/,
|
|
30
|
-
/(^|\/)go\.sum$/,
|
|
31
|
-
/(^|\/)requirements\.txt$/,
|
|
32
|
-
/(^|\/)pyproject\.toml$/,
|
|
33
|
-
/(^|\/)Pipfile$/,
|
|
34
|
-
/(^|\/)Pipfile\.lock$/,
|
|
35
|
-
/(^|\/)setup\.py$/,
|
|
36
|
-
/(^|\/)setup\.cfg$/,
|
|
37
|
-
/(^|\/)poetry\.lock$/,
|
|
38
|
-
/(^|\/)Cargo\.toml$/,
|
|
39
|
-
/(^|\/)Cargo\.lock$/,
|
|
40
|
-
/(^|\/)Gemfile$/,
|
|
41
|
-
/(^|\/)Gemfile\.lock$/,
|
|
42
|
-
/(^|\/)composer\.json$/,
|
|
43
|
-
/(^|\/)composer\.lock$/,
|
|
44
|
-
/(^|\/)pom\.xml$/,
|
|
45
|
-
/(^|\/)build\.gradle(\.kts)?$/,
|
|
46
|
-
/(^|\/)gradle\.lockfile$/,
|
|
47
|
-
/(^|\/)settings\.gradle(\.kts)?$/,
|
|
48
|
-
/(^|\/)mix\.exs$/,
|
|
49
|
-
/(^|\/)mix\.lock$/,
|
|
50
|
-
/(^|\/)stack\.yaml$/,
|
|
51
|
-
/(^|\/)cabal\.project$/,
|
|
52
|
-
/(^|\/)Package\.swift$/,
|
|
53
|
-
/(^|\/)Package\.resolved$/,
|
|
54
|
-
/(^|\/)pubspec\.yaml$/,
|
|
55
|
-
/(^|\/)pubspec\.lock$/,
|
|
56
|
-
/(^|\/)build\.zig\.zon$/,
|
|
57
|
-
/(^|\/)deno\.jsonc?$/,
|
|
58
|
-
/(^|\/)deno\.lock$/,
|
|
59
|
-
/(^|\/)Dockerfile$/,
|
|
60
|
-
/(^|\/)docker-compose\.ya?ml$/,
|
|
61
|
-
/\.cabal$/,
|
|
62
|
-
/\.csproj$/,
|
|
63
|
-
/\.fsproj$/,
|
|
64
|
-
/\.vbproj$/,
|
|
65
|
-
/\.nimble$/,
|
|
66
|
-
/\.gemspec$/,
|
|
67
|
-
/(^|\/)packages\.config$/,
|
|
68
|
-
/(^|\/)paket\.(dependencies|lock)$/,
|
|
69
|
-
/(^|\/)Directory\.Packages\.props$/,
|
|
70
|
-
/(^|\/)conanfile\.(txt|py)$/,
|
|
71
|
-
/(^|\/)vcpkg\.json$/,
|
|
72
|
-
/(^|\/)bun\.lockb?$/,
|
|
73
|
-
/\.nuspec$/,
|
|
74
|
-
/(^|\/)Podfile$/,
|
|
75
|
-
/(^|\/)Cartfile$/,
|
|
76
|
-
/\.podspec$/,
|
|
77
|
-
/(^|\/)\.tool-versions$/,
|
|
78
|
-
/(^|\/)\.python-version$/
|
|
79
|
-
],
|
|
80
|
-
tests: [/\.(test|spec)\.(ts|tsx|js|jsx)$/, /__tests__\//],
|
|
81
|
-
docs: [/\.(md|mdx)$/, /^docs\//, /^specs\//],
|
|
82
|
-
config: [/\.(json|yaml|yml|toml)$/, /^\./, /Dockerfile/, /Makefile/],
|
|
83
|
-
assets: [
|
|
84
|
-
/\.(png|jpg|jpeg|gif|svg|ico|webp|avif)$/,
|
|
85
|
-
/\.(woff2?|ttf|eot|otf)$/,
|
|
86
|
-
/\.(pdf|xlsx?|docx?)$/
|
|
87
|
-
]
|
|
88
|
-
};
|
|
89
|
-
function Ke(e) {
|
|
90
|
-
for (const [t, n] of Object.entries(de))
|
|
91
|
-
if (n.some((c) => c.test(e))) return t;
|
|
92
|
-
return "code";
|
|
93
|
-
}
|
|
94
|
-
function Qe(e) {
|
|
95
|
-
const t = e.split(" ");
|
|
96
|
-
if (t.length < 3) return null;
|
|
97
|
-
const n = t[0] === "-" ? 0 : Number(t[0]) || 0, c = t[1] === "-" ? 0 : Number(t[1]) || 0;
|
|
98
|
-
return { plus: n, minus: c };
|
|
99
|
-
}
|
|
100
|
-
function ue() {
|
|
101
|
-
return { files: 0, plus: 0, minus: 0, added: 0 };
|
|
102
|
-
}
|
|
103
|
-
function Ye(e, t) {
|
|
104
|
-
const n = I(["diff", "--name-status", t, "HEAD"], e).split(`
|
|
105
|
-
`).filter(Boolean).map((r) => {
|
|
106
|
-
const [u, ...y] = r.split(" ");
|
|
107
|
-
return { status: u, path: y.join(" ") };
|
|
108
|
-
}), c = I(["diff", "--numstat", t, "HEAD"], e).split(`
|
|
109
|
-
`).filter(Boolean), a = [], p = {}, E = new Set(n.filter((r) => r.status === "A").map((r) => r.path));
|
|
110
|
-
for (let r = 0; r < Math.min(c.length, n.length); r++) {
|
|
111
|
-
const u = Qe(c[r]);
|
|
112
|
-
if (!u) continue;
|
|
113
|
-
const y = n[r], _ = y.path, m = Ke(_);
|
|
114
|
-
a.push({ path: _, status: y.status, plus: u.plus, minus: u.minus }), p[m] ??= ue(), p[m].files++, p[m].plus += u.plus, p[m].minus += u.minus, E.has(_) && p[m].added++;
|
|
115
|
-
}
|
|
116
|
-
for (const r of Object.keys(de))
|
|
117
|
-
p[r] ??= ue();
|
|
118
|
-
const D = {
|
|
119
|
-
files: a.length,
|
|
120
|
-
plus: a.reduce((r, u) => r + u.plus, 0),
|
|
121
|
-
minus: a.reduce((r, u) => r + u.minus, 0)
|
|
122
|
-
};
|
|
123
|
-
return { files: a, totals: D, byCategory: p };
|
|
124
|
-
}
|
|
125
|
-
function Xe(e) {
|
|
126
|
-
const t = ve(e, { withFileTypes: !0 }), n = [], c = [];
|
|
127
|
-
for (const a of t)
|
|
128
|
-
a.name.startsWith(".git") || (a.isDirectory() ? n.push(a.name + "/") : a.isFile() && c.push(a.name));
|
|
129
|
-
return n.sort(), c.sort(), { dirs: n, rootFiles: c };
|
|
130
|
-
}
|
|
131
|
-
async function Ze() {
|
|
132
|
-
try {
|
|
133
|
-
const e = process.argv.slice(2), t = Ae(e), n = e.includes("--skip-worktree"), c = e.includes("--skip-threads"), a = e.includes("--force-review"), p = P(e, "--url"), E = P(e, "--ref");
|
|
134
|
-
if (!p && !E)
|
|
135
|
-
return console.error(
|
|
136
|
-
V.redBright.bold("✖ Ошибка:"),
|
|
137
|
-
"Укажите --url <webUrl> или --ref group/project!iid"
|
|
138
|
-
), 1;
|
|
139
|
-
const D = P(e, "--vcs-host") ?? P(e, "--vcs-source"), r = P(e, "--repos-base");
|
|
140
|
-
let u = null;
|
|
141
|
-
try {
|
|
142
|
-
u = await Re(xe(t));
|
|
143
|
-
} catch {
|
|
144
|
-
}
|
|
145
|
-
const y = u ?? { version: 1, reposBase: void 0, vcsHost: void 0 }, _ = Ce(y), m = /* @__PURE__ */ new Set();
|
|
146
|
-
(D || p) && m.add("vcsHost"), r && m.add("reposBase");
|
|
147
|
-
const K = _.missing.filter((i) => !m.has(i));
|
|
148
|
-
if (K.length > 0)
|
|
149
|
-
return e.includes("--json") ? console.info(JSON.stringify({ configured: !1, missing: K })) : console.info(
|
|
150
|
-
V.yellow("ℹ agent-inbox не настроен. Запустите gennady inbox config --init")
|
|
151
|
-
), 0;
|
|
152
|
-
const H = await Se({ url: p, ref: E, host: D }), $ = H.project, h = String(H.iid), pe = H.host, fe = H.token, L = be(H), g = await L.MergeRequests.getByIid({ project: $, iid: h }), he = g?.title ?? "", A = g?.web_url ?? "", ge = g?.source_branch ?? "", N = g?.target_branch ?? "", me = g?.created_at ?? "", $e = g?.updated_at ?? "", B = g?.diff_refs, we = g?.description ?? "", Q = g?.author?.username ?? "", Y = g?.reviewers?.map((i) => i.username ?? "").filter(Boolean) ?? [];
|
|
153
|
-
let R = null, X = null, v = null;
|
|
154
|
-
if (!n) {
|
|
155
|
-
const i = r ?? y.reposBase ?? le(ke(), "Developer"), o = await je($, pe, fe, {
|
|
156
|
-
reposBase: i,
|
|
157
|
-
reposMapPath: De(t),
|
|
158
|
-
clonesRoot: Pe(t)
|
|
159
|
-
}), s = P(e, "--worktree-dir");
|
|
160
|
-
let j;
|
|
161
|
-
if (s)
|
|
162
|
-
j = s;
|
|
163
|
-
else {
|
|
164
|
-
const b = _e(t);
|
|
165
|
-
ie(b, { recursive: !0 }), await He(b, Be, Date.now()), Me(b, Ee, Date.now()), Ne(t, Te, Date.now()), j = Oe(t, `${$}!${h}`);
|
|
166
|
-
}
|
|
167
|
-
const d = await Ie(o, h, j);
|
|
168
|
-
v = d.headSha;
|
|
169
|
-
let l = "";
|
|
170
|
-
if (N) {
|
|
171
|
-
try {
|
|
172
|
-
O("git", ["-c", "core.hooksPath=/dev/null", "fetch", "origin", N], {
|
|
173
|
-
cwd: o,
|
|
174
|
-
stdio: "ignore"
|
|
175
|
-
});
|
|
176
|
-
} catch {
|
|
177
|
-
}
|
|
178
|
-
try {
|
|
179
|
-
l = await Le(
|
|
180
|
-
o,
|
|
181
|
-
N,
|
|
182
|
-
d.headSha,
|
|
183
|
-
B?.base_sha
|
|
184
|
-
);
|
|
185
|
-
} catch {
|
|
186
|
-
l = "";
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (l) {
|
|
190
|
-
if (a && B?.base_sha && l === d.headSha)
|
|
191
|
-
try {
|
|
192
|
-
O(
|
|
193
|
-
"git",
|
|
194
|
-
["merge-base", "--is-ancestor", B.base_sha, d.headSha],
|
|
195
|
-
{ cwd: d.worktreePath, stdio: "ignore" }
|
|
196
|
-
), l = B.base_sha;
|
|
197
|
-
} catch {
|
|
198
|
-
}
|
|
199
|
-
X = Ye(d.worktreePath, l);
|
|
200
|
-
}
|
|
201
|
-
R = {
|
|
202
|
-
path: d.worktreePath,
|
|
203
|
-
base: l,
|
|
204
|
-
diffRefs: B,
|
|
205
|
-
repoLayout: Xe(d.worktreePath)
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
const Z = qe(D, y.vcsHost), S = (await Z.getCurrentUser()).login, ee = Q === S, te = Y.includes(S);
|
|
209
|
-
let w = null, F = Q, W = Y, U = we, q = [];
|
|
210
|
-
try {
|
|
211
|
-
const o = (await Z.Inbox.getActionable({ iid: h })).find((s) => s.project === $ && s.iid === h);
|
|
212
|
-
o ? (w = o.role, F = o.author || F, W = o.reviewers.length > 0 ? o.reviewers : W, U = o.description || U, q = o.approvedBy ?? []) : w = ee ? "author" : te ? "reviewer" : null;
|
|
213
|
-
} catch {
|
|
214
|
-
w = ee ? "author" : te ? "reviewer" : null;
|
|
215
|
-
}
|
|
216
|
-
let G = !1, T = null, se = null, oe = null, re = null;
|
|
217
|
-
if (!c) {
|
|
218
|
-
const [i, o] = await Promise.all([
|
|
219
|
-
L.MergeDiscussions.getAll({ project: $, iid: h }),
|
|
220
|
-
L.MergeDiscussions.listDraftNotes({ project: $, iid: h })
|
|
221
|
-
]), s = Ge(i);
|
|
222
|
-
T = Je(s, S, w, a), se = ze(s, S, w, a).openNotes.length, oe = Ve(s), re = { total: i.length, drafts: o.length }, G = i.some(
|
|
223
|
-
(d) => d.notes?.some(
|
|
224
|
-
(l) => l.system === !0 && typeof l.body == "string" && l.body.includes("approved this merge request") && l.author?.username === S
|
|
225
|
-
)
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
|
-
let M = null, k = null, x, C, ne = !1;
|
|
229
|
-
const ae = q.includes(S);
|
|
230
|
-
if (!n && v) {
|
|
231
|
-
const i = Fe(ce(t)), o = A ? i.entries[A] : void 0;
|
|
232
|
-
if (x = o?.lastReviewedHeadSha, C = o?.lastApprovedHeadSha, !C && G && (C = o?.lastReviewedHeadSha ?? v), ne = !!C && !ae && C !== v, !x || x === v)
|
|
233
|
-
M = { kind: "none", newCommitCount: 0 }, k = [];
|
|
234
|
-
else {
|
|
235
|
-
let s = !1;
|
|
236
|
-
try {
|
|
237
|
-
O("git", ["merge-base", "--is-ancestor", x, "HEAD"], {
|
|
238
|
-
cwd: R.path,
|
|
239
|
-
stdio: "ignore"
|
|
240
|
-
}), s = !0;
|
|
241
|
-
} catch {
|
|
242
|
-
}
|
|
243
|
-
if (s) {
|
|
244
|
-
try {
|
|
245
|
-
k = I(
|
|
246
|
-
["log", "--format=%H%x09%s%x09%an%x09%aI", `${x}..HEAD`],
|
|
247
|
-
R.path
|
|
248
|
-
).split(`
|
|
249
|
-
`).filter(Boolean).map((d) => {
|
|
250
|
-
const [l, b, J, z] = d.split(" ");
|
|
251
|
-
return { sha: l, subject: b, author: J, date: z };
|
|
252
|
-
});
|
|
253
|
-
} catch {
|
|
254
|
-
k = [];
|
|
255
|
-
}
|
|
256
|
-
M = { kind: "fast_forward", newCommitCount: k.length };
|
|
257
|
-
} else {
|
|
258
|
-
try {
|
|
259
|
-
k = I(
|
|
260
|
-
["log", "--format=%H%x09%s%x09%an%x09%aI", "HEAD", "--max-count=50"],
|
|
261
|
-
R.path
|
|
262
|
-
).split(`
|
|
263
|
-
`).filter(Boolean).map((d) => {
|
|
264
|
-
const [l, b, J, z] = d.split(" ");
|
|
265
|
-
return { sha: l, subject: b, author: J, date: z };
|
|
266
|
-
});
|
|
267
|
-
} catch {
|
|
268
|
-
k = [];
|
|
269
|
-
}
|
|
270
|
-
M = { kind: "rewritten", newCommitCount: k.length };
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (A) {
|
|
274
|
-
const s = i.entries[A];
|
|
275
|
-
i.entries[A] = {
|
|
276
|
-
project: $,
|
|
277
|
-
iid: h,
|
|
278
|
-
role: s?.role ?? w,
|
|
279
|
-
stage: s?.stage ?? "idle",
|
|
280
|
-
lastSeenUpdatedAt: s?.lastSeenUpdatedAt ?? "",
|
|
281
|
-
firstSeenAt: s?.firstSeenAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
282
|
-
lastClassifiedAt: s?.lastClassifiedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
283
|
-
lastReviewedHeadSha: v,
|
|
284
|
-
lastApprovedHeadSha: ae ? v : s?.lastApprovedHeadSha ?? (G ? v : void 0)
|
|
285
|
-
}, We(ce(t), i);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
const f = {
|
|
289
|
-
ref: `${$}!${h}`,
|
|
290
|
-
title: he,
|
|
291
|
-
webUrl: A,
|
|
292
|
-
sourceBranch: ge,
|
|
293
|
-
targetBranch: N,
|
|
294
|
-
createdAt: me,
|
|
295
|
-
updatedAt: $e,
|
|
296
|
-
myLogin: S,
|
|
297
|
-
myRole: w,
|
|
298
|
-
author: F,
|
|
299
|
-
reviewers: W,
|
|
300
|
-
description: U,
|
|
301
|
-
approvedBy: q,
|
|
302
|
-
headChanged: M,
|
|
303
|
-
newCommits: k,
|
|
304
|
-
lastReviewedHeadSha: x ?? null,
|
|
305
|
-
lastApprovedHeadSha: C ?? null,
|
|
306
|
-
myApprovalReset: ne,
|
|
307
|
-
reviewPlanRequired: R !== null && (T === "review_needed" || T === null && w === "reviewer" || w === "author" || M?.kind === "fast_forward"),
|
|
308
|
-
worktree: R,
|
|
309
|
-
changeset: X,
|
|
310
|
-
stage: T,
|
|
311
|
-
openQuestions: se,
|
|
312
|
-
lastAuthor: oe,
|
|
313
|
-
threadStats: re
|
|
314
|
-
};
|
|
315
|
-
if (e.includes("--json-file")) {
|
|
316
|
-
const i = `${$}!${h}`, o = Ue(t, i);
|
|
317
|
-
ie(o, { recursive: !0 });
|
|
318
|
-
const s = le(o, "context.json");
|
|
319
|
-
ye(s, JSON.stringify(f, null, 2), "utf-8"), console.info(
|
|
320
|
-
JSON.stringify({
|
|
321
|
-
file: s,
|
|
322
|
-
ref: f.ref,
|
|
323
|
-
title: f.title,
|
|
324
|
-
webUrl: f.webUrl,
|
|
325
|
-
myRole: f.myRole,
|
|
326
|
-
stage: f.stage,
|
|
327
|
-
author: f.author,
|
|
328
|
-
headChanged: f.headChanged,
|
|
329
|
-
changeset: f.changeset?.totals ?? null,
|
|
330
|
-
reviewPlanRequired: f.reviewPlanRequired
|
|
331
|
-
})
|
|
332
|
-
);
|
|
333
|
-
} else
|
|
334
|
-
console.info(JSON.stringify(f, null, 2));
|
|
335
|
-
return 0;
|
|
336
|
-
} catch (e) {
|
|
337
|
-
return console.error(V.redBright.bold("✖ Ошибка:"), e.message ?? String(e)), 1;
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
process.exit(await Ze());
|