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,658 +0,0 @@
1
- import { readdirSync as T, lstatSync as P, existsSync as z, readFileSync as D, statSync as K } from "node:fs";
2
- import { resolve as w, join as R, extname as H, basename as N, relative as x, sep as E } from "node:path";
3
- import { l as S, aq as G } from "./services-CwvXl2MB.js";
4
- const U = [".ts", ".tsx"], J = /* @__PURE__ */ new Set([
5
- "node_modules",
6
- ".git",
7
- "dist",
8
- "coverage",
9
- "build",
10
- "out",
11
- "__tests__"
12
- ]), Q = /\.(test|spec)\.(ts|tsx)$/;
13
- function F(i) {
14
- const e = /* @__PURE__ */ new Set(), n = w(i);
15
- return _(n, e), [...e].sort();
16
- }
17
- function _(i, e) {
18
- let n;
19
- try {
20
- n = T(i, { withFileTypes: !0 });
21
- } catch {
22
- return;
23
- }
24
- for (const t of n) {
25
- if (t.name.startsWith(".") || J.has(t.name)) continue;
26
- const o = R(i, t.name);
27
- let s;
28
- try {
29
- s = P(o);
30
- } catch {
31
- continue;
32
- }
33
- if (!s.isSymbolicLink()) {
34
- if (s.isDirectory())
35
- _(o, e);
36
- else if (s.isFile()) {
37
- if (Q.test(t.name)) continue;
38
- const r = H(t.name).toLowerCase();
39
- U.includes(r) && e.add(o);
40
- }
41
- }
42
- }
43
- }
44
- function V(i) {
45
- const e = { file: "", tasks: [], consumers: [] };
46
- if (i.length === 0) return e;
47
- const n = i.split(`
48
- `);
49
- for (const t of n) {
50
- const o = t.trim();
51
- if (o.startsWith("import ")) break;
52
- if (o.startsWith("// @file:") && (e.file = o.slice(9).trim()), o.startsWith("// @tasks:")) {
53
- const s = o.slice(10);
54
- e.tasks = s.split(/[,;\s]+/).map((r) => r.trim()).filter((r) => /^TSK-\d+$/.test(r));
55
- }
56
- if (o.startsWith("// @consumers:")) {
57
- const s = o.slice(14);
58
- e.consumers = s.split(/[,;]+/).map((r) => r.trim()).filter(Boolean);
59
- }
60
- }
61
- return e;
62
- }
63
- function Y(i) {
64
- const e = /* @__PURE__ */ new Map();
65
- for (const n of i) {
66
- const t = I(n.header.file);
67
- for (const o of t)
68
- L(e, o, { file: n.absPath, source: "file" });
69
- for (const o of n.exports) {
70
- const s = o.contract.entries.find(
71
- (c) => c.type === "purpose" || c.type === "description"
72
- );
73
- if (!s) continue;
74
- const r = I(s.value);
75
- for (const c of r)
76
- L(e, c, { file: n.absPath, source: "entity", entity: o.name });
77
- }
78
- }
79
- return e;
80
- }
81
- function I(i) {
82
- return i.toLowerCase().split(/[^a-z0-9_]+/).filter((e) => e.length > 1);
83
- }
84
- function L(i, e, n) {
85
- let t = i.get(e);
86
- t || (t = /* @__PURE__ */ new Set(), i.set(e, t)), t.add(n);
87
- }
88
- function Z(i, e) {
89
- if (e.length === 0) return [];
90
- const n = [];
91
- for (const t of e) {
92
- const o = i.filter((s) => s.header.tasks.includes(t));
93
- n.push({ taskId: t, files: o });
94
- }
95
- return n;
96
- }
97
- function W(i, e) {
98
- const n = i.length, t = e.length, o = [];
99
- for (let s = 0; s <= n; s++)
100
- o[s] = [], o[s][0] = s;
101
- for (let s = 0; s <= t; s++)
102
- o[0][s] = s;
103
- for (let s = 1; s <= n; s++)
104
- for (let r = 1; r <= t; r++) {
105
- const c = i[s - 1] === e[r - 1] ? 0 : 1;
106
- o[s][r] = Math.min(
107
- o[s - 1][r] + 1,
108
- // deletion
109
- o[s][r - 1] + 1,
110
- // insertion
111
- o[s - 1][r - 1] + c
112
- // substitution
113
- ), s > 1 && r > 1 && i[s - 1] === e[r - 2] && i[s - 2] === e[r - 1] && (o[s][r] = Math.min(o[s][r], o[s - 2][r - 2] + c));
114
- }
115
- return o[n][t];
116
- }
117
- function A(i, e, n) {
118
- if (e.length === 0) return [];
119
- const t = [];
120
- for (const o of e) {
121
- const s = i.filter((r) => n ? r.header.consumers.some((c) => {
122
- const f = o.length <= 5 ? 2 : 3;
123
- return W(o.toLowerCase(), c.toLowerCase()) <= f;
124
- }) : r.header.consumers.some((c) => c.toLowerCase().includes(o.toLowerCase())));
125
- t.push({ consumerName: o, files: s });
126
- }
127
- return t;
128
- }
129
- function ee(i, e, n) {
130
- const t = n.trim();
131
- if (t.length === 0) return [];
132
- const o = t.toLowerCase().split(/\s+/).filter(Boolean), s = /* @__PURE__ */ new Map();
133
- for (const l of i)
134
- s.set(l.absPath, l);
135
- const r = /* @__PURE__ */ new Map(), c = [];
136
- for (const l of o) {
137
- const p = /* @__PURE__ */ new Set(), m = e.get(l);
138
- if (m)
139
- for (const u of m) {
140
- p.add(u.file);
141
- const g = r.get(u.file) ?? { score: 0 };
142
- g.score += 10, u.source === "entity" && u.entity && (g.entityName = u.entity), r.set(u.file, g);
143
- }
144
- for (const [u, g] of e)
145
- if (u !== l && u.startsWith(l))
146
- for (const d of g) {
147
- p.add(d.file);
148
- const h = r.get(d.file) ?? { score: 0 };
149
- h.score += 5, d.source === "entity" && d.entity && !h.entityName && (h.entityName = d.entity), r.set(d.file, h);
150
- }
151
- for (const [u, g] of e) {
152
- const d = l.length <= 5 ? 2 : 3;
153
- if (W(l, u) <= d && u !== l && !u.startsWith(l))
154
- for (const h of g) {
155
- p.add(h.file);
156
- const y = r.get(h.file) ?? { score: 0 };
157
- y.score += 3, h.source === "entity" && h.entity && !y.entityName && (y.entityName = h.entity), r.set(h.file, y);
158
- }
159
- }
160
- c.push(p);
161
- }
162
- let f = /* @__PURE__ */ new Set();
163
- if (c.length > 0) {
164
- f = c[0];
165
- for (let l = 1; l < c.length; l++)
166
- f = new Set([...f].filter((p) => c[l].has(p)));
167
- }
168
- const a = [];
169
- for (const l of f) {
170
- const p = s.get(l);
171
- if (!p) continue;
172
- const m = r.get(l);
173
- a.push({
174
- file: p,
175
- score: m?.score ?? 0,
176
- entityName: m?.entityName
177
- });
178
- }
179
- return a.sort((l, p) => p.score - l.score), a;
180
- }
181
- function te(i, e, n) {
182
- if (e.length === 0) return [];
183
- const t = [];
184
- for (const o of i)
185
- for (const s of o.exports)
186
- for (const r of e) {
187
- if (!n && s.name === r) {
188
- t.push({
189
- name: s.name,
190
- kind: s.kind,
191
- filePath: o.absPath,
192
- contract: s.contract,
193
- fuzzy: !1
194
- });
195
- continue;
196
- }
197
- if (n) {
198
- const c = r.length <= 5 ? 2 : 3, f = W(r.toLowerCase(), s.name.toLowerCase());
199
- f <= c && t.push({
200
- name: s.name,
201
- kind: s.kind,
202
- filePath: o.absPath,
203
- contract: s.contract,
204
- fuzzy: !0,
205
- distance: f
206
- });
207
- }
208
- }
209
- return t;
210
- }
211
- function ne(i) {
212
- const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
213
- for (const t of i) {
214
- const o = N(t.absPath, ".ts");
215
- n.set(o, t.absPath);
216
- }
217
- for (const t of i)
218
- for (const o of t.header.consumers) {
219
- let s = e.get(o);
220
- if (!s) {
221
- const r = n.has(o);
222
- s = {
223
- consumer: o,
224
- files: r ? [n.get(o)] : [],
225
- consumedBy: [],
226
- unresolved: !r
227
- }, e.set(o, s);
228
- }
229
- s.files.push(t.absPath);
230
- }
231
- for (const t of i)
232
- for (const o of t.header.consumers) {
233
- const s = e.get(o);
234
- if (!s) continue;
235
- const r = N(t.absPath, ".ts");
236
- s.consumer !== r && (s.consumedBy.includes(r) || s.consumedBy.push(r));
237
- }
238
- return e;
239
- }
240
- function se(i, e, n) {
241
- const t = /* @__PURE__ */ new Set(), o = [];
242
- function s(r, c, f) {
243
- if (c > n) {
244
- o.push(`${f}... more`);
245
- return;
246
- }
247
- if (t.has(r)) {
248
- o.push(`${f}${r} [circular]`);
249
- return;
250
- }
251
- t.add(r);
252
- const a = i.get(r);
253
- if (!a) {
254
- o.push(`${f}${r} (unresolved)`);
255
- return;
256
- }
257
- o.push(`${f}${r}`);
258
- for (const l of a.consumedBy)
259
- s(l, c + 1, `${f} `);
260
- }
261
- return s(e, 0, ""), o;
262
- }
263
- function M(i) {
264
- const e = w(i, "specs");
265
- if (!z(e)) return [];
266
- const n = oe(e), t = [];
267
- for (const o of n) {
268
- const s = x(i, o);
269
- let r;
270
- try {
271
- r = D(o, "utf-8");
272
- } catch {
273
- continue;
274
- }
275
- const c = ie(r), f = c.length === 0, a = {
276
- specPath: s,
277
- taskIds: c,
278
- isLibraryLevel: f,
279
- subSpecs: []
280
- };
281
- f && (a.subSpecs = re(o, e)), t.push(a);
282
- }
283
- return t;
284
- }
285
- function oe(i) {
286
- const e = [], n = [i];
287
- for (; n.length > 0; ) {
288
- const t = n.pop();
289
- let o;
290
- try {
291
- o = T(t);
292
- } catch {
293
- continue;
294
- }
295
- for (const s of o) {
296
- if (s.startsWith(".")) continue;
297
- const r = w(t, s);
298
- let c;
299
- try {
300
- c = K(r);
301
- } catch {
302
- continue;
303
- }
304
- c.isDirectory() ? n.push(r) : s.endsWith(".spec.md") && e.push(r);
305
- }
306
- }
307
- return e;
308
- }
309
- function ie(i) {
310
- const e = /* @__PURE__ */ new Set(), n = /TSK-\d+/g;
311
- let t;
312
- for (; (t = n.exec(i)) !== null; )
313
- e.add(t[0]);
314
- return [...e].sort();
315
- }
316
- function re(i, e) {
317
- const n = w(i, "..");
318
- if (!n.startsWith(e)) return [];
319
- let t;
320
- try {
321
- t = T(n);
322
- } catch {
323
- return [];
324
- }
325
- return t.filter((o) => o !== N(i) && o.endsWith(".spec.md")).map((o) => w(n, o)).filter((o) => o !== i).sort();
326
- }
327
- function ce(i, e) {
328
- return M(i).find((t) => t.specPath.endsWith(e)) ?? null;
329
- }
330
- function le(i) {
331
- const e = [];
332
- return i.file.length > 0 ? [
333
- "orient --detail show DBC contracts for each entity in this file",
334
- "orient --task=TSK-XX --detail find files by task, then show their contracts"
335
- ] : i.task.length > 0 ? (e.push("orient --task=<TID> --detail show DBC contracts for matched files"), e.push("orient --consumer=<name> find files by consumer name"), e.push("orient --entity=<name> search for a specific exported entity"), e.push("orient --specs see all specs and their task files"), e.slice(0, 4)) : i.consumer.length > 0 ? (e.push("orient --consumer=<name> --detail show contracts"), e.push("orient --graph show the full dependency graph"), e.push("orient --graph --recursive show transitive dependencies"), e) : i.entity.length > 0 ? (e.push("orient --entity=<name> --fuzzy fuzzy match entity names"), e.push("orient --file=<path> inspect a specific file in detail"), e) : i.graph ? (e.push("orient --graph --recursive expand transitive dependencies"), e.push("orient --graph --recursive --depth=<N> limit recursion depth"), e.push("orient --consumer=<name> find files by consumer"), e) : i.specs || i.spec ? (e.push("orient --task=TSK-XX find files for a specific task"), e.push("orient --file=<path> detailed view of a file"), e) : i._.length > 0 ? (e.push("orient --detail include DBC contract details"), e.push("orient --task=TSK-XX find all files for a task"), e.push("orient --entity=<name> search exported entities"), e.push("orient --file=<path> detailed view of a single file"), e.slice(0, 4)) : (e.push("orient --depth=<N> limit tree depth"), e.push("orient --detail show DBC contracts per file"), e.push("orient --task=TSK-XX find files by task ID"), e.push("orient <keyword> search across all @file: and @purpose"), e.slice(0, 4));
336
- }
337
- function fe(i, e, n, t, o) {
338
- const s = [], r = ae(i, e);
339
- if (O(r, "", e, n, 0, t, s), o < i.length) {
340
- const c = i.length - o;
341
- s.push(`... ${c} more file${c === 1 ? "" : "s"}`);
342
- }
343
- return s;
344
- }
345
- function ae(i, e) {
346
- const n = /* @__PURE__ */ new Map();
347
- for (const t of i) {
348
- const s = x(e, t.absPath).split(E);
349
- let r = n;
350
- for (let c = 0; c < s.length - 1; c++) {
351
- const f = s[c];
352
- let a = r.get(f);
353
- (!a || !(a instanceof Map)) && (a = /* @__PURE__ */ new Map(), r.set(f, a)), r = a;
354
- }
355
- r.set(s[s.length - 1], t);
356
- }
357
- return n;
358
- }
359
- function O(i, e, n, t, o, s, r) {
360
- if (i instanceof Map) {
361
- const d = [...i.entries()].sort(([$], [k]) => $.localeCompare(k)), h = [], y = [];
362
- for (const [$, k] of d)
363
- k instanceof Map ? h.push([$, k]) : y.push([$, k]);
364
- if (o >= t) {
365
- const $ = h.length, k = y.length, j = $ === 1 ? "dir" : "dirs", q = k === 1 ? "file" : "files";
366
- r.push(`${e}... ${$} more ${j}, ${k} ${q}`);
367
- return;
368
- }
369
- for (const [$, k] of h)
370
- r.push(`${e}${$}/`), O(k, `${e} `, n, t, o + 1, s, r);
371
- for (const [, $] of y)
372
- O($, e, n, t, o, s, r);
373
- return;
374
- }
375
- const c = i, f = c.header.file || "(missing)", a = c.header.tasks.length > 0 ? c.header.tasks.join(", ") : "", l = c.header.consumers.join(", "), p = c.exports.length.toString(), m = x(n, c.absPath), u = m.split(E).pop() ?? m;
376
- let g = `${e}${u} — @file: ${f}`;
377
- if (a && (g += ` | @tasks: ${a}`), l && (g += ` | @consumers: ${l}`), g += ` | @exports: ${p}`, r.push(g), s && c.exports.length > 0)
378
- for (const d of c.exports) {
379
- const h = d.contract.entries.find(
380
- (y) => y.type === "purpose" || y.type === "description"
381
- );
382
- h && r.push(`${e} - ${d.name}(${d.kind}) ${h.value}`);
383
- }
384
- }
385
- function b(i, e) {
386
- const n = [];
387
- for (const t of i) {
388
- const o = x(e, t.absPath);
389
- if (n.push(o), n.push(` @file: ${t.header.file || "(missing)"}`), t.header.tasks.length > 0 && n.push(` @tasks: ${t.header.tasks.join(", ")}`), t.header.consumers.length > 0 && n.push(` @consumers: ${t.header.consumers.join(", ")}`), n.push(` @exports: ${t.exports.length}`), t.exports.length > 0) {
390
- n.push("");
391
- for (const s of t.exports) {
392
- const r = ue(s.name, s.kind, s.contract);
393
- n.push(` ${r}`), he(s.contract.entries, n, " "), n.push("");
394
- }
395
- }
396
- }
397
- return n;
398
- }
399
- function ue(i, e, n) {
400
- if (e === "function") {
401
- const t = n.entries.filter((r) => r.type === "param").map((r) => r.specifier ?? "?").join(", "), o = n.entries.find((r) => r.type === "returns"), s = o ? `: ${o.dataType ?? o.value}` : ": void";
402
- return `${i}(${t})${s}`;
403
- }
404
- return `${i}: ${e}`;
405
- }
406
- function he(i, e, n) {
407
- for (const t of i) {
408
- if (t.type === "description") continue;
409
- let o = `${n}@${t.type}`;
410
- if (t.specifier && (o += ` {${t.specifier}}`), t.dataType && (o += ` {${t.dataType}}`), t.value && (o += ` ${t.value}`), e.push(o), t.inline)
411
- for (const s of t.inline) {
412
- let r = `${n} @${s.type}`;
413
- s.specifier && (r += ` {${s.specifier}}`), s.dataType && (r += ` {${s.dataType}}`), s.value && (r += ` ${s.value}`), e.push(r);
414
- }
415
- }
416
- }
417
- function pe(i, e) {
418
- const n = x(e, i.absPath), t = i.header.file || "(missing)", o = i.header.tasks.length > 0 ? i.header.tasks.join(", ") : "", s = i.header.consumers.join(", "), r = i.exports.length.toString();
419
- let c = `${n} — @file: ${t}`;
420
- return o && (c += ` | @tasks: ${o}`), s && (c += ` | @consumers: ${s}`), c += ` | @exports: ${r}`, c;
421
- }
422
- function B(i, e) {
423
- return i.map((n) => pe(n, e));
424
- }
425
- function de(i) {
426
- const e = [];
427
- if (i.size === 0)
428
- return e.push("No consumer dependencies found"), e;
429
- e.push("Project dependencies:");
430
- for (const [n, t] of [...i.entries()].sort(([o], [s]) => o.localeCompare(s))) {
431
- e.push(` ${n} consumes:`);
432
- const o = [...new Set(t.files)].sort();
433
- for (const s of o)
434
- e.push(` ${s}`);
435
- t.unresolved && e.push(" (unresolved — text-only reference)");
436
- }
437
- return e;
438
- }
439
- function me(i) {
440
- const e = [];
441
- if (i.length === 0)
442
- return e.push("No specs found"), e;
443
- for (const n of i)
444
- if (n.isLibraryLevel) {
445
- const t = n.subSpecs.length;
446
- e.push(
447
- `${n.specPath} (library-level spec — ${t} sub-spec${t === 1 ? "" : "s"} below)`
448
- );
449
- } else
450
- e.push(`${n.specPath} → ${n.taskIds.join(", ")}`);
451
- return e;
452
- }
453
- function ge(i) {
454
- const e = [];
455
- e.push(`${i.specPath}:`);
456
- for (const n of i.taskIds)
457
- e.push(` ${n}`);
458
- return e;
459
- }
460
- function ye(i, e) {
461
- const n = [];
462
- for (const t of i) {
463
- let s = `${x(e, t.file.absPath)} — @file: ${t.file.header.file || "(missing)"}`;
464
- t.entityName && (s += ` - ${t.entityName}() @purpose: found via entity match`), n.push(s);
465
- }
466
- return n;
467
- }
468
- function $e(i) {
469
- const e = {
470
- _: [],
471
- file: [],
472
- dir: "",
473
- task: [],
474
- consumer: [],
475
- entity: [],
476
- graph: !1,
477
- recursive: !1,
478
- specs: !1,
479
- spec: "",
480
- detail: !1,
481
- fuzzy: !1,
482
- depth: 1 / 0,
483
- maxResults: 1 / 0
484
- };
485
- for (let n = 2; n < i.length; n++) {
486
- const t = i[n];
487
- t === "--file" ? e.file.push(i[++n] ?? "") : t.startsWith("--file=") ? e.file.push(t.slice(7)) : t === "--dir" ? e.dir = i[++n] ?? "" : t.startsWith("--dir=") ? e.dir = t.slice(6) : t === "--task" ? e.task.push(i[++n] ?? "") : t.startsWith("--task=") ? e.task.push(t.slice(7)) : t === "--consumer" ? e.consumer.push(i[++n] ?? "") : t.startsWith("--consumer=") ? e.consumer.push(t.slice(11)) : t === "--entity" ? e.entity.push(i[++n] ?? "") : t.startsWith("--entity=") ? e.entity.push(t.slice(9)) : t === "--graph" ? e.graph = !0 : t === "--recursive" ? e.recursive = !0 : t === "--specs" ? e.specs = !0 : t === "--spec" ? e.spec = i[++n] ?? "" : t.startsWith("--spec=") ? e.spec = t.slice(7) : t === "--detail" ? e.detail = !0 : t === "--fuzzy" ? e.fuzzy = !0 : t === "--depth" ? e.depth = parseInt(i[++n] ?? "", 10) || 1 / 0 : t.startsWith("--depth=") ? e.depth = parseInt(t.slice(8), 10) || 1 / 0 : t === "--max-results" ? e.maxResults = parseInt(i[++n] ?? "", 10) || 1 / 0 : t.startsWith("--max-results=") ? e.maxResults = parseInt(t.slice(14), 10) || 1 / 0 : t && !t.startsWith("-") && t !== "orient" && e._.push(t);
488
- }
489
- return e;
490
- }
491
- async function Se(i) {
492
- S.debug("[OrientCommand#run] [idle → parsing]");
493
- const e = $e(i), n = w(".");
494
- let t;
495
- if (e.file.length > 0)
496
- t = e.file.filter((o) => {
497
- const s = w(o);
498
- return !z(s) || !P(s).isFile() ? (console.error(`[OrientCommand#run] File not found: ${o}`), !1) : !0;
499
- }).map((o) => C(w(o)));
500
- else if (e.dir) {
501
- const o = w(e.dir);
502
- (!z(o) || !P(o).isDirectory()) && (console.error(`[OrientCommand#run] Directory not found: ${e.dir}`), process.exit(1)), t = F(o).map((r) => C(r));
503
- } else
504
- t = F(n).map((s) => C(s)).slice(0, e.maxResults);
505
- if (t.length === 0) {
506
- console.log("No .ts files found in the project.");
507
- return;
508
- }
509
- S.debug(`[OrientCommand#run] [parsing → loaded] ${t.length} file(s)`), e.file.length > 0 && e.dir && (console.error("[OrientCommand#run] --file and --dir are mutually exclusive"), process.exit(1)), e.specs && e.file.length > 0 && (console.error("[OrientCommand#run] --specs and --file are mutually exclusive"), process.exit(1)), e.specs && (e.task.length > 0 || e.consumer.length > 0 || e.entity.length > 0 || e.graph) && (console.error(
510
- "[OrientCommand#run] --specs is incompatible with --task/--consumer/--entity/--graph"
511
- ), process.exit(1)), e.spec && (e.file.length > 0 || e.task.length > 0 || e.consumer.length > 0 || e.entity.length > 0 || e.graph) && (console.error(
512
- "[OrientCommand#run] --spec is incompatible with --file/--task/--consumer/--entity/--graph"
513
- ), process.exit(1)), e.graph && e._.length > 0 && (console.error("[OrientCommand#run] --graph and positional keyword are mutually exclusive"), process.exit(1)), e.file.length > 0 ? xe(t, e, n) : e.task.length > 0 ? ke(t, e, n) : e.consumer.length > 0 ? ve(t, e, n) : e.entity.length > 0 ? be(t, e, n) : e.graph ? Ce(t, e) : e.specs ? Pe(e, n) : e.spec ? ze(e, n) : e._.length > 0 ? we(t, e, n) : X(t, e, n);
514
- }
515
- function X(i, e, n) {
516
- S.debug("[OrientCommand#run] [routing → S1] map");
517
- const t = fe(i, n, e.depth, e.detail, e.maxResults);
518
- for (const o of t) console.log(o);
519
- v(e);
520
- }
521
- function ke(i, e, n) {
522
- S.debug("[OrientCommand#run] [routing → S2] task");
523
- const t = Z(i, e.task);
524
- for (const o of t) {
525
- if (o.files.length === 0) {
526
- console.log(`No files found for ${o.taskId}`);
527
- continue;
528
- }
529
- if (console.log(`${o.taskId} — ${o.files.length} file${o.files.length === 1 ? "" : "s"}:`), e.detail)
530
- for (const s of b(o.files, n)) console.log(` ${s}`);
531
- else
532
- for (const s of B(o.files, n)) console.log(` ${s}`);
533
- }
534
- v(e);
535
- }
536
- function ve(i, e, n) {
537
- S.debug("[OrientCommand#run] [routing → S3] consumer");
538
- const t = A(i, e.consumer, e.fuzzy);
539
- for (const o of t) {
540
- if (o.files.length === 0) {
541
- console.log(`"${o.consumerName}" not found as consumer`);
542
- continue;
543
- }
544
- if (console.log(
545
- `"${o.consumerName}" referenced as consumer by ${o.files.length} file${o.files.length === 1 ? "" : "s"}:`
546
- ), e.detail)
547
- for (const s of b(o.files, n)) console.log(` ${s}`);
548
- else
549
- for (const s of B(o.files, n)) console.log(` ${s}`);
550
- }
551
- v(e);
552
- }
553
- function we(i, e, n) {
554
- const t = e._.join(" ").trim();
555
- if (!t) {
556
- X(i, e, n);
557
- return;
558
- }
559
- S.debug(`[OrientCommand#run] [routing → S4] keyword "${t}"`);
560
- const o = Y(i), s = ee(i, o, t);
561
- if (s.length === 0) {
562
- console.log(`"${t}" not found`), v(e);
563
- return;
564
- }
565
- if (console.log(`"${t}" found in ${s.length} file${s.length === 1 ? "" : "s"}:`), e.detail) {
566
- const r = s.map((c) => c.file);
567
- for (const c of b(r, n)) console.log(` ${c}`);
568
- } else
569
- for (const r of ye(s, n)) console.log(` ${r}`);
570
- v(e);
571
- }
572
- function xe(i, e, n) {
573
- S.debug("[OrientCommand#run] [routing → S5] detail"), i.length === 0 && (console.error("[OrientCommand#run] No valid files to display"), process.exit(1));
574
- for (const t of b(i, n)) console.log(t);
575
- v(e);
576
- }
577
- function be(i, e, n) {
578
- S.debug("[OrientCommand#run] [routing → S6] entity");
579
- const t = te(i, e.entity, e.fuzzy);
580
- for (const o of e.entity) {
581
- const s = t.filter((c) => c.name === o || e.fuzzy && c.fuzzy);
582
- if (s.length === 0) {
583
- console.log(`"${o}" not found`);
584
- continue;
585
- }
586
- const r = new Set(s.map((c) => c.filePath));
587
- console.log(`"${o}" found in ${r.size} file${r.size === 1 ? "" : "s"}:`);
588
- for (const c of r) {
589
- const f = x(n, c);
590
- console.log(` ${f}`);
591
- const a = s.filter((l) => l.filePath === c);
592
- for (const l of a) {
593
- const p = l.contract.entries.find(
594
- (u) => u.type === "purpose" || u.type === "description"
595
- );
596
- console.log(p ? ` ${l.name}: ${l.kind} — ${p.value}` : ` ${l.name}: ${l.kind}`);
597
- const m = l.contract.entries.find((u) => u.type === "implements");
598
- m && console.log(` @implements ${m.specifier ?? m.value}`);
599
- }
600
- }
601
- }
602
- v(e);
603
- }
604
- function Ce(i, e) {
605
- S.debug("[OrientCommand#run] [routing → S7] graph");
606
- const n = ne(i);
607
- if (e.recursive) {
608
- const t = [...n.keys()].filter((o) => {
609
- const s = n.get(o);
610
- return s && !s.unresolved;
611
- });
612
- for (const o of t) {
613
- const s = se(n, o, e.depth);
614
- for (const r of s) console.log(r);
615
- }
616
- } else
617
- for (const t of de(n)) console.log(t);
618
- v(e);
619
- }
620
- function Pe(i, e) {
621
- S.debug("[OrientCommand#run] [routing → S8] specs overview");
622
- const n = M(e);
623
- for (const t of me(n)) console.log(t);
624
- v(i);
625
- }
626
- function ze(i, e) {
627
- S.debug(`[OrientCommand#run] [routing → S9] spec "${i.spec}"`);
628
- const n = ce(e, i.spec);
629
- n || (console.error(`spec "${i.spec}" not found. Use orient --specs for available specs.`), process.exit(1));
630
- for (const t of ge(n)) console.log(t);
631
- v(i);
632
- }
633
- function v(i) {
634
- console.log(""), console.log("Hints:");
635
- const e = le(i);
636
- for (const n of e) console.log(` ${n}`);
637
- }
638
- function C(i) {
639
- let e;
640
- try {
641
- e = D(i, "utf-8");
642
- } catch {
643
- return { absPath: i, header: { file: "", tasks: [], consumers: [] }, exports: [] };
644
- }
645
- const n = V(e), t = Ne(e);
646
- return { absPath: i, header: n, exports: t };
647
- }
648
- function Ne(i) {
649
- const e = [], n = new G(), t = /((?:\/\*\*[\s\S]*?\*\/\s*))?export\s+(class|function|const|type|interface|enum)\s+(\w+)/g;
650
- let o;
651
- for (; (o = t.exec(i)) !== null; ) {
652
- const s = o[1]?.trim() ?? "", r = o[2], c = o[3];
653
- let f, a = "";
654
- s ? (a = s, f = n.parse(s)) : f = { entries: [], format: "single-line" }, e.push({ name: c, kind: r, contract: f, rawJsdoc: a });
655
- }
656
- return e;
657
- }
658
- await Se(process.argv);
@@ -1,7 +0,0 @@
1
- import { p as e, r } from "./run-review-command.logic-CA2Rjymb.js";
2
- const s = e(process.argv), o = await r({
3
- mode: "verify",
4
- args: s
5
- });
6
- o.output && console.info(o.output);
7
- process.exit(o.code);