@ia-qa/self-healing 1.7.8 → 1.7.11

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 (55) hide show
  1. package/README.md +37 -2
  2. package/TUTORIAL.md +45 -1
  3. package/dist/aom.d.ts +11 -0
  4. package/dist/aom.js.map +1 -1
  5. package/dist/browser/match.d.ts +10 -0
  6. package/dist/browser/match.js +16 -6
  7. package/dist/browser/match.js.map +1 -1
  8. package/dist/captureState.d.ts +66 -0
  9. package/dist/captureState.js +149 -0
  10. package/dist/captureState.js.map +1 -0
  11. package/dist/cli/args.js +4 -3
  12. package/dist/cli/args.js.map +1 -1
  13. package/dist/cli/baseline.js +22 -0
  14. package/dist/cli/baseline.js.map +1 -1
  15. package/dist/cli/diff.d.ts +35 -0
  16. package/dist/cli/diff.js +87 -11
  17. package/dist/cli/diff.js.map +1 -1
  18. package/dist/cli/emit.d.ts +17 -0
  19. package/dist/cli/emit.js +25 -0
  20. package/dist/cli/emit.js.map +1 -1
  21. package/dist/cli/exitCodes.d.ts +29 -0
  22. package/dist/cli/exitCodes.js +41 -0
  23. package/dist/cli/exitCodes.js.map +1 -0
  24. package/dist/cli/explain.js +27 -4
  25. package/dist/cli/explain.js.map +1 -1
  26. package/dist/cli/fix.d.ts +16 -0
  27. package/dist/cli/fix.js +85 -11
  28. package/dist/cli/fix.js.map +1 -1
  29. package/dist/cli/index.js +12 -1
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/cli/init.d.ts +39 -1
  32. package/dist/cli/init.js +216 -12
  33. package/dist/cli/init.js.map +1 -1
  34. package/dist/cli/map.js +51 -0
  35. package/dist/cli/map.js.map +1 -1
  36. package/dist/cli/run.js +8 -26
  37. package/dist/cli/run.js.map +1 -1
  38. package/dist/config.d.ts +45 -0
  39. package/dist/config.js.map +1 -1
  40. package/dist/explain.d.ts +27 -0
  41. package/dist/explain.js +88 -7
  42. package/dist/explain.js.map +1 -1
  43. package/dist/ingest.d.ts +13 -0
  44. package/dist/ingest.js +215 -7
  45. package/dist/ingest.js.map +1 -1
  46. package/dist/nextStep.d.ts +79 -0
  47. package/dist/nextStep.js +107 -0
  48. package/dist/nextStep.js.map +1 -0
  49. package/dist/systemicDelta.d.ts +129 -0
  50. package/dist/systemicDelta.js +164 -0
  51. package/dist/systemicDelta.js.map +1 -0
  52. package/dist/ui/server.js +5 -1
  53. package/dist/ui/server.js.map +1 -1
  54. package/package.json +1 -1
  55. package/skills/ia-qa-heal/SKILL.md +31 -2
