@decocms/parity 0.33.58 → 0.33.60

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 +1391 -538
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -39022,6 +39022,21 @@ var DISABLE_ANIMATIONS_CSS = `
39022
39022
  scroll-behavior: auto !important;
39023
39023
  }
39024
39024
  `;
39025
+ function injectStyleScript(css) {
39026
+ return `
39027
+ (function () {
39028
+ var apply = function () {
39029
+ var style = document.createElement('style');
39030
+ style.textContent = ${JSON.stringify(css)};
39031
+ document.documentElement.appendChild(style);
39032
+ };
39033
+ if (document.documentElement) return apply();
39034
+ new MutationObserver(function (_, o) {
39035
+ if (document.documentElement) { o.disconnect(); apply(); }
39036
+ }).observe(document, { childList: true });
39037
+ })();
39038
+ `;
39039
+ }
39025
39040
  var USER_AGENT_BY_VIEWPORT = {
39026
39041
  mobile: "Mozilla/5.0 (Linux; Android 14; Pixel 7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Mobile Safari/537.36",
39027
39042
  tablet: "Mozilla/5.0 (iPad; CPU OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
@@ -39057,6 +39072,7 @@ async function launchBrowser(opts = {}) {
39057
39072
  headless: opts.headless ?? true,
39058
39073
  slowMo: opts.slowMo ?? 0,
39059
39074
  timeout: 30000,
39075
+ ignoreDefaultArgs: opts.showScrollbars ? ["--hide-scrollbars"] : undefined,
39060
39076
  args: [
39061
39077
  "--disable-blink-features=AutomationControlled",
39062
39078
  "--no-sandbox",
@@ -39167,30 +39183,11 @@ async function newContext(browser, opts) {
39167
39183
  return page;
39168
39184
  };
39169
39185
  }
39170
- await ctx.addInitScript({
39171
- content: `
39172
- try {
39173
- const style = document.createElement('style');
39174
- style.textContent = ${JSON.stringify(DISABLE_ANIMATIONS_CSS)};
39175
- (document.head || document.documentElement).appendChild(style);
39176
- } catch (e) {}
39177
- `
39178
- });
39186
+ if (!opts.keepMotion)
39187
+ await ctx.addInitScript({ content: injectStyleScript(DISABLE_ANIMATIONS_CSS) });
39179
39188
  if (opts.hideScrollbars) {
39180
39189
  await ctx.addInitScript({
39181
- content: `
39182
- (function () {
39183
- var apply = function () {
39184
- var style = document.createElement('style');
39185
- style.textContent = 'html, body, * { scrollbar-width: none !important; } ::-webkit-scrollbar { display: none !important; }';
39186
- document.documentElement.appendChild(style);
39187
- };
39188
- if (document.documentElement) return apply();
39189
- new MutationObserver(function (_, o) {
39190
- if (document.documentElement) { o.disconnect(); apply(); }
39191
- }).observe(document, { childList: true });
39192
- })();
39193
- `
39190
+ content: injectStyleScript("html, body, * { scrollbar-width: none !important; } ::-webkit-scrollbar { display: none !important; }")
39194
39191
  });
39195
39192
  }
39196
39193
  await ctx.addInitScript({ content: CAROUSEL_STABILIZER_INIT_SCRIPT });
@@ -39221,6 +39218,29 @@ var ACCEPT_SELECTORS = [
39221
39218
  'button[id*="accept" i][id*="cookie" i]'
39222
39219
  ];
39223
39220
  var LOOSE_ACCEPT_SELECTOR = 'button:has-text("Aceitar")';
39221
+ function clickConsentButtonByText() {
39222
+ const LABEL = /^(continuar e fechar|aceitar e fechar|continuar|fechar|entendi|ok)$/i;
39223
+ const CONSENT = /cookie/i;
39224
+ const MAX_DEPTH = 4;
39225
+ const MAX_BANNER_TEXT = 1500;
39226
+ for (const b of Array.from(document.querySelectorAll("button, [role='button']"))) {
39227
+ if (!LABEL.test((b.textContent ?? "").replace(/\s+/g, " ").trim()))
39228
+ continue;
39229
+ if (b.checkVisibility && !b.checkVisibility())
39230
+ continue;
39231
+ let el = b.parentElement;
39232
+ for (let d = 0;el && d < MAX_DEPTH; d++, el = el.parentElement) {
39233
+ const text = el.textContent ?? "";
39234
+ if (text.length > MAX_BANNER_TEXT)
39235
+ break;
39236
+ if (CONSENT.test(text)) {
39237
+ b.click();
39238
+ return true;
39239
+ }
39240
+ }
39241
+ }
39242
+ return false;
39243
+ }
39224
39244
  async function acceptCookieBanner(page, opts = {}) {
39225
39245
  const selectors = opts.loose ? [...ACCEPT_SELECTORS, LOOSE_ACCEPT_SELECTOR] : ACCEPT_SELECTORS;
39226
39246
  for (const sel of selectors) {
@@ -39235,6 +39255,12 @@ async function acceptCookieBanner(page, opts = {}) {
39235
39255
  return true;
39236
39256
  }
39237
39257
  }
39258
+ if (await page.evaluate(clickConsentButtonByText).catch(() => false)) {
39259
+ await page.waitForTimeout(300).catch(() => {
39260
+ return;
39261
+ });
39262
+ return true;
39263
+ }
39238
39264
  return false;
39239
39265
  }
39240
39266
 
@@ -44576,6 +44602,14 @@ async function dismissOverlays(page, ctx) {
44576
44602
  const sels = overlaySelectorsFor(ctx.rc);
44577
44603
  dlog2(ctx, ` dismissOverlays: checking ${sels.length} selector(s)…`);
44578
44604
  const dismissals = [];
44605
+ if (await acceptCookieBanner(page).catch(() => false)) {
44606
+ dismissals.push({
44607
+ reason: "selector-match",
44608
+ tag: "cookie-consent",
44609
+ method: "close-button",
44610
+ dismissed: true
44611
+ });
44612
+ }
44579
44613
  for (const sel of sels) {
44580
44614
  try {
44581
44615
  const overlay = page.locator(sel).first();
@@ -46648,21 +46682,47 @@ async function navigateWithHover(page, targetUrl, productImage = false) {
46648
46682
  const targetPath = new URL(targetUrl).pathname;
46649
46683
  const sel = `a[href="${cssAttrEscape(targetUrl)}"], a[href="${cssAttrEscape(targetPath)}"], a[href^="${cssAttrEscape(`${targetPath}?`)}"]`;
46650
46684
  const anchor = page.locator(sel).first();
46685
+ const docStart = await page.evaluate(() => performance.timeOrigin).catch(() => {
46686
+ return;
46687
+ });
46651
46688
  const visible = await anchor.isVisible({ timeout: 1500 }).catch(() => false);
46652
46689
  let t;
46690
+ let viaFallback = false;
46691
+ let prefetched;
46653
46692
  if (visible) {
46654
46693
  await anchor.hover({ timeout: 1500 }).catch(() => {
46655
46694
  return;
46656
46695
  });
46657
46696
  await page.waitForTimeout(500);
46697
+ const mobile = (page.viewportSize()?.width ?? 1440) < 768;
46698
+ const box = mobile ? await anchor.boundingBox().catch(() => null) : null;
46699
+ if (box) {
46700
+ await page.mouse.move(box.x + box.width / 2, box.y + box.height / 2);
46701
+ await page.mouse.down();
46702
+ await page.waitForTimeout(500);
46703
+ }
46704
+ const clickAt = Date.now();
46705
+ const tracker = speculationTrackers.get(page.context());
46706
+ if (tracker)
46707
+ await withCap(Promise.all([...tracker.pending]), 2000, []);
46708
+ prefetched = prefetchVerdict(tracker, targetUrl, docStart, clickAt);
46658
46709
  t = Date.now();
46659
46710
  await Promise.allSettled([
46660
- page.waitForURL((u) => u.toString().includes(targetPath), { timeout: NAV_CAP_MS }).catch(() => {
46711
+ page.waitForURL((u) => u.toString().includes(targetPath), { timeout: 6000 }).catch(() => {
46661
46712
  return;
46662
46713
  }),
46663
- anchor.click({ timeout: 3000 })
46714
+ box ? page.mouse.up() : anchor.click({ timeout: 3000 })
46664
46715
  ]);
46716
+ if (!page.url().includes(targetPath)) {
46717
+ viaFallback = true;
46718
+ prefetched = undefined;
46719
+ t = Date.now();
46720
+ await page.goto(targetUrl, { waitUntil: "domcontentloaded", timeout: NAV_CAP_MS }).catch(() => {
46721
+ return;
46722
+ });
46723
+ }
46665
46724
  } else {
46725
+ viaFallback = true;
46666
46726
  t = Date.now();
46667
46727
  await page.goto(targetUrl, { waitUntil: "domcontentloaded", timeout: NAV_CAP_MS }).catch(() => {
46668
46728
  return;
@@ -46676,7 +46736,62 @@ async function navigateWithHover(page, targetUrl, productImage = false) {
46676
46736
  ok = await waitReady(page);
46677
46737
  }
46678
46738
  const navMs = Date.now() - t;
46679
- return { ok, navMs };
46739
+ const landed = page.url().includes(targetPath);
46740
+ return {
46741
+ ok: ok && landed,
46742
+ navMs,
46743
+ landed,
46744
+ viaFallback,
46745
+ ...prefetched !== undefined ? { prefetched } : {}
46746
+ };
46747
+ }
46748
+ function labelGotoFallback(note, viaFallback) {
46749
+ if (!viaFallback)
46750
+ return note;
46751
+ const label = "medido via goto (link não visível ou não navegou no clique), sem hover/prefetch";
46752
+ return note ? `${note} — ${label}` : label;
46753
+ }
46754
+ var speculationTrackers = new WeakMap;
46755
+ function trackSpeculativeRequests(ctx) {
46756
+ const tracker = { since: Date.now(), hits: [], pending: new Set };
46757
+ speculationTrackers.set(ctx, tracker);
46758
+ ctx.on("request", (r) => {
46759
+ const at = Date.now();
46760
+ const p = r.allHeaders().then((headers) => {
46761
+ if (sawSpeculativePrefetch([{ url: r.url(), headers }], r.url()))
46762
+ tracker.hits.push({ url: r.url(), headers, at });
46763
+ }).catch(() => {
46764
+ return;
46765
+ }).finally(() => tracker.pending.delete(p));
46766
+ tracker.pending.add(p);
46767
+ });
46768
+ }
46769
+ function prefetchVerdict(tracker, targetUrl, docStart, clickAt) {
46770
+ if (!tracker || docStart === undefined || !Number.isFinite(docStart))
46771
+ return "unknown";
46772
+ if (tracker.since > docStart)
46773
+ return "unknown";
46774
+ const inWindow = tracker.hits.filter((h) => h.at >= docStart - 250 && h.at <= clickAt);
46775
+ return sawSpeculativePrefetch(inWindow, targetUrl);
46776
+ }
46777
+ function sawSpeculativePrefetch(requests, targetUrl) {
46778
+ let target;
46779
+ try {
46780
+ target = new URL(targetUrl);
46781
+ } catch {
46782
+ return false;
46783
+ }
46784
+ return requests.some((r) => {
46785
+ const purpose = Object.entries(r.headers).find(([k]) => k.toLowerCase() === "sec-purpose")?.[1];
46786
+ if (!purpose?.toLowerCase().includes("prefetch"))
46787
+ return false;
46788
+ try {
46789
+ const u = new URL(r.url);
46790
+ return u.host === target.host && u.pathname === target.pathname;
46791
+ } catch {
46792
+ return false;
46793
+ }
46794
+ });
46680
46795
  }
46681
46796
  var HAMBURGER_SELECTORS = [
46682
46797
  'button[aria-label*="menu" i]',
@@ -46856,7 +46971,13 @@ async function clickShelfProduct(page, ctx) {
46856
46971
  return "";
46857
46972
  }
46858
46973
  })();
46859
- return now !== curPath ? { url: page.url(), imgOk: nav.ok, navMs: nav.navMs } : null;
46974
+ return now !== curPath ? {
46975
+ url: page.url(),
46976
+ imgOk: nav.ok,
46977
+ navMs: nav.navMs,
46978
+ viaFallback: nav.viaFallback,
46979
+ prefetched: nav.prefetched
46980
+ } : null;
46860
46981
  }
46861
46982
  async function onePass(page, ctx, targets, paginations, measure) {
46862
46983
  const shot = async (label, fullPage) => {
@@ -46961,7 +47082,8 @@ async function onePass(page, ctx, targets, paginations, measure) {
46961
47082
  ms: pdpNav.navMs,
46962
47083
  url: page.url(),
46963
47084
  ok: pdpOk,
46964
- note: pdpOk ? undefined : pdpBroken ? "página não encontrada / erro" : !reachedPdp() ? "produto não encontrado (após retry)" : "imagem do produto não carregou"
47085
+ ...pdpNav.prefetched !== undefined ? { prefetched: pdpNav.prefetched } : {},
47086
+ 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)
46965
47087
  };
46966
47088
  await scrollPageInChunks(page).catch(() => {
46967
47089
  return;
@@ -47019,7 +47141,8 @@ async function onePass(page, ctx, targets, paginations, measure) {
47019
47141
  ms: shelfHit?.navMs ?? 0,
47020
47142
  url: page.url(),
47021
47143
  ok: shelfOk,
47022
- 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)"
47144
+ ...shelfHit?.prefetched !== undefined ? { prefetched: shelfHit.prefetched } : {},
47145
+ 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)
47023
47146
  };
47024
47147
  await scrollPageInChunks(page).catch(() => {
47025
47148
  return;
@@ -47441,6 +47564,7 @@ async function runSideBenchmark(opts) {
47441
47564
  deviceScaleFactor: 1,
47442
47565
  cohortCookieValue: "control"
47443
47566
  });
47567
+ trackSpeculativeRequests(ctx);
47444
47568
  try {
47445
47569
  const page = await ctx.newPage();
47446
47570
  const flowCtx = flowCtxFor(ctx);
@@ -47521,12 +47645,16 @@ async function runSideBenchmark(opts) {
47521
47645
  };
47522
47646
  }
47523
47647
  function aggregatePhase(step, samples) {
47648
+ const pf = samples.filter((s) => s.prefetched !== undefined);
47524
47649
  return {
47525
47650
  step,
47526
47651
  ms: median(samples.map((s) => s.ms)),
47527
47652
  url: samples[0]?.url,
47528
47653
  ok: samples.length > 0 && samples.every((s) => s.ok),
47529
- note: (samples.find((s) => !s.ok) ?? samples.find((s) => s.note))?.note
47654
+ note: (samples.find((s) => !s.ok) ?? samples.find((s) => s.note))?.note,
47655
+ ...pf.length > 0 ? {
47656
+ prefetched: pf.every((s) => s.prefetched === true) ? true : pf.some((s) => s.prefetched === "unknown") ? "unknown" : false
47657
+ } : {}
47530
47658
  };
47531
47659
  }
47532
47660
  function aggregatePaginationTotal(measured) {
@@ -47615,7 +47743,7 @@ async function resolveContentPaths(opts) {
47615
47743
  };
47616
47744
  await dismissAll(page, flow);
47617
47745
  const brand = await captureBrand(page);
47618
- 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(() => []);
47746
+ 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(() => []);
47619
47747
  const candidates = filterContentPaths(hrefs, opts.prodBase);
47620
47748
  const ok = [];
47621
47749
  for (const path of candidates) {
@@ -47639,6 +47767,38 @@ async function resolveContentPaths(opts) {
47639
47767
  });
47640
47768
  }
47641
47769
  }
47770
+ async function revealLink(page, base, path) {
47771
+ const sel = `a[href="${cssAttrEscape(path)}"], a[href^="${cssAttrEscape(`${path}?`)}"]`;
47772
+ const isVis = () => page.locator(sel).first().isVisible({ timeout: 400 }).catch(() => false);
47773
+ if (await isVis())
47774
+ return true;
47775
+ await openMenu(page).catch(() => {
47776
+ return;
47777
+ });
47778
+ if (await isVis())
47779
+ return true;
47780
+ const triggers = page.locator("header [aria-haspopup], header .dropdown > a, header .dropdown > button, header li:has(> ul) > a, header li:has(> ul) > button");
47781
+ const n = Math.min(await triggers.count().catch(() => 0), 12);
47782
+ for (let i = 0;i < n; i++) {
47783
+ const before = page.url();
47784
+ await triggers.nth(i).click({ timeout: 1500 }).catch(() => {
47785
+ return;
47786
+ });
47787
+ await page.waitForTimeout(300);
47788
+ if (page.url() !== before && !page.url().includes(path)) {
47789
+ await page.goto(base, { waitUntil: "domcontentloaded", timeout: 15000 }).catch(() => {
47790
+ return;
47791
+ });
47792
+ await waitReady(page).catch(() => {
47793
+ return;
47794
+ });
47795
+ continue;
47796
+ }
47797
+ if (await isVis())
47798
+ return true;
47799
+ }
47800
+ return false;
47801
+ }
47642
47802
  async function onePassContent(page, ctx, paths, measure) {
47643
47803
  const shot = async (label, fullPage) => {
47644
47804
  if (!measure)
@@ -47666,27 +47826,24 @@ async function onePassContent(page, ctx, paths, measure) {
47666
47826
  });
47667
47827
  const homeShot = await shot("home", true);
47668
47828
  await scrollToTop(page);
47669
- const urlA = new URL(paths.pageA, ctx.baseUrl).toString();
47670
- const a = await navigateWithHover(page, urlA, false);
47671
- const nav1Broken = await pageLooksBroken(page);
47672
- const nav1 = {
47673
- step: "nav-to-page-1",
47674
- ms: a.navMs,
47675
- url: page.url(),
47676
- ok: a.ok && !nav1Broken,
47677
- note: !a.ok ? `atingiu o cap de espera sem sinal de prontidão (${paths.pageA})` : nav1Broken ? "página não encontrada / erro" : paths.pageA
47829
+ const hop = async (step, path) => {
47830
+ await revealLink(page, ctx.baseUrl, path).catch(() => {
47831
+ return;
47832
+ });
47833
+ const nav = await navigateWithHover(page, new URL(path, ctx.baseUrl).toString(), false);
47834
+ const broken = await pageLooksBroken(page);
47835
+ return {
47836
+ step,
47837
+ ms: nav.navMs,
47838
+ url: page.url(),
47839
+ ok: nav.ok && !broken,
47840
+ ...nav.prefetched !== undefined ? { prefetched: nav.prefetched } : {},
47841
+ 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)
47842
+ };
47678
47843
  };
47844
+ const nav1 = await hop("nav-to-page-1", paths.pageA);
47679
47845
  const shotA = await shot("page1", true);
47680
- const urlB = new URL(paths.pageB, ctx.baseUrl).toString();
47681
- const b = await navigateWithHover(page, urlB, false);
47682
- const nav2Broken = await pageLooksBroken(page);
47683
- const nav2 = {
47684
- step: "nav-to-page-2",
47685
- ms: b.navMs,
47686
- url: page.url(),
47687
- ok: b.ok && !nav2Broken,
47688
- note: !b.ok ? `atingiu o cap de espera sem sinal de prontidão (${paths.pageB})` : nav2Broken ? "página não encontrada / erro" : paths.pageB
47689
- };
47846
+ const nav2 = await hop("nav-to-page-2", paths.pageB);
47690
47847
  const shotB = await shot("page2", true);
47691
47848
  return { home, nav1, nav2, screenshots: { home: homeShot, plp: shotA, pdp: shotB } };
47692
47849
  }
@@ -47710,6 +47867,7 @@ async function runSideBenchmarkContent(opts) {
47710
47867
  deviceScaleFactor: 1,
47711
47868
  cohortCookieValue: "control"
47712
47869
  });
47870
+ trackSpeculativeRequests(ctx);
47713
47871
  const flowCtx = {
47714
47872
  baseUrl: opts.base,
47715
47873
  side: opts.side,
@@ -48539,6 +48697,11 @@ function renderStep(step, prod, cand, lang) {
48539
48697
  const delta = failed ? `<div class="step-delta"><strong style="color:${DECK.bad}">⚠ ${L("erro", "error", lang)}</strong>
48540
48698
  <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>
48541
48699
  <span class="step-delta-sub">${L("vs. Fresh", "vs. Fresh", lang)}</span></div>`;
48700
+ const coldSides = [
48701
+ prodStep?.prefetched === false ? "Fresh" : "",
48702
+ candStep?.prefetched === false ? "TanStack" : ""
48703
+ ].filter(Boolean).join(" + ");
48704
+ 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>` : "";
48542
48705
  return `
48543
48706
  <section class="step${failed ? " step-failed" : ""}">
48544
48707
  <div class="step-head">
@@ -48551,6 +48714,7 @@ function renderStep(step, prod, cand, lang) {
48551
48714
  ${subSteps}
48552
48715
  </div>
48553
48716
  ${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>` : ""}
48717
+ ${coldNote}
48554
48718
  <div class="step-shots">
48555
48719
  ${figure(shotKey ? prod.screenshots[shotKey] : undefined, "Fresh", prodFailed ? DECK.bad : DECK.faint, prodStep?.url, scroll)}
48556
48720
  ${figure(shotKey ? cand.screenshots[shotKey] : undefined, "TanStack", candFailed ? DECK.bad : DECK.soft, candStep?.url, scroll)}
@@ -49138,7 +49302,8 @@ function printSummary2(report) {
49138
49302
  for (const cs of cand.steps) {
49139
49303
  const ps = prod.steps.find((s) => s.step === cs.step);
49140
49304
  const flag = ps?.ok === false || cs.ok === false ? chalk5.red(` ✗ ERRO: ${cs.ok === false ? "cand" : "prod"} ${cs.note ?? ""}`) : "";
49141
- console.log(` ${cs.step.padEnd(16)} prod ${fmt(ps?.ms ?? 0).padStart(8)} cand ${fmt(cs.ms).padStart(8)}${flag}`);
49305
+ const cold = [ps?.prefetched === false ? "prod" : "", cs.prefetched === false ? "cand" : ""].filter(Boolean).join("+");
49306
+ console.log(` ${cs.step.padEnd(16)} prod ${fmt(ps?.ms ?? 0).padStart(8)} cand ${fmt(cs.ms).padStart(8)}${flag}${cold ? chalk5.dim(` sem prefetch: ${cold}`) : ""}`);
49142
49307
  }
49143
49308
  }
49144
49309
  const failed = report.sides.flatMap((s) => s.steps.filter((st) => st.ok === false).map((st) => `${s.side}/${st.step}`));
@@ -61901,6 +62066,7 @@ async function captureSectionArtifacts(page, opts) {
61901
62066
  const matches = $(opts.selector);
61902
62067
  if (matches.length === 0) {
61903
62068
  result.htmlError = `seletor '${opts.selector}' não casou nenhum elemento`;
62069
+ result.htmlNoMatch = true;
61904
62070
  } else {
61905
62071
  result.html = $.html(matches.first());
61906
62072
  }
@@ -62401,6 +62567,26 @@ function compactComponentHtml(html, maxChars = COMPONENT_HTML_MAX_CHARS) {
62401
62567
  truncated
62402
62568
  };
62403
62569
  }
62570
+ function viewportDeltas(primary, others) {
62571
+ const primaryHtml = normalizeForCompare(primary.html);
62572
+ const out = [];
62573
+ for (const o of others) {
62574
+ if (o.status === "absent") {
62575
+ out.push({ viewport: o.viewport, absent: true, keepScreenshot: false });
62576
+ continue;
62577
+ }
62578
+ if (o.status === "failed") {
62579
+ out.push({ viewport: o.viewport, failed: o.reason, keepScreenshot: false });
62580
+ continue;
62581
+ }
62582
+ const htmlDiffers = normalizeForCompare(o.html) !== primaryHtml;
62583
+ const keepScreenshot = o.screenshot !== null && !primary.screenshot?.equals(o.screenshot);
62584
+ if (!htmlDiffers && !keepScreenshot)
62585
+ continue;
62586
+ out.push({ viewport: o.viewport, ...htmlDiffers ? { html: o.html } : {}, keepScreenshot });
62587
+ }
62588
+ return out;
62589
+ }
62404
62590
 
62405
62591
  // src/commands/section.ts
62406
62592
  import { mkdirSync as mkdirSync12 } from "node:fs";
@@ -62882,7 +63068,7 @@ function mergePlanDecisions(fresh, previous) {
62882
63068
  return { plan: fresh, carried, keptUncaptured, droppedWithDecisions: [] };
62883
63069
  }
62884
63070
  var PLAN_FILE = "migration-plan.json";
62885
- var SETTLED = new Set(["done", "as-is", "upgrade", "skipped"]);
63071
+ var SETTLED = new Set(["done", "as-is", "upgrade", "skipped", "vanished"]);
62886
63072
  function loadPlan(dir) {
62887
63073
  const p = join22(dir, PLAN_FILE);
62888
63074
  if (!existsSync13(p))
@@ -62896,9 +63082,26 @@ function savePlan(dir, plan) {
62896
63082
  function setComponentStatus(plan, name, status, opts = {}) {
62897
63083
  const k = key(name);
62898
63084
  const component = plan.components.find((c) => key(c.name) === k);
63085
+ if (!component && !opts.create)
63086
+ return null;
63087
+ const given = opts.note?.trim() ?? "";
63088
+ if (status === "vanished" && !given && !component?.reference?.note?.trim()) {
63089
+ throw new Error('`vanished` needs a note — "<capture date>: <why it is gone from prod>". Without it the row reads as a forgotten gap.');
63090
+ }
63091
+ const withNote = (c) => {
63092
+ if (given) {
63093
+ c.reference = {
63094
+ url: c.reference?.url ?? "",
63095
+ selector: c.reference?.selector ?? null,
63096
+ note: given,
63097
+ ...c.reference?.design ? { design: c.reference.design } : {}
63098
+ };
63099
+ }
63100
+ return c;
63101
+ };
62899
63102
  if (component) {
62900
63103
  component.status = status;
62901
- return component;
63104
+ return withNote(component);
62902
63105
  }
62903
63106
  if (!opts.create)
62904
63107
  return null;
@@ -62914,7 +63117,7 @@ function setComponentStatus(plan, name, status, opts = {}) {
62914
63117
  verified: null
62915
63118
  };
62916
63119
  plan.components.push(created);
62917
- return created;
63120
+ return withNote(created);
62918
63121
  }
62919
63122
  function setComponentProvenance(plan, name, provenance) {
62920
63123
  const k = key(name);
@@ -62976,10 +63179,15 @@ function planProgress(plan) {
62976
63179
  done: 0,
62977
63180
  "as-is": 0,
62978
63181
  upgrade: 0,
62979
- skipped: 0
63182
+ skipped: 0,
63183
+ vanished: 0
62980
63184
  };
62981
63185
  const settled = [];
62982
- const settledByStatus = { done: [], skipped: [] };
63186
+ const settledByStatus = {
63187
+ done: [],
63188
+ skipped: [],
63189
+ vanished: []
63190
+ };
62983
63191
  const accepted = { asIs: [], upgrade: [] };
62984
63192
  const remaining = [];
62985
63193
  for (const c of plan.components) {
@@ -62992,6 +63200,8 @@ function planProgress(plan) {
62992
63200
  settledByStatus.done.push(c.name);
62993
63201
  if (c.status === "skipped")
62994
63202
  settledByStatus.skipped.push(c.name);
63203
+ if (c.status === "vanished")
63204
+ settledByStatus.vanished.push(c.name);
62995
63205
  if (SETTLED.has(c.status))
62996
63206
  settled.push(c.name);
62997
63207
  else
@@ -63048,7 +63258,7 @@ function sourcePath(plan, c) {
63048
63258
  function disposition(c) {
63049
63259
  if (c.status === "pending" || c.status === "partial")
63050
63260
  return "build";
63051
- if (c.status === "skipped")
63261
+ if (c.status === "skipped" || c.status === "vanished")
63052
63262
  return "settled";
63053
63263
  if (c.status === "as-is")
63054
63264
  return "as-is";
@@ -65436,10 +65646,229 @@ function listCommand(output) {
65436
65646
  return 0;
65437
65647
  }
65438
65648
 
65439
- // src/commands/migrate.ts
65440
- import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync24, writeFileSync as writeFileSync25 } from "node:fs";
65441
- import { resolve as resolve7 } from "node:path";
65649
+ // src/commands/loadtest.ts
65650
+ import { existsSync as existsSync14, readFileSync as readFileSync20 } from "node:fs";
65442
65651
  import chalk21 from "chalk";
65652
+ var MAX_RPS = 100;
65653
+ var MAX_DURATION_SEC = 900;
65654
+ var MAX_IN_FLIGHT = 512;
65655
+ var LATE_MS = 250;
65656
+ var LATE_SHARE = 0.05;
65657
+ function scheduleOffsets(rps, durationSec) {
65658
+ const n = Math.floor(rps * durationSec);
65659
+ const step = 1000 / rps;
65660
+ return Array.from({ length: n }, (_, i) => i * step);
65661
+ }
65662
+ function pickTarget(i, paths, devices) {
65663
+ return {
65664
+ path: paths[Math.floor(i / devices.length) % paths.length],
65665
+ device: devices[i % devices.length]
65666
+ };
65667
+ }
65668
+ function cacheStateOf(h) {
65669
+ const obs = classifyCacheHeaders(h);
65670
+ if (obs.state !== "unknown")
65671
+ return { state: obs.state, segment: obs.segment };
65672
+ const cf = h.get("cf-cache-status")?.trim().toLowerCase();
65673
+ const state = cf === "hit" || cf === "revalidated" ? "hit" : cf === "stale" ? "stale-hit" : cf === "miss" || cf === "expired" ? "miss" : "unknown";
65674
+ return { state, segment: obs.segment };
65675
+ }
65676
+ function summarize(samples) {
65677
+ const status = {};
65678
+ const cache = {};
65679
+ for (const s of samples) {
65680
+ const k = s.status === 0 ? "error" : String(s.status);
65681
+ status[k] = (status[k] ?? 0) + 1;
65682
+ cache[s.state] = (cache[s.state] ?? 0) + 1;
65683
+ }
65684
+ const ok = samples.filter((s) => s.status !== 0).map((s) => s.durationMs).sort((a, b) => a - b);
65685
+ const p = (q) => ok.length === 0 ? null : Math.round(percentile(ok, q));
65686
+ return {
65687
+ requests: samples.length,
65688
+ status,
65689
+ p50Ms: p(50),
65690
+ p95Ms: p(95),
65691
+ p99Ms: p(99),
65692
+ hitRate: hitRate(samples.map((s) => s.state)),
65693
+ cache
65694
+ };
65695
+ }
65696
+ function groupBy(samples, key) {
65697
+ const groups = new Map;
65698
+ for (const s of samples) {
65699
+ const k = key(s);
65700
+ (groups.get(k) ?? groups.set(k, []).get(k)).push(s);
65701
+ }
65702
+ return Object.fromEntries([...groups].map(([k, v]) => [k, summarize(v)]));
65703
+ }
65704
+ async function runLoad(args) {
65705
+ const { baseUrl, paths, devices, rps, durationSec } = args;
65706
+ const offsets = scheduleOffsets(rps, durationSec);
65707
+ const samples = [];
65708
+ const inFlight = new Set;
65709
+ let dropped = 0;
65710
+ let late = 0;
65711
+ let lastSentAt = 0;
65712
+ const fire = async (path, device) => {
65713
+ const started = performance.now();
65714
+ let status = 0;
65715
+ let state = "unknown";
65716
+ let segment = null;
65717
+ try {
65718
+ const res = await fetch(new URL(path, baseUrl), {
65719
+ redirect: "manual",
65720
+ headers: {
65721
+ "user-agent": userAgentFor(device),
65722
+ "accept-encoding": "gzip",
65723
+ accept: "text/html"
65724
+ },
65725
+ signal: AbortSignal.timeout(args.timeoutMs ?? 30000)
65726
+ });
65727
+ await res.arrayBuffer();
65728
+ status = res.status;
65729
+ ({ state, segment } = cacheStateOf(res.headers));
65730
+ } catch {}
65731
+ samples.push({
65732
+ path,
65733
+ kind: classifyPath2(path.split("?")[0]),
65734
+ device,
65735
+ segment,
65736
+ status,
65737
+ durationMs: performance.now() - started,
65738
+ state
65739
+ });
65740
+ };
65741
+ const t0 = performance.now();
65742
+ for (let i = 0;i < offsets.length; i++) {
65743
+ const wait = t0 + offsets[i] - performance.now();
65744
+ if (wait > 0)
65745
+ await new Promise((r) => setTimeout(r, wait));
65746
+ else if (-wait > LATE_MS)
65747
+ late++;
65748
+ if (inFlight.size >= MAX_IN_FLIGHT) {
65749
+ dropped++;
65750
+ continue;
65751
+ }
65752
+ const { path, device } = pickTarget(i, paths, devices);
65753
+ const p = fire(path, device).finally(() => inFlight.delete(p));
65754
+ inFlight.add(p);
65755
+ lastSentAt = performance.now() - t0;
65756
+ }
65757
+ await Promise.all(inFlight);
65758
+ const wallSec = (performance.now() - t0) / 1000;
65759
+ const sent = offsets.length - dropped;
65760
+ const sentRps = sent / Math.max((lastSentAt + 1000 / rps) / 1000, 0.000000001);
65761
+ const why = [];
65762
+ if (dropped > 0)
65763
+ why.push(`${dropped} requests dropped at the ${MAX_IN_FLIGHT} in-flight ceiling (latency × rate outran the client)`);
65764
+ if (late / Math.max(offsets.length, 1) > LATE_SHARE)
65765
+ why.push(`${late} requests left >${LATE_MS}ms behind schedule (this machine's event loop fell behind)`);
65766
+ const covered = new Set(samples.map((s) => `${s.path}\x00${s.device}`)).size;
65767
+ return {
65768
+ url: baseUrl,
65769
+ paths: paths.length,
65770
+ devices: [...devices],
65771
+ requestedRps: rps,
65772
+ durationSec,
65773
+ scheduled: offsets.length,
65774
+ sent,
65775
+ dropped,
65776
+ late,
65777
+ sentRps: round(sentRps),
65778
+ completedRps: round(samples.length / Math.max(wallSec, 0.000000001)),
65779
+ clientLimited: why.length > 0,
65780
+ clientLimitedWhy: why.length > 0 ? why.join("; ") : null,
65781
+ coverage: round(covered / (paths.length * devices.length)),
65782
+ overall: summarize(samples),
65783
+ byKind: groupBy(samples, (s) => s.kind),
65784
+ byDevice: groupBy(samples, (s) => s.device),
65785
+ bySegment: groupBy(samples, (s) => s.segment ?? `${s.device}:unreported`)
65786
+ };
65787
+ }
65788
+ var round = (n) => Math.round(n * 100) / 100;
65789
+ async function loadtestCommand(opts) {
65790
+ const refuse = (msg) => {
65791
+ console.error(chalk21.red(`parity loadtest: ${msg}`));
65792
+ return 2;
65793
+ };
65794
+ if (!Number.isFinite(opts.rps) || opts.rps <= 0 || opts.rps > MAX_RPS)
65795
+ 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`);
65796
+ if (!Number.isFinite(opts.duration) || opts.duration <= 0 || opts.duration > MAX_DURATION_SEC)
65797
+ return refuse(`--duration must be in (0, ${MAX_DURATION_SEC}] seconds (got ${opts.duration})`);
65798
+ const devices = [];
65799
+ for (const d of opts.devices.split(",").map((s) => s.trim()).filter(Boolean)) {
65800
+ const v = Viewport.safeParse(d);
65801
+ if (!v.success)
65802
+ return refuse(`unknown device "${d}" (mobile, tablet, desktop)`);
65803
+ devices.push(v.data);
65804
+ }
65805
+ if (devices.length === 0)
65806
+ return refuse("--devices is empty");
65807
+ let paths;
65808
+ if (opts.paths) {
65809
+ const raw = existsSync14(opts.paths) ? readFileSync20(opts.paths, "utf8").split(`
65810
+ `) : opts.paths.split(",");
65811
+ paths = raw.map((s) => toPath(s.trim())).filter(Boolean);
65812
+ } else {
65813
+ if (opts.pathsFrom && opts.pathsFrom !== "sitemap")
65814
+ return refuse(`--paths-from only supports "sitemap" (got "${opts.pathsFrom}")`);
65815
+ paths = (await resolveSitemapUrls(opts.url)).map(toPath).filter((p) => p && classifyPath2(p) !== "auth");
65816
+ }
65817
+ paths = [...new Set(paths)].slice(0, opts.limit && opts.limit > 0 ? opts.limit : undefined);
65818
+ if (paths.length === 0)
65819
+ return refuse("no paths to load — sitemap empty/unreachable or --paths empty. Nothing measured.");
65820
+ if (!opts.json)
65821
+ console.error(chalk21.dim(`loadtest ${opts.url}: ${opts.rps} rps × ${opts.duration}s over ${paths.length} paths × ${devices.join("/")}`));
65822
+ const r = await runLoad({
65823
+ baseUrl: opts.url,
65824
+ paths,
65825
+ devices,
65826
+ rps: opts.rps,
65827
+ durationSec: opts.duration
65828
+ });
65829
+ if (opts.json)
65830
+ console.log(JSON.stringify(r, null, 2));
65831
+ else
65832
+ printSummary7(r);
65833
+ if (r.overall.requests === 0 || r.overall.requests === (r.overall.status.error ?? 0))
65834
+ return 2;
65835
+ if (r.clientLimited)
65836
+ return 3;
65837
+ const failed = Object.entries(r.overall.status).some(([k, n]) => n > 0 && (k === "error" || Number(k) >= 500));
65838
+ return failed ? 1 : 0;
65839
+ }
65840
+ function toPath(s) {
65841
+ if (!s)
65842
+ return "";
65843
+ try {
65844
+ const u = new URL(s);
65845
+ return u.pathname + u.search;
65846
+ } catch {
65847
+ return s.startsWith("/") ? s : `/${s}`;
65848
+ }
65849
+ }
65850
+ function printSummary7(r) {
65851
+ const pct = (v) => v == null ? "n/a" : `${Math.round(v * 100)}%`;
65852
+ 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(" ")}`;
65853
+ console.log(`Throughput: requested ${r.requestedRps} rps · sent ${r.sentRps} rps · completed ${r.completedRps} rps · coverage ${pct(r.coverage)} of path×device`);
65854
+ if (r.clientLimited)
65855
+ console.log(chalk21.yellow(` CLIENT-LIMITED — the generator, not the site, capped the rate: ${r.clientLimitedWhy}`));
65856
+ console.log(line("overall", r.overall));
65857
+ console.log("By segment (x-cache-segment):");
65858
+ for (const [k, s] of Object.entries(r.bySegment))
65859
+ console.log(line(k, s));
65860
+ console.log("By device:");
65861
+ for (const [k, s] of Object.entries(r.byDevice))
65862
+ console.log(line(k, s));
65863
+ console.log("By path kind:");
65864
+ for (const [k, s] of Object.entries(r.byKind))
65865
+ console.log(line(k, s));
65866
+ }
65867
+
65868
+ // src/commands/migrate.ts
65869
+ import { existsSync as existsSync19, mkdirSync as mkdirSync16, readFileSync as readFileSync25, rmSync, writeFileSync as writeFileSync25 } from "node:fs";
65870
+ import { relative as relative4, resolve as resolve7 } from "node:path";
65871
+ import chalk22 from "chalk";
65443
65872
  import open from "open";
65444
65873
 
65445
65874
  // src/migrate/pdp-discovery.ts
@@ -65867,7 +66296,7 @@ function escapePipes2(s) {
65867
66296
  }
65868
66297
 
65869
66298
  // src/migrate/exporters/html.ts
65870
- import { readFileSync as readFileSync20, writeFileSync as writeFileSync24 } from "node:fs";
66299
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync24 } from "node:fs";
65871
66300
  import { join as join27 } from "node:path";
65872
66301
 
65873
66302
  // src/migrate/targets/faststore-v4.ts
@@ -66209,7 +66638,7 @@ function dataUri2(absPath) {
66209
66638
  const mime = MIME2[ext];
66210
66639
  if (!mime)
66211
66640
  return null;
66212
- return `data:${mime};base64,${readFileSync20(absPath).toString("base64")}`;
66641
+ return `data:${mime};base64,${readFileSync21(absPath).toString("base64")}`;
66213
66642
  } catch {
66214
66643
  return null;
66215
66644
  }
@@ -66458,7 +66887,7 @@ function buildMigrationPrompt(bundle, playbook, source) {
66458
66887
  }
66459
66888
 
66460
66889
  // src/migrate/sources/deco-fresh.ts
66461
- import { existsSync as existsSync14, readFileSync as readFileSync21 } from "node:fs";
66890
+ import { existsSync as existsSync15, readFileSync as readFileSync22 } from "node:fs";
66462
66891
  import { join as join29 } from "node:path";
66463
66892
 
66464
66893
  // src/migrate/sources/walk.ts
@@ -66504,13 +66933,13 @@ function walkFiles(dir, exts) {
66504
66933
  function isDecoFresh(repoDir) {
66505
66934
  const denoJson = join29(repoDir, "deno.json");
66506
66935
  const denoJsonc = join29(repoDir, "deno.jsonc");
66507
- const file = existsSync14(denoJson) ? denoJson : existsSync14(denoJsonc) ? denoJsonc : null;
66936
+ const file = existsSync15(denoJson) ? denoJson : existsSync15(denoJsonc) ? denoJsonc : null;
66508
66937
  if (!file)
66509
66938
  return false;
66510
- if (!existsSync14(join29(repoDir, "fresh.gen.ts")))
66939
+ if (!existsSync15(join29(repoDir, "fresh.gen.ts")))
66511
66940
  return false;
66512
66941
  try {
66513
- return readFileSync21(file, "utf8").includes("@deco/deco");
66942
+ return readFileSync22(file, "utf8").includes("@deco/deco");
66514
66943
  } catch {
66515
66944
  return false;
66516
66945
  }
@@ -66519,7 +66948,7 @@ var GLOBAL_HINT = /\b(header|footer|navbar|menu|topbar)\b/i;
66519
66948
  function inventory(repoDir) {
66520
66949
  const components = [];
66521
66950
  const sectionsDir = join29(repoDir, "sections");
66522
- if (existsSync14(sectionsDir)) {
66951
+ if (existsSync15(sectionsDir)) {
66523
66952
  for (const rel of walkFiles(sectionsDir, [".tsx"])) {
66524
66953
  const key = rel.replace(/\.tsx$/, "");
66525
66954
  components.push({
@@ -66533,9 +66962,9 @@ function inventory(repoDir) {
66533
66962
  const notes = [
66534
66963
  "Source: Deco on Fresh/Deno (Preact + signals, JSX). Sections are the CMS unit."
66535
66964
  ];
66536
- if (existsSync14(join29(repoDir, "islands")))
66965
+ if (existsSync15(join29(repoDir, "islands")))
66537
66966
  notes.push("Has islands/ — client-interactive components.");
66538
- if (existsSync14(join29(repoDir, "loaders")))
66967
+ if (existsSync15(join29(repoDir, "loaders")))
66539
66968
  notes.push("Has loaders/ — server data functions to port.");
66540
66969
  return { components, notes };
66541
66970
  }
@@ -66575,14 +67004,14 @@ captured HTML/computed-styles as the source of truth for structure and styling.`
66575
67004
  };
66576
67005
 
66577
67006
  // src/migrate/sources/vtex-io.ts
66578
- import { existsSync as existsSync15, readFileSync as readFileSync22 } from "node:fs";
67007
+ import { existsSync as existsSync16, readFileSync as readFileSync23 } from "node:fs";
66579
67008
  import { join as join30 } from "node:path";
66580
67009
  function readManifest(repoDir) {
66581
67010
  const file = join30(repoDir, "manifest.json");
66582
- if (!existsSync15(file))
67011
+ if (!existsSync16(file))
66583
67012
  return null;
66584
67013
  try {
66585
- return JSON.parse(readFileSync22(file, "utf8"));
67014
+ return JSON.parse(readFileSync23(file, "utf8"));
66586
67015
  } catch {
66587
67016
  return null;
66588
67017
  }
@@ -66605,12 +67034,12 @@ var GLOBAL_HINT2 = /header|footer|menu|minicart|navbar/i;
66605
67034
  function inventory2(repoDir) {
66606
67035
  const blocksDir = join30(repoDir, "store", "blocks");
66607
67036
  const seen = new Map;
66608
- if (existsSync15(blocksDir)) {
67037
+ if (existsSync16(blocksDir)) {
66609
67038
  for (const rel of walkFiles(blocksDir, [".json", ".jsonc"])) {
66610
67039
  const abs = join30(blocksDir, rel);
66611
67040
  let parsed;
66612
67041
  try {
66613
- parsed = JSON.parse(stripJsonc(readFileSync22(abs, "utf8")));
67042
+ parsed = JSON.parse(stripJsonc(readFileSync23(abs, "utf8")));
66614
67043
  } catch {
66615
67044
  continue;
66616
67045
  }
@@ -66654,7 +67083,7 @@ CMS placeholders.`
66654
67083
  };
66655
67084
 
66656
67085
  // src/migrate/sources/find.ts
66657
- import { existsSync as existsSync16, readdirSync as readdirSync5, statSync } from "node:fs";
67086
+ import { existsSync as existsSync17, readdirSync as readdirSync5, statSync } from "node:fs";
66658
67087
  import { basename as basename4, join as join31, resolve as resolve6 } from "node:path";
66659
67088
  var GENERIC_LABELS = new Set(["www", "m", "www2", "loja", "shop", "store", "secure", "web"]);
66660
67089
  var TARGET_SUFFIXES = ["-tanstack", "-faststore", "-next", "-cand", "-candidate", "-migration"];
@@ -66712,7 +67141,7 @@ function scoreCandidate(dir, slug) {
66712
67141
  }
66713
67142
  function findSourceCandidates(opts) {
66714
67143
  const slug = slugFromUrl(opts.url);
66715
- const roots = opts.roots.map((r) => resolve6(r)).filter((r) => existsSync16(r) && isDir(r));
67144
+ const roots = opts.roots.map((r) => resolve6(r)).filter((r) => existsSync17(r) && isDir(r));
66716
67145
  if (!slug)
66717
67146
  return { roots, candidates: [] };
66718
67147
  const excluded = new Set((opts.exclude ?? []).map((p) => resolve6(p)));
@@ -66776,7 +67205,7 @@ function formatSourceHunt(result) {
66776
67205
  `);
66777
67206
  }
66778
67207
  // src/migrate/sources/project.ts
66779
- import { existsSync as existsSync17, readFileSync as readFileSync23, readdirSync as readdirSync6 } from "node:fs";
67208
+ import { existsSync as existsSync18, readFileSync as readFileSync24, readdirSync as readdirSync6 } from "node:fs";
66780
67209
  import { join as join32 } from "node:path";
66781
67210
  var MAX_PROPS_CHARS = 4000;
66782
67211
  var MAX_PAGES = 60;
@@ -66851,7 +67280,7 @@ function readComponentDetail(repoDir, file) {
66851
67280
  const abs = join32(repoDir, file);
66852
67281
  let source;
66853
67282
  try {
66854
- source = readFileSync23(abs, "utf8");
67283
+ source = readFileSync24(abs, "utf8");
66855
67284
  } catch {
66856
67285
  return null;
66857
67286
  }
@@ -66874,11 +67303,11 @@ var TOKEN_CANDIDATES = [
66874
67303
  "styles/configs/color.json"
66875
67304
  ];
66876
67305
  function findTokenFiles(repoDir) {
66877
- return TOKEN_CANDIDATES.filter((f) => existsSync17(join32(repoDir, f)));
67306
+ return TOKEN_CANDIDATES.filter((f) => existsSync18(join32(repoDir, f)));
66878
67307
  }
66879
67308
  function readDecoPages(repoDir) {
66880
67309
  const blocksDir = join32(repoDir, ".deco", "blocks");
66881
- if (!existsSync17(blocksDir))
67310
+ if (!existsSync18(blocksDir))
66882
67311
  return { pages: [], total: 0 };
66883
67312
  let files;
66884
67313
  try {
@@ -66892,7 +67321,7 @@ function readDecoPages(repoDir) {
66892
67321
  break;
66893
67322
  let parsed;
66894
67323
  try {
66895
- parsed = JSON.parse(readFileSync23(join32(blocksDir, file), "utf8"));
67324
+ parsed = JSON.parse(readFileSync24(join32(blocksDir, file), "utf8"));
66896
67325
  } catch {
66897
67326
  continue;
66898
67327
  }
@@ -67442,22 +67871,25 @@ async function captureInteractions(page, selector) {
67442
67871
  async function migrateCommand(opts) {
67443
67872
  const viewport = parseViewport3(opts.viewport);
67444
67873
  if (!viewport) {
67445
- console.error(chalk21.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
67874
+ console.error(chalk22.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
67446
67875
  return 2;
67447
67876
  }
67448
67877
  const viewports = (opts.viewports ? opts.viewports.split(",") : [opts.viewport]).map((v) => parseViewport3(v.trim())).filter((v) => Boolean(v));
67449
67878
  if (viewports.length === 0) {
67450
- console.error(chalk21.red(`--viewports inválido: ${opts.viewports}`));
67879
+ console.error(chalk22.red(`--viewports inválido: ${opts.viewports}`));
67451
67880
  return 2;
67452
67881
  }
67453
67882
  const primaryViewport = viewports[0];
67883
+ if (opts.componentViewports && viewports.length < 2) {
67884
+ console.warn(chalk22.yellow(" ! --component-viewports needs a second viewport in --viewports; ignored."));
67885
+ }
67454
67886
  if (!isValidUrl4(opts.url)) {
67455
- console.error(chalk21.red(`--url inválido: ${opts.url}`));
67887
+ console.error(chalk22.red(`--url inválido: ${opts.url}`));
67456
67888
  return 2;
67457
67889
  }
67458
67890
  const format = normalizeFormat2(opts.format);
67459
67891
  if (!format) {
67460
- console.error(chalk21.red(`--format inválido: ${opts.format} (use md|json|both)`));
67892
+ console.error(chalk22.red(`--format inválido: ${opts.format} (use md|json|both)`));
67461
67893
  return 2;
67462
67894
  }
67463
67895
  let pageTokens;
@@ -67467,14 +67899,14 @@ async function migrateCommand(opts) {
67467
67899
  fallback: ["/", "category-auto", "pdp-auto"]
67468
67900
  });
67469
67901
  } catch (err) {
67470
- console.error(chalk21.red(err.message));
67902
+ console.error(chalk22.red(err.message));
67471
67903
  return 2;
67472
67904
  }
67473
67905
  let playbook;
67474
67906
  if (opts.target) {
67475
67907
  playbook = getTargetPlaybook(opts.target);
67476
67908
  if (!playbook) {
67477
- console.error(chalk21.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
67909
+ console.error(chalk22.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
67478
67910
  return 2;
67479
67911
  }
67480
67912
  }
@@ -67484,7 +67916,7 @@ async function migrateCommand(opts) {
67484
67916
  if (opts.sourceKind) {
67485
67917
  const s = getSource(opts.sourceKind);
67486
67918
  if (!s) {
67487
- console.error(chalk21.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
67919
+ console.error(chalk22.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
67488
67920
  return 2;
67489
67921
  }
67490
67922
  source = s;
@@ -67492,24 +67924,24 @@ async function migrateCommand(opts) {
67492
67924
  let sourceHunt = null;
67493
67925
  let sourceProject = null;
67494
67926
  if (opts.source) {
67495
- if (!existsSync18(opts.source)) {
67496
- console.error(chalk21.red(`--source não encontrado: ${opts.source}`));
67927
+ if (!existsSync19(opts.source)) {
67928
+ console.error(chalk22.red(`--source não encontrado: ${opts.source}`));
67497
67929
  return 2;
67498
67930
  }
67499
67931
  if (!opts.sourceKind)
67500
67932
  source = detectSource(opts.source);
67501
67933
  sourceInventory = source.inventory(opts.source);
67502
- console.log(chalk21.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
67934
+ console.log(chalk22.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
67503
67935
  sourceProject = readSourceProject(opts.source, sourceInventory.components);
67504
67936
  for (const note of sourceProject.notes)
67505
- console.log(chalk21.dim(` ${note}`));
67937
+ console.log(chalk22.dim(` ${note}`));
67506
67938
  } else if (!opts.noSourceHunt) {
67507
67939
  sourceHunt = findSourceCandidates({
67508
67940
  url: opts.url,
67509
67941
  roots: defaultSearchRoots()
67510
67942
  });
67511
67943
  const message = formatSourceHunt(sourceHunt);
67512
- console.log(sourceHunt.candidates.length > 0 ? chalk21.yellow(message) : chalk21.dim(message));
67944
+ console.log(sourceHunt.candidates.length > 0 ? chalk22.yellow(message) : chalk22.dim(message));
67513
67945
  }
67514
67946
  const host = safeHost6(opts.url);
67515
67947
  const runDir = resolve7(opts.outDir, host);
@@ -67526,23 +67958,23 @@ async function migrateCommand(opts) {
67526
67958
  let screenshots;
67527
67959
  let vtexBlocks = null;
67528
67960
  let contentMap = {};
67529
- if (!opts.refresh && existsSync18(themePath) && existsSync18(assetsPath)) {
67961
+ if (!opts.refresh && existsSync19(themePath) && existsSync19(assetsPath)) {
67530
67962
  theme = readJson(themePath);
67531
67963
  const meta = readJson(assetsPath);
67532
67964
  platform = meta.platform;
67533
67965
  stack = meta.stack ?? null;
67534
67966
  assets = meta.assets;
67535
67967
  screenshots = meta.screenshots ?? [];
67536
- console.log(chalk21.dim(" phase 1 theme+assets: cached"));
67968
+ console.log(chalk22.dim(" phase 1 theme+assets: cached"));
67537
67969
  } else {
67538
- console.log(chalk21.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67970
+ console.log(chalk22.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67539
67971
  mkdirSync16(resolve7(runDir, "screenshots"), { recursive: true });
67540
67972
  const samples = [];
67541
67973
  screenshots = [];
67542
67974
  let platformSeen = null;
67543
67975
  let assetsResolved = null;
67544
67976
  for (const vp of viewports) {
67545
- const ctx = await newContext(browser, { viewport: vp });
67977
+ const ctx = await newContext(browser, { viewport: vp, keepMotion: true });
67546
67978
  const page = await ctx.newPage();
67547
67979
  try {
67548
67980
  await page.goto(opts.url, { waitUntil: "domcontentloaded", timeout: 30000 });
@@ -67560,9 +67992,9 @@ async function migrateCommand(opts) {
67560
67992
  platformSeen = detectPlatform({ url: opts.url, html: pageHtml });
67561
67993
  const cookieNames = await ctx.cookies().then((cs) => cs.map((c) => c.name).join("; ")).catch(() => "");
67562
67994
  stack = classifyLiveStack(pageHtml, cookieNames);
67563
- console.log(chalk21.dim(` stack: ${describeStack(stack)}`));
67995
+ console.log(chalk22.dim(` stack: ${describeStack(stack)}`));
67564
67996
  if (!opts.source && stack.frontend !== "unknown") {
67565
- console.warn(chalk21.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67997
+ console.warn(chalk22.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67566
67998
  Re-run with --source <repo> for structural porting (real class strings, not measured pixels).`));
67567
67999
  }
67568
68000
  const rawAssets = await collectSiteAssets(page);
@@ -67596,11 +68028,11 @@ async function migrateCommand(opts) {
67596
68028
  }
67597
68029
  const sitemapPath = resolve7(runDir, "sitemap.json");
67598
68030
  let resolvedPages;
67599
- if (!opts.refresh && existsSync18(sitemapPath)) {
68031
+ if (!opts.refresh && existsSync19(sitemapPath)) {
67600
68032
  resolvedPages = readJson(sitemapPath).pages;
67601
- console.log(chalk21.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
68033
+ console.log(chalk22.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
67602
68034
  } else {
67603
- console.log(chalk21.dim(" phase 2 sitemap: resolving pages…"));
68035
+ console.log(chalk22.dim(" phase 2 sitemap: resolving pages…"));
67604
68036
  const ctx = await newContext(browser, { viewport: primaryViewport });
67605
68037
  const page = await ctx.newPage();
67606
68038
  let sitemapUrls = [];
@@ -67628,33 +68060,34 @@ async function migrateCommand(opts) {
67628
68060
  a[p.kind] = (a[p.kind] ?? 0) + 1;
67629
68061
  return a;
67630
68062
  }, {});
67631
- console.log(chalk21.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
68063
+ console.log(chalk22.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
67632
68064
  }
67633
68065
  writeFileSync25(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
67634
68066
  `, "utf8");
67635
68067
  }
67636
68068
  if (resolvedPages.length === 0) {
67637
- console.error(chalk21.red("nenhuma página resolvida a partir de --pages"));
68069
+ console.error(chalk22.red("nenhuma página resolvida a partir de --pages"));
67638
68070
  return 1;
67639
68071
  }
67640
68072
  const capturePath = resolve7(runDir, "capture.json");
67641
68073
  let pages;
67642
68074
  let components;
67643
- if (!opts.refresh && existsSync18(capturePath)) {
68075
+ if (!opts.refresh && existsSync19(capturePath)) {
67644
68076
  const cached = readJson(capturePath);
67645
68077
  pages = cached.pages;
67646
68078
  components = cached.components;
67647
68079
  vtexBlocks = cached.vtexBlocks ?? null;
67648
68080
  contentMap = cached.contentMap ?? {};
67649
- console.log(chalk21.dim(` phase 3 components: cached (${components.length})`));
68081
+ console.log(chalk22.dim(` phase 3 components: cached (${components.length})`));
67650
68082
  } else {
67651
- console.log(chalk21.dim(" phase 3 components: capturing…"));
68083
+ console.log(chalk22.dim(" phase 3 components: capturing…"));
67652
68084
  ({ pages, components, vtexBlocks, contentMap } = await capturePages(browser, primaryViewport, resolvedPages, theme, {
67653
68085
  allowlist,
67654
68086
  llm: !opts.noLlm,
67655
68087
  runDir,
67656
68088
  baseUrl: opts.url,
67657
- vtexScrape: opts.source ? source.kind === "vtex-io" : true
68089
+ vtexScrape: opts.source ? source.kind === "vtex-io" : true,
68090
+ extraViewports: opts.componentViewports ? viewports.slice(1) : []
67658
68091
  }));
67659
68092
  writeFileSync25(capturePath, `${JSON.stringify({ pages, components, vtexBlocks, contentMap }, null, 2)}
67660
68093
  `, "utf8");
@@ -67711,13 +68144,13 @@ async function migrateCommand(opts) {
67711
68144
  const projectPath = resolve7(runDir, "source-project.json");
67712
68145
  writeFileSync25(projectPath, `${JSON.stringify(sourceProject, null, 2)}
67713
68146
  `, "utf8");
67714
- 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)`));
68147
+ 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)`));
67715
68148
  }
67716
68149
  if (merged.carried.length) {
67717
- console.log(chalk21.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
68150
+ console.log(chalk22.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
67718
68151
  }
67719
68152
  if (merged.keptUncaptured.length) {
67720
- 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.`));
68153
+ 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.`));
67721
68154
  }
67722
68155
  bundle.components.push(...syntheticSourceComponents(plan));
67723
68156
  if (format === "json" || format === "both")
@@ -67763,9 +68196,10 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67763
68196
  const blocksByPath = new Map;
67764
68197
  const contentMap = {};
67765
68198
  for (const target of resolvedPages) {
67766
- const ctx = await newContext(browser, { viewport });
68199
+ const ctx = await newContext(browser, { viewport, keepMotion: true });
67767
68200
  const page = await ctx.newPage();
67768
68201
  const pageComponents = [];
68202
+ const capturedHere = [];
67769
68203
  try {
67770
68204
  await page.goto(target.url, { waitUntil: "domcontentloaded", timeout: 30000 });
67771
68205
  await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
@@ -67797,6 +68231,7 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67797
68231
  const interactions = await captureInteractions(page, component.selector);
67798
68232
  const migrated = toMigratedComponent(extracted, interactions, global ? "global" : "page", theme.tokens, repeated);
67799
68233
  components.push(migrated);
68234
+ capturedHere.push({ migrated, componentDir });
67800
68235
  if (!global)
67801
68236
  pageComponents.push(migrated);
67802
68237
  }
@@ -67825,6 +68260,9 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67825
68260
  return;
67826
68261
  });
67827
68262
  }
68263
+ if (cfg.extraViewports.length && capturedHere.length) {
68264
+ await captureViewportVariants(browser, target.url, cfg.extraViewports, capturedHere, cfg.runDir);
68265
+ }
67828
68266
  }
67829
68267
  return {
67830
68268
  pages,
@@ -67833,6 +68271,89 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67833
68271
  contentMap
67834
68272
  };
67835
68273
  }
68274
+ async function captureViewportVariants(browser, url, extraViewports, captured, runDir) {
68275
+ const perComponent = captured.map(() => []);
68276
+ for (const vp of extraViewports) {
68277
+ let ctx;
68278
+ let page;
68279
+ let done = 0;
68280
+ try {
68281
+ ctx = await newContext(browser, { viewport: vp });
68282
+ page = await ctx.newPage();
68283
+ await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 });
68284
+ await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
68285
+ return;
68286
+ });
68287
+ await settlePage(page, { fonts: false, layoutStable: false });
68288
+ const pageScreenshot = await page.screenshot({ fullPage: true, animations: "disabled", timeout: 15000 }).catch(() => {
68289
+ return;
68290
+ });
68291
+ for (const [i, { migrated, componentDir }] of captured.entries()) {
68292
+ const art = await captureSectionArtifacts(page, {
68293
+ selector: migrated.selector,
68294
+ wantHtml: true,
68295
+ wantStyles: false,
68296
+ wantCssSource: false
68297
+ });
68298
+ if (art.html === null) {
68299
+ perComponent[i].push(art.htmlNoMatch ? { viewport: vp, status: "absent" } : { viewport: vp, status: "failed", reason: art.htmlError ?? "HTML read failed" });
68300
+ done++;
68301
+ continue;
68302
+ }
68303
+ const shot = resolve7(componentDir, vp, "screenshot.png");
68304
+ mkdirSync16(resolve7(componentDir, vp), { recursive: true });
68305
+ const err = await captureSectionScreenshot(page, migrated.selector, shot, pageScreenshot);
68306
+ perComponent[i].push({
68307
+ viewport: vp,
68308
+ status: "ok",
68309
+ html: art.html,
68310
+ screenshot: !err && existsSync19(shot) ? readFileSync25(shot) : null
68311
+ });
68312
+ done++;
68313
+ }
68314
+ } catch (err) {
68315
+ const reason = `${vp} load failed: ${err.message.split(`
68316
+ `)[0]}`;
68317
+ console.warn(chalk22.yellow(` ! --component-viewports: ${url} — ${reason}; skipped`));
68318
+ for (let i = done;i < captured.length; i++) {
68319
+ perComponent[i].push({ viewport: vp, status: "failed", reason });
68320
+ }
68321
+ } finally {
68322
+ await page?.close().catch(() => {
68323
+ return;
68324
+ });
68325
+ await ctx?.close().catch(() => {
68326
+ return;
68327
+ });
68328
+ }
68329
+ }
68330
+ for (const [i, { migrated, componentDir }] of captured.entries()) {
68331
+ const primaryShot = existsSync19(migrated.screenshotPath) ? readFileSync25(migrated.screenshotPath) : null;
68332
+ const deltas = viewportDeltas({ html: migrated.html, screenshot: primaryShot }, perComponent[i]);
68333
+ const variants = [];
68334
+ for (const vp of extraViewports) {
68335
+ const dir = resolve7(componentDir, vp);
68336
+ const d = deltas.find((x) => x.viewport === vp);
68337
+ if (!d || d.absent || d.failed)
68338
+ rmSync(dir, { recursive: true, force: true });
68339
+ if (!d)
68340
+ continue;
68341
+ if (d.html !== undefined)
68342
+ writeFileSync25(resolve7(dir, "component.html"), d.html, "utf8");
68343
+ if (!d.keepScreenshot)
68344
+ rmSync(resolve7(dir, "screenshot.png"), { force: true });
68345
+ variants.push({
68346
+ viewport: vp,
68347
+ ...d.absent ? { absent: true } : {},
68348
+ ...d.failed ? { failed: d.failed } : {},
68349
+ ...d.html !== undefined ? { html: d.html } : {},
68350
+ ...d.keepScreenshot ? { screenshotPath: relative4(runDir, resolve7(dir, "screenshot.png")) } : {}
68351
+ });
68352
+ }
68353
+ if (variants.length)
68354
+ migrated.viewportVariants = variants;
68355
+ }
68356
+ }
67836
68357
  async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67837
68358
  const out = [];
67838
68359
  const plp = pickPlpFromHomeHtml(homeHtml, baseUrl);
@@ -67841,12 +68362,12 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67841
68362
  if (plp)
67842
68363
  out.push({ path: token, url: plp, kind: "plp" });
67843
68364
  else
67844
- console.warn(chalk21.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
68365
+ console.warn(chalk22.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
67845
68366
  continue;
67846
68367
  }
67847
68368
  if (token === "pdp-auto") {
67848
68369
  if (!plp) {
67849
- console.warn(chalk21.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
68370
+ console.warn(chalk22.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
67850
68371
  continue;
67851
68372
  }
67852
68373
  let html = null;
@@ -67863,7 +68384,7 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67863
68384
  if (pdp)
67864
68385
  out.push({ path: token, url: pdp, kind: "pdp" });
67865
68386
  else
67866
- console.warn(chalk21.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
68387
+ console.warn(chalk22.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
67867
68388
  continue;
67868
68389
  }
67869
68390
  try {
@@ -67957,31 +68478,31 @@ function kindOf(url) {
67957
68478
  }
67958
68479
  }
67959
68480
  function printResults4(runDir, bundle) {
67960
- console.log(chalk21.bold(`
68481
+ console.log(chalk22.bold(`
67961
68482
  parity migrate`));
67962
- console.log(chalk21.dim(` url: ${bundle.url}`));
67963
- console.log(chalk21.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
67964
- console.log(chalk21.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
67965
- console.log(chalk21.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
67966
- console.log(chalk21.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
68483
+ console.log(chalk22.dim(` url: ${bundle.url}`));
68484
+ console.log(chalk22.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
68485
+ console.log(chalk22.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
68486
+ console.log(chalk22.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
68487
+ console.log(chalk22.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
67967
68488
  if (bundle.vtex) {
67968
68489
  const mapped = bundle.vtex.map.filter((m) => m.strategy === "mapped").length;
67969
68490
  const withContent = bundle.vtex.blocks.filter((x) => x.props).length;
67970
68491
  const contentImgs = countContentImages(bundle.vtex.blocks);
67971
- 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`));
68492
+ 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`));
67972
68493
  }
67973
- console.log(chalk21.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
67974
- console.log(chalk21.dim(` out: ${runDir}`));
68494
+ console.log(chalk22.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
68495
+ console.log(chalk22.dim(` out: ${runDir}`));
67975
68496
  console.log("");
67976
- console.log(chalk21.bold(` ${bundle.components.length} component(s):`));
68497
+ console.log(chalk22.bold(` ${bundle.components.length} component(s):`));
67977
68498
  for (const c of bundle.components) {
67978
- console.log(` ${chalk21.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk21.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
68499
+ console.log(` ${chalk22.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk22.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
67979
68500
  }
67980
68501
  console.log("");
67981
68502
  }
67982
68503
  function readJson(path) {
67983
68504
  try {
67984
- return JSON.parse(readFileSync24(path, "utf8"));
68505
+ return JSON.parse(readFileSync25(path, "utf8"));
67985
68506
  } catch {
67986
68507
  return null;
67987
68508
  }
@@ -68024,67 +68545,84 @@ function isValidUrl4(s) {
68024
68545
  }
68025
68546
 
68026
68547
  // src/commands/plan.ts
68027
- import { readFileSync as readFileSync25 } from "node:fs";
68028
- import chalk22 from "chalk";
68029
- var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
68548
+ import { readFileSync as readFileSync26 } from "node:fs";
68549
+ import chalk23 from "chalk";
68550
+ var STATUSES = [
68551
+ "pending",
68552
+ "partial",
68553
+ "done",
68554
+ "as-is",
68555
+ "upgrade",
68556
+ "skipped",
68557
+ "vanished"
68558
+ ];
68030
68559
  var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
68031
68560
  function planSetStatusCommand(dir, name, status, opts = {}) {
68032
68561
  if (!STATUSES.includes(status)) {
68033
- console.error(chalk22.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
68562
+ console.error(chalk23.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
68034
68563
  return 1;
68035
68564
  }
68036
68565
  const plan = loadPlan(dir);
68037
68566
  if (!plan) {
68038
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68567
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68039
68568
  return 1;
68040
68569
  }
68041
68570
  const existed = plan.components.length;
68042
- const component = setComponentStatus(plan, name, status, opts.create ? { create: { scope: opts.create } } : {});
68571
+ let component;
68572
+ try {
68573
+ component = setComponentStatus(plan, name, status, {
68574
+ ...opts.create ? { create: { scope: opts.create } } : {},
68575
+ note: opts.note
68576
+ });
68577
+ } catch (err) {
68578
+ console.error(chalk23.red(err.message));
68579
+ return 1;
68580
+ }
68043
68581
  if (!component) {
68044
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68045
- 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."));
68582
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68583
+ 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."));
68046
68584
  return 1;
68047
68585
  }
68048
68586
  if (plan.components.length > existed) {
68049
- console.log(chalk22.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
68587
+ console.log(chalk23.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
68050
68588
  }
68051
68589
  savePlan(dir, plan);
68052
- console.log(`${chalk22.green("✓")} ${component.name} → ${status}`);
68590
+ console.log(`${chalk23.green("✓")} ${component.name} → ${status}`);
68053
68591
  if ((status === "upgrade" || status === "as-is") && !component.reference) {
68054
- console.log(chalk22.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
68592
+ console.log(chalk23.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
68055
68593
  }
68056
68594
  return 0;
68057
68595
  }
68058
68596
  function planSetPageStatusCommand(dir, path, status) {
68059
68597
  if (!PAGE_STATUSES.includes(status)) {
68060
- console.error(chalk22.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
68598
+ console.error(chalk23.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
68061
68599
  return 1;
68062
68600
  }
68063
68601
  const plan = loadPlan(dir);
68064
68602
  if (!plan) {
68065
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68603
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68066
68604
  return 1;
68067
68605
  }
68068
68606
  const page = setPageStatus(plan, path, status);
68069
68607
  if (!page) {
68070
- console.error(chalk22.red(`No page matching "${path}" in the plan`));
68608
+ console.error(chalk23.red(`No page matching "${path}" in the plan`));
68071
68609
  return 1;
68072
68610
  }
68073
68611
  savePlan(dir, plan);
68074
- console.log(`${chalk22.green("✓")} ${page.path} → ${status}`);
68612
+ console.log(`${chalk23.green("✓")} ${page.path} → ${status}`);
68075
68613
  return 0;
68076
68614
  }
68077
68615
  var DISPOSITION_STYLE = {
68078
- build: chalk22.red,
68079
- validate: chalk22.yellow,
68080
- upgrade: chalk22.cyan,
68081
- "as-is": chalk22.gray,
68082
- settled: chalk22.green
68616
+ build: chalk23.red,
68617
+ validate: chalk23.yellow,
68618
+ upgrade: chalk23.cyan,
68619
+ "as-is": chalk23.gray,
68620
+ settled: chalk23.green
68083
68621
  };
68084
68622
  function planSetReferenceCommand(dir, name, opts) {
68085
68623
  const plan = loadPlan(dir);
68086
68624
  if (!plan) {
68087
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68625
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68088
68626
  return 1;
68089
68627
  }
68090
68628
  const component = setComponentReference(plan, name, {
@@ -68093,76 +68631,76 @@ function planSetReferenceCommand(dir, name, opts) {
68093
68631
  note: opts.note
68094
68632
  });
68095
68633
  if (!component) {
68096
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68634
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68097
68635
  return 1;
68098
68636
  }
68099
68637
  savePlan(dir, plan);
68100
- console.log(`${chalk22.green("✓")} ${component.name} → reference ${component.reference?.url}`);
68638
+ console.log(`${chalk23.green("✓")} ${component.name} → reference ${component.reference?.url}`);
68101
68639
  return 0;
68102
68640
  }
68103
68641
  function planVerifyCommand(dir, name, verdict, opts) {
68104
68642
  if (verdict !== "pass" && verdict !== "fail" && verdict !== "inconclusive") {
68105
- console.error(chalk22.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
68643
+ console.error(chalk23.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
68106
68644
  return 1;
68107
68645
  }
68108
68646
  const plan = loadPlan(dir);
68109
68647
  if (!plan) {
68110
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68648
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68111
68649
  return 1;
68112
68650
  }
68113
68651
  const component = setComponentVerified(plan, name, verdict, opts.at ?? new Date().toISOString(), opts.note);
68114
68652
  if (!component) {
68115
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68653
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68116
68654
  return 1;
68117
68655
  }
68118
68656
  savePlan(dir, plan);
68119
- const mark = verdict === "pass" ? chalk22.green("✓") : verdict === "inconclusive" ? chalk22.yellow("?") : chalk22.red("✗");
68657
+ const mark = verdict === "pass" ? chalk23.green("✓") : verdict === "inconclusive" ? chalk23.yellow("?") : chalk23.red("✗");
68120
68658
  console.log(`${mark} ${component.name} → ${verdict} (against ${component.verified?.against})`);
68121
68659
  return 0;
68122
68660
  }
68123
68661
  function planMergeCommand(dir, sourceDir) {
68124
68662
  const fresh = loadPlan(sourceDir);
68125
68663
  if (!fresh) {
68126
- console.error(chalk22.red(`No migration-plan.json found in ${sourceDir}`));
68664
+ console.error(chalk23.red(`No migration-plan.json found in ${sourceDir}`));
68127
68665
  return 1;
68128
68666
  }
68129
68667
  const existing = loadPlan(dir);
68130
68668
  const { plan, carried, keptUncaptured } = mergePlanDecisions(fresh, existing);
68131
68669
  savePlan(dir, plan);
68132
68670
  if (!existing) {
68133
- console.log(`${chalk22.green("✓")} plan written to ${dir} (nothing to merge)`);
68671
+ console.log(`${chalk23.green("✓")} plan written to ${dir} (nothing to merge)`);
68134
68672
  return 0;
68135
68673
  }
68136
- console.log(`${chalk22.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
68674
+ console.log(`${chalk23.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
68137
68675
  if (keptUncaptured.length) {
68138
- console.log(chalk22.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
68676
+ console.log(chalk23.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
68139
68677
  }
68140
68678
  return 0;
68141
68679
  }
68142
68680
  function planPageCommand(dir, path, opts) {
68143
68681
  const plan = loadPlan(dir);
68144
68682
  if (!plan) {
68145
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68683
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68146
68684
  return 1;
68147
68685
  }
68148
68686
  const page = pagePlan(plan, path, opts.cand);
68149
68687
  if (!page) {
68150
- console.error(chalk22.red(`No page matching "${path}" in the plan`));
68151
- console.error(chalk22.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
68688
+ console.error(chalk23.red(`No page matching "${path}" in the plan`));
68689
+ console.error(chalk23.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
68152
68690
  return 1;
68153
68691
  }
68154
68692
  if (opts.json) {
68155
68693
  console.log(JSON.stringify(page, null, 2));
68156
68694
  return 0;
68157
68695
  }
68158
- console.log(chalk22.bold(`
68159
- ${page.path} ${chalk22.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk22.green(" ready") : ""));
68696
+ console.log(chalk23.bold(`
68697
+ ${page.path} ${chalk23.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk23.green(" ready") : ""));
68160
68698
  if (page.tasks === null) {
68161
- 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"));
68699
+ 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"));
68162
68700
  return 0;
68163
68701
  }
68164
68702
  if (page.tasks.length === 0) {
68165
- console.log(chalk22.gray(`
68703
+ console.log(chalk23.gray(`
68166
68704
  The capture saw no components on this page.
68167
68705
  `));
68168
68706
  return 0;
@@ -68173,22 +68711,22 @@ ${page.path} ${chalk22.gray(`(${page.kind})`)} — ${page.status}`) + (page.read
68173
68711
  if (!rows.length)
68174
68712
  continue;
68175
68713
  console.log(`
68176
- ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
68714
+ ${DISPOSITION_STYLE[d](chalk23.bold(d))} (${rows.length})`);
68177
68715
  for (const t of rows) {
68178
- console.log(` ${t.name} ${chalk22.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
68716
+ console.log(` ${t.name} ${chalk23.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
68179
68717
  if (t.note)
68180
- console.log(chalk22.gray(` why: ${t.note}`));
68718
+ console.log(chalk23.gray(` why: ${t.note}`));
68181
68719
  if (t.against?.kind === "reference") {
68182
- console.log(chalk22.cyan(` reference: ${t.against.url}`));
68720
+ console.log(chalk23.cyan(` reference: ${t.against.url}`));
68183
68721
  }
68184
68722
  if (t.source)
68185
- console.log(chalk22.green(` source: ${t.source}`));
68723
+ console.log(chalk23.green(` source: ${t.source}`));
68186
68724
  if (t.command)
68187
- console.log(chalk22.gray(` $ ${t.command}`));
68725
+ console.log(chalk23.gray(` $ ${t.command}`));
68188
68726
  }
68189
68727
  }
68190
68728
  if (page.counts.validate > 0 && !opts.cand) {
68191
- console.log(chalk22.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
68729
+ console.log(chalk23.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
68192
68730
  }
68193
68731
  console.log("");
68194
68732
  return 0;
@@ -68196,8 +68734,8 @@ ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
68196
68734
  function planStatusCommand(dir, asJson) {
68197
68735
  const plan = loadPlan(dir);
68198
68736
  if (!plan) {
68199
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68200
- console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
68737
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68738
+ console.error(chalk23.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
68201
68739
  return 1;
68202
68740
  }
68203
68741
  const p = planProgress(plan);
@@ -68208,59 +68746,63 @@ function planStatusCommand(dir, asJson) {
68208
68746
  return 0;
68209
68747
  }
68210
68748
  const c = p.components;
68211
- console.log(chalk22.bold(`
68749
+ console.log(chalk23.bold(`
68212
68750
  Migration plan — ${plan.url}${plan.target.name ? ` → ${plan.target.name}` : ""}`));
68751
+ const vanished = c.byStatus.vanished ? `, ${chalk23.gray(`${c.byStatus.vanished} vanished`)}` : "";
68213
68752
  console.log(`
68214
- ${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`)}`);
68753
+ ${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}`);
68215
68754
  if (c.accepted.upgrade.length) {
68216
- console.log(chalk22.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
68755
+ console.log(chalk23.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
68217
68756
  }
68218
68757
  if (c.accepted.asIs.length) {
68219
- console.log(chalk22.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68758
+ console.log(chalk23.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68220
68759
  }
68221
68760
  if (provenance.library > 0 || provenance.built > 0) {
68222
- const unrecorded = provenance.unrecorded > 0 ? chalk22.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68223
- console.log(` reuse: ${chalk22.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
68761
+ const unrecorded = provenance.unrecorded > 0 ? chalk23.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68762
+ console.log(` reuse: ${chalk23.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
68224
68763
  }
68225
68764
  if (touches > 0) {
68226
- console.log(chalk22.dim(` human touches: ${touches} across this migration`));
68765
+ console.log(chalk23.dim(` human touches: ${touches} across this migration`));
68227
68766
  }
68228
68767
  if (c.settledByStatus.done.length) {
68229
- console.log(chalk22.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68768
+ console.log(chalk23.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68230
68769
  }
68231
68770
  if (c.settledByStatus.skipped.length) {
68232
- console.log(chalk22.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
68771
+ console.log(chalk23.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
68772
+ }
68773
+ if (c.settledByStatus.vanished.length) {
68774
+ console.log(chalk23.gray(` gone from prod, shipped disabled: ${c.settledByStatus.vanished.join(", ")}`));
68233
68775
  }
68234
68776
  for (const r of c.remaining) {
68235
- const tag = r.status === "partial" ? chalk22.yellow("partial") : chalk22.red("pending");
68236
- console.log(` ${tag} ${r.name} ${chalk22.gray(`(${r.scope}, ${r.origin})`)}`);
68777
+ const tag = r.status === "partial" ? chalk23.yellow("partial") : chalk23.red("pending");
68778
+ console.log(` ${tag} ${r.name} ${chalk23.gray(`(${r.scope}, ${r.origin})`)}`);
68237
68779
  }
68238
68780
  const pg = p.pages;
68239
68781
  console.log(`
68240
- ${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`)}`);
68782
+ ${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`)}`);
68241
68783
  if (pg.awaitingContent.length) {
68242
- console.log(chalk22.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68784
+ console.log(chalk23.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68243
68785
  }
68244
68786
  for (const r of pg.remaining.filter((r) => r.status === "pending")) {
68245
- console.log(` ${chalk22.red("pending")} ${r.path} ${chalk22.gray(`(${r.kind})`)}`);
68787
+ console.log(` ${chalk23.red("pending")} ${r.path} ${chalk23.gray(`(${r.kind})`)}`);
68246
68788
  }
68247
68789
  console.log("");
68248
68790
  return 0;
68249
68791
  }
68250
68792
  var COLUMN_ORDER = ["triage", "backlog", "building", "review", "done"];
68251
68793
  var COLUMN_STYLE = {
68252
- triage: chalk22.magenta,
68253
- backlog: chalk22.red,
68254
- building: chalk22.yellow,
68255
- review: chalk22.cyan,
68256
- done: chalk22.green,
68257
- skipped: chalk22.gray
68794
+ triage: chalk23.magenta,
68795
+ backlog: chalk23.red,
68796
+ building: chalk23.yellow,
68797
+ review: chalk23.cyan,
68798
+ done: chalk23.green,
68799
+ skipped: chalk23.gray
68258
68800
  };
68259
68801
  async function planBoardCommand(dir, opts) {
68260
68802
  const plan = loadPlan(dir);
68261
68803
  if (!plan) {
68262
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68263
- console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
68804
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68805
+ console.error(chalk23.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
68264
68806
  return 1;
68265
68807
  }
68266
68808
  const board = planBoard(plan, opts.cand);
@@ -68268,46 +68810,46 @@ async function planBoardCommand(dir, opts) {
68268
68810
  console.log(JSON.stringify(board, null, 2));
68269
68811
  return 0;
68270
68812
  }
68271
- console.log(chalk22.bold(`
68813
+ console.log(chalk23.bold(`
68272
68814
  Board — ${board.url}`));
68273
- console.log(chalk22.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
68815
+ console.log(chalk23.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
68274
68816
  if (board.shell.length) {
68275
68817
  console.log(`
68276
- ${chalk22.bold("shell")} ${chalk22.gray("(global — blocks every page)")}: ${chalk22.yellow(board.shell.join(", "))}`);
68818
+ ${chalk23.bold("shell")} ${chalk23.gray("(global — blocks every page)")}: ${chalk23.yellow(board.shell.join(", "))}`);
68277
68819
  }
68278
68820
  for (const column of COLUMN_ORDER) {
68279
68821
  const cards = board.columns[column];
68280
68822
  if (!cards.length)
68281
68823
  continue;
68282
68824
  console.log(`
68283
- ${COLUMN_STYLE[column](chalk22.bold(column))} (${cards.length})`);
68825
+ ${COLUMN_STYLE[column](chalk23.bold(column))} (${cards.length})`);
68284
68826
  for (const card of cards) {
68285
- console.log(` ${card.path} ${chalk22.gray(`(${card.kind})`)}`);
68827
+ console.log(` ${card.path} ${chalk23.gray(`(${card.kind})`)}`);
68286
68828
  if (card.blockers.length) {
68287
- console.log(chalk22.gray(` blocked by: ${card.blockers.join(", ")}`));
68829
+ console.log(chalk23.gray(` blocked by: ${card.blockers.join(", ")}`));
68288
68830
  }
68289
68831
  }
68290
68832
  }
68291
68833
  const skipped = board.columns.skipped;
68292
68834
  if (skipped.length) {
68293
68835
  console.log(`
68294
- ${chalk22.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68836
+ ${chalk23.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68295
68837
  }
68296
68838
  if (board.unassigned.length) {
68297
68839
  console.log(`
68298
- ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled page)")}
68299
- ${chalk22.gray(board.unassigned.join(", "))}`);
68840
+ ${chalk23.bold("no page")} ${chalk23.gray("(in the code, not seen on any sampled page)")}
68841
+ ${chalk23.gray(board.unassigned.join(", "))}`);
68300
68842
  }
68301
68843
  console.log("");
68302
68844
  if (opts.board === "studio") {
68303
68845
  const cfg = studioConfigFromEnv();
68304
68846
  if (!cfg) {
68305
- console.log(chalk22.yellow(`Studio board skipped — ${STUDIO_LOGIN_HINT}. Showing the terminal board instead.
68847
+ console.log(chalk23.yellow(`Studio board skipped — ${STUDIO_LOGIN_HINT}. Showing the terminal board instead.
68306
68848
  `));
68307
68849
  return 0;
68308
68850
  }
68309
68851
  try {
68310
- const fixes = opts.fixes ? JSON.parse(readFileSync25(opts.fixes, "utf8")) : undefined;
68852
+ const fixes = opts.fixes ? JSON.parse(readFileSync26(opts.fixes, "utf8")) : undefined;
68311
68853
  const synced = await syncBoardToStudio(board, cfg, { repo: opts.repo, fixes });
68312
68854
  let stored = 0;
68313
68855
  for (const [path, id] of Object.entries(synced.ids)) {
@@ -68316,10 +68858,10 @@ ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled
68316
68858
  }
68317
68859
  if (stored)
68318
68860
  savePlan(dir, plan);
68319
- console.log(chalk22.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
68861
+ console.log(chalk23.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
68320
68862
  `));
68321
68863
  } catch (err) {
68322
- console.log(chalk22.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
68864
+ console.log(chalk23.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
68323
68865
  `));
68324
68866
  }
68325
68867
  }
@@ -68328,27 +68870,27 @@ ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled
68328
68870
  async function planNotesCommand(dir, opts) {
68329
68871
  const plan = loadPlan(dir);
68330
68872
  if (!plan) {
68331
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68873
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68332
68874
  return 1;
68333
68875
  }
68334
68876
  const cfg = studioConfigFromEnv();
68335
68877
  if (!cfg) {
68336
- console.error(chalk22.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68878
+ console.error(chalk23.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68337
68879
  return 1;
68338
68880
  }
68339
68881
  if (opts.post) {
68340
68882
  const page = plan.pages.find((p) => p.path === opts.page);
68341
68883
  if (!page?.boardItemId) {
68342
- console.error(chalk22.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
68884
+ console.error(chalk23.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
68343
68885
  return 1;
68344
68886
  }
68345
68887
  await postParityComment(page.boardItemId, opts.post, cfg);
68346
- console.log(`${chalk22.green("✓")} comment posted on ${page.path}`);
68888
+ console.log(`${chalk23.green("✓")} comment posted on ${page.path}`);
68347
68889
  return 0;
68348
68890
  }
68349
68891
  const pages = plan.pages.filter((p) => p.boardItemId).filter((p) => !opts.page || p.path === opts.page).map((p) => ({ path: p.path, boardItemId: p.boardItemId }));
68350
68892
  if (!pages.length) {
68351
- console.error(chalk22.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
68893
+ console.error(chalk23.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
68352
68894
  return 1;
68353
68895
  }
68354
68896
  const notes = await fetchClientNotes(pages, cfg);
@@ -68357,47 +68899,47 @@ async function planNotesCommand(dir, opts) {
68357
68899
  return 0;
68358
68900
  }
68359
68901
  if (!notes.length) {
68360
- console.log(chalk22.gray(`
68902
+ console.log(chalk23.gray(`
68361
68903
  No open client notes.
68362
68904
  `));
68363
68905
  return 0;
68364
68906
  }
68365
- console.log(chalk22.bold(`
68907
+ console.log(chalk23.bold(`
68366
68908
  Client notes (${notes.length})`));
68367
68909
  for (const n of notes) {
68368
68910
  console.log(`
68369
- ${chalk22.cyan(n.path)} ${chalk22.gray(n.createdAt)}`);
68911
+ ${chalk23.cyan(n.path)} ${chalk23.gray(n.createdAt)}`);
68370
68912
  for (const line of n.body.split(`
68371
68913
  `))
68372
68914
  console.log(` ${line}`);
68373
68915
  }
68374
- 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'));
68916
+ 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'));
68375
68917
  return 0;
68376
68918
  }
68377
68919
  var PROVENANCES = ["library", "built"];
68378
68920
  function planSetProvenanceCommand(dir, name, provenance) {
68379
68921
  if (!PROVENANCES.includes(provenance)) {
68380
- console.error(chalk22.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
68922
+ console.error(chalk23.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
68381
68923
  return 1;
68382
68924
  }
68383
68925
  const plan = loadPlan(dir);
68384
68926
  if (!plan) {
68385
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68927
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68386
68928
  return 1;
68387
68929
  }
68388
68930
  const component = setComponentProvenance(plan, name, provenance);
68389
68931
  if (!component) {
68390
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68932
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68391
68933
  return 1;
68392
68934
  }
68393
68935
  savePlan(dir, plan);
68394
- console.log(`${chalk22.green("✓")} ${component.name} → ${provenance}`);
68936
+ console.log(`${chalk23.green("✓")} ${component.name} → ${provenance}`);
68395
68937
  return 0;
68396
68938
  }
68397
68939
  function planTouchCommand(dir, page, opts) {
68398
68940
  const plan = loadPlan(dir);
68399
68941
  if (!plan) {
68400
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68942
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68401
68943
  return 1;
68402
68944
  }
68403
68945
  const count = recordTouch(plan, page);
@@ -68405,20 +68947,20 @@ function planTouchCommand(dir, page, opts) {
68405
68947
  if (opts.json) {
68406
68948
  console.log(JSON.stringify({ page, touches: count, total: totalTouches(plan) }));
68407
68949
  } else {
68408
- console.log(`${chalk22.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
68950
+ console.log(`${chalk23.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
68409
68951
  }
68410
68952
  return 0;
68411
68953
  }
68412
68954
 
68413
68955
  // src/commands/pr.ts
68414
- import { existsSync as existsSync22, readFileSync as readFileSync28, writeFileSync as writeFileSync26 } from "node:fs";
68956
+ import { existsSync as existsSync23, readFileSync as readFileSync29, writeFileSync as writeFileSync26 } from "node:fs";
68415
68957
  import { join as join35 } from "node:path";
68416
- import chalk25 from "chalk";
68958
+ import chalk26 from "chalk";
68417
68959
 
68418
68960
  // src/commands/run.ts
68419
- import { existsSync as existsSync21, readFileSync as readFileSync27, unlinkSync as unlinkSync3 } from "node:fs";
68961
+ import { existsSync as existsSync22, readFileSync as readFileSync28, unlinkSync as unlinkSync3 } from "node:fs";
68420
68962
  import { join as join34 } from "node:path";
68421
- import chalk24 from "chalk";
68963
+ import chalk25 from "chalk";
68422
68964
  import ora8 from "ora";
68423
68965
 
68424
68966
  // src/diff/score-band.ts
@@ -69006,11 +69548,11 @@ function formatMs(ms) {
69006
69548
  }
69007
69549
 
69008
69550
  // src/commands/serve.ts
69009
- import { existsSync as existsSync20 } from "node:fs";
69010
- import chalk23 from "chalk";
69551
+ import { existsSync as existsSync21 } from "node:fs";
69552
+ import chalk24 from "chalk";
69011
69553
 
69012
69554
  // src/server/proxy-server.ts
69013
- import { existsSync as existsSync19, readFileSync as readFileSync26, statSync as statSync2 } from "node:fs";
69555
+ import { existsSync as existsSync20, readFileSync as readFileSync27, statSync as statSync2 } from "node:fs";
69014
69556
  import { createServer } from "node:http";
69015
69557
  import { extname, join as join33, normalize as normalize3, resolve as resolve8, sep } from "node:path";
69016
69558
  var MIME3 = {
@@ -69050,7 +69592,7 @@ var STRIPPED_REQUEST_HEADERS = new Set([
69050
69592
  var scrollBeacons = [];
69051
69593
  async function startProxyServer(runDir, opts = {}) {
69052
69594
  const absRunDir = resolve8(runDir);
69053
- if (!existsSync19(absRunDir)) {
69595
+ if (!existsSync20(absRunDir)) {
69054
69596
  throw new Error(`Run directory not found: ${runDir}`);
69055
69597
  }
69056
69598
  const server = createServer((req, res) => {
@@ -69121,12 +69663,12 @@ async function handleRequest(req, res, runDir) {
69121
69663
  }
69122
69664
  function serveReportHtml(res, runDir) {
69123
69665
  const filePath = join33(runDir, "report.html");
69124
- if (!existsSync19(filePath)) {
69666
+ if (!existsSync20(filePath)) {
69125
69667
  res.statusCode = 404;
69126
69668
  res.end("report.html not found");
69127
69669
  return;
69128
69670
  }
69129
- const html = readFileSync26(filePath, "utf8");
69671
+ const html = readFileSync27(filePath, "utf8");
69130
69672
  const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
69131
69673
  const out = html.includes("</head>") ? html.replace("</head>", `${inject}</head>`) : `${inject}${html}`;
69132
69674
  res.statusCode = 200;
@@ -69142,7 +69684,7 @@ function serveStatic(res, runDir, path) {
69142
69684
  res.end("forbidden");
69143
69685
  return;
69144
69686
  }
69145
- if (!existsSync19(filePath)) {
69687
+ if (!existsSync20(filePath)) {
69146
69688
  res.statusCode = 404;
69147
69689
  res.end("not found");
69148
69690
  return;
@@ -69157,7 +69699,7 @@ function serveStatic(res, runDir, path) {
69157
69699
  res.statusCode = 200;
69158
69700
  res.setHeader("content-type", MIME3[ext] ?? "application/octet-stream");
69159
69701
  res.setHeader("cache-control", "no-store");
69160
- res.end(readFileSync26(filePath));
69702
+ res.end(readFileSync27(filePath));
69161
69703
  }
69162
69704
  async function proxyRequest(req, res, targetUrl, opts = {}) {
69163
69705
  let target;
@@ -69280,16 +69822,16 @@ async function serveRunAndBlock(runDir, opts = {}) {
69280
69822
  try {
69281
69823
  handle = await startProxyServer(runDir, { port: opts.port });
69282
69824
  } catch (err) {
69283
- console.error(chalk23.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69825
+ console.error(chalk24.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69284
69826
  return 2;
69285
69827
  }
69286
69828
  const label = opts.label ?? "parity serve";
69287
69829
  console.log("");
69288
- console.log(chalk23.bold(` ${label}`));
69289
- console.log(` ${chalk23.green("●")} ${handle.url}`);
69290
- console.log(chalk23.dim(` Servindo: ${runDir}`));
69291
- console.log(chalk23.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69292
- console.log(chalk23.dim(` Ctrl+C pra parar (2x pra forçar saída).
69830
+ console.log(chalk24.bold(` ${label}`));
69831
+ console.log(` ${chalk24.green("●")} ${handle.url}`);
69832
+ console.log(chalk24.dim(` Servindo: ${runDir}`));
69833
+ console.log(chalk24.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69834
+ console.log(chalk24.dim(` Ctrl+C pra parar (2x pra forçar saída).
69293
69835
  `));
69294
69836
  if (opts.open !== false) {
69295
69837
  const { default: open } = await import("open");
@@ -69321,12 +69863,12 @@ async function serveRunAndBlock(runDir, opts = {}) {
69321
69863
  }
69322
69864
  async function serveCommand(runId, opts) {
69323
69865
  const paths = getRunPaths(opts.output, runId);
69324
- if (!existsSync20(paths.runDir)) {
69325
- console.error(chalk23.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
69866
+ if (!existsSync21(paths.runDir)) {
69867
+ console.error(chalk24.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
69326
69868
  return 1;
69327
69869
  }
69328
- if (!existsSync20(paths.reportHtml)) {
69329
- console.error(chalk23.red(`✖ report.html não existe em ${paths.runDir}`));
69870
+ if (!existsSync21(paths.reportHtml)) {
69871
+ console.error(chalk24.red(`✖ report.html não existe em ${paths.runDir}`));
69330
69872
  return 1;
69331
69873
  }
69332
69874
  return serveRunAndBlock(paths.runDir, {
@@ -69476,7 +70018,7 @@ function evaluateFailOnGate(allIssues, failOn, verdictStatus) {
69476
70018
  var SCORE_BAND_RUNS = 4;
69477
70019
  function readRunChecks(reportPath) {
69478
70020
  try {
69479
- const raw = JSON.parse(readFileSync27(reportPath, "utf8"));
70021
+ const raw = JSON.parse(readFileSync28(reportPath, "utf8"));
69480
70022
  return (raw.checks ?? []).filter((c) => typeof c.name === "string" && typeof c.status === "string").map((c) => ({ name: c.name, status: c.status }));
69481
70023
  } catch {
69482
70024
  return [];
@@ -69485,14 +70027,14 @@ function readRunChecks(reportPath) {
69485
70027
  async function runCommand(rawOpts) {
69486
70028
  if (!rawOpts.prod) {
69487
70029
  const target = rawOpts.cand ?? "<url>";
69488
- console.error(`${chalk24.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
69489
- For one site, use: ${chalk24.cyan(`parity e2e --url ${target}`)}
70030
+ console.error(`${chalk25.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
70031
+ For one site, use: ${chalk25.cyan(`parity e2e --url ${target}`)}
69490
70032
  (runs the functional flows + all checks in single-site mode — no prod baseline needed).`);
69491
70033
  return 2;
69492
70034
  }
69493
70035
  let opts = applyPreset(rawOpts);
69494
70036
  if (rawOpts.preset) {
69495
- console.log(chalk24.dim(` preset: ${rawOpts.preset}`));
70037
+ console.log(chalk25.dim(` preset: ${rawOpts.preset}`));
69496
70038
  }
69497
70039
  if (opts.pt)
69498
70040
  setLlmLanguage("pt");
@@ -69500,14 +70042,14 @@ async function runCommand(rawOpts) {
69500
70042
  disableInteractive();
69501
70043
  const llmCfgErr = applyLlmOptions(opts);
69502
70044
  if (llmCfgErr) {
69503
- console.error(chalk24.red(` ${llmCfgErr}`));
70045
+ console.error(chalk25.red(` ${llmCfgErr}`));
69504
70046
  return 2;
69505
70047
  }
69506
70048
  const llmStillAvailable = isLlmAvailable();
69507
70049
  const preSmart = opts;
69508
70050
  opts = applySmartDefaults(opts, llmStillAvailable);
69509
70051
  if (!llmStillAvailable && opts.visualPages !== preSmart.visualPages) {
69510
- console.log(chalk24.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
70052
+ console.log(chalk25.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
69511
70053
  }
69512
70054
  let interactivePromptShown = false;
69513
70055
  if (!opts.only && !opts.skip && !rawOpts.preset) {
@@ -69533,14 +70075,14 @@ async function runCommand(rawOpts) {
69533
70075
  if (isContentProfile && !opts.only && !opts.skip) {
69534
70076
  opts.only = "seo,visual,vitals,cache,console,html,network";
69535
70077
  moduleDropReason = "profile: content → e2e module dropped (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force";
69536
- console.log(chalk24.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
70078
+ console.log(chalk25.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
69537
70079
  }
69538
70080
  const selection = resolveSelection({ only: opts.only, skip: opts.skip });
69539
70081
  if (selection.errors.length > 0) {
69540
- console.error(chalk24.red(" --only/--skip: invalid value(s):"));
70082
+ console.error(chalk25.red(" --only/--skip: invalid value(s):"));
69541
70083
  for (const e of selection.errors)
69542
- console.error(chalk24.red(` - ${e}`));
69543
- console.error(chalk24.dim(`
70084
+ console.error(chalk25.red(` - ${e}`));
70085
+ console.error(chalk25.dim(`
69544
70086
  valid modules: ${Object.keys(MODULES).join(", ")}`));
69545
70087
  return 2;
69546
70088
  }
@@ -69552,14 +70094,14 @@ async function runCommand(rawOpts) {
69552
70094
  const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
69553
70095
  const scoped = resolveScopedFlows({ explicitFlows, selectionFlows: selection.flows });
69554
70096
  flows = scoped.flows;
69555
- console.log(chalk24.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
70097
+ console.log(chalk25.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
69556
70098
  if (scoped.starved.length > 0) {
69557
- console.log(chalk24.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
70099
+ console.log(chalk25.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
69558
70100
  }
69559
70101
  } else {
69560
70102
  flows = opts.flows.split(",").map((s) => s.trim());
69561
70103
  if (!interactivePromptShown) {
69562
- console.log(chalk24.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
70104
+ console.log(chalk25.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
69563
70105
  }
69564
70106
  }
69565
70107
  if (isContentProfile) {
@@ -69568,12 +70110,12 @@ async function runCommand(rawOpts) {
69568
70110
  if (!flows.includes("homepage"))
69569
70111
  flows.unshift("homepage");
69570
70112
  if (before !== flows.join(",")) {
69571
- console.log(chalk24.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
70113
+ console.log(chalk25.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
69572
70114
  }
69573
70115
  }
69574
70116
  const pagesScopeWarning = pagesFlowsScopeWarning(opts, flows);
69575
70117
  if (pagesScopeWarning) {
69576
- console.log(chalk24.dim(` ${pagesScopeWarning}`));
70118
+ console.log(chalk25.dim(` ${pagesScopeWarning}`));
69577
70119
  }
69578
70120
  if (hasSelection) {
69579
70121
  const needsSitemapPages = selection.modules.some((m) => MODULES[m].needsSitemapPages);
@@ -69582,12 +70124,12 @@ async function runCommand(rawOpts) {
69582
70124
  const VISUAL_PAGES_DEFAULT = 5;
69583
70125
  if (!needsSitemapPages && opts.vitalsPages === VITALS_PAGES_DEFAULT) {
69584
70126
  opts.vitalsPages = 0;
69585
- console.log(chalk24.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
70127
+ console.log(chalk25.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
69586
70128
  }
69587
70129
  if (!needsLlmPass && opts.visualPages === VISUAL_PAGES_DEFAULT) {
69588
70130
  opts.visualPages = 0;
69589
70131
  opts.noVisualDiff = true;
69590
- console.log(chalk24.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
70132
+ console.log(chalk25.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
69591
70133
  }
69592
70134
  }
69593
70135
  const viewports = opts.viewports.split(",").map((s) => s.trim());
@@ -69601,37 +70143,37 @@ async function runCommand(rawOpts) {
69601
70143
  const ignore = loadParityIgnore();
69602
70144
  if (opts.clearCache) {
69603
70145
  const cacheFile = join34(opts.output, "cache", "verdicts.json");
69604
- if (existsSync21(cacheFile)) {
70146
+ if (existsSync22(cacheFile)) {
69605
70147
  try {
69606
70148
  unlinkSync3(cacheFile);
69607
- console.log(chalk24.dim(` cache wiped: ${cacheFile}`));
70149
+ console.log(chalk25.dim(` cache wiped: ${cacheFile}`));
69608
70150
  } catch (err) {
69609
- console.log(chalk24.yellow(` cache wipe falhou: ${err.message}`));
70151
+ console.log(chalk25.yellow(` cache wipe falhou: ${err.message}`));
69610
70152
  }
69611
70153
  }
69612
70154
  }
69613
70155
  const llmTimeoutRaw = opts.llmTimeout ?? 60;
69614
70156
  if (!Number.isFinite(llmTimeoutRaw)) {
69615
- console.error(chalk24.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
70157
+ console.error(chalk25.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
69616
70158
  return 2;
69617
70159
  }
69618
70160
  const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
69619
70161
  if (isLlmAvailable()) {
69620
- console.log(chalk24.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
70162
+ console.log(chalk25.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
69621
70163
  } else {
69622
- console.log(chalk24.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
70164
+ console.log(chalk25.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
69623
70165
  }
69624
70166
  if (isInteractiveMode()) {
69625
- console.log(chalk24.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
70167
+ console.log(chalk25.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
69626
70168
  }
69627
70169
  const primaryViewport = viewports[0] ?? "mobile";
69628
70170
  const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
69629
70171
  if (!preflight.ok) {
69630
- console.error(chalk24.red(`
70172
+ console.error(chalk25.red(`
69631
70173
  ✖ pre-flight falhou:`));
69632
70174
  for (const err of preflight.errors)
69633
- console.error(chalk24.red(` - ${err}`));
69634
- console.error(chalk24.dim(`
70175
+ console.error(chalk25.red(` - ${err}`));
70176
+ console.error(chalk25.dim(`
69635
70177
  dica: verifique se as URLs estão corretas e acessíveis`));
69636
70178
  return 2;
69637
70179
  }
@@ -69642,7 +70184,7 @@ async function runCommand(rawOpts) {
69642
70184
  if (prodHomeHtml) {
69643
70185
  platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
69644
70186
  if (platform !== "custom") {
69645
- console.log(chalk24.dim(` Detected platform: ${platform}`));
70187
+ console.log(chalk25.dim(` Detected platform: ${platform}`));
69646
70188
  }
69647
70189
  }
69648
70190
  const prodHost = hostOf3(opts.prod);
@@ -69677,11 +70219,11 @@ async function runCommand(rawOpts) {
69677
70219
  viewports,
69678
70220
  timestamp
69679
70221
  });
69680
- console.log(chalk24.bold(`
70222
+ console.log(chalk25.bold(`
69681
70223
  parity run ${runId}`));
69682
- console.log(chalk24.dim(` prod: ${opts.prod}`));
69683
- console.log(chalk24.dim(` cand: ${opts.cand}`));
69684
- console.log(chalk24.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
70224
+ console.log(chalk25.dim(` prod: ${opts.prod}`));
70225
+ console.log(chalk25.dim(` cand: ${opts.cand}`));
70226
+ console.log(chalk25.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
69685
70227
  `));
69686
70228
  const spinner = ora8("Launching browser…").start();
69687
70229
  let browser = null;
@@ -69693,7 +70235,7 @@ async function runCommand(rawOpts) {
69693
70235
  const min = Math.floor(elapsedSec / 60);
69694
70236
  const sec = elapsedSec % 60;
69695
70237
  const mmss = `${min.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
69696
- spinner.text = `${chalk24.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
70238
+ spinner.text = `${chalk25.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
69697
70239
  };
69698
70240
  const setSpinnerLabel = (label) => {
69699
70241
  currentSpinnerLabel = label;
@@ -69813,8 +70355,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69813
70355
  for (const flow of flows) {
69814
70356
  const flowStart = Date.now();
69815
70357
  let lastStepTotal = 0;
69816
- const sideTag = side === "prod" ? chalk24.cyan("prod") : chalk24.magenta("cand");
69817
- const prefix = `${chalk24.dim(`[${viewport}/`)}${sideTag}${chalk24.dim("]")}`;
70358
+ const sideTag = side === "prod" ? chalk25.cyan("prod") : chalk25.magenta("cand");
70359
+ const prefix = `${chalk25.dim(`[${viewport}/`)}${sideTag}${chalk25.dim("]")}`;
69818
70360
  setSpinnerLabel(`${prefix} ${flow}: starting…`);
69819
70361
  const cap = await runFlow(flow, {
69820
70362
  baseUrl,
@@ -69831,7 +70373,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69831
70373
  onStep: (event) => {
69832
70374
  if (event.phase === "start") {
69833
70375
  lastStepTotal = event.total;
69834
- setSpinnerLabel(`${prefix} ${flow} ${chalk24.dim(`${event.index}/${event.total}`)} ${event.name}…`);
70376
+ setSpinnerLabel(`${prefix} ${flow} ${chalk25.dim(`${event.index}/${event.total}`)} ${event.name}…`);
69835
70377
  }
69836
70378
  }
69837
70379
  });
@@ -69840,18 +70382,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69840
70382
  const target = lastStepTotal || recorded;
69841
70383
  const failed = cap.steps?.find((s) => s.status === "failed");
69842
70384
  const lastStep = cap.steps?.[cap.steps.length - 1];
69843
- const elapsedDim = chalk24.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
69844
- const counts = target > 0 ? chalk24.dim(`${okSteps}/${target}`) : "";
70385
+ const elapsedDim = chalk25.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
70386
+ const counts = target > 0 ? chalk25.dim(`${okSteps}/${target}`) : "";
69845
70387
  let glyph;
69846
70388
  let detail;
69847
70389
  if (failed) {
69848
- glyph = chalk24.red("✗");
69849
- detail = `stopped at ${chalk24.yellow(failed.name)}`;
70390
+ glyph = chalk25.red("✗");
70391
+ detail = `stopped at ${chalk25.yellow(failed.name)}`;
69850
70392
  } else if (target > 0 && okSteps < target) {
69851
- glyph = chalk24.yellow("▴");
69852
- detail = lastStep ? `ended at ${chalk24.dim(lastStep.name)}` : "incomplete";
70393
+ glyph = chalk25.yellow("▴");
70394
+ detail = lastStep ? `ended at ${chalk25.dim(lastStep.name)}` : "incomplete";
69853
70395
  } else {
69854
- glyph = chalk24.green("✓");
70396
+ glyph = chalk25.green("✓");
69855
70397
  detail = "";
69856
70398
  }
69857
70399
  const summary = `${glyph} ${prefix} ${flow} ${counts} ${detail} ${elapsedDim}`.replace(/\s+/g, " ").trim();
@@ -69913,7 +70455,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69913
70455
  const vitalsPagesLimit = opts.vitalsPages ?? vitalsPagesDefault;
69914
70456
  const vitalsRuns = Math.max(1, Number.parseInt(opts.runs, 10) || 1);
69915
70457
  if (candIsDevServer && vitalsPagesLimit > 0) {
69916
- console.log(chalk24.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
70458
+ console.log(chalk25.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
69917
70459
  }
69918
70460
  if (browser && vitalsPagesLimit > 0) {
69919
70461
  currentPhase = "vitals-pages";
@@ -70260,12 +70802,12 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
70260
70802
  totalIssues: allIssues.length,
70261
70803
  verdict: { status: verdict.status, score: verdict.score, scoreVersion: SCORE_VERSION }
70262
70804
  });
70263
- printSummary7(run, paths.reportHtml, { promotedCount, deprecatedCount, platform });
70805
+ printSummary8(run, paths.reportHtml, { promotedCount, deprecatedCount, platform });
70264
70806
  console.log(`
70265
70807
  ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
70266
70808
  const failOnGate = evaluateFailOnGate(allIssues, failOn, verdict.status);
70267
70809
  if (failOnGate.exitCode === 1) {
70268
- console.log(chalk24.red(failOnGate.message));
70810
+ console.log(chalk25.red(failOnGate.message));
70269
70811
  return 1;
70270
70812
  }
70271
70813
  if (opts.open) {
@@ -70335,10 +70877,10 @@ function parsePagePair(entry) {
70335
70877
  }
70336
70878
  function resolveExplicitPages(pagesFile, pagesList) {
70337
70879
  if (pagesFile) {
70338
- if (!existsSync21(pagesFile)) {
70880
+ if (!existsSync22(pagesFile)) {
70339
70881
  throw new Error(`--pages-file não encontrado: ${pagesFile}`);
70340
70882
  }
70341
- const raw = readFileSync27(pagesFile, "utf-8");
70883
+ const raw = readFileSync28(pagesFile, "utf-8");
70342
70884
  const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
70343
70885
  for (const line of lines)
70344
70886
  validatePageEntry(line, [], true);
@@ -70489,63 +71031,63 @@ function hostOf3(url) {
70489
71031
  return url;
70490
71032
  }
70491
71033
  }
70492
- function printSummary7(run, htmlPath, meta) {
71034
+ function printSummary8(run, htmlPath, meta) {
70493
71035
  const { verdict } = run;
70494
71036
  const inconclusive = verdict.status === "inconclusive";
70495
- const emoji = inconclusive ? chalk24.dim("○") : verdict.status === "pass" ? chalk24.green("✔") : verdict.status === "warn" ? chalk24.yellow("⚠") : chalk24.red("✖");
70496
- const score = inconclusive ? chalk24.dim("—") : verdict.status === "pass" ? chalk24.green(verdict.score) : verdict.status === "warn" ? chalk24.yellow(verdict.score) : chalk24.red(verdict.score);
71037
+ const emoji = inconclusive ? chalk25.dim("○") : verdict.status === "pass" ? chalk25.green("✔") : verdict.status === "warn" ? chalk25.yellow("⚠") : chalk25.red("✖");
71038
+ const score = inconclusive ? chalk25.dim("—") : verdict.status === "pass" ? chalk25.green(verdict.score) : verdict.status === "warn" ? chalk25.yellow(verdict.score) : chalk25.red(verdict.score);
70497
71039
  const prev = run.previousRun;
70498
- 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})`);
71040
+ 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})`);
70499
71041
  console.log("");
70500
71042
  if (inconclusive) {
70501
71043
  console.log(` ${emoji} parity INCONCLUSIVE · nothing was measured (0 checks ran)`);
70502
71044
  } else {
70503
71045
  console.log(` ${emoji} parity ${verdict.status.toUpperCase()} · score ${score}/100${scoreDelta}`);
70504
71046
  }
70505
- console.log(` checks: ${chalk24.green(verdict.checksPassed)} pass · ${chalk24.red(verdict.checksFailed)} fail · ${chalk24.dim(`${verdict.checksSkipped} skipped`)}`);
70506
- console.log(` issues: ${chalk24.red(verdict.critical)} critical · ${chalk24.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk24.dim(`${verdict.low} low`)}`);
71047
+ console.log(` checks: ${chalk25.green(verdict.checksPassed)} pass · ${chalk25.red(verdict.checksFailed)} fail · ${chalk25.dim(`${verdict.checksSkipped} skipped`)}`);
71048
+ console.log(` issues: ${chalk25.red(verdict.critical)} critical · ${chalk25.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk25.dim(`${verdict.low} low`)}`);
70507
71049
  const band = run.scoreBand;
70508
71050
  const bandLine = band ? formatScoreBand(band) : null;
70509
71051
  if (band && bandLine) {
70510
- console.log(` ${chalk24.dim(bandLine)}`);
71052
+ console.log(` ${chalk25.dim(bandLine)}`);
70511
71053
  const caveat = scoreBandCaveat(band);
70512
71054
  if (caveat)
70513
- console.log(` ${chalk24.yellow("⚠")} ${caveat}`);
71055
+ console.log(` ${chalk25.yellow("⚠")} ${caveat}`);
70514
71056
  }
70515
71057
  for (const c of run.caveats ?? []) {
70516
- const mark = c.level === "warn" ? chalk24.yellow("⚠") : chalk24.dim("ℹ");
71058
+ const mark = c.level === "warn" ? chalk25.yellow("⚠") : chalk25.dim("ℹ");
70517
71059
  console.log(` ${mark} ${c.summary}`);
70518
71060
  }
70519
71061
  if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
70520
71062
  const perModule = run.moduleVerdicts.map((mv) => {
70521
- const colored = mv.status === "pass" ? chalk24.green(mv.score) : mv.status === "warn" ? chalk24.yellow(mv.score) : chalk24.red(mv.score);
71063
+ const colored = mv.status === "pass" ? chalk25.green(mv.score) : mv.status === "warn" ? chalk25.yellow(mv.score) : chalk25.red(mv.score);
70522
71064
  return `${mv.module} ${colored}`;
70523
71065
  }).join(" · ");
70524
71066
  console.log(` modules: ${perModule} → composite ${score}`);
70525
71067
  }
70526
71068
  if (run.visualDiff) {
70527
71069
  const vd = run.visualDiff;
70528
- const parityIcon = vd.parityOk ? chalk24.green("✔") : chalk24.red("✖");
70529
- const parityLabel = vd.parityOk ? chalk24.green("OK") : chalk24.red("DIFFS");
70530
- const cacheNote = vd.pagesFromCache > 0 ? chalk24.dim(` · ${vd.pagesFromCache} cached`) : "";
70531
- console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk24.red(vd.pagesWithDiffs)} diffs · ${chalk24.green(vd.pagesPassed)} pass${cacheNote}`);
71070
+ const parityIcon = vd.parityOk ? chalk25.green("✔") : chalk25.red("✖");
71071
+ const parityLabel = vd.parityOk ? chalk25.green("OK") : chalk25.red("DIFFS");
71072
+ const cacheNote = vd.pagesFromCache > 0 ? chalk25.dim(` · ${vd.pagesFromCache} cached`) : "";
71073
+ console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk25.red(vd.pagesWithDiffs)} diffs · ${chalk25.green(vd.pagesPassed)} pass${cacheNote}`);
70532
71074
  }
70533
71075
  if (run.topIssues.length > 0) {
70534
71076
  console.log("");
70535
- console.log(chalk24.bold(" Top issues:"));
71077
+ console.log(chalk25.bold(" Top issues:"));
70536
71078
  for (const g of groupIssues(run.topIssues).slice(0, 5)) {
70537
71079
  const i = g.sample;
70538
- const sev = i.severity === "critical" ? chalk24.red(`[${i.severity}]`) : i.severity === "high" ? chalk24.yellow(`[${i.severity}]`) : chalk24.dim(`[${i.severity}]`);
70539
- const pagesNote = g.pages.length > 1 ? chalk24.dim(` (${g.pages.length} páginas)`) : "";
71080
+ const sev = i.severity === "critical" ? chalk25.red(`[${i.severity}]`) : i.severity === "high" ? chalk25.yellow(`[${i.severity}]`) : chalk25.dim(`[${i.severity}]`);
71081
+ const pagesNote = g.pages.length > 1 ? chalk25.dim(` (${g.pages.length} páginas)`) : "";
70540
71082
  console.log(` ${sev} ${i.summary}${pagesNote}`);
70541
71083
  }
70542
71084
  }
70543
71085
  if (meta.promotedCount > 0 || meta.deprecatedCount > 0) {
70544
71086
  console.log("");
70545
- console.log(chalk24.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk24.green(`+${meta.promotedCount}`)} promoted · ${chalk24.yellow(meta.deprecatedCount)} deprecated`));
71087
+ console.log(chalk25.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk25.green(`+${meta.promotedCount}`)} promoted · ${chalk25.yellow(meta.deprecatedCount)} deprecated`));
70546
71088
  }
70547
71089
  console.log("");
70548
- console.log(chalk24.dim(` → ${htmlPath}`));
71090
+ console.log(chalk25.dim(` → ${htmlPath}`));
70549
71091
  console.log("");
70550
71092
  }
70551
71093
 
@@ -70569,26 +71111,26 @@ async function prCommand(opts) {
70569
71111
  preset: opts.preset ?? "ci",
70570
71112
  open: false
70571
71113
  };
70572
- console.log(chalk25.dim(` prod : ${opts.prod}`));
70573
- console.log(chalk25.dim(` preview : ${opts.preview}`));
71114
+ console.log(chalk26.dim(` prod : ${opts.prod}`));
71115
+ console.log(chalk26.dim(` preview : ${opts.preview}`));
70574
71116
  console.log("");
70575
71117
  const runCode = await runCommand(runOpts);
70576
71118
  const runs = listRuns(opts.output);
70577
71119
  if (runs.length === 0) {
70578
- console.error(chalk25.red("no run was produced — cannot build PR comment"));
71120
+ console.error(chalk26.red("no run was produced — cannot build PR comment"));
70579
71121
  return runCode || 1;
70580
71122
  }
70581
71123
  const latest = runs[0];
70582
71124
  const reportJsonPath = join35(opts.output, "runs", latest.id, "report.json");
70583
- if (!existsSync22(reportJsonPath)) {
70584
- console.error(chalk25.red(`report.json not found at ${reportJsonPath}`));
71125
+ if (!existsSync23(reportJsonPath)) {
71126
+ console.error(chalk26.red(`report.json not found at ${reportJsonPath}`));
70585
71127
  return runCode || 1;
70586
71128
  }
70587
- const run = JSON.parse(readFileSync28(reportJsonPath, "utf8"));
71129
+ const run = JSON.parse(readFileSync29(reportJsonPath, "utf8"));
70588
71130
  const markdown = buildPrComment(run, opts);
70589
71131
  if (opts.out) {
70590
71132
  writeFileSync26(opts.out, markdown, "utf8");
70591
- console.log(chalk25.dim(` wrote PR comment: ${opts.out}`));
71133
+ console.log(chalk26.dim(` wrote PR comment: ${opts.out}`));
70592
71134
  } else {
70593
71135
  process.stdout.write(`
70594
71136
  ${markdown}
@@ -70598,7 +71140,7 @@ ${markdown}
70598
71140
  try {
70599
71141
  writeFileSync26(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
70600
71142
  } catch (err) {
70601
- console.error(chalk25.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
71143
+ console.error(chalk26.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
70602
71144
  }
70603
71145
  }
70604
71146
  return runCode;
@@ -70658,14 +71200,14 @@ function buildPrComment(run, opts) {
70658
71200
  }
70659
71201
 
70660
71202
  // src/commands/prompt.ts
70661
- import { existsSync as existsSync23, writeFileSync as writeFileSync27 } from "node:fs";
70662
- import chalk26 from "chalk";
71203
+ import { existsSync as existsSync24, writeFileSync as writeFileSync27 } from "node:fs";
71204
+ import chalk27 from "chalk";
70663
71205
  function promptCommand(runId, opts) {
70664
71206
  let run;
70665
71207
  try {
70666
71208
  run = loadRun(opts.output, runId);
70667
71209
  } catch (err) {
70668
- console.error(chalk26.red(`✖ ${err.message}`));
71210
+ console.error(chalk27.red(`✖ ${err.message}`));
70669
71211
  return 1;
70670
71212
  }
70671
71213
  const md = buildLlmPrompt(run, {
@@ -70674,10 +71216,10 @@ function promptCommand(runId, opts) {
70674
71216
  });
70675
71217
  if (opts.out) {
70676
71218
  writeFileSync27(opts.out, md, "utf8");
70677
- console.log(chalk26.green(`✔ prompt salvo em ${opts.out}`));
70678
- if (existsSync23(opts.out)) {
71219
+ console.log(chalk27.green(`✔ prompt salvo em ${opts.out}`));
71220
+ if (existsSync24(opts.out)) {
70679
71221
  const sizeKb = (md.length / 1024).toFixed(1);
70680
- console.log(chalk26.dim(` ${md.length} chars (${sizeKb} KB)`));
71222
+ console.log(chalk27.dim(` ${md.length} chars (${sizeKb} KB)`));
70681
71223
  }
70682
71224
  } else {
70683
71225
  process.stdout.write(md);
@@ -70686,9 +71228,9 @@ function promptCommand(runId, opts) {
70686
71228
  }
70687
71229
 
70688
71230
  // src/commands/report.ts
70689
- import { existsSync as existsSync24, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "node:fs";
71231
+ import { existsSync as existsSync25, readFileSync as readFileSync30, writeFileSync as writeFileSync28 } from "node:fs";
70690
71232
  import { join as join36 } from "node:path";
70691
- import chalk27 from "chalk";
71233
+ import chalk28 from "chalk";
70692
71234
  import open2 from "open";
70693
71235
 
70694
71236
  // src/report/deck-template.ts
@@ -70992,7 +71534,7 @@ function blockPages(blocks, lang) {
70992
71534
  const legend = `<div class="legend">${[
70993
71535
  ["ok", "feito", "done"],
70994
71536
  ["new", "upgrade", "upgrade"],
70995
- ["warn", "parcial / as-is / skipped", "partial / as-is / skipped"],
71537
+ ["warn", "parcial / as-is / skipped / vanished", "partial / as-is / skipped / vanished"],
70996
71538
  ["gap", "pendente", "pending"]
70997
71539
  ].map(([tone, pt, en]) => `<span class="lg"><i class="cell ${CELL_CLASS[tone]}"></i>${L2(pt, en, lang)}</span>`).join("")}</div>`;
70998
71540
  const zones = blocks.zones.map((z) => {
@@ -71098,6 +71640,7 @@ var TONE_BY_STATUS = {
71098
71640
  partial: "warn",
71099
71641
  "as-is": "warn",
71100
71642
  skipped: "warn",
71643
+ vanished: "warn",
71101
71644
  pending: "gap"
71102
71645
  };
71103
71646
  function buildDeckBlocks(plan) {
@@ -71368,7 +71911,7 @@ async function reportCommand(runId, opts) {
71368
71911
  try {
71369
71912
  run = loadRun(opts.output, runId);
71370
71913
  } catch (err) {
71371
- console.error(chalk27.red(`failed to load run: ${err.message}`));
71914
+ console.error(chalk28.red(`failed to load run: ${err.message}`));
71372
71915
  return 1;
71373
71916
  }
71374
71917
  let plan = null;
@@ -71376,29 +71919,29 @@ async function reportCommand(runId, opts) {
71376
71919
  try {
71377
71920
  plan = loadPlan(opts.planDir);
71378
71921
  } catch (err) {
71379
- console.error(chalk27.red(`failed to read migration-plan.json: ${err.message}`));
71922
+ console.error(chalk28.red(`failed to read migration-plan.json: ${err.message}`));
71380
71923
  return 1;
71381
71924
  }
71382
71925
  if (!plan) {
71383
- console.error(chalk27.red(`no migration-plan.json in ${opts.planDir}`));
71926
+ console.error(chalk28.red(`no migration-plan.json in ${opts.planDir}`));
71384
71927
  return 1;
71385
71928
  }
71386
71929
  }
71387
71930
  const html = renderDeckHtml(buildDeckModel(run, plan), opts.lang ?? "en");
71388
71931
  const dest = opts.out ?? join36(paths.runDir, "deck.html");
71389
71932
  writeFileSync28(dest, html, "utf8");
71390
- console.log(`${chalk27.green("✓")} deck → ${dest}`);
71933
+ console.log(`${chalk28.green("✓")} deck → ${dest}`);
71391
71934
  if (opts.open) {
71392
71935
  await open2(dest).catch((err) => {
71393
- console.error(chalk27.red(`failed to open: ${err.message}`));
71936
+ console.error(chalk28.red(`failed to open: ${err.message}`));
71394
71937
  });
71395
71938
  }
71396
71939
  return 0;
71397
71940
  }
71398
71941
  if (opts.section) {
71399
71942
  if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
71400
- console.error(chalk27.red(`unknown section "${opts.section}"`));
71401
- console.error(chalk27.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71943
+ console.error(chalk28.red(`unknown section "${opts.section}"`));
71944
+ console.error(chalk28.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71402
71945
  return 1;
71403
71946
  }
71404
71947
  if (opts.json) {
@@ -71406,40 +71949,40 @@ async function reportCommand(runId, opts) {
71406
71949
  const run = loadRun(opts.output, runId);
71407
71950
  const payload = extractReportSection({ kind: "json", section: opts.section, run });
71408
71951
  if (payload === null) {
71409
- console.error(chalk27.red(`section "${opts.section}" not present in this run`));
71952
+ console.error(chalk28.red(`section "${opts.section}" not present in this run`));
71410
71953
  return 1;
71411
71954
  }
71412
71955
  process.stdout.write(`${JSON.stringify(payload, null, 2)}
71413
71956
  `);
71414
71957
  return 0;
71415
71958
  } catch (err) {
71416
- console.error(chalk27.red(`failed to load run: ${err.message}`));
71959
+ console.error(chalk28.red(`failed to load run: ${err.message}`));
71417
71960
  return 1;
71418
71961
  }
71419
71962
  }
71420
- if (!existsSync24(paths.reportHtml)) {
71421
- console.error(chalk27.red(`report.html not found at ${paths.reportHtml}`));
71963
+ if (!existsSync25(paths.reportHtml)) {
71964
+ console.error(chalk28.red(`report.html not found at ${paths.reportHtml}`));
71422
71965
  return 1;
71423
71966
  }
71424
- const html = readFileSync29(paths.reportHtml, "utf8");
71967
+ const html = readFileSync30(paths.reportHtml, "utf8");
71425
71968
  const slice = extractReportSection({ kind: "html", section: opts.section, html });
71426
71969
  if (slice === null) {
71427
- console.error(chalk27.red(`section "${opts.section}" not present in this report`));
71970
+ console.error(chalk28.red(`section "${opts.section}" not present in this report`));
71428
71971
  return 1;
71429
71972
  }
71430
71973
  process.stdout.write(slice);
71431
71974
  return 0;
71432
71975
  }
71433
- console.log(chalk27.dim(`opening ${paths.reportHtml}`));
71976
+ console.log(chalk28.dim(`opening ${paths.reportHtml}`));
71434
71977
  await open2(paths.reportHtml).catch((err) => {
71435
- console.error(chalk27.red(`failed to open: ${err.message}`));
71978
+ console.error(chalk28.red(`failed to open: ${err.message}`));
71436
71979
  });
71437
71980
  return 0;
71438
71981
  }
71439
71982
 
71440
71983
  // src/commands/event.ts
71441
71984
  import { resolve as resolve9 } from "node:path";
71442
- import chalk28 from "chalk";
71985
+ import chalk29 from "chalk";
71443
71986
 
71444
71987
  // src/events.ts
71445
71988
  import { appendFileSync, mkdirSync as mkdirSync17 } from "node:fs";
@@ -71463,24 +72006,24 @@ function eventCommand(type, opts) {
71463
72006
  if (parsed && typeof parsed === "object")
71464
72007
  data = parsed;
71465
72008
  else {
71466
- console.error(chalk28.red("--data must be a JSON object"));
72009
+ console.error(chalk29.red("--data must be a JSON object"));
71467
72010
  return 1;
71468
72011
  }
71469
72012
  } catch {
71470
- console.error(chalk28.red(`--data is not valid JSON: ${opts.data}`));
72013
+ console.error(chalk29.red(`--data is not valid JSON: ${opts.data}`));
71471
72014
  return 1;
71472
72015
  }
71473
72016
  }
71474
72017
  const dir = resolve9(opts.dir);
71475
72018
  emitEvent(dir, type, data);
71476
- console.log(`${chalk28.green("✓")} ${type} → ${dir}/events.jsonl`);
72019
+ console.log(`${chalk29.green("✓")} ${type} → ${dir}/events.jsonl`);
71477
72020
  return 0;
71478
72021
  }
71479
72022
 
71480
72023
  // src/commands/bench.ts
71481
- import { existsSync as existsSync25, mkdirSync as mkdirSync18, readFileSync as readFileSync30, writeFileSync as writeFileSync29 } from "node:fs";
72024
+ import { existsSync as existsSync26, mkdirSync as mkdirSync18, readFileSync as readFileSync31, writeFileSync as writeFileSync29 } from "node:fs";
71482
72025
  import { resolve as resolve10 } from "node:path";
71483
- import chalk29 from "chalk";
72026
+ import chalk30 from "chalk";
71484
72027
 
71485
72028
  // src/diff/motion.ts
71486
72029
  var WEIGHT = {
@@ -71862,7 +72405,10 @@ function isHarnessSide(explicitSelector) {
71862
72405
  return !explicitSelector;
71863
72406
  }
71864
72407
  async function gatherBenchSide(browser, opts) {
71865
- const ctx = await newContext(browser, { viewport: opts.viewport });
72408
+ const ctx = await newContext(browser, {
72409
+ viewport: opts.viewport,
72410
+ keepMotion: true
72411
+ });
71866
72412
  const page = await ctx.newPage();
71867
72413
  const side = {
71868
72414
  url: opts.url,
@@ -71908,20 +72454,20 @@ async function gatherBenchSide(browser, opts) {
71908
72454
  async function benchCommand(opts) {
71909
72455
  const viewport = parseViewport3(opts.viewport);
71910
72456
  if (!viewport) {
71911
- console.error(chalk29.red(`--viewport inválido: ${opts.viewport}`));
72457
+ console.error(chalk30.red(`--viewport inválido: ${opts.viewport}`));
71912
72458
  return 2;
71913
72459
  }
71914
72460
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
71915
72461
  let props;
71916
72462
  if (opts.props) {
71917
- if (!existsSync25(opts.props)) {
71918
- console.error(chalk29.red(`--props não encontrado: ${opts.props}`));
72463
+ if (!existsSync26(opts.props)) {
72464
+ console.error(chalk30.red(`--props não encontrado: ${opts.props}`));
71919
72465
  return 2;
71920
72466
  }
71921
72467
  try {
71922
- props = JSON.parse(readFileSync30(opts.props, "utf8"));
72468
+ props = JSON.parse(readFileSync31(opts.props, "utf8"));
71923
72469
  } catch (err) {
71924
- console.error(chalk29.red(`--props não é JSON válido: ${err.message}`));
72470
+ console.error(chalk30.red(`--props não é JSON válido: ${err.message}`));
71925
72471
  return 2;
71926
72472
  }
71927
72473
  }
@@ -71936,7 +72482,7 @@ async function benchCommand(opts) {
71936
72482
  const prefix = `bench-${slug}-${viewport}`;
71937
72483
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
71938
72484
  if (aliasNote)
71939
- console.log(chalk29.dim(` ${aliasNote}`));
72485
+ console.log(chalk30.dim(` ${aliasNote}`));
71940
72486
  const browser = await launchBrowser({ headless: true });
71941
72487
  try {
71942
72488
  const [prodSide, candSide] = await Promise.all([
@@ -71961,7 +72507,7 @@ async function benchCommand(opts) {
71961
72507
  if (opts.json)
71962
72508
  console.log(JSON.stringify(payload));
71963
72509
  else
71964
- console.error(chalk29.red(` bench falhou — ${readErr}`));
72510
+ console.error(chalk30.red(` bench falhou — ${readErr}`));
71965
72511
  return 2;
71966
72512
  }
71967
72513
  const geometry = diffBoxTrees(prodSide.boxNodes.nodes, candSide.boxNodes.nodes, {
@@ -71991,9 +72537,9 @@ async function benchCommand(opts) {
71991
72537
  console.log(JSON.stringify(result));
71992
72538
  } else {
71993
72539
  console.log("");
71994
- console.log(chalk29.bold(` ${opts.component} — isolated (${viewport})`));
71995
- console.log(chalk29.dim(` prod ${prodUrl}`));
71996
- console.log(chalk29.dim(` cand ${candUrl}`));
72540
+ console.log(chalk30.bold(` ${opts.component} — isolated (${viewport})`));
72541
+ console.log(chalk30.dim(` prod ${prodUrl}`));
72542
+ console.log(chalk30.dim(` cand ${candUrl}`));
71997
72543
  console.log("");
71998
72544
  for (const line of formatBoxTreeDiff(geometry).split(`
71999
72545
  `))
@@ -72004,7 +72550,7 @@ async function benchCommand(opts) {
72004
72550
  ]) {
72005
72551
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
72006
72552
  if (caveat)
72007
- console.log(chalk29.yellow(` ${caveat}`));
72553
+ console.log(chalk30.yellow(` ${caveat}`));
72008
72554
  }
72009
72555
  if (motion) {
72010
72556
  console.log("");
@@ -72013,7 +72559,7 @@ async function benchCommand(opts) {
72013
72559
  console.log(` ${line}`);
72014
72560
  }
72015
72561
  console.log("");
72016
- console.log(chalk29.dim(` ${resultPath}`));
72562
+ console.log(chalk30.dim(` ${resultPath}`));
72017
72563
  }
72018
72564
  return clean || !opts.failOnDiff ? 0 : 1;
72019
72565
  } finally {
@@ -72024,7 +72570,7 @@ async function benchCommand(opts) {
72024
72570
  }
72025
72571
 
72026
72572
  // src/commands/locate.ts
72027
- import chalk30 from "chalk";
72573
+ import chalk31 from "chalk";
72028
72574
  var hitOf = (n, nodes) => ({
72029
72575
  key: n.key,
72030
72576
  label: n.label,
@@ -72149,22 +72695,22 @@ function printResult3(r) {
72149
72695
  const side = (name, a) => {
72150
72696
  if (a.found) {
72151
72697
  console.log(` ${name.padEnd(5)} ${a.hit.tag.padEnd(8)} ${formatHit(a.hit)}`);
72152
- console.log(chalk30.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
72698
+ console.log(chalk31.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
72153
72699
  return;
72154
72700
  }
72155
- console.log(chalk30.yellow(` ${name.padEnd(5)} ${a.reason}`));
72701
+ console.log(chalk31.yellow(` ${name.padEnd(5)} ${a.reason}`));
72156
72702
  for (const c of a.candidates ?? [])
72157
- console.log(chalk30.dim(` candidate: ${c}`));
72703
+ console.log(chalk31.dim(` candidate: ${c}`));
72158
72704
  };
72159
72705
  console.log("");
72160
- console.log(chalk30.bold(` ${r.label} — ${r.viewport}`));
72706
+ console.log(chalk31.bold(` ${r.label} — ${r.viewport}`));
72161
72707
  side("prod", r.prod);
72162
72708
  side("cand", r.cand);
72163
72709
  if (r.prod.found && r.cand.found) {
72164
72710
  const delta = formatDelta(r.prod.hit, r.cand.hit);
72165
72711
  console.log(` ${"diff".padEnd(5)} ${delta ?? "identical box and type"}`);
72166
72712
  for (const note of pairingNotes(r.prod.hit, r.cand.hit)) {
72167
- console.log(chalk30.yellow(` note ${note}`));
72713
+ console.log(chalk31.yellow(` note ${note}`));
72168
72714
  }
72169
72715
  }
72170
72716
  }
@@ -72172,22 +72718,22 @@ async function locateCommand(opts) {
72172
72718
  const selector = opts.selector ?? "body";
72173
72719
  const waitMs = Number.parseInt(opts.wait, 10);
72174
72720
  if (!Number.isFinite(waitMs) || waitMs < 0) {
72175
- console.error(chalk30.red(`--wait inválido: ${opts.wait}`));
72721
+ console.error(chalk31.red(`--wait inválido: ${opts.wait}`));
72176
72722
  return 2;
72177
72723
  }
72178
72724
  if (opts.labels.length === 0) {
72179
- console.error(chalk30.red("nenhum --label passado — o comando procura por label, não por seletor"));
72725
+ console.error(chalk31.red("nenhum --label passado — o comando procura por label, não por seletor"));
72180
72726
  return 2;
72181
72727
  }
72182
72728
  const viewports = opts.viewports.split(",").map((v) => v.trim());
72183
72729
  const bad = viewports.find((v) => parseViewport3(v) === null);
72184
72730
  if (bad) {
72185
- console.error(chalk30.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
72731
+ console.error(chalk31.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
72186
72732
  return 2;
72187
72733
  }
72188
72734
  const { aliases, note } = resolveAliases(opts.planDir);
72189
72735
  if (note && !opts.json)
72190
- console.log(chalk30.dim(` ${note}`));
72736
+ console.log(chalk31.dim(` ${note}`));
72191
72737
  const results = [];
72192
72738
  const caveats = [];
72193
72739
  const browser = await launchBrowser({ headless: true });
@@ -72242,39 +72788,39 @@ async function locateCommand(opts) {
72242
72788
  for (const r of results)
72243
72789
  printResult3(r);
72244
72790
  for (const c of caveats)
72245
- console.log(chalk30.yellow(` ${c}`));
72791
+ console.log(chalk31.yellow(` ${c}`));
72246
72792
  console.log("");
72247
72793
  if (unresolved.length > 0) {
72248
- console.log(chalk30.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72794
+ console.log(chalk31.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72249
72795
  } else {
72250
- console.log(chalk30.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
72796
+ console.log(chalk31.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
72251
72797
  }
72252
72798
  return unresolved.length > 0 ? 1 : 0;
72253
72799
  }
72254
72800
 
72255
72801
  // src/commands/cockpit.ts
72256
72802
  import { resolve as resolve15 } from "node:path";
72257
- import chalk31 from "chalk";
72803
+ import chalk32 from "chalk";
72258
72804
 
72259
72805
  // src/server/cockpit.ts
72260
- import { readFileSync as readFileSync35 } from "node:fs";
72806
+ import { readFileSync as readFileSync36 } from "node:fs";
72261
72807
  import { createServer as createServer2 } from "node:http";
72262
72808
  import { dirname as dirname8, join as join42, resolve as resolve14 } from "node:path";
72263
72809
 
72264
72810
  // src/server/cockpit-actions.ts
72265
72811
  import { spawn as spawn3 } from "node:child_process";
72266
- import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync32, readdirSync as readdirSync7, writeFileSync as writeFileSync31 } from "node:fs";
72812
+ import { existsSync as existsSync28, mkdirSync as mkdirSync20, readFileSync as readFileSync33, readdirSync as readdirSync7, writeFileSync as writeFileSync31 } from "node:fs";
72267
72813
  import { join as join39, resolve as resolve12 } from "node:path";
72268
72814
 
72269
72815
  // src/server/cockpit-settings.ts
72270
72816
  import { execFileSync as execFileSync3 } from "node:child_process";
72271
- import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync31, writeFileSync as writeFileSync30 } from "node:fs";
72817
+ import { chmodSync, existsSync as existsSync27, mkdirSync as mkdirSync19, readFileSync as readFileSync32, writeFileSync as writeFileSync30 } from "node:fs";
72272
72818
  import { homedir as homedir3 } from "node:os";
72273
72819
  import { join as join38, resolve as resolve11 } from "node:path";
72274
72820
  var FILE = () => join38(process.env.PARITY_HOME ?? join38(homedir3(), ".parity"), "config.json");
72275
72821
  function readAll() {
72276
72822
  try {
72277
- return JSON.parse(readFileSync31(FILE(), "utf8"));
72823
+ return JSON.parse(readFileSync32(FILE(), "utf8"));
72278
72824
  } catch {
72279
72825
  return {};
72280
72826
  }
@@ -72427,12 +72973,13 @@ var COMPONENT_STATUSES = [
72427
72973
  "done",
72428
72974
  "as-is",
72429
72975
  "upgrade",
72430
- "skipped"
72976
+ "skipped",
72977
+ "vanished"
72431
72978
  ];
72432
72979
  var PAGE_STATUSES2 = ["pending", "code", "done", "skipped"];
72433
72980
  function readState(planDir) {
72434
72981
  try {
72435
- return JSON.parse(readFileSync32(join39(planDir, "migration.json"), "utf8"));
72982
+ return JSON.parse(readFileSync33(join39(planDir, "migration.json"), "utf8"));
72436
72983
  } catch {
72437
72984
  return null;
72438
72985
  }
@@ -72506,10 +73053,10 @@ function setComponent(planDir, name, status, decision = {}) {
72506
73053
  const plan = loadPlan(planDir);
72507
73054
  if (!plan)
72508
73055
  throw new Error("no migration-plan.json");
72509
- const c = setComponentStatus(plan, name, status);
73056
+ const note = decision.note?.trim() ?? "";
73057
+ const c = setComponentStatus(plan, name, status, { note });
72510
73058
  if (!c)
72511
73059
  throw new Error(`no component "${name}" in the plan`);
72512
- const note = decision.note?.trim() ?? "";
72513
73060
  if (note || url || design) {
72514
73061
  setComponentReference(plan, name, {
72515
73062
  url,
@@ -72538,10 +73085,10 @@ function setComponentSelector(planDir, name, selector) {
72538
73085
  }
72539
73086
  function captured(planDir, host, name) {
72540
73087
  const file = join39(planDir, host, "capture.json");
72541
- if (!existsSync27(file))
73088
+ if (!existsSync28(file))
72542
73089
  return null;
72543
73090
  try {
72544
- const cap = JSON.parse(readFileSync32(file, "utf8"));
73091
+ const cap = JSON.parse(readFileSync33(file, "utf8"));
72545
73092
  const rows = Array.isArray(cap.components) ? cap.components : [];
72546
73093
  return rows.find((r) => r.role === name || r.name === name) ?? null;
72547
73094
  } catch {
@@ -72563,7 +73110,7 @@ function componentDetail(planDir, name) {
72563
73110
  }
72564
73111
  })();
72565
73112
  const cap = host ? captured(planDir, host, name) : null;
72566
- const shot = typeof cap?.screenshotPath === "string" && existsSync27(cap.screenshotPath) ? cap.screenshotPath : null;
73113
+ const shot = typeof cap?.screenshotPath === "string" && existsSync28(cap.screenshotPath) ? cap.screenshotPath : null;
72567
73114
  const styles = cap?.computedStyles ?? {};
72568
73115
  return {
72569
73116
  name: c.name,
@@ -72592,7 +73139,7 @@ function componentShot(planDir, name) {
72592
73139
  const p = typeof cap?.screenshotPath === "string" ? cap.screenshotPath : null;
72593
73140
  if (!p || !resolve12(p).startsWith(resolve12(join39(planDir, host))))
72594
73141
  return null;
72595
- return existsSync27(p) ? readFileSync32(p) : null;
73142
+ return existsSync28(p) ? readFileSync33(p) : null;
72596
73143
  }
72597
73144
  function setPage(planDir, path, status) {
72598
73145
  if (!PAGE_STATUSES2.includes(status)) {
@@ -72610,13 +73157,13 @@ function setPage(planDir, path, status) {
72610
73157
  var jobsDir = (planDir) => join39(planDir, "jobs");
72611
73158
  function lastJob(planDir, kind) {
72612
73159
  const dir = jobsDir(planDir);
72613
- if (!existsSync27(dir))
73160
+ if (!existsSync28(dir))
72614
73161
  return null;
72615
73162
  const id = readdirSync7(dir).filter((d) => d.startsWith(`${kind}-`)).sort().pop();
72616
73163
  if (!id)
72617
73164
  return null;
72618
73165
  const j = join39(dir, id);
72619
- const read = (f) => existsSync27(join39(j, f)) ? readFileSync32(join39(j, f), "utf8") : null;
73166
+ const read = (f) => existsSync28(join39(j, f)) ? readFileSync33(join39(j, f), "utf8") : null;
72620
73167
  const exit = read("exit");
72621
73168
  const pid = Number(read("pid") ?? 0);
72622
73169
  let alive = false;
@@ -72675,14 +73222,14 @@ function remoteUrl(dir) {
72675
73222
  }
72676
73223
 
72677
73224
  // src/server/cockpit-api.ts
72678
- import { existsSync as existsSync28, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "node:fs";
73225
+ import { existsSync as existsSync29, readFileSync as readFileSync34, readdirSync as readdirSync8 } from "node:fs";
72679
73226
  import { join as join40 } from "node:path";
72680
73227
  var notFound = (what) => ({ status: 404, body: { error: what } });
72681
73228
  function readJson2(path) {
72682
- if (!existsSync28(path))
73229
+ if (!existsSync29(path))
72683
73230
  return null;
72684
73231
  try {
72685
- return JSON.parse(readFileSync33(path, "utf8"));
73232
+ return JSON.parse(readFileSync34(path, "utf8"));
72686
73233
  } catch {
72687
73234
  return null;
72688
73235
  }
@@ -72691,7 +73238,7 @@ function withPlan(ctx) {
72691
73238
  return loadPlan(ctx.planDir);
72692
73239
  }
72693
73240
  function listBenchResults(benchDir) {
72694
- if (!existsSync28(benchDir))
73241
+ if (!existsSync29(benchDir))
72695
73242
  return [];
72696
73243
  let files;
72697
73244
  try {
@@ -72726,7 +73273,7 @@ function cockpitApi(path, params, ctx) {
72726
73273
  benchDir: ctx.benchDir,
72727
73274
  prodUrl: ctx.prodUrl ?? null,
72728
73275
  candUrl: ctx.candUrl ?? null,
72729
- hasPlan: existsSync28(join40(ctx.planDir, "migration-plan.json"))
73276
+ hasPlan: existsSync29(join40(ctx.planDir, "migration-plan.json"))
72730
73277
  }
72731
73278
  };
72732
73279
  case "/api/state": {
@@ -73296,13 +73843,13 @@ import { execFileSync as execFileSync4, spawn as spawn4 } from "node:child_proce
73296
73843
  import { randomUUID } from "node:crypto";
73297
73844
  import {
73298
73845
  appendFileSync as appendFileSync2,
73299
- existsSync as existsSync29,
73846
+ existsSync as existsSync30,
73300
73847
  mkdirSync as mkdirSync21,
73301
- readFileSync as readFileSync34,
73848
+ readFileSync as readFileSync35,
73302
73849
  readdirSync as readdirSync9,
73303
73850
  realpathSync,
73304
73851
  renameSync as renameSync2,
73305
- rmSync,
73852
+ rmSync as rmSync2,
73306
73853
  statSync as statSync3,
73307
73854
  symlinkSync,
73308
73855
  unlinkSync as unlinkSync4,
@@ -73324,12 +73871,12 @@ function validTaskId(id) {
73324
73871
  }
73325
73872
  function pluginDir() {
73326
73873
  const root = resolve13(dirname7(fileURLToPath(import.meta.url)), "../../../..");
73327
- return existsSync29(join41(root, ".claude-plugin", "plugin.json")) ? root : null;
73874
+ return existsSync30(join41(root, ".claude-plugin", "plugin.json")) ? root : null;
73328
73875
  }
73329
73876
  function targetDir(planDir) {
73330
73877
  try {
73331
- const state = JSON.parse(readFileSync34(join41(planDir, "migration.json"), "utf8"));
73332
- if (typeof state?.target?.dir === "string" && existsSync29(state.target.dir))
73878
+ const state = JSON.parse(readFileSync35(join41(planDir, "migration.json"), "utf8"));
73879
+ if (typeof state?.target?.dir === "string" && existsSync30(state.target.dir))
73333
73880
  return state.target.dir;
73334
73881
  } catch {}
73335
73882
  return dirname7(resolve13(planDir));
@@ -73426,7 +73973,7 @@ function locateSource(html, root) {
73426
73973
  continue;
73427
73974
  const file = join41(dir, e.name);
73428
73975
  if (/\.(s?css|less)$/.test(e.name)) {
73429
- const lines = readFileSync34(file, "utf8").split(`
73976
+ const lines = readFileSync35(file, "utf8").split(`
73430
73977
  `);
73431
73978
  for (const local of mods.get(stem) ?? []) {
73432
73979
  const leaf = local.split("__").pop() ?? local;
@@ -73438,7 +73985,7 @@ function locateSource(html, root) {
73438
73985
  }
73439
73986
  }
73440
73987
  };
73441
- walk(existsSync29(join41(root, "src")) ? join41(root, "src") : root, 0);
73988
+ walk(existsSync30(join41(root, "src")) ? join41(root, "src") : root, 0);
73442
73989
  return hits;
73443
73990
  }
73444
73991
  function grid(s) {
@@ -73588,7 +74135,7 @@ function prompt(task, planDir, dir) {
73588
74135
  "",
73589
74136
  "Steps:",
73590
74137
  `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.`,
73591
- 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.`,
74138
+ 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.`,
73592
74139
  " 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.",
73593
74140
  `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.`,
73594
74141
  "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:",
@@ -73628,7 +74175,7 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73628
74175
  return false;
73629
74176
  }
73630
74177
  })();
73631
- if (sameDeps && existsSync29(join41(repo, "node_modules")) && !existsSync29(join41(wt, "node_modules"))) {
74178
+ if (sameDeps && existsSync30(join41(repo, "node_modules")) && !existsSync30(join41(wt, "node_modules"))) {
73632
74179
  symlinkSync(join41(repo, "node_modules"), join41(wt, "node_modules"));
73633
74180
  }
73634
74181
  return { worktree: wt, branch, base: { ref, sha } };
@@ -73683,7 +74230,7 @@ function retryTask(planDir, id, note) {
73683
74230
  const n = (task.attempts?.length ?? 0) + 2;
73684
74231
  const previousBranch = task.branch ?? d.delivery?.branch ?? null;
73685
74232
  let moved = false;
73686
- if (!task.worktree || !existsSync29(task.worktree)) {
74233
+ if (!task.worktree || !existsSync30(task.worktree)) {
73687
74234
  Object.assign(task, prepareWorktree(task, planDir, dir, `cockpit/${task.id}-r${n}`));
73688
74235
  if (!task.worktree)
73689
74236
  throw new Error(`could not create a worktree: ${task.worktreeError}`);
@@ -73708,11 +74255,11 @@ function retryTask(planDir, id, note) {
73708
74255
  const promptFile = join41(dir, `prompt-${n}.md`);
73709
74256
  writeFileSync32(promptFile, lines.join(`
73710
74257
  `));
73711
- if (existsSync29(join41(dir, "stderr.log")))
74258
+ if (existsSync30(join41(dir, "stderr.log")))
73712
74259
  renameSync2(join41(dir, "stderr.log"), join41(dir, `stderr-${n - 1}.log`));
73713
- if (existsSync29(join41(dir, "exit")))
74260
+ if (existsSync30(join41(dir, "exit")))
73714
74261
  unlinkSync4(join41(dir, "exit"));
73715
- if (existsSync29(join41(dir, "stopped")))
74262
+ if (existsSync30(join41(dir, "stopped")))
73716
74263
  unlinkSync4(join41(dir, "stopped"));
73717
74264
  task.attempts = [
73718
74265
  ...task.attempts ?? [],
@@ -73763,7 +74310,7 @@ async function createTask(planDir, note) {
73763
74310
  }
73764
74311
  var procCache = new Map;
73765
74312
  function taskProcesses(worktree) {
73766
- if (!worktree || !existsSync29(worktree))
74313
+ if (!worktree || !existsSync30(worktree))
73767
74314
  return [];
73768
74315
  const real = realpathSync(worktree);
73769
74316
  if (!real || real === "/")
@@ -73806,11 +74353,11 @@ function taskProcesses(worktree) {
73806
74353
  function stopTask(planDir, id) {
73807
74354
  const dir = taskDir(planDir, id);
73808
74355
  const file = join41(dir, "task.json");
73809
- if (!existsSync29(file))
74356
+ if (!existsSync30(file))
73810
74357
  throw new Error("no such task");
73811
- const task = JSON.parse(readFileSync34(file, "utf8"));
74358
+ const task = JSON.parse(readFileSync35(file, "utf8"));
73812
74359
  let stopped = 0;
73813
- if (task.pid && alive(task.pid) && !existsSync29(join41(dir, "exit"))) {
74360
+ if (task.pid && alive(task.pid) && !existsSync30(join41(dir, "exit"))) {
73814
74361
  try {
73815
74362
  process.kill(-task.pid, "SIGTERM");
73816
74363
  stopped += 1;
@@ -73876,7 +74423,7 @@ function prPlan(planDir, id, baseOverride) {
73876
74423
  throw new Error("no such task");
73877
74424
  const task = d.task;
73878
74425
  const branch = d.delivery?.branch;
73879
- if (!branch || !task.worktree || !existsSync29(task.worktree))
74426
+ if (!branch || !task.worktree || !existsSync30(task.worktree))
73880
74427
  throw new Error("this task has no local branch to push");
73881
74428
  const eff = effectiveSettings(planDir, targetDir(planDir));
73882
74429
  const settings = { prBase: eff.prBase, githubUser: eff.githubUser };
@@ -73920,7 +74467,7 @@ function openPr(planDir, id, baseOverride) {
73920
74467
  if (!plan.commits.length)
73921
74468
  throw new Error("the branch has no commits of its own");
73922
74469
  const dir = taskDir(planDir, id);
73923
- const task = JSON.parse(readFileSync34(join41(dir, "task.json"), "utf8"));
74470
+ const task = JSON.parse(readFileSync35(join41(dir, "task.json"), "utf8"));
73924
74471
  const wt = task.worktree;
73925
74472
  const env = { ...process.env, ...ghEnv(plan.account ?? undefined) };
73926
74473
  const git = (...a) => execFileSync4("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
@@ -73981,7 +74528,7 @@ function autoOpenPrs(planDir) {
73981
74528
  if (t.status !== "done" || t.prUrl)
73982
74529
  continue;
73983
74530
  const mark = join41(taskDir(planDir, t.id), "pr-auto.json");
73984
- if (existsSync29(mark))
74531
+ if (existsSync30(mark))
73985
74532
  continue;
73986
74533
  const at = new Date().toISOString();
73987
74534
  try {
@@ -74078,12 +74625,12 @@ function autoMergePrs(planDir) {
74078
74625
  if (t.status !== "done")
74079
74626
  continue;
74080
74627
  const dir = taskDir(planDir, t.id);
74081
- if (existsSync29(join41(dir, "pr-merge.json")))
74628
+ if (existsSync30(join41(dir, "pr-merge.json")))
74082
74629
  continue;
74083
74630
  const d = readTask(planDir, t.id);
74084
74631
  const branch = d?.delivery?.branch;
74085
74632
  const wt = d?.task.worktree;
74086
- if (!d || !branch || !wt || !existsSync29(wt))
74633
+ if (!d || !branch || !wt || !existsSync30(wt))
74087
74634
  continue;
74088
74635
  const pr = prInfo(branch, wt, dir, true, true);
74089
74636
  if (!pr || pr.state !== "OPEN")
@@ -74122,8 +74669,8 @@ function autoMergePrs(planDir) {
74122
74669
  writeFileSync32(join41(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
74123
74670
  `)[0] }));
74124
74671
  }
74125
- rmSync(join41(dir, "pr.json"), { force: true });
74126
- } else if (pr.checks.failed > 0 && !existsSync29(join41(dir, "ci-retry.json"))) {
74672
+ rmSync2(join41(dir, "pr.json"), { force: true });
74673
+ } else if (pr.checks.failed > 0 && !existsSync30(join41(dir, "ci-retry.json"))) {
74127
74674
  writeFileSync32(join41(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
74128
74675
  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.`);
74129
74676
  }
@@ -74134,7 +74681,7 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
74134
74681
  return null;
74135
74682
  const cache = join41(dir, "pr.json");
74136
74683
  try {
74137
- const c = JSON.parse(readFileSync34(cache, "utf8"));
74684
+ const c = JSON.parse(readFileSync35(cache, "utf8"));
74138
74685
  if (!fresh && Date.now() - c.checkedAt < 60000)
74139
74686
  return c.info ?? (c.url ? { url: c.url } : null);
74140
74687
  } catch {}
@@ -74164,9 +74711,9 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
74164
74711
  function readTask(planDir, id) {
74165
74712
  const dir = taskDir(planDir, id);
74166
74713
  const file = join41(dir, "task.json");
74167
- if (!existsSync29(file))
74714
+ if (!existsSync30(file))
74168
74715
  return null;
74169
- const task = JSON.parse(readFileSync34(file, "utf8"));
74716
+ const task = JSON.parse(readFileSync35(file, "utf8"));
74170
74717
  const streamFile = join41(dir, "stream.jsonl");
74171
74718
  const exitFile = join41(dir, "exit");
74172
74719
  const steps = [];
@@ -74177,7 +74724,7 @@ function readTask(planDir, id) {
74177
74724
  let lastTs;
74178
74725
  let rawResult = "";
74179
74726
  const actorOf = (parent) => parent && agents.get(parent)?.type || "orchestrator";
74180
- const lines = existsSync29(streamFile) ? readFileSync34(streamFile, "utf8").split(`
74727
+ const lines = existsSync30(streamFile) ? readFileSync35(streamFile, "utf8").split(`
74181
74728
  `) : [];
74182
74729
  for (const line of lines) {
74183
74730
  if (!line.trim())
@@ -74271,8 +74818,8 @@ function readTask(planDir, id) {
74271
74818
  if (agent) {
74272
74819
  const scan = (t) => [...t.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74273
74820
  let res = scan(String(m.summary ?? ""));
74274
- if (!res && typeof m.output_file === "string" && existsSync29(m.output_file)) {
74275
- res = scan(agentText(readFileSync34(m.output_file, "utf8")));
74821
+ if (!res && typeof m.output_file === "string" && existsSync30(m.output_file)) {
74822
+ res = scan(agentText(readFileSync35(m.output_file, "utf8")));
74276
74823
  }
74277
74824
  if (res) {
74278
74825
  try {
@@ -74297,8 +74844,8 @@ function readTask(planDir, id) {
74297
74844
  steps.push({ actor: "orchestrator", kind: "result", text: result.text, isError: !result.ok });
74298
74845
  }
74299
74846
  }
74300
- const exit = existsSync29(exitFile) ? Number(readFileSync34(exitFile, "utf8").trim()) : null;
74301
- const stderrRaw = existsSync29(join41(dir, "stderr.log")) ? readFileSync34(join41(dir, "stderr.log"), "utf8") : "";
74847
+ const exit = existsSync30(exitFile) ? Number(readFileSync35(exitFile, "utf8").trim()) : null;
74848
+ const stderrRaw = existsSync30(join41(dir, "stderr.log")) ? readFileSync35(join41(dir, "stderr.log"), "utf8") : "";
74302
74849
  const finalLine = [...rawResult.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74303
74850
  let verdict = null;
74304
74851
  try {
@@ -74310,7 +74857,7 @@ function readTask(planDir, id) {
74310
74857
  let reason;
74311
74858
  let status;
74312
74859
  if (exit !== null) {
74313
- if (existsSync29(join41(dir, "stopped"))) {
74860
+ if (existsSync30(join41(dir, "stopped"))) {
74314
74861
  reason = "stopped from the cockpit";
74315
74862
  } else if (/Background tasks still running .* terminating/.test(stderrRaw)) {
74316
74863
  reason = `claude stopped waiting for background agents (${unfinished.join(", ") || "?"}) and terminated them`;
@@ -74329,17 +74876,17 @@ function readTask(planDir, id) {
74329
74876
  else if (!alive(task.pid))
74330
74877
  status = "failed";
74331
74878
  else {
74332
- const last = existsSync29(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74879
+ const last = existsSync30(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74333
74880
  status = Date.now() - last > STALL_MS ? "stalled" : "running";
74334
74881
  }
74335
- const read = (f) => existsSync29(join41(dir, f)) ? readFileSync34(join41(dir, f), "utf8") : null;
74882
+ const read = (f) => existsSync30(join41(dir, f)) ? readFileSync35(join41(dir, f), "utf8") : null;
74336
74883
  const stderr = clip(stderrRaw, 1500);
74337
74884
  const fixer = [...agents.values()].reverse().find((a) => a.type === "fixer" && a.result);
74338
74885
  const fr = fixer?.result ?? {};
74339
74886
  const branch = verdict?.branch ?? fr.branch ?? null;
74340
74887
  let delivery = null;
74341
74888
  if (branch) {
74342
- const repo = task.worktree && existsSync29(task.worktree) ? task.worktree : targetDir(dirname7(dirname7(dir)));
74889
+ const repo = task.worktree && existsSync30(task.worktree) ? task.worktree : targetDir(dirname7(dirname7(dir)));
74343
74890
  const baseSha = task.base?.sha ?? fr.base;
74344
74891
  const git = (...a) => {
74345
74892
  try {
@@ -74370,7 +74917,7 @@ function readTask(planDir, id) {
74370
74917
  model,
74371
74918
  prError: (() => {
74372
74919
  try {
74373
- const m = JSON.parse(readFileSync34(join41(dir, "pr-auto.json"), "utf8"));
74920
+ const m = JSON.parse(readFileSync35(join41(dir, "pr-auto.json"), "utf8"));
74374
74921
  return m.ok ? null : String(m.error);
74375
74922
  } catch {
74376
74923
  return null;
@@ -74390,7 +74937,7 @@ function readTask(planDir, id) {
74390
74937
  }
74391
74938
  function listTasks2(planDir) {
74392
74939
  const dir = tasksDir(planDir);
74393
- if (!existsSync29(dir))
74940
+ if (!existsSync30(dir))
74394
74941
  return [];
74395
74942
  return readdirSync9(dir).filter(validTaskId).sort().reverse().map((id) => readTask(planDir, id)).filter((t) => t !== null).map(({ task, status, agents, result, delivery }) => ({
74396
74943
  ...task,
@@ -74405,7 +74952,7 @@ function taskShot(planDir, id, side) {
74405
74952
  if (!validTaskId(id) || side !== "prod" && side !== "cand")
74406
74953
  return null;
74407
74954
  const file = join41(taskDir(planDir, id), `${side}.png`);
74408
- return existsSync29(file) ? readFileSync34(file) : null;
74955
+ return existsSync30(file) ? readFileSync35(file) : null;
74409
74956
  }
74410
74957
 
74411
74958
  // src/server/cockpit.ts
@@ -74690,7 +75237,7 @@ async function actions(req, res, path, ctx) {
74690
75237
  }
74691
75238
  function targetDirOf(planDir) {
74692
75239
  try {
74693
- const st = JSON.parse(readFileSync35(join42(planDir, "migration.json"), "utf8"));
75240
+ const st = JSON.parse(readFileSync36(join42(planDir, "migration.json"), "utf8"));
74694
75241
  if (typeof st?.target?.dir === "string")
74695
75242
  return st.target.dir;
74696
75243
  } catch {}
@@ -74713,19 +75260,19 @@ async function cockpitCommand(opts) {
74713
75260
  host: opts.host
74714
75261
  });
74715
75262
  } catch (err) {
74716
- console.error(chalk31.red(` ✖ could not start the cockpit: ${err.message}`));
75263
+ console.error(chalk32.red(` ✖ could not start the cockpit: ${err.message}`));
74717
75264
  return 2;
74718
75265
  }
74719
75266
  console.log("");
74720
- console.log(chalk31.bold(" parity cockpit"));
74721
- console.log(` ${chalk31.green("●")} ${handle.url}`);
74722
- console.log(chalk31.dim(` plan ${ctx.planDir}`));
74723
- console.log(chalk31.dim(` runs ${ctx.output}`));
74724
- console.log(chalk31.dim(` bench ${ctx.benchDir}`));
75267
+ console.log(chalk32.bold(" parity cockpit"));
75268
+ console.log(` ${chalk32.green("●")} ${handle.url}`);
75269
+ console.log(chalk32.dim(` plan ${ctx.planDir}`));
75270
+ console.log(chalk32.dim(` runs ${ctx.output}`));
75271
+ console.log(chalk32.dim(` bench ${ctx.benchDir}`));
74725
75272
  if (opts.host && opts.host !== "127.0.0.1" && opts.host !== "localhost") {
74726
- console.log(chalk31.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
75273
+ console.log(chalk32.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
74727
75274
  }
74728
- console.log(chalk31.dim(` Ctrl+C to stop.
75275
+ console.log(chalk32.dim(` Ctrl+C to stop.
74729
75276
  `));
74730
75277
  if (opts.open !== false) {
74731
75278
  const { default: openUrl } = await import("open");
@@ -74745,15 +75292,15 @@ async function cockpitCommand(opts) {
74745
75292
 
74746
75293
  // src/commands/ios.ts
74747
75294
  import { execFileSync as execFileSync5 } from "node:child_process";
74748
- import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync37, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
75295
+ import { existsSync as existsSync32, mkdirSync as mkdirSync22, readFileSync as readFileSync38, rmSync as rmSync3, writeFileSync as writeFileSync33 } from "node:fs";
74749
75296
  import { homedir as homedir4, tmpdir as tmpdir2 } from "node:os";
74750
75297
  import { join as join44, resolve as resolve16 } from "node:path";
74751
- import chalk33 from "chalk";
75298
+ import chalk34 from "chalk";
74752
75299
 
74753
75300
  // src/commands/pair.ts
74754
- import { existsSync as existsSync30, readFileSync as readFileSync36 } from "node:fs";
75301
+ import { existsSync as existsSync31, readFileSync as readFileSync37 } from "node:fs";
74755
75302
  import { join as join43 } from "node:path";
74756
- import chalk32 from "chalk";
75303
+ import chalk33 from "chalk";
74757
75304
 
74758
75305
  // src/engine/pair.ts
74759
75306
  function signatureOf(target, doc = document) {
@@ -74953,7 +75500,7 @@ async function open3(browser, url, viewport, waitMs) {
74953
75500
  async function pairCommand(opts) {
74954
75501
  const viewport = parseViewport3(opts.viewport);
74955
75502
  if (!viewport) {
74956
- console.error(chalk32.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
75503
+ console.error(chalk33.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
74957
75504
  return 2;
74958
75505
  }
74959
75506
  const from = opts.side;
@@ -74995,27 +75542,27 @@ function report(opts, from, source, match, problem) {
74995
75542
  ambiguous: match?.ambiguous ?? 0
74996
75543
  }));
74997
75544
  } else {
74998
- const box = (s) => s ? chalk32.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
75545
+ const box = (s) => s ? chalk33.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
74999
75546
  if (source)
75000
75547
  console.log(`${from} ${source.selector} ${box(source)}`);
75001
75548
  if (match) {
75002
- console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk32.dim(`by ${match.by}`)}`);
75549
+ console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk33.dim(`by ${match.by}`)}`);
75003
75550
  }
75004
75551
  if (problem)
75005
- console.log(chalk32.yellow(problem));
75552
+ console.log(chalk33.yellow(problem));
75006
75553
  else if (match?.by === "position") {
75007
- console.log(chalk32.yellow("matched by position only — verify it is the same element"));
75554
+ console.log(chalk33.yellow("matched by position only — verify it is the same element"));
75008
75555
  }
75009
75556
  }
75010
75557
  return problem ? 2 : 0;
75011
75558
  }
75012
75559
  function sectionArgsFromTask(taskDir) {
75013
75560
  const file = join43(taskDir, "task.json");
75014
- if (!existsSync30(file))
75561
+ if (!existsSync31(file))
75015
75562
  throw new Error(`no task.json in ${taskDir}`);
75016
- const task = JSON.parse(readFileSync36(file, "utf8"));
75563
+ const task = JSON.parse(readFileSync37(file, "utf8"));
75017
75564
  const ctxFile = join43(taskDir, "context.json");
75018
- const ctx = existsSync30(ctxFile) ? JSON.parse(readFileSync36(ctxFile, "utf8")) : {};
75565
+ const ctx = existsSync31(ctxFile) ? JSON.parse(readFileSync37(ctxFile, "utf8")) : {};
75019
75566
  const prodSel = task.side === "prod" ? task.selector : ctx.prod?.selector ?? task.counterpart;
75020
75567
  const candSel = task.side === "cand" ? task.selector : ctx.cand?.selector ?? task.counterpart;
75021
75568
  if (!prodSel || !candSel) {
@@ -75050,7 +75597,7 @@ async function takeLock() {
75050
75597
  mkdirSync22(join44(homedir4(), ".parity"), { recursive: true });
75051
75598
  const until = Date.now() + 5 * 60000;
75052
75599
  for (;; ) {
75053
- const holder = existsSync31(LOCK) ? Number(readFileSync37(LOCK, "utf8")) : 0;
75600
+ const holder = existsSync32(LOCK) ? Number(readFileSync38(LOCK, "utf8")) : 0;
75054
75601
  if (!holder || !alive2(holder) || holder === process.pid)
75055
75602
  break;
75056
75603
  if (Date.now() > until)
@@ -75071,7 +75618,7 @@ async function iosCommand(opts) {
75071
75618
  try {
75072
75619
  execFileSync5("xcrun", ["simctl", "help"], { stdio: "ignore" });
75073
75620
  } catch {
75074
- console.error(chalk33.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
75621
+ console.error(chalk34.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
75075
75622
  return 2;
75076
75623
  }
75077
75624
  let { prod, cand, selector, candSelector } = opts;
@@ -75128,9 +75675,9 @@ async function iosCommand(opts) {
75128
75675
  simctl("shutdown", device.udid);
75129
75676
  } catch {}
75130
75677
  }
75131
- rmSync2(scratch, { recursive: true, force: true });
75132
- if (existsSync31(LOCK) && Number(readFileSync37(LOCK, "utf8")) === process.pid)
75133
- rmSync2(LOCK);
75678
+ rmSync3(scratch, { recursive: true, force: true });
75679
+ if (existsSync32(LOCK) && Number(readFileSync38(LOCK, "utf8")) === process.pid)
75680
+ rmSync3(LOCK);
75134
75681
  }
75135
75682
  const missing = Object.entries(found).filter(([, v]) => v !== true).map(([k]) => k);
75136
75683
  let diff = null;
@@ -75146,11 +75693,11 @@ async function iosCommand(opts) {
75146
75693
  if (opts.json)
75147
75694
  console.log(JSON.stringify(report));
75148
75695
  else {
75149
- console.log(`${chalk33.bold("iOS Safari")} · ${device.name}`);
75696
+ console.log(`${chalk34.bold("iOS Safari")} · ${device.name}`);
75150
75697
  for (const [k, v] of Object.entries(shots))
75151
75698
  console.log(` ${k.padEnd(5)} ${v}`);
75152
75699
  for (const side of missing) {
75153
- 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\`)`));
75700
+ 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\`)`));
75154
75701
  }
75155
75702
  if (diff)
75156
75703
  console.log(` diff ${(diff.pctDiff * 100).toFixed(2)}% (${diff.diffPixels} px) → ${diff.heatmapPath}`);
@@ -75163,7 +75710,7 @@ import { createInterface as createInterface3 } from "node:readline";
75163
75710
  import { resolve as resolve18 } from "node:path";
75164
75711
 
75165
75712
  // src/util/version.ts
75166
- import { readFileSync as readFileSync38 } from "node:fs";
75713
+ import { readFileSync as readFileSync39 } from "node:fs";
75167
75714
  import { dirname as dirname9, resolve as resolve17 } from "node:path";
75168
75715
  import { fileURLToPath as fileURLToPath2 } from "node:url";
75169
75716
  function getPackageVersion() {
@@ -75172,7 +75719,7 @@ function getPackageVersion() {
75172
75719
  for (const up of ["..", "../..", "../../.."]) {
75173
75720
  try {
75174
75721
  const pkgPath = resolve17(here, up, "package.json");
75175
- const raw = readFileSync38(pkgPath, "utf8");
75722
+ const raw = readFileSync39(pkgPath, "utf8");
75176
75723
  const parsed = JSON.parse(raw);
75177
75724
  if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
75178
75725
  return parsed.version;
@@ -75283,7 +75830,7 @@ function parseLine(line) {
75283
75830
  }
75284
75831
 
75285
75832
  // src/mcp/tools.ts
75286
- import { existsSync as existsSync32, readFileSync as readFileSync39 } from "node:fs";
75833
+ import { existsSync as existsSync33, readFileSync as readFileSync40 } from "node:fs";
75287
75834
  import { join as join45 } from "node:path";
75288
75835
  var STR = { type: "string" };
75289
75836
  var NONE = { type: "object", properties: {}, additionalProperties: false };
@@ -75321,11 +75868,11 @@ function createTools(ctx) {
75321
75868
  inputSchema: NONE,
75322
75869
  handler: () => {
75323
75870
  const p = join45(ctx.planDir, "migration.json");
75324
- if (!existsSync32(p)) {
75871
+ if (!existsSync33(p)) {
75325
75872
  return fail2(`no migration.json in ${ctx.planDir} — no migration has been started here`);
75326
75873
  }
75327
75874
  try {
75328
- return json2(JSON.parse(readFileSync39(p, "utf8")));
75875
+ return json2(JSON.parse(readFileSync40(p, "utf8")));
75329
75876
  } catch (err) {
75330
75877
  return fail2(`migration.json is not valid JSON: ${err.message}`);
75331
75878
  }
@@ -75424,10 +75971,10 @@ function createTools(ctx) {
75424
75971
  },
75425
75972
  {
75426
75973
  name: "SET_STATUS",
75427
- 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.",
75974
+ 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>\").",
75428
75975
  inputSchema: {
75429
75976
  type: "object",
75430
- properties: { name: STR, status: STR },
75977
+ properties: { name: STR, status: STR, note: STR },
75431
75978
  required: ["name", "status"],
75432
75979
  additionalProperties: false
75433
75980
  },
@@ -75437,14 +75984,19 @@ function createTools(ctx) {
75437
75984
  const status = str(args, "status");
75438
75985
  if (!name || !status)
75439
75986
  return fail2("name and status are required");
75440
- const allowed = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
75987
+ const allowed = ["pending", "partial", "done", "as-is", "upgrade", "skipped", "vanished"];
75441
75988
  if (!allowed.includes(status)) {
75442
75989
  return fail2(`invalid status "${status}". Use one of: ${allowed.join(", ")}`);
75443
75990
  }
75444
- return mutate(ctx, (plan) => {
75445
- const c = setComponentStatus(plan, name, status);
75446
- return c ? `${c.name} → ${status}` : null;
75447
- });
75991
+ const note = str(args, "note") ?? undefined;
75992
+ try {
75993
+ return mutate(ctx, (plan) => {
75994
+ const c = setComponentStatus(plan, name, status, { note });
75995
+ return c ? `${c.name} → ${status}` : null;
75996
+ });
75997
+ } catch (err) {
75998
+ return fail2(err.message);
75999
+ }
75448
76000
  }
75449
76001
  },
75450
76002
  {
@@ -75557,7 +76109,7 @@ async function mcpCommand(opts) {
75557
76109
  // src/commands/heatmap.ts
75558
76110
  import { mkdirSync as mkdirSync23 } from "node:fs";
75559
76111
  import { resolve as resolve19 } from "node:path";
75560
- import chalk34 from "chalk";
76112
+ import chalk35 from "chalk";
75561
76113
 
75562
76114
  // src/diff/hotspot-findings.ts
75563
76115
  var TYPOGRAPHY_PROPS = /^(font-family|font-weight|font-size|font-style|line-height|letter-spacing|text-transform)$/;
@@ -75656,13 +76208,13 @@ function describe2(type, hotspot, nodes, imageHostDelta, because) {
75656
76208
  }
75657
76209
 
75658
76210
  // src/diff/noise-mask.ts
75659
- import { readFileSync as readFileSync40, writeFileSync as writeFileSync34 } from "node:fs";
76211
+ import { readFileSync as readFileSync41, writeFileSync as writeFileSync34 } from "node:fs";
75660
76212
  import { PNG as PNG5 } from "pngjs";
75661
76213
  var DEFAULT_DILATE = 2;
75662
76214
  var MAX_MASK_COVERAGE = 0.2;
75663
76215
  function buildNoiseMask(firstPng, secondPng, dilate = DEFAULT_DILATE) {
75664
- const a = PNG5.sync.read(readFileSync40(firstPng));
75665
- const b = PNG5.sync.read(readFileSync40(secondPng));
76216
+ const a = PNG5.sync.read(readFileSync41(firstPng));
76217
+ const b = PNG5.sync.read(readFileSync41(secondPng));
75666
76218
  if (a.width !== b.width || a.height !== b.height)
75667
76219
  return null;
75668
76220
  const { width, height } = a;
@@ -75702,7 +76254,7 @@ function dilateMask(src, width, height, radius) {
75702
76254
  return pass(pass(src, true), false);
75703
76255
  }
75704
76256
  function applyMask(pngPath, mask, outPath) {
75705
- const png = PNG5.sync.read(readFileSync40(pngPath));
76257
+ const png = PNG5.sync.read(readFileSync41(pngPath));
75706
76258
  if (png.width !== mask.width || png.height !== mask.height) {
75707
76259
  throw new Error(`applyMask: image is ${png.width}x${png.height} but the mask is ${mask.width}x${mask.height}`);
75708
76260
  }
@@ -75719,7 +76271,7 @@ function applyMask(pngPath, mask, outPath) {
75719
76271
  }
75720
76272
  function readPngSize(pngPath) {
75721
76273
  try {
75722
- const head = readFileSync40(pngPath).subarray(0, 24);
76274
+ const head = readFileSync41(pngPath).subarray(0, 24);
75723
76275
  if (head.length < 24)
75724
76276
  return null;
75725
76277
  return { width: head.readUInt32BE(16), height: head.readUInt32BE(20) };
@@ -75971,16 +76523,16 @@ function exitCodeFor(verdict) {
75971
76523
  async function heatmapCommand(opts) {
75972
76524
  const specs = parseViewports2(opts.viewports);
75973
76525
  if (typeof specs === "string") {
75974
- console.error(chalk34.red(specs));
76526
+ console.error(chalk35.red(specs));
75975
76527
  return EXIT_INCONCLUSIVE;
75976
76528
  }
75977
76529
  const waitMs = Number.parseInt(opts.wait, 10);
75978
76530
  if (!Number.isFinite(waitMs) || waitMs < 0) {
75979
- console.error(chalk34.red(`--wait inválido: ${opts.wait}`));
76531
+ console.error(chalk35.red(`--wait inválido: ${opts.wait}`));
75980
76532
  return EXIT_INCONCLUSIVE;
75981
76533
  }
75982
76534
  if (!isValidUrl5(opts.prod) || !isValidUrl5(opts.cand)) {
75983
- console.error(chalk34.red("--prod ou --cand inválido"));
76535
+ console.error(chalk35.red("--prod ou --cand inválido"));
75984
76536
  return EXIT_INCONCLUSIVE;
75985
76537
  }
75986
76538
  const selector = opts.selector?.trim() || null;
@@ -76019,7 +76571,7 @@ async function heatmapCommand(opts) {
76019
76571
  };
76020
76572
  if (opts.pr) {
76021
76573
  await postQaComment({ report, pr: opts.pr, repo: opts.repo }).catch((err) => {
76022
- console.error(chalk34.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
76574
+ console.error(chalk35.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
76023
76575
  });
76024
76576
  }
76025
76577
  if (opts.json)
@@ -76131,6 +76683,18 @@ function judgePair(args) {
76131
76683
  const blocked = firstBlocker(prod, cand);
76132
76684
  if (blocked)
76133
76685
  return { ...base, verdict: "inconclusive", reason: blocked };
76686
+ const overflow = judgeHorizontalOverflow(prod, cand);
76687
+ if (overflow?.verdict === "inconclusive") {
76688
+ return { ...base, verdict: "inconclusive", reason: overflow.reason };
76689
+ }
76690
+ if (overflow) {
76691
+ return {
76692
+ ...base,
76693
+ findings: [overflow.finding],
76694
+ verdict: "differs",
76695
+ reason: overflow.finding.summary
76696
+ };
76697
+ }
76134
76698
  if (!args.prodRepeatScreenshot) {
76135
76699
  return {
76136
76700
  ...base,
@@ -76253,6 +76817,37 @@ function judgePair(args) {
76253
76817
  reason: diff.diffPixels === 0 ? undefined : `${diff.diffPixels} differing pixels in ${analysis.hotspots.length} region(s)`
76254
76818
  };
76255
76819
  }
76820
+ function judgeHorizontalOverflow(prod, cand) {
76821
+ const c = cand.horizontalOverflow;
76822
+ if (c === undefined)
76823
+ return { verdict: "inconclusive", reason: "cand horizontal overflow not measured" };
76824
+ if (c === null)
76825
+ return null;
76826
+ if (prod.horizontalOverflow === undefined) {
76827
+ return {
76828
+ verdict: "inconclusive",
76829
+ reason: `prod horizontal overflow not measured, so cand's ${c.px}px overflow cannot be judged a regression`
76830
+ };
76831
+ }
76832
+ const prodPx = prod.horizontalOverflow?.px ?? 0;
76833
+ if (c.px <= prodPx)
76834
+ return null;
76835
+ const culprit = c.widest ? `widest offender \`${c.widest.selector}\` ends ${c.widest.overflowPx}px past it` : "no single element was found past the edge";
76836
+ const baseline = prodPx > 0 ? `prod overflows ${prodPx}px` : "prod fits";
76837
+ return {
76838
+ verdict: "differs",
76839
+ finding: {
76840
+ type: "horizontal-overflow",
76841
+ hotspot: {
76842
+ ...c.widest?.rect ?? { x: c.clientWidth, y: 0, width: c.px, height: 0 },
76843
+ pixelCount: 0
76844
+ },
76845
+ nodes: [],
76846
+ 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`,
76847
+ truncated: false
76848
+ }
76849
+ };
76850
+ }
76256
76851
  function explainHotspots(hotspots, prod, cand, paths, prodBoxTree, candBoxTree) {
76257
76852
  if (hotspots.length === 0)
76258
76853
  return [];
@@ -76328,6 +76923,7 @@ async function captureSide(browser, args) {
76328
76923
  });
76329
76924
  side.devicePixelRatio = await page.evaluate(() => window.devicePixelRatio);
76330
76925
  side.fontsStatus = await page.evaluate(() => document.fonts?.status ?? "unknown");
76926
+ side.horizontalOverflow = await readHorizontalOverflow(page);
76331
76927
  if (args.selector) {
76332
76928
  const loc = page.locator(args.selector);
76333
76929
  side.matches = await loc.count();
@@ -76409,6 +77005,46 @@ async function isAlreadyOnScreen(page, selector) {
76409
77005
  return false;
76410
77006
  }
76411
77007
  }
77008
+ async function readHorizontalOverflow(page) {
77009
+ return page.evaluate(() => {
77010
+ const root = document.documentElement;
77011
+ const clientWidth = root.clientWidth;
77012
+ const px = root.scrollWidth - clientWidth;
77013
+ if (px <= 0)
77014
+ return null;
77015
+ const clipped = (el) => {
77016
+ for (let a = el.parentElement;a && a !== document.body && a !== root; a = a.parentElement) {
77017
+ if (getComputedStyle(a).overflowX !== "visible")
77018
+ return true;
77019
+ }
77020
+ return false;
77021
+ };
77022
+ let widest = null;
77023
+ for (const el of Array.from(document.body?.querySelectorAll("*") ?? [])) {
77024
+ const r = el.getBoundingClientRect();
77025
+ const right = r.right + window.scrollX;
77026
+ const over = Math.round(right - clientWidth);
77027
+ if (over <= 0 || widest && over <= widest.overflowPx)
77028
+ continue;
77029
+ if (getComputedStyle(el).position === "fixed" || clipped(el))
77030
+ continue;
77031
+ const cls = Array.from(el.classList).slice(0, 2).map((c) => `.${CSS.escape(c)}`).join("");
77032
+ widest = {
77033
+ selector: `${el.tagName.toLowerCase()}${el.id ? `#${CSS.escape(el.id)}` : ""}${cls}`,
77034
+ overflowPx: over,
77035
+ rect: {
77036
+ x: Math.round(r.left + window.scrollX),
77037
+ y: Math.round(r.top + window.scrollY),
77038
+ width: Math.round(r.width),
77039
+ height: Math.round(r.height)
77040
+ }
77041
+ };
77042
+ }
77043
+ return { px, clientWidth, widest };
77044
+ }).catch(() => {
77045
+ return;
77046
+ });
77047
+ }
76412
77048
  async function readImageHosts(page, selector) {
76413
77049
  return page.evaluate((sel) => {
76414
77050
  const root = sel ? document.querySelector(sel) : document.body;
@@ -76445,35 +77081,46 @@ function isValidUrl5(s) {
76445
77081
  }
76446
77082
  }
76447
77083
  var MARK = {
76448
- identical: chalk34.green("✓"),
76449
- differs: chalk34.red("✗"),
76450
- inconclusive: chalk34.yellow("?")
77084
+ identical: chalk35.green("✓"),
77085
+ differs: chalk35.red("✗"),
77086
+ inconclusive: chalk35.yellow("?")
76451
77087
  };
76452
77088
  function printReport(report) {
76453
77089
  console.log("");
76454
- console.log(chalk34.bold(` parity heatmap — ${report.mode}`));
76455
- console.log(chalk34.dim(` prod: ${report.prodUrl}`));
76456
- console.log(chalk34.dim(` cand: ${report.candUrl}`));
77090
+ console.log(chalk35.bold(` parity heatmap — ${report.mode}`));
77091
+ console.log(chalk35.dim(` prod: ${report.prodUrl}`));
77092
+ console.log(chalk35.dim(` cand: ${report.candUrl}`));
76457
77093
  console.log("");
76458
77094
  for (const v of report.viewports) {
76459
- const detail = v.verdict === "identical" ? chalk34.dim("0 pixels") : v.reason ?? chalk34.dim("no detail");
77095
+ const detail = v.verdict === "identical" ? chalk35.dim("0 pixels") : v.reason ?? chalk35.dim("no detail");
76460
77096
  console.log(` ${MARK[v.verdict]} ${v.label.padEnd(12)} ${detail}`);
76461
77097
  if (v.maskedCoverage != null && v.maskedCoverage > 0) {
76462
- console.log(chalk34.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
77098
+ console.log(chalk35.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
77099
+ }
77100
+ if (!v.findings.some((f) => f.type === "horizontal-overflow")) {
77101
+ for (const [name, s] of [
77102
+ ["prod", v.prod],
77103
+ ["cand", v.cand]
77104
+ ]) {
77105
+ const o = s.horizontalOverflow;
77106
+ if (o) {
77107
+ console.log(chalk35.yellow(` ${name} overflows sideways by ${o.px}px${o.widest ? ` (\`${o.widest.selector}\`)` : ""}`));
77108
+ }
77109
+ }
76463
77110
  }
76464
77111
  for (const f of v.findings.slice(0, 5)) {
76465
- console.log(chalk34.dim(` [${f.type}] ${f.summary}`));
77112
+ console.log(chalk35.dim(` [${f.type}] ${f.summary}`));
76466
77113
  }
76467
77114
  if (v.heatmapPath && v.verdict === "differs") {
76468
- console.log(chalk34.dim(` ${v.heatmapPath}`));
77115
+ console.log(chalk35.dim(` ${v.heatmapPath}`));
76469
77116
  }
76470
77117
  const hosts = imageHostDelta(v.prod.imageHosts, v.cand.imageHosts);
76471
77118
  if (hosts.onlyProd.length > 0 || hosts.onlyCand.length > 0) {
76472
- console.log(chalk34.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
77119
+ console.log(chalk35.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
76473
77120
  }
76474
77121
  }
76475
77122
  console.log("");
76476
- console.log(` ${MARK[report.verdict]} ${chalk34.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
77123
+ console.log(` ${MARK[report.verdict]} ${chalk35.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
76477
77124
  console.log("");
76478
77125
  }
76479
77126
  function imageHostDelta(prod, cand) {
@@ -76493,8 +77140,193 @@ function formatHostDelta(d) {
76493
77140
  return parts.join(" · ");
76494
77141
  }
76495
77142
 
77143
+ // src/commands/overlay.ts
77144
+ import chalk36 from "chalk";
77145
+ var SUBPIXEL_TOLERANCE = 0.5;
77146
+ var MIN_GUTTER_PX = 2;
77147
+ function judgeOverlay(rest, open, closed) {
77148
+ if (rest.innerWidth - rest.layoutWidth < MIN_GUTTER_PX) {
77149
+ return {
77150
+ status: "inconclusive",
77151
+ 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",
77152
+ shifts: []
77153
+ };
77154
+ }
77155
+ const shifts = [];
77156
+ for (const [phase, frame] of [
77157
+ ["open", open],
77158
+ ["closed", closed]
77159
+ ]) {
77160
+ if (!frame)
77161
+ continue;
77162
+ for (const metric of ["layoutWidth", "anchorX"]) {
77163
+ const from = rest[metric];
77164
+ const to = frame[metric];
77165
+ if (from === null || to === null)
77166
+ continue;
77167
+ if (Math.abs(to - from) > SUBPIXEL_TOLERANCE)
77168
+ shifts.push({ phase, metric, from, to });
77169
+ }
77170
+ }
77171
+ if (shifts.length > 0)
77172
+ return { status: "shift", shifts };
77173
+ if (!closed) {
77174
+ return {
77175
+ status: "inconclusive",
77176
+ reason: "overlay did not close (Escape ignored?) — pass --close <selector>",
77177
+ shifts
77178
+ };
77179
+ }
77180
+ return { status: "clean", shifts };
77181
+ }
77182
+ function openSignals(page, openSel) {
77183
+ return page.evaluate((sel) => {
77184
+ const visible = (el) => {
77185
+ const r = el.getBoundingClientRect();
77186
+ const s = getComputedStyle(el);
77187
+ return r.width > 0 && r.height > 0 && s.visibility !== "hidden" && s.display !== "none";
77188
+ };
77189
+ if (sel)
77190
+ return Array.from(document.querySelectorAll(sel)).filter(visible).length;
77191
+ const locked = (el) => /hidden|clip/.test(getComputedStyle(el).overflowY);
77192
+ 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);
77193
+ }, openSel);
77194
+ }
77195
+ async function waitSignals(page, openSel, done, timeoutMs) {
77196
+ const until = Date.now() + timeoutMs;
77197
+ while (Date.now() < until) {
77198
+ if (done(await openSignals(page, openSel).catch(() => Number.NaN)))
77199
+ return true;
77200
+ await page.waitForTimeout(100);
77201
+ }
77202
+ return false;
77203
+ }
77204
+ function readFrame(page, anchor) {
77205
+ return page.evaluate((sel) => {
77206
+ const a = document.querySelector(sel);
77207
+ return {
77208
+ layoutWidth: document.documentElement.getBoundingClientRect().width,
77209
+ innerWidth: window.innerWidth,
77210
+ anchorX: a ? a.getBoundingClientRect().left : null
77211
+ };
77212
+ }, anchor);
77213
+ }
77214
+ var OPEN_TIMEOUT_MS = 3000;
77215
+ async function measureTrigger(page, url, trigger, opts) {
77216
+ const fail = (reason) => ({
77217
+ trigger,
77218
+ status: "inconclusive",
77219
+ reason,
77220
+ shifts: []
77221
+ });
77222
+ const res = await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 }).catch((err) => err);
77223
+ if (res instanceof Error)
77224
+ return fail(`${url} did not respond — ${res.message.split(`
77225
+ `)[0]}`);
77226
+ if (res && res.status() >= 400)
77227
+ return fail(`${url} responded HTTP ${res.status()}`);
77228
+ await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
77229
+ return;
77230
+ });
77231
+ await page.waitForTimeout(opts.waitMs);
77232
+ const target = page.locator(`${trigger} >> visible=true`).first();
77233
+ if (await target.count().catch(() => 0) === 0) {
77234
+ return fail("trigger matched no visible element");
77235
+ }
77236
+ const baseline = await openSignals(page, opts.open);
77237
+ const rest = await readFrame(page, opts.anchor);
77238
+ const clicked = await target.click({ timeout: 3000 }).then(() => true).catch(() => false);
77239
+ if (!clicked)
77240
+ return fail("trigger could not be clicked");
77241
+ if (!await waitSignals(page, opts.open, (n) => n > baseline, OPEN_TIMEOUT_MS)) {
77242
+ 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>");
77243
+ }
77244
+ await page.waitForTimeout(opts.settleMs);
77245
+ const open = await readFrame(page, opts.anchor);
77246
+ if (opts.close) {
77247
+ await page.locator(`${opts.close} >> visible=true`).first().click({ timeout: 3000 }).catch(() => {
77248
+ return;
77249
+ });
77250
+ } else {
77251
+ await page.keyboard.press("Escape").catch(() => {
77252
+ return;
77253
+ });
77254
+ }
77255
+ const didClose = await waitSignals(page, opts.open, (n) => n <= baseline, OPEN_TIMEOUT_MS);
77256
+ await page.waitForTimeout(opts.settleMs);
77257
+ const closed = didClose ? await readFrame(page, opts.anchor) : null;
77258
+ return { trigger, rest, open, closed, ...judgeOverlay(rest, open, closed) };
77259
+ }
77260
+ async function overlayCommand(opts) {
77261
+ const viewport = parseViewport3(opts.viewport);
77262
+ if (!viewport) {
77263
+ console.error(chalk36.red(`invalid --viewport: ${opts.viewport}`));
77264
+ return 2;
77265
+ }
77266
+ const waitMs = Math.max(0, Number.parseInt(opts.wait, 10) || 0);
77267
+ const settleMs = Math.max(0, Number.parseInt(opts.settle, 10) || 0);
77268
+ const browser = await launchBrowser({ headless: true, showScrollbars: true });
77269
+ const pages = [];
77270
+ try {
77271
+ for (const url of opts.url) {
77272
+ const ctx = await newContext(browser, { viewport });
77273
+ const page = await ctx.newPage();
77274
+ const results = [];
77275
+ try {
77276
+ for (const trigger of opts.trigger) {
77277
+ results.push(await measureTrigger(page, url, trigger, {
77278
+ open: opts.open,
77279
+ close: opts.close,
77280
+ anchor: opts.anchor,
77281
+ waitMs,
77282
+ settleMs
77283
+ }));
77284
+ }
77285
+ } finally {
77286
+ await ctx.close().catch(() => {
77287
+ return;
77288
+ });
77289
+ }
77290
+ pages.push({ url, results });
77291
+ }
77292
+ } finally {
77293
+ await browser.close().catch(() => {
77294
+ return;
77295
+ });
77296
+ }
77297
+ const all = pages.flatMap((p) => p.results);
77298
+ const code = all.some((r) => r.status === "shift") ? 1 : all.some((r) => r.status === "inconclusive") ? 2 : 0;
77299
+ if (opts.json) {
77300
+ console.log(JSON.stringify({ viewport, anchor: opts.anchor, pages }));
77301
+ return code;
77302
+ }
77303
+ for (const { url, results } of pages) {
77304
+ console.log(chalk36.bold(`
77305
+ ${url}`));
77306
+ for (const r of results) {
77307
+ if (r.status === "clean") {
77308
+ const anchorNote = r.rest?.anchorX === null ? ` (anchor ${opts.anchor} not found — width only)` : "";
77309
+ console.log(` clean ${r.trigger}${anchorNote}`);
77310
+ } else if (r.status === "inconclusive") {
77311
+ console.log(chalk36.yellow(` INCONCLUSIVE ${r.trigger} — ${r.reason}`));
77312
+ } else {
77313
+ console.log(chalk36.red(` overlay-layout-shift ${r.trigger}`));
77314
+ for (const s of r.shifts) {
77315
+ 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)`));
77316
+ }
77317
+ if (r.closed === null)
77318
+ console.log(chalk36.dim(" (overlay did not close; close leg unmeasured)"));
77319
+ }
77320
+ }
77321
+ }
77322
+ if (code === 1) {
77323
+ 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."));
77324
+ }
77325
+ return code;
77326
+ }
77327
+
76496
77328
  // src/commands/states.ts
76497
- import chalk35 from "chalk";
77329
+ import chalk37 from "chalk";
76498
77330
  var HOVERABLE = "a,button,summary,[role='button'],[role='menuitem'],label";
76499
77331
  var SETTLE_RETRY_FACTOR = 4;
76500
77332
  async function readStateEffects(page, opts) {
@@ -76599,7 +77431,10 @@ async function readDelta(page, selector, base) {
76599
77431
  };
76600
77432
  }
76601
77433
  async function gatherStates(browser, opts) {
76602
- const ctx = await newContext(browser, { viewport: opts.viewport });
77434
+ const ctx = await newContext(browser, {
77435
+ viewport: opts.viewport,
77436
+ keepMotion: true
77437
+ });
76603
77438
  const page = await ctx.newPage();
76604
77439
  const out = {
76605
77440
  motion: { found: false, error: "not read" },
@@ -76706,7 +77541,7 @@ function statesVerdict(counts) {
76706
77541
  async function statesCommand(opts) {
76707
77542
  const viewport = parseViewport3(opts.viewport);
76708
77543
  if (!viewport) {
76709
- console.error(chalk35.red(`--viewport inválido: ${opts.viewport}`));
77544
+ console.error(chalk37.red(`--viewport inválido: ${opts.viewport}`));
76710
77545
  return 2;
76711
77546
  }
76712
77547
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
@@ -76715,12 +77550,12 @@ async function statesCommand(opts) {
76715
77550
  const prodSelector = opts.prodSelector?.trim() || opts.selector?.trim();
76716
77551
  const candSelector = opts.candSelector?.trim() || opts.selector?.trim();
76717
77552
  if (!prodSelector || !candSelector) {
76718
- console.error(chalk35.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
77553
+ console.error(chalk37.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
76719
77554
  return 2;
76720
77555
  }
76721
77556
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
76722
77557
  if (aliasNote)
76723
- console.log(chalk35.dim(` ${aliasNote}`));
77558
+ console.log(chalk37.dim(` ${aliasNote}`));
76724
77559
  const browser = await launchBrowser({ headless: true });
76725
77560
  try {
76726
77561
  const [prodSide, candSide] = await Promise.all([
@@ -76743,7 +77578,7 @@ async function statesCommand(opts) {
76743
77578
  ]);
76744
77579
  if (prodSide.baseError || candSide.baseError) {
76745
77580
  const which = prodSide.baseError ? `prod: ${prodSide.baseError}` : `cand: ${candSide.baseError}`;
76746
- console.error(chalk35.red(` não foi possível ler o componente — ${which}`));
77581
+ console.error(chalk37.red(` não foi possível ler o componente — ${which}`));
76747
77582
  return 2;
76748
77583
  }
76749
77584
  const motion = prodSide.motion.found && candSide.motion.found ? diffMotion(prodSide.motion, candSide.motion, {
@@ -76780,58 +77615,58 @@ async function statesCommand(opts) {
76780
77615
  ]) {
76781
77616
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
76782
77617
  if (caveat)
76783
- console.log(chalk35.yellow(` ${caveat}`));
77618
+ console.log(chalk37.yellow(` ${caveat}`));
76784
77619
  }
76785
77620
  console.log("");
76786
- console.log(chalk35.bold(" Declared motion"));
77621
+ console.log(chalk37.bold(" Declared motion"));
76787
77622
  if (!motion) {
76788
77623
  const err = prodSide.motion.found ? candSide.motion : prodSide.motion;
76789
- console.log(chalk35.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
77624
+ console.log(chalk37.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
76790
77625
  } else {
76791
77626
  for (const line of formatMotionDiff(motion).split(`
76792
77627
  `))
76793
77628
  console.log(` ${line}`);
76794
77629
  }
76795
77630
  console.log("");
76796
- console.log(chalk35.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
77631
+ console.log(chalk37.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
76797
77632
  const nothing = effects.lost.length === 0 && effects.changed.length === 0 && effects.added.length === 0 && effects.unpaired.length === 0;
76798
77633
  if (nothing && !exercised) {
76799
- console.log(chalk35.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
77634
+ console.log(chalk37.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
76800
77635
  } else if (nothing) {
76801
77636
  console.log(" clean — every hover that changes something in prod changes the same in cand");
76802
77637
  }
76803
77638
  for (const e of effects.lost) {
76804
- console.log(chalk35.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
77639
+ console.log(chalk37.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
76805
77640
  }
76806
77641
  for (const { prod, extra, notComparable, onElement } of effects.changed) {
76807
77642
  console.log(` DIFFERS ${prod.target}${prod.label ? ` (${prod.label})` : ""}`);
76808
77643
  if (onElement.length) {
76809
- console.log(chalk35.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
77644
+ console.log(chalk37.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
76810
77645
  }
76811
77646
  if (extra.length)
76812
77647
  console.log(` cand also moves [${extra.join(", ")}]`);
76813
77648
  if (notComparable.length) {
76814
- 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.`));
77649
+ 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.`));
76815
77650
  }
76816
77651
  if (onElement.length === 0 && extra.length === 0) {
76817
- console.log(chalk35.dim(" nothing comparable differs."));
77652
+ console.log(chalk37.dim(" nothing comparable differs."));
76818
77653
  }
76819
77654
  }
76820
77655
  for (const e of effects.unpaired) {
76821
- 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)`));
77656
+ 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)`));
76822
77657
  }
76823
77658
  for (const e of effects.added) {
76824
77659
  console.log(` ADDED ${e.target} — cand moves [${e.properties.join(", ")}]; prod does not`);
76825
77660
  }
76826
77661
  if (effects.unpaired.length > 0 && effects.lost.length === 0 && effects.changed.length === 0) {
76827
77662
  console.log("");
76828
- 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.`));
77663
+ 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.`));
76829
77664
  }
76830
77665
  if (prodSide.ambient > 0 || candSide.ambient > 0) {
76831
- 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.`));
77666
+ 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.`));
76832
77667
  }
76833
77668
  if (prodSide.truncated || candSide.truncated) {
76834
- console.log(chalk35.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
77669
+ console.log(chalk37.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
76835
77670
  }
76836
77671
  return inconclusive || effects.lost.length > 0 || (motion?.findings.length ?? 0) > 0 ? 1 : 0;
76837
77672
  } finally {
@@ -76842,7 +77677,7 @@ async function statesCommand(opts) {
76842
77677
  }
76843
77678
 
76844
77679
  // src/commands/variance.ts
76845
- import chalk36 from "chalk";
77680
+ import chalk38 from "chalk";
76846
77681
 
76847
77682
  // src/diff/variance.ts
76848
77683
  var uniq2 = (xs) => [...new Set(xs)];
@@ -76946,7 +77781,7 @@ function formatVariance(report, opts = {}) {
76946
77781
  // src/commands/variance.ts
76947
77782
  function varianceCommand(opts) {
76948
77783
  if (opts.runIds.length < 2) {
76949
- console.error(chalk36.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
77784
+ console.error(chalk38.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
76950
77785
  return 2;
76951
77786
  }
76952
77787
  const budget = Number.parseFloat(opts.scoreBudget ?? "1");
@@ -76955,7 +77790,7 @@ function varianceCommand(opts) {
76955
77790
  try {
76956
77791
  runs.push(loadRun(opts.output, id));
76957
77792
  } catch (err) {
76958
- console.error(chalk36.red(` ✖ ${err.message}`));
77793
+ console.error(chalk38.red(` ✖ ${err.message}`));
76959
77794
  return 2;
76960
77795
  }
76961
77796
  }
@@ -76964,7 +77799,7 @@ function varianceCommand(opts) {
76964
77799
  console.log(JSON.stringify({ ...report, stable: isStable(report, budget), scoreBudget: budget }));
76965
77800
  } else {
76966
77801
  console.log("");
76967
- console.log(chalk36.bold(" Score variance"));
77802
+ console.log(chalk38.bold(" Score variance"));
76968
77803
  for (const line of formatVariance(report, { scoreBudget: budget }).split(`
76969
77804
  `)) {
76970
77805
  console.log(` ${line}`);
@@ -76976,10 +77811,10 @@ function varianceCommand(opts) {
76976
77811
  }
76977
77812
 
76978
77813
  // src/commands/vitals.ts
76979
- import { existsSync as existsSync33, readFileSync as readFileSync41, writeFileSync as writeFileSync35 } from "node:fs";
77814
+ import { existsSync as existsSync34, readFileSync as readFileSync42, writeFileSync as writeFileSync35 } from "node:fs";
76980
77815
  import { availableParallelism } from "node:os";
76981
77816
  import { join as join46 } from "node:path";
76982
- import chalk37 from "chalk";
77817
+ import chalk39 from "chalk";
76983
77818
  import ora9 from "ora";
76984
77819
 
76985
77820
  // src/checks/agentic-nav.ts
@@ -77277,10 +78112,10 @@ async function vitalsCommand(opts) {
77277
78112
  const runId = newRunId();
77278
78113
  const paths = createRunDir(opts.output, runId);
77279
78114
  const t0 = Date.now();
77280
- console.log(chalk37.bold(`
78115
+ console.log(chalk39.bold(`
77281
78116
  parity vitals ${runId}`));
77282
- console.log(chalk37.dim(` prod: ${opts.prod}`));
77283
- console.log(chalk37.dim(` cand: ${opts.cand}`));
78117
+ console.log(chalk39.dim(` prod: ${opts.prod}`));
78118
+ console.log(chalk39.dim(` cand: ${opts.cand}`));
77284
78119
  const discoverSpinner = ora9("Descobrindo páginas…").start();
77285
78120
  const pagePaths = await discoverPagePaths2(opts.prod, opts);
77286
78121
  if (pagePaths.length === 0) {
@@ -77312,7 +78147,7 @@ async function vitalsCommand(opts) {
77312
78147
  completed++;
77313
78148
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
77314
78149
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
77315
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
78150
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk39.cyan("prod") : chalk39.magenta("cand")} ${task.path} (${task.viewport})`;
77316
78151
  }
77317
78152
  });
77318
78153
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
@@ -77341,7 +78176,7 @@ async function vitalsCommand(opts) {
77341
78176
  }
77342
78177
  lhCompleted++;
77343
78178
  const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
77344
- lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
78179
+ lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk39.cyan("prod") : chalk39.magenta("cand")} ${task.path} (${task.viewport})`;
77345
78180
  });
77346
78181
  lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
77347
78182
  }
@@ -77417,10 +78252,10 @@ async function vitalsCommand(opts) {
77417
78252
  opportunities: aggregateOpportunities(checkCtx.candPages)
77418
78253
  }, null, 2)}
77419
78254
  `, "utf8");
77420
- printSummary8(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
78255
+ printSummary9(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
77421
78256
  console.log("");
77422
- console.log(chalk37.dim(` → ${paths.reportHtml}`));
77423
- console.log(chalk37.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
78257
+ console.log(chalk39.dim(` → ${paths.reportHtml}`));
78258
+ console.log(chalk39.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
77424
78259
  console.log("");
77425
78260
  if (opts.open) {
77426
78261
  const { default: open } = await import("open");
@@ -77510,15 +78345,15 @@ async function discoverPagePaths2(prodUrl, opts) {
77510
78345
  function parseUrlList(input) {
77511
78346
  if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
77512
78347
  const path = input.replace(/^file:\/\//, "");
77513
- if (existsSync33(path)) {
77514
- return readFileSync41(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
78348
+ if (existsSync34(path)) {
78349
+ return readFileSync42(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
77515
78350
  }
77516
78351
  }
77517
78352
  return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
77518
78353
  }
77519
- function printSummary8(vitals, cache, scores, opportunities, agentic) {
78354
+ function printSummary9(vitals, cache, scores, opportunities, agentic) {
77520
78355
  console.log("");
77521
- console.log(chalk37.bold(" Summary:"));
78356
+ console.log(chalk39.bold(" Summary:"));
77522
78357
  console.log(` ${vitals.summary}`);
77523
78358
  console.log(` ${cache.summary}`);
77524
78359
  if (scores.status !== "skipped")
@@ -77581,13 +78416,14 @@ program.command("list").description("List saved runs").option("--output <dir>",
77581
78416
  }).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) => {
77582
78417
  process.exit(listModulesCommand(Boolean(opts.json)));
77583
78418
  }));
77584
- 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) => {
78419
+ 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) => {
77585
78420
  if (opts.create && opts.create !== "global" && opts.create !== "page") {
77586
78421
  console.error("--create must be `global` or `page`");
77587
78422
  process.exit(2);
77588
78423
  }
77589
78424
  process.exit(planSetStatusCommand(opts.dir, name, status, {
77590
- create: opts.create
78425
+ create: opts.create,
78426
+ note: opts.note
77591
78427
  }));
77592
78428
  })).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) => {
77593
78429
  process.exit(planSetPageStatusCommand(opts.dir, path, status));
@@ -77703,6 +78539,9 @@ function buildCacheProbeCommand(name, deprecated) {
77703
78539
  }
77704
78540
  cacheTopCommand.addCommand(buildCacheProbeCommand("probe", false));
77705
78541
  program.addCommand(buildCacheProbeCommand("cache-gap", true));
78542
+ 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) => {
78543
+ process.exit(await loadtestCommand(opts));
78544
+ });
77706
78545
  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) => {
77707
78546
  process.exit(await vitalsCommand(opts));
77708
78547
  });
@@ -77911,6 +78750,19 @@ program.command("states").description("Compare a component's INTERACTIVE states,
77911
78750
  json: opts.json
77912
78751
  }));
77913
78752
  });
78753
+ 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) => {
78754
+ process.exit(await overlayCommand({
78755
+ url: opts.url,
78756
+ trigger: opts.trigger,
78757
+ open: opts.open,
78758
+ close: opts.close,
78759
+ anchor: opts.anchor,
78760
+ viewport: opts.viewport,
78761
+ wait: opts.wait,
78762
+ settle: opts.settle,
78763
+ json: opts.json
78764
+ }));
78765
+ });
77914
78766
  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) => {
77915
78767
  deprecatedNotice("fix", "section --all");
77916
78768
  if (opts.pt) {
@@ -77942,7 +78794,7 @@ program.command("extract").description("Single-site AI-ready component extractio
77942
78794
  }));
77943
78795
  });
77944
78796
  function buildCaptureCommand(name, deprecated) {
77945
- 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) => {
78797
+ 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) => {
77946
78798
  if (deprecated)
77947
78799
  deprecatedNotice("migrate", "capture");
77948
78800
  process.exit(await migrateCommand({
@@ -77955,6 +78807,7 @@ function buildCaptureCommand(name, deprecated) {
77955
78807
  noSourceHunt: !opts.sourceHunt,
77956
78808
  viewport: opts.viewport,
77957
78809
  viewports: opts.viewports,
78810
+ componentViewports: opts.componentViewports,
77958
78811
  sample: opts.sample,
77959
78812
  format: opts.format,
77960
78813
  outDir: opts.out,