@nielspeter/eess 0.4.0 → 0.5.0

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 (125) hide show
  1. package/README.md +94 -1
  2. package/dist/baseline-generator.d.ts +9 -0
  3. package/dist/baseline-generator.d.ts.map +1 -1
  4. package/dist/baseline-generator.js +9 -0
  5. package/dist/baseline-generator.js.map +1 -1
  6. package/dist/baseline.d.ts +1 -1
  7. package/dist/cardinality.d.ts.map +1 -1
  8. package/dist/cardinality.js +20 -5
  9. package/dist/cardinality.js.map +1 -1
  10. package/dist/cli-config.d.ts +59 -0
  11. package/dist/cli-config.d.ts.map +1 -0
  12. package/dist/cli-config.js +84 -0
  13. package/dist/cli-config.js.map +1 -0
  14. package/dist/collect-result.d.ts +94 -0
  15. package/dist/collect-result.d.ts.map +1 -0
  16. package/dist/collect-result.js +142 -0
  17. package/dist/collect-result.js.map +1 -0
  18. package/dist/combinators.d.ts +14 -0
  19. package/dist/combinators.d.ts.map +1 -1
  20. package/dist/combinators.js +53 -16
  21. package/dist/combinators.js.map +1 -1
  22. package/dist/condition.d.ts +37 -0
  23. package/dist/condition.d.ts.map +1 -1
  24. package/dist/condition.js +48 -1
  25. package/dist/condition.js.map +1 -1
  26. package/dist/correspondence.d.ts +30 -0
  27. package/dist/correspondence.d.ts.map +1 -1
  28. package/dist/correspondence.js +36 -1
  29. package/dist/correspondence.js.map +1 -1
  30. package/dist/dedupe-config-findings.d.ts.map +1 -1
  31. package/dist/dedupe-config-findings.js +27 -0
  32. package/dist/dedupe-config-findings.js.map +1 -1
  33. package/dist/diff-aware.d.ts +8 -9
  34. package/dist/diff-aware.d.ts.map +1 -1
  35. package/dist/diff-aware.js +38 -17
  36. package/dist/diff-aware.js.map +1 -1
  37. package/dist/emitter-findings.d.ts +167 -0
  38. package/dist/emitter-findings.d.ts.map +1 -0
  39. package/dist/emitter-findings.js +237 -0
  40. package/dist/emitter-findings.js.map +1 -0
  41. package/dist/errors.d.ts +48 -0
  42. package/dist/errors.d.ts.map +1 -1
  43. package/dist/errors.js +61 -0
  44. package/dist/errors.js.map +1 -1
  45. package/dist/exclusion-comments.d.ts +36 -1
  46. package/dist/exclusion-comments.d.ts.map +1 -1
  47. package/dist/exclusion-comments.js +185 -37
  48. package/dist/exclusion-comments.js.map +1 -1
  49. package/dist/execute-rule.d.ts +12 -3
  50. package/dist/execute-rule.d.ts.map +1 -1
  51. package/dist/execute-rule.js +184 -7
  52. package/dist/execute-rule.js.map +1 -1
  53. package/dist/file-walk.d.ts +22 -0
  54. package/dist/file-walk.d.ts.map +1 -0
  55. package/dist/file-walk.js +51 -0
  56. package/dist/file-walk.js.map +1 -0
  57. package/dist/format-json.d.ts +13 -0
  58. package/dist/format-json.d.ts.map +1 -1
  59. package/dist/format-json.js +24 -0
  60. package/dist/format-json.js.map +1 -1
  61. package/dist/index.d.ts +14 -46
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +13 -41
  64. package/dist/index.js.map +1 -1
  65. package/dist/internal.d.ts +55 -0
  66. package/dist/internal.d.ts.map +1 -0
  67. package/dist/internal.js +92 -0
  68. package/dist/internal.js.map +1 -0
  69. package/dist/mask-non-comment.d.ts +49 -0
  70. package/dist/mask-non-comment.d.ts.map +1 -0
  71. package/dist/mask-non-comment.js +261 -0
  72. package/dist/mask-non-comment.js.map +1 -0
  73. package/dist/owns-empty-discovery.d.ts.map +1 -1
  74. package/dist/owns-empty-discovery.js +12 -4
  75. package/dist/owns-empty-discovery.js.map +1 -1
  76. package/dist/path-suffix.d.ts +57 -0
  77. package/dist/path-suffix.d.ts.map +1 -0
  78. package/dist/path-suffix.js +73 -0
  79. package/dist/path-suffix.js.map +1 -0
  80. package/dist/predicate.d.ts +12 -0
  81. package/dist/predicate.d.ts.map +1 -1
  82. package/dist/predicate.js +20 -1
  83. package/dist/predicate.js.map +1 -1
  84. package/dist/preset-dispatch.d.ts +6 -34
  85. package/dist/preset-dispatch.d.ts.map +1 -1
  86. package/dist/preset-dispatch.js +30 -52
  87. package/dist/preset-dispatch.js.map +1 -1
  88. package/dist/report.d.ts +31 -7
  89. package/dist/report.d.ts.map +1 -1
  90. package/dist/report.js +174 -15
  91. package/dist/report.js.map +1 -1
  92. package/dist/rule-builder-like.d.ts +8 -2
  93. package/dist/rule-builder-like.d.ts.map +1 -1
  94. package/dist/rule-builder.d.ts +15 -0
  95. package/dist/rule-builder.d.ts.map +1 -1
  96. package/dist/rule-builder.js +41 -36
  97. package/dist/rule-builder.js.map +1 -1
  98. package/dist/rule-description.d.ts +50 -0
  99. package/dist/rule-description.d.ts.map +1 -1
  100. package/dist/rule-description.js +58 -0
  101. package/dist/rule-description.js.map +1 -1
  102. package/dist/selection-memo.d.ts +1 -3
  103. package/dist/selection-memo.d.ts.map +1 -1
  104. package/dist/selection-memo.js +1 -3
  105. package/dist/selection-memo.js.map +1 -1
  106. package/dist/silent-exclusion.d.ts +12 -0
  107. package/dist/silent-exclusion.d.ts.map +1 -1
  108. package/dist/silent-exclusion.js +22 -0
  109. package/dist/silent-exclusion.js.map +1 -1
  110. package/dist/terminal-builder.d.ts +29 -15
  111. package/dist/terminal-builder.d.ts.map +1 -1
  112. package/dist/terminal-builder.js +97 -51
  113. package/dist/terminal-builder.js.map +1 -1
  114. package/dist/vacuity-findings.d.ts +0 -6
  115. package/dist/vacuity-findings.d.ts.map +1 -1
  116. package/dist/vacuity-findings.js +27 -57
  117. package/dist/vacuity-findings.js.map +1 -1
  118. package/dist/violation.d.ts +22 -1
  119. package/dist/violation.d.ts.map +1 -1
  120. package/dist/violation.js.map +1 -1
  121. package/dist/watch.d.ts +71 -0
  122. package/dist/watch.d.ts.map +1 -0
  123. package/dist/watch.js +129 -0
  124. package/dist/watch.js.map +1 -0
  125. package/package.json +6 -1
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Blank every span a directive must NOT be read from, preserving length and
3
+ * lines so reported positions are unchanged.
4
+ *
5
+ * Bug 0154: `parseExclusionComments` scanned raw source line by line with a bare
6
+ * regex, so text that merely LOOKED like `// eess-exclude …` — inside a string,
7
+ * a template literal, or a block comment describing the grammar — was parsed as
8
+ * a real waiver and silently suppressed a genuine finding on the next line. That
9
+ * is a suppression nobody wrote, which is the worst direction a suppression
10
+ * system can fail in.
11
+ *
12
+ * **Text-only, deliberately.** The kernel cannot import ts-morph (ADR-002/007
13
+ * confine it to `eess-ts`), so this is a hand-rolled single-pass scanner rather
14
+ * than an AST walk. The failure direction is what makes that acceptable: a
15
+ * mis-lex can only ever *hide* a directive — a waiver stops working, loudly, and
16
+ * the violation it was hiding comes back — never invent one.
17
+ *
18
+ * Line comments are deliberately NOT blanked: they are the thing being looked
19
+ * for. Everything else that can contain `//` is.
20
+ */
21
+ /**
22
+ * Blank strings, template literals, regex literals and block comments.
23
+ *
24
+ * @param sourceText the raw file text
25
+ * @returns text of identical length and line structure, with those spans spaced out
26
+ */
27
+ export declare function maskNonCommentSpans(sourceText: string): string;
28
+ /**
29
+ * The markdown answer to the question `maskNonCommentSpans` asks of code.
30
+ *
31
+ * A `.md` file has no string or template literals, so running the JS/TS lexer
32
+ * over one is a category error — and a costly one, because markdown is
33
+ * backtick-dense: a single unbalanced backtick in prose opened a "template
34
+ * literal" that swallowed the rest of the file, silencing every real directive
35
+ * after it. Fail-closed, so no invented suppression, but a waiver that stops
36
+ * working for a reason nobody can see is its own defect.
37
+ *
38
+ * What markdown DOES have is code spans, and they mean the same thing a string
39
+ * literal means in code: this is an example of the grammar, not an instance of
40
+ * it. Fenced blocks (``` or ~~~) and inline spans are blanked; prose is left
41
+ * alone. Length- and line-preserving, so reported positions do not move.
42
+ *
43
+ * An unterminated fence blanks to end-of-file. That is the fail-closed
44
+ * direction: text under a fence that was opened and never closed is more likely
45
+ * an example than a waiver, and the cost is a directive that does not apply
46
+ * rather than one that applies where nobody asked.
47
+ */
48
+ export declare function maskMarkdownCodeSpans(sourceText: string): string;
49
+ //# sourceMappingURL=mask-non-comment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask-non-comment.d.ts","sourceRoot":"","sources":["../src/mask-non-comment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAkCH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAyF9D;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAyChE"}
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Blank every span a directive must NOT be read from, preserving length and
3
+ * lines so reported positions are unchanged.
4
+ *
5
+ * Bug 0154: `parseExclusionComments` scanned raw source line by line with a bare
6
+ * regex, so text that merely LOOKED like `// eess-exclude …` — inside a string,
7
+ * a template literal, or a block comment describing the grammar — was parsed as
8
+ * a real waiver and silently suppressed a genuine finding on the next line. That
9
+ * is a suppression nobody wrote, which is the worst direction a suppression
10
+ * system can fail in.
11
+ *
12
+ * **Text-only, deliberately.** The kernel cannot import ts-morph (ADR-002/007
13
+ * confine it to `eess-ts`), so this is a hand-rolled single-pass scanner rather
14
+ * than an AST walk. The failure direction is what makes that acceptable: a
15
+ * mis-lex can only ever *hide* a directive — a waiver stops working, loudly, and
16
+ * the violation it was hiding comes back — never invent one.
17
+ *
18
+ * Line comments are deliberately NOT blanked: they are the thing being looked
19
+ * for. Everything else that can contain `//` is.
20
+ */
21
+ /** Replace a span with spaces, keeping newlines so line numbers do not move. */
22
+ function blank(text, start, end) {
23
+ let out = '';
24
+ for (let i = start; i < end; i++) {
25
+ out += text[i] === '\n' ? '\n' : ' ';
26
+ }
27
+ return out;
28
+ }
29
+ /**
30
+ * A `/` here starts a regex literal rather than dividing.
31
+ *
32
+ * Decided by the previous significant character: after a value (identifier,
33
+ * literal, `)`, `]`) a `/` divides; after an operator, `(`, `,`, `=` or nothing
34
+ * it opens a regex. Getting this wrong is safe in one direction only — treating
35
+ * a division as a regex blanks source that could then hide a directive, so the
36
+ * bias is toward NOT opening a regex when unsure.
37
+ */
38
+ function opensRegex(text, at) {
39
+ let i = at - 1;
40
+ while (i >= 0) {
41
+ const c = text[i];
42
+ if (c === undefined)
43
+ return true;
44
+ if (c === ' ' || c === '\t' || c === '\r' || c === '\n') {
45
+ i -= 1;
46
+ continue;
47
+ }
48
+ return !/[A-Za-z0-9_$)\]]/.test(c);
49
+ }
50
+ return true;
51
+ }
52
+ /**
53
+ * Blank strings, template literals, regex literals and block comments.
54
+ *
55
+ * @param sourceText the raw file text
56
+ * @returns text of identical length and line structure, with those spans spaced out
57
+ */
58
+ export function maskNonCommentSpans(sourceText) {
59
+ let out = '';
60
+ let i = 0;
61
+ const n = sourceText.length;
62
+ while (i < n) {
63
+ const c = sourceText[i];
64
+ const next = sourceText[i + 1];
65
+ // Line comment — left intact; this is what the directive parser reads.
66
+ if (c === '/' && next === '/') {
67
+ const end = sourceText.indexOf('\n', i);
68
+ const stop = end === -1 ? n : end;
69
+ out += sourceText.slice(i, stop);
70
+ i = stop;
71
+ continue;
72
+ }
73
+ // Block comment — blanked. A grammar description inside JSDoc is prose.
74
+ if (c === '/' && next === '*') {
75
+ const close = sourceText.indexOf('*/', i + 2);
76
+ const stop = close === -1 ? n : close + 2;
77
+ out += blank(sourceText, i, stop);
78
+ i = stop;
79
+ continue;
80
+ }
81
+ // String or template literal — blanked whole, interpolations included. A
82
+ // `${…}` may itself contain a quote, so scanning it as code would need a
83
+ // nesting stack for no benefit: nothing inside a template is a directive.
84
+ if (c === '"' || c === "'" || c === '`') {
85
+ const quote = c;
86
+ let j = i + 1;
87
+ while (j < n) {
88
+ const d = sourceText[j];
89
+ if (d === '\\') {
90
+ j += 2;
91
+ continue;
92
+ }
93
+ if (d === quote) {
94
+ j += 1;
95
+ break;
96
+ }
97
+ // An unterminated single- or double-quoted string ends at the newline;
98
+ // a template legitimately spans lines.
99
+ if (d === '\n' && quote !== '`')
100
+ break;
101
+ j += 1;
102
+ }
103
+ out += blank(sourceText, i, j);
104
+ i = j;
105
+ continue;
106
+ }
107
+ // Regex literal — blanked. `/…\/…/` can contain `//`.
108
+ if (c === '/' && opensRegex(sourceText, i)) {
109
+ let j = i + 1;
110
+ let inClass = false;
111
+ let closed = false;
112
+ while (j < n) {
113
+ const d = sourceText[j];
114
+ if (d === '\\') {
115
+ j += 2;
116
+ continue;
117
+ }
118
+ if (d === '\n')
119
+ break;
120
+ if (d === '[')
121
+ inClass = true;
122
+ else if (d === ']')
123
+ inClass = false;
124
+ else if (d === '/' && !inClass) {
125
+ j += 1;
126
+ closed = true;
127
+ break;
128
+ }
129
+ j += 1;
130
+ }
131
+ // Only blank when it really closed on the same line; an unterminated
132
+ // `/` was division after all, and blanking to end-of-line could hide a
133
+ // trailing directive.
134
+ if (closed) {
135
+ out += blank(sourceText, i, j);
136
+ i = j;
137
+ continue;
138
+ }
139
+ }
140
+ out += c;
141
+ i += 1;
142
+ }
143
+ return out;
144
+ }
145
+ /**
146
+ * The markdown answer to the question `maskNonCommentSpans` asks of code.
147
+ *
148
+ * A `.md` file has no string or template literals, so running the JS/TS lexer
149
+ * over one is a category error — and a costly one, because markdown is
150
+ * backtick-dense: a single unbalanced backtick in prose opened a "template
151
+ * literal" that swallowed the rest of the file, silencing every real directive
152
+ * after it. Fail-closed, so no invented suppression, but a waiver that stops
153
+ * working for a reason nobody can see is its own defect.
154
+ *
155
+ * What markdown DOES have is code spans, and they mean the same thing a string
156
+ * literal means in code: this is an example of the grammar, not an instance of
157
+ * it. Fenced blocks (``` or ~~~) and inline spans are blanked; prose is left
158
+ * alone. Length- and line-preserving, so reported positions do not move.
159
+ *
160
+ * An unterminated fence blanks to end-of-file. That is the fail-closed
161
+ * direction: text under a fence that was opened and never closed is more likely
162
+ * an example than a waiver, and the cost is a directive that does not apply
163
+ * rather than one that applies where nobody asked.
164
+ */
165
+ export function maskMarkdownCodeSpans(sourceText) {
166
+ const lines = sourceText.split('\n');
167
+ const out = [];
168
+ let fenceChar;
169
+ let fenceLength = 0;
170
+ for (const line of lines) {
171
+ const opener = /^\s*(`{3,}|~{3,})/.exec(line);
172
+ const marker = opener === null ? undefined : opener[1];
173
+ if (fenceChar !== undefined) {
174
+ // Inside a fence: blank everything, the closing marker line included.
175
+ out.push(' '.repeat(line.length));
176
+ if (marker !== undefined && marker.charAt(0) === fenceChar && marker.length >= fenceLength) {
177
+ fenceChar = undefined;
178
+ fenceLength = 0;
179
+ }
180
+ continue;
181
+ }
182
+ if (marker !== undefined) {
183
+ fenceChar = marker.charAt(0);
184
+ fenceLength = marker.length;
185
+ out.push(' '.repeat(line.length));
186
+ continue;
187
+ }
188
+ // Markdown's THIRD code construct: a 4-space (or tab) indented block. Missed
189
+ // by the first version, which handled fences and inline spans only — so an
190
+ // indented example of a directive was read as a live waiver. Deliberately
191
+ // over-broad (a wrapped list item indents too): over-masking hides a
192
+ // directive, which is loud; under-masking invents one, which is silent.
193
+ if (/^(?: {4}|\t)/.test(line)) {
194
+ out.push(' '.repeat(line.length));
195
+ continue;
196
+ }
197
+ // Outside a fence: blank BALANCED inline spans only. An odd backtick is
198
+ // prose, and treating it as an opener is exactly the bug this replaces.
199
+ out.push(blankInlineCodeSpans(line));
200
+ }
201
+ return out.join('\n');
202
+ }
203
+ /**
204
+ * Blank code spans on one line, matching backtick RUNS the way CommonMark does:
205
+ * an opening run of N backticks is closed by the next run of exactly N.
206
+ *
207
+ * The first version paired backticks one at a time, which left the contents of
208
+ * any run of two or more exposed — so a directive inside ``…`` survived masking
209
+ * and was read as a live waiver. That is a suppression nobody wrote, the one
210
+ * direction this whole module exists to prevent (bug 0154), reintroduced by the
211
+ * fix for it. Multi-tick runs are not exotic here: they are the repo's own
212
+ * convention for code containing a backtick.
213
+ *
214
+ * An unclosed run is left as ordinary text, so a stray tick in prose still
215
+ * cannot swallow the rest of the line.
216
+ */
217
+ function blankInlineCodeSpans(line) {
218
+ const runs = [];
219
+ let i = 0;
220
+ while (i < line.length) {
221
+ if (line.charAt(i) !== '`') {
222
+ i += 1;
223
+ continue;
224
+ }
225
+ const start = i;
226
+ while (i < line.length && line.charAt(i) === '`')
227
+ i += 1;
228
+ runs.push({ start, length: i - start });
229
+ }
230
+ if (runs.length < 2)
231
+ return line;
232
+ let out = line;
233
+ let openIndex = 0;
234
+ while (openIndex < runs.length) {
235
+ const open = runs[openIndex];
236
+ if (open === undefined)
237
+ break;
238
+ let closeIndex = -1;
239
+ for (let j = openIndex + 1; j < runs.length; j++) {
240
+ const candidate = runs[j];
241
+ if (candidate !== undefined && candidate.length === open.length) {
242
+ closeIndex = j;
243
+ break;
244
+ }
245
+ }
246
+ if (closeIndex === -1) {
247
+ // No matching close: this run is prose, not a delimiter.
248
+ openIndex += 1;
249
+ continue;
250
+ }
251
+ const close = runs[closeIndex];
252
+ if (close === undefined)
253
+ break;
254
+ const from = open.start;
255
+ const to = close.start + close.length;
256
+ out = out.slice(0, from) + ' '.repeat(to - from) + out.slice(to);
257
+ openIndex = closeIndex + 1;
258
+ }
259
+ return out;
260
+ }
261
+ //# sourceMappingURL=mask-non-comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mask-non-comment.js","sourceRoot":"","sources":["../src/mask-non-comment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gFAAgF;AAChF,SAAS,KAAK,CAAC,IAAY,EAAE,KAAa,EAAE,GAAW;IACrD,IAAI,GAAG,GAAG,EAAE,CAAA;IACZ,KAAK,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAA;IACtC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,IAAY,EAAE,EAAU;IAC1C,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;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AK;YACP,CAAC;QACH,CAAC;QACD,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;YACtB,yDAAyD;YACzD,SAAS,IAAI,CAAC,CAAA;YACd,SAAQ;QACV,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,CAAA;QAC9B,IAAI,KAAK,KAAK,SAAS;YAAE,MAAK;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAA;QACvB,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAA;QACrC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAChE,SAAS,GAAG,UAAU,GAAG,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"owns-empty-discovery.d.ts","sourceRoot":"","sources":["../src/owns-empty-discovery.ts"],"names":[],"mappings":"AA4DA,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAGxE;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE7D"}
1
+ {"version":3,"file":"owns-empty-discovery.d.ts","sourceRoot":"","sources":["../src/owns-empty-discovery.ts"],"names":[],"mappings":"AAoEA,gFAAgF;AAChF,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAGxE;AAED,uEAAuE;AACvE,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE7D"}
@@ -51,10 +51,18 @@
51
51
  * and a test asserts that constructor emits no own symbols. `PairCondition` has no
