gennady 0.8.4-draft.2 → 0.8.4-draft.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/directives/sdd-v2/root.directive.xml +36 -3
- package/ai/directives/sdd-v2/router.directive.xml +22 -1
- package/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
- package/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
- package/ai/skills/agent-inbox/SKILL.md +1 -1
- package/ai/skills/sdd/SKILL.md +5 -3
- package/ai/skills/sdd-audit/SKILL.md +5 -2
- package/ai/skills/sdd-check/SKILL.md +2 -2
- package/ai/skills/sdd-code-review/SKILL.md +4 -1
- package/ai/skills/sdd-critic/SKILL.md +5 -2
- package/ai/skills/sdd-execute/SKILL.md +5 -2
- package/ai/skills/sdd-reconcile/SKILL.md +5 -2
- package/ai/skills/sdd-scaffold/SKILL.md +5 -2
- package/dist/ai/directives/sdd-v2/root.directive.xml +36 -3
- package/dist/ai/directives/sdd-v2/router.directive.xml +22 -1
- package/dist/ai/kit/templates/sdd-v2/root.directive.hbs +11 -3
- package/dist/ai/kit/templates/sdd-v2/router.directive.hbs +22 -1
- package/dist/ai/skills/agent-inbox/SKILL.md +1 -1
- package/dist/ai/skills/sdd/SKILL.md +5 -3
- package/dist/ai/skills/sdd-audit/SKILL.md +5 -2
- package/dist/ai/skills/sdd-check/SKILL.md +2 -2
- package/dist/ai/skills/sdd-code-review/SKILL.md +4 -1
- package/dist/ai/skills/sdd-critic/SKILL.md +5 -2
- package/dist/ai/skills/sdd-execute/SKILL.md +5 -2
- package/dist/ai/skills/sdd-reconcile/SKILL.md +5 -2
- package/dist/ai/skills/sdd-scaffold/SKILL.md +5 -2
- package/dist/chunks/{classify-mr-stage.logic-BiCHTmPp.js → classify-mr-stage.logic-CazmQDwZ.js} +2 -2
- package/dist/chunks/{config-index-9VHWSDQD.js → config-index-DU8-FEjq.js} +1 -1
- package/dist/chunks/{devtools-b0DwO1x_.js → devtools-1JmXJjUG.js} +1 -1
- package/dist/chunks/{eval.cmd-CwNPaNJd.js → eval.cmd-CBANnOFG.js} +1 -1
- package/dist/chunks/{help-D5cXtdMI.js → help-DVloaFF5.js} +1 -1
- package/dist/chunks/{index-BVnJEutp.js → index-2xhpqJtd.js} +2 -2
- package/dist/chunks/{index-RR5OUxje.js → index-AxsLBUAx.js} +14 -14
- package/dist/chunks/{index-CUkeTGqM.js → index-B7sydB0W.js} +2 -2
- package/dist/chunks/{index-CMCn9ErF.js → index-BKxk4zOz.js} +2 -2
- package/dist/chunks/{index-Db13NlHh.js → index-BNMmX_Mv.js} +21 -21
- package/dist/chunks/{index-CmQO-RmM.js → index-BPzldG3a.js} +2 -2
- package/dist/chunks/{index-BOQl7F_Z.js → index-BQlFDvKW.js} +2 -2
- package/dist/chunks/{index-RzkvIfJQ.js → index-Baq7RL1L.js} +3 -3
- package/dist/chunks/index-BbPiwvY9.js +2 -0
- package/dist/chunks/{index-ClJLPEUB.js → index-BreGNLJ_.js} +1 -1
- package/dist/chunks/{index-DjSafAkN.js → index-BslPwGtM.js} +2 -2
- package/dist/chunks/{index-DiMFxS0z.js → index-BtCUN2fZ.js} +16 -16
- package/dist/chunks/{index-CS0VbiLD.js → index-C10-EOdB.js} +1 -1
- package/dist/chunks/{index-2BOEcJIa.js → index-C4JmZLaj.js} +2 -2
- package/dist/chunks/index-CA-JKLr4.js +2 -0
- package/dist/chunks/{index-43GiH--T.js → index-CG_jJZVu.js} +2 -2
- package/dist/chunks/{index-BdkFKsMm.js → index-CGyP2uDE.js} +3 -3
- package/dist/chunks/{index-BOKv0b01.js → index-CPl1s9XJ.js} +2 -2
- package/dist/chunks/{index-DIPrBH-4.js → index-CSxE4cEm.js} +9 -9
- package/dist/chunks/{index-Cm7U1-fU.js → index-CWR5EzXx.js} +2 -2
- package/dist/chunks/{index-BwN5llCR.js → index-Camql5kL.js} +2 -2
- package/dist/chunks/{index-Drh-J9O7.js → index-CdUiTipO.js} +7 -7
- package/dist/chunks/{index-Cn029KTN.js → index-Crg61pK5.js} +2 -2
- package/dist/chunks/{index-Dja2O-hV.js → index-Cv9ZYXso.js} +1 -1
- package/dist/chunks/{index-Ck8v_Gv7.js → index-D7ADMlG3.js} +1 -1
- package/dist/chunks/index-DNl2gC8l.js +158 -0
- package/dist/chunks/{index-BYIzl-Ut.js → index-DVJA0qVm.js} +36 -36
- package/dist/chunks/{index-BAEIZVx0.js → index-DcFJhkY1.js} +2 -2
- package/dist/chunks/{index-Dx5_CB2E.js → index-DdEd-L3x.js} +2 -2
- package/dist/chunks/{index-DVmqMmgb.js → index-DkGA1eW_.js} +32 -32
- package/dist/chunks/{index-3k7mPX1e.js → index-Dnwxlti3.js} +1 -1
- package/dist/chunks/{index-CrizvxOJ.js → index-DqdEJDi2.js} +2 -2
- package/dist/chunks/{index-BIPebtDl.js → index-DqiwmBt4.js} +1 -1
- package/dist/chunks/{index-DS4MhAw-.js → index-PfuqBWjY.js} +2 -2
- package/dist/chunks/{index-BmFT1Kx2.js → index-SVP6RfVl.js} +2 -2
- package/dist/chunks/{index-CDxV4b81.js → index-Y8wu48Q0.js} +1 -1
- package/dist/chunks/index-_ewSKppm.js +2 -0
- package/dist/chunks/{index-Ctcr_Qeu.js → index-aBVtCLIJ.js} +2 -2
- package/dist/chunks/index-dNdz9j6d.js +2 -0
- package/dist/chunks/{index-BFUkVkSo.js → index-gskOpu3H.js} +16 -16
- package/dist/chunks/{index-CXpkT25O.js → index-pBSLMn5Q.js} +3 -3
- package/dist/chunks/index-sqPhX5Io.js +2 -0
- package/dist/chunks/{index-BzmR4Es2.js → index-vfrjhUD1.js} +39 -39
- package/dist/chunks/{index-J2NvjjDV.js → index-xGF5XC_i.js} +2 -2
- package/dist/chunks/{run-review-command.logic-CA2Rjymb.js → run-review-command.logic-B9GoCxh-.js} +24 -24
- package/dist/chunks/{serve.cmd-RxYS6WoN.js → serve.cmd-UXkaeaPI.js} +2 -2
- package/dist/chunks/{services-Csd556Tv.js → services-BYCeGBlO.js} +4 -4
- package/dist/chunks/{shared-B5CTGvpG.js → shared-B3cXL2Np.js} +1178 -1117
- package/dist/chunks/{stats-index-BLztvK69.js → stats-index-AIAnnp9S.js} +2 -2
- package/dist/gennady.js +46 -46
- package/dist/index.js +4 -4
- package/dist/shared/sdd/ladder.d.ts +42 -0
- package/dist/shared/sdd/module-specs.d.ts +7 -0
- package/dist/shared/sdd/tracker.d.ts +9 -0
- package/package.json +1 -1
- package/dist/chunks/classify-mr-stage.logic-ClmhzQPQ.js +0 -53
- package/dist/chunks/config-index-RFeqlDWs.js +0 -104
- package/dist/chunks/devtools-p8tmPuLn.js +0 -79
- package/dist/chunks/eval.cmd-ewU5lcUY.js +0 -34
- package/dist/chunks/help-DzGnMNi2.js +0 -7
- package/dist/chunks/index--AXFi0ty.js +0 -89
- package/dist/chunks/index-64TSesTc.js +0 -186
- package/dist/chunks/index-9Gv5trS_.js +0 -125
- package/dist/chunks/index-B1DQIryA.js +0 -2
- package/dist/chunks/index-B1PiBeQ3.js +0 -2
- package/dist/chunks/index-B4rzuhkt.js +0 -183
- package/dist/chunks/index-B97HJjkg.js +0 -159
- package/dist/chunks/index-BF6qypm0.js +0 -131
- package/dist/chunks/index-BK84ZQsh.js +0 -128
- package/dist/chunks/index-BRVIirjj.js +0 -141
- package/dist/chunks/index-BXnryCGW.js +0 -96
- package/dist/chunks/index-BaZm7Otb.js +0 -2
- package/dist/chunks/index-Bhk746A2.js +0 -129
- package/dist/chunks/index-Bi-eY_dY.js +0 -164
- package/dist/chunks/index-BjumU69g.js +0 -2
- package/dist/chunks/index-BkWXcpXU.js +0 -16979
- package/dist/chunks/index-BlY4jQIA.js +0 -168
- package/dist/chunks/index-C0iy7GxD.js +0 -140
- package/dist/chunks/index-CCBTXczb.js +0 -56
- package/dist/chunks/index-CDAfkSrr.js +0 -2
- package/dist/chunks/index-CDHymWzC.js +0 -102
- package/dist/chunks/index-CNfXJAao.js +0 -2
- package/dist/chunks/index-CQsae1nq.js +0 -207
- package/dist/chunks/index-CVmd0prf.js +0 -2
- package/dist/chunks/index-CZuTNeNm.js +0 -2
- package/dist/chunks/index-CasNhhrL.js +0 -96
- package/dist/chunks/index-Ce7GWENF.js +0 -377
- package/dist/chunks/index-Cf-02TAg.js +0 -265
- package/dist/chunks/index-CfjQWSrh.js +0 -52
- package/dist/chunks/index-Chr7gBBz.js +0 -443
- package/dist/chunks/index-Ci875Zlg.js +0 -346
- package/dist/chunks/index-CwA6RzIB.js +0 -3793
- package/dist/chunks/index-D1dI63ej.js +0 -46
- package/dist/chunks/index-DCS32A2i.js +0 -663
- package/dist/chunks/index-DOFoNxvb.js +0 -131
- package/dist/chunks/index-DVkCEuws.js +0 -136
- package/dist/chunks/index-DkadaaXq.js +0 -658
- package/dist/chunks/index-Dn11CLtk.js +0 -7
- package/dist/chunks/index-Do3spFJT.js +0 -340
- package/dist/chunks/index-DrFRZ0Yg.js +0 -2
- package/dist/chunks/index-DvEQhXi2.js +0 -1054
- package/dist/chunks/index-GiS0x6jg.js +0 -90
- package/dist/chunks/index-NacvqeQ5.js +0 -69
- package/dist/chunks/index-RNJhFzdr.js +0 -227
- package/dist/chunks/index-R_vUB6CL.js +0 -2
- package/dist/chunks/index-TQft1s5H.js +0 -20
- package/dist/chunks/index-ZmQRP38W.js +0 -26969
- package/dist/chunks/index-jdOZ4AkD.js +0 -143
- package/dist/chunks/index-kNa21kUI.js +0 -279
- package/dist/chunks/index-v4AV9kAc.js +0 -108
- package/dist/chunks/run-review-command.logic-CU1Slmc_.js +0 -331
- package/dist/chunks/serve.cmd-dWu_k_G_.js +0 -162
- package/dist/chunks/services-CwvXl2MB.js +0 -46832
- package/dist/chunks/shared-DSZTUx5b.js +0 -4509
- package/dist/chunks/stats-index-H6ALcjxy.js +0 -66
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
import { readFileSync as S, existsSync as k, readdirSync as A } from "node:fs";
|
|
2
|
-
import { resolve as f, join as m, sep as _, dirname as v } from "node:path";
|
|
3
|
-
import { l as te } from "./services-Csd556Tv.js";
|
|
4
|
-
import { p as ne, k as H, l as V, m as I, n as ce, o as oe, q as re, t as P, v as ae, h as ie, w as le, y as ue, z as pe, B as de, C as q, D as fe, E as he, F as me, H as ge, I as ke, J as Ce, K as ye, L as Se, M as _e, N as x, O as we, P as Re, Q as Ee, R as xe, S as ve, U as Fe, W as De, X as Te, Y as $e, Z as Ie, e as Q, _ as X, $ as Oe, a0 as Le, a1 as Ae, a2 as Ne, a3 as Me, a4 as Be } from "./shared-B5CTGvpG.js";
|
|
5
|
-
const Ke = "ERR_CLI_SDD_CHECK_BAD_INVOCATION", be = "ERR_CLI_SDD_CHECK_FILE";
|
|
6
|
-
function je(t, n) {
|
|
7
|
-
if (t.length === 0)
|
|
8
|
-
return { text: `[sdd-check] ✅ clean — ${n} file(s) checked`, exitCode: 0 };
|
|
9
|
-
const e = t.map((c) => `${c.file}: ${c.severity}: ${c.code} ${c.message}`), s = t.filter((c) => c.severity === "error").length, r = t.length - s, a = `[sdd-check] ${s} error(s), ${r} warning(s) across ${n} file(s)`;
|
|
10
|
-
return { text: [...e, "", a].join(`
|
|
11
|
-
`), exitCode: s > 0 ? 1 : 0 };
|
|
12
|
-
}
|
|
13
|
-
function He() {
|
|
14
|
-
return {
|
|
15
|
-
text: [
|
|
16
|
-
`[sdd-check] ${Ke}`,
|
|
17
|
-
" expected: gennady sdd-check (--task <ticket> | --all [project-root] | --changed [project-root])"
|
|
18
|
-
].join(`
|
|
19
|
-
`),
|
|
20
|
-
exitCode: 4
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function Ve(t) {
|
|
24
|
-
return {
|
|
25
|
-
text: `[sdd-check] ${be}: ${t}
|
|
26
|
-
Cannot read the ticket — verify the path.`,
|
|
27
|
-
exitCode: 1
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
const N = /* @__PURE__ */ new Set([
|
|
31
|
-
"node_modules",
|
|
32
|
-
".git",
|
|
33
|
-
"dist",
|
|
34
|
-
"build",
|
|
35
|
-
"out",
|
|
36
|
-
"coverage",
|
|
37
|
-
"__tests__"
|
|
38
|
-
]);
|
|
39
|
-
function Y(t, n) {
|
|
40
|
-
let e;
|
|
41
|
-
try {
|
|
42
|
-
e = A(t, { withFileTypes: !0 });
|
|
43
|
-
} catch {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
for (const s of e) {
|
|
47
|
-
if (s.name.startsWith(".") || N.has(s.name) || s.isSymbolicLink()) continue;
|
|
48
|
-
const r = m(t, s.name);
|
|
49
|
-
s.isDirectory() ? Y(r, n) : s.isFile() && s.name.endsWith(".md") && n.push(r);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function Pe(t, n) {
|
|
53
|
-
const e = [], s = v(t);
|
|
54
|
-
for (const r of n.matchAll(/\]\(([^)`#]+\.spec\.md)(?:#[^)]*)?\)/g)) {
|
|
55
|
-
const a = r[1];
|
|
56
|
-
a && (k(f(s, a)) || e.push({
|
|
57
|
-
severity: "error",
|
|
58
|
-
code: "SDD_BROKEN_SPEC_LINK",
|
|
59
|
-
file: t,
|
|
60
|
-
message: `Referenced spec does not resolve on disk: ${a}`
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
return e;
|
|
64
|
-
}
|
|
65
|
-
function W(t, n) {
|
|
66
|
-
const e = [], s = v(t);
|
|
67
|
-
for (const r of n.matchAll(/\]\(([^)`#]+\.xml)(?:#[^)]*)?\)/g)) {
|
|
68
|
-
const a = r[1];
|
|
69
|
-
a && (k(f(s, a)) || e.push({
|
|
70
|
-
severity: "error",
|
|
71
|
-
code: "SDD_BROKEN_RULE_LINK",
|
|
72
|
-
file: t,
|
|
73
|
-
message: `Referenced rule file does not resolve on disk: ${a}`
|
|
74
|
-
}));
|
|
75
|
-
}
|
|
76
|
-
return e;
|
|
77
|
-
}
|
|
78
|
-
const O = /* @__PURE__ */ new Map();
|
|
79
|
-
function We(t, n) {
|
|
80
|
-
const e = O.get(n);
|
|
81
|
-
if (e) return e;
|
|
82
|
-
let s = "";
|
|
83
|
-
try {
|
|
84
|
-
s = S(f(t, n), "utf-8");
|
|
85
|
-
} catch {
|
|
86
|
-
return O.set(n, []), [];
|
|
87
|
-
}
|
|
88
|
-
const r = Be(s);
|
|
89
|
-
return O.set(n, r), r;
|
|
90
|
-
}
|
|
91
|
-
function Ge(t, n) {
|
|
92
|
-
const e = /* @__PURE__ */ new Map(), s = [...n];
|
|
93
|
-
for (; s.length; ) {
|
|
94
|
-
const r = s.pop();
|
|
95
|
-
if (e.has(r)) continue;
|
|
96
|
-
const a = We(t, r);
|
|
97
|
-
e.set(r, a);
|
|
98
|
-
for (const c of a) e.has(c) || s.push(c);
|
|
99
|
-
}
|
|
100
|
-
return e;
|
|
101
|
-
}
|
|
102
|
-
function G(t, n, e) {
|
|
103
|
-
const s = x(n, "PHASES_OVERVIEW");
|
|
104
|
-
if (s.status !== "ok") return [];
|
|
105
|
-
const r = [];
|
|
106
|
-
for (const a of we(s.content)) {
|
|
107
|
-
const c = x(n, `PHASE_${a.id}`);
|
|
108
|
-
if (c.status !== "ok") continue;
|
|
109
|
-
const l = Re(c.content).rules.filter((u) => u.endsWith(".xml")).map((u) => Ee(t, e, u));
|
|
110
|
-
if (l.length === 0) continue;
|
|
111
|
-
const i = Ge(e, l);
|
|
112
|
-
r.push(...xe(t, a.id, l, i));
|
|
113
|
-
}
|
|
114
|
-
return r;
|
|
115
|
-
}
|
|
116
|
-
const J = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
|
|
117
|
-
function Je(t) {
|
|
118
|
-
const n = J.get(t);
|
|
119
|
-
if (n) return n;
|
|
120
|
-
const e = [], s = (a) => {
|
|
121
|
-
let c;
|
|
122
|
-
try {
|
|
123
|
-
c = A(a, { withFileTypes: !0 });
|
|
124
|
-
} catch {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
for (const l of c) {
|
|
128
|
-
if (l.name.startsWith(".") || N.has(l.name) && l.name !== "__tests__" || l.isSymbolicLink())
|
|
129
|
-
continue;
|
|
130
|
-
const i = m(a, l.name);
|
|
131
|
-
l.isDirectory() ? s(i) : l.isFile() && /\.(test|spec)\.(ts|tsx|js)$/.test(l.name) && e.push(i);
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
s(t);
|
|
135
|
-
const r = e.map((a) => a.split(_).join("/"));
|
|
136
|
-
return J.set(t, r), r;
|
|
137
|
-
}
|
|
138
|
-
function Ue(t) {
|
|
139
|
-
const n = U.get(t);
|
|
140
|
-
if (n) return n;
|
|
141
|
-
let e = "";
|
|
142
|
-
try {
|
|
143
|
-
e = S(t, "utf-8");
|
|
144
|
-
} catch {
|
|
145
|
-
}
|
|
146
|
-
const s = Me(e);
|
|
147
|
-
return U.set(t, s), s;
|
|
148
|
-
}
|
|
149
|
-
function z(t, n, e) {
|
|
150
|
-
const s = x(n, "TEST_COVERAGE");
|
|
151
|
-
if (s.status !== "ok") return [];
|
|
152
|
-
const r = ve(t, s.content), a = Fe(s.content);
|
|
153
|
-
if (a.length === 0) return r;
|
|
154
|
-
const c = Je(e), l = /* @__PURE__ */ new Map();
|
|
155
|
-
for (const d of a) {
|
|
156
|
-
if (d.deferred !== null || l.has(d.testFile)) continue;
|
|
157
|
-
const h = De(c, d.testFile);
|
|
158
|
-
r.push(...Te(t, d.testFile, h)), l.set(
|
|
159
|
-
d.testFile,
|
|
160
|
-
h.flatMap((g) => Ue(g))
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
const i = x(n, "META"), u = i.status === "ok" ? $e(i.content).taskId : null;
|
|
164
|
-
return r.push(
|
|
165
|
-
...Ie(
|
|
166
|
-
t,
|
|
167
|
-
a,
|
|
168
|
-
l,
|
|
169
|
-
E(t, e),
|
|
170
|
-
u
|
|
171
|
-
)
|
|
172
|
-
), r;
|
|
173
|
-
}
|
|
174
|
-
function ze(t, n, e, s) {
|
|
175
|
-
const r = Oe(n).map(Le);
|
|
176
|
-
if (r.length === 0) return [];
|
|
177
|
-
const a = /* @__PURE__ */ new Set();
|
|
178
|
-
for (const c of r) {
|
|
179
|
-
if (c.external || !c.name) continue;
|
|
180
|
-
Ae(
|
|
181
|
-
`grep -rlF --include='*.ts' --include='*.tsx' --include='*.js' --exclude-dir=node_modules --exclude-dir=dist --exclude-dir=.git -- ${JSON.stringify(c.name)} ${JSON.stringify(e)} 2>/dev/null`,
|
|
182
|
-
{ expectedExitCodes: [1] }
|
|
183
|
-
).split(`
|
|
184
|
-
`).map((u) => u.trim()).filter(Boolean).some((u) => f(u) !== s) && a.add(c.name);
|
|
185
|
-
}
|
|
186
|
-
return Ne(t, r, a);
|
|
187
|
-
}
|
|
188
|
-
function Ze(t) {
|
|
189
|
-
let n = t;
|
|
190
|
-
for (; ; ) {
|
|
191
|
-
if (k(m(n, "package.json"))) return n;
|
|
192
|
-
const e = v(n);
|
|
193
|
-
if (e === n) return t;
|
|
194
|
-
n = e;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
function qe(t) {
|
|
198
|
-
return t.toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/\s+/g, "-");
|
|
199
|
-
}
|
|
200
|
-
function Z(t, n) {
|
|
201
|
-
const e = [], s = v(t);
|
|
202
|
-
for (const r of n.matchAll(/\]\(([^)`#]+\.spec\.md)#([^)\s]+)\)/g)) {
|
|
203
|
-
const a = r[1], c = r[2];
|
|
204
|
-
if (!a || !c) continue;
|
|
205
|
-
const l = f(s, a);
|
|
206
|
-
if (!k(l)) {
|
|
207
|
-
e.push({
|
|
208
|
-
severity: "error",
|
|
209
|
-
code: "SDD_BROKEN_SPEC_REF",
|
|
210
|
-
file: t,
|
|
211
|
-
message: `Spec reference does not resolve on disk: ${a}#${c}`
|
|
212
|
-
});
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
let i;
|
|
216
|
-
try {
|
|
217
|
-
i = S(l, "utf-8");
|
|
218
|
-
} catch {
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
const u = c.toLowerCase(), d = [...i.matchAll(/^#{1,6}\s+(.+?)\s*$/gm)].map((g) => qe(g[1] ?? "")), h = [...i.matchAll(/<!--SECTION:([A-Z0-9_]+)-->/g)].map(
|
|
222
|
-
(g) => (g[1] ?? "").toLowerCase()
|
|
223
|
-
);
|
|
224
|
-
!d.includes(u) && !h.includes(u) && e.push({
|
|
225
|
-
severity: "warn",
|
|
226
|
-
code: "SDD_BROKEN_SPEC_ANCHOR",
|
|
227
|
-
file: t,
|
|
228
|
-
message: `Spec anchor not found in ${a}: #${c} (entity renamed/moved? the worker's sdd-extract will miss it)`
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
return e;
|
|
232
|
-
}
|
|
233
|
-
function L(t) {
|
|
234
|
-
const n = t.split(_), e = n.lastIndexOf("specs"), s = e > 0 ? n.slice(0, e).join(_) : _;
|
|
235
|
-
return e < 0 || n.length - e < 3 ? Q(s) : X(s, n[e + 1]);
|
|
236
|
-
}
|
|
237
|
-
function E(t, n) {
|
|
238
|
-
const e = f(t).split(_), s = e.lastIndexOf("tasks");
|
|
239
|
-
return s >= 0 && e.length - s >= 2 ? X(n, e[s + 1]) : Q(n);
|
|
240
|
-
}
|
|
241
|
-
function Qe(t) {
|
|
242
|
-
return q(t).length > 0;
|
|
243
|
-
}
|
|
244
|
-
function Xe(t) {
|
|
245
|
-
let n;
|
|
246
|
-
try {
|
|
247
|
-
n = A(t, { withFileTypes: !0 });
|
|
248
|
-
} catch {
|
|
249
|
-
return [];
|
|
250
|
-
}
|
|
251
|
-
return n.filter((e) => e.isDirectory() && !e.name.startsWith(".") && !N.has(e.name)).filter(
|
|
252
|
-
(e) => k(m(t, e.name, `${e.name}.spec.md`)) || k(m(t, e.name, `${e.name}.1-spec.md`))
|
|
253
|
-
).map((e) => e.name);
|
|
254
|
-
}
|
|
255
|
-
async function Ye(t) {
|
|
256
|
-
const n = ne(t, { task: ["task"], all: ["all"], changed: ["changed"] }), e = n._.filter(
|
|
257
|
-
(i) => typeof i == "string" && i !== "sdd-check"
|
|
258
|
-
);
|
|
259
|
-
let s;
|
|
260
|
-
typeof n.task == "string" ? s = n.task : n.task === !0 && (s = e[0]);
|
|
261
|
-
const r = n.all === !0 || n.all === "true", a = n.changed === !0 || n.changed === "true";
|
|
262
|
-
if (!s && !r && !a) return He();
|
|
263
|
-
const c = [];
|
|
264
|
-
let l = 0;
|
|
265
|
-
if (s) {
|
|
266
|
-
let i;
|
|
267
|
-
try {
|
|
268
|
-
i = S(f(s), "utf-8");
|
|
269
|
-
} catch {
|
|
270
|
-
return Ve(s);
|
|
271
|
-
}
|
|
272
|
-
const u = process.cwd();
|
|
273
|
-
c.push(...H(s, i)), c.push(...W(s, i)), c.push(...Z(s, i)), c.push(...await V(s, i)), c.push(...G(s, i, u)), c.push(...z(s, i, u)), L(f(s)) === "v2" && c.push(...I(s, i)), l = 1;
|
|
274
|
-
} else if (a) {
|
|
275
|
-
const i = f(e[0] ?? ".");
|
|
276
|
-
for (const u of ce(i)) {
|
|
277
|
-
const d = m(i, u);
|
|
278
|
-
let h;
|
|
279
|
-
try {
|
|
280
|
-
h = S(d, "utf-8");
|
|
281
|
-
} catch {
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
c.push(...oe(u, h, re(i, u))), c.push(...ze(u, h, i, f(d))), l++;
|
|
285
|
-
}
|
|
286
|
-
} else {
|
|
287
|
-
const i = f(e[0] ?? "."), u = Ze(i), d = m(i, "specs"), h = m(i, "tasks"), g = [d, h].filter((o) => k(o));
|
|
288
|
-
g.length === 0 && g.push(i);
|
|
289
|
-
const F = m(d, "README.md"), M = [];
|
|
290
|
-
for (const o of g) Y(o, M);
|
|
291
|
-
let D = [];
|
|
292
|
-
if (k(F))
|
|
293
|
-
try {
|
|
294
|
-
D = P(S(F, "utf-8"));
|
|
295
|
-
} catch {
|
|
296
|
-
D = [];
|
|
297
|
-
}
|
|
298
|
-
const w = [], B = [], K = [], T = /* @__PURE__ */ new Map(), b = [];
|
|
299
|
-
for (const o of M) {
|
|
300
|
-
let p;
|
|
301
|
-
try {
|
|
302
|
-
p = S(o, "utf-8");
|
|
303
|
-
} catch {
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
if (p.includes("```mermaid") && b.push({ file: o, content: p }), o === F)
|
|
307
|
-
c.push(
|
|
308
|
-
...ae({
|
|
309
|
-
scopes: ie(p),
|
|
310
|
-
edges: P(p),
|
|
311
|
-
specDirs: Xe(d)
|
|
312
|
-
})
|
|
313
|
-
), l++;
|
|
314
|
-
else if (o.endsWith(".spec.md") || o.endsWith(".1-spec.md")) {
|
|
315
|
-
c.push(...Pe(o, p));
|
|
316
|
-
const C = L(o);
|
|
317
|
-
c.push(...le(o, p, C)), C === "v2" && c.push(...I(o, p)), c.push(...ue(o, p)), c.push(...pe(o, p, D)), K.push({ file: o, content: p, flowVersion: C });
|
|
318
|
-
const y = o.split(_), R = y.lastIndexOf("specs");
|
|
319
|
-
if (R >= 0 && y.length - R >= 4) {
|
|
320
|
-
const $ = y[R + 1], se = m(y.slice(0, R + 2).join(_), `${$}.spec.md`), j = T.get($) ?? { edges: [], scopeFile: se };
|
|
321
|
-
j.edges.push(...de(p)), T.set($, j);
|
|
322
|
-
}
|
|
323
|
-
l++;
|
|
324
|
-
} else if (Qe(p)) {
|
|
325
|
-
const C = E(o, u);
|
|
326
|
-
for (const y of q(p))
|
|
327
|
-
B.push({
|
|
328
|
-
file: o,
|
|
329
|
-
taskId: y.taskId,
|
|
330
|
-
status: y.status,
|
|
331
|
-
flowVersion: C
|
|
332
|
-
});
|
|
333
|
-
l++;
|
|
334
|
-
} else fe(p) ? (c.push(...H(o, p)), c.push(...W(o, p)), c.push(...Z(o, p)), c.push(...G(o, p, u)), c.push(...z(o, p, u)), L(o) === "v2" && c.push(...I(o, p)), w.push(he(o, p, E(o, u))), l++) : me(p) && (c.push(...ge(o)), w.push(ke(o, p, E(o, u))), l++);
|
|
335
|
-
}
|
|
336
|
-
c.push(...Ce(w)), c.push(...ye(w, B)), c.push(...Se(K));
|
|
337
|
-
for (const [o, { edges: p, scopeFile: C }] of T)
|
|
338
|
-
c.push(..._e(o, C, p));
|
|
339
|
-
for (const o of b)
|
|
340
|
-
c.push(...await V(o.file, o.content));
|
|
341
|
-
}
|
|
342
|
-
return te.debug(`[SddCheckCommand#run] ${c.length} finding(s) across ${l} file(s)`), je(c, l);
|
|
343
|
-
}
|
|
344
|
-
const ee = await Ye(process.argv);
|
|
345
|
-
console.log(ee.text);
|
|
346
|
-
process.exit(ee.exitCode);
|