@decocms/parity 0.34.4 → 0.34.5

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 (2) hide show
  1. package/dist/cli.js +353 -92
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -75778,7 +75778,7 @@ See: https://github.com/dequelabs/axe-core/blob/master/doc/context.md`));
75778
75778
 
75779
75779
  // src/cli.ts
75780
75780
  import { DESCRIPTION, registerCommands } from "@decocms/vtex-cms";
75781
- import chalk45 from "chalk";
75781
+ import chalk46 from "chalk";
75782
75782
  import { Command, InvalidArgumentError as InvalidArgumentError2 } from "commander";
75783
75783
 
75784
75784
  // src/commands/ab-detect.ts
@@ -118253,8 +118253,258 @@ async function reportCommand(runId, opts) {
118253
118253
  return 0;
118254
118254
  }
118255
118255
 
118256
- // src/commands/states.ts
118256
+ // src/commands/rerender.ts
118257
+ import { writeFileSync as writeFileSync36 } from "node:fs";
118257
118258
  import chalk39 from "chalk";
118259
+ function analyzeFrames(before, frames, opts = {}) {
118260
+ const threshold = opts.flashWhite ?? Math.min(97, before.white + 20);
118261
+ const flashes = [];
118262
+ let open = null;
118263
+ for (const f of frames) {
118264
+ if (f.white >= threshold) {
118265
+ if (!open)
118266
+ open = { from: f.t, to: f.t, peakWhite: f.white };
118267
+ open.to = f.t;
118268
+ open.peakWhite = Math.max(open.peakWhite, f.white);
118269
+ } else if (open) {
118270
+ flashes.push(open);
118271
+ open = null;
118272
+ }
118273
+ }
118274
+ if (open)
118275
+ flashes.push(open);
118276
+ const delta = opts.settleDelta ?? 0.5;
118277
+ let settledAt = frames.length ? 0 : null;
118278
+ for (let i = 1;i < frames.length; i++)
118279
+ if (Math.abs(frames[i].changed - frames[i - 1].changed) > delta)
118280
+ settledAt = frames[i].t;
118281
+ return { flashes, settledAt };
118282
+ }
118283
+ async function scoreFrames(page, base, frames) {
118284
+ return page.evaluate(async ({ base, frames }) => {
118285
+ const load = (b64) => new Promise((resolve, reject) => {
118286
+ const img = new Image;
118287
+ img.onload = () => {
118288
+ const c = document.createElement("canvas");
118289
+ c.width = 320;
118290
+ c.height = Math.round(img.height / img.width * 320);
118291
+ const ctx = c.getContext("2d");
118292
+ ctx.drawImage(img, 0, 0, c.width, c.height);
118293
+ resolve(ctx.getImageData(0, 0, c.width, c.height));
118294
+ };
118295
+ img.onerror = reject;
118296
+ img.src = `data:image/jpeg;base64,${b64}`;
118297
+ });
118298
+ const lum = (d, i) => 0.299 * d[i] + 0.587 * d[i + 1] + 0.114 * d[i + 2];
118299
+ const b = await load(base);
118300
+ const out = [];
118301
+ for (const f of frames) {
118302
+ const im = await load(f);
118303
+ let white = 0;
118304
+ let changed = 0;
118305
+ const n = im.data.length / 4;
118306
+ for (let i = 0;i < im.data.length; i += 4) {
118307
+ const l = lum(im.data, i);
118308
+ if (l > 245)
118309
+ white++;
118310
+ if (i < b.data.length && Math.abs(l - lum(b.data, i)) > 30)
118311
+ changed++;
118312
+ }
118313
+ out.push({ white: white / n * 100, changed: changed / n * 100 });
118314
+ }
118315
+ return out;
118316
+ }, { base, frames });
118317
+ }
118318
+ var SKELETON = "[class*='skeleton' i], .animate-pulse, [aria-busy='true'], .loading";
118319
+ async function rerenderCommand(opts) {
118320
+ if (!opts.selector && !opts.text) {
118321
+ console.error(chalk39.red("pass --selector or --text"));
118322
+ return 2;
118323
+ }
118324
+ const browser = await launchBrowser({ headless: true });
118325
+ try {
118326
+ const ctx = await newContext(browser, { viewport: opts.viewport });
118327
+ const page = await ctx.newPage();
118328
+ await page.goto(opts.url, { waitUntil: "domcontentloaded", timeout: 30000 });
118329
+ await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
118330
+ return;
118331
+ });
118332
+ await page.waitForTimeout(2000);
118333
+ const urlBefore = page.url();
118334
+ await page.evaluate((skeletonSel) => {
118335
+ const w = window;
118336
+ const regionOf = (n) => {
118337
+ let el = n && (n.nodeType === 1 ? n : n.parentElement);
118338
+ while (el && el !== document.body) {
118339
+ if (el.matches("header, footer, section, [data-manifest-key], [data-section]"))
118340
+ return el;
118341
+ el = el.parentElement;
118342
+ }
118343
+ return null;
118344
+ };
118345
+ const nameOf = (el) => !el ? "page" : el.getAttribute("data-manifest-key") || el.getAttribute("data-section") || el.tagName.toLowerCase() + (el.id ? `#${el.id}` : "");
118346
+ const tops = Array.from(document.querySelectorAll("header, footer, section, [data-manifest-key], [data-section]")).filter((el) => !el.parentElement?.closest("header, footer, section, [data-manifest-key], [data-section]"));
118347
+ w.__before = new Map(tops.map((el) => [nameOf(el), new WeakRef(el)]));
118348
+ const changes = {};
118349
+ const skeletons = {};
118350
+ w.__changes = changes;
118351
+ w.__skeletons = skeletons;
118352
+ new MutationObserver((ms) => {
118353
+ for (const m of ms) {
118354
+ const r = nameOf(regionOf(m.target));
118355
+ changes[r] ??= { added: 0, removed: 0, attrs: 0, text: 0 };
118356
+ const c = changes[r];
118357
+ if (m.type === "childList") {
118358
+ c.added += m.addedNodes.length;
118359
+ c.removed += m.removedNodes.length;
118360
+ for (const n of m.addedNodes)
118361
+ if (n.nodeType === 1) {
118362
+ const el = n;
118363
+ const k = (el.matches(skeletonSel) ? 1 : 0) + el.querySelectorAll(skeletonSel).length;
118364
+ if (k)
118365
+ skeletons[r] = (skeletons[r] ?? 0) + k;
118366
+ }
118367
+ } else if (m.type === "attributes")
118368
+ c.attrs++;
118369
+ else
118370
+ c.text++;
118371
+ }
118372
+ }).observe(document.body, {
118373
+ subtree: true,
118374
+ childList: true,
118375
+ attributes: true,
118376
+ characterData: true
118377
+ });
118378
+ w.__nameOf = nameOf;
118379
+ }, SKELETON);
118380
+ const requests = [];
118381
+ const onReq = (r) => {
118382
+ if (["xhr", "fetch", "document"].includes(r.resourceType()))
118383
+ requests.push(`${r.method()} ${r.url().replace(/^https?:\/\/[^/]+/, "").slice(0, 100)}`);
118384
+ };
118385
+ page.on("request", onReq);
118386
+ const cdp = await ctx.newCDPSession(page);
118387
+ const frames = [];
118388
+ let t0 = 0;
118389
+ cdp.on("Page.screencastFrame", async (f) => {
118390
+ frames.push({ t: t0 ? Date.now() - t0 : -1, data: f.data });
118391
+ await cdp.send("Page.screencastFrameAck", { sessionId: f.sessionId }).catch(() => {
118392
+ return;
118393
+ });
118394
+ });
118395
+ await cdp.send("Page.startScreencast", { format: "jpeg", quality: 50, everyNthFrame: 1 });
118396
+ await page.waitForTimeout(400);
118397
+ const target = (opts.selector ? page.locator(opts.selector) : page.getByText(opts.text, { exact: true })).filter({ visible: true }).first();
118398
+ t0 = Date.now();
118399
+ const clicked = await target.click({ timeout: 5000 }).then(() => true).catch(() => false);
118400
+ if (!clicked) {
118401
+ console.error(chalk39.yellow("target not clickable — nothing measured"));
118402
+ return 2;
118403
+ }
118404
+ await page.waitForTimeout(opts.settleMs);
118405
+ await cdp.send("Page.stopScreencast").catch(() => {
118406
+ return;
118407
+ });
118408
+ page.off("request", onReq);
118409
+ const dom = await page.evaluate(() => {
118410
+ const w = window;
118411
+ const before = w.__before;
118412
+ const changes = w.__changes;
118413
+ const remounted = [];
118414
+ for (const [name, ref] of before) {
118415
+ const el = ref.deref();
118416
+ if (!el || !el.isConnected)
118417
+ remounted.push(name);
118418
+ }
118419
+ return { remounted, changes, skeletons: w.__skeletons };
118420
+ });
118421
+ const pre = frames.filter((f) => f.t < 0);
118422
+ const post = frames.filter((f) => f.t >= 0);
118423
+ const base = pre[pre.length - 1] ?? post[0];
118424
+ const scorer = await ctx.newPage();
118425
+ const scores = base ? await scoreFrames(scorer, base.data, post.map((f) => f.data)) : [];
118426
+ const baseScore = base ? (await scoreFrames(scorer, base.data, [base.data]))[0] : { white: 0, changed: 0 };
118427
+ const stats = post.map((f, i) => ({ t: f.t, ...scores[i] }));
118428
+ const { flashes, settledAt } = analyzeFrames(baseScore, stats);
118429
+ const names = new Set([...Object.keys(dom.changes), ...dom.remounted]);
118430
+ const regions = [...names].map((region) => ({
118431
+ region,
118432
+ remounted: dom.remounted.includes(region),
118433
+ ...dom.changes[region] ?? { added: 0, removed: 0, attrs: 0, text: 0 }
118434
+ })).sort((a, b) => Number(b.remounted) - Number(a.remounted) || b.added + b.removed - (a.added + a.removed));
118435
+ const report = {
118436
+ urlBefore,
118437
+ urlAfter: page.url(),
118438
+ requests,
118439
+ regions,
118440
+ skeletons: Object.entries(dom.skeletons).map(([region, count]) => ({ region, count })),
118441
+ flashes,
118442
+ settledAt,
118443
+ frames: post.length
118444
+ };
118445
+ if (opts.sheet && base) {
118446
+ const pick = new Set([0]);
118447
+ for (const fl of flashes) {
118448
+ const i = stats.findIndex((s) => s.t === fl.from);
118449
+ if (i >= 0)
118450
+ pick.add(i);
118451
+ const j = stats.findIndex((s) => s.t > fl.to);
118452
+ if (j >= 0)
118453
+ pick.add(j);
118454
+ }
118455
+ pick.add(stats.length - 1);
118456
+ const chosen = [...pick].sort((a, b) => a - b).map((i) => post[i]);
118457
+ const png = await scorer.evaluate(async (imgs) => {
118458
+ const load = (b64) => new Promise((res) => {
118459
+ const im = new Image;
118460
+ im.onload = () => res(im);
118461
+ im.src = `data:image/jpeg;base64,${b64}`;
118462
+ });
118463
+ const els = await Promise.all(imgs.map((x) => load(x.data)));
118464
+ const w = 480;
118465
+ const h = Math.round(els[0].height / els[0].width * w);
118466
+ const c = document.createElement("canvas");
118467
+ c.width = w * els.length;
118468
+ c.height = h + 24;
118469
+ const g = c.getContext("2d");
118470
+ g.fillStyle = "#111";
118471
+ g.fillRect(0, 0, c.width, c.height);
118472
+ els.forEach((im, i) => {
118473
+ g.drawImage(im, i * w, 24, w, h);
118474
+ g.fillStyle = "#fff";
118475
+ g.font = "14px sans-serif";
118476
+ g.fillText(`+${imgs[i].t}ms`, i * w + 8, 17);
118477
+ });
118478
+ return c.toDataURL("image/png").split(",")[1];
118479
+ }, chosen.map((f) => ({ data: f.data, t: Math.max(0, f.t) })));
118480
+ writeFileSync36(opts.sheet, Buffer.from(png, "base64"));
118481
+ }
118482
+ if (opts.json) {
118483
+ console.log(JSON.stringify({ url: opts.url, action: opts.selector ?? opts.text, ...report }));
118484
+ return 0;
118485
+ }
118486
+ console.log(chalk39.bold(`
118487
+ click ${opts.selector ?? `"${opts.text}"`} on ${urlBefore}`));
118488
+ if (report.urlAfter !== urlBefore)
118489
+ console.log(` url → ${report.urlAfter}`);
118490
+ console.log(` ${requests.length} request(s): ${requests.slice(0, 6).join(" · ")}`);
118491
+ for (const r of regions.slice(0, 10))
118492
+ console.log(` ${r.remounted ? chalk39.red("REMOUNTED") : "changed "} ${r.region.padEnd(48)} +${r.added}/-${r.removed} attrs ${r.attrs} text ${r.text}`);
118493
+ for (const s of report.skeletons)
118494
+ console.log(chalk39.yellow(` skeletons ×${s.count} in ${s.region}`));
118495
+ for (const f of flashes)
118496
+ console.log(chalk39.red(` white flash +${f.from}–${f.to}ms (peak ${f.peakWhite.toFixed(0)}% white)`));
118497
+ console.log(chalk39.dim(` settled at +${settledAt ?? "?"}ms · ${post.length} frames${opts.sheet ? ` · sheet ${opts.sheet}` : ""}`));
118498
+ return 0;
118499
+ } finally {
118500
+ await browser.close().catch(() => {
118501
+ return;
118502
+ });
118503
+ }
118504
+ }
118505
+
118506
+ // src/commands/states.ts
118507
+ import chalk40 from "chalk";
118258
118508
  var ROOT_ATTR = "data-parity-states";