package/dist/ingest.js CHANGED
@@ -140,6 +140,19 @@ const PATTERNS = [
140
140
  * Shared call shapes (`.type`, `.press`, `.fill`…) take text in one framework and
141
141
  * a selector in another, so a captured literal is only recorded when it *reads*
142
142
  * like a selector. A bare tag (`click('button')`) is the accepted miss.
143
+ *
144
+ * "Reads like a selector" used to mean *contains a structural character* — a `>`,
145
+ * a `[`, a leading `.`. That test cannot tell `div > span` from `age > 18`, and
146
+ * the permissive Page Object shape below offers it every `foo = '…'` in the suite,
147
+ * so a SQL condition typed into a field was inventoried as a selector. The cost
148
+ * was argued as one line in an advisory count; `explain` then made it a red gate
149
+ * (`exit 1`) pointing at a healthy test line. So the test is now *validity*, not
150
+ * presence: `18` is not a type selector, `.5` is not a class, `fix:` is not a
151
+ * pseudo. Seven of the eight parasites in the reference corpus are refused by the
152
+ * grammar alone, and none of them needed a list of known-bad shapes.
153
+ *
154
+ * What the grammar cannot see stays: `a.b.c` is a valid selector whether it names
155
+ * an element or a JWT. That residue is real and is not worth a length heuristic.
143
156
  */
144
157
  function plausibleSelector(value) {
145
158
  const v = value.trim();
@@ -161,17 +174,212 @@ function plausibleSelector(value) {
161
174
  return false;
162
175
  if (/^#[0-9a-f]{3,8}$/i.test(v))
163
176
  return false;
164
- if (/^[#.[]/.test(v))
165
- return true;
166
- if (v.includes('>>'))
177
+ return v
178
+ .split('>>')
179
+ .every((part) => selectorPart(part));
180
+ }
181
+ /** An engine-prefixed locator states its own grammar; we do not know it. */
182
+ const ENGINE_PREFIX = /^(?:text|role|xpath|css|data-testid|id|nth|visible|internal:[\w-]+)=/;
183
+ /** A bare XPath — `//button`, `(//tr)[2]`. Legal in Playwright, not CSS. */
184
+ const XPATH_START = /^\(*\/\//;
185
+ function selectorPart(part) {
186
+ const p = part.trim();
187
+ if (p === '')
188
+ return false;
189
+ if (ENGINE_PREFIX.test(p))
167
190
  return true;
168
- if (/[>[\]]/.test(v))
191
+ if (XPATH_START.test(p))
169
192
  return true;
170
- if (/^[a-z][a-z0-9-]*[#.:]/i.test(v))
193
+ return isSelectorShaped(p);
194
+ }
195
+ // Non-ASCII is a legal CSS identifier character — `.café` and `.日本語` are classes.
196
+ const NON_ASCII = '\u0080';
197
+ const BACKSLASH = '\u005c';
198
+ const isIdentStart = (c) => /[A-Za-z_]/.test(c) || c === BACKSLASH || c >= NON_ASCII;
199
+ const isIdentChar = (c) => /[-A-Za-z0-9_]/.test(c) || c === BACKSLASH || c >= NON_ASCII;
200
+ /**
201
+ * Every element name a browser can be asked for by type, plus the SVG ones a test
202
+ * realistically queries. A closed set, and that is the point: a type selector names
203
+ * an *element*, so anything outside this list has to look like a custom element to
204
+ * be admitted at all.
205
+ */
206
+ const HTML_TAGS = new Set(('a abbr address area article aside audio b base bdi bdo big blockquote body br button canvas caption ' +
207
+ 'cite code col colgroup data datalist dd del details dfn dialog div dl dt em embed fieldset figcaption ' +
208
+ 'figure footer form h1 h2 h3 h4 h5 h6 head header hgroup hr html i iframe img input ins kbd label ' +
209
+ 'legend li link main map mark menu meta meter nav noscript object ol optgroup option output p param ' +
210
+ 'picture pre progress q rp rt ruby s samp script search section select slot small source span strong ' +
211
+ 'style sub summary sup table tbody td template textarea tfoot th thead time title tr track u ul var ' +
212
+ 'video wbr ' +
213
+ 'svg circle ellipse g line path polygon polyline rect stop text tspan use defs symbol foreignObject')
214
+ .split(' '));
215
+ /**
216
+ * Can this identifier be an element name?
217
+ *
218
+ * The grammar alone cannot tell `div.active` from `demo_tool.input.free` — a JSON
219
+ * schema path is a perfectly well-formed `tag.class.class`, and the reference corpus
220
+ * holds eleven of them. HTML settles it: an element is either a known tag or a custom
221
+ * element, and a custom element must start lowercase, must contain a hyphen, and may
222
+ * never contain an underscore. `demo_tool` fails all three; `app-root`, `mat-button`
223
+ * and `ion-select` pass, which is what this rule exists to protect.
224
+ *
225
+ * A placeholder is unknowable, so `${tag}.foo` is admitted rather than guessed at.
226
+ */
227
+ function plausibleTypeName(name) {
228
+ if (name.indexOf('${') !== -1)
171
229
  return true;
172
- if (/^(?:text|role|xpath|css|data-testid)=/.test(v))
230
+ if (HTML_TAGS.has(name.toLowerCase()))
173
231
  return true;
174
- return false;
232
+ return /^[a-z][a-z0-9.]*-[a-z0-9.-]*$/.test(name);
233
+ }
234
+ /**
235
+ * Is `sel` a well-formed CSS selector that actually *qualifies* something?
236
+ *
237
+ * Three conditions, all load-bearing. Well-formed rejects `age > 18` and `v1.5.1`.
238
+ * Element-named rejects `demo_tool.input.free`. Qualified — at least one `#`, `.`,
239
+ * `[`, `:` or an explicit combinator — rejects `hello world`, which the grammar alone
240
+ * would happily read as two type selectors. A bare tag was already the accepted miss;
241
+ * two bare tags are the same miss, and admitting them would inventory every two-word
242
+ * English string.
243
+ */
244
+ function isSelectorShaped(sel) {
245
+ let i = 0;
246
+ let qualified = false;
247
+ const n = sel.length;
248
+ const skipWs = () => {
249
+ const from = i;
250
+ while (i < n && /\s/.test(sel[i]))
251
+ i++;
252
+ return i > from;
253
+ };
254
+ /** Consume a balanced `[...]` / `(...)`, quotes honoured. Depth, not first close. */
255
+ const skipBalanced = (open, close) => {
256
+ let depth = 0;
257
+ while (i < n) {
258
+ const c = sel[i];
259
+ if (c === '"' || c === "'") {
260
+ const q = c;
261
+ i++;
262
+ while (i < n && sel[i] !== q)
263
+ i += sel[i] === '\\' ? 2 : 1;
264
+ if (i >= n)
265
+ return false;
266
+ i++;
267
+ continue;
268
+ }
269
+ if (c === open)
270
+ depth++;
271
+ else if (c === close) {
272
+ depth--;
273
+ i++;
274
+ if (depth === 0)
275
+ return true;
276
+ continue;
277
+ }
278
+ i++;
279
+ }
280
+ return false;
281
+ };
282
+ /**
283
+ * An identifier, plus the one non-CSS token that belongs here: `${…}`. A
284
+ * template placeholder is opaque to every consumer of this inventory, but
285
+ * `#row-${id}` is an ordinary selector and refusing it would drop a real one.
286
+ */
287
+ const readIdent = () => {
288
+ const from = i;
289
+ if (i < n && sel[i] === '$' && sel[i + 1] === '{') {
290
+ i++;
291
+ if (!skipBalanced('{', '}'))
292
+ return false;
293
+ }
294
+ else {
295
+ if (i >= n || !isIdentStart(sel[i]))
296
+ return false;
297
+ if (sel[i] === '\\')
298
+ i++;
299
+ i++;
300
+ }
301
+ while (i < n) {
302
+ if (sel[i] === '$' && sel[i + 1] === '{') {
303
+ i++;
304
+ if (!skipBalanced('{', '}'))
305
+ return false;
306
+ continue;
307
+ }
308
+ if (!isIdentChar(sel[i]))
309
+ break;
310
+ i += sel[i] === '\\' ? 2 : 1;
311
+ }
312
+ return i > from;
313
+ };
314
+ const readCompound = () => {
315
+ let pieces = 0;
316
+ if (i < n && sel[i] === '*') {
317
+ i++;
318
+ pieces++;
319
+ }
320
+ else if (i < n && (isIdentStart(sel[i]) || (sel[i] === '$' && sel[i + 1] === '{'))) {
321
+ const from = i;
322
+ if (!readIdent())
323
+ return false;
324
+ if (!plausibleTypeName(sel.slice(from, i)))
325
+ return false;
326
+ pieces++;
327
+ }
328
+ for (;;) {
329
+ const c = sel[i];
330
+ if (c === '#' || c === '.') {
331
+ i++;
332
+ if (!readIdent())
333
+ return false;
334
+ }
335
+ else if (c === '[') {
336
+ if (!skipBalanced('[', ']'))
337
+ return false;
338
+ }
339
+ else if (c === ':') {
340
+ i++;
341
+ if (sel[i] === ':')
342
+ i++;
343
+ if (!readIdent())
344
+ return false;
345
+ if (sel[i] === '(' && !skipBalanced('(', ')'))
346
+ return false;
347
+ }
348
+ else
349
+ break;
350
+ pieces++;
351
+ qualified = true;
352
+ }
353
+ return pieces > 0;
354
+ };
355
+ skipWs();
356
+ if (i < n && '>+~'.indexOf(sel[i]) !== -1) {
357
+ i++;
358
+ qualified = true;
359
+ skipWs();
360
+ }
361
+ for (;;) {
362
+ if (!readCompound())
363
+ return false;
364
+ const hadWs = skipWs();
365
+ if (i >= n)
366
+ break;
367
+ const c = sel[i];
368
+ if (c === ',') {
369
+ i++;
370
+ skipWs();
371
+ continue;
372
+ }
373
+ if ('>+~'.indexOf(c) !== -1) {
374
+ i++;
375
+ qualified = true;
376
+ skipWs();
377
+ continue;
378
+ }
379
+ if (!hadWs)
380
+ return false;
381
+ }
382
+ return qualified;
175
383
  }
176
384
  function scanText(text, file) {
177
385
  const out = [];
@@ -1 +1 @@
1
- {"version":3,"file":"ingest.js","sourceRoot":"","sources":["../src/ingest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,8BAEC;AA4ED,8CAqBC;AAED,4BAmBC;AAOD,kCAyBC;AA0BD,oDAkCC;AAED,8BAKC;AAED,8BAUC;AAQD,gCAaC;AA5TD,uCAAyB;AACzB,2CAA6B;AAC7B,qCAAyD;AACzD,2CAA4E;AAC5E,iDAA2E;AAC3E,2CAAqD;AAuCxC,QAAA,cAAc,GAAG,YAAY,CAAC;AAE3C;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,SAAS,CAAC,MAAc,IAAA,gBAAO,GAAE;IAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,mBAAU,EAAE,sBAAc,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,MAAM,GAAG,4BAA4B,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,cAAc,GAAG,sBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,+BAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7E,MAAM,WAAW,GAAG,sBAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EA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D,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAAa,EAAE,CAAC;IACzB,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACd,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChB,CAAC;IACH,CAAC,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;QAAE,KAAK,MAAM,CAAC,IAAI,KAAK;YAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACvF,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QAAE,KAAK,MAAM,CAAC,IAAI,KAAK;YAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzF,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Two fields an agent needs and a terminal does not: how sure the tool is about one
3
+ * proposed rewrite, and what to run next.
4
+ *
5
+ * Both are **derived**, never scored. Every value below is a rename of information the
6
+ * matcher already produced — `matchType`, `status`, the verdict ladder. Inventing a
7
+ * confidence index here would be the uncalibrated-judge anti-pattern wearing a
8
+ * deterministic tool's clothes: a number that looks like evidence, is not, and that a
9
+ * model would branch on precisely because it looks like one.
10
+ *
11
+ * A human reads the same facts off the terminal's own wording ("the element exists, only
12
+ * its class changed"). This is that sentence, in a field.
13
+ */
14
+ /**
15
+ * How safe one proposed rewrite is.
16
+ *
17
+ * `ambiguous` is deliberately not a low number. A number invites a threshold, and a
18
+ * threshold over "17 candidates matched equally well" would let an agent apply one of
19
+ * them — the coin flip this package refuses everywhere else. It is a different *kind* of
20
+ * answer, so it gets a different word.
21
+ */
22
+ export type Confidence = 'high' | 'medium' | 'ambiguous' | 'none';
23
+ export interface ConfidenceInput {
24
+ status: string;
25
+ matchType?: 'exact' | 'fuzzy';
26
+ rebound?: boolean;
27
+ }
28
+ /**
29
+ * `rebound` deliberately does **not** lower confidence, and getting this backwards is
30
+ * easy enough that it is worth writing down.
31
+ *
32
+ * A first version treated the flag as "danger, do not touch" and zeroed out every rewrite
33
+ * carrying it — 12 of 401 on the reference corpus. That inverts its meaning. On a
34
+ * *contract row*, `match.js` sets `rebound` alongside `healable` when the old selector now
35
+ * resolves onto a **different** element and the original was re-identified elsewhere: the
36
+ * test is green today while clicking the wrong thing, and `old → new` is the repair that
37
+ * cures exactly that. It is the highest-value rewrite this tool produces.
38
+ *
39
+ * What `rebound` *does* is raise the verdict to BLOCK so a human sees it before it is
40
+ * applied. That is a gate concern, not a confidence one, and the flag travels on the row
41
+ * for anyone who needs it. (The `rebound` of `resolution.ts` is a different thing under
42
+ * the same name — there a test's own literal reaches a new element with nothing proving
43
+ * what it should reach, and it is never rewritten.)
44
+ */
45
+ export declare function confidenceFor(row: ConfidenceInput): Confidence;
46
+ export interface NextStep {
47
+ /** A command to run, or `null` when the honest answer is "not yours to run". */
48
+ next_command: string | null;
49
+ /** Why — one sentence, the same one the terminal prints. */
50
+ next: string;
51
+ }
52
+ /**
53
+ * What to do with this verdict.
54
+ *
55
+ * BLOCK returns a **null command**, and that is the load-bearing case. The console is
56
+ * where a human picks between candidates, and the skill forbids an agent from starting
57
+ * it (it blocks until a browser tab closes). Naming a command here that an agent must
58
+ * not run would put this file in direct conflict with that prohibition — so BLOCK says
59
+ * what it is instead: a decision, and not this caller's.
60
+ */
61
+ export declare function nextStepFor(verdict: 'PASS' | 'FIX' | 'BLOCK', opts?: {
62
+ dirMode?: boolean;
63
+ systemicUnresolved?: boolean;
64
+ }): NextStep;
65
+ /**
66
+ * The version of the JSON these verbs emit.
67
+ *
68
+ * Added the day the first rename was refused. `healable` means two quantities — contract
69
+ * rows in `diff`, rewrite pairs in `fix` — and the terminal wording now separates them
70
+ * ("drifted" and "rewrites"). The *field names* deliberately did not move: the zero-install
71
+ * web tool reads `row.status === 'healable'` and `counts.healable` straight out of the same
72
+ * `match.js` that ships to npm, so renaming the status would blank that page unless both
73
+ * deploys landed together — silently, showing zero rows rather than an error.
74
+ *
75
+ * So the field names stay and this number exists, which is the honest trade: a consumer can
76
+ * pin it, and the day the rename is worth two coordinated deploys it becomes `2` instead of
77
+ * being a breaking change nobody was warned about.
78
+ */
79
+ export declare const SCHEMA_VERSION = 1;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ /**
3
+ * Two fields an agent needs and a terminal does not: how sure the tool is about one
4
+ * proposed rewrite, and what to run next.
5
+ *
6
+ * Both are **derived**, never scored. Every value below is a rename of information the
7
+ * matcher already produced — `matchType`, `status`, the verdict ladder. Inventing a
8
+ * confidence index here would be the uncalibrated-judge anti-pattern wearing a
9
+ * deterministic tool's clothes: a number that looks like evidence, is not, and that a
10
+ * model would branch on precisely because it looks like one.
11
+ *
12
+ * A human reads the same facts off the terminal's own wording ("the element exists, only
13
+ * its class changed"). This is that sentence, in a field.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.SCHEMA_VERSION = void 0;
17
+ exports.confidenceFor = confidenceFor;
18
+ exports.nextStepFor = nextStepFor;
19
+ /**
20
+ * `rebound` deliberately does **not** lower confidence, and getting this backwards is
21
+ * easy enough that it is worth writing down.
22
+ *
23
+ * A first version treated the flag as "danger, do not touch" and zeroed out every rewrite
24
+ * carrying it — 12 of 401 on the reference corpus. That inverts its meaning. On a
25
+ * *contract row*, `match.js` sets `rebound` alongside `healable` when the old selector now
26
+ * resolves onto a **different** element and the original was re-identified elsewhere: the
27
+ * test is green today while clicking the wrong thing, and `old → new` is the repair that
28
+ * cures exactly that. It is the highest-value rewrite this tool produces.
29
+ *
30
+ * What `rebound` *does* is raise the verdict to BLOCK so a human sees it before it is
31
+ * applied. That is a gate concern, not a confidence one, and the flag travels on the row
32
+ * for anyone who needs it. (The `rebound` of `resolution.ts` is a different thing under
33
+ * the same name — there a test's own literal reaches a new element with nothing proving
34
+ * what it should reach, and it is never rewritten.)
35
+ */
36
+ function confidenceFor(row) {
37
+ switch (row.status) {
38
+ case 'ok':
39
+ case 'renamed':
40
+ // Nothing is being proposed, so nothing needs weighing.
41
+ return 'high';
42
+ case 'healable':
43
+ // The element survived and was re-identified. `exact` means role, name and context
44
+ // all still agree — the "only its class changed" case, which is a safe rewrite.
45
+ // `fuzzy` cleared the similarity threshold and is a proposal, not a certainty.
46
+ return row.matchType === 'fuzzy' ? 'medium' : 'high';
47
+ case 'ambiguous':
48
+ return 'ambiguous';
49
+ default:
50
+ // `lost`, `added`, and anything a future status introduces: no repair is on offer,
51
+ // so there is nothing to be confident about. Unknown statuses land here on purpose.
52
+ return 'none';
53
+ }
54
+ }
55
+ /**
56
+ * What to do with this verdict.
57
+ *
58
+ * BLOCK returns a **null command**, and that is the load-bearing case. The console is
59
+ * where a human picks between candidates, and the skill forbids an agent from starting
60
+ * it (it blocks until a browser tab closes). Naming a command here that an agent must
61
+ * not run would put this file in direct conflict with that prohibition — so BLOCK says
62
+ * what it is instead: a decision, and not this caller's.
63
+ */
64
+ function nextStepFor(verdict, opts = {}) {
65
+ const scope = opts.dirMode === false ? '' : ' --dir';
66
+ if (opts.systemicUnresolved) {
67
+ // Ranked above the verdict on purpose: while a cross-page group is unexplained, every
68
+ // other number in the report is measured against a capture nobody has vouched for.
69
+ return {
70
+ next_command: `ia-qa-heal map && ia-qa-heal baseline`,
71
+ next: 'The same element moved on every page at once and the capture state cannot explain it. ' +
72
+ 'Re-map and re-baseline so the next diff can tell an app change from a state difference — ' +
73
+ 'or declare the state in config.prepare.',
74
+ };
75
+ }
76
+ switch (verdict) {
77
+ case 'PASS':
78
+ return { next_command: null, next: 'Nothing drifted. No action.' };
79
+ case 'FIX':
80
+ return {
81
+ next_command: `ia-qa-heal fix${scope} --dry-run`,
82
+ next: 'Every break has a deterministic rewrite. Read the plan, then run it again without --dry-run.',
83
+ };
84
+ case 'BLOCK':
85
+ return {
86
+ next_command: null,
87
+ next: 'A human decides. Nothing here is safe to rewrite — surface the rows and their file:line, ' +
88
+ 'and do not run `ia-qa-heal ui` yourself: it blocks until a browser tab is closed.',
89
+ };
90
+ }
91
+ }
92
+ /**
93
+ * The version of the JSON these verbs emit.
94
+ *
95
+ * Added the day the first rename was refused. `healable` means two quantities — contract
96
+ * rows in `diff`, rewrite pairs in `fix` — and the terminal wording now separates them
97
+ * ("drifted" and "rewrites"). The *field names* deliberately did not move: the zero-install
98
+ * web tool reads `row.status === 'healable'` and `counts.healable` straight out of the same
99
+ * `match.js` that ships to npm, so renaming the status would blank that page unless both
100
+ * deploys landed together — silently, showing zero rows rather than an error.
101
+ *
102
+ * So the field names stay and this number exists, which is the honest trade: a consumer can
103
+ * pin it, and the day the rename is worth two coordinated deploys it becomes `2` instead of
104
+ * being a breaking change nobody was warned about.
105
+ */
106
+ exports.SCHEMA_VERSION = 1;
107
+ //# sourceMappingURL=nextStep.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextStep.js","sourceRoot":"","sources":["../src/nextStep.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAmCH,sCAkBC;AAkBD,kCAkCC;AAvFD;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,aAAa,CAAC,GAAoB;IAChD,QAAQ,GAAG,CAAC,MAAM,EAAE,CAAC;QACnB,KAAK,IAAI,CAAC;QACV,KAAK,SAAS;YACZ,wDAAwD;YACxD,OAAO,MAAM,CAAC;QAChB,KAAK,UAAU;YACb,mFAAmF;YACnF,gFAAgF;YAChF,+EAA+E;YAC/E,OAAO,GAAG,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;QACvD,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB;YACE,mFAAmF;YACnF,oFAAoF;YACpF,OAAO,MAAM,CAAC;IAClB,CAAC;AACH,CAAC;AASD;;;;;;;;GAQG;AACH,SAAgB,WAAW,CACzB,OAAiC,EACjC,OAA4D,EAAE;IAE9D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC;IAErD,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC5B,sFAAsF;QACtF,mFAAmF;QACnF,OAAO;YACL,YAAY,EAAE,uCAAuC;YACrD,IAAI,EACF,wFAAwF;gBACxF,2FAA2F;gBAC3F,yCAAyC;SAC5C,CAAC;IACJ,CAAC;IAED,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,MAAM;YACT,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,6BAA6B,EAAE,CAAC;QACrE,KAAK,KAAK;YACR,OAAO;gBACL,YAAY,EAAE,iBAAiB,KAAK,YAAY;gBAChD,IAAI,EAAE,8FAA8F;aACrG,CAAC;QACJ,KAAK,OAAO;YACV,OAAO;gBACL,YAAY,EAAE,IAAI;gBAClB,IAAI,EACF,2FAA2F;oBAC3F,mFAAmF;aACtF,CAAC;IACN,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACU,QAAA,cAAc,GAAG,CAAC,CAAC"}
@@ -0,0 +1,129 @@
1
+ import { CaptureState, StateComparison } from './captureState';
2
+ /**
3
+ * The same element missing from every page is one fact, not one fact per page.
4
+ *
5
+ * Measured on a 142-page app whose suite was green and whose site was sound:
6
+ * `diff --dir` returned ⛔ BLOCK on 139 of 142 pages, 288 `lost` rows, exactly two
7
+ * per page. Behind all 288: two buttons of a cookie banner, present in a baseline
8
+ * captured before consent and absent from a capture taken after it. The app had not
9
+ * moved. Nobody triages 288 rows to find that out, and a gate that shouts on a
10
+ * healthy app is a gate that gets turned off.
11
+ *
12
+ * This module is the missing half of a de-duplication the package already performs
13
+ * twice elsewhere — `check` collapses a finding repeated across pages ("a navbar on
14
+ * 142 pages is one fix, not 142 findings") and `_layouts/` lifts the shared shell out
15
+ * of the contracts structurally. Neither reaches the *verdict*, which is where the
16
+ * cost lands.
17
+ *
18
+ * **What it is not.** It is not a filter on noisy rows, and it is emphatically not
19
+ * driven by `usage.json`. The first version of this idea held out rows no test
20
+ * referenced; on the very corpus that motivated it, `usage.names` held both `reject`
21
+ * and `accept all` — a spec tests that banner on purpose — so the rule would have
22
+ * fired on nothing at all. What separates the two cases is not who references the
23
+ * element; it is that *one page's worth of change explains every page's rows*.
24
+ *
25
+ * **Why it lives outside `src/browser/match.js`**, like `nameDrift.ts` and
26
+ * `nameMask.ts`: that file ships twice (npm + the zero-install web tool), stays
27
+ * dependency-free, and — decisively here — compares exactly two pages. A cross-page
28
+ * fact is unrepresentable there. The same boundary is why the MCP tools
29
+ * `diff_mappings` and `fix_tests` are out of scope rather than divergent: they take
30
+ * two files, and two files cannot show that something is true of every page. With
31
+ * one page compared, this module returns no groups, so a single-page `diff` is
32
+ * bit-for-bit what it was before.
33
+ */
34
+ export interface SystemicRowLike {
35
+ status: string;
36
+ role?: string;
37
+ name?: string;
38
+ rebound?: boolean;
39
+ }
40
+ export interface SystemicReportLike {
41
+ verdict: 'PASS' | 'FIX' | 'BLOCK';
42
+ counts: Record<string, number>;
43
+ rows: SystemicRowLike[];
44
+ added: SystemicRowLike[];
45
+ }
46
+ export interface SystemicPageLike {
47
+ name: string;
48
+ report: SystemicReportLike;
49
+ isLayout: boolean;
50
+ }
51
+ export interface SystemicGroup {
52
+ /** `lost` — gone from every page. `added` — appeared on every page. */
53
+ kind: 'lost' | 'added';
54
+ role: string;
55
+ name: string;
56
+ /** The pages carrying this row, in walk order. */
57
+ pages: string[];
58
+ /**
59
+ * Pages whose contract holds this element at all — the denominator. A control that
60
+ * only ever existed on the 40 tool pages is systemic when it leaves all 40, not
61
+ * when it leaves 40 of 142.
62
+ */
63
+ seenOn: number;
64
+ }
65
+ /**
66
+ * Whether the groups were held out of the verdict, and on what evidence.
67
+ *
68
+ * `in-verdict` is not a failure mode — it is the honest answer whenever the capture
69
+ * state cannot exonerate the app. A navbar the app really deleted produces exactly
70
+ * the same rows as a banner that was merely dismissed, and letting that through as a
71
+ * pass is worse than every false BLOCK this module exists to remove.
72
+ */
73
+ export type SystemicPolicy = 'held-out' | 'in-verdict';
74
+ export interface SystemicOutcome {
75
+ groups: SystemicGroup[];
76
+ policy: SystemicPolicy;
77
+ /** How the two moments' capture state compared — the reason for the policy. */
78
+ state: StateComparison;
79
+ baselineState?: CaptureState;
80
+ currentState?: CaptureState;
81
+ }
82
+ /**
83
+ * A group must cover this many pages before it can be called systemic.
84
+ *
85
+ * Below it the collapse buys nothing (five rows is a list, not a wall) while still
86
+ * costing the ability to see them per page. It also keeps small projects — a
87
+ * three-page app where everything is on every page — entirely out of this code path.
88
+ */
89
+ export declare const MIN_PAGES = 5;
90
+ /**
91
+ * …and this share of the pages that held the element. Deliberately not 1.0: one page
92
+ * whose capture happened to catch the banner mid-animation should not turn a
93
+ * 142-page fact back into 142 facts.
94
+ */
95
+ export declare const MIN_SHARE = 0.9;
96
+ /**
97
+ * Find the cross-page groups. Pure — no policy, no state, no I/O.
98
+ *
99
+ * Layout pages are excluded from both numerator and denominator: `_layouts/` already
100
+ * holds one row for the whole shell, so counting it would let a single layout row
101
+ * pull a group over the threshold on its own.
102
+ */
103
+ export declare function findSystemicGroups(pages: SystemicPageLike[]): SystemicGroup[];
104
+ /**
105
+ * Detection plus policy.
106
+ *
107
+ * The policy is one line and it carries the whole risk of the feature: a group leaves
108
+ * the verdict **only** when the two captures are known to have run under different
109
+ * browser state. Identical state means the app really did change — that is a finding,
110
+ * collapsed to one row but still red. Unknown state (any baseline written before
111
+ * fingerprints existed) is also red, because "I cannot tell" and "they match" must
112
+ * not lead to the same place.
113
+ */
114
+ export declare function assessSystemic(pages: SystemicPageLike[], baselineState?: CaptureState, currentState?: CaptureState): SystemicOutcome;
115
+ /**
116
+ * Remove the held-out rows and re-derive each page's verdict.
117
+ *
118
+ * Returns fresh report objects: the caller's reports are the ones the HTML report and
119
+ * the JUnit writer read, and mutating them in place would make the collapse depend on
120
+ * which consumer ran first. Counts are recomputed from the surviving rows rather than
121
+ * decremented, so a status this module does not know about cannot silently skew them.
122
+ *
123
+ * `total` is left alone on purpose. It is the size of the baseline contract, not a
124
+ * tally of rows — lowering it would quietly shrink the denominator every coverage
125
+ * line in the tool is computed against.
126
+ */
127
+ export declare function applySystemic(pages: SystemicPageLike[], outcome: SystemicOutcome): SystemicPageLike[];
128
+ /** One line for the terminal and the report, or null when nothing is systemic. */
129
+ export declare function systemicHeadline(outcome: SystemicOutcome): string | null;