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.
Files changed (146) hide show
  1. package/ai/directives/sdd-v2/root.directive.xml +36 -3
  2. package/ai/directives/sdd-v2/router.directive.xml +22 -1
  3. package/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
  4. package/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
  5. package/ai/skills/agent-inbox/SKILL.md +1 -1
  6. package/ai/skills/sdd/SKILL.md +5 -3
  7. package/ai/skills/sdd-audit/SKILL.md +5 -2
  8. package/ai/skills/sdd-check/SKILL.md +2 -2
  9. package/ai/skills/sdd-code-review/SKILL.md +4 -1
  10. package/ai/skills/sdd-critic/SKILL.md +5 -2
  11. package/ai/skills/sdd-execute/SKILL.md +5 -2
  12. package/ai/skills/sdd-reconcile/SKILL.md +5 -2
  13. package/ai/skills/sdd-scaffold/SKILL.md +5 -2
  14. package/dist/ai/directives/sdd-v2/root.directive.xml +36 -3
  15. package/dist/ai/directives/sdd-v2/router.directive.xml +22 -1
  16. package/dist/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
  17. package/dist/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
  18. package/dist/ai/skills/agent-inbox/SKILL.md +1 -1
  19. package/dist/ai/skills/sdd/SKILL.md +5 -3
  20. package/dist/ai/skills/sdd-audit/SKILL.md +5 -2
  21. package/dist/ai/skills/sdd-check/SKILL.md +2 -2
  22. package/dist/ai/skills/sdd-code-review/SKILL.md +4 -1
  23. package/dist/ai/skills/sdd-critic/SKILL.md +5 -2
  24. package/dist/ai/skills/sdd-execute/SKILL.md +5 -2
  25. package/dist/ai/skills/sdd-reconcile/SKILL.md +5 -2
  26. package/dist/ai/skills/sdd-scaffold/SKILL.md +5 -2
  27. package/dist/chunks/{classify-mr-stage.logic-BiCHTmPp.js → classify-mr-stage.logic-CazmQDwZ.js} +2 -2
  28. package/dist/chunks/{config-index-9VHWSDQD.js → config-index-DU8-FEjq.js} +1 -1
  29. package/dist/chunks/{devtools-b0DwO1x_.js → devtools-1JmXJjUG.js} +1 -1
  30. package/dist/chunks/{eval.cmd-CwNPaNJd.js → eval.cmd-CBANnOFG.js} +1 -1
  31. package/dist/chunks/{help-D5cXtdMI.js → help-DVloaFF5.js} +1 -1
  32. package/dist/chunks/{index-BVnJEutp.js → index-2xhpqJtd.js} +2 -2
  33. package/dist/chunks/{index-RR5OUxje.js → index-AxsLBUAx.js} +14 -14
  34. package/dist/chunks/{index-CUkeTGqM.js → index-B7sydB0W.js} +2 -2
  35. package/dist/chunks/{index-CMCn9ErF.js → index-BKxk4zOz.js} +2 -2
  36. package/dist/chunks/{index-Db13NlHh.js → index-BNMmX_Mv.js} +21 -21
  37. package/dist/chunks/{index-CmQO-RmM.js → index-BPzldG3a.js} +2 -2
  38. package/dist/chunks/{index-BOQl7F_Z.js → index-BQlFDvKW.js} +2 -2
  39. package/dist/chunks/{index-RzkvIfJQ.js → index-Baq7RL1L.js} +3 -3
  40. package/dist/chunks/index-BbPiwvY9.js +2 -0
  41. package/dist/chunks/{index-ClJLPEUB.js → index-BreGNLJ_.js} +1 -1
  42. package/dist/chunks/{index-DjSafAkN.js → index-BslPwGtM.js} +2 -2
  43. package/dist/chunks/{index-DiMFxS0z.js → index-BtCUN2fZ.js} +16 -16
  44. package/dist/chunks/{index-CS0VbiLD.js → index-C10-EOdB.js} +1 -1
  45. package/dist/chunks/{index-2BOEcJIa.js → index-C4JmZLaj.js} +2 -2
  46. package/dist/chunks/index-CA-JKLr4.js +2 -0
  47. package/dist/chunks/{index-43GiH--T.js → index-CG_jJZVu.js} +2 -2
  48. package/dist/chunks/{index-BdkFKsMm.js → index-CGyP2uDE.js} +3 -3
  49. package/dist/chunks/{index-BOKv0b01.js → index-CPl1s9XJ.js} +2 -2
  50. package/dist/chunks/{index-DIPrBH-4.js → index-CSxE4cEm.js} +9 -9
  51. package/dist/chunks/{index-Cm7U1-fU.js → index-CWR5EzXx.js} +2 -2
  52. package/dist/chunks/{index-BwN5llCR.js → index-Camql5kL.js} +2 -2
  53. package/dist/chunks/{index-Drh-J9O7.js → index-CdUiTipO.js} +7 -7
  54. package/dist/chunks/{index-Cn029KTN.js → index-Crg61pK5.js} +2 -2
  55. package/dist/chunks/{index-Dja2O-hV.js → index-Cv9ZYXso.js} +1 -1
  56. package/dist/chunks/{index-Ck8v_Gv7.js → index-D7ADMlG3.js} +1 -1
  57. package/dist/chunks/index-DNl2gC8l.js +158 -0
  58. package/dist/chunks/{index-BYIzl-Ut.js → index-DVJA0qVm.js} +36 -36
  59. package/dist/chunks/{index-BAEIZVx0.js → index-DcFJhkY1.js} +2 -2
  60. package/dist/chunks/{index-Dx5_CB2E.js → index-DdEd-L3x.js} +2 -2
  61. package/dist/chunks/{index-DVmqMmgb.js → index-DkGA1eW_.js} +32 -32
  62. package/dist/chunks/{index-3k7mPX1e.js → index-Dnwxlti3.js} +1 -1
  63. package/dist/chunks/{index-CrizvxOJ.js → index-DqdEJDi2.js} +2 -2
  64. package/dist/chunks/{index-BIPebtDl.js → index-DqiwmBt4.js} +1 -1
  65. package/dist/chunks/{index-DS4MhAw-.js → index-PfuqBWjY.js} +2 -2
  66. package/dist/chunks/{index-BmFT1Kx2.js → index-SVP6RfVl.js} +2 -2
  67. package/dist/chunks/{index-CDxV4b81.js → index-Y8wu48Q0.js} +1 -1
  68. package/dist/chunks/index-_ewSKppm.js +2 -0
  69. package/dist/chunks/{index-Ctcr_Qeu.js → index-aBVtCLIJ.js} +2 -2
  70. package/dist/chunks/index-dNdz9j6d.js +2 -0
  71. package/dist/chunks/{index-BFUkVkSo.js → index-gskOpu3H.js} +16 -16
  72. package/dist/chunks/{index-CXpkT25O.js → index-pBSLMn5Q.js} +3 -3
  73. package/dist/chunks/index-sqPhX5Io.js +2 -0
  74. package/dist/chunks/{index-BzmR4Es2.js → index-vfrjhUD1.js} +39 -39
  75. package/dist/chunks/{index-J2NvjjDV.js → index-xGF5XC_i.js} +2 -2
  76. package/dist/chunks/{run-review-command.logic-CA2Rjymb.js → run-review-command.logic-B9GoCxh-.js} +24 -24
  77. package/dist/chunks/{serve.cmd-RxYS6WoN.js → serve.cmd-UXkaeaPI.js} +2 -2
  78. package/dist/chunks/{services-Csd556Tv.js → services-BYCeGBlO.js} +4 -4
  79. package/dist/chunks/{shared-B5CTGvpG.js → shared-B3cXL2Np.js} +1178 -1117
  80. package/dist/chunks/{stats-index-BLztvK69.js → stats-index-AIAnnp9S.js} +2 -2
  81. package/dist/gennady.js +46 -46
  82. package/dist/index.js +4 -4
  83. package/dist/shared/sdd/ladder.d.ts +42 -0
  84. package/dist/shared/sdd/module-specs.d.ts +7 -0
  85. package/dist/shared/sdd/tracker.d.ts +9 -0
  86. package/package.json +1 -1
  87. package/dist/chunks/classify-mr-stage.logic-ClmhzQPQ.js +0 -53
  88. package/dist/chunks/config-index-RFeqlDWs.js +0 -104
  89. package/dist/chunks/devtools-p8tmPuLn.js +0 -79
  90. package/dist/chunks/eval.cmd-ewU5lcUY.js +0 -34
  91. package/dist/chunks/help-DzGnMNi2.js +0 -7
  92. package/dist/chunks/index--AXFi0ty.js +0 -89
  93. package/dist/chunks/index-64TSesTc.js +0 -186
  94. package/dist/chunks/index-9Gv5trS_.js +0 -125
  95. package/dist/chunks/index-B1DQIryA.js +0 -2
  96. package/dist/chunks/index-B1PiBeQ3.js +0 -2
  97. package/dist/chunks/index-B4rzuhkt.js +0 -183
  98. package/dist/chunks/index-B97HJjkg.js +0 -159
  99. package/dist/chunks/index-BF6qypm0.js +0 -131
  100. package/dist/chunks/index-BK84ZQsh.js +0 -128
  101. package/dist/chunks/index-BRVIirjj.js +0 -141
  102. package/dist/chunks/index-BXnryCGW.js +0 -96
  103. package/dist/chunks/index-BaZm7Otb.js +0 -2
  104. package/dist/chunks/index-Bhk746A2.js +0 -129
  105. package/dist/chunks/index-Bi-eY_dY.js +0 -164
  106. package/dist/chunks/index-BjumU69g.js +0 -2
  107. package/dist/chunks/index-BkWXcpXU.js +0 -16979
  108. package/dist/chunks/index-BlY4jQIA.js +0 -168
  109. package/dist/chunks/index-C0iy7GxD.js +0 -140
  110. package/dist/chunks/index-CCBTXczb.js +0 -56
  111. package/dist/chunks/index-CDAfkSrr.js +0 -2
  112. package/dist/chunks/index-CDHymWzC.js +0 -102
  113. package/dist/chunks/index-CNfXJAao.js +0 -2
  114. package/dist/chunks/index-CQsae1nq.js +0 -207
  115. package/dist/chunks/index-CVmd0prf.js +0 -2
  116. package/dist/chunks/index-CZuTNeNm.js +0 -2
  117. package/dist/chunks/index-CasNhhrL.js +0 -96
  118. package/dist/chunks/index-Ce7GWENF.js +0 -377
  119. package/dist/chunks/index-Cf-02TAg.js +0 -265
  120. package/dist/chunks/index-CfjQWSrh.js +0 -52
  121. package/dist/chunks/index-Chr7gBBz.js +0 -443
  122. package/dist/chunks/index-Ci875Zlg.js +0 -346
  123. package/dist/chunks/index-CwA6RzIB.js +0 -3793
  124. package/dist/chunks/index-D1dI63ej.js +0 -46
  125. package/dist/chunks/index-DCS32A2i.js +0 -663
  126. package/dist/chunks/index-DOFoNxvb.js +0 -131
  127. package/dist/chunks/index-DVkCEuws.js +0 -136
  128. package/dist/chunks/index-DkadaaXq.js +0 -658
  129. package/dist/chunks/index-Dn11CLtk.js +0 -7
  130. package/dist/chunks/index-Do3spFJT.js +0 -340
  131. package/dist/chunks/index-DrFRZ0Yg.js +0 -2
  132. package/dist/chunks/index-DvEQhXi2.js +0 -1054
  133. package/dist/chunks/index-GiS0x6jg.js +0 -90
  134. package/dist/chunks/index-NacvqeQ5.js +0 -69
  135. package/dist/chunks/index-RNJhFzdr.js +0 -227
  136. package/dist/chunks/index-R_vUB6CL.js +0 -2
  137. package/dist/chunks/index-TQft1s5H.js +0 -20
  138. package/dist/chunks/index-ZmQRP38W.js +0 -26969
  139. package/dist/chunks/index-jdOZ4AkD.js +0 -143
  140. package/dist/chunks/index-kNa21kUI.js +0 -279
  141. package/dist/chunks/index-v4AV9kAc.js +0 -108
  142. package/dist/chunks/run-review-command.logic-CU1Slmc_.js +0 -331
  143. package/dist/chunks/serve.cmd-dWu_k_G_.js +0 -162
  144. package/dist/chunks/services-CwvXl2MB.js +0 -46832
  145. package/dist/chunks/shared-DSZTUx5b.js +0 -4509
  146. package/dist/chunks/stats-index-H6ALcjxy.js +0 -66
