@decocms/parity 0.33.59 → 0.33.61

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 +1389 -525
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -39072,6 +39072,7 @@ async function launchBrowser(opts = {}) {
39072
39072
  headless: opts.headless ?? true,
39073
39073
  slowMo: opts.slowMo ?? 0,
39074
39074
  timeout: 30000,
39075
+ ignoreDefaultArgs: opts.showScrollbars ? ["--hide-scrollbars"] : undefined,
39075
39076
  args: [
39076
39077
  "--disable-blink-features=AutomationControlled",
39077
39078
  "--no-sandbox",
@@ -46643,6 +46644,24 @@ function median(values) {
46643
46644
  const mid = Math.floor(clean.length / 2);
46644
46645
  return clean.length % 2 ? clean[mid] : (clean[mid - 1] + clean[mid]) / 2;
46645
46646
  }
46647
+ function spreadOf(values) {
46648
+ const clean = values.filter((v) => Number.isFinite(v));
46649
+ if (clean.length === 0)
46650
+ return;
46651
+ return { minMs: Math.min(...clean), maxMs: Math.max(...clean), samples: clean.length };
46652
+ }
46653
+ function noiseWarning(prod, cand) {
46654
+ if (!prod?.ok || !cand?.ok || !prod.spread || !cand.spread)
46655
+ return null;
46656
+ if (prod.spread.samples < 2 || cand.spread.samples < 2)
46657
+ return null;
46658
+ const prodNoise = prod.spread.maxMs - prod.spread.minMs;
46659
+ const candNoise = cand.spread.maxMs - cand.spread.minMs;
46660
+ const deltaMs = Math.abs(cand.ms - prod.ms);
46661
+ const side = prodNoise >= candNoise ? "prod" : "cand";
46662
+ const noiseMs = Math.max(prodNoise, candNoise);
46663
+ return deltaMs <= noiseMs ? { side, noiseMs, deltaMs } : null;
46664
+ }
46646
46665
  function cssAttrEscape(s) {
46647
46666
  return s.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
46648
46667
  }
@@ -46681,21 +46700,47 @@ async function navigateWithHover(page, targetUrl, productImage = false) {
46681
46700
  const targetPath = new URL(targetUrl).pathname;
46682
46701
  const sel = `a[href="${cssAttrEscape(targetUrl)}"], a[href="${cssAttrEscape(targetPath)}"], a[href^="${cssAttrEscape(`${targetPath}?`)}"]`;
46683
46702
  const anchor = page.locator(sel).first();
46703
+ const docStart = await page.evaluate(() => performance.timeOrigin).catch(() => {
46704
+ return;
46705
+ });
46684
46706
  const visible = await anchor.isVisible({ timeout: 1500 }).catch(() => false);
46685
46707
  let t;
46708
+ let viaFallback = false;
46709
+ let prefetched;
46686
46710
  if (visible) {
46687
46711
  await anchor.hover({ timeout: 1500 }).catch(() => {
46688
46712
  return;
46689
46713
  });
46690
46714
  await page.waitForTimeout(500);
46715
+ const mobile = (page.viewportSize()?.width ?? 1440) < 768;
46716
+ const box = mobile ? await anchor.boundingBox().catch(() => null) : null;
46717
+ if (box) {
46718
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
46719
+ await page.mouse.down();
46720
+ await page.waitForTimeout(500);
46721
+ }
46722
+ const clickAt = Date.now();
46723
+ const tracker = speculationTrackers.get(page.context());
46724
+ if (tracker)
46725
+ await withCap(Promise.all([...tracker.pending]), 2000, []);
46726
+ prefetched = prefetchVerdict(tracker, targetUrl, docStart, clickAt);
46691
46727
  t = Date.now();
46692
46728
  await Promise.allSettled([
46693
- page.waitForURL((u) => u.toString().includes(targetPath), { timeout: NAV_CAP_MS }).catch(() => {
46729
+ page.waitForURL((u) => u.toString().includes(targetPath), { timeout: 6000 }).catch(() => {
46694
46730
  return;
46695
46731
  }),
46696
- anchor.click({ timeout: 3000 })
46732
+ box ? page.mouse.up() : anchor.click({ timeout: 3000 })
46697
46733
  ]);
46734
+ if (!page.url().includes(targetPath)) {
46735
+ viaFallback = true;
46736
+ prefetched = undefined;
46737
+ t = Date.now();
46738
+ await page.goto(targetUrl, { waitUntil: "domcontentloaded", timeout: NAV_CAP_MS }).catch(() => {
46739
+ return;
46740
+ });
46741
+ }
46698
46742
  } else {
46743
+ viaFallback = true;
46699
46744
  t = Date.now();
46700
46745
  await page.goto(targetUrl, { waitUntil: "domcontentloaded", timeout: NAV_CAP_MS }).catch(() => {
46701
46746
  return;
@@ -46709,7 +46754,62 @@ async function navigateWithHover(page, targetUrl, productImage = false) {
46709
46754
  ok = await waitReady(page);
46710
46755
  }
46711
46756
  const navMs = Date.now() - t;
46712
- return { ok, navMs };
46757
+ const landed = page.url().includes(targetPath);
46758
+ return {
46759
+ ok: ok && landed,
46760
+ navMs,
46761
+ landed,
46762
+ viaFallback,
46763
+ ...prefetched !== undefined ? { prefetched } : {}
46764
+ };
46765
+ }
46766
+ function labelGotoFallback(note, viaFallback) {
46767
+ if (!viaFallback)
46768
+ return note;
46769
+ const label = "medido via goto (link não visível ou não navegou no clique), sem hover/prefetch";
46770
+ return note ? `${note} — ${label}` : label;
46771
+ }
46772
+ var speculationTrackers = new WeakMap;
46773
+ function trackSpeculativeRequests(ctx) {
46774
+ const tracker = { since: Date.now(), hits: [], pending: new Set };
46775
+ speculationTrackers.set(ctx, tracker);
46776
+ ctx.on("request", (r) => {
46777
+ const at = Date.now();
46778
+ const p = r.allHeaders().then((headers) => {
46779
+ if (sawSpeculativePrefetch([{ url: r.url(), headers }], r.url()))
46780
+ tracker.hits.push({ url: r.url(), headers, at });
46781
+ }).catch(() => {
46782
+ return;
46783
+ }).finally(() => tracker.pending.delete(p));
46784
+ tracker.pending.add(p);
46785
+ });
46786
+ }
46787
+ function prefetchVerdict(tracker, targetUrl, docStart, clickAt) {
46788
+ if (!tracker || docStart === undefined || !Number.isFinite(docStart))
46789
+ return "unknown";
46790
+ if (tracker.since > docStart)
46791
+ return "unknown";
46792
+ const inWindow = tracker.hits.filter((h) => h.at >= docStart - 250 && h.at <= clickAt);
46793
+ return sawSpeculativePrefetch(inWindow, targetUrl);
46794
+ }
46795
+ function sawSpeculativePrefetch(requests, targetUrl) {
46796
+ let target;
46797
+ try {
46798
+ target = new URL(targetUrl);
46799
+ } catch {
46800
+ return false;
46801
+ }
46802
+ return requests.some((r) => {
46803
+ const purpose = Object.entries(r.headers).find(([k]) => k.toLowerCase() === "sec-purpose")?.[1];
46804
+ if (!purpose?.toLowerCase().includes("prefetch"))
46805
+ return false;
46806
+ try {
46807
+ const u = new URL(r.url);
46808
+ return u.host === target.host && u.pathname === target.pathname;
46809
+ } catch {
46810
+ return false;
46811
+ }
46812
+ });
46713
46813
  }
46714
46814
  var HAMBURGER_SELECTORS = [
46715
46815
  'button[aria-label*="menu" i]',
@@ -46889,9 +46989,15 @@ async function clickShelfProduct(page, ctx) {
46889
46989
  return "";
46890
46990
  }
46891
46991
  })();
46892
- return now !== curPath ? { url: page.url(), imgOk: nav.ok, navMs: nav.navMs } : null;
46992
+ return now !== curPath ? {
46993
+ url: page.url(),
46994
+ imgOk: nav.ok,
46995
+ navMs: nav.navMs,
46996
+ viaFallback: nav.viaFallback,
46997
+ prefetched: nav.prefetched
46998
+ } : null;
46893
46999
  }
46894
- async function onePass(page, ctx, targets, paginations, measure) {
47000
+ async function onePass(page, ctx, targets, paginations, measure, paginationCapMs = 5000) {
46895
47001
  const shot = async (label, fullPage) => {
46896
47002
  if (!measure)
46897
47003
  return "";
@@ -46947,7 +47053,7 @@ async function onePass(page, ctx, targets, paginations, measure) {
46947
47053
  await page.evaluate(() => window.scrollTo(0, document.documentElement.scrollHeight)).catch(() => {
46948
47054
  return;
46949
47055
  });
46950
- const after = await waitForCardGrowth(page, before, 5000);
47056
+ const after = await waitForCardGrowth(page, before, paginationCapMs);
46951
47057
  if (after <= before) {
46952
47058
  pagination.push({
46953
47059
  step: `pagination-${i + 1}`,
@@ -46994,7 +47100,8 @@ async function onePass(page, ctx, targets, paginations, measure) {
46994
47100
  ms: pdpNav.navMs,
46995
47101
  url: page.url(),
46996
47102
  ok: pdpOk,
46997
- note: pdpOk ? undefined : pdpBroken ? "página não encontrada / erro" : !reachedPdp() ? "produto não encontrado (após retry)" : "imagem do produto não carregou"
47103
+ ...pdpNav.prefetched !== undefined ? { prefetched: pdpNav.prefetched } : {},
47104
+ note: labelGotoFallback(pdpOk ? undefined : pdpBroken ? "página não encontrada / erro" : !reachedPdp() ? "produto não encontrado (após retry)" : "imagem do produto não carregou", pdpNav.viaFallback)
46998
47105
  };
46999
47106
  await scrollPageInChunks(page).catch(() => {
47000
47107
  return;
@@ -47052,7 +47159,8 @@ async function onePass(page, ctx, targets, paginations, measure) {
47052
47159
  ms: shelfHit?.navMs ?? 0,
47053
47160
  url: page.url(),
47054
47161
  ok: shelfOk,
47055
- note: shelfBroken ? "página não encontrada / erro" : !shelfHit ? "shelf sem produto (após retry)" : !shelfHit.imgOk ? "imagem do produto da shelf não carregou" : "produto da shelf (SPA→SPA)"
47162
+ ...shelfHit?.prefetched !== undefined ? { prefetched: shelfHit.prefetched } : {},
47163
+ note: labelGotoFallback(shelfBroken ? "página não encontrada / erro" : !shelfHit ? "shelf sem produto (após retry)" : !shelfHit.imgOk ? "imagem do produto da shelf não carregou" : shelfHit.viaFallback ? "produto da shelf" : "produto da shelf (SPA→SPA)", !!shelfHit?.viaFallback)
47056
47164
  };
47057
47165
  await scrollPageInChunks(page).catch(() => {
47058
47166
  return;
@@ -47474,6 +47582,7 @@ async function runSideBenchmark(opts) {
47474
47582
  deviceScaleFactor: 1,
47475
47583
  cohortCookieValue: "control"
47476
47584
  });
47585
+ trackSpeculativeRequests(ctx);
47477
47586
  try {
47478
47587
  const page = await ctx.newPage();
47479
47588
  const flowCtx = flowCtxFor(ctx);
@@ -47489,12 +47598,12 @@ async function runSideBenchmark(opts) {
47489
47598
  if (targets) {
47490
47599
  for (let r = 0;r < opts.warmupRuns; r++) {
47491
47600
  emit(`[${opts.viewport}/${opts.side}] aquecendo (borda + navegador) — passe ${r + 1}/${opts.warmupRuns}`);
47492
- await onePass(page, flowCtx, targets, opts.paginations, false);
47601
+ await onePass(page, flowCtx, targets, opts.paginations, false, opts.paginationCapMs);
47493
47602
  }
47494
47603
  const runs = Math.max(1, opts.measuredRuns);
47495
47604
  for (let r = 0;r < runs; r++) {
47496
47605
  emit(`[${opts.viewport}/${opts.side}] medindo navegação — passe ${r + 1}/${runs}`);
47497
- const res = await onePass(page, flowCtx, targets, opts.paginations, true);
47606
+ const res = await onePass(page, flowCtx, targets, opts.paginations, true, opts.paginationCapMs);
47498
47607
  measured.push(res);
47499
47608
  Object.assign(screenshots, res.screenshots);
47500
47609
  }
@@ -47554,12 +47663,17 @@ async function runSideBenchmark(opts) {
47554
47663
  };
47555
47664
  }
47556
47665
  function aggregatePhase(step, samples) {
47666
+ const pf = samples.filter((s) => s.prefetched !== undefined);
47557
47667
  return {
47558
47668
  step,
47559
47669
  ms: median(samples.map((s) => s.ms)),
47670
+ spread: spreadOf(samples.map((s) => s.ms)),
47560
47671
  url: samples[0]?.url,
47561
47672
  ok: samples.length > 0 && samples.every((s) => s.ok),
47562
- note: (samples.find((s) => !s.ok) ?? samples.find((s) => s.note))?.note
47673
+ note: (samples.find((s) => !s.ok) ?? samples.find((s) => s.note))?.note,
47674
+ ...pf.length > 0 ? {
47675
+ prefetched: pf.every((s) => s.prefetched === true) ? true : pf.some((s) => s.prefetched === "unknown") ? "unknown" : false
47676
+ } : {}
47563
47677
  };
47564
47678
  }
47565
47679
  function aggregatePaginationTotal(measured) {
@@ -47567,6 +47681,7 @@ function aggregatePaginationTotal(measured) {
47567
47681
  return {
47568
47682
  step: "pagination",
47569
47683
  ms: median(perPass),
47684
+ spread: spreadOf(perPass),
47570
47685
  ok: measured.length > 0 && measured.every((m) => m.pagination.every((p) => p.ok)),
47571
47686
  note: `${measured[0]?.pagination.length ?? 0} scroll(s)`
47572
47687
  };
@@ -47579,6 +47694,7 @@ function aggregatePaginationSteps(measured) {
47579
47694
  out.push({
47580
47695
  step: `pagination-${i + 1}`,
47581
47696
  ms: median(atI.map((p) => p.ms)),
47697
+ spread: spreadOf(atI.map((p) => p.ms)),
47582
47698
  ok: atI.length > 0 && atI.every((p) => p.ok),
47583
47699
  note: (atI.find((p) => !p.ok) ?? atI[atI.length - 1])?.note
47584
47700
  });
@@ -47648,7 +47764,7 @@ async function resolveContentPaths(opts) {
47648
47764
  };
47649
47765
  await dismissAll(page, flow);
47650
47766
  const brand = await captureBrand(page);
47651
- const hrefs = await page.evaluate(() => Array.from(document.querySelectorAll("header a[href], nav a[href], a[href]")).map((a) => a.getAttribute("href")).filter((h) => !!h)).catch(() => []);
47767
+ const hrefs = await page.evaluate(() => Array.from(document.querySelectorAll("header a[href], nav a[href], a[href]")).filter((a) => !a.parentElement?.querySelector(":scope > ul, :scope > [class*='dropdown']:not(a), :scope > [class*='submenu']:not(a)")).map((a) => a.getAttribute("href")).filter((h) => !!h)).catch(() => []);
47652
47768
  const candidates = filterContentPaths(hrefs, opts.prodBase);
47653
47769
  const ok = [];
47654
47770
  for (const path of candidates) {
@@ -47672,6 +47788,38 @@ async function resolveContentPaths(opts) {
47672
47788
  });
47673
47789
  }
47674
47790
  }
47791
+ async function revealLink(page, base, path) {
47792
+ const sel = `a[href="${cssAttrEscape(path)}"], a[href^="${cssAttrEscape(`${path}?`)}"]`;
47793
+ const isVis = () => page.locator(sel).first().isVisible({ timeout: 400 }).catch(() => false);
47794
+ if (await isVis())
47795
+ return true;
47796
+ await openMenu(page).catch(() => {
47797
+ return;
47798
+ });
47799
+ if (await isVis())
47800
+ return true;
47801
+ const triggers = page.locator("header [aria-haspopup], header .dropdown > a, header .dropdown > button, header li:has(> ul) > a, header li:has(> ul) > button");
47802
+ const n = Math.min(await triggers.count().catch(() => 0), 12);
47803
+ for (let i = 0;i < n; i++) {
47804
+ const before = page.url();
47805
+ await triggers.nth(i).click({ timeout: 1500 }).catch(() => {
47806
+ return;
47807
+ });
47808
+ await page.waitForTimeout(300);
47809
+ if (page.url() !== before && !page.url().includes(path)) {
47810
+ await page.goto(base, { waitUntil: "domcontentloaded", timeout: 15000 }).catch(() => {
47811
+ return;
47812
+ });
47813
+ await waitReady(page).catch(() => {
47814
+ return;
47815
+ });
47816
+ continue;
47817
+ }
47818
+ if (await isVis())
47819
+ return true;
47820
+ }
47821
+ return false;
47822
+ }
47675
47823
  async function onePassContent(page, ctx, paths, measure) {
47676
47824
  const shot = async (label, fullPage) => {
47677
47825
  if (!measure)
@@ -47699,27 +47847,24 @@ async function onePassContent(page, ctx, paths, measure) {
47699
47847
  });
47700
47848
  const homeShot = await shot("home", true);
47701
47849
  await scrollToTop(page);
47702
- const urlA = new URL(paths.pageA, ctx.baseUrl).toString();
47703
- const a = await navigateWithHover(page, urlA, false);
47704
- const nav1Broken = await pageLooksBroken(page);
47705
- const nav1 = {
47706
- step: "nav-to-page-1",
47707
- ms: a.navMs,
47708
- url: page.url(),
47709
- ok: a.ok && !nav1Broken,
47710
- note: !a.ok ? `atingiu o cap de espera sem sinal de prontidão (${paths.pageA})` : nav1Broken ? "página não encontrada / erro" : paths.pageA
47850
+ const hop = async (step, path) => {
47851
+ await revealLink(page, ctx.baseUrl, path).catch(() => {
47852
+ return;
47853
+ });
47854
+ const nav = await navigateWithHover(page, new URL(path, ctx.baseUrl).toString(), false);
47855
+ const broken = await pageLooksBroken(page);
47856
+ return {
47857
+ step,
47858
+ ms: nav.navMs,
47859
+ url: page.url(),
47860
+ ok: nav.ok && !broken,
47861
+ ...nav.prefetched !== undefined ? { prefetched: nav.prefetched } : {},
47862
+ note: labelGotoFallback(!nav.landed ? `${path} — navegação não trocou de página` : !nav.ok ? `atingiu o cap de espera sem sinal de prontidão (${path})` : broken ? "página não encontrada / erro" : path, nav.viaFallback)
47863
+ };
47711
47864
  };
47865
+ const nav1 = await hop("nav-to-page-1", paths.pageA);
47712
47866
  const shotA = await shot("page1", true);
47713
- const urlB = new URL(paths.pageB, ctx.baseUrl).toString();
47714
- const b = await navigateWithHover(page, urlB, false);
47715
- const nav2Broken = await pageLooksBroken(page);
47716
- const nav2 = {
47717
- step: "nav-to-page-2",
47718
- ms: b.navMs,
47719
- url: page.url(),
47720
- ok: b.ok && !nav2Broken,
47721
- note: !b.ok ? `atingiu o cap de espera sem sinal de prontidão (${paths.pageB})` : nav2Broken ? "página não encontrada / erro" : paths.pageB
47722
- };
47867
+ const nav2 = await hop("nav-to-page-2", paths.pageB);
47723
47868
  const shotB = await shot("page2", true);
47724
47869
  return { home, nav1, nav2, screenshots: { home: homeShot, plp: shotA, pdp: shotB } };
47725
47870
  }
@@ -47743,6 +47888,7 @@ async function runSideBenchmarkContent(opts) {
47743
47888
  deviceScaleFactor: 1,
47744
47889
  cohortCookieValue: "control"
47745
47890
  });
47891
+ trackSpeculativeRequests(ctx);
47746
47892
  const flowCtx = {
47747
47893
  baseUrl: opts.base,
47748
47894
  side: opts.side,
@@ -48453,6 +48599,11 @@ function L(pt, en, lang) {
48453
48599
  function fmtMs(ms) {
48454
48600
  return ms >= 1000 ? `${(ms / 1000).toFixed(2)}s` : `${Math.round(ms)}ms`;
48455
48601
  }
48602
+ function fmtRange(s) {
48603
+ if (!s?.spread || s.spread.samples < 2)
48604
+ return "";
48605
+ return `${fmtMs(s.spread.minMs)}–${fmtMs(s.spread.maxMs)}`;
48606
+ }
48456
48607
  function domainOf(url) {
48457
48608
  try {
48458
48609
  return new URL(url).hostname.replace(/^www\./, "");
@@ -48527,7 +48678,8 @@ function renderStep(step, prod, cand, lang) {
48527
48678
  const c = candStep?.ms ?? 0;
48528
48679
  const max = Math.max(p, c, 1);
48529
48680
  const label = STEP_LABELS[step.step] ?? { pt: step.step, en: step.step };
48530
- const tone = deltaTone(p, c);
48681
+ const noise = noiseWarning(prodStep, candStep);
48682
+ const tone = noise ? DECK.muted : deltaTone(p, c);
48531
48683
  const shotKey = STEP_SHOT[step.step];
48532
48684
  const scroll = true;
48533
48685
  const naNote = candStep?.ms === 0 ? candStep.note : undefined;
@@ -48538,12 +48690,15 @@ function renderStep(step, prod, cand, lang) {
48538
48690
  <div class="step-note">${L(naNote, naNote, lang)}</div>
48539
48691
  </section>`;
48540
48692
  }
48541
- const bar = (ms, who, color) => `
48693
+ const bar = (ms, who, color, s) => {
48694
+ const r = fmtRange(s);
48695
+ return `
48542
48696
  <div class="bar-row">
48543
48697
  <span class="bar-who">${who}</span>
48544
48698
  <div class="bar-track"><div class="bar-fill" style="width:${ms / max * 100}%;background:${color}"></div></div>
48545
- <span class="bar-val" style="color:${color}">${fmtMs(ms)}</span>
48699
+ <span class="bar-val" style="color:${color}">${fmtMs(ms)}${r ? `<span class="bar-range">${r}</span>` : ""}</span>
48546
48700
  </div>`;
48701
+ };
48547
48702
  const subSteps = (() => {
48548
48703
  if (step.step !== "pagination")
48549
48704
  return "";
@@ -48572,6 +48727,13 @@ function renderStep(step, prod, cand, lang) {
48572
48727
  const delta = failed ? `<div class="step-delta"><strong style="color:${DECK.bad}">⚠ ${L("erro", "error", lang)}</strong>
48573
48728
  <span class="step-delta-sub">${L(candFailed ? "TanStack falhou" : "Fresh falhou", candFailed ? "TanStack failed" : "Fresh failed", lang)}</span></div>` : `<div class="step-delta" style="color:${tone}"><strong>${pctChange(p, c)}</strong>
48574
48729
  <span class="step-delta-sub">${L("vs. Fresh", "vs. Fresh", lang)}</span></div>`;
48730
+ const coldSides = [
48731
+ prodStep?.prefetched === false ? "Fresh" : "",
48732
+ candStep?.prefetched === false ? "TanStack" : ""
48733
+ ].filter(Boolean).join(" + ");
48734
+ const coldNote = coldSides ? `<div class="step-note">${L(`Sem prefetch (${coldSides}): nenhum request Sec-Purpose: prefetch antes do clique — tempo de navegação fria.`, `No prefetch (${coldSides}): no Sec-Purpose: prefetch request before the click — cold navigation time.`, lang)}</div>` : "";
48735
+ const noiseWho = noise?.side === "cand" ? "TanStack" : "Fresh";
48736
+ const noiseNote = noise ? `<div class="step-note step-note-noise">~ ${L(`${noiseWho} variou ${fmtMs(noise.noiseMs)} entre as passadas; uma diferença de ${fmtMs(noise.deltaMs)} está dentro desse ruído — não dá para atribuir.`, `${noiseWho} varied by ${fmtMs(noise.noiseMs)} across passes; a ${fmtMs(noise.deltaMs)} difference is inside that noise — it cannot be attributed.`, lang)}</div>` : "";
48575
48737
  return `
48576
48738
  <section class="step${failed ? " step-failed" : ""}">
48577
48739
  <div class="step-head">
@@ -48579,11 +48741,13 @@ function renderStep(step, prod, cand, lang) {
48579
48741
  ${delta}
48580
48742
  </div>
48581
48743
  <div class="step-bars">
48582
- ${bar(p, "Fresh", prodFailed ? DECK.bad : DECK.faint)}
48583
- ${bar(c, "TanStack", candFailed ? DECK.bad : DECK.soft)}
48744
+ ${bar(p, "Fresh", prodFailed ? DECK.bad : DECK.faint, prodStep)}
48745
+ ${bar(c, "TanStack", candFailed ? DECK.bad : DECK.soft, candStep)}
48584
48746
  ${subSteps}
48585
48747
  </div>
48586
48748
  ${failed ? `<div class="step-note step-note-err">⚠ ${L(failNote, failNote, lang)}</div>` : candStep?.note ? `<div class="step-note">${L(candStep.note, candStep.note, lang)}</div>` : ""}
48749
+ ${coldNote}
48750
+ ${noiseNote}
48587
48751
  <div class="step-shots">
48588
48752
  ${figure(shotKey ? prod.screenshots[shotKey] : undefined, "Fresh", prodFailed ? DECK.bad : DECK.faint, prodStep?.url, scroll)}
48589
48753
  ${figure(shotKey ? cand.screenshots[shotKey] : undefined, "TanStack", candFailed ? DECK.bad : DECK.soft, candStep?.url, scroll)}
@@ -48639,7 +48803,7 @@ function renderViewport(report, viewport, lang) {
48639
48803
  const ps = prod.steps.find((s) => s.step === cs.step);
48640
48804
  const p = ps?.ms ?? 0;
48641
48805
  const label = STEP_LABELS[cs.step] ?? { pt: cs.step, en: cs.step };
48642
- const tone = deltaTone(p, cs.ms);
48806
+ const tone = noiseWarning(ps, cs) ? DECK.muted : deltaTone(p, cs.ms);
48643
48807
  return `<div class="tile">
48644
48808
  <span class="tile-val" style="color:${tone}">${fmtMs(cs.ms)}</span>
48645
48809
  <span class="tile-label">${L(label.pt, label.en, lang)}</span>
@@ -48665,6 +48829,7 @@ function renderViewport(report, viewport, lang) {
48665
48829
 
48666
48830
  <div class="eyebrow section-eyebrow">${L("OS CINCO PASSOS, LADO A LADO", "THE FIVE STEPS, SIDE BY SIDE", lang)}</div>
48667
48831
  <div class="stat-grid">${statTiles}</div>
48832
+ <p class="annotation">${report.measuredRuns < 2 ? L("⚠ 1 passada medida por lado: sem dispersão, nenhuma diferença pode ser separada do ruído.", "⚠ 1 measured pass per side: no spread, so no difference can be told apart from noise.", lang) : L("Faixas = mín–máx entre as passadas medidas. Só compare números deste mesmo relatório: entre execuções diferentes o Fresh chega a variar 2×.", "Ranges = min–max across the measured passes. Only compare numbers within this report: between separate runs Fresh varies by up to 2×.", lang)}</p>
48668
48833
 
48669
48834
  <div class="steps">${steps}</div>
48670
48835
 
@@ -48708,7 +48873,7 @@ function methodologyModal(report, lang) {
48708
48873
  </ul>
48709
48874
  <p>O hover (que dispara o prefetch do SPA) é aplicado igual nos dois sites e fica FORA do tempo — medimos só o clique→conteúdo.</p>
48710
48875
  <h3>4. Média</h3>
48711
- <p>Cada número é a <b>mediana de ${report.measuredRuns} medição(ões)</b> por lado, para cortar variância. O HAR completo da sessão fica salvo como artefato forense.</p>`;
48876
+ <p>Cada número é a <b>mediana de ${report.measuredRuns} medição(ões)</b> por lado, para cortar variância; a faixa mín–máx aparece ao lado. Quando a diferença entre os lados cabe dentro da variação de um deles, o passo fica cinza e é marcado como ruído. Os dois sites são medidos <b>ao mesmo tempo</b>, então oscilações de rede afetam ambos — mas números de execuções diferentes não são comparáveis entre si. O HAR completo da sessão fica salvo como artefato forense.</p>`;
48712
48877
  const en = `
48713
48878
  <h3>1. Scout (once)</h3>
48714
48879
  <p>An explorer validates, in the browser, a category (PLP) and a product (PDP) that <b>work on BOTH sites</b> — they render a real product, no error page. The SAME pages are used on both sides.</p>
@@ -48725,7 +48890,7 @@ function methodologyModal(report, lang) {
48725
48890
  </ul>
48726
48891
  <p>The hover (which triggers the SPA prefetch) is applied identically on both sides and kept OUT of the timing — we measure only click→content.</p>
48727
48892
  <h3>4. Median</h3>
48728
- <p>Each number is the <b>median of ${report.measuredRuns} measurement(s)</b> per side, to cut variance. The full session HAR is saved as a forensic artifact.</p>`;
48893
+ <p>Each number is the <b>median of ${report.measuredRuns} measurement(s)</b> per side, to cut variance; the min–max range is shown next to it. When the difference between the sides fits inside either side's own variation, the step is greyed out and marked as noise. Both sites are measured <b>at the same time</b>, so network swings hit both — but numbers from separate runs are not comparable. The full session HAR is saved as a forensic artifact.</p>`;
48729
48894
  return `<div class="modal-back" id="infoModal">
48730
48895
  <div class="modal">
48731
48896
  <button class="mclose" id="infoClose" type="button" aria-label="fechar">×</button>
@@ -48862,6 +49027,8 @@ ${report.favicon ? `<link rel="icon" href="${esc(report.favicon)}"/>` : ""}
48862
49027
  /* failures */
48863
49028
  .step-failed{border-color:rgba(212,61,61,0.35);box-shadow:0 0 0 1px rgba(212,61,61,0.12) inset}
48864
49029
  .step-note-err{background:rgba(212,61,61,0.06);border-color:rgba(212,61,61,0.25);color:#a5302f}
49030
+ .bar-range{display:block;font-size:11px;font-weight:400;color:var(--faint)}
49031
+ .step-note-noise{color:var(--muted);font-style:italic}
48865
49032
  .warn-banner{margin:18px 0 4px;padding:14px 18px;border-radius:14px;background:rgba(212,61,61,0.07);
48866
49033
  border:1px solid rgba(212,61,61,0.3);color:#a5302f;font-size:14px;line-height:1.55}
48867
49034
  .warn-banner b{color:#8f2624}
@@ -49002,6 +49169,7 @@ async function benchmarkCommand(opts) {
49002
49169
  const warmupRuns = num(opts.warmupRuns, 2);
49003
49170
  const measuredRuns = Math.max(1, num(opts.measuredRuns, 3));
49004
49171
  const paginations = num(opts.paginations, 3);
49172
+ const paginationCapMs = num(opts.paginationCapMs ?? 5000, 5000) || 5000;
49005
49173
  const runVitals = opts.vitals !== false;
49006
49174
  const lang = opts.lang === "en" ? "en" : "pt";
49007
49175
  const rc = loadParityRc();
@@ -49063,6 +49231,7 @@ async function benchmarkCommand(opts) {
49063
49231
  warmupRuns,
49064
49232
  measuredRuns,
49065
49233
  paginations,
49234
+ paginationCapMs,
49066
49235
  runVitals,
49067
49236
  onEvent
49068
49237
  });
@@ -49157,6 +49326,11 @@ async function benchmarkCommand(opts) {
49157
49326
  function fmt(ms) {
49158
49327
  return ms >= 1000 ? `${(ms / 1000).toFixed(2)}s` : `${Math.round(ms)}ms`;
49159
49328
  }
49329
+ function range(s) {
49330
+ if (!s?.spread || s.spread.samples < 2)
49331
+ return "";
49332
+ return chalk5.dim(` (${fmt(s.spread.minMs)}–${fmt(s.spread.maxMs)})`);
49333
+ }
49160
49334
  function printSummary2(report) {
49161
49335
  for (const viewport of report.viewports) {
49162
49336
  const prod = report.sides.find((s) => s.viewport === viewport && s.side === "prod");
@@ -49171,9 +49345,17 @@ function printSummary2(report) {
49171
49345
  for (const cs of cand.steps) {
49172
49346
  const ps = prod.steps.find((s) => s.step === cs.step);
49173
49347
  const flag = ps?.ok === false || cs.ok === false ? chalk5.red(` ✗ ERRO: ${cs.ok === false ? "cand" : "prod"} ${cs.note ?? ""}`) : "";
49174
- console.log(` ${cs.step.padEnd(16)} prod ${fmt(ps?.ms ?? 0).padStart(8)} cand ${fmt(cs.ms).padStart(8)}${flag}`);
49348
+ const cold = [ps?.prefetched === false ? "prod" : "", cs.prefetched === false ? "cand" : ""].filter(Boolean).join("+");
49349
+ const noise = noiseWarning(ps, cs);
49350
+ console.log(` ${cs.step.padEnd(16)} prod ${fmt(ps?.ms ?? 0).padStart(8)}${range(ps)} cand ${fmt(cs.ms).padStart(8)}${range(cs)}${flag}${cold ? chalk5.dim(` sem prefetch: ${cold}`) : ""}`);
49351
+ if (noise) {
49352
+ console.log(chalk5.yellow(` ~ ${noise.side} variou ${fmt(noise.noiseMs)} entre passes; a diferença de ${fmt(noise.deltaMs)} está dentro desse ruído — não é resultado`));
49353
+ }
49175
49354
  }
49176
49355
  }
49356
+ console.log("");
49357
+ console.log(chalk5.dim(report.measuredRuns < 2 ? " ⚠ 1 passe medido por lado: sem dispersão, nenhum delta pode ser separado do ruído. Use --measured-runs ≥ 3." : " faixa = min–max entre os passes medidos. Números de runs diferentes não são comparáveis (o prod deriva até 2x entre runs)."));
49358
+ console.log(chalk5.dim(" Para medir uma mudança do candidato: --prod <cand-antes> --cand <cand-depois> no MESMO run."));
49177
49359
  const failed = report.sides.flatMap((s) => s.steps.filter((st) => st.ok === false).map((st) => `${s.side}/${st.step}`));
49178
49360
  if (failed.length > 0) {
49179
49361
  console.log("");
@@ -61934,6 +62116,7 @@ async function captureSectionArtifacts(page, opts) {
61934
62116
  const matches = $(opts.selector);
61935
62117
  if (matches.length === 0) {
61936
62118
  result.htmlError = `seletor '${opts.selector}' não casou nenhum elemento`;
62119
+ result.htmlNoMatch = true;
61937
62120
  } else {
61938
62121
  result.html = $.html(matches.first());
61939
62122
  }
@@ -62434,6 +62617,26 @@ function compactComponentHtml(html, maxChars = COMPONENT_HTML_MAX_CHARS) {
62434
62617
  truncated
62435
62618
  };
62436
62619
  }
62620
+ function viewportDeltas(primary, others) {
62621
+ const primaryHtml = normalizeForCompare(primary.html);
62622
+ const out = [];
62623
+ for (const o of others) {
62624
+ if (o.status === "absent") {
62625
+ out.push({ viewport: o.viewport, absent: true, keepScreenshot: false });
62626
+ continue;
62627
+ }
62628
+ if (o.status === "failed") {
62629
+ out.push({ viewport: o.viewport, failed: o.reason, keepScreenshot: false });
62630
+ continue;
62631
+ }
62632
+ const htmlDiffers = normalizeForCompare(o.html) !== primaryHtml;
62633
+ const keepScreenshot = o.screenshot !== null && !primary.screenshot?.equals(o.screenshot);
62634
+ if (!htmlDiffers && !keepScreenshot)
62635
+ continue;
62636
+ out.push({ viewport: o.viewport, ...htmlDiffers ? { html: o.html } : {}, keepScreenshot });
62637
+ }
62638
+ return out;
62639
+ }
62437
62640
 
62438
62641
  // src/commands/section.ts
62439
62642
  import { mkdirSync as mkdirSync12 } from "node:fs";
@@ -62915,7 +63118,7 @@ function mergePlanDecisions(fresh, previous) {
62915
63118
  return { plan: fresh, carried, keptUncaptured, droppedWithDecisions: [] };
62916
63119
  }
62917
63120
  var PLAN_FILE = "migration-plan.json";
62918
- var SETTLED = new Set(["done", "as-is", "upgrade", "skipped"]);
63121
+ var SETTLED = new Set(["done", "as-is", "upgrade", "skipped", "vanished"]);
62919
63122
  function loadPlan(dir) {
62920
63123
  const p = join22(dir, PLAN_FILE);
62921
63124
  if (!existsSync13(p))
@@ -62929,9 +63132,26 @@ function savePlan(dir, plan) {
62929
63132
  function setComponentStatus(plan, name, status, opts = {}) {
62930
63133
  const k = key(name);
62931
63134
  const component = plan.components.find((c) => key(c.name) === k);
63135
+ if (!component && !opts.create)
63136
+ return null;
63137
+ const given = opts.note?.trim() ?? "";
63138
+ if (status === "vanished" && !given && !component?.reference?.note?.trim()) {
63139
+ throw new Error('`vanished` needs a note — "<capture date>: <why it is gone from prod>". Without it the row reads as a forgotten gap.');
63140
+ }
63141
+ const withNote = (c) => {
63142
+ if (given) {
63143
+ c.reference = {
63144
+ url: c.reference?.url ?? "",
63145
+ selector: c.reference?.selector ?? null,
63146
+ note: given,
63147
+ ...c.reference?.design ? { design: c.reference.design } : {}
63148
+ };
63149
+ }
63150
+ return c;
63151
+ };
62932
63152
  if (component) {
62933
63153
  component.status = status;
62934
- return component;
63154
+ return withNote(component);
62935
63155
  }
62936
63156
  if (!opts.create)
62937
63157
  return null;
@@ -62947,7 +63167,7 @@ function setComponentStatus(plan, name, status, opts = {}) {
62947
63167
  verified: null
62948
63168
  };
62949
63169
  plan.components.push(created);
62950
- return created;
63170
+ return withNote(created);
62951
63171
  }
62952
63172
  function setComponentProvenance(plan, name, provenance) {
62953
63173
  const k = key(name);
@@ -63009,10 +63229,15 @@ function planProgress(plan) {
63009
63229
  done: 0,
63010
63230
  "as-is": 0,
63011
63231
  upgrade: 0,
63012
- skipped: 0
63232
+ skipped: 0,
63233
+ vanished: 0
63013
63234
  };
63014
63235
  const settled = [];
63015
- const settledByStatus = { done: [], skipped: [] };
63236
+ const settledByStatus = {
63237
+ done: [],
63238
+ skipped: [],
63239
+ vanished: []
63240
+ };
63016
63241
  const accepted = { asIs: [], upgrade: [] };
63017
63242
  const remaining = [];
63018
63243
  for (const c of plan.components) {
@@ -63025,6 +63250,8 @@ function planProgress(plan) {
63025
63250
  settledByStatus.done.push(c.name);
63026
63251
  if (c.status === "skipped")
63027
63252
  settledByStatus.skipped.push(c.name);
63253
+ if (c.status === "vanished")
63254
+ settledByStatus.vanished.push(c.name);
63028
63255
  if (SETTLED.has(c.status))
63029
63256
  settled.push(c.name);
63030
63257
  else
@@ -63081,7 +63308,7 @@ function sourcePath(plan, c) {
63081
63308
  function disposition(c) {
63082
63309
  if (c.status === "pending" || c.status === "partial")
63083
63310
  return "build";
63084
- if (c.status === "skipped")
63311
+ if (c.status === "skipped" || c.status === "vanished")
63085
63312
  return "settled";
63086
63313
  if (c.status === "as-is")
63087
63314
  return "as-is";
@@ -65469,10 +65696,229 @@ function listCommand(output) {
65469
65696
  return 0;
65470
65697
  }
65471
65698
 
65472
- // src/commands/migrate.ts
65473
- import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync24, writeFileSync as writeFileSync25 } from "node:fs";
65474
- import { resolve as resolve7 } from "node:path";
65699
+ // src/commands/loadtest.ts
65700
+ import { existsSync as existsSync14, readFileSync as readFileSync20 } from "node:fs";
65475
65701
  import chalk21 from "chalk";
65702
+ var MAX_RPS = 100;
65703
+ var MAX_DURATION_SEC = 900;
65704
+ var MAX_IN_FLIGHT = 512;
65705
+ var LATE_MS = 250;
65706
+ var LATE_SHARE = 0.05;
65707
+ function scheduleOffsets(rps, durationSec) {
65708
+ const n = Math.floor(rps * durationSec);
65709
+ const step = 1000 / rps;
65710
+ return Array.from({ length: n }, (_, i) => i * step);
65711
+ }
65712
+ function pickTarget(i, paths, devices) {
65713
+ return {
65714
+ path: paths[Math.floor(i / devices.length) % paths.length],
65715
+ device: devices[i % devices.length]
65716
+ };
65717
+ }
65718
+ function cacheStateOf(h) {
65719
+ const obs = classifyCacheHeaders(h);
65720
+ if (obs.state !== "unknown")
65721
+ return { state: obs.state, segment: obs.segment };
65722
+ const cf = h.get("cf-cache-status")?.trim().toLowerCase();
65723
+ const state = cf === "hit" || cf === "revalidated" ? "hit" : cf === "stale" ? "stale-hit" : cf === "miss" || cf === "expired" ? "miss" : "unknown";
65724
+ return { state, segment: obs.segment };
65725
+ }
65726
+ function summarize(samples) {
65727
+ const status = {};
65728
+ const cache = {};
65729
+ for (const s of samples) {
65730
+ const k = s.status === 0 ? "error" : String(s.status);
65731
+ status[k] = (status[k] ?? 0) + 1;
65732
+ cache[s.state] = (cache[s.state] ?? 0) + 1;
65733
+ }
65734
+ const ok = samples.filter((s) => s.status !== 0).map((s) => s.durationMs).sort((a, b) => a - b);
65735
+ const p = (q) => ok.length === 0 ? null : Math.round(percentile(ok, q));
65736
+ return {
65737
+ requests: samples.length,
65738
+ status,
65739
+ p50Ms: p(50),
65740
+ p95Ms: p(95),
65741
+ p99Ms: p(99),
65742
+ hitRate: hitRate(samples.map((s) => s.state)),
65743
+ cache
65744
+ };
65745
+ }
65746
+ function groupBy(samples, key) {
65747
+ const groups = new Map;
65748
+ for (const s of samples) {
65749
+ const k = key(s);
65750
+ (groups.get(k) ?? groups.set(k, []).get(k)).push(s);
65751
+ }
65752
+ return Object.fromEntries([...groups].map(([k, v]) => [k, summarize(v)]));
65753
+ }
65754
+ async function runLoad(args) {
65755
+ const { baseUrl, paths, devices, rps, durationSec } = args;
65756
+ const offsets = scheduleOffsets(rps, durationSec);
65757
+ const samples = [];
65758
+ const inFlight = new Set;
65759
+ let dropped = 0;
65760
+ let late = 0;
65761
+ let lastSentAt = 0;
65762
+ const fire = async (path, device) => {
65763
+ const started = performance.now();
65764
+ let status = 0;
65765
+ let state = "unknown";
65766
+ let segment = null;
65767
+ try {
65768
+ const res = await fetch(new URL(path, baseUrl), {
65769
+ redirect: "manual",
65770
+ headers: {
65771
+ "user-agent": userAgentFor(device),
65772
+ "accept-encoding": "gzip",
65773
+ accept: "text/html"
65774
+ },
65775
+ signal: AbortSignal.timeout(args.timeoutMs ?? 30000)
65776
+ });
65777
+ await res.arrayBuffer();
65778
+ status = res.status;
65779
+ ({ state, segment } = cacheStateOf(res.headers));
65780
+ } catch {}
65781
+ samples.push({
65782
+ path,
65783
+ kind: classifyPath2(path.split("?")[0]),
65784
+ device,
65785
+ segment,
65786
+ status,
65787
+ durationMs: performance.now() - started,
65788
+ state
65789
+ });
65790
+ };
65791
+ const t0 = performance.now();
65792
+ for (let i = 0;i < offsets.length; i++) {
65793
+ const wait = t0 + offsets[i] - performance.now();
65794
+ if (wait > 0)
65795
+ await new Promise((r) => setTimeout(r, wait));
65796
+ else if (-wait > LATE_MS)
65797
+ late++;
65798
+ if (inFlight.size >= MAX_IN_FLIGHT) {
65799
+ dropped++;
65800
+ continue;
65801
+ }
65802
+ const { path, device } = pickTarget(i, paths, devices);
65803
+ const p = fire(path, device).finally(() => inFlight.delete(p));
65804
+ inFlight.add(p);
65805
+ lastSentAt = performance.now() - t0;
65806
+ }
65807
+ await Promise.all(inFlight);
65808
+ const wallSec = (performance.now() - t0) / 1000;
65809
+ const sent = offsets.length - dropped;
65810
+ const sentRps = sent / Math.max((lastSentAt + 1000 / rps) / 1000, 0.000000001);
65811
+ const why = [];
65812
+ if (dropped > 0)
65813
+ why.push(`${dropped} requests dropped at the ${MAX_IN_FLIGHT} in-flight ceiling (latency × rate outran the client)`);
65814
+ if (late / Math.max(offsets.length, 1) > LATE_SHARE)
65815
+ why.push(`${late} requests left >${LATE_MS}ms behind schedule (this machine's event loop fell behind)`);
65816
+ const covered = new Set(samples.map((s) => `${s.path}\x00${s.device}`)).size;
65817
+ return {
65818
+ url: baseUrl,
65819
+ paths: paths.length,
65820
+ devices: [...devices],
65821
+ requestedRps: rps,
65822
+ durationSec,
65823
+ scheduled: offsets.length,
65824
+ sent,
65825
+ dropped,
65826
+ late,
65827
+ sentRps: round(sentRps),
65828
+ completedRps: round(samples.length / Math.max(wallSec, 0.000000001)),
65829
+ clientLimited: why.length > 0,
65830
+ clientLimitedWhy: why.length > 0 ? why.join("; ") : null,
65831
+ coverage: round(covered / (paths.length * devices.length)),
65832
+ overall: summarize(samples),
65833
+ byKind: groupBy(samples, (s) => s.kind),
65834
+ byDevice: groupBy(samples, (s) => s.device),
65835
+ bySegment: groupBy(samples, (s) => s.segment ?? `${s.device}:unreported`)
65836
+ };
65837
+ }
65838
+ var round = (n) => Math.round(n * 100) / 100;
65839
+ async function loadtestCommand(opts) {
65840
+ const refuse = (msg) => {
65841
+ console.error(chalk21.red(`parity loadtest: ${msg}`));
65842
+ return 2;
65843
+ };
65844
+ if (!Number.isFinite(opts.rps) || opts.rps <= 0 || opts.rps > MAX_RPS)
65845
+ return refuse(`--rps must be in (0, ${MAX_RPS}] (got ${opts.rps}) — the cap keeps a typo from becoming an attack on someone's store`);
65846
+ if (!Number.isFinite(opts.duration) || opts.duration <= 0 || opts.duration > MAX_DURATION_SEC)
65847
+ return refuse(`--duration must be in (0, ${MAX_DURATION_SEC}] seconds (got ${opts.duration})`);
65848
+ const devices = [];
65849
+ for (const d of opts.devices.split(",").map((s) => s.trim()).filter(Boolean)) {
65850
+ const v = Viewport.safeParse(d);
65851
+ if (!v.success)
65852
+ return refuse(`unknown device "${d}" (mobile, tablet, desktop)`);
65853
+ devices.push(v.data);
65854
+ }
65855
+ if (devices.length === 0)
65856
+ return refuse("--devices is empty");
65857
+ let paths;
65858
+ if (opts.paths) {
65859
+ const raw = existsSync14(opts.paths) ? readFileSync20(opts.paths, "utf8").split(`
65860
+ `) : opts.paths.split(",");
65861
+ paths = raw.map((s) => toPath(s.trim())).filter(Boolean);
65862
+ } else {
65863
+ if (opts.pathsFrom && opts.pathsFrom !== "sitemap")
65864
+ return refuse(`--paths-from only supports "sitemap" (got "${opts.pathsFrom}")`);
65865
+ paths = (await resolveSitemapUrls(opts.url)).map(toPath).filter((p) => p && classifyPath2(p) !== "auth");
65866
+ }
65867
+ paths = [...new Set(paths)].slice(0, opts.limit && opts.limit > 0 ? opts.limit : undefined);
65868
+ if (paths.length === 0)
65869
+ return refuse("no paths to load — sitemap empty/unreachable or --paths empty. Nothing measured.");
65870
+ if (!opts.json)
65871
+ console.error(chalk21.dim(`loadtest ${opts.url}: ${opts.rps} rps × ${opts.duration}s over ${paths.length} paths × ${devices.join("/")}`));
65872
+ const r = await runLoad({
65873
+ baseUrl: opts.url,
65874
+ paths,
65875
+ devices,
65876
+ rps: opts.rps,
65877
+ durationSec: opts.duration
65878
+ });
65879
+ if (opts.json)
65880
+ console.log(JSON.stringify(r, null, 2));
65881
+ else
65882
+ printSummary7(r);
65883
+ if (r.overall.requests === 0 || r.overall.requests === (r.overall.status.error ?? 0))
65884
+ return 2;
65885
+ if (r.clientLimited)
65886
+ return 3;
65887
+ const failed = Object.entries(r.overall.status).some(([k, n]) => n > 0 && (k === "error" || Number(k) >= 500));
65888
+ return failed ? 1 : 0;
65889
+ }
65890
+ function toPath(s) {
65891
+ if (!s)
65892
+ return "";
65893
+ try {
65894
+ const u = new URL(s);
65895
+ return u.pathname + u.search;
65896
+ } catch {
65897
+ return s.startsWith("/") ? s : `/${s}`;
65898
+ }
65899
+ }
65900
+ function printSummary7(r) {
65901
+ const pct = (v) => v == null ? "n/a" : `${Math.round(v * 100)}%`;
65902
+ const line = (label, s) => ` ${label.padEnd(28)} ${String(s.requests).padStart(6)} req p50 ${s.p50Ms ?? "-"} p95 ${s.p95Ms ?? "-"} p99 ${s.p99Ms ?? "-"} ms hit ${pct(s.hitRate)} ${Object.entries(s.status).map(([k, n]) => `${k}:${n}`).join(" ")}`;
65903
+ console.log(`Throughput: requested ${r.requestedRps} rps · sent ${r.sentRps} rps · completed ${r.completedRps} rps · coverage ${pct(r.coverage)} of path×device`);
65904
+ if (r.clientLimited)
65905
+ console.log(chalk21.yellow(` CLIENT-LIMITED — the generator, not the site, capped the rate: ${r.clientLimitedWhy}`));
65906
+ console.log(line("overall", r.overall));
65907
+ console.log("By segment (x-cache-segment):");
65908
+ for (const [k, s] of Object.entries(r.bySegment))
65909
+ console.log(line(k, s));
65910
+ console.log("By device:");
65911
+ for (const [k, s] of Object.entries(r.byDevice))
65912
+ console.log(line(k, s));
65913
+ console.log("By path kind:");
65914
+ for (const [k, s] of Object.entries(r.byKind))
65915
+ console.log(line(k, s));
65916
+ }
65917
+
65918
+ // src/commands/migrate.ts
65919
+ import { existsSync as existsSync19, mkdirSync as mkdirSync16, readFileSync as readFileSync25, rmSync, writeFileSync as writeFileSync25 } from "node:fs";
65920
+ import { relative as relative4, resolve as resolve7 } from "node:path";
65921
+ import chalk22 from "chalk";
65476
65922
  import open from "open";
65477
65923
 
65478
65924
  // src/migrate/pdp-discovery.ts
@@ -65900,7 +66346,7 @@ function escapePipes2(s) {
65900
66346
  }
65901
66347
 
65902
66348
  // src/migrate/exporters/html.ts
65903
- import { readFileSync as readFileSync20, writeFileSync as writeFileSync24 } from "node:fs";
66349
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync24 } from "node:fs";
65904
66350
  import { join as join27 } from "node:path";
65905
66351
 
65906
66352
  // src/migrate/targets/faststore-v4.ts
@@ -66242,7 +66688,7 @@ function dataUri2(absPath) {
66242
66688
  const mime = MIME2[ext];
66243
66689
  if (!mime)
66244
66690
  return null;
66245
- return `data:${mime};base64,${readFileSync20(absPath).toString("base64")}`;
66691
+ return `data:${mime};base64,${readFileSync21(absPath).toString("base64")}`;
66246
66692
  } catch {
66247
66693
  return null;
66248
66694
  }
@@ -66491,7 +66937,7 @@ function buildMigrationPrompt(bundle, playbook, source) {
66491
66937
  }
66492
66938
 
66493
66939
  // src/migrate/sources/deco-fresh.ts
66494
- import { existsSync as existsSync14, readFileSync as readFileSync21 } from "node:fs";
66940
+ import { existsSync as existsSync15, readFileSync as readFileSync22 } from "node:fs";
66495
66941
  import { join as join29 } from "node:path";
66496
66942
 
66497
66943
  // src/migrate/sources/walk.ts
@@ -66537,13 +66983,13 @@ function walkFiles(dir, exts) {
66537
66983
  function isDecoFresh(repoDir) {
66538
66984
  const denoJson = join29(repoDir, "deno.json");
66539
66985
  const denoJsonc = join29(repoDir, "deno.jsonc");
66540
- const file = existsSync14(denoJson) ? denoJson : existsSync14(denoJsonc) ? denoJsonc : null;
66986
+ const file = existsSync15(denoJson) ? denoJson : existsSync15(denoJsonc) ? denoJsonc : null;
66541
66987
  if (!file)
66542
66988
  return false;
66543
- if (!existsSync14(join29(repoDir, "fresh.gen.ts")))
66989
+ if (!existsSync15(join29(repoDir, "fresh.gen.ts")))
66544
66990
  return false;
66545
66991
  try {
66546
- return readFileSync21(file, "utf8").includes("@deco/deco");
66992
+ return readFileSync22(file, "utf8").includes("@deco/deco");
66547
66993
  } catch {
66548
66994
  return false;
66549
66995
  }
@@ -66552,7 +66998,7 @@ var GLOBAL_HINT = /\b(header|footer|navbar|menu|topbar)\b/i;
66552
66998
  function inventory(repoDir) {
66553
66999
  const components = [];
66554
67000
  const sectionsDir = join29(repoDir, "sections");
66555
- if (existsSync14(sectionsDir)) {
67001
+ if (existsSync15(sectionsDir)) {
66556
67002
  for (const rel of walkFiles(sectionsDir, [".tsx"])) {
66557
67003
  const key = rel.replace(/\.tsx$/, "");
66558
67004
  components.push({
@@ -66566,9 +67012,9 @@ function inventory(repoDir) {
66566
67012
  const notes = [
66567
67013
  "Source: Deco on Fresh/Deno (Preact + signals, JSX). Sections are the CMS unit."
66568
67014
  ];
66569
- if (existsSync14(join29(repoDir, "islands")))
67015
+ if (existsSync15(join29(repoDir, "islands")))
66570
67016
  notes.push("Has islands/ — client-interactive components.");
66571
- if (existsSync14(join29(repoDir, "loaders")))
67017
+ if (existsSync15(join29(repoDir, "loaders")))
66572
67018
  notes.push("Has loaders/ — server data functions to port.");
66573
67019
  return { components, notes };
66574
67020
  }
@@ -66608,14 +67054,14 @@ captured HTML/computed-styles as the source of truth for structure and styling.`
66608
67054
  };
66609
67055
 
66610
67056
  // src/migrate/sources/vtex-io.ts
66611
- import { existsSync as existsSync15, readFileSync as readFileSync22 } from "node:fs";
67057
+ import { existsSync as existsSync16, readFileSync as readFileSync23 } from "node:fs";
66612
67058
  import { join as join30 } from "node:path";
66613
67059
  function readManifest(repoDir) {
66614
67060
  const file = join30(repoDir, "manifest.json");
66615
- if (!existsSync15(file))
67061
+ if (!existsSync16(file))
66616
67062
  return null;
66617
67063
  try {
66618
- return JSON.parse(readFileSync22(file, "utf8"));
67064
+ return JSON.parse(readFileSync23(file, "utf8"));
66619
67065
  } catch {
66620
67066
  return null;
66621
67067
  }
@@ -66638,12 +67084,12 @@ var GLOBAL_HINT2 = /header|footer|menu|minicart|navbar/i;
66638
67084
  function inventory2(repoDir) {
66639
67085
  const blocksDir = join30(repoDir, "store", "blocks");
66640
67086
  const seen = new Map;
66641
- if (existsSync15(blocksDir)) {
67087
+ if (existsSync16(blocksDir)) {
66642
67088
  for (const rel of walkFiles(blocksDir, [".json", ".jsonc"])) {
66643
67089
  const abs = join30(blocksDir, rel);
66644
67090
  let parsed;
66645
67091
  try {
66646
- parsed = JSON.parse(stripJsonc(readFileSync22(abs, "utf8")));
67092
+ parsed = JSON.parse(stripJsonc(readFileSync23(abs, "utf8")));
66647
67093
  } catch {
66648
67094
  continue;
66649
67095
  }
@@ -66687,7 +67133,7 @@ CMS placeholders.`
66687
67133
  };
66688
67134
 
66689
67135
  // src/migrate/sources/find.ts
66690
- import { existsSync as existsSync16, readdirSync as readdirSync5, statSync } from "node:fs";
67136
+ import { existsSync as existsSync17, readdirSync as readdirSync5, statSync } from "node:fs";
66691
67137
  import { basename as basename4, join as join31, resolve as resolve6 } from "node:path";
66692
67138
  var GENERIC_LABELS = new Set(["www", "m", "www2", "loja", "shop", "store", "secure", "web"]);
66693
67139
  var TARGET_SUFFIXES = ["-tanstack", "-faststore", "-next", "-cand", "-candidate", "-migration"];
@@ -66745,7 +67191,7 @@ function scoreCandidate(dir, slug) {
66745
67191
  }
66746
67192
  function findSourceCandidates(opts) {
66747
67193
  const slug = slugFromUrl(opts.url);
66748
- const roots = opts.roots.map((r) => resolve6(r)).filter((r) => existsSync16(r) && isDir(r));
67194
+ const roots = opts.roots.map((r) => resolve6(r)).filter((r) => existsSync17(r) && isDir(r));
66749
67195
  if (!slug)
66750
67196
  return { roots, candidates: [] };
66751
67197
  const excluded = new Set((opts.exclude ?? []).map((p) => resolve6(p)));
@@ -66809,7 +67255,7 @@ function formatSourceHunt(result) {
66809
67255
  `);
66810
67256
  }
66811
67257
  // src/migrate/sources/project.ts
66812
- import { existsSync as existsSync17, readFileSync as readFileSync23, readdirSync as readdirSync6 } from "node:fs";
67258
+ import { existsSync as existsSync18, readFileSync as readFileSync24, readdirSync as readdirSync6 } from "node:fs";
66813
67259
  import { join as join32 } from "node:path";
66814
67260
  var MAX_PROPS_CHARS = 4000;
66815
67261
  var MAX_PAGES = 60;
@@ -66884,7 +67330,7 @@ function readComponentDetail(repoDir, file) {
66884
67330
  const abs = join32(repoDir, file);
66885
67331
  let source;
66886
67332
  try {
66887
- source = readFileSync23(abs, "utf8");
67333
+ source = readFileSync24(abs, "utf8");
66888
67334
  } catch {
66889
67335
  return null;
66890
67336
  }
@@ -66907,11 +67353,11 @@ var TOKEN_CANDIDATES = [
66907
67353
  "styles/configs/color.json"
66908
67354
  ];
66909
67355
  function findTokenFiles(repoDir) {
66910
- return TOKEN_CANDIDATES.filter((f) => existsSync17(join32(repoDir, f)));
67356
+ return TOKEN_CANDIDATES.filter((f) => existsSync18(join32(repoDir, f)));
66911
67357
  }
66912
67358
  function readDecoPages(repoDir) {
66913
67359
  const blocksDir = join32(repoDir, ".deco", "blocks");
66914
- if (!existsSync17(blocksDir))
67360
+ if (!existsSync18(blocksDir))
66915
67361
  return { pages: [], total: 0 };
66916
67362
  let files;
66917
67363
  try {
@@ -66925,7 +67371,7 @@ function readDecoPages(repoDir) {
66925
67371
  break;
66926
67372
  let parsed;
66927
67373
  try {
66928
- parsed = JSON.parse(readFileSync23(join32(blocksDir, file), "utf8"));
67374
+ parsed = JSON.parse(readFileSync24(join32(blocksDir, file), "utf8"));
66929
67375
  } catch {
66930
67376
  continue;
66931
67377
  }
@@ -67475,22 +67921,25 @@ async function captureInteractions(page, selector) {
67475
67921
  async function migrateCommand(opts) {
67476
67922
  const viewport = parseViewport3(opts.viewport);
67477
67923
  if (!viewport) {
67478
- console.error(chalk21.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
67924
+ console.error(chalk22.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
67479
67925
  return 2;
67480
67926
  }
67481
67927
  const viewports = (opts.viewports ? opts.viewports.split(",") : [opts.viewport]).map((v) => parseViewport3(v.trim())).filter((v) => Boolean(v));
67482
67928
  if (viewports.length === 0) {
67483
- console.error(chalk21.red(`--viewports inválido: ${opts.viewports}`));
67929
+ console.error(chalk22.red(`--viewports inválido: ${opts.viewports}`));
67484
67930
  return 2;
67485
67931
  }
67486
67932
  const primaryViewport = viewports[0];
67933
+ if (opts.componentViewports && viewports.length < 2) {
67934
+ console.warn(chalk22.yellow(" ! --component-viewports needs a second viewport in --viewports; ignored."));
67935
+ }
67487
67936
  if (!isValidUrl4(opts.url)) {
67488
- console.error(chalk21.red(`--url inválido: ${opts.url}`));
67937
+ console.error(chalk22.red(`--url inválido: ${opts.url}`));
67489
67938
  return 2;
67490
67939
  }
67491
67940
  const format = normalizeFormat2(opts.format);
67492
67941
  if (!format) {
67493
- console.error(chalk21.red(`--format inválido: ${opts.format} (use md|json|both)`));
67942
+ console.error(chalk22.red(`--format inválido: ${opts.format} (use md|json|both)`));
67494
67943
  return 2;
67495
67944
  }
67496
67945
  let pageTokens;
@@ -67500,14 +67949,14 @@ async function migrateCommand(opts) {
67500
67949
  fallback: ["/", "category-auto", "pdp-auto"]
67501
67950
  });
67502
67951
  } catch (err) {
67503
- console.error(chalk21.red(err.message));
67952
+ console.error(chalk22.red(err.message));
67504
67953
  return 2;
67505
67954
  }
67506
67955
  let playbook;
67507
67956
  if (opts.target) {
67508
67957
  playbook = getTargetPlaybook(opts.target);
67509
67958
  if (!playbook) {
67510
- console.error(chalk21.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
67959
+ console.error(chalk22.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
67511
67960
  return 2;
67512
67961
  }
67513
67962
  }
@@ -67517,7 +67966,7 @@ async function migrateCommand(opts) {
67517
67966
  if (opts.sourceKind) {
67518
67967
  const s = getSource(opts.sourceKind);
67519
67968
  if (!s) {
67520
- console.error(chalk21.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
67969
+ console.error(chalk22.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
67521
67970
  return 2;
67522
67971
  }
67523
67972
  source = s;
@@ -67525,24 +67974,24 @@ async function migrateCommand(opts) {
67525
67974
  let sourceHunt = null;
67526
67975
  let sourceProject = null;
67527
67976
  if (opts.source) {
67528
- if (!existsSync18(opts.source)) {
67529
- console.error(chalk21.red(`--source não encontrado: ${opts.source}`));
67977
+ if (!existsSync19(opts.source)) {
67978
+ console.error(chalk22.red(`--source não encontrado: ${opts.source}`));
67530
67979
  return 2;
67531
67980
  }
67532
67981
  if (!opts.sourceKind)
67533
67982
  source = detectSource(opts.source);
67534
67983
  sourceInventory = source.inventory(opts.source);
67535
- console.log(chalk21.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
67984
+ console.log(chalk22.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
67536
67985
  sourceProject = readSourceProject(opts.source, sourceInventory.components);
67537
67986
  for (const note of sourceProject.notes)
67538
- console.log(chalk21.dim(` ${note}`));
67987
+ console.log(chalk22.dim(` ${note}`));
67539
67988
  } else if (!opts.noSourceHunt) {
67540
67989
  sourceHunt = findSourceCandidates({
67541
67990
  url: opts.url,
67542
67991
  roots: defaultSearchRoots()
67543
67992
  });
67544
67993
  const message = formatSourceHunt(sourceHunt);
67545
- console.log(sourceHunt.candidates.length > 0 ? chalk21.yellow(message) : chalk21.dim(message));
67994
+ console.log(sourceHunt.candidates.length > 0 ? chalk22.yellow(message) : chalk22.dim(message));
67546
67995
  }
67547
67996
  const host = safeHost6(opts.url);
67548
67997
  const runDir = resolve7(opts.outDir, host);
@@ -67559,16 +68008,16 @@ async function migrateCommand(opts) {
67559
68008
  let screenshots;
67560
68009
  let vtexBlocks = null;
67561
68010
  let contentMap = {};
67562
- if (!opts.refresh && existsSync18(themePath) && existsSync18(assetsPath)) {
68011
+ if (!opts.refresh && existsSync19(themePath) && existsSync19(assetsPath)) {
67563
68012
  theme = readJson(themePath);
67564
68013
  const meta = readJson(assetsPath);
67565
68014
  platform = meta.platform;
67566
68015
  stack = meta.stack ?? null;
67567
68016
  assets = meta.assets;
67568
68017
  screenshots = meta.screenshots ?? [];
67569
- console.log(chalk21.dim(" phase 1 theme+assets: cached"));
68018
+ console.log(chalk22.dim(" phase 1 theme+assets: cached"));
67570
68019
  } else {
67571
- console.log(chalk21.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
68020
+ console.log(chalk22.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67572
68021
  mkdirSync16(resolve7(runDir, "screenshots"), { recursive: true });
67573
68022
  const samples = [];
67574
68023
  screenshots = [];
@@ -67593,9 +68042,9 @@ async function migrateCommand(opts) {
67593
68042
  platformSeen = detectPlatform({ url: opts.url, html: pageHtml });
67594
68043
  const cookieNames = await ctx.cookies().then((cs) => cs.map((c) => c.name).join("; ")).catch(() => "");
67595
68044
  stack = classifyLiveStack(pageHtml, cookieNames);
67596
- console.log(chalk21.dim(` stack: ${describeStack(stack)}`));
68045
+ console.log(chalk22.dim(` stack: ${describeStack(stack)}`));
67597
68046
  if (!opts.source && stack.frontend !== "unknown") {
67598
- console.warn(chalk21.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
68047
+ console.warn(chalk22.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67599
68048
  Re-run with --source <repo> for structural porting (real class strings, not measured pixels).`));
67600
68049
  }
67601
68050
  const rawAssets = await collectSiteAssets(page);
@@ -67629,11 +68078,11 @@ async function migrateCommand(opts) {
67629
68078
  }
67630
68079
  const sitemapPath = resolve7(runDir, "sitemap.json");
67631
68080
  let resolvedPages;
67632
- if (!opts.refresh && existsSync18(sitemapPath)) {
68081
+ if (!opts.refresh && existsSync19(sitemapPath)) {
67633
68082
  resolvedPages = readJson(sitemapPath).pages;
67634
- console.log(chalk21.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
68083
+ console.log(chalk22.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
67635
68084
  } else {
67636
- console.log(chalk21.dim(" phase 2 sitemap: resolving pages…"));
68085
+ console.log(chalk22.dim(" phase 2 sitemap: resolving pages…"));
67637
68086
  const ctx = await newContext(browser, { viewport: primaryViewport });
67638
68087
  const page = await ctx.newPage();
67639
68088
  let sitemapUrls = [];
@@ -67661,33 +68110,34 @@ async function migrateCommand(opts) {
67661
68110
  a[p.kind] = (a[p.kind] ?? 0) + 1;
67662
68111
  return a;
67663
68112
  }, {});
67664
- console.log(chalk21.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
68113
+ console.log(chalk22.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
67665
68114
  }
67666
68115
  writeFileSync25(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
67667
68116
  `, "utf8");
67668
68117
  }
67669
68118
  if (resolvedPages.length === 0) {
67670
- console.error(chalk21.red("nenhuma página resolvida a partir de --pages"));
68119
+ console.error(chalk22.red("nenhuma página resolvida a partir de --pages"));
67671
68120
  return 1;
67672
68121
  }
67673
68122
  const capturePath = resolve7(runDir, "capture.json");
67674
68123
  let pages;
67675
68124
  let components;
67676
- if (!opts.refresh && existsSync18(capturePath)) {
68125
+ if (!opts.refresh && existsSync19(capturePath)) {
67677
68126
  const cached = readJson(capturePath);
67678
68127
  pages = cached.pages;
67679
68128
  components = cached.components;
67680
68129
  vtexBlocks = cached.vtexBlocks ?? null;
67681
68130
  contentMap = cached.contentMap ?? {};
67682
- console.log(chalk21.dim(` phase 3 components: cached (${components.length})`));
68131
+ console.log(chalk22.dim(` phase 3 components: cached (${components.length})`));
67683
68132
  } else {
67684
- console.log(chalk21.dim(" phase 3 components: capturing…"));
68133
+ console.log(chalk22.dim(" phase 3 components: capturing…"));
67685
68134
  ({ pages, components, vtexBlocks, contentMap } = await capturePages(browser, primaryViewport, resolvedPages, theme, {
67686
68135
  allowlist,
67687
68136
  llm: !opts.noLlm,
67688
68137
  runDir,
67689
68138
  baseUrl: opts.url,
67690
- vtexScrape: opts.source ? source.kind === "vtex-io" : true
68139
+ vtexScrape: opts.source ? source.kind === "vtex-io" : true,
68140
+ extraViewports: opts.componentViewports ? viewports.slice(1) : []
67691
68141
  }));
67692
68142
  writeFileSync25(capturePath, `${JSON.stringify({ pages, components, vtexBlocks, contentMap }, null, 2)}
67693
68143
  `, "utf8");
@@ -67744,13 +68194,13 @@ async function migrateCommand(opts) {
67744
68194
  const projectPath = resolve7(runDir, "source-project.json");
67745
68195
  writeFileSync25(projectPath, `${JSON.stringify(sourceProject, null, 2)}
67746
68196
  `, "utf8");
67747
- console.log(chalk21.dim(` source-project.json — ${sourceProject.totals.components} component detail(s), ${sourceProject.totals.pages} CMS page(s), ${sourceProject.tokenFiles.length} token file(s)`));
68197
+ console.log(chalk22.dim(` source-project.json — ${sourceProject.totals.components} component detail(s), ${sourceProject.totals.pages} CMS page(s), ${sourceProject.tokenFiles.length} token file(s)`));
67748
68198
  }
67749
68199
  if (merged.carried.length) {
67750
- console.log(chalk21.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
68200
+ console.log(chalk22.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
67751
68201
  }
67752
68202
  if (merged.keptUncaptured.length) {
67753
- console.log(chalk21.yellow(` plan: ${merged.keptUncaptured.length} row(s) kept although this capture no longer sees them — ${merged.keptUncaptured.join(", ")}. They carry a decision or were added by hand; the capture owns the captured row set, not rows it cannot see.`));
68203
+ console.log(chalk22.yellow(` plan: ${merged.keptUncaptured.length} row(s) kept although this capture no longer sees them — ${merged.keptUncaptured.join(", ")}. They carry a decision or were added by hand; the capture owns the captured row set, not rows it cannot see.`));
67754
68204
  }
67755
68205
  bundle.components.push(...syntheticSourceComponents(plan));
67756
68206
  if (format === "json" || format === "both")
@@ -67799,6 +68249,7 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67799
68249
  const ctx = await newContext(browser, { viewport, keepMotion: true });
67800
68250
  const page = await ctx.newPage();
67801
68251
  const pageComponents = [];
68252
+ const capturedHere = [];
67802
68253
  try {
67803
68254
  await page.goto(target.url, { waitUntil: "domcontentloaded", timeout: 30000 });
67804
68255
  await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
@@ -67830,6 +68281,7 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67830
68281
  const interactions = await captureInteractions(page, component.selector);
67831
68282
  const migrated = toMigratedComponent(extracted, interactions, global ? "global" : "page", theme.tokens, repeated);
67832
68283
  components.push(migrated);
68284
+ capturedHere.push({ migrated, componentDir });
67833
68285
  if (!global)
67834
68286
  pageComponents.push(migrated);
67835
68287
  }
@@ -67858,6 +68310,9 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67858
68310
  return;
67859
68311
  });
67860
68312
  }
68313
+ if (cfg.extraViewports.length && capturedHere.length) {
68314
+ await captureViewportVariants(browser, target.url, cfg.extraViewports, capturedHere, cfg.runDir);
68315
+ }
67861
68316
  }
67862
68317
  return {
67863
68318
  pages,
@@ -67866,6 +68321,89 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67866
68321
  contentMap
67867
68322
  };
67868
68323
  }
68324
+ async function captureViewportVariants(browser, url, extraViewports, captured, runDir) {
68325
+ const perComponent = captured.map(() => []);
68326
+ for (const vp of extraViewports) {
68327
+ let ctx;
68328
+ let page;
68329
+ let done = 0;
68330
+ try {
68331
+ ctx = await newContext(browser, { viewport: vp });
68332
+ page = await ctx.newPage();
68333
+ await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 });
68334
+ await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
68335
+ return;
68336
+ });
68337
+ await settlePage(page, { fonts: false, layoutStable: false });
68338
+ const pageScreenshot = await page.screenshot({ fullPage: true, animations: "disabled", timeout: 15000 }).catch(() => {
68339
+ return;
68340
+ });
68341
+ for (const [i, { migrated, componentDir }] of captured.entries()) {
68342
+ const art = await captureSectionArtifacts(page, {
68343
+ selector: migrated.selector,
68344
+ wantHtml: true,
68345
+ wantStyles: false,
68346
+ wantCssSource: false
68347
+ });
68348
+ if (art.html === null) {
68349
+ perComponent[i].push(art.htmlNoMatch ? { viewport: vp, status: "absent" } : { viewport: vp, status: "failed", reason: art.htmlError ?? "HTML read failed" });
68350
+ done++;
68351
+ continue;
68352
+ }
68353
+ const shot = resolve7(componentDir, vp, "screenshot.png");
68354
+ mkdirSync16(resolve7(componentDir, vp), { recursive: true });
68355
+ const err = await captureSectionScreenshot(page, migrated.selector, shot, pageScreenshot);
68356
+ perComponent[i].push({
68357
+ viewport: vp,
68358
+ status: "ok",
68359
+ html: art.html,
68360
+ screenshot: !err && existsSync19(shot) ? readFileSync25(shot) : null
68361
+ });
68362
+ done++;
68363
+ }
68364
+ } catch (err) {
68365
+ const reason = `${vp} load failed: ${err.message.split(`
68366
+ `)[0]}`;
68367
+ console.warn(chalk22.yellow(` ! --component-viewports: ${url} — ${reason}; skipped`));
68368
+ for (let i = done;i < captured.length; i++) {
68369
+ perComponent[i].push({ viewport: vp, status: "failed", reason });
68370
+ }
68371
+ } finally {
68372
+ await page?.close().catch(() => {
68373
+ return;
68374
+ });
68375
+ await ctx?.close().catch(() => {
68376
+ return;
68377
+ });
68378
+ }
68379
+ }
68380
+ for (const [i, { migrated, componentDir }] of captured.entries()) {
68381
+ const primaryShot = existsSync19(migrated.screenshotPath) ? readFileSync25(migrated.screenshotPath) : null;
68382
+ const deltas = viewportDeltas({ html: migrated.html, screenshot: primaryShot }, perComponent[i]);
68383
+ const variants = [];
68384
+ for (const vp of extraViewports) {
68385
+ const dir = resolve7(componentDir, vp);
68386
+ const d = deltas.find((x) => x.viewport === vp);
68387
+ if (!d || d.absent || d.failed)
68388
+ rmSync(dir, { recursive: true, force: true });
68389
+ if (!d)
68390
+ continue;
68391
+ if (d.html !== undefined)
68392
+ writeFileSync25(resolve7(dir, "component.html"), d.html, "utf8");
68393
+ if (!d.keepScreenshot)
68394
+ rmSync(resolve7(dir, "screenshot.png"), { force: true });
68395
+ variants.push({
68396
+ viewport: vp,
68397
+ ...d.absent ? { absent: true } : {},
68398
+ ...d.failed ? { failed: d.failed } : {},
68399
+ ...d.html !== undefined ? { html: d.html } : {},
68400
+ ...d.keepScreenshot ? { screenshotPath: relative4(runDir, resolve7(dir, "screenshot.png")) } : {}
68401
+ });
68402
+ }
68403
+ if (variants.length)
68404
+ migrated.viewportVariants = variants;
68405
+ }
68406
+ }
67869
68407
  async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67870
68408
  const out = [];
67871
68409
  const plp = pickPlpFromHomeHtml(homeHtml, baseUrl);
@@ -67874,12 +68412,12 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67874
68412
  if (plp)
67875
68413
  out.push({ path: token, url: plp, kind: "plp" });
67876
68414
  else
67877
- console.warn(chalk21.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
68415
+ console.warn(chalk22.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
67878
68416
  continue;
67879
68417
  }
67880
68418
  if (token === "pdp-auto") {
67881
68419
  if (!plp) {
67882
- console.warn(chalk21.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
68420
+ console.warn(chalk22.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
67883
68421
  continue;
67884
68422
  }
67885
68423
  let html = null;
@@ -67896,7 +68434,7 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67896
68434
  if (pdp)
67897
68435
  out.push({ path: token, url: pdp, kind: "pdp" });
67898
68436
  else
67899
- console.warn(chalk21.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
68437
+ console.warn(chalk22.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
67900
68438
  continue;
67901
68439
  }
67902
68440
  try {
@@ -67990,31 +68528,31 @@ function kindOf(url) {
67990
68528
  }
67991
68529
  }
67992
68530
  function printResults4(runDir, bundle) {
67993
- console.log(chalk21.bold(`
68531
+ console.log(chalk22.bold(`
67994
68532
  parity migrate`));
67995
- console.log(chalk21.dim(` url: ${bundle.url}`));
67996
- console.log(chalk21.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
67997
- console.log(chalk21.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
67998
- console.log(chalk21.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
67999
- console.log(chalk21.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
68533
+ console.log(chalk22.dim(` url: ${bundle.url}`));
68534
+ console.log(chalk22.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
68535
+ console.log(chalk22.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
68536
+ console.log(chalk22.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
68537
+ console.log(chalk22.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
68000
68538
  if (bundle.vtex) {
68001
68539
  const mapped = bundle.vtex.map.filter((m) => m.strategy === "mapped").length;
68002
68540
  const withContent = bundle.vtex.blocks.filter((x) => x.props).length;
68003
68541
  const contentImgs = countContentImages(bundle.vtex.blocks);
68004
- console.log(chalk21.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
68542
+ console.log(chalk22.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
68005
68543
  }
68006
- console.log(chalk21.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
68007
- console.log(chalk21.dim(` out: ${runDir}`));
68544
+ console.log(chalk22.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
68545
+ console.log(chalk22.dim(` out: ${runDir}`));
68008
68546
  console.log("");
68009
- console.log(chalk21.bold(` ${bundle.components.length} component(s):`));
68547
+ console.log(chalk22.bold(` ${bundle.components.length} component(s):`));
68010
68548
  for (const c of bundle.components) {
68011
- console.log(` ${chalk21.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk21.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
68549
+ console.log(` ${chalk22.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk22.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
68012
68550
  }
68013
68551
  console.log("");
68014
68552
  }
68015
68553
  function readJson(path) {
68016
68554
  try {
68017
- return JSON.parse(readFileSync24(path, "utf8"));
68555
+ return JSON.parse(readFileSync25(path, "utf8"));
68018
68556
  } catch {
68019
68557
  return null;
68020
68558
  }
@@ -68057,67 +68595,84 @@ function isValidUrl4(s) {
68057
68595
  }
68058
68596
 
68059
68597
  // src/commands/plan.ts
68060
- import { readFileSync as readFileSync25 } from "node:fs";
68061
- import chalk22 from "chalk";
68062
- var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
68598
+ import { readFileSync as readFileSync26 } from "node:fs";
68599
+ import chalk23 from "chalk";
68600
+ var STATUSES = [
68601
+ "pending",
68602
+ "partial",
68603
+ "done",
68604
+ "as-is",
68605
+ "upgrade",
68606
+ "skipped",
68607
+ "vanished"
68608
+ ];
68063
68609
  var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
68064
68610
  function planSetStatusCommand(dir, name, status, opts = {}) {
68065
68611
  if (!STATUSES.includes(status)) {
68066
- console.error(chalk22.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
68612
+ console.error(chalk23.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
68067
68613
  return 1;
68068
68614
  }
68069
68615
  const plan = loadPlan(dir);
68070
68616
  if (!plan) {
68071
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68617
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68072
68618
  return 1;
68073
68619
  }
68074
68620
  const existed = plan.components.length;
68075
- const component = setComponentStatus(plan, name, status, opts.create ? { create: { scope: opts.create } } : {});
68621
+ let component;
68622
+ try {
68623
+ component = setComponentStatus(plan, name, status, {
68624
+ ...opts.create ? { create: { scope: opts.create } } : {},
68625
+ note: opts.note
68626
+ });
68627
+ } catch (err) {
68628
+ console.error(chalk23.red(err.message));
68629
+ return 1;
68630
+ }
68076
68631
  if (!component) {
68077
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68078
- console.error(chalk22.yellow("A capture can miss a component that exists — a zero-height overlay header, a portal-rendered panel. Add it with --create global|page if this is one of those, so the plan can hold a decision about it."));
68632
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68633
+ console.error(chalk23.yellow("A capture can miss a component that exists — a zero-height overlay header, a portal-rendered panel. Add it with --create global|page if this is one of those, so the plan can hold a decision about it."));
68079
68634
  return 1;
68080
68635
  }
68081
68636
  if (plan.components.length > existed) {
68082
- console.log(chalk22.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
68637
+ console.log(chalk23.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
68083
68638
  }
68084
68639
  savePlan(dir, plan);
68085
- console.log(`${chalk22.green("✓")} ${component.name} → ${status}`);
68640
+ console.log(`${chalk23.green("✓")} ${component.name} → ${status}`);
68086
68641
  if ((status === "upgrade" || status === "as-is") && !component.reference) {
68087
- console.log(chalk22.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
68642
+ console.log(chalk23.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
68088
68643
  }
68089
68644
  return 0;
68090
68645
  }
68091
68646
  function planSetPageStatusCommand(dir, path, status) {
68092
68647
  if (!PAGE_STATUSES.includes(status)) {
68093
- console.error(chalk22.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
68648
+ console.error(chalk23.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
68094
68649
  return 1;
68095
68650
  }
68096
68651
  const plan = loadPlan(dir);
68097
68652
  if (!plan) {
68098
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68653
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68099
68654
  return 1;
68100
68655
  }
68101
68656
  const page = setPageStatus(plan, path, status);
68102
68657
  if (!page) {
68103
- console.error(chalk22.red(`No page matching "${path}" in the plan`));
68658
+ console.error(chalk23.red(`No page matching "${path}" in the plan`));
68104
68659
  return 1;
68105
68660
  }
68106
68661
  savePlan(dir, plan);
68107
- console.log(`${chalk22.green("✓")} ${page.path} → ${status}`);
68662
+ console.log(`${chalk23.green("✓")} ${page.path} → ${status}`);
68108
68663
  return 0;
68109
68664
  }
68110
68665
  var DISPOSITION_STYLE = {
68111
- build: chalk22.red,
68112
- validate: chalk22.yellow,
68113
- upgrade: chalk22.cyan,
68114
- "as-is": chalk22.gray,
68115
- settled: chalk22.green
68666
+ build: chalk23.red,
68667
+ validate: chalk23.yellow,
68668
+ upgrade: chalk23.cyan,
68669
+ "as-is": chalk23.gray,
68670
+ settled: chalk23.green
68116
68671
  };
68117
68672
  function planSetReferenceCommand(dir, name, opts) {
68118
68673
  const plan = loadPlan(dir);
68119
68674
  if (!plan) {
68120
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68675
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68121
68676
  return 1;
68122
68677
  }
68123
68678
  const component = setComponentReference(plan, name, {
@@ -68126,76 +68681,76 @@ function planSetReferenceCommand(dir, name, opts) {
68126
68681
  note: opts.note
68127
68682
  });
68128
68683
  if (!component) {
68129
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68684
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68130
68685
  return 1;
68131
68686
  }
68132
68687
  savePlan(dir, plan);
68133
- console.log(`${chalk22.green("✓")} ${component.name} → reference ${component.reference?.url}`);
68688
+ console.log(`${chalk23.green("✓")} ${component.name} → reference ${component.reference?.url}`);
68134
68689
  return 0;
68135
68690
  }
68136
68691
  function planVerifyCommand(dir, name, verdict, opts) {
68137
68692
  if (verdict !== "pass" && verdict !== "fail" && verdict !== "inconclusive") {
68138
- console.error(chalk22.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
68693
+ console.error(chalk23.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
68139
68694
  return 1;
68140
68695
  }
68141
68696
  const plan = loadPlan(dir);
68142
68697
  if (!plan) {
68143
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68698
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68144
68699
  return 1;
68145
68700
  }
68146
68701
  const component = setComponentVerified(plan, name, verdict, opts.at ?? new Date().toISOString(), opts.note);
68147
68702
  if (!component) {
68148
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68703
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68149
68704
  return 1;
68150
68705
  }
68151
68706
  savePlan(dir, plan);
68152
- const mark = verdict === "pass" ? chalk22.green("✓") : verdict === "inconclusive" ? chalk22.yellow("?") : chalk22.red("✗");
68707
+ const mark = verdict === "pass" ? chalk23.green("✓") : verdict === "inconclusive" ? chalk23.yellow("?") : chalk23.red("✗");
68153
68708
  console.log(`${mark} ${component.name} → ${verdict} (against ${component.verified?.against})`);
68154
68709
  return 0;
68155
68710
  }
68156
68711
  function planMergeCommand(dir, sourceDir) {
68157
68712
  const fresh = loadPlan(sourceDir);
68158
68713
  if (!fresh) {
68159
- console.error(chalk22.red(`No migration-plan.json found in ${sourceDir}`));
68714
+ console.error(chalk23.red(`No migration-plan.json found in ${sourceDir}`));
68160
68715
  return 1;
68161
68716
  }
68162
68717
  const existing = loadPlan(dir);
68163
68718
  const { plan, carried, keptUncaptured } = mergePlanDecisions(fresh, existing);
68164
68719
  savePlan(dir, plan);
68165
68720
  if (!existing) {
68166
- console.log(`${chalk22.green("✓")} plan written to ${dir} (nothing to merge)`);
68721
+ console.log(`${chalk23.green("✓")} plan written to ${dir} (nothing to merge)`);
68167
68722
  return 0;
68168
68723
  }
68169
- console.log(`${chalk22.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
68724
+ console.log(`${chalk23.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
68170
68725
  if (keptUncaptured.length) {
68171
- console.log(chalk22.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
68726
+ console.log(chalk23.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
68172
68727
  }
68173
68728
  return 0;
68174
68729
  }
68175
68730
  function planPageCommand(dir, path, opts) {
68176
68731
  const plan = loadPlan(dir);
68177
68732
  if (!plan) {
68178
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68733
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68179
68734
  return 1;
68180
68735
  }
68181
68736
  const page = pagePlan(plan, path, opts.cand);
68182
68737
  if (!page) {
68183
- console.error(chalk22.red(`No page matching "${path}" in the plan`));
68184
- console.error(chalk22.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
68738
+ console.error(chalk23.red(`No page matching "${path}" in the plan`));
68739
+ console.error(chalk23.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
68185
68740
  return 1;
68186
68741
  }
68187
68742
  if (opts.json) {
68188
68743
  console.log(JSON.stringify(page, null, 2));
68189
68744
  return 0;
68190
68745
  }
68191
- console.log(chalk22.bold(`
68192
- ${page.path} ${chalk22.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk22.green(" ready") : ""));
68746
+ console.log(chalk23.bold(`
68747
+ ${page.path} ${chalk23.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk23.green(" ready") : ""));
68193
68748
  if (page.tasks === null) {
68194
- console.log(chalk22.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
68749
+ console.log(chalk23.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
68195
68750
  return 0;
68196
68751
  }
68197
68752
  if (page.tasks.length === 0) {
68198
- console.log(chalk22.gray(`
68753
+ console.log(chalk23.gray(`
68199
68754
  The capture saw no components on this page.
68200
68755
  `));
68201
68756
  return 0;
@@ -68206,22 +68761,22 @@ ${page.path} ${chalk22.gray(`(${page.kind})`)} — ${page.status}`) + (page.read
68206
68761
  if (!rows.length)
68207
68762
  continue;
68208
68763
  console.log(`
68209
- ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
68764
+ ${DISPOSITION_STYLE[d](chalk23.bold(d))} (${rows.length})`);
68210
68765
  for (const t of rows) {
68211
- console.log(` ${t.name} ${chalk22.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
68766
+ console.log(` ${t.name} ${chalk23.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
68212
68767
  if (t.note)
68213
- console.log(chalk22.gray(` why: ${t.note}`));
68768
+ console.log(chalk23.gray(` why: ${t.note}`));
68214
68769
  if (t.against?.kind === "reference") {
68215
- console.log(chalk22.cyan(` reference: ${t.against.url}`));
68770
+ console.log(chalk23.cyan(` reference: ${t.against.url}`));
68216
68771
  }
68217
68772
  if (t.source)
68218
- console.log(chalk22.green(` source: ${t.source}`));
68773
+ console.log(chalk23.green(` source: ${t.source}`));
68219
68774
  if (t.command)
68220
- console.log(chalk22.gray(` $ ${t.command}`));
68775
+ console.log(chalk23.gray(` $ ${t.command}`));
68221
68776
  }
68222
68777
  }
68223
68778
  if (page.counts.validate > 0 && !opts.cand) {
68224
- console.log(chalk22.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
68779
+ console.log(chalk23.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
68225
68780
  }
68226
68781
  console.log("");
68227
68782
  return 0;
@@ -68229,8 +68784,8 @@ ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
68229
68784
  function planStatusCommand(dir, asJson) {
68230
68785
  const plan = loadPlan(dir);
68231
68786
  if (!plan) {
68232
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68233
- console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
68787
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68788
+ console.error(chalk23.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
68234
68789
  return 1;
68235
68790
  }
68236
68791
  const p = planProgress(plan);
@@ -68241,59 +68796,63 @@ function planStatusCommand(dir, asJson) {
68241
68796
  return 0;
68242
68797
  }
68243
68798
  const c = p.components;
68244
- console.log(chalk22.bold(`
68799
+ console.log(chalk23.bold(`
68245
68800
  Migration plan — ${plan.url}${plan.target.name ? ` → ${plan.target.name}` : ""}`));
68801
+ const vanished = c.byStatus.vanished ? `, ${chalk23.gray(`${c.byStatus.vanished} vanished`)}` : "";
68246
68802
  console.log(`
68247
- ${chalk22.bold("Components")} (${c.total}): ` + `${chalk22.green(`${c.byStatus.done} done`)}, ` + `${chalk22.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk22.red(`${c.byStatus.pending} pending`)}, ` + `${chalk22.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk22.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk22.gray(`${c.byStatus.skipped} skipped`)}`);
68803
+ ${chalk23.bold("Components")} (${c.total}): ` + `${chalk23.green(`${c.byStatus.done} done`)}, ` + `${chalk23.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk23.red(`${c.byStatus.pending} pending`)}, ` + `${chalk23.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk23.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk23.gray(`${c.byStatus.skipped} skipped`)}${vanished}`);
68248
68804
  if (c.accepted.upgrade.length) {
68249
- console.log(chalk22.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
68805
+ console.log(chalk23.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
68250
68806
  }
68251
68807
  if (c.accepted.asIs.length) {
68252
- console.log(chalk22.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68808
+ console.log(chalk23.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68253
68809
  }
68254
68810
  if (provenance.library > 0 || provenance.built > 0) {
68255
- const unrecorded = provenance.unrecorded > 0 ? chalk22.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68256
- console.log(` reuse: ${chalk22.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
68811
+ const unrecorded = provenance.unrecorded > 0 ? chalk23.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68812
+ console.log(` reuse: ${chalk23.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
68257
68813
  }
68258
68814
  if (touches > 0) {
68259
- console.log(chalk22.dim(` human touches: ${touches} across this migration`));
68815
+ console.log(chalk23.dim(` human touches: ${touches} across this migration`));
68260
68816
  }
68261
68817
  if (c.settledByStatus.done.length) {
68262
- console.log(chalk22.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68818
+ console.log(chalk23.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68263
68819
  }
68264
68820
  if (c.settledByStatus.skipped.length) {
68265
- console.log(chalk22.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
68821
+ console.log(chalk23.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
68822
+ }
68823
+ if (c.settledByStatus.vanished.length) {
68824
+ console.log(chalk23.gray(` gone from prod, shipped disabled: ${c.settledByStatus.vanished.join(", ")}`));
68266
68825
  }
68267
68826
  for (const r of c.remaining) {
68268
- const tag = r.status === "partial" ? chalk22.yellow("partial") : chalk22.red("pending");
68269
- console.log(` ${tag} ${r.name} ${chalk22.gray(`(${r.scope}, ${r.origin})`)}`);
68827
+ const tag = r.status === "partial" ? chalk23.yellow("partial") : chalk23.red("pending");
68828
+ console.log(` ${tag} ${r.name} ${chalk23.gray(`(${r.scope}, ${r.origin})`)}`);
68270
68829
  }
68271
68830
  const pg = p.pages;
68272
68831
  console.log(`
68273
- ${chalk22.bold("Pages")} (${pg.total}): ` + `${chalk22.green(`${pg.byStatus.done} done`)}, ` + `${chalk22.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk22.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk22.gray(`${pg.byStatus.skipped} skipped`)}`);
68832
+ ${chalk23.bold("Pages")} (${pg.total}): ` + `${chalk23.green(`${pg.byStatus.done} done`)}, ` + `${chalk23.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk23.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk23.gray(`${pg.byStatus.skipped} skipped`)}`);
68274
68833
  if (pg.awaitingContent.length) {
68275
- console.log(chalk22.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68834
+ console.log(chalk23.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68276
68835
  }
68277
68836
  for (const r of pg.remaining.filter((r) => r.status === "pending")) {
68278
- console.log(` ${chalk22.red("pending")} ${r.path} ${chalk22.gray(`(${r.kind})`)}`);
68837
+ console.log(` ${chalk23.red("pending")} ${r.path} ${chalk23.gray(`(${r.kind})`)}`);
68279
68838
  }
68280
68839
  console.log("");
68281
68840
  return 0;
68282
68841
  }
68283
68842
  var COLUMN_ORDER = ["triage", "backlog", "building", "review", "done"];
68284
68843
  var COLUMN_STYLE = {
68285
- triage: chalk22.magenta,
68286
- backlog: chalk22.red,
68287
- building: chalk22.yellow,
68288
- review: chalk22.cyan,
68289
- done: chalk22.green,
68290
- skipped: chalk22.gray
68844
+ triage: chalk23.magenta,
68845
+ backlog: chalk23.red,
68846
+ building: chalk23.yellow,
68847
+ review: chalk23.cyan,
68848
+ done: chalk23.green,
68849
+ skipped: chalk23.gray
68291
68850
  };
68292
68851
  async function planBoardCommand(dir, opts) {
68293
68852
  const plan = loadPlan(dir);
68294
68853
  if (!plan) {
68295
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68296
- console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
68854
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68855
+ console.error(chalk23.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
68297
68856
  return 1;
68298
68857
  }
68299
68858
  const board = planBoard(plan, opts.cand);
@@ -68301,46 +68860,46 @@ async function planBoardCommand(dir, opts) {
68301
68860
  console.log(JSON.stringify(board, null, 2));
68302
68861
  return 0;
68303
68862
  }
68304
- console.log(chalk22.bold(`
68863
+ console.log(chalk23.bold(`
68305
68864
  Board — ${board.url}`));
68306
- console.log(chalk22.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
68865
+ console.log(chalk23.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
68307
68866
  if (board.shell.length) {
68308
68867
  console.log(`
68309
- ${chalk22.bold("shell")} ${chalk22.gray("(global — blocks every page)")}: ${chalk22.yellow(board.shell.join(", "))}`);
68868
+ ${chalk23.bold("shell")} ${chalk23.gray("(global — blocks every page)")}: ${chalk23.yellow(board.shell.join(", "))}`);
68310
68869
  }
68311
68870
  for (const column of COLUMN_ORDER) {
68312
68871
  const cards = board.columns[column];
68313
68872
  if (!cards.length)
68314
68873
  continue;
68315
68874
  console.log(`
68316
- ${COLUMN_STYLE[column](chalk22.bold(column))} (${cards.length})`);
68875
+ ${COLUMN_STYLE[column](chalk23.bold(column))} (${cards.length})`);
68317
68876
  for (const card of cards) {
68318
- console.log(` ${card.path} ${chalk22.gray(`(${card.kind})`)}`);
68877
+ console.log(` ${card.path} ${chalk23.gray(`(${card.kind})`)}`);
68319
68878
  if (card.blockers.length) {
68320
- console.log(chalk22.gray(` blocked by: ${card.blockers.join(", ")}`));
68879
+ console.log(chalk23.gray(` blocked by: ${card.blockers.join(", ")}`));
68321
68880
  }
68322
68881
  }
68323
68882
  }
68324
68883
  const skipped = board.columns.skipped;
68325
68884
  if (skipped.length) {
68326
68885
  console.log(`
68327
- ${chalk22.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68886
+ ${chalk23.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68328
68887
  }
68329
68888
  if (board.unassigned.length) {
68330
68889
  console.log(`
68331
- ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled page)")}
68332
- ${chalk22.gray(board.unassigned.join(", "))}`);
68890
+ ${chalk23.bold("no page")} ${chalk23.gray("(in the code, not seen on any sampled page)")}
68891
+ ${chalk23.gray(board.unassigned.join(", "))}`);
68333
68892
  }
68334
68893
  console.log("");
68335
68894
  if (opts.board === "studio") {
68336
68895
  const cfg = studioConfigFromEnv();
68337
68896
  if (!cfg) {
68338
- console.log(chalk22.yellow(`Studio board skipped — ${STUDIO_LOGIN_HINT}. Showing the terminal board instead.
68897
+ console.log(chalk23.yellow(`Studio board skipped — ${STUDIO_LOGIN_HINT}. Showing the terminal board instead.
68339
68898
  `));
68340
68899
  return 0;
68341
68900
  }
68342
68901
  try {
68343
- const fixes = opts.fixes ? JSON.parse(readFileSync25(opts.fixes, "utf8")) : undefined;
68902
+ const fixes = opts.fixes ? JSON.parse(readFileSync26(opts.fixes, "utf8")) : undefined;
68344
68903
  const synced = await syncBoardToStudio(board, cfg, { repo: opts.repo, fixes });
68345
68904
  let stored = 0;
68346
68905
  for (const [path, id] of Object.entries(synced.ids)) {
@@ -68349,10 +68908,10 @@ ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled
68349
68908
  }
68350
68909
  if (stored)
68351
68910
  savePlan(dir, plan);
68352
- console.log(chalk22.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
68911
+ console.log(chalk23.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
68353
68912
  `));
68354
68913
  } catch (err) {
68355
- console.log(chalk22.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
68914
+ console.log(chalk23.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
68356
68915
  `));
68357
68916
  }
68358
68917
  }
@@ -68361,27 +68920,27 @@ ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled
68361
68920
  async function planNotesCommand(dir, opts) {
68362
68921
  const plan = loadPlan(dir);
68363
68922
  if (!plan) {
68364
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68923
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68365
68924
  return 1;
68366
68925
  }
68367
68926
  const cfg = studioConfigFromEnv();
68368
68927
  if (!cfg) {
68369
- console.error(chalk22.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68928
+ console.error(chalk23.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68370
68929
  return 1;
68371
68930
  }
68372
68931
  if (opts.post) {
68373
68932
  const page = plan.pages.find((p) => p.path === opts.page);
68374
68933
  if (!page?.boardItemId) {
68375
- console.error(chalk22.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
68934
+ console.error(chalk23.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
68376
68935
  return 1;
68377
68936
  }
68378
68937
  await postParityComment(page.boardItemId, opts.post, cfg);
68379
- console.log(`${chalk22.green("✓")} comment posted on ${page.path}`);
68938
+ console.log(`${chalk23.green("✓")} comment posted on ${page.path}`);
68380
68939
  return 0;
68381
68940
  }
68382
68941
  const pages = plan.pages.filter((p) => p.boardItemId).filter((p) => !opts.page || p.path === opts.page).map((p) => ({ path: p.path, boardItemId: p.boardItemId }));
68383
68942
  if (!pages.length) {
68384
- console.error(chalk22.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
68943
+ console.error(chalk23.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
68385
68944
  return 1;
68386
68945
  }
68387
68946
  const notes = await fetchClientNotes(pages, cfg);
@@ -68390,47 +68949,47 @@ async function planNotesCommand(dir, opts) {
68390
68949
  return 0;
68391
68950
  }
68392
68951
  if (!notes.length) {
68393
- console.log(chalk22.gray(`
68952
+ console.log(chalk23.gray(`
68394
68953
  No open client notes.
68395
68954
  `));
68396
68955
  return 0;
68397
68956
  }
68398
- console.log(chalk22.bold(`
68957
+ console.log(chalk23.bold(`
68399
68958
  Client notes (${notes.length})`));
68400
68959
  for (const n of notes) {
68401
68960
  console.log(`
68402
- ${chalk22.cyan(n.path)} ${chalk22.gray(n.createdAt)}`);
68961
+ ${chalk23.cyan(n.path)} ${chalk23.gray(n.createdAt)}`);
68403
68962
  for (const line of n.body.split(`
68404
68963
  `))
68405
68964
  console.log(` ${line}`);
68406
68965
  }
68407
- console.log(chalk22.gray('\nThese are PROPOSALS. Apply with `parity plan set-reference` / `set-status`, then confirm with `parity plan notes --page <path> --post "<what you did>"`.\n'));
68966
+ console.log(chalk23.gray('\nThese are PROPOSALS. Apply with `parity plan set-reference` / `set-status`, then confirm with `parity plan notes --page <path> --post "<what you did>"`.\n'));
68408
68967
  return 0;
68409
68968
  }
68410
68969
  var PROVENANCES = ["library", "built"];
68411
68970
  function planSetProvenanceCommand(dir, name, provenance) {
68412
68971
  if (!PROVENANCES.includes(provenance)) {
68413
- console.error(chalk22.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
68972
+ console.error(chalk23.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
68414
68973
  return 1;
68415
68974
  }
68416
68975
  const plan = loadPlan(dir);
68417
68976
  if (!plan) {
68418
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68977
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68419
68978
  return 1;
68420
68979
  }
68421
68980
  const component = setComponentProvenance(plan, name, provenance);
68422
68981
  if (!component) {
68423
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68982
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68424
68983
  return 1;
68425
68984
  }
68426
68985
  savePlan(dir, plan);
68427
- console.log(`${chalk22.green("✓")} ${component.name} → ${provenance}`);
68986
+ console.log(`${chalk23.green("✓")} ${component.name} → ${provenance}`);
68428
68987
  return 0;
68429
68988
  }
68430
68989
  function planTouchCommand(dir, page, opts) {
68431
68990
  const plan = loadPlan(dir);
68432
68991
  if (!plan) {
68433
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68992
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68434
68993
  return 1;
68435
68994
  }
68436
68995
  const count = recordTouch(plan, page);
@@ -68438,20 +68997,20 @@ function planTouchCommand(dir, page, opts) {
68438
68997
  if (opts.json) {
68439
68998
  console.log(JSON.stringify({ page, touches: count, total: totalTouches(plan) }));
68440
68999
  } else {
68441
- console.log(`${chalk22.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
69000
+ console.log(`${chalk23.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
68442
69001
  }
68443
69002
  return 0;
68444
69003
  }
68445
69004
 
68446
69005
  // src/commands/pr.ts
68447
- import { existsSync as existsSync22, readFileSync as readFileSync28, writeFileSync as writeFileSync26 } from "node:fs";
69006
+ import { existsSync as existsSync23, readFileSync as readFileSync29, writeFileSync as writeFileSync26 } from "node:fs";
68448
69007
  import { join as join35 } from "node:path";
68449
- import chalk25 from "chalk";
69008
+ import chalk26 from "chalk";
68450
69009
 
68451
69010
  // src/commands/run.ts
68452
- import { existsSync as existsSync21, readFileSync as readFileSync27, unlinkSync as unlinkSync3 } from "node:fs";
69011
+ import { existsSync as existsSync22, readFileSync as readFileSync28, unlinkSync as unlinkSync3 } from "node:fs";
68453
69012
  import { join as join34 } from "node:path";
68454
- import chalk24 from "chalk";
69013
+ import chalk25 from "chalk";
68455
69014
  import ora8 from "ora";
68456
69015
 
68457
69016
  // src/diff/score-band.ts
@@ -69039,11 +69598,11 @@ function formatMs(ms) {
69039
69598
  }
69040
69599
 
69041
69600
  // src/commands/serve.ts
69042
- import { existsSync as existsSync20 } from "node:fs";
69043
- import chalk23 from "chalk";
69601
+ import { existsSync as existsSync21 } from "node:fs";
69602
+ import chalk24 from "chalk";
69044
69603
 
69045
69604
  // src/server/proxy-server.ts
69046
- import { existsSync as existsSync19, readFileSync as readFileSync26, statSync as statSync2 } from "node:fs";
69605
+ import { existsSync as existsSync20, readFileSync as readFileSync27, statSync as statSync2 } from "node:fs";
69047
69606
  import { createServer } from "node:http";
69048
69607
  import { extname, join as join33, normalize as normalize3, resolve as resolve8, sep } from "node:path";
69049
69608
  var MIME3 = {
@@ -69083,7 +69642,7 @@ var STRIPPED_REQUEST_HEADERS = new Set([
69083
69642
  var scrollBeacons = [];
69084
69643
  async function startProxyServer(runDir, opts = {}) {
69085
69644
  const absRunDir = resolve8(runDir);
69086
- if (!existsSync19(absRunDir)) {
69645
+ if (!existsSync20(absRunDir)) {
69087
69646
  throw new Error(`Run directory not found: ${runDir}`);
69088
69647
  }
69089
69648
  const server = createServer((req, res) => {
@@ -69154,12 +69713,12 @@ async function handleRequest(req, res, runDir) {
69154
69713
  }
69155
69714
  function serveReportHtml(res, runDir) {
69156
69715
  const filePath = join33(runDir, "report.html");
69157
- if (!existsSync19(filePath)) {
69716
+ if (!existsSync20(filePath)) {
69158
69717
  res.statusCode = 404;
69159
69718
  res.end("report.html not found");
69160
69719
  return;
69161
69720
  }
69162
- const html = readFileSync26(filePath, "utf8");
69721
+ const html = readFileSync27(filePath, "utf8");
69163
69722
  const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
69164
69723
  const out = html.includes("</head>") ? html.replace("</head>", `${inject}</head>`) : `${inject}${html}`;
69165
69724
  res.statusCode = 200;
@@ -69175,7 +69734,7 @@ function serveStatic(res, runDir, path) {
69175
69734
  res.end("forbidden");
69176
69735
  return;
69177
69736
  }
69178
- if (!existsSync19(filePath)) {
69737
+ if (!existsSync20(filePath)) {
69179
69738
  res.statusCode = 404;
69180
69739
  res.end("not found");
69181
69740
  return;
@@ -69190,7 +69749,7 @@ function serveStatic(res, runDir, path) {
69190
69749
  res.statusCode = 200;
69191
69750
  res.setHeader("content-type", MIME3[ext] ?? "application/octet-stream");
69192
69751
  res.setHeader("cache-control", "no-store");
69193
- res.end(readFileSync26(filePath));
69752
+ res.end(readFileSync27(filePath));
69194
69753
  }
69195
69754
  async function proxyRequest(req, res, targetUrl, opts = {}) {
69196
69755
  let target;
@@ -69313,16 +69872,16 @@ async function serveRunAndBlock(runDir, opts = {}) {
69313
69872
  try {
69314
69873
  handle = await startProxyServer(runDir, { port: opts.port });
69315
69874
  } catch (err) {
69316
- console.error(chalk23.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69875
+ console.error(chalk24.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69317
69876
  return 2;
69318
69877
  }
69319
69878
  const label = opts.label ?? "parity serve";
69320
69879
  console.log("");
69321
- console.log(chalk23.bold(` ${label}`));
69322
- console.log(` ${chalk23.green("●")} ${handle.url}`);
69323
- console.log(chalk23.dim(` Servindo: ${runDir}`));
69324
- console.log(chalk23.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69325
- console.log(chalk23.dim(` Ctrl+C pra parar (2x pra forçar saída).
69880
+ console.log(chalk24.bold(` ${label}`));
69881
+ console.log(` ${chalk24.green("●")} ${handle.url}`);
69882
+ console.log(chalk24.dim(` Servindo: ${runDir}`));
69883
+ console.log(chalk24.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69884
+ console.log(chalk24.dim(` Ctrl+C pra parar (2x pra forçar saída).
69326
69885
  `));
69327
69886
  if (opts.open !== false) {
69328
69887
  const { default: open } = await import("open");
@@ -69354,12 +69913,12 @@ async function serveRunAndBlock(runDir, opts = {}) {
69354
69913
  }
69355
69914
  async function serveCommand(runId, opts) {
69356
69915
  const paths = getRunPaths(opts.output, runId);
69357
- if (!existsSync20(paths.runDir)) {
69358
- console.error(chalk23.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
69916
+ if (!existsSync21(paths.runDir)) {
69917
+ console.error(chalk24.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
69359
69918
  return 1;
69360
69919
  }
69361
- if (!existsSync20(paths.reportHtml)) {
69362
- console.error(chalk23.red(`✖ report.html não existe em ${paths.runDir}`));
69920
+ if (!existsSync21(paths.reportHtml)) {
69921
+ console.error(chalk24.red(`✖ report.html não existe em ${paths.runDir}`));
69363
69922
  return 1;
69364
69923
  }
69365
69924
  return serveRunAndBlock(paths.runDir, {
@@ -69509,7 +70068,7 @@ function evaluateFailOnGate(allIssues, failOn, verdictStatus) {
69509
70068
  var SCORE_BAND_RUNS = 4;
69510
70069
  function readRunChecks(reportPath) {
69511
70070
  try {
69512
- const raw = JSON.parse(readFileSync27(reportPath, "utf8"));
70071
+ const raw = JSON.parse(readFileSync28(reportPath, "utf8"));
69513
70072
  return (raw.checks ?? []).filter((c) => typeof c.name === "string" && typeof c.status === "string").map((c) => ({ name: c.name, status: c.status }));
69514
70073
  } catch {
69515
70074
  return [];
@@ -69518,14 +70077,14 @@ function readRunChecks(reportPath) {
69518
70077
  async function runCommand(rawOpts) {
69519
70078
  if (!rawOpts.prod) {
69520
70079
  const target = rawOpts.cand ?? "<url>";
69521
- console.error(`${chalk24.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
69522
- For one site, use: ${chalk24.cyan(`parity e2e --url ${target}`)}
70080
+ console.error(`${chalk25.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
70081
+ For one site, use: ${chalk25.cyan(`parity e2e --url ${target}`)}
69523
70082
  (runs the functional flows + all checks in single-site mode — no prod baseline needed).`);
69524
70083
  return 2;
69525
70084
  }
69526
70085
  let opts = applyPreset(rawOpts);
69527
70086
  if (rawOpts.preset) {
69528
- console.log(chalk24.dim(` preset: ${rawOpts.preset}`));
70087
+ console.log(chalk25.dim(` preset: ${rawOpts.preset}`));
69529
70088
  }
69530
70089
  if (opts.pt)
69531
70090
  setLlmLanguage("pt");
@@ -69533,14 +70092,14 @@ async function runCommand(rawOpts) {
69533
70092
  disableInteractive();
69534
70093
  const llmCfgErr = applyLlmOptions(opts);
69535
70094
  if (llmCfgErr) {
69536
- console.error(chalk24.red(` ${llmCfgErr}`));
70095
+ console.error(chalk25.red(` ${llmCfgErr}`));
69537
70096
  return 2;
69538
70097
  }
69539
70098
  const llmStillAvailable = isLlmAvailable();
69540
70099
  const preSmart = opts;
69541
70100
  opts = applySmartDefaults(opts, llmStillAvailable);
69542
70101
  if (!llmStillAvailable && opts.visualPages !== preSmart.visualPages) {
69543
- console.log(chalk24.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
70102
+ console.log(chalk25.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
69544
70103
  }
69545
70104
  let interactivePromptShown = false;
69546
70105
  if (!opts.only && !opts.skip && !rawOpts.preset) {
@@ -69566,14 +70125,14 @@ async function runCommand(rawOpts) {
69566
70125
  if (isContentProfile && !opts.only && !opts.skip) {
69567
70126
  opts.only = "seo,visual,vitals,cache,console,html,network";
69568
70127
  moduleDropReason = "profile: content → e2e module dropped (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force";
69569
- console.log(chalk24.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
70128
+ console.log(chalk25.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
69570
70129
  }
69571
70130
  const selection = resolveSelection({ only: opts.only, skip: opts.skip });
69572
70131
  if (selection.errors.length > 0) {
69573
- console.error(chalk24.red(" --only/--skip: invalid value(s):"));
70132
+ console.error(chalk25.red(" --only/--skip: invalid value(s):"));
69574
70133
  for (const e of selection.errors)
69575
- console.error(chalk24.red(` - ${e}`));
69576
- console.error(chalk24.dim(`
70134
+ console.error(chalk25.red(` - ${e}`));
70135
+ console.error(chalk25.dim(`
69577
70136
  valid modules: ${Object.keys(MODULES).join(", ")}`));
69578
70137
  return 2;
69579
70138
  }
@@ -69585,14 +70144,14 @@ async function runCommand(rawOpts) {
69585
70144
  const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
69586
70145
  const scoped = resolveScopedFlows({ explicitFlows, selectionFlows: selection.flows });
69587
70146
  flows = scoped.flows;
69588
- console.log(chalk24.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
70147
+ console.log(chalk25.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
69589
70148
  if (scoped.starved.length > 0) {
69590
- console.log(chalk24.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
70149
+ console.log(chalk25.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
69591
70150
  }
69592
70151
  } else {
69593
70152
  flows = opts.flows.split(",").map((s) => s.trim());
69594
70153
  if (!interactivePromptShown) {
69595
- console.log(chalk24.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
70154
+ console.log(chalk25.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
69596
70155
  }
69597
70156
  }
69598
70157
  if (isContentProfile) {
@@ -69601,12 +70160,12 @@ async function runCommand(rawOpts) {
69601
70160
  if (!flows.includes("homepage"))
69602
70161
  flows.unshift("homepage");
69603
70162
  if (before !== flows.join(",")) {
69604
- console.log(chalk24.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
70163
+ console.log(chalk25.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
69605
70164
  }
69606
70165
  }
69607
70166
  const pagesScopeWarning = pagesFlowsScopeWarning(opts, flows);
69608
70167
  if (pagesScopeWarning) {
69609
- console.log(chalk24.dim(` ${pagesScopeWarning}`));
70168
+ console.log(chalk25.dim(` ${pagesScopeWarning}`));
69610
70169
  }
69611
70170
  if (hasSelection) {
69612
70171
  const needsSitemapPages = selection.modules.some((m) => MODULES[m].needsSitemapPages);
@@ -69615,12 +70174,12 @@ async function runCommand(rawOpts) {
69615
70174
  const VISUAL_PAGES_DEFAULT = 5;
69616
70175
  if (!needsSitemapPages && opts.vitalsPages === VITALS_PAGES_DEFAULT) {
69617
70176
  opts.vitalsPages = 0;
69618
- console.log(chalk24.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
70177
+ console.log(chalk25.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
69619
70178
  }
69620
70179
  if (!needsLlmPass && opts.visualPages === VISUAL_PAGES_DEFAULT) {
69621
70180
  opts.visualPages = 0;
69622
70181
  opts.noVisualDiff = true;
69623
- console.log(chalk24.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
70182
+ console.log(chalk25.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
69624
70183
  }
69625
70184
  }
69626
70185
  const viewports = opts.viewports.split(",").map((s) => s.trim());
@@ -69634,37 +70193,37 @@ async function runCommand(rawOpts) {
69634
70193
  const ignore = loadParityIgnore();
69635
70194
  if (opts.clearCache) {
69636
70195
  const cacheFile = join34(opts.output, "cache", "verdicts.json");
69637
- if (existsSync21(cacheFile)) {
70196
+ if (existsSync22(cacheFile)) {
69638
70197
  try {
69639
70198
  unlinkSync3(cacheFile);
69640
- console.log(chalk24.dim(` cache wiped: ${cacheFile}`));
70199
+ console.log(chalk25.dim(` cache wiped: ${cacheFile}`));
69641
70200
  } catch (err) {
69642
- console.log(chalk24.yellow(` cache wipe falhou: ${err.message}`));
70201
+ console.log(chalk25.yellow(` cache wipe falhou: ${err.message}`));
69643
70202
  }
69644
70203
  }
69645
70204
  }
69646
70205
  const llmTimeoutRaw = opts.llmTimeout ?? 60;
69647
70206
  if (!Number.isFinite(llmTimeoutRaw)) {
69648
- console.error(chalk24.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
70207
+ console.error(chalk25.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
69649
70208
  return 2;
69650
70209
  }
69651
70210
  const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
69652
70211
  if (isLlmAvailable()) {
69653
- console.log(chalk24.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
70212
+ console.log(chalk25.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
69654
70213
  } else {
69655
- console.log(chalk24.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
70214
+ console.log(chalk25.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
69656
70215
  }
69657
70216
  if (isInteractiveMode()) {
69658
- console.log(chalk24.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
70217
+ console.log(chalk25.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
69659
70218
  }
69660
70219
  const primaryViewport = viewports[0] ?? "mobile";
69661
70220
  const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
69662
70221
  if (!preflight.ok) {
69663
- console.error(chalk24.red(`
70222
+ console.error(chalk25.red(`
69664
70223
  ✖ pre-flight falhou:`));
69665
70224
  for (const err of preflight.errors)
69666
- console.error(chalk24.red(` - ${err}`));
69667
- console.error(chalk24.dim(`
70225
+ console.error(chalk25.red(` - ${err}`));
70226
+ console.error(chalk25.dim(`
69668
70227
  dica: verifique se as URLs estão corretas e acessíveis`));
69669
70228
  return 2;
69670
70229
  }
@@ -69675,7 +70234,7 @@ async function runCommand(rawOpts) {
69675
70234
  if (prodHomeHtml) {
69676
70235
  platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
69677
70236
  if (platform !== "custom") {
69678
- console.log(chalk24.dim(` Detected platform: ${platform}`));
70237
+ console.log(chalk25.dim(` Detected platform: ${platform}`));
69679
70238
  }
69680
70239
  }
69681
70240
  const prodHost = hostOf3(opts.prod);
@@ -69710,11 +70269,11 @@ async function runCommand(rawOpts) {
69710
70269
  viewports,
69711
70270
  timestamp
69712
70271
  });
69713
- console.log(chalk24.bold(`
70272
+ console.log(chalk25.bold(`
69714
70273
  parity run ${runId}`));
69715
- console.log(chalk24.dim(` prod: ${opts.prod}`));
69716
- console.log(chalk24.dim(` cand: ${opts.cand}`));
69717
- console.log(chalk24.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
70274
+ console.log(chalk25.dim(` prod: ${opts.prod}`));
70275
+ console.log(chalk25.dim(` cand: ${opts.cand}`));
70276
+ console.log(chalk25.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
69718
70277
  `));
69719
70278
  const spinner = ora8("Launching browser…").start();
69720
70279
  let browser = null;
@@ -69726,7 +70285,7 @@ async function runCommand(rawOpts) {
69726
70285
  const min = Math.floor(elapsedSec / 60);
69727
70286
  const sec = elapsedSec % 60;
69728
70287
  const mmss = `${min.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
69729
- spinner.text = `${chalk24.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
70288
+ spinner.text = `${chalk25.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
69730
70289
  };
69731
70290
  const setSpinnerLabel = (label) => {
69732
70291
  currentSpinnerLabel = label;
@@ -69846,8 +70405,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69846
70405
  for (const flow of flows) {
69847
70406
  const flowStart = Date.now();
69848
70407
  let lastStepTotal = 0;
69849
- const sideTag = side === "prod" ? chalk24.cyan("prod") : chalk24.magenta("cand");
69850
- const prefix = `${chalk24.dim(`[${viewport}/`)}${sideTag}${chalk24.dim("]")}`;
70408
+ const sideTag = side === "prod" ? chalk25.cyan("prod") : chalk25.magenta("cand");
70409
+ const prefix = `${chalk25.dim(`[${viewport}/`)}${sideTag}${chalk25.dim("]")}`;
69851
70410
  setSpinnerLabel(`${prefix} ${flow}: starting…`);
69852
70411
  const cap = await runFlow(flow, {
69853
70412
  baseUrl,
@@ -69864,7 +70423,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69864
70423
  onStep: (event) => {
69865
70424
  if (event.phase === "start") {
69866
70425
  lastStepTotal = event.total;
69867
- setSpinnerLabel(`${prefix} ${flow} ${chalk24.dim(`${event.index}/${event.total}`)} ${event.name}…`);
70426
+ setSpinnerLabel(`${prefix} ${flow} ${chalk25.dim(`${event.index}/${event.total}`)} ${event.name}…`);
69868
70427
  }
69869
70428
  }
69870
70429
  });
@@ -69873,18 +70432,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69873
70432
  const target = lastStepTotal || recorded;
69874
70433
  const failed = cap.steps?.find((s) => s.status === "failed");
69875
70434
  const lastStep = cap.steps?.[cap.steps.length - 1];
69876
- const elapsedDim = chalk24.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
69877
- const counts = target > 0 ? chalk24.dim(`${okSteps}/${target}`) : "";
70435
+ const elapsedDim = chalk25.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
70436
+ const counts = target > 0 ? chalk25.dim(`${okSteps}/${target}`) : "";
69878
70437
  let glyph;
69879
70438
  let detail;
69880
70439
  if (failed) {
69881
- glyph = chalk24.red("✗");
69882
- detail = `stopped at ${chalk24.yellow(failed.name)}`;
70440
+ glyph = chalk25.red("✗");
70441
+ detail = `stopped at ${chalk25.yellow(failed.name)}`;
69883
70442
  } else if (target > 0 && okSteps < target) {
69884
- glyph = chalk24.yellow("▴");
69885
- detail = lastStep ? `ended at ${chalk24.dim(lastStep.name)}` : "incomplete";
70443
+ glyph = chalk25.yellow("▴");
70444
+ detail = lastStep ? `ended at ${chalk25.dim(lastStep.name)}` : "incomplete";
69886
70445
  } else {
69887
- glyph = chalk24.green("✓");
70446
+ glyph = chalk25.green("✓");
69888
70447
  detail = "";
69889
70448
  }
69890
70449
  const summary = `${glyph} ${prefix} ${flow} ${counts} ${detail} ${elapsedDim}`.replace(/\s+/g, " ").trim();
@@ -69946,7 +70505,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69946
70505
  const vitalsPagesLimit = opts.vitalsPages ?? vitalsPagesDefault;
69947
70506
  const vitalsRuns = Math.max(1, Number.parseInt(opts.runs, 10) || 1);
69948
70507
  if (candIsDevServer && vitalsPagesLimit > 0) {
69949
- console.log(chalk24.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
70508
+ console.log(chalk25.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
69950
70509
  }
69951
70510
  if (browser && vitalsPagesLimit > 0) {
69952
70511
  currentPhase = "vitals-pages";
@@ -70293,12 +70852,12 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
70293
70852
  totalIssues: allIssues.length,
70294
70853
  verdict: { status: verdict.status, score: verdict.score, scoreVersion: SCORE_VERSION }
70295
70854
  });
70296
- printSummary7(run, paths.reportHtml, { promotedCount, deprecatedCount, platform });
70855
+ printSummary8(run, paths.reportHtml, { promotedCount, deprecatedCount, platform });
70297
70856
  console.log(`
70298
70857
  ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
70299
70858
  const failOnGate = evaluateFailOnGate(allIssues, failOn, verdict.status);
70300
70859
  if (failOnGate.exitCode === 1) {
70301
- console.log(chalk24.red(failOnGate.message));
70860
+ console.log(chalk25.red(failOnGate.message));
70302
70861
  return 1;
70303
70862
  }
70304
70863
  if (opts.open) {
@@ -70368,10 +70927,10 @@ function parsePagePair(entry) {
70368
70927
  }
70369
70928
  function resolveExplicitPages(pagesFile, pagesList) {
70370
70929
  if (pagesFile) {
70371
- if (!existsSync21(pagesFile)) {
70930
+ if (!existsSync22(pagesFile)) {
70372
70931
  throw new Error(`--pages-file não encontrado: ${pagesFile}`);
70373
70932
  }
70374
- const raw = readFileSync27(pagesFile, "utf-8");
70933
+ const raw = readFileSync28(pagesFile, "utf-8");
70375
70934
  const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
70376
70935
  for (const line of lines)
70377
70936
  validatePageEntry(line, [], true);
@@ -70522,63 +71081,63 @@ function hostOf3(url) {
70522
71081
  return url;
70523
71082
  }
70524
71083
  }
70525
- function printSummary7(run, htmlPath, meta) {
71084
+ function printSummary8(run, htmlPath, meta) {
70526
71085
  const { verdict } = run;
70527
71086
  const inconclusive = verdict.status === "inconclusive";
70528
- const emoji = inconclusive ? chalk24.dim("○") : verdict.status === "pass" ? chalk24.green("✔") : verdict.status === "warn" ? chalk24.yellow("⚠") : chalk24.red("✖");
70529
- const score = inconclusive ? chalk24.dim("—") : verdict.status === "pass" ? chalk24.green(verdict.score) : verdict.status === "warn" ? chalk24.yellow(verdict.score) : chalk24.red(verdict.score);
71087
+ const emoji = inconclusive ? chalk25.dim("○") : verdict.status === "pass" ? chalk25.green("✔") : verdict.status === "warn" ? chalk25.yellow("⚠") : chalk25.red("✖");
71088
+ const score = inconclusive ? chalk25.dim("—") : verdict.status === "pass" ? chalk25.green(verdict.score) : verdict.status === "warn" ? chalk25.yellow(verdict.score) : chalk25.red(verdict.score);
70530
71089
  const prev = run.previousRun;
70531
- const scoreDelta = !prev ? chalk24.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk24.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk24.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk24.dim(` (= run anterior: ${prev.score})`);
71090
+ const scoreDelta = !prev ? chalk25.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk25.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk25.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk25.dim(` (= run anterior: ${prev.score})`);
70532
71091
  console.log("");
70533
71092
  if (inconclusive) {
70534
71093
  console.log(` ${emoji} parity INCONCLUSIVE · nothing was measured (0 checks ran)`);
70535
71094
  } else {
70536
71095
  console.log(` ${emoji} parity ${verdict.status.toUpperCase()} · score ${score}/100${scoreDelta}`);
70537
71096
  }
70538
- console.log(` checks: ${chalk24.green(verdict.checksPassed)} pass · ${chalk24.red(verdict.checksFailed)} fail · ${chalk24.dim(`${verdict.checksSkipped} skipped`)}`);
70539
- console.log(` issues: ${chalk24.red(verdict.critical)} critical · ${chalk24.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk24.dim(`${verdict.low} low`)}`);
71097
+ console.log(` checks: ${chalk25.green(verdict.checksPassed)} pass · ${chalk25.red(verdict.checksFailed)} fail · ${chalk25.dim(`${verdict.checksSkipped} skipped`)}`);
71098
+ console.log(` issues: ${chalk25.red(verdict.critical)} critical · ${chalk25.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk25.dim(`${verdict.low} low`)}`);
70540
71099
  const band = run.scoreBand;
70541
71100
  const bandLine = band ? formatScoreBand(band) : null;
70542
71101
  if (band && bandLine) {
70543
- console.log(` ${chalk24.dim(bandLine)}`);
71102
+ console.log(` ${chalk25.dim(bandLine)}`);
70544
71103
  const caveat = scoreBandCaveat(band);
70545
71104
  if (caveat)
70546
- console.log(` ${chalk24.yellow("⚠")} ${caveat}`);
71105
+ console.log(` ${chalk25.yellow("⚠")} ${caveat}`);
70547
71106
  }
70548
71107
  for (const c of run.caveats ?? []) {
70549
- const mark = c.level === "warn" ? chalk24.yellow("⚠") : chalk24.dim("ℹ");
71108
+ const mark = c.level === "warn" ? chalk25.yellow("⚠") : chalk25.dim("ℹ");
70550
71109
  console.log(` ${mark} ${c.summary}`);
70551
71110
  }
70552
71111
  if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
70553
71112
  const perModule = run.moduleVerdicts.map((mv) => {
70554
- const colored = mv.status === "pass" ? chalk24.green(mv.score) : mv.status === "warn" ? chalk24.yellow(mv.score) : chalk24.red(mv.score);
71113
+ const colored = mv.status === "pass" ? chalk25.green(mv.score) : mv.status === "warn" ? chalk25.yellow(mv.score) : chalk25.red(mv.score);
70555
71114
  return `${mv.module} ${colored}`;
70556
71115
  }).join(" · ");
70557
71116
  console.log(` modules: ${perModule} → composite ${score}`);
70558
71117
  }
70559
71118
  if (run.visualDiff) {
70560
71119
  const vd = run.visualDiff;
70561
- const parityIcon = vd.parityOk ? chalk24.green("✔") : chalk24.red("✖");
70562
- const parityLabel = vd.parityOk ? chalk24.green("OK") : chalk24.red("DIFFS");
70563
- const cacheNote = vd.pagesFromCache > 0 ? chalk24.dim(` · ${vd.pagesFromCache} cached`) : "";
70564
- console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk24.red(vd.pagesWithDiffs)} diffs · ${chalk24.green(vd.pagesPassed)} pass${cacheNote}`);
71120
+ const parityIcon = vd.parityOk ? chalk25.green("✔") : chalk25.red("✖");
71121
+ const parityLabel = vd.parityOk ? chalk25.green("OK") : chalk25.red("DIFFS");
71122
+ const cacheNote = vd.pagesFromCache > 0 ? chalk25.dim(` · ${vd.pagesFromCache} cached`) : "";
71123
+ console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk25.red(vd.pagesWithDiffs)} diffs · ${chalk25.green(vd.pagesPassed)} pass${cacheNote}`);
70565
71124
  }
70566
71125
  if (run.topIssues.length > 0) {
70567
71126
  console.log("");
70568
- console.log(chalk24.bold(" Top issues:"));
71127
+ console.log(chalk25.bold(" Top issues:"));
70569
71128
  for (const g of groupIssues(run.topIssues).slice(0, 5)) {
70570
71129
  const i = g.sample;
70571
- const sev = i.severity === "critical" ? chalk24.red(`[${i.severity}]`) : i.severity === "high" ? chalk24.yellow(`[${i.severity}]`) : chalk24.dim(`[${i.severity}]`);
70572
- const pagesNote = g.pages.length > 1 ? chalk24.dim(` (${g.pages.length} páginas)`) : "";
71130
+ const sev = i.severity === "critical" ? chalk25.red(`[${i.severity}]`) : i.severity === "high" ? chalk25.yellow(`[${i.severity}]`) : chalk25.dim(`[${i.severity}]`);
71131
+ const pagesNote = g.pages.length > 1 ? chalk25.dim(` (${g.pages.length} páginas)`) : "";
70573
71132
  console.log(` ${sev} ${i.summary}${pagesNote}`);
70574
71133
  }
70575
71134
  }
70576
71135
  if (meta.promotedCount > 0 || meta.deprecatedCount > 0) {
70577
71136
  console.log("");
70578
- console.log(chalk24.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk24.green(`+${meta.promotedCount}`)} promoted · ${chalk24.yellow(meta.deprecatedCount)} deprecated`));
71137
+ console.log(chalk25.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk25.green(`+${meta.promotedCount}`)} promoted · ${chalk25.yellow(meta.deprecatedCount)} deprecated`));
70579
71138
  }
70580
71139
  console.log("");
70581
- console.log(chalk24.dim(` → ${htmlPath}`));
71140
+ console.log(chalk25.dim(` → ${htmlPath}`));
70582
71141
  console.log("");
70583
71142
  }
70584
71143
 
@@ -70602,26 +71161,26 @@ async function prCommand(opts) {
70602
71161
  preset: opts.preset ?? "ci",
70603
71162
  open: false
70604
71163
  };
70605
- console.log(chalk25.dim(` prod : ${opts.prod}`));
70606
- console.log(chalk25.dim(` preview : ${opts.preview}`));
71164
+ console.log(chalk26.dim(` prod : ${opts.prod}`));
71165
+ console.log(chalk26.dim(` preview : ${opts.preview}`));
70607
71166
  console.log("");
70608
71167
  const runCode = await runCommand(runOpts);
70609
71168
  const runs = listRuns(opts.output);
70610
71169
  if (runs.length === 0) {
70611
- console.error(chalk25.red("no run was produced — cannot build PR comment"));
71170
+ console.error(chalk26.red("no run was produced — cannot build PR comment"));
70612
71171
  return runCode || 1;
70613
71172
  }
70614
71173
  const latest = runs[0];
70615
71174
  const reportJsonPath = join35(opts.output, "runs", latest.id, "report.json");
70616
- if (!existsSync22(reportJsonPath)) {
70617
- console.error(chalk25.red(`report.json not found at ${reportJsonPath}`));
71175
+ if (!existsSync23(reportJsonPath)) {
71176
+ console.error(chalk26.red(`report.json not found at ${reportJsonPath}`));
70618
71177
  return runCode || 1;
70619
71178
  }
70620
- const run = JSON.parse(readFileSync28(reportJsonPath, "utf8"));
71179
+ const run = JSON.parse(readFileSync29(reportJsonPath, "utf8"));
70621
71180
  const markdown = buildPrComment(run, opts);
70622
71181
  if (opts.out) {
70623
71182
  writeFileSync26(opts.out, markdown, "utf8");
70624
- console.log(chalk25.dim(` wrote PR comment: ${opts.out}`));
71183
+ console.log(chalk26.dim(` wrote PR comment: ${opts.out}`));
70625
71184
  } else {
70626
71185
  process.stdout.write(`
70627
71186
  ${markdown}
@@ -70631,7 +71190,7 @@ ${markdown}
70631
71190
  try {
70632
71191
  writeFileSync26(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
70633
71192
  } catch (err) {
70634
- console.error(chalk25.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
71193
+ console.error(chalk26.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
70635
71194
  }
70636
71195
  }
70637
71196
  return runCode;
@@ -70691,14 +71250,14 @@ function buildPrComment(run, opts) {
70691
71250
  }
70692
71251
 
70693
71252
  // src/commands/prompt.ts
70694
- import { existsSync as existsSync23, writeFileSync as writeFileSync27 } from "node:fs";
70695
- import chalk26 from "chalk";
71253
+ import { existsSync as existsSync24, writeFileSync as writeFileSync27 } from "node:fs";
71254
+ import chalk27 from "chalk";
70696
71255
  function promptCommand(runId, opts) {
70697
71256
  let run;
70698
71257
  try {
70699
71258
  run = loadRun(opts.output, runId);
70700
71259
  } catch (err) {
70701
- console.error(chalk26.red(`✖ ${err.message}`));
71260
+ console.error(chalk27.red(`✖ ${err.message}`));
70702
71261
  return 1;
70703
71262
  }
70704
71263
  const md = buildLlmPrompt(run, {
@@ -70707,10 +71266,10 @@ function promptCommand(runId, opts) {
70707
71266
  });
70708
71267
  if (opts.out) {
70709
71268
  writeFileSync27(opts.out, md, "utf8");
70710
- console.log(chalk26.green(`✔ prompt salvo em ${opts.out}`));
70711
- if (existsSync23(opts.out)) {
71269
+ console.log(chalk27.green(`✔ prompt salvo em ${opts.out}`));
71270
+ if (existsSync24(opts.out)) {
70712
71271
  const sizeKb = (md.length / 1024).toFixed(1);
70713
- console.log(chalk26.dim(` ${md.length} chars (${sizeKb} KB)`));
71272
+ console.log(chalk27.dim(` ${md.length} chars (${sizeKb} KB)`));
70714
71273
  }
70715
71274
  } else {
70716
71275
  process.stdout.write(md);
@@ -70719,9 +71278,9 @@ function promptCommand(runId, opts) {
70719
71278
  }
70720
71279
 
70721
71280
  // src/commands/report.ts
70722
- import { existsSync as existsSync24, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "node:fs";
71281
+ import { existsSync as existsSync25, readFileSync as readFileSync30, writeFileSync as writeFileSync28 } from "node:fs";
70723
71282
  import { join as join36 } from "node:path";
70724
- import chalk27 from "chalk";
71283
+ import chalk28 from "chalk";
70725
71284
  import open2 from "open";
70726
71285
 
70727
71286
  // src/report/deck-template.ts
@@ -71025,7 +71584,7 @@ function blockPages(blocks, lang) {
71025
71584
  const legend = `<div class="legend">${[
71026
71585
  ["ok", "feito", "done"],
71027
71586
  ["new", "upgrade", "upgrade"],
71028
- ["warn", "parcial / as-is / skipped", "partial / as-is / skipped"],
71587
+ ["warn", "parcial / as-is / skipped / vanished", "partial / as-is / skipped / vanished"],
71029
71588
  ["gap", "pendente", "pending"]
71030
71589
  ].map(([tone, pt, en]) => `<span class="lg"><i class="cell ${CELL_CLASS[tone]}"></i>${L2(pt, en, lang)}</span>`).join("")}</div>`;
71031
71590
  const zones = blocks.zones.map((z) => {
@@ -71131,6 +71690,7 @@ var TONE_BY_STATUS = {
71131
71690
  partial: "warn",
71132
71691
  "as-is": "warn",
71133
71692
  skipped: "warn",
71693
+ vanished: "warn",
71134
71694
  pending: "gap"
71135
71695
  };
71136
71696
  function buildDeckBlocks(plan) {
@@ -71401,7 +71961,7 @@ async function reportCommand(runId, opts) {
71401
71961
  try {
71402
71962
  run = loadRun(opts.output, runId);
71403
71963
  } catch (err) {
71404
- console.error(chalk27.red(`failed to load run: ${err.message}`));
71964
+ console.error(chalk28.red(`failed to load run: ${err.message}`));
71405
71965
  return 1;
71406
71966
  }
71407
71967
  let plan = null;
@@ -71409,29 +71969,29 @@ async function reportCommand(runId, opts) {
71409
71969
  try {
71410
71970
  plan = loadPlan(opts.planDir);
71411
71971
  } catch (err) {
71412
- console.error(chalk27.red(`failed to read migration-plan.json: ${err.message}`));
71972
+ console.error(chalk28.red(`failed to read migration-plan.json: ${err.message}`));
71413
71973
  return 1;
71414
71974
  }
71415
71975
  if (!plan) {
71416
- console.error(chalk27.red(`no migration-plan.json in ${opts.planDir}`));
71976
+ console.error(chalk28.red(`no migration-plan.json in ${opts.planDir}`));
71417
71977
  return 1;
71418
71978
  }
71419
71979
  }
71420
71980
  const html = renderDeckHtml(buildDeckModel(run, plan), opts.lang ?? "en");
71421
71981
  const dest = opts.out ?? join36(paths.runDir, "deck.html");
71422
71982
  writeFileSync28(dest, html, "utf8");
71423
- console.log(`${chalk27.green("✓")} deck → ${dest}`);
71983
+ console.log(`${chalk28.green("✓")} deck → ${dest}`);
71424
71984
  if (opts.open) {
71425
71985
  await open2(dest).catch((err) => {
71426
- console.error(chalk27.red(`failed to open: ${err.message}`));
71986
+ console.error(chalk28.red(`failed to open: ${err.message}`));
71427
71987
  });
71428
71988
  }
71429
71989
  return 0;
71430
71990
  }
71431
71991
  if (opts.section) {
71432
71992
  if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
71433
- console.error(chalk27.red(`unknown section "${opts.section}"`));
71434
- console.error(chalk27.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71993
+ console.error(chalk28.red(`unknown section "${opts.section}"`));
71994
+ console.error(chalk28.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71435
71995
  return 1;
71436
71996
  }
71437
71997
  if (opts.json) {
@@ -71439,40 +71999,40 @@ async function reportCommand(runId, opts) {
71439
71999
  const run = loadRun(opts.output, runId);
71440
72000
  const payload = extractReportSection({ kind: "json", section: opts.section, run });
71441
72001
  if (payload === null) {
71442
- console.error(chalk27.red(`section "${opts.section}" not present in this run`));
72002
+ console.error(chalk28.red(`section "${opts.section}" not present in this run`));
71443
72003
  return 1;
71444
72004
  }
71445
72005
  process.stdout.write(`${JSON.stringify(payload, null, 2)}
71446
72006
  `);
71447
72007
  return 0;
71448
72008
  } catch (err) {
71449
- console.error(chalk27.red(`failed to load run: ${err.message}`));
72009
+ console.error(chalk28.red(`failed to load run: ${err.message}`));
71450
72010
  return 1;
71451
72011
  }
71452
72012
  }
71453
- if (!existsSync24(paths.reportHtml)) {
71454
- console.error(chalk27.red(`report.html not found at ${paths.reportHtml}`));
72013
+ if (!existsSync25(paths.reportHtml)) {
72014
+ console.error(chalk28.red(`report.html not found at ${paths.reportHtml}`));
71455
72015
  return 1;
71456
72016
  }
71457
- const html = readFileSync29(paths.reportHtml, "utf8");
72017
+ const html = readFileSync30(paths.reportHtml, "utf8");
71458
72018
  const slice = extractReportSection({ kind: "html", section: opts.section, html });
71459
72019
  if (slice === null) {
71460
- console.error(chalk27.red(`section "${opts.section}" not present in this report`));
72020
+ console.error(chalk28.red(`section "${opts.section}" not present in this report`));
71461
72021
  return 1;
71462
72022
  }
71463
72023
  process.stdout.write(slice);
71464
72024
  return 0;
71465
72025
  }
71466
- console.log(chalk27.dim(`opening ${paths.reportHtml}`));
72026
+ console.log(chalk28.dim(`opening ${paths.reportHtml}`));
71467
72027
  await open2(paths.reportHtml).catch((err) => {
71468
- console.error(chalk27.red(`failed to open: ${err.message}`));
72028
+ console.error(chalk28.red(`failed to open: ${err.message}`));
71469
72029
  });
71470
72030
  return 0;
71471
72031
  }
71472
72032
 
71473
72033
  // src/commands/event.ts
71474
72034
  import { resolve as resolve9 } from "node:path";
71475
- import chalk28 from "chalk";
72035
+ import chalk29 from "chalk";
71476
72036
 
71477
72037
  // src/events.ts
71478
72038
  import { appendFileSync, mkdirSync as mkdirSync17 } from "node:fs";
@@ -71496,24 +72056,24 @@ function eventCommand(type, opts) {
71496
72056
  if (parsed && typeof parsed === "object")
71497
72057
  data = parsed;
71498
72058
  else {
71499
- console.error(chalk28.red("--data must be a JSON object"));
72059
+ console.error(chalk29.red("--data must be a JSON object"));
71500
72060
  return 1;
71501
72061
  }
71502
72062
  } catch {
71503
- console.error(chalk28.red(`--data is not valid JSON: ${opts.data}`));
72063
+ console.error(chalk29.red(`--data is not valid JSON: ${opts.data}`));
71504
72064
  return 1;
71505
72065
  }
71506
72066
  }
71507
72067
  const dir = resolve9(opts.dir);
71508
72068
  emitEvent(dir, type, data);
71509
- console.log(`${chalk28.green("✓")} ${type} → ${dir}/events.jsonl`);
72069
+ console.log(`${chalk29.green("✓")} ${type} → ${dir}/events.jsonl`);
71510
72070
  return 0;
71511
72071
  }
71512
72072
 
71513
72073
  // src/commands/bench.ts
71514
- import { existsSync as existsSync25, mkdirSync as mkdirSync18, readFileSync as readFileSync30, writeFileSync as writeFileSync29 } from "node:fs";
72074
+ import { existsSync as existsSync26, mkdirSync as mkdirSync18, readFileSync as readFileSync31, writeFileSync as writeFileSync29 } from "node:fs";
71515
72075
  import { resolve as resolve10 } from "node:path";
71516
- import chalk29 from "chalk";
72076
+ import chalk30 from "chalk";
71517
72077
 
71518
72078
  // src/diff/motion.ts
71519
72079
  var WEIGHT = {
@@ -71944,20 +72504,20 @@ async function gatherBenchSide(browser, opts) {
71944
72504
  async function benchCommand(opts) {
71945
72505
  const viewport = parseViewport3(opts.viewport);
71946
72506
  if (!viewport) {
71947
- console.error(chalk29.red(`--viewport inválido: ${opts.viewport}`));
72507
+ console.error(chalk30.red(`--viewport inválido: ${opts.viewport}`));
71948
72508
  return 2;
71949
72509
  }
71950
72510
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
71951
72511
  let props;
71952
72512
  if (opts.props) {
71953
- if (!existsSync25(opts.props)) {
71954
- console.error(chalk29.red(`--props não encontrado: ${opts.props}`));
72513
+ if (!existsSync26(opts.props)) {
72514
+ console.error(chalk30.red(`--props não encontrado: ${opts.props}`));
71955
72515
  return 2;
71956
72516
  }
71957
72517
  try {
71958
- props = JSON.parse(readFileSync30(opts.props, "utf8"));
72518
+ props = JSON.parse(readFileSync31(opts.props, "utf8"));
71959
72519
  } catch (err) {
71960
- console.error(chalk29.red(`--props não é JSON válido: ${err.message}`));
72520
+ console.error(chalk30.red(`--props não é JSON válido: ${err.message}`));
71961
72521
  return 2;
71962
72522
  }
71963
72523
  }
@@ -71972,7 +72532,7 @@ async function benchCommand(opts) {
71972
72532
  const prefix = `bench-${slug}-${viewport}`;
71973
72533
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
71974
72534
  if (aliasNote)
71975
- console.log(chalk29.dim(` ${aliasNote}`));
72535
+ console.log(chalk30.dim(` ${aliasNote}`));
71976
72536
  const browser = await launchBrowser({ headless: true });
71977
72537
  try {
71978
72538
  const [prodSide, candSide] = await Promise.all([
@@ -71997,7 +72557,7 @@ async function benchCommand(opts) {
71997
72557
  if (opts.json)
71998
72558
  console.log(JSON.stringify(payload));
71999
72559
  else
72000
- console.error(chalk29.red(` bench falhou — ${readErr}`));
72560
+ console.error(chalk30.red(` bench falhou — ${readErr}`));
72001
72561
  return 2;
72002
72562
  }
72003
72563
  const geometry = diffBoxTrees(prodSide.boxNodes.nodes, candSide.boxNodes.nodes, {
@@ -72027,9 +72587,9 @@ async function benchCommand(opts) {
72027
72587
  console.log(JSON.stringify(result));
72028
72588
  } else {
72029
72589
  console.log("");
72030
- console.log(chalk29.bold(` ${opts.component} — isolated (${viewport})`));
72031
- console.log(chalk29.dim(` prod ${prodUrl}`));
72032
- console.log(chalk29.dim(` cand ${candUrl}`));
72590
+ console.log(chalk30.bold(` ${opts.component} — isolated (${viewport})`));
72591
+ console.log(chalk30.dim(` prod ${prodUrl}`));
72592
+ console.log(chalk30.dim(` cand ${candUrl}`));
72033
72593
  console.log("");
72034
72594
  for (const line of formatBoxTreeDiff(geometry).split(`
72035
72595
  `))
@@ -72040,7 +72600,7 @@ async function benchCommand(opts) {
72040
72600
  ]) {
72041
72601
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
72042
72602
  if (caveat)
72043
- console.log(chalk29.yellow(` ${caveat}`));
72603
+ console.log(chalk30.yellow(` ${caveat}`));
72044
72604
  }
72045
72605
  if (motion) {
72046
72606
  console.log("");
@@ -72049,7 +72609,7 @@ async function benchCommand(opts) {
72049
72609
  console.log(` ${line}`);
72050
72610
  }
72051
72611
  console.log("");
72052
- console.log(chalk29.dim(` ${resultPath}`));
72612
+ console.log(chalk30.dim(` ${resultPath}`));
72053
72613
  }
72054
72614
  return clean || !opts.failOnDiff ? 0 : 1;
72055
72615
  } finally {
@@ -72060,7 +72620,7 @@ async function benchCommand(opts) {
72060
72620
  }
72061
72621
 
72062
72622
  // src/commands/locate.ts
72063
- import chalk30 from "chalk";
72623
+ import chalk31 from "chalk";
72064
72624
  var hitOf = (n, nodes) => ({
72065
72625
  key: n.key,
72066
72626
  label: n.label,
@@ -72185,22 +72745,22 @@ function printResult3(r) {
72185
72745
  const side = (name, a) => {
72186
72746
  if (a.found) {
72187
72747
  console.log(` ${name.padEnd(5)} ${a.hit.tag.padEnd(8)} ${formatHit(a.hit)}`);
72188
- console.log(chalk30.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
72748
+ console.log(chalk31.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
72189
72749
  return;
72190
72750
  }
72191
- console.log(chalk30.yellow(` ${name.padEnd(5)} ${a.reason}`));
72751
+ console.log(chalk31.yellow(` ${name.padEnd(5)} ${a.reason}`));
72192
72752
  for (const c of a.candidates ?? [])
72193
- console.log(chalk30.dim(` candidate: ${c}`));
72753
+ console.log(chalk31.dim(` candidate: ${c}`));
72194
72754
  };
72195
72755
  console.log("");
72196
- console.log(chalk30.bold(` ${r.label} — ${r.viewport}`));
72756
+ console.log(chalk31.bold(` ${r.label} — ${r.viewport}`));
72197
72757
  side("prod", r.prod);
72198
72758
  side("cand", r.cand);
72199
72759
  if (r.prod.found && r.cand.found) {
72200
72760
  const delta = formatDelta(r.prod.hit, r.cand.hit);
72201
72761
  console.log(` ${"diff".padEnd(5)} ${delta ?? "identical box and type"}`);
72202
72762
  for (const note of pairingNotes(r.prod.hit, r.cand.hit)) {
72203
- console.log(chalk30.yellow(` note ${note}`));
72763
+ console.log(chalk31.yellow(` note ${note}`));
72204
72764
  }
72205
72765
  }
72206
72766
  }
@@ -72208,22 +72768,22 @@ async function locateCommand(opts) {
72208
72768
  const selector = opts.selector ?? "body";
72209
72769
  const waitMs = Number.parseInt(opts.wait, 10);
72210
72770
  if (!Number.isFinite(waitMs) || waitMs < 0) {
72211
- console.error(chalk30.red(`--wait inválido: ${opts.wait}`));
72771
+ console.error(chalk31.red(`--wait inválido: ${opts.wait}`));
72212
72772
  return 2;
72213
72773
  }
72214
72774
  if (opts.labels.length === 0) {
72215
- console.error(chalk30.red("nenhum --label passado — o comando procura por label, não por seletor"));
72775
+ console.error(chalk31.red("nenhum --label passado — o comando procura por label, não por seletor"));
72216
72776
  return 2;
72217
72777
  }
72218
72778
  const viewports = opts.viewports.split(",").map((v) => v.trim());
72219
72779
  const bad = viewports.find((v) => parseViewport3(v) === null);
72220
72780
  if (bad) {
72221
- console.error(chalk30.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
72781
+ console.error(chalk31.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
72222
72782
  return 2;
72223
72783
  }
72224
72784
  const { aliases, note } = resolveAliases(opts.planDir);
72225
72785
  if (note && !opts.json)
72226
- console.log(chalk30.dim(` ${note}`));
72786
+ console.log(chalk31.dim(` ${note}`));
72227
72787
  const results = [];
72228
72788
  const caveats = [];
72229
72789
  const browser = await launchBrowser({ headless: true });
@@ -72278,39 +72838,39 @@ async function locateCommand(opts) {
72278
72838
  for (const r of results)
72279
72839
  printResult3(r);
72280
72840
  for (const c of caveats)
72281
- console.log(chalk30.yellow(` ${c}`));
72841
+ console.log(chalk31.yellow(` ${c}`));
72282
72842
  console.log("");
72283
72843
  if (unresolved.length > 0) {
72284
- console.log(chalk30.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72844
+ console.log(chalk31.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72285
72845
  } else {
72286
- console.log(chalk30.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
72846
+ console.log(chalk31.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
72287
72847
  }
72288
72848
  return unresolved.length > 0 ? 1 : 0;
72289
72849
  }
72290
72850
 
72291
72851
  // src/commands/cockpit.ts
72292
72852
  import { resolve as resolve15 } from "node:path";
72293
- import chalk31 from "chalk";
72853
+ import chalk32 from "chalk";
72294
72854
 
72295
72855
  // src/server/cockpit.ts
72296
- import { readFileSync as readFileSync35 } from "node:fs";
72856
+ import { readFileSync as readFileSync36 } from "node:fs";
72297
72857
  import { createServer as createServer2 } from "node:http";
72298
72858
  import { dirname as dirname8, join as join42, resolve as resolve14 } from "node:path";
72299
72859
 
72300
72860
  // src/server/cockpit-actions.ts
72301
72861
  import { spawn as spawn3 } from "node:child_process";
72302
- import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync32, readdirSync as readdirSync7, writeFileSync as writeFileSync31 } from "node:fs";
72862
+ import { existsSync as existsSync28, mkdirSync as mkdirSync20, readFileSync as readFileSync33, readdirSync as readdirSync7, writeFileSync as writeFileSync31 } from "node:fs";
72303
72863
  import { join as join39, resolve as resolve12 } from "node:path";
72304
72864
 
72305
72865
  // src/server/cockpit-settings.ts
72306
72866
  import { execFileSync as execFileSync3 } from "node:child_process";
72307
- import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync31, writeFileSync as writeFileSync30 } from "node:fs";
72867
+ import { chmodSync, existsSync as existsSync27, mkdirSync as mkdirSync19, readFileSync as readFileSync32, writeFileSync as writeFileSync30 } from "node:fs";
72308
72868
  import { homedir as homedir3 } from "node:os";
72309
72869
  import { join as join38, resolve as resolve11 } from "node:path";
72310
72870
  var FILE = () => join38(process.env.PARITY_HOME ?? join38(homedir3(), ".parity"), "config.json");
72311
72871
  function readAll() {
72312
72872
  try {
72313
- return JSON.parse(readFileSync31(FILE(), "utf8"));
72873
+ return JSON.parse(readFileSync32(FILE(), "utf8"));
72314
72874
  } catch {
72315
72875
  return {};
72316
72876
  }
@@ -72463,12 +73023,13 @@ var COMPONENT_STATUSES = [
72463
73023
  "done",
72464
73024
  "as-is",
72465
73025
  "upgrade",
72466
- "skipped"
73026
+ "skipped",
73027
+ "vanished"
72467
73028
  ];
72468
73029
  var PAGE_STATUSES2 = ["pending", "code", "done", "skipped"];
72469
73030
  function readState(planDir) {
72470
73031
  try {
72471
- return JSON.parse(readFileSync32(join39(planDir, "migration.json"), "utf8"));
73032
+ return JSON.parse(readFileSync33(join39(planDir, "migration.json"), "utf8"));
72472
73033
  } catch {
72473
73034
  return null;
72474
73035
  }
@@ -72542,10 +73103,10 @@ function setComponent(planDir, name, status, decision = {}) {
72542
73103
  const plan = loadPlan(planDir);
72543
73104
  if (!plan)
72544
73105
  throw new Error("no migration-plan.json");
72545
- const c = setComponentStatus(plan, name, status);
73106
+ const note = decision.note?.trim() ?? "";
73107
+ const c = setComponentStatus(plan, name, status, { note });
72546
73108
  if (!c)
72547
73109
  throw new Error(`no component "${name}" in the plan`);
72548
- const note = decision.note?.trim() ?? "";
72549
73110
  if (note || url || design) {
72550
73111
  setComponentReference(plan, name, {
72551
73112
  url,
@@ -72574,10 +73135,10 @@ function setComponentSelector(planDir, name, selector) {
72574
73135
  }
72575
73136
  function captured(planDir, host, name) {
72576
73137
  const file = join39(planDir, host, "capture.json");
72577
- if (!existsSync27(file))
73138
+ if (!existsSync28(file))
72578
73139
  return null;
72579
73140
  try {
72580
- const cap = JSON.parse(readFileSync32(file, "utf8"));
73141
+ const cap = JSON.parse(readFileSync33(file, "utf8"));
72581
73142
  const rows = Array.isArray(cap.components) ? cap.components : [];
72582
73143
  return rows.find((r) => r.role === name || r.name === name) ?? null;
72583
73144
  } catch {
@@ -72599,7 +73160,7 @@ function componentDetail(planDir, name) {
72599
73160
  }
72600
73161
  })();
72601
73162
  const cap = host ? captured(planDir, host, name) : null;
72602
- const shot = typeof cap?.screenshotPath === "string" && existsSync27(cap.screenshotPath) ? cap.screenshotPath : null;
73163
+ const shot = typeof cap?.screenshotPath === "string" && existsSync28(cap.screenshotPath) ? cap.screenshotPath : null;
72603
73164
  const styles = cap?.computedStyles ?? {};
72604
73165
  return {
72605
73166
  name: c.name,
@@ -72628,7 +73189,7 @@ function componentShot(planDir, name) {
72628
73189
  const p = typeof cap?.screenshotPath === "string" ? cap.screenshotPath : null;
72629
73190
  if (!p || !resolve12(p).startsWith(resolve12(join39(planDir, host))))
72630
73191
  return null;
72631
- return existsSync27(p) ? readFileSync32(p) : null;
73192
+ return existsSync28(p) ? readFileSync33(p) : null;
72632
73193
  }
72633
73194
  function setPage(planDir, path, status) {
72634
73195
  if (!PAGE_STATUSES2.includes(status)) {
@@ -72646,13 +73207,13 @@ function setPage(planDir, path, status) {
72646
73207
  var jobsDir = (planDir) => join39(planDir, "jobs");
72647
73208
  function lastJob(planDir, kind) {
72648
73209
  const dir = jobsDir(planDir);
72649
- if (!existsSync27(dir))
73210
+ if (!existsSync28(dir))
72650
73211
  return null;
72651
73212
  const id = readdirSync7(dir).filter((d) => d.startsWith(`${kind}-`)).sort().pop();
72652
73213
  if (!id)
72653
73214
  return null;
72654
73215
  const j = join39(dir, id);
72655
- const read = (f) => existsSync27(join39(j, f)) ? readFileSync32(join39(j, f), "utf8") : null;
73216
+ const read = (f) => existsSync28(join39(j, f)) ? readFileSync33(join39(j, f), "utf8") : null;
72656
73217
  const exit = read("exit");
72657
73218
  const pid = Number(read("pid") ?? 0);
72658
73219
  let alive = false;
@@ -72711,14 +73272,14 @@ function remoteUrl(dir) {
72711
73272
  }
72712
73273
 
72713
73274
  // src/server/cockpit-api.ts
72714
- import { existsSync as existsSync28, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "node:fs";
73275
+ import { existsSync as existsSync29, readFileSync as readFileSync34, readdirSync as readdirSync8 } from "node:fs";
72715
73276
  import { join as join40 } from "node:path";
72716
73277
  var notFound = (what) => ({ status: 404, body: { error: what } });
72717
73278
  function readJson2(path) {
72718
- if (!existsSync28(path))
73279
+ if (!existsSync29(path))
72719
73280
  return null;
72720
73281
  try {
72721
- return JSON.parse(readFileSync33(path, "utf8"));
73282
+ return JSON.parse(readFileSync34(path, "utf8"));
72722
73283
  } catch {
72723
73284
  return null;
72724
73285
  }
@@ -72727,7 +73288,7 @@ function withPlan(ctx) {
72727
73288
  return loadPlan(ctx.planDir);
72728
73289
  }
72729
73290
  function listBenchResults(benchDir) {
72730
- if (!existsSync28(benchDir))
73291
+ if (!existsSync29(benchDir))
72731
73292
  return [];
72732
73293
  let files;
72733
73294
  try {
@@ -72762,7 +73323,7 @@ function cockpitApi(path, params, ctx) {
72762
73323
  benchDir: ctx.benchDir,
72763
73324
  prodUrl: ctx.prodUrl ?? null,
72764
73325
  candUrl: ctx.candUrl ?? null,
72765
- hasPlan: existsSync28(join40(ctx.planDir, "migration-plan.json"))
73326
+ hasPlan: existsSync29(join40(ctx.planDir, "migration-plan.json"))
72766
73327
  }
72767
73328
  };
72768
73329
  case "/api/state": {
@@ -73332,13 +73893,13 @@ import { execFileSync as execFileSync4, spawn as spawn4 } from "node:child_proce
73332
73893
  import { randomUUID } from "node:crypto";
73333
73894
  import {
73334
73895
  appendFileSync as appendFileSync2,
73335
- existsSync as existsSync29,
73896
+ existsSync as existsSync30,
73336
73897
  mkdirSync as mkdirSync21,
73337
- readFileSync as readFileSync34,
73898
+ readFileSync as readFileSync35,
73338
73899
  readdirSync as readdirSync9,
73339
73900
  realpathSync,
73340
73901
  renameSync as renameSync2,
73341
- rmSync,
73902
+ rmSync as rmSync2,
73342
73903
  statSync as statSync3,
73343
73904
  symlinkSync,
73344
73905
  unlinkSync as unlinkSync4,
@@ -73360,12 +73921,12 @@ function validTaskId(id) {
73360
73921
  }
73361
73922
  function pluginDir() {
73362
73923
  const root = resolve13(dirname7(fileURLToPath(import.meta.url)), "../../../..");
73363
- return existsSync29(join41(root, ".claude-plugin", "plugin.json")) ? root : null;
73924
+ return existsSync30(join41(root, ".claude-plugin", "plugin.json")) ? root : null;
73364
73925
  }
73365
73926
  function targetDir(planDir) {
73366
73927
  try {
73367
- const state = JSON.parse(readFileSync34(join41(planDir, "migration.json"), "utf8"));
73368
- if (typeof state?.target?.dir === "string" && existsSync29(state.target.dir))
73928
+ const state = JSON.parse(readFileSync35(join41(planDir, "migration.json"), "utf8"));
73929
+ if (typeof state?.target?.dir === "string" && existsSync30(state.target.dir))
73369
73930
  return state.target.dir;
73370
73931
  } catch {}
73371
73932
  return dirname7(resolve13(planDir));
@@ -73462,7 +74023,7 @@ function locateSource(html, root) {
73462
74023
  continue;
73463
74024
  const file = join41(dir, e.name);
73464
74025
  if (/\.(s?css|less)$/.test(e.name)) {
73465
- const lines = readFileSync34(file, "utf8").split(`
74026
+ const lines = readFileSync35(file, "utf8").split(`
73466
74027
  `);
73467
74028
  for (const local of mods.get(stem) ?? []) {
73468
74029
  const leaf = local.split("__").pop() ?? local;
@@ -73474,7 +74035,7 @@ function locateSource(html, root) {
73474
74035
  }
73475
74036
  }
73476
74037
  };
73477
- walk(existsSync29(join41(root, "src")) ? join41(root, "src") : root, 0);
74038
+ walk(existsSync30(join41(root, "src")) ? join41(root, "src") : root, 0);
73478
74039
  return hits;
73479
74040
  }
73480
74041
  function grid(s) {
@@ -73624,7 +74185,7 @@ function prompt(task, planDir, dir) {
73624
74185
  "",
73625
74186
  "Steps:",
73626
74187
  `0. Reproduce first, against the DEPLOYED cand (no build needed): have \`runner\` run \`parity section --task '${dir}' --box-tree --computed-styles --screenshot --json\`. If it shows no difference in what the note is about, STOP: report ok:false, qa:"not-run", summary "does not reproduce" plus what was measured — do not dispatch a fixer. Chromium is not Safari: when the note could be engine- or device-specific (icons, SVG sprites, vh, a phone or tablet), also reproduce with \`parity ios --prod … --cand … --selector … --cand-selector … --device "iPad Pro 13-inch (M5)"\` (or an iPhone) before concluding it does not reproduce.`,
73627
- existsSync29(join41(dir, "sizes.md")) ? `1. The numbers are already measured and written to ${join41(dir, "sizes.md")} (prod = target, cand = now, plus the source file and CSS rule). Dispatch \`fixer\` DIRECTLY with the note, sizes.md, context.json, the screenshots, and the TARGET repo's conventions.rules + gates from migration.json. Do not dispatch \`briefer\` — sizes.md is the brief.` : `1. Nothing was measured. Dispatch \`briefer\` first (note, screenshots, target dir; out: ${join41(dir, "brief.md")}), then \`fixer\` with brief.md and the TARGET repo's conventions.rules + gates.`,
74188
+ existsSync30(join41(dir, "sizes.md")) ? `1. The numbers are already measured and written to ${join41(dir, "sizes.md")} (prod = target, cand = now, plus the source file and CSS rule). Dispatch \`fixer\` DIRECTLY with the note, sizes.md, context.json, the screenshots, and the TARGET repo's conventions.rules + gates from migration.json. Do not dispatch \`briefer\` — sizes.md is the brief.` : `1. Nothing was measured. Dispatch \`briefer\` first (note, screenshots, target dir; out: ${join41(dir, "brief.md")}), then \`fixer\` with brief.md and the TARGET repo's conventions.rules + gates.`,
73628
74189
  " Tell the fixer, verbatim: (a) hit the prod column's numbers at this viewport; do not re-measure from the screenshots; (b) do not start dev servers or browsers — qa verifies the render; (c) if dependencies are missing run the target's install once in the worktree, never look in other directories; (d) run only the configured gates.",
73629
74190
  `2. ONE preview server for the whole task, at http://localhost:${previewPort(task.id)}: after the fixer commits, have \`runner\` build the worktree once and start it there with the target's own build/start (see its AGENTS.md). Reuse it for every QA round; after a new commit, rebuild and restart that same one — never a second server, never on another port. Each agent building and starting its own cost dozens of commands per round.`,
73630
74191
  "3. Dispatch `qa` to verify this element against prod at the same viewport, using sizes.md (or brief.md) as the acceptance criteria. Hand it the pair and the command — do not let it rediscover selectors or start servers:",
@@ -73664,7 +74225,7 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73664
74225
  return false;
73665
74226
  }
73666
74227
  })();
73667
- if (sameDeps && existsSync29(join41(repo, "node_modules")) && !existsSync29(join41(wt, "node_modules"))) {
74228
+ if (sameDeps && existsSync30(join41(repo, "node_modules")) && !existsSync30(join41(wt, "node_modules"))) {
73668
74229
  symlinkSync(join41(repo, "node_modules"), join41(wt, "node_modules"));
73669
74230
  }
73670
74231
  return { worktree: wt, branch, base: { ref, sha } };
@@ -73719,7 +74280,7 @@ function retryTask(planDir, id, note) {
73719
74280
  const n = (task.attempts?.length ?? 0) + 2;
73720
74281
  const previousBranch = task.branch ?? d.delivery?.branch ?? null;
73721
74282
  let moved = false;
73722
- if (!task.worktree || !existsSync29(task.worktree)) {
74283
+ if (!task.worktree || !existsSync30(task.worktree)) {
73723
74284
  Object.assign(task, prepareWorktree(task, planDir, dir, `cockpit/${task.id}-r${n}`));
73724
74285
  if (!task.worktree)
73725
74286
  throw new Error(`could not create a worktree: ${task.worktreeError}`);
@@ -73744,11 +74305,11 @@ function retryTask(planDir, id, note) {
73744
74305
  const promptFile = join41(dir, `prompt-${n}.md`);
73745
74306
  writeFileSync32(promptFile, lines.join(`
73746
74307
  `));
73747
- if (existsSync29(join41(dir, "stderr.log")))
74308
+ if (existsSync30(join41(dir, "stderr.log")))
73748
74309
  renameSync2(join41(dir, "stderr.log"), join41(dir, `stderr-${n - 1}.log`));
73749
- if (existsSync29(join41(dir, "exit")))
74310
+ if (existsSync30(join41(dir, "exit")))
73750
74311
  unlinkSync4(join41(dir, "exit"));
73751
- if (existsSync29(join41(dir, "stopped")))
74312
+ if (existsSync30(join41(dir, "stopped")))
73752
74313
  unlinkSync4(join41(dir, "stopped"));
73753
74314
  task.attempts = [
73754
74315
  ...task.attempts ?? [],
@@ -73799,7 +74360,7 @@ async function createTask(planDir, note) {
73799
74360
  }
73800
74361
  var procCache = new Map;
73801
74362
  function taskProcesses(worktree) {
73802
- if (!worktree || !existsSync29(worktree))
74363
+ if (!worktree || !existsSync30(worktree))
73803
74364
  return [];
73804
74365
  const real = realpathSync(worktree);
73805
74366
  if (!real || real === "/")
@@ -73842,11 +74403,11 @@ function taskProcesses(worktree) {
73842
74403
  function stopTask(planDir, id) {
73843
74404
  const dir = taskDir(planDir, id);
73844
74405
  const file = join41(dir, "task.json");
73845
- if (!existsSync29(file))
74406
+ if (!existsSync30(file))
73846
74407
  throw new Error("no such task");
73847
- const task = JSON.parse(readFileSync34(file, "utf8"));
74408
+ const task = JSON.parse(readFileSync35(file, "utf8"));
73848
74409
  let stopped = 0;
73849
- if (task.pid && alive(task.pid) && !existsSync29(join41(dir, "exit"))) {
74410
+ if (task.pid && alive(task.pid) && !existsSync30(join41(dir, "exit"))) {
73850
74411
  try {
73851
74412
  process.kill(-task.pid, "SIGTERM");
73852
74413
  stopped += 1;
@@ -73912,7 +74473,7 @@ function prPlan(planDir, id, baseOverride) {
73912
74473
  throw new Error("no such task");
73913
74474
  const task = d.task;
73914
74475
  const branch = d.delivery?.branch;
73915
- if (!branch || !task.worktree || !existsSync29(task.worktree))
74476
+ if (!branch || !task.worktree || !existsSync30(task.worktree))
73916
74477
  throw new Error("this task has no local branch to push");
73917
74478
  const eff = effectiveSettings(planDir, targetDir(planDir));
73918
74479
  const settings = { prBase: eff.prBase, githubUser: eff.githubUser };
@@ -73956,7 +74517,7 @@ function openPr(planDir, id, baseOverride) {
73956
74517
  if (!plan.commits.length)
73957
74518
  throw new Error("the branch has no commits of its own");
73958
74519
  const dir = taskDir(planDir, id);
73959
- const task = JSON.parse(readFileSync34(join41(dir, "task.json"), "utf8"));
74520
+ const task = JSON.parse(readFileSync35(join41(dir, "task.json"), "utf8"));
73960
74521
  const wt = task.worktree;
73961
74522
  const env = { ...process.env, ...ghEnv(plan.account ?? undefined) };
73962
74523
  const git = (...a) => execFileSync4("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
@@ -74017,7 +74578,7 @@ function autoOpenPrs(planDir) {
74017
74578
  if (t.status !== "done" || t.prUrl)
74018
74579
  continue;
74019
74580
  const mark = join41(taskDir(planDir, t.id), "pr-auto.json");
74020
- if (existsSync29(mark))
74581
+ if (existsSync30(mark))
74021
74582
  continue;
74022
74583
  const at = new Date().toISOString();
74023
74584
  try {
@@ -74114,12 +74675,12 @@ function autoMergePrs(planDir) {
74114
74675
  if (t.status !== "done")
74115
74676
  continue;
74116
74677
  const dir = taskDir(planDir, t.id);
74117
- if (existsSync29(join41(dir, "pr-merge.json")))
74678
+ if (existsSync30(join41(dir, "pr-merge.json")))
74118
74679
  continue;
74119
74680
  const d = readTask(planDir, t.id);
74120
74681
  const branch = d?.delivery?.branch;
74121
74682
  const wt = d?.task.worktree;
74122
- if (!d || !branch || !wt || !existsSync29(wt))
74683
+ if (!d || !branch || !wt || !existsSync30(wt))
74123
74684
  continue;
74124
74685
  const pr = prInfo(branch, wt, dir, true, true);
74125
74686
  if (!pr || pr.state !== "OPEN")
@@ -74158,8 +74719,8 @@ function autoMergePrs(planDir) {
74158
74719
  writeFileSync32(join41(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
74159
74720
  `)[0] }));
74160
74721
  }
74161
- rmSync(join41(dir, "pr.json"), { force: true });
74162
- } else if (pr.checks.failed > 0 && !existsSync29(join41(dir, "ci-retry.json"))) {
74722
+ rmSync2(join41(dir, "pr.json"), { force: true });
74723
+ } else if (pr.checks.failed > 0 && !existsSync30(join41(dir, "ci-retry.json"))) {
74163
74724
  writeFileSync32(join41(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
74164
74725
  retryTask(planDir, t.id, `CI failed on PR #${pr.number}: ${pr.checks.failing.join(", ")}.${waivers.length ? ` Not waivable: ${waivers.filter((w) => !w.waived).map((w) => w.why).join("; ")}.` : ""} Read the failing job logs, fix on the same branch, push, wait for every check, then merge.`);
74165
74726
  }
@@ -74170,7 +74731,7 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
74170
74731
  return null;
74171
74732
  const cache = join41(dir, "pr.json");
74172
74733
  try {
74173
- const c = JSON.parse(readFileSync34(cache, "utf8"));
74734
+ const c = JSON.parse(readFileSync35(cache, "utf8"));
74174
74735
  if (!fresh && Date.now() - c.checkedAt < 60000)
74175
74736
  return c.info ?? (c.url ? { url: c.url } : null);
74176
74737
  } catch {}
@@ -74200,9 +74761,9 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
74200
74761
  function readTask(planDir, id) {
74201
74762
  const dir = taskDir(planDir, id);
74202
74763
  const file = join41(dir, "task.json");
74203
- if (!existsSync29(file))
74764
+ if (!existsSync30(file))
74204
74765
  return null;
74205
- const task = JSON.parse(readFileSync34(file, "utf8"));
74766
+ const task = JSON.parse(readFileSync35(file, "utf8"));
74206
74767
  const streamFile = join41(dir, "stream.jsonl");
74207
74768
  const exitFile = join41(dir, "exit");
74208
74769
  const steps = [];
@@ -74213,7 +74774,7 @@ function readTask(planDir, id) {
74213
74774
  let lastTs;
74214
74775
  let rawResult = "";
74215
74776
  const actorOf = (parent) => parent && agents.get(parent)?.type || "orchestrator";
74216
- const lines = existsSync29(streamFile) ? readFileSync34(streamFile, "utf8").split(`
74777
+ const lines = existsSync30(streamFile) ? readFileSync35(streamFile, "utf8").split(`
74217
74778
  `) : [];
74218
74779
  for (const line of lines) {
74219
74780
  if (!line.trim())
@@ -74307,8 +74868,8 @@ function readTask(planDir, id) {
74307
74868
  if (agent) {
74308
74869
  const scan = (t) => [...t.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74309
74870
  let res = scan(String(m.summary ?? ""));
74310
- if (!res && typeof m.output_file === "string" && existsSync29(m.output_file)) {
74311
- res = scan(agentText(readFileSync34(m.output_file, "utf8")));
74871
+ if (!res && typeof m.output_file === "string" && existsSync30(m.output_file)) {
74872
+ res = scan(agentText(readFileSync35(m.output_file, "utf8")));
74312
74873
  }
74313
74874
  if (res) {
74314
74875
  try {
@@ -74333,8 +74894,8 @@ function readTask(planDir, id) {
74333
74894
  steps.push({ actor: "orchestrator", kind: "result", text: result.text, isError: !result.ok });
74334
74895
  }
74335
74896
  }
74336
- const exit = existsSync29(exitFile) ? Number(readFileSync34(exitFile, "utf8").trim()) : null;
74337
- const stderrRaw = existsSync29(join41(dir, "stderr.log")) ? readFileSync34(join41(dir, "stderr.log"), "utf8") : "";
74897
+ const exit = existsSync30(exitFile) ? Number(readFileSync35(exitFile, "utf8").trim()) : null;
74898
+ const stderrRaw = existsSync30(join41(dir, "stderr.log")) ? readFileSync35(join41(dir, "stderr.log"), "utf8") : "";
74338
74899
  const finalLine = [...rawResult.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74339
74900
  let verdict = null;
74340
74901
  try {
@@ -74346,7 +74907,7 @@ function readTask(planDir, id) {
74346
74907
  let reason;
74347
74908
  let status;
74348
74909
  if (exit !== null) {
74349
- if (existsSync29(join41(dir, "stopped"))) {
74910
+ if (existsSync30(join41(dir, "stopped"))) {
74350
74911
  reason = "stopped from the cockpit";
74351
74912
  } else if (/Background tasks still running .* terminating/.test(stderrRaw)) {
74352
74913
  reason = `claude stopped waiting for background agents (${unfinished.join(", ") || "?"}) and terminated them`;
@@ -74365,17 +74926,17 @@ function readTask(planDir, id) {
74365
74926
  else if (!alive(task.pid))
74366
74927
  status = "failed";
74367
74928
  else {
74368
- const last = existsSync29(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74929
+ const last = existsSync30(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74369
74930
  status = Date.now() - last > STALL_MS ? "stalled" : "running";
74370
74931
  }
74371
- const read = (f) => existsSync29(join41(dir, f)) ? readFileSync34(join41(dir, f), "utf8") : null;
74932
+ const read = (f) => existsSync30(join41(dir, f)) ? readFileSync35(join41(dir, f), "utf8") : null;
74372
74933
  const stderr = clip(stderrRaw, 1500);
74373
74934
  const fixer = [...agents.values()].reverse().find((a) => a.type === "fixer" && a.result);
74374
74935
  const fr = fixer?.result ?? {};
74375
74936
  const branch = verdict?.branch ?? fr.branch ?? null;
74376
74937
  let delivery = null;
74377
74938
  if (branch) {
74378
- const repo = task.worktree && existsSync29(task.worktree) ? task.worktree : targetDir(dirname7(dirname7(dir)));
74939
+ const repo = task.worktree && existsSync30(task.worktree) ? task.worktree : targetDir(dirname7(dirname7(dir)));
74379
74940
  const baseSha = task.base?.sha ?? fr.base;
74380
74941
  const git = (...a) => {
74381
74942
  try {
@@ -74406,7 +74967,7 @@ function readTask(planDir, id) {
74406
74967
  model,
74407
74968
  prError: (() => {
74408
74969
  try {
74409
- const m = JSON.parse(readFileSync34(join41(dir, "pr-auto.json"), "utf8"));
74970
+ const m = JSON.parse(readFileSync35(join41(dir, "pr-auto.json"), "utf8"));
74410
74971
  return m.ok ? null : String(m.error);
74411
74972
  } catch {
74412
74973
  return null;
@@ -74426,7 +74987,7 @@ function readTask(planDir, id) {
74426
74987
  }
74427
74988
  function listTasks2(planDir) {
74428
74989
  const dir = tasksDir(planDir);
74429
- if (!existsSync29(dir))
74990
+ if (!existsSync30(dir))
74430
74991
  return [];
74431
74992
  return readdirSync9(dir).filter(validTaskId).sort().reverse().map((id) => readTask(planDir, id)).filter((t) => t !== null).map(({ task, status, agents, result, delivery }) => ({
74432
74993
  ...task,
@@ -74441,7 +75002,7 @@ function taskShot(planDir, id, side) {
74441
75002
  if (!validTaskId(id) || side !== "prod" && side !== "cand")
74442
75003
  return null;
74443
75004
  const file = join41(taskDir(planDir, id), `${side}.png`);
74444
- return existsSync29(file) ? readFileSync34(file) : null;
75005
+ return existsSync30(file) ? readFileSync35(file) : null;
74445
75006
  }
74446
75007
 
74447
75008
  // src/server/cockpit.ts
@@ -74726,7 +75287,7 @@ async function actions(req, res, path, ctx) {
74726
75287
  }
74727
75288
  function targetDirOf(planDir) {
74728
75289
  try {
74729
- const st = JSON.parse(readFileSync35(join42(planDir, "migration.json"), "utf8"));
75290
+ const st = JSON.parse(readFileSync36(join42(planDir, "migration.json"), "utf8"));
74730
75291
  if (typeof st?.target?.dir === "string")
74731
75292
  return st.target.dir;
74732
75293
  } catch {}
@@ -74749,19 +75310,19 @@ async function cockpitCommand(opts) {
74749
75310
  host: opts.host
74750
75311
  });
74751
75312
  } catch (err) {
74752
- console.error(chalk31.red(` ✖ could not start the cockpit: ${err.message}`));
75313
+ console.error(chalk32.red(` ✖ could not start the cockpit: ${err.message}`));
74753
75314
  return 2;
74754
75315
  }
74755
75316
  console.log("");
74756
- console.log(chalk31.bold(" parity cockpit"));
74757
- console.log(` ${chalk31.green("●")} ${handle.url}`);
74758
- console.log(chalk31.dim(` plan ${ctx.planDir}`));
74759
- console.log(chalk31.dim(` runs ${ctx.output}`));
74760
- console.log(chalk31.dim(` bench ${ctx.benchDir}`));
75317
+ console.log(chalk32.bold(" parity cockpit"));
75318
+ console.log(` ${chalk32.green("●")} ${handle.url}`);
75319
+ console.log(chalk32.dim(` plan ${ctx.planDir}`));
75320
+ console.log(chalk32.dim(` runs ${ctx.output}`));
75321
+ console.log(chalk32.dim(` bench ${ctx.benchDir}`));
74761
75322
  if (opts.host && opts.host !== "127.0.0.1" && opts.host !== "localhost") {
74762
- console.log(chalk31.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
75323
+ console.log(chalk32.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
74763
75324
  }
74764
- console.log(chalk31.dim(` Ctrl+C to stop.
75325
+ console.log(chalk32.dim(` Ctrl+C to stop.
74765
75326
  `));
74766
75327
  if (opts.open !== false) {
74767
75328
  const { default: openUrl } = await import("open");
@@ -74781,15 +75342,15 @@ async function cockpitCommand(opts) {
74781
75342
 
74782
75343
  // src/commands/ios.ts
74783
75344
  import { execFileSync as execFileSync5 } from "node:child_process";
74784
- import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync37, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
75345
+ import { existsSync as existsSync32, mkdirSync as mkdirSync22, readFileSync as readFileSync38, rmSync as rmSync3, writeFileSync as writeFileSync33 } from "node:fs";
74785
75346
  import { homedir as homedir4, tmpdir as tmpdir2 } from "node:os";
74786
75347
  import { join as join44, resolve as resolve16 } from "node:path";
74787
- import chalk33 from "chalk";
75348
+ import chalk34 from "chalk";
74788
75349
 
74789
75350
  // src/commands/pair.ts
74790
- import { existsSync as existsSync30, readFileSync as readFileSync36 } from "node:fs";
75351
+ import { existsSync as existsSync31, readFileSync as readFileSync37 } from "node:fs";
74791
75352
  import { join as join43 } from "node:path";
74792
- import chalk32 from "chalk";
75353
+ import chalk33 from "chalk";
74793
75354
 
74794
75355
  // src/engine/pair.ts
74795
75356
  function signatureOf(target, doc = document) {
@@ -74989,7 +75550,7 @@ async function open3(browser, url, viewport, waitMs) {
74989
75550
  async function pairCommand(opts) {
74990
75551
  const viewport = parseViewport3(opts.viewport);
74991
75552
  if (!viewport) {
74992
- console.error(chalk32.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
75553
+ console.error(chalk33.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
74993
75554
  return 2;
74994
75555
  }
74995
75556
  const from = opts.side;
@@ -75031,27 +75592,27 @@ function report(opts, from, source, match, problem) {
75031
75592
  ambiguous: match?.ambiguous ?? 0
75032
75593
  }));
75033
75594
  } else {
75034
- const box = (s) => s ? chalk32.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
75595
+ const box = (s) => s ? chalk33.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
75035
75596
  if (source)
75036
75597
  console.log(`${from} ${source.selector} ${box(source)}`);
75037
75598
  if (match) {
75038
- console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk32.dim(`by ${match.by}`)}`);
75599
+ console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk33.dim(`by ${match.by}`)}`);
75039
75600
  }
75040
75601
  if (problem)
75041
- console.log(chalk32.yellow(problem));
75602
+ console.log(chalk33.yellow(problem));
75042
75603
  else if (match?.by === "position") {
75043
- console.log(chalk32.yellow("matched by position only — verify it is the same element"));
75604
+ console.log(chalk33.yellow("matched by position only — verify it is the same element"));
75044
75605
  }
75045
75606
  }
75046
75607
  return problem ? 2 : 0;
75047
75608
  }
75048
75609
  function sectionArgsFromTask(taskDir) {
75049
75610
  const file = join43(taskDir, "task.json");
75050
- if (!existsSync30(file))
75611
+ if (!existsSync31(file))
75051
75612
  throw new Error(`no task.json in ${taskDir}`);
75052
- const task = JSON.parse(readFileSync36(file, "utf8"));
75613
+ const task = JSON.parse(readFileSync37(file, "utf8"));
75053
75614
  const ctxFile = join43(taskDir, "context.json");
75054
- const ctx = existsSync30(ctxFile) ? JSON.parse(readFileSync36(ctxFile, "utf8")) : {};
75615
+ const ctx = existsSync31(ctxFile) ? JSON.parse(readFileSync37(ctxFile, "utf8")) : {};
75055
75616
  const prodSel = task.side === "prod" ? task.selector : ctx.prod?.selector ?? task.counterpart;
75056
75617
  const candSel = task.side === "cand" ? task.selector : ctx.cand?.selector ?? task.counterpart;
75057
75618
  if (!prodSel || !candSel) {
@@ -75086,7 +75647,7 @@ async function takeLock() {
75086
75647
  mkdirSync22(join44(homedir4(), ".parity"), { recursive: true });
75087
75648
  const until = Date.now() + 5 * 60000;
75088
75649
  for (;; ) {
75089
- const holder = existsSync31(LOCK) ? Number(readFileSync37(LOCK, "utf8")) : 0;
75650
+ const holder = existsSync32(LOCK) ? Number(readFileSync38(LOCK, "utf8")) : 0;
75090
75651
  if (!holder || !alive2(holder) || holder === process.pid)
75091
75652
  break;
75092
75653
  if (Date.now() > until)
@@ -75107,7 +75668,7 @@ async function iosCommand(opts) {
75107
75668
  try {
75108
75669
  execFileSync5("xcrun", ["simctl", "help"], { stdio: "ignore" });
75109
75670
  } catch {
75110
- console.error(chalk33.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
75671
+ console.error(chalk34.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
75111
75672
  return 2;
75112
75673
  }
75113
75674
  let { prod, cand, selector, candSelector } = opts;
@@ -75164,9 +75725,9 @@ async function iosCommand(opts) {
75164
75725
  simctl("shutdown", device.udid);
75165
75726
  } catch {}
75166
75727
  }
75167
- rmSync2(scratch, { recursive: true, force: true });
75168
- if (existsSync31(LOCK) && Number(readFileSync37(LOCK, "utf8")) === process.pid)
75169
- rmSync2(LOCK);
75728
+ rmSync3(scratch, { recursive: true, force: true });
75729
+ if (existsSync32(LOCK) && Number(readFileSync38(LOCK, "utf8")) === process.pid)
75730
+ rmSync3(LOCK);
75170
75731
  }
75171
75732
  const missing = Object.entries(found).filter(([, v]) => v !== true).map(([k]) => k);
75172
75733
  let diff = null;
@@ -75182,11 +75743,11 @@ async function iosCommand(opts) {
75182
75743
  if (opts.json)
75183
75744
  console.log(JSON.stringify(report));
75184
75745
  else {
75185
- console.log(`${chalk33.bold("iOS Safari")} · ${device.name}`);
75746
+ console.log(`${chalk34.bold("iOS Safari")} · ${device.name}`);
75186
75747
  for (const [k, v] of Object.entries(shots))
75187
75748
  console.log(` ${k.padEnd(5)} ${v}`);
75188
75749
  for (const side of missing) {
75189
- console.log(chalk33.yellow(` ${side}: the element was ${found[side] === false ? "not found" : "not reported"} in Safari — no diff (pass a selector that holds, e.g. from \`parity pair\`)`));
75750
+ console.log(chalk34.yellow(` ${side}: the element was ${found[side] === false ? "not found" : "not reported"} in Safari — no diff (pass a selector that holds, e.g. from \`parity pair\`)`));
75190
75751
  }
75191
75752
  if (diff)
75192
75753
  console.log(` diff ${(diff.pctDiff * 100).toFixed(2)}% (${diff.diffPixels} px) → ${diff.heatmapPath}`);
@@ -75199,7 +75760,7 @@ import { createInterface as createInterface3 } from "node:readline";
75199
75760
  import { resolve as resolve18 } from "node:path";
75200
75761
 
75201
75762
  // src/util/version.ts
75202
- import { readFileSync as readFileSync38 } from "node:fs";
75763
+ import { readFileSync as readFileSync39 } from "node:fs";
75203
75764
  import { dirname as dirname9, resolve as resolve17 } from "node:path";
75204
75765
  import { fileURLToPath as fileURLToPath2 } from "node:url";
75205
75766
  function getPackageVersion() {
@@ -75208,7 +75769,7 @@ function getPackageVersion() {
75208
75769
  for (const up of ["..", "../..", "../../.."]) {
75209
75770
  try {
75210
75771
  const pkgPath = resolve17(here, up, "package.json");
75211
- const raw = readFileSync38(pkgPath, "utf8");
75772
+ const raw = readFileSync39(pkgPath, "utf8");
75212
75773
  const parsed = JSON.parse(raw);
75213
75774
  if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
75214
75775
  return parsed.version;
@@ -75319,7 +75880,7 @@ function parseLine(line) {
75319
75880
  }
75320
75881
 
75321
75882
  // src/mcp/tools.ts
75322
- import { existsSync as existsSync32, readFileSync as readFileSync39 } from "node:fs";
75883
+ import { existsSync as existsSync33, readFileSync as readFileSync40 } from "node:fs";
75323
75884
  import { join as join45 } from "node:path";
75324
75885
  var STR = { type: "string" };
75325
75886
  var NONE = { type: "object", properties: {}, additionalProperties: false };
@@ -75357,11 +75918,11 @@ function createTools(ctx) {
75357
75918
  inputSchema: NONE,
75358
75919
  handler: () => {
75359
75920
  const p = join45(ctx.planDir, "migration.json");
75360
- if (!existsSync32(p)) {
75921
+ if (!existsSync33(p)) {
75361
75922
  return fail2(`no migration.json in ${ctx.planDir} — no migration has been started here`);
75362
75923
  }
75363
75924
  try {
75364
- return json2(JSON.parse(readFileSync39(p, "utf8")));
75925
+ return json2(JSON.parse(readFileSync40(p, "utf8")));
75365
75926
  } catch (err) {
75366
75927
  return fail2(`migration.json is not valid JSON: ${err.message}`);
75367
75928
  }
@@ -75460,10 +76021,10 @@ function createTools(ctx) {
75460
76021
  },
75461
76022
  {
75462
76023
  name: "SET_STATUS",
75463
- description: "Flip a component's porting status: pending | partial | done | as-is | upgrade | skipped. `as-is` and `upgrade` mean 'stop opening work for this' and are the USER's call — an agent setting them itself is how a real gap disappears from view.",
76024
+ description: "Flip a component's porting status: pending | partial | done | as-is | upgrade | skipped | vanished. `as-is` and `upgrade` mean 'stop opening work for this' and are the USER's call — an agent setting them itself is how a real gap disappears from view. `vanished` = was live at capture, gone from prod now — built and shipped disabled; requires `note` (\"<capture date>: <why>\").",
75464
76025
  inputSchema: {
75465
76026
  type: "object",
75466
- properties: { name: STR, status: STR },
76027
+ properties: { name: STR, status: STR, note: STR },
75467
76028
  required: ["name", "status"],
75468
76029
  additionalProperties: false
75469
76030
  },
@@ -75473,14 +76034,19 @@ function createTools(ctx) {
75473
76034
  const status = str(args, "status");
75474
76035
  if (!name || !status)
75475
76036
  return fail2("name and status are required");
75476
- const allowed = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
76037
+ const allowed = ["pending", "partial", "done", "as-is", "upgrade", "skipped", "vanished"];
75477
76038
  if (!allowed.includes(status)) {
75478
76039
  return fail2(`invalid status "${status}". Use one of: ${allowed.join(", ")}`);
75479
76040
  }
75480
- return mutate(ctx, (plan) => {
75481
- const c = setComponentStatus(plan, name, status);
75482
- return c ? `${c.name} → ${status}` : null;
75483
- });
76041
+ const note = str(args, "note") ?? undefined;
76042
+ try {
76043
+ return mutate(ctx, (plan) => {
76044
+ const c = setComponentStatus(plan, name, status, { note });
76045
+ return c ? `${c.name} → ${status}` : null;
76046
+ });
76047
+ } catch (err) {
76048
+ return fail2(err.message);
76049
+ }
75484
76050
  }
75485
76051
  },
75486
76052
  {
@@ -75593,7 +76159,7 @@ async function mcpCommand(opts) {
75593
76159
  // src/commands/heatmap.ts
75594
76160
  import { mkdirSync as mkdirSync23 } from "node:fs";
75595
76161
  import { resolve as resolve19 } from "node:path";
75596
- import chalk34 from "chalk";
76162
+ import chalk35 from "chalk";
75597
76163
 
75598
76164
  // src/diff/hotspot-findings.ts
75599
76165
  var TYPOGRAPHY_PROPS = /^(font-family|font-weight|font-size|font-style|line-height|letter-spacing|text-transform)$/;
@@ -75692,13 +76258,13 @@ function describe2(type, hotspot, nodes, imageHostDelta, because) {
75692
76258
  }
75693
76259
 
75694
76260
  // src/diff/noise-mask.ts
75695
- import { readFileSync as readFileSync40, writeFileSync as writeFileSync34 } from "node:fs";
76261
+ import { readFileSync as readFileSync41, writeFileSync as writeFileSync34 } from "node:fs";
75696
76262
  import { PNG as PNG5 } from "pngjs";
75697
76263
  var DEFAULT_DILATE = 2;
75698
76264
  var MAX_MASK_COVERAGE = 0.2;
75699
76265
  function buildNoiseMask(firstPng, secondPng, dilate = DEFAULT_DILATE) {
75700
- const a = PNG5.sync.read(readFileSync40(firstPng));
75701
- const b = PNG5.sync.read(readFileSync40(secondPng));
76266
+ const a = PNG5.sync.read(readFileSync41(firstPng));
76267
+ const b = PNG5.sync.read(readFileSync41(secondPng));
75702
76268
  if (a.width !== b.width || a.height !== b.height)
75703
76269
  return null;
75704
76270
  const { width, height } = a;
@@ -75738,7 +76304,7 @@ function dilateMask(src, width, height, radius) {
75738
76304
  return pass(pass(src, true), false);
75739
76305
  }
75740
76306
  function applyMask(pngPath, mask, outPath) {
75741
- const png = PNG5.sync.read(readFileSync40(pngPath));
76307
+ const png = PNG5.sync.read(readFileSync41(pngPath));
75742
76308
  if (png.width !== mask.width || png.height !== mask.height) {
75743
76309
  throw new Error(`applyMask: image is ${png.width}x${png.height} but the mask is ${mask.width}x${mask.height}`);
75744
76310
  }
@@ -75755,7 +76321,7 @@ function applyMask(pngPath, mask, outPath) {
75755
76321
  }
75756
76322
  function readPngSize(pngPath) {
75757
76323
  try {
75758
- const head = readFileSync40(pngPath).subarray(0, 24);
76324
+ const head = readFileSync41(pngPath).subarray(0, 24);
75759
76325
  if (head.length < 24)
75760
76326
  return null;
75761
76327
  return { width: head.readUInt32BE(16), height: head.readUInt32BE(20) };
@@ -76007,16 +76573,16 @@ function exitCodeFor(verdict) {
76007
76573
  async function heatmapCommand(opts) {
76008
76574
  const specs = parseViewports2(opts.viewports);
76009
76575
  if (typeof specs === "string") {
76010
- console.error(chalk34.red(specs));
76576
+ console.error(chalk35.red(specs));
76011
76577
  return EXIT_INCONCLUSIVE;
76012
76578
  }
76013
76579
  const waitMs = Number.parseInt(opts.wait, 10);
76014
76580
  if (!Number.isFinite(waitMs) || waitMs < 0) {
76015
- console.error(chalk34.red(`--wait inválido: ${opts.wait}`));
76581
+ console.error(chalk35.red(`--wait inválido: ${opts.wait}`));
76016
76582
  return EXIT_INCONCLUSIVE;
76017
76583
  }
76018
76584
  if (!isValidUrl5(opts.prod) || !isValidUrl5(opts.cand)) {
76019
- console.error(chalk34.red("--prod ou --cand inválido"));
76585
+ console.error(chalk35.red("--prod ou --cand inválido"));
76020
76586
  return EXIT_INCONCLUSIVE;
76021
76587
  }
76022
76588
  const selector = opts.selector?.trim() || null;
@@ -76055,7 +76621,7 @@ async function heatmapCommand(opts) {
76055
76621
  };
76056
76622
  if (opts.pr) {
76057
76623
  await postQaComment({ report, pr: opts.pr, repo: opts.repo }).catch((err) => {
76058
- console.error(chalk34.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
76624
+ console.error(chalk35.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
76059
76625
  });
76060
76626
  }
76061
76627
  if (opts.json)
@@ -76167,6 +76733,18 @@ function judgePair(args) {
76167
76733
  const blocked = firstBlocker(prod, cand);
76168
76734
  if (blocked)
76169
76735
  return { ...base, verdict: "inconclusive", reason: blocked };
76736
+ const overflow = judgeHorizontalOverflow(prod, cand);
76737
+ if (overflow?.verdict === "inconclusive") {
76738
+ return { ...base, verdict: "inconclusive", reason: overflow.reason };
76739
+ }
76740
+ if (overflow) {
76741
+ return {
76742
+ ...base,
76743
+ findings: [overflow.finding],
76744
+ verdict: "differs",
76745
+ reason: overflow.finding.summary
76746
+ };
76747
+ }
76170
76748
  if (!args.prodRepeatScreenshot) {
76171
76749
  return {
76172
76750
  ...base,
@@ -76289,6 +76867,37 @@ function judgePair(args) {
76289
76867
  reason: diff.diffPixels === 0 ? undefined : `${diff.diffPixels} differing pixels in ${analysis.hotspots.length} region(s)`
76290
76868
  };
76291
76869
  }
76870
+ function judgeHorizontalOverflow(prod, cand) {
76871
+ const c = cand.horizontalOverflow;
76872
+ if (c === undefined)
76873
+ return { verdict: "inconclusive", reason: "cand horizontal overflow not measured" };
76874
+ if (c === null)
76875
+ return null;
76876
+ if (prod.horizontalOverflow === undefined) {
76877
+ return {
76878
+ verdict: "inconclusive",
76879
+ reason: `prod horizontal overflow not measured, so cand's ${c.px}px overflow cannot be judged a regression`
76880
+ };
76881
+ }
76882
+ const prodPx = prod.horizontalOverflow?.px ?? 0;
76883
+ if (c.px <= prodPx)
76884
+ return null;
76885
+ const culprit = c.widest ? `widest offender \`${c.widest.selector}\` ends ${c.widest.overflowPx}px past it` : "no single element was found past the edge";
76886
+ const baseline = prodPx > 0 ? `prod overflows ${prodPx}px` : "prod fits";
76887
+ return {
76888
+ verdict: "differs",
76889
+ finding: {
76890
+ type: "horizontal-overflow",
76891
+ hotspot: {
76892
+ ...c.widest?.rect ?? { x: c.clientWidth, y: 0, width: c.px, height: 0 },
76893
+ pixelCount: 0
76894
+ },
76895
+ nodes: [],
76896
+ summary: `cand scrolls sideways: the page is ${c.px}px wider than its ${c.clientWidth}px viewport (${baseline}); ${culprit} — fix that before reading any pixel diff, every position is shifted by it`,
76897
+ truncated: false
76898
+ }
76899
+ };
76900
+ }
76292
76901
  function explainHotspots(hotspots, prod, cand, paths, prodBoxTree, candBoxTree) {
76293
76902
  if (hotspots.length === 0)
76294
76903
  return [];
@@ -76364,6 +76973,7 @@ async function captureSide(browser, args) {
76364
76973
  });
76365
76974
  side.devicePixelRatio = await page.evaluate(() => window.devicePixelRatio);
76366
76975
  side.fontsStatus = await page.evaluate(() => document.fonts?.status ?? "unknown");
76976
+ side.horizontalOverflow = await readHorizontalOverflow(page);
76367
76977
  if (args.selector) {
76368
76978
  const loc = page.locator(args.selector);
76369
76979
  side.matches = await loc.count();
@@ -76445,6 +77055,46 @@ async function isAlreadyOnScreen(page, selector) {
76445
77055
  return false;
76446
77056
  }
76447
77057
  }
77058
+ async function readHorizontalOverflow(page) {
77059
+ return page.evaluate(() => {
77060
+ const root = document.documentElement;
77061
+ const clientWidth = root.clientWidth;
77062
+ const px = root.scrollWidth - clientWidth;
77063
+ if (px <= 0)
77064
+ return null;
77065
+ const clipped = (el) => {
77066
+ for (let a = el.parentElement;a && a !== document.body && a !== root; a = a.parentElement) {
77067
+ if (getComputedStyle(a).overflowX !== "visible")
77068
+ return true;
77069
+ }
77070
+ return false;
77071
+ };
77072
+ let widest = null;
77073
+ for (const el of Array.from(document.body?.querySelectorAll("*") ?? [])) {
77074
+ const r = el.getBoundingClientRect();
77075
+ const right = r.right + window.scrollX;
77076
+ const over = Math.round(right - clientWidth);
77077
+ if (over <= 0 || widest && over <= widest.overflowPx)
77078
+ continue;
77079
+ if (getComputedStyle(el).position === "fixed" || clipped(el))
77080
+ continue;
77081
+ const cls = Array.from(el.classList).slice(0, 2).map((c) => `.${CSS.escape(c)}`).join("");
77082
+ widest = {
77083
+ selector: `${el.tagName.toLowerCase()}${el.id ? `#${CSS.escape(el.id)}` : ""}${cls}`,
77084
+ overflowPx: over,
77085
+ rect: {
77086
+ x: Math.round(r.left + window.scrollX),
77087
+ y: Math.round(r.top + window.scrollY),
77088
+ width: Math.round(r.width),
77089
+ height: Math.round(r.height)
77090
+ }
77091
+ };
77092
+ }
77093
+ return { px, clientWidth, widest };
77094
+ }).catch(() => {
77095
+ return;
77096
+ });
77097
+ }
76448
77098
  async function readImageHosts(page, selector) {
76449
77099
  return page.evaluate((sel) => {
76450
77100
  const root = sel ? document.querySelector(sel) : document.body;
@@ -76481,35 +77131,46 @@ function isValidUrl5(s) {
76481
77131
  }
76482
77132
  }
76483
77133
  var MARK = {
76484
- identical: chalk34.green("✓"),
76485
- differs: chalk34.red("✗"),
76486
- inconclusive: chalk34.yellow("?")
77134
+ identical: chalk35.green("✓"),
77135
+ differs: chalk35.red("✗"),
77136
+ inconclusive: chalk35.yellow("?")
76487
77137
  };
76488
77138
  function printReport(report) {
76489
77139
  console.log("");
76490
- console.log(chalk34.bold(` parity heatmap — ${report.mode}`));
76491
- console.log(chalk34.dim(` prod: ${report.prodUrl}`));
76492
- console.log(chalk34.dim(` cand: ${report.candUrl}`));
77140
+ console.log(chalk35.bold(` parity heatmap — ${report.mode}`));
77141
+ console.log(chalk35.dim(` prod: ${report.prodUrl}`));
77142
+ console.log(chalk35.dim(` cand: ${report.candUrl}`));
76493
77143
  console.log("");
76494
77144
  for (const v of report.viewports) {
76495
- const detail = v.verdict === "identical" ? chalk34.dim("0 pixels") : v.reason ?? chalk34.dim("no detail");
77145
+ const detail = v.verdict === "identical" ? chalk35.dim("0 pixels") : v.reason ?? chalk35.dim("no detail");
76496
77146
  console.log(` ${MARK[v.verdict]} ${v.label.padEnd(12)} ${detail}`);
76497
77147
  if (v.maskedCoverage != null && v.maskedCoverage > 0) {
76498
- console.log(chalk34.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
77148
+ console.log(chalk35.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
77149
+ }
77150
+ if (!v.findings.some((f) => f.type === "horizontal-overflow")) {
77151
+ for (const [name, s] of [
77152
+ ["prod", v.prod],
77153
+ ["cand", v.cand]
77154
+ ]) {
77155
+ const o = s.horizontalOverflow;
77156
+ if (o) {
77157
+ console.log(chalk35.yellow(` ${name} overflows sideways by ${o.px}px${o.widest ? ` (\`${o.widest.selector}\`)` : ""}`));
77158
+ }
77159
+ }
76499
77160
  }
76500
77161
  for (const f of v.findings.slice(0, 5)) {
76501
- console.log(chalk34.dim(` [${f.type}] ${f.summary}`));
77162
+ console.log(chalk35.dim(` [${f.type}] ${f.summary}`));
76502
77163
  }
76503
77164
  if (v.heatmapPath && v.verdict === "differs") {
76504
- console.log(chalk34.dim(` ${v.heatmapPath}`));
77165
+ console.log(chalk35.dim(` ${v.heatmapPath}`));
76505
77166
  }
76506
77167
  const hosts = imageHostDelta(v.prod.imageHosts, v.cand.imageHosts);
76507
77168
  if (hosts.onlyProd.length > 0 || hosts.onlyCand.length > 0) {
76508
- console.log(chalk34.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
77169
+ console.log(chalk35.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
76509
77170
  }
76510
77171
  }
76511
77172
  console.log("");
76512
- console.log(` ${MARK[report.verdict]} ${chalk34.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
77173
+ console.log(` ${MARK[report.verdict]} ${chalk35.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
76513
77174
  console.log("");
76514
77175
  }
76515
77176
  function imageHostDelta(prod, cand) {
@@ -76529,8 +77190,193 @@ function formatHostDelta(d) {
76529
77190
  return parts.join(" · ");
76530
77191
  }
76531
77192
 
77193
+ // src/commands/overlay.ts
77194
+ import chalk36 from "chalk";
77195
+ var SUBPIXEL_TOLERANCE = 0.5;
77196
+ var MIN_GUTTER_PX = 2;
77197
+ function judgeOverlay(rest, open, closed) {
77198
+ if (rest.innerWidth - rest.layoutWidth < MIN_GUTTER_PX) {
77199
+ return {
77200
+ status: "inconclusive",
77201
+ reason: "no scrollbar at rest (overlay scrollbars or a page that does not scroll) — nothing for a scroll lock to remove; use --viewport desktop on a page that scrolls",
77202
+ shifts: []
77203
+ };
77204
+ }
77205
+ const shifts = [];
77206
+ for (const [phase, frame] of [
77207
+ ["open", open],
77208
+ ["closed", closed]
77209
+ ]) {
77210
+ if (!frame)
77211
+ continue;
77212
+ for (const metric of ["layoutWidth", "anchorX"]) {
77213
+ const from = rest[metric];
77214
+ const to = frame[metric];
77215
+ if (from === null || to === null)
77216
+ continue;
77217
+ if (Math.abs(to - from) > SUBPIXEL_TOLERANCE)
77218
+ shifts.push({ phase, metric, from, to });
77219
+ }
77220
+ }
77221
+ if (shifts.length > 0)
77222
+ return { status: "shift", shifts };
77223
+ if (!closed) {
77224
+ return {
77225
+ status: "inconclusive",
77226
+ reason: "overlay did not close (Escape ignored?) — pass --close <selector>",
77227
+ shifts
77228
+ };
77229
+ }
77230
+ return { status: "clean", shifts };
77231
+ }
77232
+ function openSignals(page, openSel) {
77233
+ return page.evaluate((sel) => {
77234
+ const visible = (el) => {
77235
+ const r = el.getBoundingClientRect();
77236
+ const s = getComputedStyle(el);
77237
+ return r.width > 0 && r.height > 0 && s.visibility !== "hidden" && s.display !== "none";
77238
+ };
77239
+ if (sel)
77240
+ return Array.from(document.querySelectorAll(sel)).filter(visible).length;
77241
+ const locked = (el) => /hidden|clip/.test(getComputedStyle(el).overflowY);
77242
+ return Array.from(document.querySelectorAll("dialog[open],[role='dialog'],[aria-modal='true']")).filter(visible).length + document.querySelectorAll(".drawer-toggle:checked,[aria-expanded='true']").length + (locked(document.documentElement) ? 1 : 0) + (locked(document.body) ? 1 : 0);
77243
+ }, openSel);
77244
+ }
77245
+ async function waitSignals(page, openSel, done, timeoutMs) {
77246
+ const until = Date.now() + timeoutMs;
77247
+ while (Date.now() < until) {
77248
+ if (done(await openSignals(page, openSel).catch(() => Number.NaN)))
77249
+ return true;
77250
+ await page.waitForTimeout(100);
77251
+ }
77252
+ return false;
77253
+ }
77254
+ function readFrame(page, anchor) {
77255
+ return page.evaluate((sel) => {
77256
+ const a = document.querySelector(sel);
77257
+ return {
77258
+ layoutWidth: document.documentElement.getBoundingClientRect().width,
77259
+ innerWidth: window.innerWidth,
77260
+ anchorX: a ? a.getBoundingClientRect().left : null
77261
+ };
77262
+ }, anchor);
77263
+ }
77264
+ var OPEN_TIMEOUT_MS = 3000;
77265
+ async function measureTrigger(page, url, trigger, opts) {
77266
+ const fail = (reason) => ({
77267
+ trigger,
77268
+ status: "inconclusive",
77269
+ reason,
77270
+ shifts: []
77271
+ });
77272
+ const res = await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 }).catch((err) => err);
77273
+ if (res instanceof Error)
77274
+ return fail(`${url} did not respond — ${res.message.split(`
77275
+ `)[0]}`);
77276
+ if (res && res.status() >= 400)
77277
+ return fail(`${url} responded HTTP ${res.status()}`);
77278
+ await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
77279
+ return;
77280
+ });
77281
+ await page.waitForTimeout(opts.waitMs);
77282
+ const target = page.locator(`${trigger} >> visible=true`).first();
77283
+ if (await target.count().catch(() => 0) === 0) {
77284
+ return fail("trigger matched no visible element");
77285
+ }
77286
+ const baseline = await openSignals(page, opts.open);
77287
+ const rest = await readFrame(page, opts.anchor);
77288
+ const clicked = await target.click({ timeout: 3000 }).then(() => true).catch(() => false);
77289
+ if (!clicked)
77290
+ return fail("trigger could not be clicked");
77291
+ if (!await waitSignals(page, opts.open, (n) => n > baseline, OPEN_TIMEOUT_MS)) {
77292
+ return fail(opts.open ? `--open ${opts.open} never became visible after the click` : "no overlay opened after the click (no dialog, drawer, aria-expanded or scroll lock appeared) — pass --open <selector>");
77293
+ }
77294
+ await page.waitForTimeout(opts.settleMs);
77295
+ const open = await readFrame(page, opts.anchor);
77296
+ if (opts.close) {
77297
+ await page.locator(`${opts.close} >> visible=true`).first().click({ timeout: 3000 }).catch(() => {
77298
+ return;
77299
+ });
77300
+ } else {
77301
+ await page.keyboard.press("Escape").catch(() => {
77302
+ return;
77303
+ });
77304
+ }
77305
+ const didClose = await waitSignals(page, opts.open, (n) => n <= baseline, OPEN_TIMEOUT_MS);
77306
+ await page.waitForTimeout(opts.settleMs);
77307
+ const closed = didClose ? await readFrame(page, opts.anchor) : null;
77308
+ return { trigger, rest, open, closed, ...judgeOverlay(rest, open, closed) };
77309
+ }
77310
+ async function overlayCommand(opts) {
77311
+ const viewport = parseViewport3(opts.viewport);
77312
+ if (!viewport) {
77313
+ console.error(chalk36.red(`invalid --viewport: ${opts.viewport}`));
77314
+ return 2;
77315
+ }
77316
+ const waitMs = Math.max(0, Number.parseInt(opts.wait, 10) || 0);
77317
+ const settleMs = Math.max(0, Number.parseInt(opts.settle, 10) || 0);
77318
+ const browser = await launchBrowser({ headless: true, showScrollbars: true });
77319
+ const pages = [];
77320
+ try {
77321
+ for (const url of opts.url) {
77322
+ const ctx = await newContext(browser, { viewport });
77323
+ const page = await ctx.newPage();
77324
+ const results = [];
77325
+ try {
77326
+ for (const trigger of opts.trigger) {
77327
+ results.push(await measureTrigger(page, url, trigger, {
77328
+ open: opts.open,
77329
+ close: opts.close,
77330
+ anchor: opts.anchor,
77331
+ waitMs,
77332
+ settleMs
77333
+ }));
77334
+ }
77335
+ } finally {
77336
+ await ctx.close().catch(() => {
77337
+ return;
77338
+ });
77339
+ }
77340
+ pages.push({ url, results });
77341
+ }
77342
+ } finally {
77343
+ await browser.close().catch(() => {
77344
+ return;
77345
+ });
77346
+ }
77347
+ const all = pages.flatMap((p) => p.results);
77348
+ const code = all.some((r) => r.status === "shift") ? 1 : all.some((r) => r.status === "inconclusive") ? 2 : 0;
77349
+ if (opts.json) {
77350
+ console.log(JSON.stringify({ viewport, anchor: opts.anchor, pages }));
77351
+ return code;
77352
+ }
77353
+ for (const { url, results } of pages) {
77354
+ console.log(chalk36.bold(`
77355
+ ${url}`));
77356
+ for (const r of results) {
77357
+ if (r.status === "clean") {
77358
+ const anchorNote = r.rest?.anchorX === null ? ` (anchor ${opts.anchor} not found — width only)` : "";
77359
+ console.log(` clean ${r.trigger}${anchorNote}`);
77360
+ } else if (r.status === "inconclusive") {
77361
+ console.log(chalk36.yellow(` INCONCLUSIVE ${r.trigger} — ${r.reason}`));
77362
+ } else {
77363
+ console.log(chalk36.red(` overlay-layout-shift ${r.trigger}`));
77364
+ for (const s of r.shifts) {
77365
+ console.log(chalk36.red(` ${s.phase.padEnd(6)} ${s.metric} ${s.from} → ${s.to} (${s.to - s.from > 0 ? "+" : ""}${Math.round((s.to - s.from) * 100) / 100}px)`));
77366
+ }
77367
+ if (r.closed === null)
77368
+ console.log(chalk36.dim(" (overlay did not close; close leg unmeasured)"));
77369
+ }
77370
+ }
77371
+ }
77372
+ if (code === 1) {
77373
+ console.log(chalk36.dim("\n The scroll lock removes the scrollbar and the page widens. Fix: `html { scrollbar-gutter: stable }` once in global CSS, or pad the lock by the scrollbar width."));
77374
+ }
77375
+ return code;
77376
+ }
77377
+
76532
77378
  // src/commands/states.ts
76533
- import chalk35 from "chalk";
77379
+ import chalk37 from "chalk";
76534
77380
  var HOVERABLE = "a,button,summary,[role='button'],[role='menuitem'],label";
76535
77381
  var SETTLE_RETRY_FACTOR = 4;
76536
77382
  async function readStateEffects(page, opts) {
@@ -76745,7 +77591,7 @@ function statesVerdict(counts) {
76745
77591
  async function statesCommand(opts) {
76746
77592
  const viewport = parseViewport3(opts.viewport);
76747
77593
  if (!viewport) {
76748
- console.error(chalk35.red(`--viewport inválido: ${opts.viewport}`));
77594
+ console.error(chalk37.red(`--viewport inválido: ${opts.viewport}`));
76749
77595
  return 2;
76750
77596
  }
76751
77597
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
@@ -76754,12 +77600,12 @@ async function statesCommand(opts) {
76754
77600
  const prodSelector = opts.prodSelector?.trim() || opts.selector?.trim();
76755
77601
  const candSelector = opts.candSelector?.trim() || opts.selector?.trim();
76756
77602
  if (!prodSelector || !candSelector) {
76757
- console.error(chalk35.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
77603
+ console.error(chalk37.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
76758
77604
  return 2;
76759
77605
  }
76760
77606
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
76761
77607
  if (aliasNote)
76762
- console.log(chalk35.dim(` ${aliasNote}`));
77608
+ console.log(chalk37.dim(` ${aliasNote}`));
76763
77609
  const browser = await launchBrowser({ headless: true });
76764
77610
  try {
76765
77611
  const [prodSide, candSide] = await Promise.all([
@@ -76782,7 +77628,7 @@ async function statesCommand(opts) {
76782
77628
  ]);
76783
77629
  if (prodSide.baseError || candSide.baseError) {
76784
77630
  const which = prodSide.baseError ? `prod: ${prodSide.baseError}` : `cand: ${candSide.baseError}`;
76785
- console.error(chalk35.red(` não foi possível ler o componente — ${which}`));
77631
+ console.error(chalk37.red(` não foi possível ler o componente — ${which}`));
76786
77632
  return 2;
76787
77633
  }
76788
77634
  const motion = prodSide.motion.found && candSide.motion.found ? diffMotion(prodSide.motion, candSide.motion, {
@@ -76819,58 +77665,58 @@ async function statesCommand(opts) {
76819
77665
  ]) {
76820
77666
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
76821
77667
  if (caveat)
76822
- console.log(chalk35.yellow(` ${caveat}`));
77668
+ console.log(chalk37.yellow(` ${caveat}`));
76823
77669
  }
76824
77670
  console.log("");
76825
- console.log(chalk35.bold(" Declared motion"));
77671
+ console.log(chalk37.bold(" Declared motion"));
76826
77672
  if (!motion) {
76827
77673
  const err = prodSide.motion.found ? candSide.motion : prodSide.motion;
76828
- console.log(chalk35.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
77674
+ console.log(chalk37.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
76829
77675
  } else {
76830
77676
  for (const line of formatMotionDiff(motion).split(`
76831
77677
  `))
76832
77678
  console.log(` ${line}`);
76833
77679
  }
76834
77680
  console.log("");
76835
- console.log(chalk35.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
77681
+ console.log(chalk37.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
76836
77682
  const nothing = effects.lost.length === 0 && effects.changed.length === 0 && effects.added.length === 0 && effects.unpaired.length === 0;
76837
77683
  if (nothing && !exercised) {
76838
- console.log(chalk35.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
77684
+ console.log(chalk37.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
76839
77685
  } else if (nothing) {
76840
77686
  console.log(" clean — every hover that changes something in prod changes the same in cand");
76841
77687
  }
76842
77688
  for (const e of effects.lost) {
76843
- console.log(chalk35.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
77689
+ console.log(chalk37.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
76844
77690
  }
76845
77691
  for (const { prod, extra, notComparable, onElement } of effects.changed) {
76846
77692
  console.log(` DIFFERS ${prod.target}${prod.label ? ` (${prod.label})` : ""}`);
76847
77693
  if (onElement.length) {
76848
- console.log(chalk35.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
77694
+ console.log(chalk37.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
76849
77695
  }
76850
77696
  if (extra.length)
76851
77697
  console.log(` cand also moves [${extra.join(", ")}]`);
76852
77698
  if (notComparable.length) {
76853
- console.log(chalk35.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.`));
77699
+ console.log(chalk37.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.`));
76854
77700
  }
76855
77701
  if (onElement.length === 0 && extra.length === 0) {
76856
- console.log(chalk35.dim(" nothing comparable differs."));
77702
+ console.log(chalk37.dim(" nothing comparable differs."));
76857
77703
  }
76858
77704
  }
76859
77705
  for (const e of effects.unpaired) {
76860
- console.log(chalk35.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)`));
77706
+ console.log(chalk37.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)`));
76861
77707
  }
76862
77708
  for (const e of effects.added) {
76863
77709
  console.log(` ADDED ${e.target} — cand moves [${e.properties.join(", ")}]; prod does not`);
76864
77710
  }
76865
77711
  if (effects.unpaired.length > 0 && effects.lost.length === 0 && effects.changed.length === 0) {
76866
77712
  console.log("");
76867
- console.log(chalk35.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.`));
77713
+ console.log(chalk37.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.`));
76868
77714
  }
76869
77715
  if (prodSide.ambient > 0 || candSide.ambient > 0) {
76870
- console.log(chalk35.dim(` ${prodSide.ambient} prod / ${candSide.ambient} 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.`));
77716
+ console.log(chalk37.dim(` ${prodSide.ambient} prod / ${candSide.ambient} 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.`));
76871
77717
  }
76872
77718
  if (prodSide.truncated || candSide.truncated) {
76873
- console.log(chalk35.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
77719
+ console.log(chalk37.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
76874
77720
  }
76875
77721
  return inconclusive || effects.lost.length > 0 || (motion?.findings.length ?? 0) > 0 ? 1 : 0;
76876
77722
  } finally {
@@ -76881,7 +77727,7 @@ async function statesCommand(opts) {
76881
77727
  }
76882
77728
 
76883
77729
  // src/commands/variance.ts
76884
- import chalk36 from "chalk";
77730
+ import chalk38 from "chalk";
76885
77731
 
76886
77732
  // src/diff/variance.ts
76887
77733
  var uniq2 = (xs) => [...new Set(xs)];
@@ -76985,7 +77831,7 @@ function formatVariance(report, opts = {}) {
76985
77831
  // src/commands/variance.ts
76986
77832
  function varianceCommand(opts) {
76987
77833
  if (opts.runIds.length < 2) {
76988
- console.error(chalk36.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
77834
+ console.error(chalk38.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
76989
77835
  return 2;
76990
77836
  }
76991
77837
  const budget = Number.parseFloat(opts.scoreBudget ?? "1");
@@ -76994,7 +77840,7 @@ function varianceCommand(opts) {
76994
77840
  try {
76995
77841
  runs.push(loadRun(opts.output, id));
76996
77842
  } catch (err) {
76997
- console.error(chalk36.red(` ✖ ${err.message}`));
77843
+ console.error(chalk38.red(` ✖ ${err.message}`));
76998
77844
  return 2;
76999
77845
  }
77000
77846
  }
@@ -77003,7 +77849,7 @@ function varianceCommand(opts) {
77003
77849
  console.log(JSON.stringify({ ...report, stable: isStable(report, budget), scoreBudget: budget }));
77004
77850
  } else {
77005
77851
  console.log("");
77006
- console.log(chalk36.bold(" Score variance"));
77852
+ console.log(chalk38.bold(" Score variance"));
77007
77853
  for (const line of formatVariance(report, { scoreBudget: budget }).split(`
77008
77854
  `)) {
77009
77855
  console.log(` ${line}`);
@@ -77015,10 +77861,10 @@ function varianceCommand(opts) {
77015
77861
  }
77016
77862
 
77017
77863
  // src/commands/vitals.ts
77018
- import { existsSync as existsSync33, readFileSync as readFileSync41, writeFileSync as writeFileSync35 } from "node:fs";
77864
+ import { existsSync as existsSync34, readFileSync as readFileSync42, writeFileSync as writeFileSync35 } from "node:fs";
77019
77865
  import { availableParallelism } from "node:os";
77020
77866
  import { join as join46 } from "node:path";
77021
- import chalk37 from "chalk";
77867
+ import chalk39 from "chalk";
77022
77868
  import ora9 from "ora";
77023
77869
 
77024
77870
  // src/checks/agentic-nav.ts
@@ -77316,10 +78162,10 @@ async function vitalsCommand(opts) {
77316
78162
  const runId = newRunId();
77317
78163
  const paths = createRunDir(opts.output, runId);
77318
78164
  const t0 = Date.now();
77319
- console.log(chalk37.bold(`
78165
+ console.log(chalk39.bold(`
77320
78166
  parity vitals ${runId}`));
77321
- console.log(chalk37.dim(` prod: ${opts.prod}`));
77322
- console.log(chalk37.dim(` cand: ${opts.cand}`));
78167
+ console.log(chalk39.dim(` prod: ${opts.prod}`));
78168
+ console.log(chalk39.dim(` cand: ${opts.cand}`));
77323
78169
  const discoverSpinner = ora9("Descobrindo páginas…").start();
77324
78170
  const pagePaths = await discoverPagePaths2(opts.prod, opts);
77325
78171
  if (pagePaths.length === 0) {
@@ -77351,7 +78197,7 @@ async function vitalsCommand(opts) {
77351
78197
  completed++;
77352
78198
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
77353
78199
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
77354
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
78200
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk39.cyan("prod") : chalk39.magenta("cand")} ${task.path} (${task.viewport})`;
77355
78201
  }
77356
78202
  });
77357
78203
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
@@ -77380,7 +78226,7 @@ async function vitalsCommand(opts) {
77380
78226
  }
77381
78227
  lhCompleted++;
77382
78228
  const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
77383
- lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
78229
+ lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk39.cyan("prod") : chalk39.magenta("cand")} ${task.path} (${task.viewport})`;
77384
78230
  });
77385
78231
  lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
77386
78232
  }
@@ -77456,10 +78302,10 @@ async function vitalsCommand(opts) {
77456
78302
  opportunities: aggregateOpportunities(checkCtx.candPages)
77457
78303
  }, null, 2)}
77458
78304
  `, "utf8");
77459
- printSummary8(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
78305
+ printSummary9(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
77460
78306
  console.log("");
77461
- console.log(chalk37.dim(` → ${paths.reportHtml}`));
77462
- console.log(chalk37.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
78307
+ console.log(chalk39.dim(` → ${paths.reportHtml}`));
78308
+ console.log(chalk39.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
77463
78309
  console.log("");
77464
78310
  if (opts.open) {
77465
78311
  const { default: open } = await import("open");
@@ -77549,15 +78395,15 @@ async function discoverPagePaths2(prodUrl, opts) {
77549
78395
  function parseUrlList(input) {
77550
78396
  if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
77551
78397
  const path = input.replace(/^file:\/\//, "");
77552
- if (existsSync33(path)) {
77553
- return readFileSync41(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
78398
+ if (existsSync34(path)) {
78399
+ return readFileSync42(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
77554
78400
  }
77555
78401
  }
77556
78402
  return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
77557
78403
  }
77558
- function printSummary8(vitals, cache, scores, opportunities, agentic) {
78404
+ function printSummary9(vitals, cache, scores, opportunities, agentic) {
77559
78405
  console.log("");
77560
- console.log(chalk37.bold(" Summary:"));
78406
+ console.log(chalk39.bold(" Summary:"));
77561
78407
  console.log(` ${vitals.summary}`);
77562
78408
  console.log(` ${cache.summary}`);
77563
78409
  if (scores.status !== "skipped")
@@ -77620,13 +78466,14 @@ program.command("list").description("List saved runs").option("--output <dir>",
77620
78466
  }).addCommand(new Command("modules").description("List the 8 selectable check modules (M3 module selection) with their descriptions, checks, and flows — see --only/--skip on `parity run`.").option("--json", "Emit structured JSON instead of human-readable text", false).action((opts) => {
77621
78467
  process.exit(listModulesCommand(Boolean(opts.json)));
77622
78468
  }));
77623
- program.command("plan").description("Inspect/update the migration-plan.json component contract").addCommand(new Command("set-status").description("Mark a component's outcome as the orchestrator works. `as-is` = divergence accepted (prod is still the reference); `upgrade` = the target is deliberately ahead, so prod is NOT the reference — pair it with `plan set-reference`.").argument("<name>", "Component name (case- and separator-insensitive)").argument("<status>", "pending | partial | done | as-is | upgrade | skipped").option("--create <scope>", "Create the row when the capture never found this component — `global` or `page`. A zero-height overlay header or a portal-rendered panel can be missed by detection, which leaves the plan unable to hold a decision about it. Recorded as origin `manual`, so it stays visible that somebody added it rather than the capture observing it.").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, status, opts) => {
78469
+ program.command("plan").description("Inspect/update the migration-plan.json component contract").addCommand(new Command("set-status").description("Mark a component's outcome as the orchestrator works. `as-is` = divergence accepted (prod is still the reference); `upgrade` = the target is deliberately ahead, so prod is NOT the reference — pair it with `plan set-reference`; `vanished` = was live at capture, gone from prod now — built and shipped disabled (requires --note).").argument("<name>", "Component name (case- and separator-insensitive)").argument("<status>", "pending | partial | done | as-is | upgrade | skipped | vanished").option("--note <text>", 'Why, stored as the row\'s reference note. Required for `vanished`: "<capture date>: <why it is gone from prod>".').option("--create <scope>", "Create the row when the capture never found this component — `global` or `page`. A zero-height overlay header or a portal-rendered panel can be missed by detection, which leaves the plan unable to hold a decision about it. Recorded as origin `manual`, so it stays visible that somebody added it rather than the capture observing it.").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, status, opts) => {
77624
78470
  if (opts.create && opts.create !== "global" && opts.create !== "page") {
77625
78471
  console.error("--create must be `global` or `page`");
77626
78472
  process.exit(2);
77627
78473
  }
77628
78474
  process.exit(planSetStatusCommand(opts.dir, name, status, {
77629
- create: opts.create
78475
+ create: opts.create,
78476
+ note: opts.note
77630
78477
  }));
77631
78478
  })).addCommand(new Command("set-page-status").description("Mark a page pending|code|done|skipped (code = route built, content missing)").argument("<path>", "Page path, e.g. / or /refrigeracion").argument("<status>", "pending | code | done | skipped").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((path, status, opts) => {
77632
78479
  process.exit(planSetPageStatusCommand(opts.dir, path, status));
@@ -77742,6 +78589,9 @@ function buildCacheProbeCommand(name, deprecated) {
77742
78589
  }
77743
78590
  cacheTopCommand.addCommand(buildCacheProbeCommand("probe", false));
77744
78591
  program.addCommand(buildCacheProbeCommand("cache-gap", true));
78592
+ program.command("loadtest").description("Constant-arrival-rate HTTP load (no browser) over sitemap paths, cycling device UAs so every cache segment is warmed; reports latency, status mix and hit rate per segment, device and path kind").requiredOption("--url <url>", "Base URL to load").option("--paths-from <source>", "Where paths come from when --paths is absent", "sitemap").option("--paths <list-or-file>", "Comma-separated paths or .txt file (1/line). Overrides the sitemap.").option("--limit <n>", "Cap the number of distinct paths (0 = all)", (v) => Number(v), 0).option("--rps <n>", `Requests per second, constant arrival (max ${MAX_RPS})`, (v) => Number(v), 10).option("--duration <s>", `Seconds of load (max ${MAX_DURATION_SEC})`, (v) => Number(v), 60).option("--devices <list>", "Device UAs to rotate: mobile,tablet,desktop", "mobile,desktop").option("--json", "Print the full result as JSON", false).action(async (opts) => {
78593
+ process.exit(await loadtestCommand(opts));
78594
+ });
77745
78595
  program.command("vitals").description("Crawls multiple pages (via sitemap.xml or --urls) and compares Web Vitals prod vs cand on each. HTML output with the top worst/best expanded.").requiredOption("--prod <url>", "Production URL (base)").requiredOption("--cand <url>", "Candidate URL (base)").option("--urls <list-or-file>", "Comma-separated paths or .txt file (1/line). Overrides sitemap discovery.").option("--limit <n>", "Max pages discovered from sitemap.xml", (v) => Number(v), 20).option("--viewports <list>", "mobile,desktop", "mobile").option("--concurrency <n>", "Parallel workers (1-8)", (v) => Number(v), 4).option("--runs <n>", "Repeat each page's vitals navigation N times and compare against the median (reduces run-to-run jitter false positives). Default 1 (no repeat). Issue #179.", (v) => Number(v), 1).option("--no-lighthouse", "Skip Lighthouse and use the fast warm Playwright collector (unthrottled — NOT comparable to PageSpeed). For fast iteration only. Default: Lighthouse (Slow 4G + 4× CPU) so numbers match PageSpeed. #264.").option("--lighthouse-concurrency <n>", "Parallel Lighthouse processes. Low by default (cores/2, capped 2) — Lighthouse measures CPU, so more parallelism inflates the numbers.", (v) => Number(v)).option("--output <dir>", "Output directory", "./parity-output").option("--open", "Open the HTML report when done", false).action(async (opts) => {
77746
78596
  process.exit(await vitalsCommand(opts));
77747
78597
  });
@@ -77759,7 +78609,7 @@ program.command("benchmark").description([
77759
78609
  "a HAR, measures Web Vitals with Lighthouse, and emits ONE self-contained HTML report",
77760
78610
  "(PT/EN toggle) you can share with a client."
77761
78611
  ].join(`
77762
- `)).requiredOption("--prod <url>", "Production URL (Fresh — the 'before')").requiredOption("--cand <url>", "Candidate URL (TanStack — the 'after')").option("--viewports <list>", "mobile,desktop (pick one or both)", "mobile,desktop").option("--warmup-runs <n>", "Journey passes to warm caches before measuring", "2").option("--measured-runs <n>", "Measured passes per side (median, kills variance)", "3").option("--paginations <n>", "How many times to scroll/paginate the PLP", "3").option("--plp <path>", "Pin the PLP path (skip auto-discovery), e.g. /roupas — useful to force a clothing category with real color variants").option("--journey <type>", "Journey shape: commerce (home→PLP→PDP→variant) | content (home→page A→page B, for blog/custom sites with no PLP/PDP). Auto-detected from the platform when omitted. Issue #251.").option("--cep <cep>", "CEP (kept for overlay/region dismissal parity)", "01310-100").option("--output <dir>", "Output directory for runs/<id>/", "./parity-output").option("--no-vitals", "Skip the Lighthouse web-vitals pass (faster iteration)").option("--no-auto-selectors", "Skip LLM-based selector discovery").option("--lang <pt|en>", "Default report language (toggle switches live)", "pt").option("--open", "Open the HTML report when done", false).option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Issue #67.").action(async (opts) => {
78612
+ `)).requiredOption("--prod <url>", "Production URL (Fresh — the 'before')").requiredOption("--cand <url>", "Candidate URL (TanStack — the 'after')").option("--viewports <list>", "mobile,desktop (pick one or both)", "mobile,desktop").option("--warmup-runs <n>", "Journey passes to warm caches before measuring", "2").option("--measured-runs <n>", "Measured passes per side (median, kills variance)", "3").option("--paginations <n>", "How many times to scroll/paginate the PLP", "3").option("--pagination-cap-ms <n>", "How long one scroll waits for new cards; slower loads are truncated to this (#274)", "5000").option("--plp <path>", "Pin the PLP path (skip auto-discovery), e.g. /roupas — useful to force a clothing category with real color variants").option("--journey <type>", "Journey shape: commerce (home→PLP→PDP→variant) | content (home→page A→page B, for blog/custom sites with no PLP/PDP). Auto-detected from the platform when omitted. Issue #251.").option("--cep <cep>", "CEP (kept for overlay/region dismissal parity)", "01310-100").option("--output <dir>", "Output directory for runs/<id>/", "./parity-output").option("--no-vitals", "Skip the Lighthouse web-vitals pass (faster iteration)").option("--no-auto-selectors", "Skip LLM-based selector discovery").option("--lang <pt|en>", "Default report language (toggle switches live)", "pt").option("--open", "Open the HTML report when done", false).option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Issue #67.").action(async (opts) => {
77763
78613
  if (opts.pt) {
77764
78614
  await Promise.resolve().then(() => init_client());
77765
78615
  setLlmLanguage("pt");
@@ -77950,6 +78800,19 @@ program.command("states").description("Compare a component's INTERACTIVE states,
77950
78800
  json: opts.json
77951
78801
  }));
77952
78802
  });
78803
+ program.command("overlay").description("Does opening an overlay move the page? For each trigger: read the <html> box width and a header anchor's x at rest, click the trigger, wait for the overlay, read again, close it (Escape or --close), read again. Any delta is an `overlay-layout-shift` — a scroll lock that removes the scrollbar without compensating. Exit 0 clean, 1 shift, 2 inconclusive (trigger matched nothing, overlay never opened/closed, or no scrollbar to remove).").requiredOption("--url <url...>", "Page(s) to check. Pass prod and cand together to measure both; each is judged on its own.").requiredOption("--trigger <sel...>", "Selector(s) of the element that opens each overlay").option("--open <sel>", "Selector visible while the overlay is open. Default: an increase in open dialogs, checked daisyUI drawer toggles, aria-expanded or a scroll lock on html/body.").option("--close <sel>", "Selector to click to close the overlay. Default: press Escape.").option("--anchor <sel>", "Header element whose x is tracked", "header a").option("--viewport <viewport>", "mobile | desktop | tablet (mobile has overlay scrollbars — nothing to measure)", "desktop").option("--wait <ms>", "Extra ms after networkidle so hydration settles", "2000").option("--settle <ms>", "Wait after open/close before reading, for transitions", "400").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
78804
+ process.exit(await overlayCommand({
78805
+ url: opts.url,
78806
+ trigger: opts.trigger,
78807
+ open: opts.open,
78808
+ close: opts.close,
78809
+ anchor: opts.anchor,
78810
+ viewport: opts.viewport,
78811
+ wait: opts.wait,
78812
+ settle: opts.settle,
78813
+ json: opts.json
78814
+ }));
78815
+ });
77953
78816
  program.command("fix").description("[deprecated: use `parity section --all`] Pixel-perfect debug shortcut: run `parity section` with ALL signals on (HTML + screenshot + computed-styles + box-tree + heatmap + CSS source) and emit an LLM-ready Markdown bundle. When ANTHROPIC_API_KEY is set, also prints a 1-paragraph summary of what Claude understood from the signals — does NOT generate a patch (you ask for that in a follow-up turn).").requiredOption("--prod <url>", "Production URL (source of truth)").requiredOption("--cand <url>", "Candidate URL (migrated)").requiredOption("--selector <sel>", "CSS selector for the section to fix").option("--cand-selector <sel>", "CSS selector on the CANDIDATE side, when the ported component no longer matches --selector. Defaults to --selector.").option("--viewport <viewport>", "mobile | desktop | tablet", "mobile").option("--wait <ms>", "Extra ms after networkidle so hydration settles", "2000").option("--out-dir <dir>", "Where to write the bundle + screenshots", "./parity-output/sections").option("--json", "Emit one-line JSON instead of pretty text", false).option("--no-llm", "Skip the LLM call (still writes the markdown bundle). Use when offline or to avoid API costs.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Issue #67.").action(async (opts) => {
77954
78817
  deprecatedNotice("fix", "section --all");
77955
78818
  if (opts.pt) {
@@ -77981,7 +78844,7 @@ program.command("extract").description("Single-site AI-ready component extractio
77981
78844
  }));
77982
78845
  });
77983
78846
  function buildCaptureCommand(name, deprecated) {
77984
- return new Command(name).description(`${deprecated ? "[deprecated: use `parity capture`] " : ""}Single-site, phased migration capture (theme → sitemap → components). No prod×cand comparison — produces a target-agnostic, token-lean bundle + prompt for a migration agent: site theme (colors/typography/spacing as Tailwind tokens), classified pages, and per-component detail (suggested Tailwind classes, interaction hints, e2e selectors). Works whether or not the source code exists. Pass --target faststore to append a target playbook. Resumable: re-runs skip a completed phase unless --refresh.`).requiredOption("--url <url>", "Site to capture from").option("--pages <list>", 'Comma-separated pages: literal paths/URLs, and/or "category-auto"/"pdp-auto". Default: "/,category-auto,pdp-auto" (home + a PLP + a PDP).').option("--components <list>", "Comma-separated role allowlist, e.g. header,footer,nav,shelf,minicart. Default: all detected.").option("--target <name>", "Target playbook to append to the prompt (e.g. faststore)").option("--viewport <viewport>", "Primary viewport for component capture: mobile | desktop | tablet", "mobile").option("--viewports <list>", "Comma-separated viewports for theme + site screenshots (e.g. mobile,desktop). Default: --viewport only.").option("--sample <spec>", "Extra pages to sample from the sitemap by kind, e.g. 'plp=2,pdp=2,other=3,search=1' (other = institutional). Default samples a few of each incl. institutional pages.").option("--format <fmt>", "md | json | both", "both").option("--source <dir>", "Path to the source repo. When set, the component inventory is read from CODE (exhaustive, exact names) and the VTEX-IO runtime scrape is gated on the source actually being VTEX IO. Without it, everything comes from the live capture (original behaviour).").option("--source-kind <kind>", "Override source auto-detection: deco-fresh | vtex-io | live-only. Only needed when detection fails.").option("--no-source-hunt", "Skip the on-disk search for a source repo when --source is omitted. Without --source the command sweeps sibling directories for one.").option("--out <dir>", "Output directory (stable per host, for resume)", "./parity-migrate").option("--refresh", "Re-run all phases even if cached artifacts exist", false).option("--open", "Open the generated index.html visual report in the browser", false).option("--no-llm", "Skip the optional LLM component-relabeling pass (heuristic detection always runs regardless).").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
78847
+ return new Command(name).description(`${deprecated ? "[deprecated: use `parity capture`] " : ""}Single-site, phased migration capture (theme → sitemap → components). No prod×cand comparison — produces a target-agnostic, token-lean bundle + prompt for a migration agent: site theme (colors/typography/spacing as Tailwind tokens), classified pages, and per-component detail (suggested Tailwind classes, interaction hints, e2e selectors). Works whether or not the source code exists. Pass --target faststore to append a target playbook. Resumable: re-runs skip a completed phase unless --refresh.`).requiredOption("--url <url>", "Site to capture from").option("--pages <list>", 'Comma-separated pages: literal paths/URLs, and/or "category-auto"/"pdp-auto". Default: "/,category-auto,pdp-auto" (home + a PLP + a PDP).').option("--components <list>", "Comma-separated role allowlist, e.g. header,footer,nav,shelf,minicart. Default: all detected.").option("--target <name>", "Target playbook to append to the prompt (e.g. faststore)").option("--viewport <viewport>", "Primary viewport for component capture: mobile | desktop | tablet", "mobile").option("--viewports <list>", "Comma-separated viewports for theme + site screenshots (e.g. mobile,desktop). Default: --viewport only.").option("--component-viewports", "Also capture every component at the non-primary --viewports. Keeps a per-viewport HTML only when it differs from the primary (normalised) and a screenshot only when its bytes differ. Costs one extra page load per viewport per page.", false).option("--sample <spec>", "Extra pages to sample from the sitemap by kind, e.g. 'plp=2,pdp=2,other=3,search=1' (other = institutional). Default samples a few of each incl. institutional pages.").option("--format <fmt>", "md | json | both", "both").option("--source <dir>", "Path to the source repo. When set, the component inventory is read from CODE (exhaustive, exact names) and the VTEX-IO runtime scrape is gated on the source actually being VTEX IO. Without it, everything comes from the live capture (original behaviour).").option("--source-kind <kind>", "Override source auto-detection: deco-fresh | vtex-io | live-only. Only needed when detection fails.").option("--no-source-hunt", "Skip the on-disk search for a source repo when --source is omitted. Without --source the command sweeps sibling directories for one.").option("--out <dir>", "Output directory (stable per host, for resume)", "./parity-migrate").option("--refresh", "Re-run all phases even if cached artifacts exist", false).option("--open", "Open the generated index.html visual report in the browser", false).option("--no-llm", "Skip the optional LLM component-relabeling pass (heuristic detection always runs regardless).").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
77985
78848
  if (deprecated)
77986
78849
  deprecatedNotice("migrate", "capture");
77987
78850
  process.exit(await migrateCommand({
@@ -77994,6 +78857,7 @@ function buildCaptureCommand(name, deprecated) {
77994
78857
  noSourceHunt: !opts.sourceHunt,
77995
78858
  viewport: opts.viewport,
77996
78859
  viewports: opts.viewports,
78860
+ componentViewports: opts.componentViewports,
77997
78861
  sample: opts.sample,
77998
78862
  format: opts.format,
77999
78863
  outDir: opts.out,