gennady 0.8.2 → 0.8.4
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/README.md +212 -3
- package/ai/agents/agent-resolve-conflicts.xml +148 -3
- package/ai/agents/agent-review-verifier.xml +181 -3
- package/ai/directives/sdd/audit.directive.xml +22 -11
- package/ai/directives/sdd/critic-protocol.xml +3 -0
- package/ai/directives/sdd/critic.directive.xml +25 -3
- package/ai/skills/README.md +150 -0
- package/ai/skills/sdd-check/SKILL.md +19 -9
- package/ai/skills/sdd-execute/scripts/README.md +3 -0
- package/ai/skills/sdd-execute/scripts/_sdd-lib.sh +60 -0
- package/ai/skills/sdd-execute/scripts/check.sh +238 -0
- package/ai/skills/sdd-execute/scripts/sdd +12 -0
- package/ai/skills/sdd-hooks-install/SKILL.md +88 -0
- package/ai/skills/workspace-permission-setup/SKILL.md +193 -0
- package/cli/cmd/README.md +185 -0
- package/dist/ai/agents/agent-resolve-conflicts.xml +148 -3
- package/dist/ai/agents/agent-review-verifier.xml +181 -3
- package/dist/ai/directives/sdd/audit.directive.xml +22 -11
- package/dist/ai/directives/sdd/critic-protocol.xml +3 -0
- package/dist/ai/directives/sdd/critic.directive.xml +25 -3
- package/dist/ai/skills/README.md +150 -0
- package/dist/ai/skills/sdd-check/SKILL.md +19 -9
- package/dist/ai/skills/sdd-execute/scripts/README.md +3 -0
- package/dist/ai/skills/sdd-execute/scripts/_sdd-lib.sh +60 -0
- package/dist/ai/skills/sdd-execute/scripts/check.sh +238 -0
- package/dist/ai/skills/sdd-execute/scripts/sdd +12 -0
- package/dist/ai/skills/sdd-hooks-install/SKILL.md +88 -0
- package/dist/ai/skills/workspace-permission-setup/SKILL.md +193 -0
- package/dist/chunks/index-BHEP1kYv.js +164 -0
- package/dist/chunks/index-DqSFtXFv.js +813 -0
- package/dist/chunks/index-Ukr3nSKB.js +377 -0
- package/dist/cli/cmd/lint/checks/anchor-thin.check.d.ts +11 -0
- package/dist/cli/cmd/lint/lint.cmd.d.ts +1 -1
- package/dist/cli/cmd/lint/lint.types.d.ts +2 -0
- package/dist/gennady.js +4 -4
- package/package.json +1 -1
- package/dist/chunks/index-4fUNp3za.js +0 -156
- package/dist/chunks/index-C9UEDrqg.js +0 -754
- package/dist/chunks/index-jOIhIHdS.js +0 -369
|
@@ -0,0 +1,813 @@
|
|
|
1
|
+
import { execSync as Q } from "node:child_process";
|
|
2
|
+
import { existsSync as K, readFileSync as Y, readdirSync as H, statSync as Z, lstatSync as ee } from "node:fs";
|
|
3
|
+
import { resolve as y, relative as P, extname as F, join as te } from "node:path";
|
|
4
|
+
import { l as C, D as ne, a as se, b as oe, s as ie } from "./services-IgZptnTi.js";
|
|
5
|
+
import { p as re } from "./shared-9J_oXE74.js";
|
|
6
|
+
class w {
|
|
7
|
+
/** @purpose Collected lint errors — empty array when clean. */
|
|
8
|
+
errors;
|
|
9
|
+
/** @purpose Count of errors auto-fixed by DbcContractCheck. */
|
|
10
|
+
autoFixed;
|
|
11
|
+
/** @purpose Deduplicated task file paths resolved from @tasks annotations in linted files. */
|
|
12
|
+
taskPaths;
|
|
13
|
+
/** @purpose Deduplicated spec file paths resolved from task files. */
|
|
14
|
+
specPaths;
|
|
15
|
+
/**
|
|
16
|
+
* @purpose Creates a LintReport with collected errors, autoFixed count, and resolved references.
|
|
17
|
+
* @param errors Collected lint errors.
|
|
18
|
+
* @param [autoFixed] Count of auto-fixed errors, defaults to 0.
|
|
19
|
+
* @param [taskPaths] Resolved task file paths (deduplicated).
|
|
20
|
+
* @param [specPaths] Resolved spec file paths (deduplicated).
|
|
21
|
+
*/
|
|
22
|
+
constructor(t, e = 0, s = [], n = []) {
|
|
23
|
+
this.errors = t, this.autoFixed = e, this.taskPaths = s, this.specPaths = n;
|
|
24
|
+
}
|
|
25
|
+
/** @purpose Returns 0 when no errors, 1 otherwise — ESLint convention. | @returns 0 for clean, 1 for errors. */
|
|
26
|
+
get exitCode() {
|
|
27
|
+
return this.errors.length > 0 ? 1 : 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @purpose Formats errors in ESLint-compatible output with resolved task/spec references.
|
|
31
|
+
* @returns ESLint-compatible formatted string with References block.
|
|
32
|
+
*/
|
|
33
|
+
format() {
|
|
34
|
+
const t = [];
|
|
35
|
+
if (this.autoFixed > 0 && t.push(`Auto-fixed: ${this.autoFixed} error(s)`), this.errors.length > 0 && t.push(
|
|
36
|
+
...this.errors.map(
|
|
37
|
+
(e) => `${e.file}:${e.line}:${e.col}: ${e.severity}: ${e.code}: ${e.message}`
|
|
38
|
+
)
|
|
39
|
+
), this.errors.length > 0 && (this.specPaths.length > 0 || this.taskPaths.length > 0)) {
|
|
40
|
+
t.push(""), t.push("---"), t.push("Relevant specs & tasks for errors above:");
|
|
41
|
+
for (const e of this.specPaths)
|
|
42
|
+
t.push(` ${e}`);
|
|
43
|
+
for (const e of this.taskPaths)
|
|
44
|
+
t.push(` ${e}`);
|
|
45
|
+
}
|
|
46
|
+
return t.join(`
|
|
47
|
+
`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const W = "ERR_CLI_LINT_MISSING_FILE", U = "ERR_CLI_LINT_MISSING_CONSUMERS", ce = "ERR_CLI_LINT_ANCHOR_UNPAIRED_START", le = "ERR_CLI_LINT_ANCHOR_UNPAIRED_END", ae = "ERR_CLI_LINT_ANCHOR_NESTING", O = "ERR_CLI_LINT_ANCHOR_MALFORMED", B = "ERR_CLI_LINT_NON_ENGLISH", fe = "ERR_CLI_LINT_RESOLVE_FAILED", ue = "ERR_CLI_LINT_STAGED_CONFLICT", he = "ERR_CLI_LINT_UNAUTHORIZED_DISABLE", de = "ERR_CLI_LINT_DISABLE_MISSING_PURPOSE", $ = "ERR_CLI_LINT_TOO_MANY_INVARIANTS", ge = "ERR_CLI_LINT_ANCHOR_AT_CLASS_BODY", me = "ERR_CLI_LINT_ANCHOR_CONSECUTIVE_START", _e = "ERR_CLI_LINT_ANCHOR_TOO_THIN";
|
|
51
|
+
function pe(o, t) {
|
|
52
|
+
const e = [];
|
|
53
|
+
if (o.length === 0)
|
|
54
|
+
return e.push({
|
|
55
|
+
file: t,
|
|
56
|
+
line: 1,
|
|
57
|
+
col: 1,
|
|
58
|
+
severity: "error",
|
|
59
|
+
code: W,
|
|
60
|
+
message: "[FileHeaderCheck#check] Missing // @file: directive"
|
|
61
|
+
}), e.push({
|
|
62
|
+
file: t,
|
|
63
|
+
line: 1,
|
|
64
|
+
col: 1,
|
|
65
|
+
severity: "error",
|
|
66
|
+
code: U,
|
|
67
|
+
message: "[FileHeaderCheck#check] Missing // @consumers: directive"
|
|
68
|
+
}), e;
|
|
69
|
+
const s = o.split(`
|
|
70
|
+
`);
|
|
71
|
+
let n = !1, i = !1;
|
|
72
|
+
for (const r of s) {
|
|
73
|
+
const c = r.trim();
|
|
74
|
+
if (c.startsWith("import ") || (c.startsWith("// @file:") && (n = !0), c.startsWith("// @consumers:") && (i = !0), n && i))
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
return n || e.push({
|
|
78
|
+
file: t,
|
|
79
|
+
line: 1,
|
|
80
|
+
col: 1,
|
|
81
|
+
severity: "error",
|
|
82
|
+
code: W,
|
|
83
|
+
message: "[FileHeaderCheck#check] Missing // @file: directive"
|
|
84
|
+
}), i || e.push({
|
|
85
|
+
file: t,
|
|
86
|
+
line: 1,
|
|
87
|
+
col: 1,
|
|
88
|
+
severity: "error",
|
|
89
|
+
code: U,
|
|
90
|
+
message: "[FileHeaderCheck#check] Missing // @consumers: directive"
|
|
91
|
+
}), e;
|
|
92
|
+
}
|
|
93
|
+
function k(o) {
|
|
94
|
+
let t = "", e = 0, s = !1, n = !1, i = !1;
|
|
95
|
+
for (; e < o.length; ) {
|
|
96
|
+
const r = o[e], c = o[e + 1] ?? "";
|
|
97
|
+
if (!s && !n && !i) {
|
|
98
|
+
if (r === "/" && c === "/") break;
|
|
99
|
+
if (r === "/" && c === "*") {
|
|
100
|
+
for (e += 2; e < o.length - 1 && !(o[e] === "*" && o[e + 1] === "/"); ) e++;
|
|
101
|
+
e += 2;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (r === "\\") {
|
|
106
|
+
e += 2;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (!n && !i && r === "'") {
|
|
110
|
+
s = !s, e++;
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
if (!s && !i && r === '"') {
|
|
114
|
+
n = !n, e++;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!s && !n && r === "`") {
|
|
118
|
+
i = !i, e++;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
!s && !n && !i && (t += r), e++;
|
|
122
|
+
}
|
|
123
|
+
return t;
|
|
124
|
+
}
|
|
125
|
+
const Re = /\/\/ #(region|endregion)\s+(START|END)_([A-Z0-9_]+)/, Ce = /\/\/ #(region|endregion)\s*$/;
|
|
126
|
+
function Ie(o, t) {
|
|
127
|
+
const e = o.split(`
|
|
128
|
+
`), s = [], n = [];
|
|
129
|
+
let i = 0;
|
|
130
|
+
const r = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
131
|
+
for (let l = 0; l < e.length; l++) {
|
|
132
|
+
const a = e[l], u = a.match(Re);
|
|
133
|
+
if (i = Te(a, i), u) {
|
|
134
|
+
const h = u[2], g = u[3], f = l + 1, R = u.index ?? 0, E = a.indexOf(h, R), p = (E >= 0 ? E : R) + 1;
|
|
135
|
+
if (h === "START") {
|
|
136
|
+
const I = r.get(i), N = c.get(i) ?? !1;
|
|
137
|
+
I && Ee(n, I) && !N && s.push({
|
|
138
|
+
file: t,
|
|
139
|
+
line: f,
|
|
140
|
+
col: p,
|
|
141
|
+
severity: "error",
|
|
142
|
+
code: me,
|
|
143
|
+
message: `START_${g} immediately follows START_${I.name} at the same level — merge regions or close START_${I.name} first`
|
|
144
|
+
}), n.push({ name: g, line: f, col: p }), r.set(i, { name: g, line: f, col: p }), c.set(i, !1);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
const S = Le(n, (I) => I.name === g);
|
|
148
|
+
if (S === -1)
|
|
149
|
+
s.push({
|
|
150
|
+
file: t,
|
|
151
|
+
line: f,
|
|
152
|
+
col: p,
|
|
153
|
+
severity: "error",
|
|
154
|
+
code: le,
|
|
155
|
+
message: `END_${g} without matching START_${g} — add the missing opening anchor or remove this closing one`
|
|
156
|
+
});
|
|
157
|
+
else {
|
|
158
|
+
for (let I = n.length - 1; I > S; I--) {
|
|
159
|
+
const N = n[I];
|
|
160
|
+
s.push({
|
|
161
|
+
file: t,
|
|
162
|
+
line: f,
|
|
163
|
+
col: p,
|
|
164
|
+
severity: "error",
|
|
165
|
+
code: ae,
|
|
166
|
+
message: `END_${g} closes parent while START_${N.name} at line ${N.line} is still open — close inner block first`
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
n.length = S, r.delete(i), c.set(i, !1);
|
|
170
|
+
}
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
Ne(a) && c.set(i, !0);
|
|
174
|
+
const _ = a.match(Ce);
|
|
175
|
+
if (_) {
|
|
176
|
+
const h = l + 1, g = (_.index ?? 0) + 1;
|
|
177
|
+
if (_[1] === "endregion")
|
|
178
|
+
if (n.length > 0) {
|
|
179
|
+
const f = n[n.length - 1];
|
|
180
|
+
s.push({
|
|
181
|
+
file: t,
|
|
182
|
+
line: h,
|
|
183
|
+
col: g,
|
|
184
|
+
severity: "error",
|
|
185
|
+
code: O,
|
|
186
|
+
message: `#endregion without END_<NAME> — expected END_${f.name} (auto-closed by stack top START_${f.name} at line ${f.line})`
|
|
187
|
+
}), n.pop(), r.delete(i), c.set(i, !1);
|
|
188
|
+
} else
|
|
189
|
+
s.push({
|
|
190
|
+
file: t,
|
|
191
|
+
line: h,
|
|
192
|
+
col: g,
|
|
193
|
+
severity: "error",
|
|
194
|
+
code: O,
|
|
195
|
+
message: "#endregion without END_<NAME> — no open block to close"
|
|
196
|
+
});
|
|
197
|
+
else
|
|
198
|
+
s.push({
|
|
199
|
+
file: t,
|
|
200
|
+
line: h,
|
|
201
|
+
col: g,
|
|
202
|
+
severity: "error",
|
|
203
|
+
code: O,
|
|
204
|
+
message: "#region without START_<NAME> — add START_ prefix with a block name"
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
for (const l of n)
|
|
209
|
+
s.push({
|
|
210
|
+
file: t,
|
|
211
|
+
line: l.line,
|
|
212
|
+
col: l.col,
|
|
213
|
+
severity: "error",
|
|
214
|
+
code: ce,
|
|
215
|
+
message: `START_${l.name} without matching END_${l.name} — add the missing closing anchor`
|
|
216
|
+
});
|
|
217
|
+
return s.sort((l, a) => l.line - a.line || l.col - a.col), s;
|
|
218
|
+
}
|
|
219
|
+
function Le(o, t) {
|
|
220
|
+
for (let e = o.length - 1; e >= 0; e--)
|
|
221
|
+
if (t(o[e])) return e;
|
|
222
|
+
return -1;
|
|
223
|
+
}
|
|
224
|
+
function Te(o, t) {
|
|
225
|
+
let e = t;
|
|
226
|
+
const s = k(o);
|
|
227
|
+
for (const n of s)
|
|
228
|
+
n === "{" ? e++ : n === "}" && e--;
|
|
229
|
+
return e;
|
|
230
|
+
}
|
|
231
|
+
function Ee(o, t) {
|
|
232
|
+
return o.some(
|
|
233
|
+
(e) => e.name === t.name && e.line === t.line && e.col === t.col
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
function Ne(o) {
|
|
237
|
+
const t = o.trim();
|
|
238
|
+
return !(t === "" || t.startsWith("//") || t.startsWith("/*") && t.endsWith("*/"));
|
|
239
|
+
}
|
|
240
|
+
async function Se(o, t, e) {
|
|
241
|
+
C.debug(`[DbcContractCheck#check] [idle → creating] ${t}`);
|
|
242
|
+
const s = new se(), n = new oe(), i = new ne(s, n);
|
|
243
|
+
try {
|
|
244
|
+
if (!e) {
|
|
245
|
+
const c = await i.lint(t, { content: o });
|
|
246
|
+
return C.info(
|
|
247
|
+
`[DbcContractCheck#check] [creating → linted] ${t} (${c.errors.length} errors)`
|
|
248
|
+
), { errors: c.errors.map(G), autoFixed: 0 };
|
|
249
|
+
}
|
|
250
|
+
const r = await i.lintAndFix(t, { content: o });
|
|
251
|
+
return C.info(
|
|
252
|
+
`[DbcContractCheck#check] [creating → fixed] ${t} (autoFixed=${r.autoFixed}, remaining=${r.errors.length})`
|
|
253
|
+
), {
|
|
254
|
+
errors: r.errors.map(G),
|
|
255
|
+
autoFixed: r.autoFixed
|
|
256
|
+
};
|
|
257
|
+
} catch (r) {
|
|
258
|
+
const c = new Error(`[DbcContractCheck#check] Lint failed for ${t}`, { cause: r });
|
|
259
|
+
throw C.error(`[DbcContractCheck#check] [creating → failed] ${t}`, { error: c }), c;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
function G(o) {
|
|
263
|
+
return {
|
|
264
|
+
file: o.file,
|
|
265
|
+
line: o.line,
|
|
266
|
+
col: o.col,
|
|
267
|
+
severity: "error",
|
|
268
|
+
code: o.code,
|
|
269
|
+
message: o.message
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
const j = 8, ye = /@ts-ignore|@ts-nocheck|@ts-expect-error|eslint-disable(?:-next-line|-line)?(?:-[a-z-]+)?\b/, Ae = /\bd-\d+\b/i;
|
|
273
|
+
function xe(o) {
|
|
274
|
+
let t = !1, e = !1, s = !1;
|
|
275
|
+
for (let n = 0; n < o.length - 1; n++) {
|
|
276
|
+
const i = o[n], r = n > 0 ? o[n - 1] : "";
|
|
277
|
+
if (!t && !e && !s) {
|
|
278
|
+
if (i === "/" && (o[n + 1] === "/" || o[n + 1] === "*")) return n;
|
|
279
|
+
i === "'" ? t = !0 : i === '"' ? e = !0 : i === "`" && (s = !0);
|
|
280
|
+
} else r !== "\\" && (t && i === "'" ? t = !1 : e && i === '"' ? e = !1 : s && i === "`" && (s = !1));
|
|
281
|
+
}
|
|
282
|
+
return -1;
|
|
283
|
+
}
|
|
284
|
+
function $e(o, t) {
|
|
285
|
+
const e = o.split(`
|
|
286
|
+
`), s = [];
|
|
287
|
+
for (let n = 0; n < e.length; n++) {
|
|
288
|
+
const i = e[n], r = xe(i);
|
|
289
|
+
if (r < 0) continue;
|
|
290
|
+
const c = i.slice(r), l = ye.exec(c);
|
|
291
|
+
if (!l) continue;
|
|
292
|
+
const a = l[0], u = r + l.index + 1, _ = Ae.exec(i);
|
|
293
|
+
if (!_) {
|
|
294
|
+
s.push({
|
|
295
|
+
file: t,
|
|
296
|
+
line: n + 1,
|
|
297
|
+
col: u,
|
|
298
|
+
severity: "error",
|
|
299
|
+
code: he,
|
|
300
|
+
message: `Unauthorized disable: \`${a}\` has no Decision Log reference. Add \`D-NNN\` (e.g., \`D-042\`) in the same comment line pointing to a Decision Log entry that authorizes this disable. Policy: see specs/cli/cli.spec.md#d-007.`
|
|
301
|
+
});
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
const h = ve(c, a, _[0]);
|
|
305
|
+
h < j && s.push({
|
|
306
|
+
file: t,
|
|
307
|
+
line: n + 1,
|
|
308
|
+
col: u,
|
|
309
|
+
severity: "error",
|
|
310
|
+
code: de,
|
|
311
|
+
message: `Disable lacks purpose: \`${a}\` cites \`${_[0]}\` but the explanation is too short (${h} non-whitespace chars; need ≥ ${j}). Add a purpose after the D-NNN reference, e.g., \`${a}: ${_[0]} — <why this disable is necessary>\`. Policy: see specs/cli/cli.spec.md#d-007.`
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
return s;
|
|
315
|
+
}
|
|
316
|
+
function ve(o, t, e) {
|
|
317
|
+
let s = o.replace(t, "");
|
|
318
|
+
return s = s.replace(e, ""), s = s.replace(/\*\//g, ""), s = s.replace(/^\/\/|^\/\*/g, ""), s.replace(/\s/g, "").length;
|
|
319
|
+
}
|
|
320
|
+
const J = new RegExp("\\p{Script=Cyrillic}", "u");
|
|
321
|
+
function ke(o, t) {
|
|
322
|
+
const e = [], s = o.split(`
|
|
323
|
+
`), n = De(s);
|
|
324
|
+
for (let i = 0; i < s.length; i++) {
|
|
325
|
+
const r = s[i], c = i + 1, l = r.trim();
|
|
326
|
+
if (l.startsWith("// @file:") || l.startsWith("// @consumers:")) {
|
|
327
|
+
const a = [...r];
|
|
328
|
+
for (let u = 0; u < a.length; u++)
|
|
329
|
+
J.test(a[u]) && e.push({
|
|
330
|
+
file: t,
|
|
331
|
+
line: c,
|
|
332
|
+
col: u + 1,
|
|
333
|
+
severity: "error",
|
|
334
|
+
code: B,
|
|
335
|
+
message: `[LanguageCheck#check] Cyrillic character '${a[u]}' in file header — use English only`
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
if (n.has(i)) {
|
|
339
|
+
const a = [...r];
|
|
340
|
+
for (let u = 0; u < a.length; u++)
|
|
341
|
+
if (J.test(a[u])) {
|
|
342
|
+
e.push({
|
|
343
|
+
file: t,
|
|
344
|
+
line: c,
|
|
345
|
+
col: u + 1,
|
|
346
|
+
severity: "error",
|
|
347
|
+
code: B,
|
|
348
|
+
message: `[LanguageCheck#check] Cyrillic character '${a[u]}' in JSDoc contract — use English only`
|
|
349
|
+
});
|
|
350
|
+
break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return e;
|
|
355
|
+
}
|
|
356
|
+
function De(o) {
|
|
357
|
+
const t = /* @__PURE__ */ new Set();
|
|
358
|
+
let e = !1;
|
|
359
|
+
for (let s = 0; s < o.length; s++) {
|
|
360
|
+
const n = o[s].trim();
|
|
361
|
+
if (n.startsWith("/**")) {
|
|
362
|
+
e = !0, t.add(s), n.endsWith("*/") && (e = !1);
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
e && (t.add(s), n.includes("*/") && (e = !1));
|
|
366
|
+
}
|
|
367
|
+
return t;
|
|
368
|
+
}
|
|
369
|
+
const be = /^\s*export\s+(?:(?:default\s+)?(?:function|class|abstract\s+class|interface))\s+(\w+)/, we = /^\s*(?:function|class|abstract\s+class|interface)\s+(\w+)/, Oe = /\/\/\s*#region\s+START_\w+.*\binvariant\s*:/;
|
|
370
|
+
function Fe(o, t, e) {
|
|
371
|
+
const s = o.split(`
|
|
372
|
+
`), n = [];
|
|
373
|
+
let i = 0;
|
|
374
|
+
const r = [];
|
|
375
|
+
let c = null, l = !1, a = "", u = 0, _ = 0, h = !1, g = [];
|
|
376
|
+
for (let f = 0; f < s.length; f++) {
|
|
377
|
+
const R = s[f], E = f + 1, p = R.trim();
|
|
378
|
+
if (p.startsWith("/**"))
|
|
379
|
+
if (p.includes("*/") && p.length > 3) {
|
|
380
|
+
const m = V(p);
|
|
381
|
+
g = [];
|
|
382
|
+
for (let L = 0; L < m; L++) g.push(E);
|
|
383
|
+
} else {
|
|
384
|
+
h = !0, g = [];
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
if (h) {
|
|
388
|
+
if (p.includes("*/")) {
|
|
389
|
+
h = !1;
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
const m = V(p);
|
|
393
|
+
for (let L = 0; L < m; L++) g.push(E);
|
|
394
|
+
continue;
|
|
395
|
+
}
|
|
396
|
+
const S = R.match(be), I = p.includes("*/") ? p.slice(p.lastIndexOf("*/") + 2) : null, N = I ? I.match(
|
|
397
|
+
/^\s*export\s+(?:(?:default\s+)?(?:function|class|abstract\s+class|interface))\s+(\w+)/
|
|
398
|
+
) : null, A = S || N, d = N ? p.lastIndexOf("*/") + 2 : 0;
|
|
399
|
+
if (A) {
|
|
400
|
+
l = !0, a = A[1], u = E;
|
|
401
|
+
const m = (A.index ?? 0) + d, L = R.indexOf(a, m);
|
|
402
|
+
_ = (L >= 0 ? L : m) + 1;
|
|
403
|
+
} else g.length > 0 && we.test(R) && (g = []);
|
|
404
|
+
const T = k(R);
|
|
405
|
+
for (const m of T)
|
|
406
|
+
if (m === "{") {
|
|
407
|
+
if (i++, l) {
|
|
408
|
+
const L = {
|
|
409
|
+
name: a,
|
|
410
|
+
nameLine: u,
|
|
411
|
+
nameCol: _,
|
|
412
|
+
bodyDepth: i,
|
|
413
|
+
jsdocCount: g.length,
|
|
414
|
+
regionCount: 0
|
|
415
|
+
};
|
|
416
|
+
r.push(L), c = L, l = !1, g = [];
|
|
417
|
+
}
|
|
418
|
+
} else m === "}" && (c && i === c.bodyDepth && (c.jsdocCount > e && n.push({
|
|
419
|
+
file: t,
|
|
420
|
+
line: c.nameLine,
|
|
421
|
+
col: c.nameCol,
|
|
422
|
+
severity: "error",
|
|
423
|
+
code: $,
|
|
424
|
+
message: `Entity "${c.name}" has ${c.jsdocCount} JSDoc @invariant tags (max ${e}) — consider reviewing the contract; too many invariants suggest the entity is overloaded`
|
|
425
|
+
}), c.regionCount > e && n.push({
|
|
426
|
+
file: t,
|
|
427
|
+
line: c.nameLine,
|
|
428
|
+
col: c.nameCol,
|
|
429
|
+
severity: "error",
|
|
430
|
+
code: $,
|
|
431
|
+
message: `Entity "${c.name}" has ${c.regionCount} region invariants (max ${e}) — consider reviewing the contract; too many region invariants suggest the entity is overloaded`
|
|
432
|
+
}), r.pop(), c = r.length > 0 ? r[r.length - 1] : null), i--);
|
|
433
|
+
c && Oe.test(R) && c.regionCount++;
|
|
434
|
+
}
|
|
435
|
+
for (const f of r)
|
|
436
|
+
f.jsdocCount > e && n.push({
|
|
437
|
+
file: t,
|
|
438
|
+
line: f.nameLine,
|
|
439
|
+
col: f.nameCol,
|
|
440
|
+
severity: "error",
|
|
441
|
+
code: $,
|
|
442
|
+
message: `Entity "${f.name}" has ${f.jsdocCount} JSDoc @invariant tags (max ${e}) — consider reviewing the contract; too many invariants suggest the entity is overloaded`
|
|
443
|
+
}), f.regionCount > e && n.push({
|
|
444
|
+
file: t,
|
|
445
|
+
line: f.nameLine,
|
|
446
|
+
col: f.nameCol,
|
|
447
|
+
severity: "error",
|
|
448
|
+
code: $,
|
|
449
|
+
message: `Entity "${f.name}" has ${f.regionCount} region invariants (max ${e}) — consider reviewing the contract; too many region invariants suggest the entity is overloaded`
|
|
450
|
+
});
|
|
451
|
+
return n.sort((f, R) => f.line - R.line || f.col - R.col), n;
|
|
452
|
+
}
|
|
453
|
+
function V(o) {
|
|
454
|
+
const t = o.match(/@invariant\b/g);
|
|
455
|
+
return t ? t.length : 0;
|
|
456
|
+
}
|
|
457
|
+
const Me = /\/\/ #(region|endregion)\s+(START|END)_([A-Z0-9_]+)/;
|
|
458
|
+
function He(o, t) {
|
|
459
|
+
const e = o.split(`
|
|
460
|
+
`), s = [];
|
|
461
|
+
let n = 0;
|
|
462
|
+
const i = [];
|
|
463
|
+
let r = !1;
|
|
464
|
+
for (let c = 0; c < e.length; c++) {
|
|
465
|
+
const l = e[c], a = c + 1;
|
|
466
|
+
/\b(?:class|namespace)\s+\w/.test(k(l)) && (r = !0);
|
|
467
|
+
const u = k(l);
|
|
468
|
+
for (const h of u)
|
|
469
|
+
h === "{" ? (n++, r && (i.push(n), r = !1)) : h === "}" && (i.length > 0 && n === i[i.length - 1] && i.pop(), n--);
|
|
470
|
+
const _ = l.match(Me);
|
|
471
|
+
if (_ && i.length > 0 && n === i[i.length - 1]) {
|
|
472
|
+
const h = _[3], f = _[2] === "START" ? "START" : "END", E = (_.index ?? 0) + 1;
|
|
473
|
+
s.push({
|
|
474
|
+
file: t,
|
|
475
|
+
line: a,
|
|
476
|
+
col: E,
|
|
477
|
+
severity: "error",
|
|
478
|
+
code: ge,
|
|
479
|
+
message: `#region ${f}_${h} at class body level — regions must not separate class members; move inside a method body or remove`
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return s.sort((c, l) => c.line - l.line || c.col - l.col), s;
|
|
484
|
+
}
|
|
485
|
+
const X = /\/\/ #(region|endregion)\s+(START|END)_([A-Z0-9_]+)/, z = 2;
|
|
486
|
+
function Pe(o, t) {
|
|
487
|
+
const e = o.split(`
|
|
488
|
+
`), s = [], n = [];
|
|
489
|
+
for (let i = 0; i < e.length; i++) {
|
|
490
|
+
const r = e[i], c = r.match(X);
|
|
491
|
+
if (c && c[2] === "START") {
|
|
492
|
+
const l = c[3], a = c.index ?? 0, u = r.indexOf("START", a), _ = (u >= 0 ? u : a) + 1, g = r.slice(a + c[0].length).trim().length > 0;
|
|
493
|
+
n.push({
|
|
494
|
+
name: l,
|
|
495
|
+
startLine: i + 1,
|
|
496
|
+
col: _,
|
|
497
|
+
meaningfulCount: 0,
|
|
498
|
+
hasStartAnnotation: g,
|
|
499
|
+
hasBodyComment: !1
|
|
500
|
+
});
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
if (c && c[2] === "END") {
|
|
504
|
+
const l = c[3], a = Ue(n, (u) => u.name === l);
|
|
505
|
+
if (a !== -1) {
|
|
506
|
+
const u = n[a];
|
|
507
|
+
u.meaningfulCount < z && s.push(We(t, u)), n.length = a;
|
|
508
|
+
}
|
|
509
|
+
continue;
|
|
510
|
+
}
|
|
511
|
+
if (n.length !== 0)
|
|
512
|
+
if (Be(r))
|
|
513
|
+
for (const l of n)
|
|
514
|
+
l.meaningfulCount++;
|
|
515
|
+
else Ge(r) && (n[n.length - 1].hasBodyComment = !0);
|
|
516
|
+
}
|
|
517
|
+
return s.sort((i, r) => i.line - r.line || i.col - r.col), s;
|
|
518
|
+
}
|
|
519
|
+
function We(o, t) {
|
|
520
|
+
const { name: e, startLine: s, col: n, meaningfulCount: i, hasStartAnnotation: r, hasBodyComment: c } = t;
|
|
521
|
+
let l;
|
|
522
|
+
return i === 0 && (r || c) ? l = `START_${e} wraps only comments — keep the comment(s) and remove the region wrapper` : i === 0 ? l = `START_${e} is empty (0 meaningful lines) — remove the empty region` : r ? l = `START_${e} has only ${i} meaningful line(s) + annotation — keep the annotation as a plain comment and remove the region wrapper` : l = `START_${e} has only ${i} meaningful line(s) — regions need at least ${z} lines of code; consider removing the region`, {
|
|
523
|
+
file: o,
|
|
524
|
+
line: s,
|
|
525
|
+
col: n,
|
|
526
|
+
severity: "error",
|
|
527
|
+
code: _e,
|
|
528
|
+
message: l
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function Ue(o, t) {
|
|
532
|
+
for (let e = o.length - 1; e >= 0; e--)
|
|
533
|
+
if (t(o[e])) return e;
|
|
534
|
+
return -1;
|
|
535
|
+
}
|
|
536
|
+
function Be(o) {
|
|
537
|
+
const t = o.trim();
|
|
538
|
+
return !(t === "" || t.startsWith("//") || t.startsWith("/*") && t.endsWith("*/"));
|
|
539
|
+
}
|
|
540
|
+
function Ge(o) {
|
|
541
|
+
const t = o.trim();
|
|
542
|
+
return t.startsWith("//") ? !X.test(t) : !1;
|
|
543
|
+
}
|
|
544
|
+
function je(o, t = "tasks") {
|
|
545
|
+
const e = /* @__PURE__ */ new Map(), s = y(o, t);
|
|
546
|
+
if (!K(s))
|
|
547
|
+
return e;
|
|
548
|
+
const n = Ke(s);
|
|
549
|
+
for (const i of n) {
|
|
550
|
+
let r;
|
|
551
|
+
try {
|
|
552
|
+
r = Y(i, "utf-8");
|
|
553
|
+
} catch {
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
const c = r.match(/-\s+\*\*Task-ID:\*\*\s+(TSK-\d+)/);
|
|
557
|
+
if (!c) continue;
|
|
558
|
+
const l = c[1], a = P(o, i), u = Je(r, o);
|
|
559
|
+
e.set(l, { taskPath: a, specPaths: u });
|
|
560
|
+
}
|
|
561
|
+
return e;
|
|
562
|
+
}
|
|
563
|
+
function Je(o, t) {
|
|
564
|
+
const e = /* @__PURE__ */ new Set(), s = o.match(/\*\*Spec References:\*\*[\s\S]*?(?=\n- \*\*|$)/);
|
|
565
|
+
if (!s) return [];
|
|
566
|
+
const n = s[0], i = /\[([^\]]*)\]\(([^)]+\.md)[^)]*\)/g;
|
|
567
|
+
let r;
|
|
568
|
+
for (; (r = i.exec(n)) !== null; ) {
|
|
569
|
+
const c = r[2].split("/").pop();
|
|
570
|
+
if (!c) continue;
|
|
571
|
+
const l = Ve(y(t, "specs"), c);
|
|
572
|
+
if (l) {
|
|
573
|
+
const a = P(t, l);
|
|
574
|
+
a.startsWith("..") || e.add(a);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
return [...e].sort();
|
|
578
|
+
}
|
|
579
|
+
function Ve(o, t) {
|
|
580
|
+
if (!K(o)) return null;
|
|
581
|
+
const e = [o];
|
|
582
|
+
for (; e.length > 0; ) {
|
|
583
|
+
const s = e.pop();
|
|
584
|
+
let n;
|
|
585
|
+
try {
|
|
586
|
+
n = H(s);
|
|
587
|
+
} catch {
|
|
588
|
+
continue;
|
|
589
|
+
}
|
|
590
|
+
for (const i of n) {
|
|
591
|
+
const r = y(s, i);
|
|
592
|
+
try {
|
|
593
|
+
const c = Z(r);
|
|
594
|
+
if (c.isDirectory())
|
|
595
|
+
e.push(r);
|
|
596
|
+
else if (c.isFile() && i === t)
|
|
597
|
+
return r;
|
|
598
|
+
} catch {
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
function Ke(o) {
|
|
605
|
+
const t = [], e = [o];
|
|
606
|
+
for (; e.length > 0; ) {
|
|
607
|
+
const s = e.pop();
|
|
608
|
+
let n;
|
|
609
|
+
try {
|
|
610
|
+
n = H(s);
|
|
611
|
+
} catch {
|
|
612
|
+
continue;
|
|
613
|
+
}
|
|
614
|
+
for (const i of n) {
|
|
615
|
+
const r = y(s, i);
|
|
616
|
+
try {
|
|
617
|
+
const c = Z(r);
|
|
618
|
+
c.isDirectory() ? e.push(r) : c.isFile() && i.endsWith(".md") && t.push(r);
|
|
619
|
+
} catch {
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
return t;
|
|
624
|
+
}
|
|
625
|
+
function Ye(o) {
|
|
626
|
+
const t = o.match(/@tasks:\s*(.+)/m);
|
|
627
|
+
return t ? t[1].split(/[,;\s]+/).map((e) => e.trim()).filter((e) => /^TSK-\d+$/.test(e)) : [];
|
|
628
|
+
}
|
|
629
|
+
function Ze(o, t) {
|
|
630
|
+
const e = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set();
|
|
631
|
+
for (const n of o) {
|
|
632
|
+
const i = t.get(n);
|
|
633
|
+
if (i) {
|
|
634
|
+
e.add(i.taskPath);
|
|
635
|
+
for (const r of i.specPaths)
|
|
636
|
+
s.add(r);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
return {
|
|
640
|
+
taskPaths: [...e].sort(),
|
|
641
|
+
specPaths: [...s].sort()
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function Xe(o) {
|
|
645
|
+
let t = "", e = 0;
|
|
646
|
+
for (; e < o.length; ) {
|
|
647
|
+
const s = o[e], n = o[e + 1];
|
|
648
|
+
if (s === "*" && n === "*")
|
|
649
|
+
o[e + 2] === "/" ? (t += "(?:.*\\/)?", e += 3) : (e + 2 >= o.length, t += ".*", e += 2);
|
|
650
|
+
else if (s === "*")
|
|
651
|
+
t += "[^/]*", e++;
|
|
652
|
+
else if (s === "?")
|
|
653
|
+
t += "[^/]", e++;
|
|
654
|
+
else if (s === ".")
|
|
655
|
+
t += "\\.", e++;
|
|
656
|
+
else if (s === "[") {
|
|
657
|
+
const i = o.indexOf("]", e);
|
|
658
|
+
i !== -1 ? (t += o.slice(e, i + 1), e = i + 1) : (t += "\\[", e++);
|
|
659
|
+
} else
|
|
660
|
+
t += ze(s), e++;
|
|
661
|
+
}
|
|
662
|
+
return new RegExp("^" + t + "$");
|
|
663
|
+
}
|
|
664
|
+
function ze(o) {
|
|
665
|
+
return "^$\\+*.?{}[]()|/".includes(o) ? "\\" + o : o;
|
|
666
|
+
}
|
|
667
|
+
async function qe(o) {
|
|
668
|
+
const t = re(o, {
|
|
669
|
+
autofix: ["autofix"],
|
|
670
|
+
staged: ["staged"],
|
|
671
|
+
verbose: ["verbose", "v"],
|
|
672
|
+
maxInvariants: ["max-invariants"],
|
|
673
|
+
exclude: ["exclude"]
|
|
674
|
+
}), e = t._.filter(
|
|
675
|
+
(d) => typeof d == "string" && d !== "lint"
|
|
676
|
+
), s = t.autofix === !0 || t.autofix === "true", n = t.staged === !0 || t.staged === "true", i = t.verbose === !0 || t.verbose === "true", r = typeof t.maxInvariants == "string" ? parseInt(t.maxInvariants, 10) : 3, c = [
|
|
677
|
+
"**/node_modules/**",
|
|
678
|
+
"**/__tests__/**",
|
|
679
|
+
"**/fixtures/**",
|
|
680
|
+
"**/__tests__/fixtures/**",
|
|
681
|
+
"**/dist/**",
|
|
682
|
+
"**/coverage/**",
|
|
683
|
+
"**/build/**",
|
|
684
|
+
"**/out/**"
|
|
685
|
+
], l = t.exclude, a = Array.isArray(l) ? l : typeof l == "string" ? [l] : [], _ = [...c, ...a].map(Xe);
|
|
686
|
+
i && ie("debug");
|
|
687
|
+
let h;
|
|
688
|
+
const g = [];
|
|
689
|
+
if (n) {
|
|
690
|
+
if (e.length > 0) {
|
|
691
|
+
const d = {
|
|
692
|
+
file: "",
|
|
693
|
+
line: 0,
|
|
694
|
+
col: 0,
|
|
695
|
+
severity: "error",
|
|
696
|
+
code: ue,
|
|
697
|
+
message: "--staged and positional targets are mutually exclusive. Use either --staged or provide file/directory paths, not both."
|
|
698
|
+
};
|
|
699
|
+
return C.warn("[LintCommand#run] --staged and positional targets are mutually exclusive"), new w([d]);
|
|
700
|
+
}
|
|
701
|
+
C.debug("[LintCommand#run] [idle → collecting] staged mode");
|
|
702
|
+
try {
|
|
703
|
+
h = Q("git diff --staged --name-only", { encoding: "utf-8" }).trim().split(`
|
|
704
|
+
`).filter(Boolean).filter((T) => T.endsWith(".ts")), h = [...new Set(h)];
|
|
705
|
+
} catch (d) {
|
|
706
|
+
const T = new Error("[LintCommand#run] Git scan failed — not a git repository?", {
|
|
707
|
+
cause: d
|
|
708
|
+
});
|
|
709
|
+
throw C.error("[LintCommand#run] [collecting → failed]", { error: T }), T;
|
|
710
|
+
}
|
|
711
|
+
} else if (e.length > 0) {
|
|
712
|
+
C.debug(`[LintCommand#run] [idle → resolving] ${e.length} target(s)`);
|
|
713
|
+
const d = et(e);
|
|
714
|
+
h = d.files, g.push(...d.errors);
|
|
715
|
+
for (const T of d.errors)
|
|
716
|
+
C.warn(`[LintCommand#run] [resolving → failed] ${T.file}: ${T.message}`);
|
|
717
|
+
} else
|
|
718
|
+
h = [];
|
|
719
|
+
if (h.length > 0 && _.length > 0) {
|
|
720
|
+
const d = h.length, T = y(".");
|
|
721
|
+
h = h.filter((m) => {
|
|
722
|
+
const L = m.startsWith("/") ? P(T, m) : m;
|
|
723
|
+
return !_.some((x) => x.test(L));
|
|
724
|
+
}), C.debug(`[LintCommand#run] [filtering → filtered] ${d} → ${h.length} file(s)`);
|
|
725
|
+
}
|
|
726
|
+
if (h.length === 0)
|
|
727
|
+
return C.debug("[LintCommand#run] [collecting → done] no files to lint"), new w(g);
|
|
728
|
+
C.debug(`[LintCommand#run] [collecting → linting] ${h.length} file(s)`);
|
|
729
|
+
const f = [...g];
|
|
730
|
+
let R = 0;
|
|
731
|
+
const E = y("."), p = je(E), S = /* @__PURE__ */ new Set();
|
|
732
|
+
for (const d of h) {
|
|
733
|
+
const T = y(d);
|
|
734
|
+
let m;
|
|
735
|
+
try {
|
|
736
|
+
C.debug(`[LintCommand#run] [linting → reading] ${d}`), m = Y(T, "utf-8");
|
|
737
|
+
} catch (D) {
|
|
738
|
+
const b = new Error(`[LintCommand#run] Cannot read file: ${d}`, { cause: D });
|
|
739
|
+
C.error(`[LintCommand#run] [reading → failed] ${d}`, { error: b });
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
const L = f.length;
|
|
743
|
+
f.push(...pe(m, d)), f.push(...Ie(m, d)), f.push(...ke(m, d)), f.push(...$e(m, d)), f.push(...He(m, d)), f.push(...Pe(m, d)), f.push(...Fe(m, d, r));
|
|
744
|
+
const x = await Se(m, d, s);
|
|
745
|
+
if (f.push(...x.errors), R += x.autoFixed, f.length > L) {
|
|
746
|
+
const D = Ye(m);
|
|
747
|
+
for (const b of D)
|
|
748
|
+
S.add(b);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
const { taskPaths: I, specPaths: N } = Ze([...S], p), A = new w(f, R, I, N);
|
|
752
|
+
return A.exitCode === 1 ? console.log(`❌ [LintCommand#run] [linting → failed] ${f.length} error(s)`) : console.log("✅ [LintCommand#run] [linting → clean] no errors"), A;
|
|
753
|
+
}
|
|
754
|
+
const M = [".ts", ".tsx"], Qe = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage", "build", "out", "__tests__"]);
|
|
755
|
+
function et(o) {
|
|
756
|
+
C.debug(`[resolveTargets] [idle → resolving] ${o.length} target(s)`);
|
|
757
|
+
const t = /* @__PURE__ */ new Set(), e = [];
|
|
758
|
+
for (const n of o) {
|
|
759
|
+
const i = F(n).toLowerCase();
|
|
760
|
+
if (i && !M.includes(i) && !n.endsWith("/"))
|
|
761
|
+
continue;
|
|
762
|
+
let r;
|
|
763
|
+
try {
|
|
764
|
+
r = ee(n);
|
|
765
|
+
} catch (l) {
|
|
766
|
+
const a = l;
|
|
767
|
+
e.push({
|
|
768
|
+
file: n,
|
|
769
|
+
line: 0,
|
|
770
|
+
col: 0,
|
|
771
|
+
severity: "error",
|
|
772
|
+
code: fe,
|
|
773
|
+
message: `${n}: ${a.code ?? "UNKNOWN"}: ${a.message}`
|
|
774
|
+
});
|
|
775
|
+
continue;
|
|
776
|
+
}
|
|
777
|
+
if (r.isSymbolicLink())
|
|
778
|
+
continue;
|
|
779
|
+
const c = y(n);
|
|
780
|
+
if (r.isDirectory())
|
|
781
|
+
q(c, t);
|
|
782
|
+
else if (r.isFile()) {
|
|
783
|
+
const l = F(n).toLowerCase();
|
|
784
|
+
M.includes(l) && t.add(c);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
const s = [...t].sort();
|
|
788
|
+
return C.debug(
|
|
789
|
+
`[resolveTargets] [resolving → resolved] ${s.length} file(s), ${e.length} error(s)`
|
|
790
|
+
), { files: s, errors: e };
|
|
791
|
+
}
|
|
792
|
+
function q(o, t) {
|
|
793
|
+
let e;
|
|
794
|
+
try {
|
|
795
|
+
e = H(o, { withFileTypes: !0 });
|
|
796
|
+
} catch {
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
for (const s of e) {
|
|
800
|
+
const n = te(o, s.name);
|
|
801
|
+
if (!s.name.startsWith(".") && !Qe.has(s.name) && !s.isSymbolicLink()) {
|
|
802
|
+
if (s.isDirectory())
|
|
803
|
+
q(n, t);
|
|
804
|
+
else if (s.isFile()) {
|
|
805
|
+
const i = F(s.name).toLowerCase();
|
|
806
|
+
M.includes(i) && t.add(n);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
const v = await qe(process.argv);
|
|
812
|
+
(v.exitCode === 1 || v.autoFixed > 0) && console.log(v.format());
|
|
813
|
+
process.exit(v.exitCode);
|