118259
118509
  var rootSelector = (i) => `[${ROOT_ATTR}="${i}"]`;
118260
118510
  function resolveStateRoots(args) {
@@ -118563,7 +118813,7 @@ function statesVerdict(counts) {
118563
118813
  async function statesCommand(opts) {
118564
118814
  const viewport = parseViewport2(opts.viewport);
118565
118815
  if (!viewport) {
118566
- console.error(chalk39.red(`--viewport inválido: ${opts.viewport}`));
118816
+ console.error(chalk40.red(`--viewport inválido: ${opts.viewport}`));
118567
118817
  return 2;
118568
118818
  }
118569
118819
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
@@ -118573,12 +118823,12 @@ async function statesCommand(opts) {
118573
118823
  const prodSelector = opts.prodSelector?.trim() || opts.selector?.trim();
118574
118824
  const candSelector = opts.candSelector?.trim() || opts.selector?.trim();
118575
118825
  if (!prodSelector || !candSelector) {
118576
- console.error(chalk39.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
118826
+ console.error(chalk40.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
118577
118827
  return 2;
118578
118828
  }
118579
118829
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
118580
118830
  if (aliasNote)
118581
- console.log(chalk39.dim(` ${aliasNote}`));
118831
+ console.log(chalk40.dim(` ${aliasNote}`));
118582
118832
  const browser = await launchBrowser({ headless: true });
118583
118833
  try {
118584
118834
  const [prodSide, candSide] = await Promise.all([
@@ -118603,7 +118853,7 @@ async function statesCommand(opts) {
118603
118853
  ]);
118604
118854
  if (prodSide.baseError || candSide.baseError) {
118605
118855
  const which = prodSide.baseError ? `prod: ${prodSide.baseError}` : `cand: ${candSide.baseError}`;
118606
- console.error(chalk39.red(` não foi possível ler o componente — ${which}`));
118856
+ console.error(chalk40.red(` não foi possível ler o componente — ${which}`));
118607
118857
  return 2;
118608
118858
  }
118609
118859
  for (const [name, side, sel] of [
@@ -118612,13 +118862,13 @@ async function statesCommand(opts) {
118612
118862
  ]) {
118613
118863
  const r = side.resolution;
118614
118864
  if (r?.kind === "ambiguous") {
118615
- console.error(chalk39.red(` ${name}: ${sel} matches ${r.total} visible elements and none looks like a product card (image + link + price). Narrow it to one:`));
118865
+ console.error(chalk40.red(` ${name}: ${sel} matches ${r.total} visible elements and none looks like a product card (image + link + price). Narrow it to one:`));
118616
118866
  for (const sample of r.samples)
118617
- console.error(chalk39.dim(` ${sample}`));
118867
+ console.error(chalk40.dim(` ${sample}`));
118618
118868
  return 2;
118619
118869
  }
118620
118870
  if (!r || r.kind === "none") {
118621
- console.error(chalk39.red(` ${name}: ${sel} matches no visible element${r?.error ? ` — ${r.error}` : ""}`));
118871
+ console.error(chalk40.red(` ${name}: ${sel} matches no visible element${r?.error ? ` — ${r.error}` : ""}`));
118622
118872
  return 2;
118623
118873
  }
118624
118874
  }
@@ -118700,21 +118950,21 @@ async function statesCommand(opts) {
118700
118950
  ]) {
118701
118951
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
118702
118952
  if (caveat)
118703
- console.log(chalk39.yellow(` ${caveat}`));
118953
+ console.log(chalk40.yellow(` ${caveat}`));
118704
118954
  }
118705
118955
  if (cardMode) {
118706
118956
  console.log("");
118707
- console.log(chalk39.bold(` Product cards: ${pairing.pairs.length} pair(s) — ${pairing.pairs.map(([p, c]) => `prod #${p + 1} ↔ cand #${c + 1}`).join(", ") || "none"}`));
118957
+ console.log(chalk40.bold(` Product cards: ${pairing.pairs.length} pair(s) — ${pairing.pairs.map(([p, c]) => `prod #${p + 1} ↔ cand #${c + 1}`).join(", ") || "none"}`));
118708
118958
  for (const [name, side] of [
118709
118959
  ["prod", prodSide],
118710
118960
  ["cand", candSide]
118711
118961
  ]) {
118712
118962
  const r = side.resolution;
118713
118963
  if (r?.kind === "cards" && r.ignored > 0) {
118714
- console.log(chalk39.dim(` ${name}: ${r.ignored} matched element(s) are not product cards and were ignored`));
118964
+ console.log(chalk40.dim(` ${name}: ${r.ignored} matched element(s) are not product cards and were ignored`));
118715
118965
  }
118716
118966
  if (r?.kind === "single" && !r.isCard) {
118717
- console.log(chalk39.yellow(` ${name}: the selector names one element that is not a product card; it is never paired with a card`));
118967
+ console.log(chalk40.yellow(` ${name}: the selector names one element that is not a product card; it is never paired with a card`));
118718
118968
  }
118719
118969
  }
118720
118970
  const unpaired = [
@@ -118722,65 +118972,65 @@ async function statesCommand(opts) {
118722
118972
  ...pairing.unpairedCand.map((i) => `cand #${i + 1}`)
118723
118973
  ];
118724
118974
  if (unpaired.length)
118725
- console.log(chalk39.dim(` UNPAIRED cards: ${unpaired.join(", ")} — not compared`));
118975
+ console.log(chalk40.dim(` UNPAIRED cards: ${unpaired.join(", ")} — not compared`));
118726
118976
  if (pairing.pairs.length === 0) {
118727
- console.log(chalk39.yellow(" INCONCLUSIVE — no card paired, so nothing was compared."));
118977
+ console.log(chalk40.yellow(" INCONCLUSIVE — no card paired, so nothing was compared."));
118728
118978
  }
118729
118979
  }
118730
118980
  console.log("");
118731
- console.log(chalk39.bold(" Declared motion"));
118981
+ console.log(chalk40.bold(" Declared motion"));
118732
118982
  if (!motion) {
118733
118983
  const err = prodFlat.motionError ?? candFlat.motionError ?? "nothing paired";
118734
- console.log(chalk39.yellow(` não foi possível comparar — ${err}`));
118984
+ console.log(chalk40.yellow(` não foi possível comparar — ${err}`));
118735
118985
  } else {
118736
118986
  for (const line of formatMotionDiff(motion).split(`
118737
118987
  `))
118738
118988
  console.log(` ${line}`);
118739
118989
  }
118740
118990
  console.log("");
118741
- console.log(chalk39.bold(` Hover effects (${prodFlat.effects.length} prod / ${candFlat.effects.length} cand)`));
118991
+ console.log(chalk40.bold(` Hover effects (${prodFlat.effects.length} prod / ${candFlat.effects.length} cand)`));
118742
118992
  const nothing = effects.lost.length === 0 && effects.changed.length === 0 && effects.added.length === 0 && effects.unpaired.length === 0;
118743
118993
  if (nothing && !exercised) {
118744
- console.log(chalk39.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
118994
+ console.log(chalk40.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
118745
118995
  } else if (nothing) {
118746
118996
  console.log(" clean — every hover that changes something in prod changes the same in cand");
118747
118997
  }
118748
118998
  for (const e of effects.lost) {
118749
- console.log(chalk39.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
118999
+ console.log(chalk40.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
118750
119000
  }
118751
119001
  for (const { prod, extra, notComparable, onElement } of effects.changed) {
118752
119002
  console.log(` DIFFERS ${prod.target}${prod.label ? ` (${prod.label})` : ""}`);
118753
119003
  if (onElement.length) {
118754
- console.log(chalk39.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
119004
+ console.log(chalk40.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
118755
119005
  }
118756
119006
  if (extra.length)
118757
119007
  console.log(` cand also moves [${extra.join(", ")}]`);
118758
119008
  if (notComparable.length) {
118759
- console.log(chalk39.dim(` not comparable: [${notComparable.join(", ")}] — prod's hover renumbered ${prod.renumberedNodes} of the changed paths, so these were read on elements that are not the same ones before and after. Bench the component, or pick a selector whose subtree the hover does not restructure.`));
119009
+ console.log(chalk40.dim(` not comparable: [${notComparable.join(", ")}] — prod's hover renumbered ${prod.renumberedNodes} of the changed paths, so these were read on elements that are not the same ones before and after. Bench the component, or pick a selector whose subtree the hover does not restructure.`));
118760
119010
  }
118761
119011
  if (onElement.length === 0 && extra.length === 0) {
118762
- console.log(chalk39.dim(" nothing comparable differs."));
119012
+ console.log(chalk40.dim(" nothing comparable differs."));
118763
119013
  }
118764
119014
  }
118765
119015
  for (const e of effects.unpaired) {
118766
- console.log(chalk39.dim(` UNPAIRED ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; no matching element found on the cand side (not a defect — the port may have changed the element, or it is outside --selector)`));
119016
+ console.log(chalk40.dim(` UNPAIRED ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; no matching element found on the cand side (not a defect — the port may have changed the element, or it is outside --selector)`));
118767
119017
  }
118768
119018
  for (const e of effects.added) {
118769
119019
  console.log(` ADDED ${e.target} — cand moves [${e.properties.join(", ")}]; prod does not`);
118770
119020
  }
118771
119021
  if (effects.unpaired.length > 0 && effects.lost.length === 0 && effects.changed.length === 0) {
118772
119022
  console.log("");
118773
- console.log(chalk39.yellow(` ${effects.unpaired.length} prod effect(s) had no counterpart and NOTHING paired. That is a pairing failure, not a set of defects — check --selector contains the same component on both sides, and that ported roots carry data-section.`));
119023
+ console.log(chalk40.yellow(` ${effects.unpaired.length} prod effect(s) had no counterpart and NOTHING paired. That is a pairing failure, not a set of defects — check --selector contains the same component on both sides, and that ported roots carry data-section.`));
118774
119024
  }
118775
119025
  const prodAmbient = prodSide.roots.reduce((n, r) => n + r.ambient, 0);
118776
119026
  const candAmbient = candSide.roots.reduce((n, r) => n + r.ambient, 0);
118777
119027
  if (prodAmbient > 0 || candAmbient > 0) {
118778
- console.log(chalk39.dim(` ${prodAmbient} prod / ${candAmbient} cand node+property pair(s) were moving with no interaction (carousel, autoplaying video, anything on a timer) and were subtracted. A large count means --selector contains something animating on its own; narrow it.`));
119028
+ console.log(chalk40.dim(` ${prodAmbient} prod / ${candAmbient} cand node+property pair(s) were moving with no interaction (carousel, autoplaying video, anything on a timer) and were subtracted. A large count means --selector contains something animating on its own; narrow it.`));
118779
119029
  }
118780
119030
  for (const cap of caps)
118781
- console.log(chalk39.yellow(` CAPPED — ${cap}; absence of a finding is not proof`));
119031
+ console.log(chalk40.yellow(` CAPPED — ${cap}; absence of a finding is not proof`));
118782
119032
  if (truncated) {
118783
- console.log(chalk39.dim(" TRUNCATED — box-tree or motion node cap hit; absence of a finding is not proof"));
119033
+ console.log(chalk40.dim(" TRUNCATED — box-tree or motion node cap hit; absence of a finding is not proof"));
118784
119034
  }
118785
119035
  return inconclusive || effects.lost.length > 0 || (motion?.findings.length ?? 0) > 0 ? 1 : 0;
118786
119036
  } finally {
@@ -118792,7 +119042,7 @@ async function statesCommand(opts) {
118792
119042
 
118793
119043
  // src/commands/stress.ts
118794
119044
  import { createHash as createHash4 } from "node:crypto";
118795
- import chalk40 from "chalk";
119045
+ import chalk41 from "chalk";
118796
119046
  var STATIC = /\.(png|jpe?g|webp|avif|gif|svg|woff2?|ttf|css|js|map|ico)(\?|$)/i;
118797
119047
  function analyzeStress(requests, extra) {
118798
119048
  const groups = new Map;
@@ -118822,7 +119072,7 @@ function analyzeStress(requests, extra) {
118822
119072
  }
118823
119073
  async function stressCommand(opts) {
118824
119074
  if (!opts.selector && !opts.text) {
118825
- console.error(chalk40.red("pass --selector or --text"));
119075
+ console.error(chalk41.red("pass --selector or --text"));
118826
119076
  return 2;
118827
119077
  }
118828
119078
  const browser = await launchBrowser({ headless: true });
@@ -118849,7 +119099,7 @@ async function stressCommand(opts) {
118849
119099
  const target = (opts.selector ? page.locator(opts.selector) : page.getByText(opts.text, { exact: true })).filter({ visible: true }).first();
118850
119100
  const box = await target.boundingBox().catch(() => null);
118851
119101
  if (!box) {
118852
- console.error(chalk40.yellow("target matched no visible element — nothing was stressed"));
119102
+ console.error(chalk41.yellow("target matched no visible element — nothing was stressed"));
118853
119103
  return 2;
118854
119104
  }
118855
119105
  const handle = await target.elementHandle().catch(() => null);
@@ -118900,17 +119150,17 @@ async function stressCommand(opts) {
118900
119150
  console.log(JSON.stringify({ url: opts.url, target: opts.selector ?? opts.text, ...report }));
118901
119151
  return 0;
118902
119152
  }
118903
- console.log(chalk40.bold(`
119153
+ console.log(chalk41.bold(`
118904
119154
  ${opts.times} clicks on ${opts.selector ?? `"${opts.text}"`}`));
118905
119155
  console.log(` ${report.requests} request(s), ${report.mutations} mutating · disabled after 1st click: ${report.disabledAfterFirstClick ?? "?"}`);
118906
119156
  for (const d of report.duplicates)
118907
- console.log(chalk40.yellow(` ×${d.count} ${d.method} ${d.url.slice(0, 110)} [${d.statuses.join(",")}]`));
119157
+ console.log(chalk41.yellow(` ×${d.count} ${d.method} ${d.url.slice(0, 110)} [${d.statuses.join(",")}]`));
118908
119158
  for (const f of report.failed.filter((f) => !report.duplicates.includes(f)))
118909
- console.log(chalk40.red(` failed ${f.method} ${f.url.slice(0, 110)} [${f.statuses.join(",")}]`));
119159
+ console.log(chalk41.red(` failed ${f.method} ${f.url.slice(0, 110)} [${f.statuses.join(",")}]`));
118910
119160
  for (const e of report.consoleErrors.slice(0, 5))
118911
- console.log(chalk40.red(` console: ${e}`));
119161
+ console.log(chalk41.red(` console: ${e}`));
118912
119162
  if (opts.screenshot)
118913
- console.log(chalk40.dim(` final state: ${opts.screenshot}`));
119163
+ console.log(chalk41.dim(` final state: ${opts.screenshot}`));
118914
119164
  return 0;
118915
119165
  } finally {
118916
119166
  await browser.close().catch(() => {
@@ -118921,18 +119171,18 @@ async function stressCommand(opts) {
118921
119171
 
118922
119172
  // src/commands/studio.ts
118923
119173
  import { execFileSync as execFileSync6 } from "node:child_process";
118924
- import chalk41 from "chalk";
119174
+ import chalk42 from "chalk";
118925
119175
  var CLOSED = new Set(["done", "archived", "merged"]);
118926
119176
  var PRIORITY_RANK = { urgent: 0, high: 1, medium: 2, low: 3, none: 4 };
118927
119177
  function config() {
118928
119178
  const cfg = studioConfigFromEnv();
118929
119179
  if (!cfg) {
118930
- console.error(chalk41.red(`Studio not configured — ${STUDIO_LOGIN_HINT}. The org comes from PARITY_STUDIO_URL (…/api/<org>/mcp/self) or PARITY_STUDIO_ORG.`));
119180
+ console.error(chalk42.red(`Studio not configured — ${STUDIO_LOGIN_HINT}. The org comes from PARITY_STUDIO_URL (…/api/<org>/mcp/self) or PARITY_STUDIO_ORG.`));
118931
119181
  }
118932
119182
  return cfg;
118933
119183
  }
118934
119184
  function fail2(err) {
118935
- console.error(chalk41.red(err instanceof Error ? err.message : String(err)));
119185
+ console.error(chalk42.red(err instanceof Error ? err.message : String(err)));
118936
119186
  return 1;
118937
119187
  }
118938
119188
  function seq(t) {
@@ -118940,7 +119190,7 @@ function seq(t) {
118940
119190
  }
118941
119191
  function line(t) {
118942
119192
  const tags = [t.type, t.priority && t.priority !== "none" ? t.priority : null].filter(Boolean).join("·");
118943
- return `${chalk41.bold(seq(t).padEnd(6))} ${t.status.padEnd(12)} ${chalk41.dim(`[${tags}]`.padEnd(16))} ${t.title}${t.repo ? chalk41.dim(` ${t.repo}`) : ""}`;
119193
+ return `${chalk42.bold(seq(t).padEnd(6))} ${t.status.padEnd(12)} ${chalk42.dim(`[${tags}]`.padEnd(16))} ${t.title}${t.repo ? chalk42.dim(` ${t.repo}`) : ""}`;
118944
119194
  }
118945
119195
  async function resolveTask(cfg, ref, call) {
118946
119196
  const board = await listTasks2(cfg, call);
@@ -118964,13 +119214,13 @@ async function studioTasksCommand(opts, call = callTool2) {
118964
119214
  return 0;
118965
119215
  }
118966
119216
  if (board.items.length === 0) {
118967
- console.log(chalk41.yellow("The board is empty."));
119217
+ console.log(chalk42.yellow("The board is empty."));
118968
119218
  return 0;
118969
119219
  }
118970
119220
  for (const t of limited)
118971
119221
  console.log(line(t));
118972
119222
  const hidden = board.items.length - shown.length;
118973
- console.log(chalk41.dim(` ${shown.length} of ${board.items.length} task(s)${limited.length < shown.length ? `, first ${limited.length} shown` : ""}${hidden > 0 && !statuses && !opts.all ? ` · ${hidden} done/archived/merged or filtered out (--all shows them)` : ""}`));
119223
+ console.log(chalk42.dim(` ${shown.length} of ${board.items.length} task(s)${limited.length < shown.length ? `, first ${limited.length} shown` : ""}${hidden > 0 && !statuses && !opts.all ? ` · ${hidden} done/archived/merged or filtered out (--all shows them)` : ""}`));
118974
119224
  return 0;
118975
119225
  } catch (err) {
118976
119226
  return fail2(err);
@@ -118994,23 +119244,23 @@ async function studioShowCommand(opts, call = callTool2) {
118994
119244
  return 0;
118995
119245
  }
118996
119246
  console.log(line(task));
118997
- console.log(chalk41.dim(` id ${task.id}${task.statusSince ? ` · in ${task.status} since ${task.statusSince}` : ""}`));
119247
+ console.log(chalk42.dim(` id ${task.id}${task.statusSince ? ` · in ${task.status} since ${task.statusSince}` : ""}`));
118998
119248
  if (task.description)
118999
119249
  console.log(`
119000
119250
  ${task.description}
119001
119251
  `);
119002
119252
  if (prs === null)
119003
- console.log(chalk41.dim(" (could not read linked PRs)"));
119253
+ console.log(chalk42.dim(" (could not read linked PRs)"));
119004
119254
  for (const pr of prs ?? []) {
119005
119255
  const state = pr.merged ? "merged" : pr.draft ? "draft" : pr.state ?? "?";
119006
- console.log(` PR ${state.padEnd(7)} ${pr.url}${pr.title ? chalk41.dim(` ${pr.title}`) : ""}`);
119256
+ console.log(` PR ${state.padEnd(7)} ${pr.url}${pr.title ? chalk42.dim(` ${pr.title}`) : ""}`);
119007
119257
  }
119008
119258
  const open = comments.filter((c) => !c.resolved);
119009
119259
  if (open.length)
119010
- console.log(chalk41.bold(`
119260
+ console.log(chalk42.bold(`
119011
119261
  Comments (${open.length} open)`));
119012
119262
  for (const c of open)
119013
- console.log(` ${chalk41.dim(c.createdAt)} ${c.body.replace(/\n/g, `
119263
+ console.log(` ${chalk42.dim(c.createdAt)} ${c.body.replace(/\n/g, `
119014
119264
  `)}`);
119015
119265
  return 0;
119016
119266
  } catch (err) {
@@ -119029,7 +119279,7 @@ async function guardedMove(cfg, task, columns, to, opts, call) {
119029
119279
  if (!valid.includes(to))
119030
119280
  return fail2(new Error(`"${to}" is not a column of this board: ${valid.join(", ")}.`));
119031
119281
  if (task.status === to) {
119032
- console.log(chalk41.dim(`${seq(task)} is already in ${to}.`));
119282
+ console.log(chalk42.dim(`${seq(task)} is already in ${to}.`));
119033
119283
  return 0;
119034
119284
  }
119035
119285
  const automated = await automatedColumns(cfg, call);
@@ -119037,16 +119287,16 @@ async function guardedMove(cfg, task, columns, to, opts, call) {
119037
119287
  return fail2(new Error(`The "${to}" column has an automation: landing ${seq(task)} there starts the board's agent on it. Pass --allow-automation if that is the point.`));
119038
119288
  }
119039
119289
  if (!opts.yes) {
119040
- console.log(chalk41.yellow("dry run — nothing changed. Pass --yes."));
119290
+ console.log(chalk42.yellow("dry run — nothing changed. Pass --yes."));
119041
119291
  console.log(` ${seq(task)} ${task.status} → ${to} ${task.title}`);
119042
119292
  if (opts.comment)
119043
- console.log(chalk41.dim(` and comment: ${PARITY_COMMENT_PREFIX} ${opts.comment}`));
119293
+ console.log(chalk42.dim(` and comment: ${PARITY_COMMENT_PREFIX} ${opts.comment}`));
119044
119294
  return 0;
119045
119295
  }
119046
119296
  await moveTask(cfg, task.id, to, call);
119047
119297
  if (opts.comment)
119048
119298
  await postParityComment(task.id, opts.comment, cfg, call);
119049
- console.log(`${chalk41.green("✓")} ${seq(task)} ${task.status} → ${to} ${task.title}`);
119299
+ console.log(`${chalk42.green("✓")} ${seq(task)} ${task.status} → ${to} ${task.title}`);
119050
119300
  return 0;
119051
119301
  }
119052
119302
  async function studioTakeCommand(opts, call = callTool2) {
@@ -119095,12 +119345,12 @@ async function studioCommentCommand(opts, call = callTool2) {
119095
119345
  if (found instanceof Error)
119096
119346
  return fail2(found);
119097
119347
  if (!opts.yes) {
119098
- console.log(chalk41.yellow("dry run — nothing posted. Pass --yes."));
119348
+ console.log(chalk42.yellow("dry run — nothing posted. Pass --yes."));
119099
119349
  console.log(` on ${seq(found.task)}: ${PARITY_COMMENT_PREFIX} ${body}`);
119100
119350
  return 0;
119101
119351
  }
119102
119352
  await postParityComment(found.task.id, body, cfg, call);
119103
- console.log(`${chalk41.green("✓")} commented on ${seq(found.task)}`);
119353
+ console.log(`${chalk42.green("✓")} commented on ${seq(found.task)}`);
119104
119354
  return 0;
119105
119355
  } catch (err) {
119106
119356
  return fail2(err);
@@ -119108,9 +119358,9 @@ async function studioCommentCommand(opts, call = callTool2) {
119108
119358
  }
119109
119359
 
119110
119360
  // src/commands/sweep.ts
119111
- import { existsSync as existsSync37, readFileSync as readFileSync44, writeFileSync as writeFileSync36 } from "node:fs";
119361
+ import { existsSync as existsSync37, readFileSync as readFileSync44, writeFileSync as writeFileSync37 } from "node:fs";
119112
119362
  import { join as join50 } from "node:path";
119113
- import chalk42 from "chalk";
119363
+ import chalk43 from "chalk";
119114
119364
  import { z as z4 } from "zod";
119115
119365
 
119116
119366
  // src/board/sweep-cards.ts
@@ -120194,16 +120444,16 @@ async function sweepCommand(opts) {
120194
120444
  const trend = annotateTrend(opts.output, done.runId);
120195
120445
  if (!opts.json) {
120196
120446
  if (trend) {
120197
- console.log(chalk42.dim(` trend vs ${trend.previousRunId}: ${trend.new} new · ${trend.recurring} recurring · ${trend.resolved} resolved`));
120447
+ console.log(chalk43.dim(` trend vs ${trend.previousRunId}: ${trend.new} new · ${trend.recurring} recurring · ${trend.resolved} resolved`));
120198
120448
  } else {
120199
- console.log(chalk42.dim(" trend: first sweep of this host"));
120449
+ console.log(chalk43.dim(" trend: first sweep of this host"));
120200
120450
  }
120201
120451
  const missed = missedFloors(readReport(done.reportJson) ?? { flowCaptures: [] });
120202
120452
  if (missed.length)
120203
- console.log(chalk42.yellow(` não alcançado (${missed.length}): ${missed.join(", ")}`));
120453
+ console.log(chalk43.yellow(` não alcançado (${missed.length}): ${missed.join(", ")}`));
120204
120454
  const unverified = readUnverified(done.reportJson);
120205
120455
  if (unverified.length) {
120206
- console.log(chalk42.yellow(` não verificado (${unverified.length}): ${unverified.slice(0, 8).join(", ")}${unverified.length > 8 ? "…" : ""}`));
120456
+ console.log(chalk43.yellow(` não verificado (${unverified.length}): ${unverified.slice(0, 8).join(", ")}${unverified.length > 8 ? "…" : ""}`));
120207
120457
  }
120208
120458
  }
120209
120459
  if (opts.board) {
@@ -120265,7 +120515,7 @@ function annotateTrend(outputDir, runId) {
120265
120515
  const prev = findPreviousSweep(outputDir, hostOf5(report.url), runId);
120266
120516
  if (!prev) {
120267
120517
  report.trend = null;
120268
- writeFileSync36(paths.reportJson, `${JSON.stringify(report, null, 2)}
120518
+ writeFileSync37(paths.reportJson, `${JSON.stringify(report, null, 2)}
120269
120519
  `, "utf8");
120270
120520
  return null;
120271
120521
  }
@@ -120280,7 +120530,7 @@ function annotateTrend(outputDir, runId) {
120280
120530
  resolved: d.resolved,
120281
120531
  new: d.new
120282
120532
  };
120283
- writeFileSync36(paths.reportJson, `${JSON.stringify(report, null, 2)}
120533
+ writeFileSync37(paths.reportJson, `${JSON.stringify(report, null, 2)}
120284
120534
  `, "utf8");
120285
120535
  return report.trend;
120286
120536
  }
@@ -120291,7 +120541,7 @@ async function addProbeFindings(url, runDir, reportJson, rc, json, specsRepo) {
120291
120541
  { label: "menu", selectors: HAMBURGER_SELECTORS }
120292
120542
  ]).catch(() => []);
120293
120543
  const menu = await probeMenuLinks(url, { screenshotsDir: join50(runDir, "screenshots") }).catch(() => []);
120294
- writeFileSync36(join50(runDir, "menu-links.json"), `${JSON.stringify(menu, null, 2)}
120544
+ writeFileSync37(join50(runDir, "menu-links.json"), `${JSON.stringify(menu, null, 2)}
120295
120545
  `, "utf8");
120296
120546
  const listing = menu.find((v) => v.listingUi && v.products > 0);
120297
120547
  const a11y = await probeA11y(url, listing ? new URL(listing.link.href).pathname : undefined).catch(() => []);
@@ -120313,11 +120563,11 @@ async function addProbeFindings(url, runDir, reportJson, rc, json, specsRepo) {
120313
120563
  t[i.severity] = (t[i.severity] ?? 0) + 1;
120314
120564
  }
120315
120565
  }
120316
- writeFileSync36(reportJson, `${JSON.stringify(report, null, 2)}
120566
+ writeFileSync37(reportJson, `${JSON.stringify(report, null, 2)}
120317
120567
  `, "utf8");
120318
120568
  if (!json) {
120319
120569
  for (const i of issues)
120320
- console.log(chalk42[i.inconclusive ? "yellow" : "red"](` ${i.summary}`));
120570
+ console.log(chalk43[i.inconclusive ? "yellow" : "red"](` ${i.summary}`));
120321
120571
  }
120322
120572
  }
120323
120573
  function missedFloors(report) {
@@ -120412,28 +120662,28 @@ function mergeIssues(report, agent, dropped) {
120412
120662
  }
120413
120663
  async function sweepFileCommand(opts) {
120414
120664
  if ((opts.board ?? "studio") !== "studio") {
120415
- console.error(chalk42.red(`--board ${opts.board}: only "studio" is supported`));
120665
+ console.error(chalk43.red(`--board ${opts.board}: only "studio" is supported`));
120416
120666
  return 2;
120417
120667
  }
120418
120668
  const minSeverity = opts.minSeverity ?? "medium";
120419
120669
  if (!SEVERITIES.includes(minSeverity)) {
120420
- console.error(chalk42.red(`--min-severity ${opts.minSeverity}: use ${SEVERITIES.join("|")}`));
120670
+ console.error(chalk43.red(`--min-severity ${opts.minSeverity}: use ${SEVERITIES.join("|")}`));
120421
120671
  return 2;
120422
120672
  }
120423
120673
  const runId = opts.run ?? listRuns(opts.output).find((r) => readReport(r.reportPath)?.mode === "sweep")?.id;
120424
120674
  if (!runId) {
120425
- console.error(chalk42.red(`no sweep run in ${opts.output} — run \`parity sweep --url …\` first`));
120675
+ console.error(chalk43.red(`no sweep run in ${opts.output} — run \`parity sweep --url …\` first`));
120426
120676
  return 2;
120427
120677
  }
120428
120678
  const paths = getRunPaths(opts.output, runId);
120429
120679
  const report = readReport(paths.reportJson);
120430
120680
  if (!report || report.mode !== "sweep") {
120431
- console.error(chalk42.red(`${runId} is not a sweep run`));
120681
+ console.error(chalk43.red(`${runId} is not a sweep run`));
120432
120682
  return 2;
120433
120683
  }
120434
120684
  const cfg = studioConfigFromEnv();
120435
120685
  if (!cfg) {
120436
- console.error(chalk42.red(`Studio not configured — ${STUDIO_LOGIN_HINT}; org via PARITY_STUDIO_ORG or PARITY_STUDIO_URL.`));
120686
+ console.error(chalk43.red(`Studio not configured — ${STUDIO_LOGIN_HINT}; org via PARITY_STUDIO_ORG or PARITY_STUDIO_URL.`));
120437
120687
  return 2;
120438
120688
  }
120439
120689
  const agent = readSweeperIssues(paths.runDir);
@@ -120479,7 +120729,7 @@ async function sweepFileCommand(opts) {
120479
120729
  allowAutomation: opts.allowAutomation
120480
120730
  });
120481
120731
  } catch (err) {
120482
- console.error(chalk42.red(err instanceof Error ? err.message : String(err)));
120732
+ console.error(chalk43.red(err instanceof Error ? err.message : String(err)));
120483
120733
  return 1;
120484
120734
  }
120485
120735
  if (opts.json) {
@@ -120496,14 +120746,14 @@ async function sweepFileCommand(opts) {
120496
120746
  }));
120497
120747
  return 0;
120498
120748
  }
120499
- const head = opts.yes ? chalk42.bold(" filed on the Studio board") : chalk42.bold(" dry run — add --yes to file");
120749
+ const head = opts.yes ? chalk43.bold(" filed on the Studio board") : chalk43.bold(" dry run — add --yes to file");
120500
120750
  console.log(`
120501
120751
  ${head} (run ${runId}, ≥ ${minSeverity}${agent.issues.length ? `, +${agent.issues.length} from sweeper` : ""})`);
120502
120752
  for (const e of result.entries) {
120503
- const tag = e.action === "create" ? chalk42.green("create ") : e.action === "update" ? chalk42.yellow("update ") : e.action === "regression" ? chalk42.red("regress") : chalk42.dim("skip ");
120753
+ const tag = e.action === "create" ? chalk43.green("create ") : e.action === "update" ? chalk43.yellow("update ") : e.action === "regression" ? chalk43.red("regress") : chalk43.dim("skip ");
120504
120754
  console.log(` ${tag} ${e.title}`);
120505
120755
  }
120506
- console.log(chalk42.dim(` ${result.created} created · ${result.updated} updated · ${result.regressions} regressions · ${result.skipped} skipped${result.summaryRef ? ` · summary ${result.summaryRef}` : ""}`));
120756
+ console.log(chalk43.dim(` ${result.created} created · ${result.updated} updated · ${result.regressions} regressions · ${result.skipped} skipped${result.summaryRef ? ` · summary ${result.summaryRef}` : ""}`));
120507
120757
  return 0;
120508
120758
  }
120509
120759
  function countTotals(issues) {
@@ -120553,11 +120803,11 @@ async function sweepScheduleCommand(opts) {
120553
120803
  console.log(JSON.stringify(job));
120554
120804
  return 0;
120555
120805
  }
120556
- console.log(chalk42.bold(`
120806
+ console.log(chalk43.bold(`
120557
120807
  control-plane JOB_CREATE payload (monthly sweep)
120558
120808
  `));
120559
120809
  console.log(JSON.stringify(job, null, 2));
120560
- console.log(chalk42.dim([
120810
+ console.log(chalk43.dim([
120561
120811
  "",
120562
120812
  " How to create it:",
120563
120813
  " • from Claude Code with the parity plugin: /parity:sweep schedule … (calls the deco-control-plane MCP `JOB_CREATE` with this payload)",
@@ -120573,7 +120823,7 @@ async function sweepScheduleCommand(opts) {
120573
120823
  }
120574
120824
 
120575
120825
  // src/commands/variance.ts
120576
- import chalk43 from "chalk";
120826
+ import chalk44 from "chalk";
120577
120827
 
120578
120828
  // src/diff/variance.ts
120579
120829
  var uniq2 = (xs) => [...new Set(xs)];
@@ -120677,7 +120927,7 @@ function formatVariance(report, opts = {}) {
120677
120927
  // src/commands/variance.ts
120678
120928
  function varianceCommand(opts) {
120679
120929
  if (opts.runIds.length < 2) {
120680
- console.error(chalk43.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
120930
+ console.error(chalk44.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
120681
120931
  return 2;
120682
120932
  }
120683
120933
  const budget = Number.parseFloat(opts.scoreBudget ?? "1");
@@ -120686,7 +120936,7 @@ function varianceCommand(opts) {
120686
120936
  try {
120687
120937
  runs.push(loadRun(opts.output, id));
120688
120938
  } catch (err) {
120689
- console.error(chalk43.red(` ✖ ${err.message}`));
120939
+ console.error(chalk44.red(` ✖ ${err.message}`));
120690
120940
  return 2;
120691
120941
  }
120692
120942
  }
@@ -120695,7 +120945,7 @@ function varianceCommand(opts) {
120695
120945
  console.log(JSON.stringify({ ...report, stable: isStable(report, budget), scoreBudget: budget }));
120696
120946
  } else {
120697
120947
  console.log("");
120698
- console.log(chalk43.bold(" Score variance"));
120948
+ console.log(chalk44.bold(" Score variance"));
120699
120949
  for (const line of formatVariance(report, { scoreBudget: budget }).split(`
120700
120950
  `)) {
120701
120951
  console.log(` ${line}`);
@@ -120707,10 +120957,10 @@ function varianceCommand(opts) {
120707
120957
  }
120708
120958
 
120709
120959
  // src/commands/vitals.ts
120710
- import { existsSync as existsSync38, readFileSync as readFileSync45, writeFileSync as writeFileSync37 } from "node:fs";
120960
+ import { existsSync as existsSync38, readFileSync as readFileSync45, writeFileSync as writeFileSync38 } from "node:fs";
120711
120961
  import { availableParallelism } from "node:os";
120712
120962
  import { join as join51 } from "node:path";
120713
- import chalk44 from "chalk";
120963
+ import chalk45 from "chalk";
120714
120964
  import ora9 from "ora";
120715
120965
 
120716
120966
  // src/checks/agentic-nav.ts
@@ -121008,10 +121258,10 @@ async function vitalsCommand(opts) {
121008
121258
  const runId = newRunId();
121009
121259
  const paths = createRunDir(opts.output, runId);
121010
121260
  const t0 = Date.now();
121011
- console.log(chalk44.bold(`
121261
+ console.log(chalk45.bold(`
121012
121262
  parity vitals ${runId}`));
121013
- console.log(chalk44.dim(` prod: ${opts.prod}`));
121014
- console.log(chalk44.dim(` cand: ${opts.cand}`));
121263
+ console.log(chalk45.dim(` prod: ${opts.prod}`));
121264
+ console.log(chalk45.dim(` cand: ${opts.cand}`));
121015
121265
  const discoverSpinner = ora9("Descobrindo páginas…").start();
121016
121266
  const pagePaths = await discoverPagePaths2(opts.prod, opts);
121017
121267
  if (pagePaths.length === 0) {
@@ -121043,7 +121293,7 @@ async function vitalsCommand(opts) {
121043
121293
  completed++;
121044
121294
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
121045
121295
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
121046
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk44.cyan("prod") : chalk44.magenta("cand")} ${task.path} (${task.viewport})`;
121296
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk45.cyan("prod") : chalk45.magenta("cand")} ${task.path} (${task.viewport})`;
121047
121297
  }
121048
121298
  });
121049
121299
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
@@ -121072,7 +121322,7 @@ async function vitalsCommand(opts) {
121072
121322
  }
121073
121323
  lhCompleted++;
121074
121324
  const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
121075
- lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk44.cyan("prod") : chalk44.magenta("cand")} ${task.path} (${task.viewport})`;
121325
+ lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk45.cyan("prod") : chalk45.magenta("cand")} ${task.path} (${task.viewport})`;
121076
121326
  });
121077
121327
  lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
121078
121328
  }
@@ -121137,7 +121387,7 @@ async function vitalsCommand(opts) {
121137
121387
  writeRunReportJson(paths.runDir, run);
121138
121388
  const html = renderHtmlReport(run, paths.runDir);
121139
121389
  writeRunReportHtml(paths.runDir, html);
121140
- writeFileSync37(join51(paths.runDir, "vitals.json"), `${JSON.stringify({
121390
+ writeFileSync38(join51(paths.runDir, "vitals.json"), `${JSON.stringify({
121141
121391
  schemaVersion: "0.1",
121142
121392
  prodUrl: opts.prod,
121143
121393
  candUrl: opts.cand,
@@ -121150,8 +121400,8 @@ async function vitalsCommand(opts) {
121150
121400
  `, "utf8");
121151
121401
  printSummary9(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
121152
121402
  console.log("");
121153
- console.log(chalk44.dim(` → ${paths.reportHtml}`));
121154
- console.log(chalk44.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
121403
+ console.log(chalk45.dim(` → ${paths.reportHtml}`));
121404
+ console.log(chalk45.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
121155
121405
  console.log("");
121156
121406
  if (opts.open) {
121157
121407
  const { default: open } = await import("open");
@@ -121251,7 +121501,7 @@ function parseUrlList(input) {
121251
121501
  }
121252
121502
  function printSummary9(vitals, cache, scores, opportunities, agentic) {
121253
121503
  console.log("");
121254
- console.log(chalk44.bold(" Summary:"));
121504
+ console.log(chalk45.bold(" Summary:"));
121255
121505
  console.log(` ${vitals.summary}`);
121256
121506
  console.log(` ${cache.summary}`);
121257
121507
  if (scores.status !== "skipped")
@@ -121316,10 +121566,10 @@ sweep.addCommand(new Command("regress").description("Run only the store's tests/
121316
121566
  if (opts.json)
121317
121567
  console.log(JSON.stringify({ url: opts.url, issues }));
121318
121568
  else if (!issues.length)
121319
- console.log(chalk45.green(" regression suite: all passed"));
121569
+ console.log(chalk46.green(" regression suite: all passed"));
121320
121570
  else
121321
121571
  for (const i of issues)
121322
- console.log((i.inconclusive ? chalk45.yellow : chalk45.red)(` ${i.summary}`));
121572
+ console.log((i.inconclusive ? chalk46.yellow : chalk46.red)(` ${i.summary}`));
121323
121573
  process.exit(regressed ? 1 : unverified ? 2 : 0);
121324
121574
  }));
121325
121575
  sweep.addCommand(new Command("file").description("File an existing sweep run's findings on the Studio board (default: the newest sweep run). Merges <run>/sweeper-issues.json written by the `sweeper` agent. Dry run unless --yes.").option("--run <runId>", "Sweep run id (default: newest sweep in --output)").option("--output <dir>", "Output directory", "./parity-output").option("--board <name>", "Board: studio", "studio").option("--yes", "Actually create/update cards", false).option("--allow-automation", "File even if the board's triage column starts an agent", false).option("--min-severity <sev>", "critical|high|medium|low", "medium").option("--repo <owner/name>", "Repository to put on the cards").option("--artifacts-url <url>", "Public base URL for this run's artifacts").option("--json", "Emit JSON", false).action(async (opts) => {
@@ -121719,6 +121969,17 @@ program.command("overlay").description("Does opening an overlay move the page? F
121719
121969
  json: opts.json
121720
121970
  }));
121721
121971
  });
121972
+ program.command("rerender").description("What does one interaction repaint? Click an element and report which page sections were remounted (a new element) vs only updated, skeletons that appeared, white flashes in the screencast, the requests fired, and when the screen settled. A tool for the sweeper: e.g. choosing a size should update the price, never remount the header or blank the page. --sheet writes the key frames.").requiredOption("--url <url>", "Page to open").option("--selector <sel>", "Element to click (visible match)").option("--text <text>", "Element to click, by exact visible text").option("--settle <ms>", "Wait after the click before reading", (v) => Number(v), 4000).option("--viewport <viewport>", "desktop | mobile", "desktop").option("--sheet <png>", "Write a contact sheet of the key frames").option("--json", "Emit one-line JSON", false).action(async (opts) => {
121973
+ process.exit(await rerenderCommand({
121974
+ url: opts.url,
121975
+ selector: opts.selector,
121976
+ text: opts.text,
121977
+ settleMs: opts.settle,
121978
+ viewport: opts.viewport,
121979
+ sheet: opts.sheet,
121980
+ json: opts.json
121981
+ }));
121982
+ });
121722
121983
  program.command("stress").description("Click one element N times like an impatient shopper and measure what the site did: requests per click, duplicates (same method+URL+body = no debounce), failed requests, console errors, whether the control disabled itself, the final state. A tool for the sweeper agent: the numbers are facts, whether the outcome is a bug is its call.").requiredOption("--url <url>", "Page to open").option("--selector <sel>", "Element to click (visible match)").option("--text <text>", "Element to click, by exact visible text").option("--before <sel>", "Click this once before the burst (e.g. open the minicart)").option("--times <n>", "Clicks", (v) => Number(v), 10).option("--interval <ms>", "Pause between clicks (0 = as fast as the mouse goes)", (v) => Number(v), 0).option("--settle <ms>", "Wait after the burst before reading", (v) => Number(v), 4000).option("--viewport <viewport>", "desktop | mobile", "desktop").option("--screenshot <path>", "Save the final state").option("--json", "Emit one-line JSON", false).action(async (opts) => {
121723
121984
  process.exit(await stressCommand({
121724
121985
  url: opts.url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.34.4",
3
+ "version": "0.34.5",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",