@@ -1,168 +0,0 @@
1
- import { readFileSync as x, writeFileSync as N } from "node:fs";
2
- import { resolve as G } from "node:path";
3
- import { l as A } from "./services-CwvXl2MB.js";
4
- import { p as y, a7 as T } from "./shared-DSZTUx5b.js";
5
- const k = "ERR_CLI_SDD_LOG_BAD_INVOCATION", C = "ERR_CLI_SDD_LOG_FILE", $ = "ERR_CLI_SDD_LOG_NO_LOG_SECTION", h = "ERR_CLI_SDD_LOG_PLACEHOLDER", I = "ERR_CLI_SDD_LOG_MISSING_FLAG", j = /<[^>\s]+>/;
6
- function a(e) {
7
- return j.test(e);
8
- }
9
- function v(e) {
10
- return (e.match(/^#{3}\s+Round\s+\d+/gm)?.length ?? 0) + 1;
11
- }
12
- function B(e, t, r) {
13
- return `
14
- ### Round ${e} — ${t}, ${r}
15
- `;
16
- }
17
- function F(e, t) {
18
- return `- [x] \`${t}\` ${e}`;
19
- }
20
- function H(e) {
21
- return `
22
- #### Round close
23
- - [x] \`${e}\` DONE`;
24
- }
25
- function w(e, t) {
26
- return `
27
- #### ${t ? `${e} ${t}` : e}
28
- `;
29
- }
30
- function M(e) {
31
- return `**Handoff →** ${e}`;
32
- }
33
- function P(e, t, r, l) {
34
- return [
35
- `- 🛑 \`${l}\` BLOCKED: ${e}`,
36
- ` - 🔗 axiom: ${t}`,
37
- ` - 💬 unblock: ${r}`
38
- ].join(`
39
- `);
40
- }
41
- function D(e) {
42
- return {
43
- ok: !1,
44
- code: I,
45
- exitCode: 4,
46
- message: [
47
- `[sdd-log] ${I}: ${e}`,
48
- ' expected: gennady sdd-log <ticket> blocker "<reason>" --axiom <AX_NAME> --unblock "<concrete action>"'
49
- ].join(`
50
- `)
51
- };
52
- }
53
- function L(e) {
54
- return {
55
- ok: !1,
56
- code: k,
57
- exitCode: 4,
58
- message: [
59
- `[sdd-log] ${k}: ${e}`,
60
- " expected: gennady sdd-log <ticket> <mode> [content]",
61
- ' modes: round "<reason>" | line "<content>" | close | phase <P-ID> ["— re-run: <reason>"] |',
62
- ' handoff "<payload>" | blocker "<reason>" --axiom <AX_NAME> --unblock "<action>"',
63
- " content must carry no <…> placeholder."
64
- ].join(`
65
- `)
66
- };
67
- }
68
- function u(e) {
69
- return {
70
- ok: !1,
71
- code: h,
72
- exitCode: 2,
73
- message: [
74
- `[sdd-log] ${h}: "${e}"`,
75
- " Content still has an unreplaced <…> placeholder — that is a fabricated / incomplete log entry.",
76
- " Replace every placeholder with a real value (the actual command, exit code, name) before logging."
77
- ].join(`
78
- `)
79
- };
80
- }
81
- function R(e) {
82
- return {
83
- ok: !1,
84
- code: C,
85
- exitCode: 1,
86
- message: `[sdd-log] ${C}: ${e}
87
- Cannot read or write the ticket — verify the path.`
88
- };
89
- }
90
- function X(e) {
91
- return {
92
- ok: !1,
93
- code: $,
94
- exitCode: 2,
95
- message: [
96
- `[sdd-log] ${$}: ${e}`,
97
- " No single clean <!--SECTION:EXECUTION_LOG--> … <!--/SECTION:EXECUTION_LOG--> pair to append to.",
98
- " Scaffold or repair the Execution Log section first."
99
- ].join(`
100
- `)
101
- };
102
- }
103
- const g = "EXECUTION_LOG", b = ["round", "line", "close", "phase", "handoff", "blocker"];
104
- async function V(e, t) {
105
- const r = y(e, {
106
- axiom: { aliases: ["axiom"], takesValue: !0 },
107
- unblock: { aliases: ["unblock"], takesValue: !0 }
108
- }), l = r._.filter(
109
- (i) => typeof i == "string" && i !== "sdd-log"
110
- ), d = l[0], o = l[1], n = l.slice(2).join(" ");
111
- if (!d) return L("missing <ticket>");
112
- if (!o || !b.includes(o))
113
- return L(`unknown mode "${o ?? ""}" — use ${b.join(" | ")}`);
114
- if ((o === "round" || o === "line" || o === "phase" || o === "handoff" || o === "blocker") && n.trim() === "")
115
- return L(`mode "${o}" needs content`);
116
- if (o === "blocker") {
117
- const i = r.axiom, c = r.unblock;
118
- if (!i) return D("missing --axiom <AX_NAME>");
119
- if (!c) return D('missing --unblock "<action>"');
120
- }
121
- const E = G(d);
122
- let _;
123
- try {
124
- _ = x(E, "utf-8");
125
- } catch {
126
- return R(d);
127
- }
128
- const p = T(_, g);
129
- if (!p) return X(d);
130
- const m = t.toISOString(), S = m.slice(0, 10);
131
- let s;
132
- if (o === "round") {
133
- if (a(n)) return u(n);
134
- s = B(v(_), S, n);
135
- } else if (o === "line") {
136
- if (a(n)) return u(n);
137
- s = F(n, m);
138
- } else if (o === "phase") {
139
- const i = l[2], c = l.slice(3).join(" ") || void 0;
140
- if (a(i) || c && a(c))
141
- return u(n);
142
- s = w(i, c);
143
- } else if (o === "handoff") {
144
- if (a(n)) return u(n);
145
- s = M(n);
146
- } else if (o === "blocker") {
147
- const i = r.axiom, c = r.unblock;
148
- if (a(n) || a(i) || a(c))
149
- return u(n);
150
- s = P(n, i, c, m);
151
- } else
152
- s = H(m);
153
- const O = _.split(`
154
- `);
155
- O.splice(p.closeLine, 0, ...s.split(`
156
- `));
157
- try {
158
- N(E, O.join(`
159
- `), "utf-8");
160
- } catch {
161
- return R(d);
162
- }
163
- return A.debug(`[SddLogCommand#run] appended ${o} to ${g} of ${d}`), { ok: !0, text: `[sdd-log] appended to ${g}:
164
- ${s.trim()}` };
165
- }
166
- const f = await V(process.argv, /* @__PURE__ */ new Date());
167
- console.log(f.ok ? f.text : f.message);
168
- process.exit(f.ok ? 0 : f.exitCode);
@@ -1,140 +0,0 @@
1
- import { readFileSync as _, readdirSync as E } from "node:fs";
2
- import { resolve as $, join as S } from "node:path";
3
- import { l as b } from "./services-Csd556Tv.js";
4
- import { p as A, N as l, Y as D, O as R, ab as T, P as y, D as j, E as v, ac as C } from "./shared-B5CTGvpG.js";
5
- const m = "ERR_CLI_SDD_TASK_FILE", g = "ERR_CLI_SDD_TASK_NOT_A_TICKET";
6
- function O(t) {
7
- return (t.split("/").pop() ?? t).replace(/\.xml$/, "").trim();
8
- }
9
- function P(t, i) {
10
- const a = new Set(t.rules.map(O));
11
- return i.filter((n) => n.requiredBy.some((s) => a.has(s)));
12
- }
13
- function w(t, i, a, n) {
14
- const s = [];
15
- if (s.push(`[sdd-task] ${t.taskId ?? "<unknown>"} — ${t.status ?? "<no status>"}`), t.purpose && s.push(`Purpose: ${t.purpose}`), s.push(`Scope/Module: ${t.scope ?? "—"} / ${t.module ?? "—"}`), s.push(`Dependencies: ${t.dependencies.length ? t.dependencies.join(", ") : "none"}`), t.specRefs.length) {
16
- s.push("Spec References:");
17
- for (const e of t.specRefs)
18
- s.push(` - ${e.role ? `${e.role}: ` : ""}${e.name}${e.anchor ? ` (${e.anchor})` : ""}`);
19
- }
20
- s.push("", "Phases Overview:");
21
- for (const e of i)
22
- s.push(
23
- ` ${e.id} ${e.kind} deps=${e.deps.length ? e.deps.join(",") : "—"} status=${e.status}`
24
- );
25
- s.push("", "Per-phase read-manifest (AX_READ_PER_MANIFEST):");
26
- const c = t.specRefs.map((e) => e.anchor || e.name).filter(Boolean);
27
- for (const e of i) {
28
- const o = a[e.id];
29
- if (s.push("", `▸ ${e.id} — ${e.kind} ${e.status}`), !o) {
30
- s.push(" (phase section missing — scaffold/repair before dispatch)");
31
- continue;
32
- }
33
- o.objective && s.push(` objective: ${o.objective}`), s.push(` READ rules: ${o.rules.length ? o.rules.join(", ") : "—"}`), s.push(` READ specs: ${c.length ? c.join(", ") : "—"}`), s.push(` READ ticket: PHASE_${e.id}, BDD, VERIFICATION`), s.push(` READ files: ${o.targetFiles.length ? o.targetFiles.join(", ") : "—"}`);
34
- const r = P(o, n);
35
- s.push(` gates: ${r.length ? r.map((d) => d.command).join(" · ") : "—"}`), s.push(` inputs: ${o.inputs ?? "none"}`), s.push(
36
- " DO NOT READ: other phase bodies · code outside READ files · specs beyond the anchors above"
37
- );
38
- }
39
- if (n.length) {
40
- s.push("", "Gates (all):");
41
- for (const e of n) s.push(` ${e.command} ← ${e.requiredBy.join(", ") || "—"}`);
42
- }
43
- return s.join(`
44
- `);
45
- }
46
- function F(t) {
47
- return {
48
- ok: !1,
49
- code: m,
50
- exitCode: 1,
51
- message: `[sdd-task] ${m}: ${t}
52
- Cannot read the ticket — verify the path.`
53
- };
54
- }
55
- function x(t) {
56
- return {
57
- ok: !1,
58
- code: g,
59
- exitCode: 2,
60
- message: `[sdd-task] ${g}: ${t}
61
- No <!--SECTION:META--> found — this is not a task ticket.`
62
- };
63
- }
64
- const N = /* @__PURE__ */ new Set([
65
- "node_modules",
66
- ".git",
67
- "dist",
68
- "build",
69
- "out",
70
- "coverage",
71
- "__tests__"
72
- ]);
73
- function I(t, i) {
74
- let a;
75
- try {
76
- a = E(t, { withFileTypes: !0 });
77
- } catch {
78
- return;
79
- }
80
- for (const n of a) {
81
- if (n.name.startsWith(".") || N.has(n.name) || n.isSymbolicLink()) continue;
82
- const s = S(t, n.name);
83
- if (n.isDirectory()) I(s, i);
84
- else if (n.isFile() && n.name.endsWith(".md")) {
85
- let c;
86
- try {
87
- c = _(s, "utf-8");
88
- } catch {
89
- continue;
90
- }
91
- j(c) && i.push(v(s, c));
92
- }
93
- }
94
- }
95
- function K(t) {
96
- const i = C(t), a = new Set(i.map((e) => e.taskId)), n = new Set(
97
- t.filter((e) => /\bDONE\b/i.test(e.status ?? "")).map((e) => e.taskId)
98
- ), s = t.filter(
99
- (e) => /\bTODO\b/i.test(e.status ?? "") && !a.has(e.taskId)
100
- ), c = [
101
- `[sdd-task] execution map — ${i.length} pickable, ${s.length} blocked`
102
- ];
103
- c.push(`pickable (ready now): ${i.map((e) => e.taskId).join(", ") || "— none"}`);
104
- for (const e of s) {
105
- const o = e.dependencies.filter(
106
- (r) => !/^(none|n\/a|[—-])\b/i.test(r.trim()) && !n.has(r)
107
- );
108
- c.push(`blocked: ${e.taskId} ← ${o.join(", ")}`);
109
- }
110
- return c.join(`
111
- `);
112
- }
113
- async function L(t) {
114
- const n = A(t, {})._.filter(
115
- (p) => typeof p == "string" && p !== "sdd-task"
116
- )[0];
117
- if (!n) {
118
- const p = [];
119
- return I($("."), p), { ok: !0, text: K(p) };
120
- }
121
- let s;
122
- try {
123
- s = _($(n), "utf-8");
124
- } catch {
125
- return F(n);
126
- }
127
- const c = l(s, "META");
128
- if (c.status !== "ok") return x(n);
129
- const e = D(c.content), o = l(s, "PHASES_OVERVIEW"), r = o.status === "ok" ? R(o.content) : [], d = l(s, "VERIFICATION"), f = d.status === "ok" ? T(d.content) : [], h = {};
130
- for (const p of r) {
131
- const k = l(s, `PHASE_${p.id}`);
132
- k.status === "ok" && (h[p.id] = y(k.content));
133
- }
134
- return b.debug(
135
- `[SddTaskCommand#run] ${e.taskId ?? "?"}: ${r.length} phase(s), ${f.length} gate(s)`
136
- ), { ok: !0, text: w(e, r, h, f) };
137
- }
138
- const u = await L(process.argv);
139
- console.log(u.ok ? u.text : u.message);
140
- process.exit(u.ok ? 0 : u.exitCode);
@@ -1,56 +0,0 @@
1
- import { mkdirSync as D, symlinkSync as W, readFileSync as x, readdirSync as P, existsSync as R } from "node:fs";
2
- import { homedir as B } from "node:os";
3
- import { join as C } from "node:path";
4
- import { s as o, r as A, c as F } from "./shared-DSZTUx5b.js";
5
- import { b as M, N as j, y, Q as E, u as T, w as V, x as H, z as O, W as q, F as z, G, H as I } from "./services-CwvXl2MB.js";
6
- function a(e, r) {
7
- const n = e.find((l) => l.startsWith(`${r}=`));
8
- if (n) return n.slice(r.length + 1);
9
- const s = e.indexOf(r);
10
- return s !== -1 ? e[s + 1] : void 0;
11
- }
12
- async function K() {
13
- try {
14
- const e = process.argv.slice(2), r = M(e);
15
- if (e.includes("--cleanup-all")) {
16
- const h = await j(y(r));
17
- return console.info(o.gray(`worktrees removed: ${h.length}`)), 0;
18
- }
19
- const n = a(e, "--cleanup");
20
- if (n)
21
- return await E(n), console.info(o.gray(`worktree removed: ${n}`)), 0;
22
- const s = a(e, "--ref"), l = a(e, "--url");
23
- if (!l && (!s || !s.includes("!")))
24
- return console.error(
25
- o.redBright.bold("✖ Ошибка:"),
26
- "Укажите --url <mr-url> (предпочтительно) или --ref group/project!iid"
27
- ), 1;
28
- const S = a(e, "--vcs-host") ?? a(e, "--vcs-source"), $ = a(e, "--repos-base") ?? C(B(), "Developer"), c = await A({
29
- ref: s,
30
- host: S,
31
- url: l
32
- }), d = c.project, f = String(c.iid), b = c.host, _ = c.token, m = await F(c).MergeRequests.getByIid({ project: d, iid: f }), p = m?.target_branch ?? "", t = m?.diff_refs, w = await T(d, b, _, {
33
- reposBase: $,
34
- reposMapPath: H(r),
35
- clonesRoot: V(r)
36
- }), k = a(e, "--worktree-dir");
37
- let u;
38
- if (k)
39
- u = k;
40
- else {
41
- const h = y(r);
42
- D(h, { recursive: !0 });
43
- const v = await O(h, q, Date.now());
44
- v.length > 0 && console.info(o.gray(`gc: removed ${v.length} stale worktree(s)`)), u = z(r, `${d}!${f}`);
45
- }
46
- const i = await G(w, f, u, { existsSync: R, readdirSync: P, readFileSync: x, symlinkSync: W }, !0), g = p ? await I(w, p, i.headSha, t?.base_sha) : "";
47
- return console.info(o.bold(`worktree ready — ${s}`)), console.info(`path: ${i.worktreePath}`), console.info(`head: ${i.headSha}`), g && (console.info(`base: ${g} (${p})`), console.info(o.gray(`review: git -C ${i.worktreePath} diff ${g}..HEAD`))), t?.base_sha && t.start_sha && t.head_sha && (console.info(
48
- `diff_refs: base=${t.base_sha} start=${t.start_sha} head=${t.head_sha}`
49
- ), console.info(
50
- o.gray(" ↑ для line-комментов: position.{baseSha,startSha,headSha} = эти значения")
51
- )), console.info(o.gray(`cleanup: gennady vcs-worktree --cleanup ${i.worktreePath}`)), 0;
52
- } catch (e) {
53
- return console.error(o.redBright.bold("✖ Ошибка:"), e.message ?? String(e)), 1;
54
- }
55
- }
56
- process.exit(await K());
@@ -1,2 +0,0 @@
1
- import { r } from "./services-CwvXl2MB.js";
2
- process.exit(await r(process.argv));
@@ -1,102 +0,0 @@
1
- import { p as b, c as p, V as j, r as w } from "./shared-DSZTUx5b.js";
2
- import { l as r } from "./services-CwvXl2MB.js";
3
- function v() {
4
- return {
5
- resolveVcsContext: w,
6
- stdout: process.stdout,
7
- stderr: process.stderr,
8
- exit: (o) => process.exit(o)
9
- };
10
- }
11
- async function x(o, e) {
12
- try {
13
- r.debug("[resolveContextOrFail] [idle → resolving]");
14
- const t = await e.resolveVcsContext(o);
15
- return r.info(
16
- `[resolveContextOrFail] [resolving → resolved] ${t.host}/${t.project}${t.iid ? `!${t.iid}` : ""}`
17
- ), t;
18
- } catch (t) {
19
- t instanceof j && (r.error(
20
- `[resolveContextOrFail] [resolving → failed] ${t.message}`,
21
- { cause: t }
22
- ), e.stderr.write(`✖ Ошибка: ${t.message}
23
- `), e.exit(1));
24
- const u = new Error("[resolveContextOrFail] VCS context resolution failed", { cause: t });
25
- r.error("[resolveContextOrFail] [resolving → failed]", { error: u }), e.stderr.write(`✖ Ошибка: ${t.message ?? "неизвестная ошибка"}
26
- `), e.exit(1);
27
- }
28
- }
29
- function y(o, e) {
30
- const t = (c) => {
31
- const f = c.match(/(\d+)$/);
32
- return f ? f[1] : c;
33
- }, u = o.jobs.find((c) => t(c.id) === e);
34
- if (u) return t(u.id);
35
- const s = o.jobs.find((c) => c.name === e);
36
- if (s) return t(s.id);
37
- throw new Error(`[resolveJobId] Job not found: ${e}`);
38
- }
39
- function m(o, e) {
40
- e.stdout.write(`Job: ${o.name}
41
- `), e.stdout.write(` Status: ${o.status}
42
- `), e.stdout.write(` Stage: ${o.stage}
43
- `), e.stdout.write(` Ref: ${o.ref}
44
- `), e.stdout.write(` URL: ${o.webUrl}
45
- `);
46
- }
47
- function h(o) {
48
- const e = o.trim().toLowerCase();
49
- return e === "retry" ? "play" : e;
50
- }
51
- async function C(o, e = v()) {
52
- r.debug("[run] [idle → parsing]");
53
- const t = b(o, {
54
- ref: { aliases: ["ref"], takesValue: !0 },
55
- host: { aliases: ["host", "vcs-host"], takesValue: !0 },
56
- url: { aliases: ["url"], takesValue: !0 },
57
- job: { aliases: ["job"], takesValue: !0 },
58
- action: { aliases: ["action"], takesValue: !0 },
59
- "dry-run": ["dry-run", "dry"]
60
- }), u = {
61
- ref: t.ref,
62
- host: t.host,
63
- url: t.url
64
- }, s = t.job, c = t.action || "status", f = !!t["dry-run"];
65
- s || (e.stderr.write(`✖ Ошибка: --job <name|id> обязателен
66
- `), e.exit(1));
67
- const $ = h(c);
68
- r.debug(
69
- `[run] [parsing → parsed] job=${s} action=${$} dryRun=${f} ref=${u.ref ?? ""} host=${u.host ?? ""}`
70
- );
71
- const n = await x(u, e);
72
- let l;
73
- n.iid !== void 0 ? (l = n.iid, r.debug(`[run] [determining-iid → explicit] iid=${l}`)) : (e.stderr.write(`✖ Ошибка: vcs-job требует явный MR ref (--ref group/repo!iid)
74
- `), e.exit(1)), f && (e.stdout.write(`Would ${$} job "${s}" for: ${n.project}!${l}
75
- `), e.stdout.write(`[DRY-RUN] no request sent
76
- `), r.info(`[run] [ready → dry-run-complete] ${n.project}!${l} job=${s}`), e.exit(0));
77
- const g = p(n);
78
- g.Pipeline || (e.stderr.write(`✖ Ошибка: Pipeline API не поддерживается данным VCS-клиентом
79
- `), e.exit(1));
80
- try {
81
- r.debug(`[run] [resolved → fetching-pipeline] ${n.project}!${l}`);
82
- const d = await g.MergeRequests.getPipeline({
83
- project: n.project,
84
- iid: l
85
- });
86
- r.info(
87
- `[run] [fetching-pipeline → fetched] status=${d.status || "none"} jobs=${d.jobs.length}`
88
- );
89
- const i = y(d, s);
90
- r.debug(`[run] [resolving-job → resolved] spec=${s} id=${i}`);
91
- let a;
92
- $ === "play" ? (r.debug(`[run] [idle → playing] ${i}`), a = await g.Pipeline.playJob({ project: n.project, jobId: i }), r.info(`[run] [playing → played] ${i} status=${a.status}`)) : $ === "cancel" ? (r.debug(`[run] [idle → cancelling] ${i}`), a = await g.Pipeline.cancelJob({ project: n.project, jobId: i }), r.info(`[run] [cancelling → cancelled] ${i} status=${a.status}`)) : (r.debug(`[run] [idle → fetching-job] ${i}`), a = await g.Pipeline.getJob({ project: n.project, jobId: i }), r.info(`[run] [fetching-job → fetched] ${i} status=${a.status}`)), m(a, e), r.info(`[run] [output → complete] job=${a.name} status=${a.status}`), e.exit(0);
93
- } catch (d) {
94
- const i = new Error(
95
- `[run] Operation failed for ${n.project}!${l} job=${s} action=${$}`,
96
- { cause: d }
97
- );
98
- r.error("[run] [acting → failed]", { error: i }), e.stderr.write(`✖ GitLab API error: ${d.message ?? "неизвестная ошибка"}
99
- `), e.exit(1);
100
- }
101
- }
102
- await C(process.argv);
@@ -1,2 +0,0 @@
1
- import { r } from "./services-Csd556Tv.js";
2
- process.exit(await r(process.argv));
@@ -1,207 +0,0 @@
1
- import { performance as _ } from "node:perf_hooks";
2
- import { execFileSync as F } from "node:child_process";
3
- import { l as r, Y as z, Z as J, _ as Z, $ as K, a0 as Q, a1 as T, a2 as X, a3 as ee, a4 as G, a5 as N, a6 as te, a7 as se, a8 as ae, a9 as re, aa as oe } from "./services-Csd556Tv.js";
4
- import { c as ie } from "./shared-B5CTGvpG.js";
5
- async function ne(j) {
6
- const B = j.slice(3), q = /* @__PURE__ */ new Set(["--help", "-h"]), O = B.some((t) => q.has(t)), g = B.find((t) => !t.startsWith("-")) ?? "";
7
- if (r.debug(`[mr-stats#run] [idle → parsing] hasHelp=${O} url=${g || "<none>"}`), O)
8
- return { ok: !1, exitCode: 0, message: [
9
- "gennady mr-stats — Получить структурированную статистику по GitLab MR.",
10
- "",
11
- "Usage:",
12
- " gennady mr-stats <url>",
13
- "",
14
- "Аргументы:",
15
- " <url> URL GitLab Merge Request",
16
- "",
17
- "Пример:",
18
- " gennady mr-stats https://gitlab.corp.mail.ru/mail/messenger/-/merge_requests/14"
19
- ].join(`
20
- `) };
21
- if (!g)
22
- return r.warn("[mr-stats#run] [parsing → missing_url] no URL provided"), {
23
- ok: !1,
24
- exitCode: 1,
25
- message: `Usage: gennady mr-stats <url>
26
- Try gennady mr-stats --help for details.`
27
- };
28
- if (!z(g)) {
29
- const t = `mr-stats: invalid URL — expected GitLab MR URL, got "${g}"`;
30
- return r.warn(`[mr-stats#run] [parsing → invalid_url] ${t}`), { ok: !1, exitCode: 1, message: t };
31
- }
32
- let $;
33
- try {
34
- $ = await J(g);
35
- } catch (t) {
36
- const o = t.message ?? "VCS context resolution failed";
37
- return r.error(`[mr-stats#run] [resolving-context → failed] ${o}`, { cause: t }), { ok: !1, exitCode: 2, message: o };
38
- }
39
- const { project: x, iid: d, token: H, host: V } = $;
40
- if (!d)
41
- return { ok: !1, exitCode: 1, message: "mr-stats: unable to extract MR IID from URL" };
42
- const Y = ie($);
43
- if (!await Z("glab"))
44
- return { ok: !1, exitCode: 2, message: "glab: command not found" };
45
- const p = await K(Y, x, d);
46
- if (!p)
47
- return {
48
- ok: !1,
49
- exitCode: 5,
50
- message: `MR !${d}: source branch deleted or MR not merged`
51
- };
52
- r.info(`[mr-stats#run] [resolved → metadata] !${d} "${p.title}"`);
53
- let c = "", f = "", m = "", A = !1;
54
- try {
55
- A = F("git", ["ls-remote", "origin", `merge-requests/${d}/head`], {
56
- encoding: "utf8",
57
- timeout: 5e3
58
- }).trim().length > 0;
59
- } catch {
60
- A = !1;
61
- }
62
- if (A)
63
- try {
64
- const t = await Q(x, V, H, d);
65
- c = t.clonePath, f = t.worktreePath, m = t.headSha;
66
- } catch (t) {
67
- r.warn(`[mr-stats#run] [worktree → skipped] ${t.message}`);
68
- }
69
- let y = [];
70
- const u = p.diffRefsBaseSha;
71
- try {
72
- const t = u && m ? ["-C", c, "diff", `${u}..${m}`] : ["mr", "diff", String(d), "--repo", x], o = u && m ? "git" : "glab", C = F(o, t, {
73
- encoding: "utf8",
74
- maxBuffer: 100 * 1024 * 1024,
75
- timeout: 3e4,
76
- ...c && o === "git" ? { cwd: c } : {}
77
- }), w = (s) => /^\s*(\/\/|#|\/\*|\*|REM\s|--)/.test(s) || /^\s*\/\*\*/.test(s), h = (s) => /^\s*$/.test(s), l = /* @__PURE__ */ new Map();
78
- let i = "";
79
- for (const s of C.split(`
80
- `))
81
- if (s.startsWith("--- ") && !s.startsWith("--- /dev/null"))
82
- i = s.slice(4).trim();
83
- else if (s.startsWith("+++ ") && !s.startsWith("+++ /dev/null"))
84
- i = s.slice(4).trim(), l.has(i) || l.set(i, {
85
- added: 0,
86
- removed: 0,
87
- codeA: 0,
88
- cmtA: 0,
89
- blkA: 0,
90
- codeR: 0,
91
- cmtR: 0,
92
- blkR: 0
93
- });
94
- else if (i && s.startsWith("+") && !s.startsWith("+++")) {
95
- const e = l.get(i);
96
- e.added++, h(s.slice(1)) ? e.blkA++ : w(s.slice(1)) ? e.cmtA++ : e.codeA++;
97
- } else if (i && s.startsWith("-") && !s.startsWith("---")) {
98
- const e = l.get(i);
99
- e.removed++, h(s.slice(1)) ? e.blkR++ : w(s.slice(1)) ? e.cmtR++ : e.codeR++;
100
- }
101
- y = Array.from(l.entries()).map(([s, e]) => ({
102
- path: s,
103
- added: e.added,
104
- removed: e.removed,
105
- codeAdded: e.codeA,
106
- commentAdded: e.cmtA,
107
- blankAdded: e.blkA,
108
- codeRemoved: e.codeR,
109
- commentRemoved: e.cmtR,
110
- blankRemoved: e.blkR
111
- })), r.info(`[mr-stats#run] [diff → parsed] ${y.length} file(s) from glab mr diff`);
112
- } catch (t) {
113
- const o = `glab mr diff: ${t.message}`;
114
- return r.error(`[mr-stats#run] [diff → failed] ${o}`), { ok: !1, exitCode: 2, message: o };
115
- }
116
- try {
117
- const t = _.now(), o = y.map((e) => e.path);
118
- if (o.length === 0) {
119
- const e = {};
120
- for (const R of T)
121
- e[R] = { files: 0, added: 0, removed: 0 };
122
- return { ok: !0, report: {
123
- mr: p,
124
- categories: e
125
- } };
126
- }
127
- let C;
128
- try {
129
- C = X();
130
- } catch (e) {
131
- const n = `classifier-rules.yaml: ${e.message}`;
132
- return r.error(`[mr-stats#run] [classifier → failed] ${n}`, { cause: e }), { ok: !1, exitCode: 7, message: n };
133
- }
134
- const w = ee(o, C), h = y.map((e) => ({ file: e.path, added: e.added, removed: e.removed })), l = {};
135
- for (const e of T) {
136
- if (_.now() - t > G) {
137
- r.warn(
138
- `[mr-stats#run] [processing → timeout] mr-stats: timeout exceeded (${G / 1e3}s), result may be incomplete`
139
- );
140
- break;
141
- }
142
- const n = w[e] ?? [];
143
- if (e === "realCode") {
144
- const R = N(n, h);
145
- let W = { added: 0, removed: 0 }, M = { added: 0, removed: 0 }, S = { added: 0, removed: 0 };
146
- const L = new Set(n);
147
- if (L.size > 0 && c && u && m) {
148
- const k = F(
149
- "git",
150
- ["-C", c, "diff", `${u}..${m}`],
151
- {
152
- encoding: "utf8",
153
- maxBuffer: 104857600,
154
- timeout: 3e4
155
- }
156
- ), I = (a) => /^\s*(\/\/|\/\*|\*|#)/.test(a), P = (a) => /^\s*$/.test(a);
157
- let U = "";
158
- for (const a of k.split(`
159
- `))
160
- if (a.startsWith("+++ ") && !a.includes("/dev/null")) U = a.slice(4).trim();
161
- else if (L.has(U) && a.startsWith("+") && !a.startsWith("+++")) {
162
- const v = a.slice(1);
163
- P(v) ? S.added++ : I(v) ? M.added++ : W.added++;
164
- } else if (L.has(U) && a.startsWith("-") && !a.startsWith("---")) {
165
- const v = a.slice(1);
166
- P(v) ? S.removed++ : I(v) ? M.removed++ : W.removed++;
167
- }
168
- }
169
- let D = { introduced: [], modified: [], removed: [] }, E = { clonesFound: 0, clonedLines: 0, percentage: 0 };
170
- if (n.length > 0) {
171
- m && f && (D = await te(
172
- c,
173
- u,
174
- f,
175
- n
176
- ));
177
- const k = await se(f, n);
178
- k.ok ? E = k.report : r.warn(`[mr-stats#run] [jscpd → skipped] ${k.message}`);
179
- }
180
- l[e] = ae(
181
- R.files,
182
- R.added,
183
- R.removed,
184
- W,
185
- M,
186
- S,
187
- D,
188
- E
189
- );
190
- } else
191
- l[e] = N(n, h);
192
- }
193
- const i = re(p, l, T), s = _.now() - t;
194
- return r.info(`[mr-stats#run] [processing → completed] ${s.toFixed(2)}ms`), { ok: !0, report: i };
195
- } finally {
196
- if (f)
197
- try {
198
- await oe(f);
199
- } catch {
200
- r.warn("[mr-stats#run] [cleanup → failed]");
201
- }
202
- }
203
- }
204
- const b = await ne(process.argv);
205
- b.ok ? (process.stdout.write(JSON.stringify(b.report, null, 2) + `
206
- `), process.exit(0)) : (process.stderr.write(b.message + `
207
- `), process.exit(b.exitCode));
@@ -1,2 +0,0 @@
1
- import { T as r } from "./services-Csd556Tv.js";
2
- await r(process.argv);
@@ -1,2 +0,0 @@
1
- import { M as r } from "./services-Csd556Tv.js";
2
- process.exit(await r());