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,159 +0,0 @@
1
- import { readdirSync as S, statSync as _, mkdirSync as O, writeFileSync as P, readFileSync as v } from "node:fs";
2
- import { join as a, sep as U } from "node:path";
3
- import { fileURLToPath as $ } from "node:url";
4
- import { l as T } from "./services-CwvXl2MB.js";
5
- import { au as x, av as A, aw as z, ax as I, p as Y, ay as j } from "./shared-DSZTUx5b.js";
6
- class B {
7
- /** @purpose List of all synced file entries. */
8
- entries;
9
- /**
10
- * @purpose Construct a SyncResult from a list of entries.
11
- * @param entries File entries.
12
- */
13
- constructor(t) {
14
- this.entries = t;
15
- }
16
- /** @purpose Files with status "added". | @returns Array of added entries. */
17
- get added() {
18
- return this.entries.filter((t) => t.status === "added");
19
- }
20
- /** @purpose Files with status "updated". | @returns Array of updated entries. */
21
- get updated() {
22
- return this.entries.filter((t) => t.status === "updated");
23
- }
24
- /** @purpose Files with status "unchanged". | @returns Array of unchanged entries. */
25
- get unchanged() {
26
- return this.entries.filter((t) => t.status === "unchanged");
27
- }
28
- /** @purpose Human-readable summary of added/updated/unchanged counts. | @returns Summary string. */
29
- get summary() {
30
- const t = this.added.length, s = this.updated.length, o = this.unchanged.length;
31
- return `Synced: ${t} added, ${s} updated, ${o} skipped (unchanged)`;
32
- }
33
- /** @purpose Dry-run summary message. | @returns Dry-run message. */
34
- get dryRunSummary() {
35
- return "Dry-run: no files written.";
36
- }
37
- }
38
- const R = "ERR_SYNC_SUBDIR_NOT_FOUND", b = "ERR_SYNC_SOURCE_NOT_FOUND", w = /* @__PURE__ */ new Set(["architecture"]);
39
- function L(e, t = "ai/directives") {
40
- return z(e, t);
41
- }
42
- function W(e, t) {
43
- if (t && t.length > 0) {
44
- const o = S(e).filter(
45
- (r) => !w.has(r) && _(a(e, r)).isDirectory()
46
- );
47
- for (const r of t)
48
- if (!o.includes(r)) {
49
- const c = `[scanDirectives] ai/directives/${r}/ not found in package.
50
- Available: ${o.join(", ")}`, i = new Error(c);
51
- throw i.code = R, i;
52
- }
53
- const n = [];
54
- for (const r of t)
55
- D(a(e, r), r, n);
56
- return n.sort();
57
- }
58
- const s = [];
59
- return D(e, "", s), s.sort();
60
- }
61
- function D(e, t, s) {
62
- let o;
63
- try {
64
- o = S(e);
65
- } catch {
66
- return;
67
- }
68
- for (const n of o) {
69
- if (n.startsWith(".") || w.has(n)) continue;
70
- const r = a(e, n), c = t ? a(t, n) : n, i = _(r, { throwIfNoEntry: !1 });
71
- i && (i.isDirectory() ? D(r, c, s) : i.isFile() && s.push(c.split(U).join("/")));
72
- }
73
- }
74
- function H(e, t) {
75
- try {
76
- e.stat(t.sourceDir);
77
- } catch {
78
- const n = `[collectAndCompare] Source directory not found: ${t.sourceDir}`, r = new Error(n);
79
- throw r.code = b, r;
80
- }
81
- const s = W(t.sourceDir, t.subdirs), o = [];
82
- for (const n of s) {
83
- const r = a(t.sourceDir, n), c = a(t.targetDir, n), i = e.readFile(r), p = x(i.toString("utf-8"), I), l = Buffer.from(p, "utf-8"), f = l.length;
84
- let d = null;
85
- try {
86
- d = e.readFile(c);
87
- } catch {
88
- }
89
- let u;
90
- d === null ? u = "added" : A(l, d) ? u = "updated" : u = "unchanged", o.push({
91
- relativePath: n,
92
- status: u,
93
- sourceSize: f,
94
- targetSize: d?.length
95
- }), !t.dryRun && u !== "unchanged" && (e.mkdir(a(t.targetDir, n, ".."), { recursive: !0 }), e.writeFile(c, l));
96
- }
97
- return new B(o);
98
- }
99
- function J(e) {
100
- try {
101
- const t = a(e, "..", ".."), s = v(a(t, "package.json"), "utf-8");
102
- return JSON.parse(s).version ?? "0.0.0";
103
- } catch {
104
- return "0.0.0";
105
- }
106
- }
107
- function V(e, t, s, o, n) {
108
- s.write(`Sync (v${n})${t ? " (dry-run)" : ""}: ${o}
109
- `);
110
- const r = j(e, { dryRun: t });
111
- for (const c of r)
112
- s.write(c + `
113
- `);
114
- }
115
- function E(e, t) {
116
- const s = v, o = P, n = O, r = _, c = S, i = L, p = process.stdout, l = process.stderr, f = Y(e, {
117
- dryRun: ["dry-run"]
118
- }), d = f.dryRun === !0 || f.dryRun === "true", u = f._.filter(
119
- (g) => typeof g == "string" && g !== "sync"
120
- ), y = process.cwd(), m = i(y, "ai/directives");
121
- if (!m)
122
- return l.write(`Error: gennady package not found. Install it locally: npm i -D gennady
123
- `), 1;
124
- const N = J(m), k = a(y, "ai", "directives"), C = {
125
- sourceDir: m,
126
- targetDir: k,
127
- subdirs: u.length > 0 ? u : void 0,
128
- dryRun: d
129
- };
130
- try {
131
- const h = H({
132
- readFile: s,
133
- writeFile: o,
134
- mkdir: n,
135
- stat: (F) => r(F),
136
- readdir: c,
137
- cwd: y
138
- }, C);
139
- return V(h.entries, d, p, y, N), 0;
140
- } catch (g) {
141
- const h = g;
142
- if (h.code === R)
143
- return l.write(`Error: ${h.message}
144
- `), 1;
145
- throw h;
146
- }
147
- }
148
- if (process.argv[1]) {
149
- const e = $(import.meta.url);
150
- if (e === process.argv[1] || e.endsWith(process.argv[1]))
151
- try {
152
- const t = E(process.argv);
153
- process.exit(t);
154
- } catch (t) {
155
- const s = new Error("[syncCmd] Self-execution failed", { cause: t });
156
- T.error("[syncCmd#run] [self-executing → failed]", { error: s }), process.exit(1);
157
- }
158
- }
159
- process.exit(E(process.argv));
@@ -1,131 +0,0 @@
1
- import { statSync as m, readFileSync as l } from "node:fs";
2
- import { resolve as R, join as i } from "node:path";
3
- import { l as E } from "./services-CwvXl2MB.js";
4
- import { p as _, e as A, h as D, i as O, j as C } from "./shared-DSZTUx5b.js";
5
- const h = "ERR_CLI_SDD_STATE_BAD_INVOCATION", $ = "ERR_CLI_SDD_STATE_BAD_ROOT";
6
- function P(e) {
7
- const s = [
8
- "# sdd-state v1",
9
- `ROOT=${e.root}`,
10
- `FLOW_VERSION=${e.flowVersion}`,
11
- `PORTAL=${e.portalPresent ? "present" : "absent"} ${e.portalPath}`,
12
- "",
13
- "[READINESS]",
14
- `package.json ${e.readiness.packageJsonPresent ? "✔" : "✘"}`,
15
- "# required-script declared"
16
- ];
17
- for (const t of e.readiness.required) s.push(`${t.name} ${t.present ? "✔" : "✘"}`);
18
- if (s.push(`lint→gennady ${e.readiness.lintHasGennady ? "✔" : "✘"}`), s.push(`gennady-installed ${e.readiness.gennadyAvailable ? "✔" : "✘"}`), s.push(
19
- e.readiness.ready ? "READINESS=ready" : `READINESS=not-ready (missing: ${e.readiness.missing.join(", ")})`
20
- ), s.push("", "[SCOPES]", "# name type status description spec"), !e.portalPresent)
21
- s.push("# (portal absent — route to project-setup / root flow)");
22
- else if (e.scopes.length === 0)
23
- s.push("# (portal present, no scopes listed yet)");
24
- else
25
- for (const t of e.scopes)
26
- s.push(
27
- `${t.name} ${t.type} ${t.status} ${t.description || "—"} ${t.specPath ?? "-"}`
28
- );
29
- return s.push("", "[SESSION]", "# specs/.sdd-session.md"), s.push(e.sessionContent ? e.sessionContent : "# (no active session)"), e.probe && (s.push("", "[PROBE]"), s.push(
30
- `CODE=${e.probe.codePresent ? "present" : "absent"} ${e.probe.codeFileCount} file(s)`
31
- ), e.probe.codeDirs.length > 0 && s.push(`code-dirs ${e.probe.codeDirs.join(", ")}`), s.push(`INFRA=${e.probe.infraPresent ? "present" : "absent"}`), e.probe.configFiles.length > 0 && s.push(`configs ${e.probe.configFiles.join(", ")}`)), s.push(
32
- "",
33
- "[SUMMARY]",
34
- `flow=${e.flowVersion}`,
35
- `portal=${e.portalPresent ? "present" : "absent"}`,
36
- `readiness=${e.readiness.ready ? "ready" : "not-ready"}`,
37
- `scopes=${e.scopes.length}`,
38
- `session=${e.sessionContent ? "present" : "absent"}`
39
- ), e.probe && s.push(
40
- `code=${e.probe.codePresent ? "present" : "absent"}`,
41
- `infra=${e.probe.infraPresent ? "present" : "absent"}`
42
- ), s.join(`
43
- `);
44
- }
45
- function j(e) {
46
- return {
47
- ok: !1,
48
- code: h,
49
- exitCode: 4,
50
- message: [
51
- `[sdd-state] ${h}`,
52
- " expected: gennady sdd-state [project-root] (zero or one positional argument)",
53
- ` got: ${e || "(extra arguments)"}`
54
- ].join(`
55
- `)
56
- };
57
- }
58
- function b(e) {
59
- return {
60
- ok: !1,
61
- code: $,
62
- exitCode: 2,
63
- message: [
64
- `[sdd-state] ${$}: ${e}`,
65
- " Pass an existing project root, or run with no argument from inside the project."
66
- ].join(`
67
- `)
68
- };
69
- }
70
- function I(e) {
71
- try {
72
- return m(i(e, "node_modules", ".bin", "gennady")), !0;
73
- } catch {
74
- return !1;
75
- }
76
- }
77
- async function T(e) {
78
- const s = _(e, { probe: ["probe"] }), t = s._.filter(
79
- (o) => typeof o == "string" && o !== "sdd-state"
80
- );
81
- if (t.length > 1) return j(t.join(" "));
82
- const n = R(t[0] ?? ".");
83
- try {
84
- if (!m(n).isDirectory()) return b(n);
85
- } catch {
86
- return b(n);
87
- }
88
- const u = A(n), y = "specs/README.md";
89
- let a = !1, p = [];
90
- try {
91
- const o = l(i(n, "specs", "README.md"), "utf-8");
92
- a = !0, p = D(o);
93
- } catch {
94
- a = !1;
95
- }
96
- let f = {}, c = !1;
97
- try {
98
- const o = JSON.parse(l(i(n, "package.json"), "utf-8"));
99
- c = !0, f = o.scripts ?? {};
100
- } catch {
101
- c = !1;
102
- }
103
- const g = O({
104
- packageJsonPresent: c,
105
- scripts: f,
106
- gennadyAvailable: I(n)
107
- });
108
- let d = null;
109
- try {
110
- d = l(i(n, "specs", ".sdd-session.md"), "utf-8").trim() || null;
111
- } catch {
112
- d = null;
113
- }
114
- E.debug(
115
- `[SddStateCommand#run] flow=${u} portal=${a} ready=${g.ready} scopes=${p.length}`
116
- );
117
- const S = s.probe === !0 ? C(n) : void 0;
118
- return { ok: !0, text: P({
119
- root: n,
120
- flowVersion: u,
121
- portalPresent: a,
122
- portalPath: y,
123
- scopes: p,
124
- readiness: g,
125
- sessionContent: d,
126
- probe: S
127
- }) };
128
- }
129
- const r = await T(process.argv);
130
- console.log(r.ok ? r.text : r.message);
131
- process.exit(r.ok ? 0 : r.exitCode);
@@ -1,128 +0,0 @@
1
- import { readFileSync as f, writeFileSync as E, readdirSync as Y } from "node:fs";
2
- import { resolve as m, relative as $, dirname as h, join as A } from "node:path";
3
- import { l as T } from "./services-Csd556Tv.js";
4
- import { p as v, N as F, a8 as w, a9 as S, aa as b, C as M } from "./shared-B5CTGvpG.js";
5
- const x = "ERR_CLI_SDD_SYNC_BAD_INVOCATION", I = "ERR_CLI_SDD_SYNC_FILE", R = "ERR_CLI_SDD_SYNC_META", j = "ERR_CLI_SDD_SYNC_VERIFY";
6
- function O(n) {
7
- return {
8
- ok: !1,
9
- code: x,
10
- exitCode: 4,
11
- message: [
12
- `[sdd-sync] ${x}: ${n}`,
13
- " expected: gennady sdd-sync <ticket> [index.3-tasks.md ...]",
14
- " With no explicit indexes, every *.3-tasks.md from the ticket dir upward is synced."
15
- ].join(`
16
- `)
17
- };
18
- }
19
- function V(n) {
20
- return {
21
- ok: !1,
22
- code: I,
23
- exitCode: 1,
24
- message: `[sdd-sync] ${I}: ${n}
25
- Cannot read the ticket — verify the path.`
26
- };
27
- }
28
- function D(n) {
29
- return {
30
- ok: !1,
31
- code: R,
32
- exitCode: 2,
33
- message: [
34
- `[sdd-sync] ${R}: ${n}`,
35
- " Could not read Task-ID + Status from the Meta section. Ensure META has",
36
- " `- **Task-ID:** <id>` and `- **Status:** [x] DONE` lines."
37
- ].join(`
38
- `)
39
- };
40
- }
41
- function B(n) {
42
- const d = [];
43
- let t = h(m(n));
44
- for (let e = 0; e < 8; e++) {
45
- try {
46
- for (const s of Y(t))
47
- (s.endsWith(".3-tasks.md") || s === "3-tasks.md") && d.push(A(t, s));
48
- } catch {
49
- }
50
- const r = h(t);
51
- if (r === t) break;
52
- t = r;
53
- }
54
- return d;
55
- }
56
- function P(n) {
57
- const d = [];
58
- for (const t of n) {
59
- let e;
60
- try {
61
- e = f(t, "utf-8");
62
- } catch {
63
- continue;
64
- }
65
- const { text: r, updated: s } = b(e, (a) => {
66
- try {
67
- return M(f(m(h(t), a), "utf-8"));
68
- } catch {
69
- return null;
70
- }
71
- });
72
- if (s.length === 0) continue;
73
- E(t, r, "utf-8");
74
- const c = $(process.cwd(), t);
75
- d.push(` progress: ${c} (${s.join(", ")})`);
76
- }
77
- return d;
78
- }
79
- async function W(n) {
80
- const t = v(n, {})._.filter(
81
- (o) => typeof o == "string" && o !== "sdd-sync"
82
- ), e = t[0];
83
- if (!e) return O("missing <ticket>");
84
- let r;
85
- try {
86
- r = f(m(e), "utf-8");
87
- } catch {
88
- return V(e);
89
- }
90
- const s = F(r, "META");
91
- if (s.status !== "ok") return D(e);
92
- const { taskId: c, status: a } = w(s.content);
93
- if (!c || !a) return D(e);
94
- const p = t.length > 1 ? t.slice(1).map((o) => m(o)) : B(e);
95
- T.debug(`[SddSyncCommand#run] ${c} → ${a}; ${p.length} index file(s)`);
96
- const i = [];
97
- let C = !1;
98
- for (const o of p) {
99
- const u = $(process.cwd(), o);
100
- let y;
101
- try {
102
- y = f(o, "utf-8");
103
- } catch {
104
- i.push(` unreadable: ${u}`);
105
- continue;
106
- }
107
- const _ = S(y, c, a);
108
- if (!_.ok) {
109
- i.push(` ${_.reason === "task_not_found" ? "no-row" : "no-table"}: ${u}`);
110
- continue;
111
- }
112
- if (!_.changed) {
113
- i.push(` in-sync: ${u}`);
114
- continue;
115
- }
116
- E(o, _.text, "utf-8");
117
- const g = S(f(o, "utf-8"), c, a);
118
- g.ok && !g.changed ? i.push(` updated: ${u}`) : (C = !0, i.push(` VERIFY-FAIL: ${u}`));
119
- }
120
- i.push(...P(p));
121
- const N = `[sdd-sync] ${c} → ${a}`, L = p.length === 0 ? " (no *.3-tasks.md index files found)" : i.join(`
122
- `), k = `${N}
123
- ${L}`;
124
- return C ? { ok: !1, code: j, exitCode: 1, message: k } : { ok: !0, text: k };
125
- }
126
- const l = await W(process.argv);
127
- console.log(l.ok ? l.text : l.message);
128
- process.exit(l.ok ? 0 : l.exitCode);
@@ -1,141 +0,0 @@
1
- import { p as J, V as q, c as I, r as E } from "./shared-B5CTGvpG.js";
2
- import { l as M } from "./services-Csd556Tv.js";
3
- function P() {
4
- return {
5
- resolveVcsContext: E,
6
- stdout: process.stdout,
7
- stderr: process.stderr,
8
- exit: (a) => process.exit(a)
9
- };
10
- }
11
- async function T(a, t = P()) {
12
- const e = J(a, {
13
- ref: { aliases: ["ref"], takesValue: !0 },
14
- project: { aliases: ["project"], takesValue: !0 },
15
- iid: { aliases: ["iid"], takesValue: !0 },
16
- host: { aliases: ["host"], takesValue: !0 },
17
- url: { aliases: ["url"], takesValue: !0 },
18
- all: ["all"],
19
- json: ["json"],
20
- my: ["my"],
21
- "with-drafts": ["with-drafts", "drafts"],
22
- "dry-run": ["dry-run", "dry"]
23
- }), i = e.ref, w = e.project, d = e.iid, c = !!e.all, N = !!e.json, D = !!e["dry-run"], R = e.host, _ = e.url, j = !!e.my, x = !!e["with-drafts"];
24
- x && !j && (N && (t.stdout.write(
25
- JSON.stringify({
26
- ok: !1,
27
- error: "INVALID_ARGS",
28
- detail: "--with-drafts requires --my"
29
- }) + `
30
- `
31
- ), t.exit(2)), t.stderr.write(`✖ Ошибка: --with-drafts requires --my
32
- `), t.exit(1)), i && !/^.+\!\d+$/.test(i) && (t.stderr.write(`✖ Invalid ref format. Expected: <group/repo>!<iid>
33
- `), t.exit(1));
34
- const m = i ? Number(i.split("!").pop()) : d ? Number(d) : void 0, $ = m !== void 0 && !isNaN(m) && m > 0 ? m : void 0, C = { host: R, ref: i, project: w, iid: $, url: _ };
35
- let r;
36
- try {
37
- r = await t.resolveVcsContext(C);
38
- } catch (o) {
39
- throw o instanceof q && (t.stderr.write(`✖ Ошибка: ${o.message}
40
- `), t.exit(1)), o;
41
- }
42
- let s = r.iid ?? $;
43
- if ((!s || isNaN(s) || s <= 0) && r.branch) {
44
- const u = await I(r).MergeRequests.getOne({
45
- project: r.project,
46
- sourceBranch: r.branch
47
- });
48
- u?.iid && (s = u.iid);
49
- }
50
- (!s || isNaN(s) || s <= 0) && (t.stderr.write(
51
- `✖ Specify --url <mr-url> (preferred) or --ref <group/repo>!<iid> with --host
52
- `
53
- ), t.exit(1)), D && (t.stdout.write(
54
- `Would fetch discussions: ${r.project}!${s} host=${r.host} [DRY-RUN] no request sent
55
- `
56
- ), t.exit(0));
57
- try {
58
- const o = I(r), u = await o.MergeDiscussions.getAll({
59
- project: r.project,
60
- iid: s
61
- });
62
- let l = c ? u : u.filter((n) => n.notes?.[0]?.resolved !== !0), v;
63
- if (j) {
64
- try {
65
- const g = await o.getCurrentUser();
66
- l = l.filter((b) => (b.notes ?? []).some((y) => y.author?.username === g.login));
67
- } catch (n) {
68
- N && (t.stdout.write(
69
- JSON.stringify({
70
- ok: !1,
71
- error: "NETWORK",
72
- detail: n.message ?? "Не удалось определить текущего пользователя"
73
- }) + `
74
- `
75
- ), t.exit(2)), t.stderr.write(
76
- `✖ Ошибка: ${n.message ?? "Не удалось определить текущего пользователя"}
77
- `
78
- ), t.exit(1);
79
- }
80
- if (x)
81
- try {
82
- v = await o.MergeDiscussions.listDraftNotes({
83
- project: r.project,
84
- iid: s
85
- });
86
- } catch (n) {
87
- t.stderr.write(
88
- `⚠ Не удалось загрузить черновики: ${n.message ?? "неизвестная ошибка"}
89
- `
90
- ), v = [];
91
- }
92
- }
93
- N && (x ? t.stdout.write(
94
- JSON.stringify({ discussions: l.map(S), drafts: v }, null, 2) + `
95
- `
96
- ) : t.stdout.write(JSON.stringify(l.map(S), null, 2) + `
97
- `), t.exit(0)), l.length === 0 && (t.stdout.write(`No discussions found for ${r.project}!${s}
98
- `), t.exit(0));
99
- for (const n of l) {
100
- const g = String(n.id ?? "").slice(0, 8), f = (n.notes ?? [])[0];
101
- if (!f) continue;
102
- const y = f.author, V = y?.name ?? y?.username ?? "unknown", k = String(f.body ?? "").split(`
103
- `)[0].slice(0, 120);
104
- let h = "";
105
- const p = f.position;
106
- if (p?.new_path) {
107
- const O = p.new_path, A = p.new_line;
108
- h = O + (A ? `:${A}` : "");
109
- }
110
- f.resolved && (h += " (resolved)"), k || (h += " (no text)"), t.stdout.write(
111
- `[${g}] ${V}: ${k || "(no text)"}${h ? ` (${h})` : ""}
112
- `
113
- );
114
- }
115
- } catch (o) {
116
- const u = o.message ?? "неизвестная ошибка";
117
- M.error("[vcs-discussions] API error", { cause: o }), t.stderr.write(`✖ API error: ${u}
118
- `), t.exit(1);
119
- }
120
- t.exit(0);
121
- }
122
- function S(a) {
123
- const t = String(a.id ?? "").slice(0, 8), e = a.notes ?? [], i = e[0], w = i?.author, d = i?.position;
124
- return {
125
- id: a.id,
126
- shortId: t,
127
- author: w?.name ?? w?.username ?? "unknown",
128
- body: i?.body ?? "",
129
- file: d?.new_path ?? void 0,
130
- line: d?.new_line ?? void 0,
131
- resolved: i?.resolved ?? null,
132
- notes: e.map((c) => ({
133
- id: c.id,
134
- author: c.author?.name ?? "unknown",
135
- username: c.author?.username ?? void 0,
136
- body: c.body ?? "",
137
- createdAt: c.created_at ?? ""
138
- }))
139
- };
140
- }
141
- T(process.argv);
@@ -1,96 +0,0 @@
1
- import { p as V, V as x, c as b, r as k } from "./shared-DSZTUx5b.js";
2
- import { execFile as A } from "node:child_process";
3
- import { promisify as $ } from "node:util";
4
- import { l as p } from "./services-CwvXl2MB.js";
5
- const j = $(A);
6
- function I() {
7
- return {
8
- resolveVcsContext: k,
9
- stdout: process.stdout,
10
- stderr: process.stderr,
11
- exit: (o) => process.exit(o),
12
- git: async (o) => {
13
- const { stdout: e } = await j("git", o, { encoding: "utf-8" });
14
- return String(e ?? "").trim();
15
- }
16
- };
17
- }
18
- async function D(o, e = I()) {
19
- const r = V(o, {
20
- title: { aliases: ["title"], takesValue: !0 },
21
- description: { aliases: ["description"], takesValue: !0 },
22
- "target-branch": { aliases: ["target-branch"], takesValue: !0 },
23
- project: { aliases: ["project"], takesValue: !0 },
24
- host: { aliases: ["host", "vcs-host"], takesValue: !0 },
25
- url: { aliases: ["url"], takesValue: !0 },
26
- label: { aliases: ["label"], takesValue: !0 },
27
- assignee: { aliases: ["assignee"], takesValue: !0 },
28
- reviewer: { aliases: ["reviewer"], takesValue: !0 },
29
- milestone: { aliases: ["milestone"], takesValue: !0 },
30
- draft: ["draft"],
31
- "dry-run": ["dry-run", "dry"]
32
- }), n = r.title || void 0;
33
- n || (e.stderr.write(`✖ --title is required
34
- `), e.exit(1));
35
- const f = !!r["dry-run"], g = !!r.draft, h = r.description, w = r["target-branch"], l = [r.label].flat().filter((s) => typeof s == "string"), u = r.assignee, d = r.reviewer, m = r.milestone, v = {
36
- host: r.host,
37
- project: r.project,
38
- url: r.url
39
- };
40
- let a;
41
- try {
42
- a = await e.resolveVcsContext(v);
43
- } catch (s) {
44
- throw s instanceof x && (e.stderr.write(`✖ Ошибка: ${s.message}
45
- `), e.exit(1)), s;
46
- }
47
- let c;
48
- try {
49
- c = await e.git(["rev-parse", "--abbrev-ref", "HEAD"]), c === "HEAD" && (e.stderr.write(
50
- `✖ HEAD не указывает на ветку (detached HEAD). Укажите source branch явно.
51
- `
52
- ), e.exit(1));
53
- } catch {
54
- e.stderr.write(`✖ Не удалось определить текущую ветку: не найден git-репозиторий.
55
- `), e.exit(1);
56
- }
57
- let i = w;
58
- if (!i) {
59
- try {
60
- const t = (await e.git(["remote", "show", "origin"])).match(/HEAD branch:\s*(\S+)/);
61
- t && (i = t[1]);
62
- } catch {
63
- }
64
- i || (i = "main");
65
- }
66
- const y = {
67
- project: a.project,
68
- title: n,
69
- sourceBranch: c,
70
- targetBranch: i,
71
- description: h,
72
- draft: g || void 0,
73
- labels: l.length > 0 ? l : void 0,
74
- assigneeIds: u ? [u] : void 0,
75
- reviewerIds: d ? [d] : void 0,
76
- milestoneId: m
77
- };
78
- f && (e.stdout.write(
79
- `Would create MR: ${a.project} ← ${c} → ${i} host=${a.host} [DRY-RUN] no request sent
80
- `
81
- ), e.exit(0));
82
- try {
83
- const t = await b(a).MergeRequests.create(y);
84
- e.stdout.write(`✓ MR !${t.iid} created: ${t.webUrl}
85
- `);
86
- } catch (s) {
87
- const t = s.message ?? "неизвестная ошибка";
88
- p.error("[vcs-mr-create] API error", { cause: s }), t.includes("NetworkError") || t.includes("fetch") ? e.stderr.write(`✖ Network error: ${t}
89
- `) : t.includes("401") || t.includes("403") ? e.stderr.write(`✖ API error [403]: ${t}
90
- `) : t.includes("404") ? e.stderr.write(`✖ Not found: ${a.project}
91
- `) : e.stderr.write(`✖ API error: ${t}
92
- `), e.exit(1);
93
- }
94
- e.exit(0);
95
- }
96
- D(process.argv);
@@ -1,2 +0,0 @@
1
- import { X as r } from "./services-Csd556Tv.js";
2
- r(process.argv);