52
52
  * sanctioned constructor, so there is nothing to make the analogous guarantee.
53
53
  *
54
- * A module-level `WeakSet` has no such hole. Membership is not a property of the
55
- * object, so it cannot be read off one, copied, or forged — a caller would need
56
- * this module's binding, and it is not exported. `WeakSet` rather than `Set` so a
57
- * condition is not retained after its rule is discarded.
54
+ * A module-level `WeakSet` closes that hole for the KEY: membership is not a
55
+ * property of the object, so it cannot be read off one, copied, or forged.
56
+ *
57
+ * It does not close it for the CALL, and the clause that used to say so — "a
58
+ * caller would need this module's binding, and it is not exported" — was already
59
+ * false when it was written: `marksOwnEmptyDiscovery` was exported from the
60
+ * kernel root. It now sits behind `@nielspeter/eess/internal`, which is narrower
61
+ * and still reachable. See `cardinality.ts` for the same limitation stated in
62
+ * full; the two markers share it.
63
+ *
64
+ * `WeakSet` rather than `Set` so a condition is not retained after its rule is
65
+ * discarded.
58
66
  */
59
67
  const OWNERS = new WeakSet();
60
68
  /** Declare that this condition reports an empty discovery population itself. */
@@ -1 +1 @@
1
- {"version":3,"file":"owns-empty-discovery.js","sourceRoot":"","sources":["../src/owns-empty-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AACH,MAAM,MAAM,GAAG,IAAI,OAAO,EAAU,CAAA;AAEpC,gFAAgF;AAChF,MAAM,UAAU,sBAAsB,CAAmB,SAAY;IACnE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrB,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;;;GAOG"}
1
+ {"version":3,"file":"owns-empty-discovery.js","sourceRoot":"","sources":["../src/owns-empty-discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAM,MAAM,GAAG,IAAI,OAAO,EAAU,CAAA;AAEpC,gFAAgF;AAChF,MAAM,UAAU,sBAAsB,CAAmB,SAAY;IACnE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrB,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,OAAO,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;AAC9B,CAAC;AAED;;;;;;;GAOG"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Resolve a cited path against a set of repo-relative paths.
3
+ *
4
+ * Two dialects had written this independently — `eess-md`'s `uniqueSuffix()`
5
+ * for `path:line` code pointers, and `eess-crossvalidate`'s `resolveFeature`
6
+ * for `.feature` citations. Same algorithm, same three-way answer, and after
7
+ * bug 0254 the same remedy text; bug 0257 is that duplication.
8
+ *
9
+ * **Why the kernel.** It is pure string work over a list of paths: no
10
+ * `ArchProject`, no ts-morph, nothing dialect-shaped. That is exactly
11
+ * `path-universe.ts`'s argument for living here, and
12
+ * [ADR-013](../../../adr/013-the-kernel-takes-the-fact-not-the-project.md)'s
13
+ * test is satisfied — the kernel takes the *fact* (a list of paths), not the
14
+ * project that produced it. It is family plumbing rather than public API, so it
15
+ * is exported from `internal.ts` (ADR-011).
16
+ *
17
+ * **What it deliberately does not decide.** Whether a `none` is broken, whether
18
+ * an `ambiguous` fails or warns, whether to consult external roots, what the
19
+ * message says — all of that is the caller's policy and differs between the two
20
+ * dialects for good reasons. This answers one question: *which path did they
21
+ * mean?*
22
+ */
23
+ /** How a cited path resolves against a set of repo-relative paths. */
24
+ export type PathSuffixMatch =
25
+ /** The citation IS a repo-relative path. Wins outright, even if the same tail also matches elsewhere. */
26
+ {
27
+ readonly kind: 'exact';
28
+ readonly file: string;
29
+ }
30
+ /** Exactly one path ends with the citation on a `/` boundary. */
31
+ | {
32
+ readonly kind: 'unique';
33
+ readonly file: string;
34
+ }
35
+ /** Several do, so the citation names none of them. Candidates in index order. */
36
+ | {
37
+ readonly kind: 'ambiguous';
38
+ readonly files: readonly string[];
39
+ }
40
+ /** Nothing matches. */
41
+ | {
42
+ readonly kind: 'none';
43
+ };
44
+ /** A prepared path set. Build once, resolve many. Duplicate inputs collapse. */
45
+ export interface PathSuffixIndex {
46
+ resolve(wanted: string): PathSuffixMatch;
47
+ }
48
+ /**
49
+ * Prepare a path set for repeated suffix lookups.
50
+ *
51
+ * Indexed by last segment, because the corpora this runs over resolve hundreds
52
+ * of citations against thousands of paths and a linear scan per citation was
53
+ * measurable in `eess-md`. The index is the reason this takes the whole set up
54
+ * front rather than being a plain two-argument function.
55
+ */
56
+ export declare function pathSuffixIndex(paths: Iterable<string>): PathSuffixIndex;
57
+ //# sourceMappingURL=path-suffix.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-suffix.d.ts","sourceRoot":"","sources":["../src/path-suffix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,sEAAsE;AACtE,MAAM,MAAM,eAAe;AACzB,yGAAyG;AACvG;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACnD,iEAAiE;GAC/D;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AACpD,iFAAiF;GAC/E;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE;AACnE,uBAAuB;GACrB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7B,gFAAgF;AAChF,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAAA;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,eAAe,CAsCxE"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Resolve a cited path against a set of repo-relative paths.
3
+ *
4
+ * Two dialects had written this independently — `eess-md`'s `uniqueSuffix()`
5
+ * for `path:line` code pointers, and `eess-crossvalidate`'s `resolveFeature`
6
+ * for `.feature` citations. Same algorithm, same three-way answer, and after
7
+ * bug 0254 the same remedy text; bug 0257 is that duplication.
8
+ *
9
+ * **Why the kernel.** It is pure string work over a list of paths: no
10
+ * `ArchProject`, no ts-morph, nothing dialect-shaped. That is exactly
11
+ * `path-universe.ts`'s argument for living here, and
12
+ * [ADR-013](../../../adr/013-the-kernel-takes-the-fact-not-the-project.md)'s
13
+ * test is satisfied — the kernel takes the *fact* (a list of paths), not the
14
+ * project that produced it. It is family plumbing rather than public API, so it
15
+ * is exported from `internal.ts` (ADR-011).
16
+ *
17
+ * **What it deliberately does not decide.** Whether a `none` is broken, whether
18
+ * an `ambiguous` fails or warns, whether to consult external roots, what the
19
+ * message says — all of that is the caller's policy and differs between the two
20
+ * dialects for good reasons. This answers one question: *which path did they
21
+ * mean?*
22
+ */
23
+ /**
24
+ * Prepare a path set for repeated suffix lookups.
25
+ *
26
+ * Indexed by last segment, because the corpora this runs over resolve hundreds
27
+ * of citations against thousands of paths and a linear scan per citation was
28
+ * measurable in `eess-md`. The index is the reason this takes the whole set up
29
+ * front rather than being a plain two-argument function.
30
+ */
31
+ export function pathSuffixIndex(paths) {
32
+ // Deduplicated on entry, not assumed deduplicated. `all` was always a `Set`,
33
+ // but the per-segment lists used to push every element of the iterable — so a
34
+ // path appearing twice came back as `{ kind: 'ambiguous', files: [x, x] }`:
35
+ // one file reported as ambiguous with itself. Unreachable through today's two
36
+ // callers (both hand it a set or a filesystem walk), which is exactly why it
37
+ // would have waited for the third — the parameter is an `Iterable<string>`
38
+ // and nothing in the type says the caller must have deduplicated. Found by
39
+ // differential fuzzing across 20,000 cases; it was the only class of
40
+ // disagreement with the implementations this replaced.
41
+ const all = new Set(paths);
42
+ const byLastSegment = new Map();
43
+ for (const rel of all) {
44
+ const seg = rel.slice(rel.lastIndexOf('/') + 1);
45
+ const list = byLastSegment.get(seg);
46
+ if (list)
47
+ list.push(rel);
48
+ else
49
+ byLastSegment.set(seg, [rel]);
50
+ }
51
+ return {
52
+ resolve(wanted) {
53
+ // Exact first, and it wins outright. A citation that IS a real path is not
54
+ // ambiguous just because some longer path happens to end the same way —
55
+ // both dialects had this precedence already, and getting it backwards
56
+ // would turn correct citations into findings.
57
+ if (all.has(wanted))
58
+ return { kind: 'exact', file: wanted };
59
+ const seg = wanted.slice(wanted.lastIndexOf('/') + 1);
60
+ // Narrow by last segment, then confirm the FULL suffix on a `/` boundary:
61
+ // `x.ts` must not match `prefix-x.ts`, and `a/x.ts` must not match
62
+ // `b/aa/x.ts`.
63
+ const matches = (byLastSegment.get(seg) ?? []).filter((f) => f.endsWith('/' + wanted));
64
+ const only = matches[0];
65
+ if (matches.length === 1 && only !== undefined)
66
+ return { kind: 'unique', file: only };
67
+ if (matches.length > 1)
68
+ return { kind: 'ambiguous', files: matches };
69
+ return { kind: 'none' };
70
+ },
71
+ };
72
+ }
73
+ //# sourceMappingURL=path-suffix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"path-suffix.js","sourceRoot":"","sources":["../src/path-suffix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAkBH;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,KAAuB;IACrD,6EAA6E;IAC7E,8EAA8E;IAC9E,4EAA4E;IAC5E,8EAA8E;IAC9E,6EAA6E;IAC7E,2EAA2E;IAC3E,2EAA2E;IAC3E,qEAAqE;IACrE,uDAAuD;IACvD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAS,KAAK,CAAC,CAAA;IAClC,MAAM,aA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EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;YACpE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;QACzB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -41,4 +41,16 @@ export interface Predicate<T> {
41
41
  */
42
42
  readonly originLabel?: string;
43
43
  }
44
+ /**
45
+ * Record a predicate on a builder, noting it if it arrived after `.should()`.
46
+ *
47
+ * A free function for the same reason as `recordExclusions` and
48
+ * `selectMatching`: the two builders sit in incompatible hierarchies, so there
49
+ * is no common base to hold a method. The copies were 94% similar and differed
50
+ * only in comment wording and braces — no behaviour.
51
+ *
52
+ * `phase` is read, never written: recording a misplaced predicate is a
53
+ * diagnosis, not a state change.
54
+ */
55
+ export declare function recordPredicate<T>(predicate: Predicate<T>, predicates: Predicate<T>[], misplaced: string[], phase: string): void;
44
56
  //# sourceMappingURL=predicate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,0DAA0D;IAC1D,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAA;IACzB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAA;IAE9B;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B"}
1
+ {"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD;;;GAGG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,4FAA4F;IAC5F,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,0DAA0D;IAC1D,IAAI,CAAC,OAAO,EAAE,CAAC,GAAG,OAAO,CAAA;IACzB;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAA;IAE9B;;;;;;;;;;;;;;;;;;OAkBG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAC/B,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,EACvB,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,EAC1B,SAAS,EAAE,MAAM,EAAE,EACnB,KAAK,EAAE,MAAM,GACZ,IAAI,CAON"}
package/dist/predicate.js CHANGED
@@ -1,2 +1,21 @@
1
- export {};
1
+ /**
2
+ * Record a predicate on a builder, noting it if it arrived after `.should()`.
3
+ *
4
+ * A free function for the same reason as `recordExclusions` and
5
+ * `selectMatching`: the two builders sit in incompatible hierarchies, so there
6
+ * is no common base to hold a method. The copies were 94% similar and differed
7
+ * only in comment wording and braces — no behaviour.
8
+ *
9
+ * `phase` is read, never written: recording a misplaced predicate is a
10
+ * diagnosis, not a state change.
11
+ */
12
+ export function recordPredicate(predicate, predicates, misplaced, phase) {
13
+ predicates.push(predicate);
14
+ // Bug 0155 state 2: a predicate-only method used after `.should()`. Dual-use
15
+ // methods dispatch to conditions in that phase and never reach here, so this is
16
+ // a filter written where an assertion was meant — the one state whose fix is
17
+ // "move it before .should()", not "add a condition".
18
+ if (phase === 'condition')
19
+ misplaced.push(predicate.description);
20
+ }
2
21
  //# sourceMappingURL=predicate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"predicate.js","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"predicate.js","sourceRoot":"","sources":["../src/predicate.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC7B,SAAuB,EACvB,UAA0B,EAC1B,SAAmB,EACnB,KAAa;IAEb,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;IAC1B,6EAA6E;IAC7E,gFAAgF;IAChF,6EAA6E;IAC7E,qDAAqD;IACrD,IAAI,KAAK,KAAK,WAAW;QAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;AAClE,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { ArchViolation } from './violation.js';
1
+ import { type CollectResult } from './collect-result.js';
2
2
  import type { RuleMetadata } from './rule-metadata.js';
3
3
  import { type PresetReportOptions } from './report.js';
4
4
  /** Per-rule severity within a preset. */
@@ -15,11 +15,11 @@ export interface PresetBaseOptions extends PresetReportOptions {
15
15
  * Anything with `.rule()` and `.violations()` — works with both
16
16
  * `RuleBuilder<T, P>` and `TerminalBuilder` hierarchies, across all dialects.
17
17
  */
18
- interface Dispatchable {
18
+ export interface Dispatchable {
19
19
  rule(m: RuleMetadata): {
20
- violations(): ArchViolation[];
20
+ violations(): CollectResult;
21
21
  };
22
- violations(): ArchViolation[];
22
+ violations(): CollectResult;
23
23
  }
24
24
  /**
25
25
  * Dispatch a single rule within a preset.
@@ -30,38 +30,10 @@ interface Dispatchable {
30
30
  */
31
31
  export declare function dispatchRule(builder: Dispatchable, rule: string | (RuleMetadata & {
32
32
  id: string;
33
- }), defaultSeverity: RuleSeverity, overrides: Record<string, RuleSeverity> | undefined): ArchViolation[];
33
+ }), defaultSeverity: RuleSeverity, overrides: Record<string, RuleSeverity> | undefined): CollectResult;
34
34
  /**
35
35
  * Validate override keys against known rule IDs. Warns for unrecognized keys
36
36
  * (likely typos).
37
37
  */
38
- export declare function validateOverrides(overrides: Record<string, RuleSeverity> | undefined, knownIds: string[]): void;
39
- /**
40
- * A configuration finding for a preset call that constructed **zero** rules —
41
- * every optional capability was left off, or a required discovery pattern
42
- * (a folder glob, a repositories glob) matched nothing, so the call checked
43
- * nothing and would otherwise pass silently. The vacuity matrix
44
- * (`scripts/vacuity-matrix.mjs`) is what proves a preset needs this: it
45
- * probes every published preset at its minimal type-correct call, and a
46
- * preset reaching `fail-open` there is exactly this shape.
47
- *
48
- * Unsuppressable (ADR-010) for the same reason a zero-examined rule is: the
49
- * caller's mistake is in how the preset was configured, not in the code the
50
- * preset would have checked, and `.excluding()`/a baseline/`--changed` all
51
- * aim at the latter.
52
- *
53
- * @param presetName - The preset's own name, e.g. `'agentGuardrails'`.
54
- * @param optionsHint - The option names that would enable a rule, for the
55
- * remedy — e.g. `'noGenericErrors, noStubs, noEmptyBodies'`.
56
- */
57
- export declare function presetConstructsNothingViolation(presetName: string, optionsHint: string): ArchViolation;
58
- /**
59
- * Emit (stderr text) and throw a single `ArchRuleError` with all aggregated
60
- * violations, if any. Kept for backward compatibility; it is now `finishPreset`
61
- * in the default `throw` mode. New presets take `PresetReportOptions` and call
62
- * `finishPreset` so a caller can opt into `report: 'return'` / `--format json`
63
- * (plan 0070).
64
- */
65
- export declare function throwIfViolations(violations: ArchViolation[]): void;
66
- export {};
38
+ export declare function validateOverrides(overrides: Partial<Record<string, RuleSeverity>> | undefined, knownIds: readonly string[]): void;
67
39
  //# sourceMappingURL=preset-dispatch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preset-dispatch.d.ts","sourceRoot":"","sources":["../src/preset-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAEnD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAIpE,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;AAEnD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,SAAS,CAAC,EAAE,MAA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