@decocms/parity 0.33.59 → 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 +1326 -512
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -39072,6 +39072,7 @@ async function launchBrowser(opts = {}) {
39072
39072
  headless: opts.headless ?? true,
39073
39073
  slowMo: opts.slowMo ?? 0,
39074
39074
  timeout: 30000,
39075
+ ignoreDefaultArgs: opts.showScrollbars ? ["--hide-scrollbars"] : undefined,
39075
39076
  args: [
39076
39077
  "--disable-blink-features=AutomationControlled",
39077
39078
  "--no-sandbox",
@@ -46681,21 +46682,47 @@ async function navigateWithHover(page, targetUrl, productImage = false) {
46681
46682
  const targetPath = new URL(targetUrl).pathname;
46682
46683
  const sel = `a[href="${cssAttrEscape(targetUrl)}"], a[href="${cssAttrEscape(targetPath)}"], a[href^="${cssAttrEscape(`${targetPath}?`)}"]`;
46683
46684
  const anchor = page.locator(sel).first();
46685
+ const docStart = await page.evaluate(() => performance.timeOrigin).catch(() => {
46686
+ return;
46687
+ });
46684
46688
  const visible = await anchor.isVisible({ timeout: 1500 }).catch(() => false);
46685
46689
  let t;
46690
+ let viaFallback = false;
46691
+ let prefetched;
46686
46692
  if (visible) {
46687
46693
  await anchor.hover({ timeout: 1500 }).catch(() => {
46688
46694
  return;
46689
46695
  });
46690
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);
46691
46709
  t = Date.now();
46692
46710
  await Promise.allSettled([
46693
- page.waitForURL((u) => u.toString().includes(targetPath), { timeout: NAV_CAP_MS }).catch(() => {
46711
+ page.waitForURL((u) => u.toString().includes(targetPath), { timeout: 6000 }).catch(() => {
46694
46712
  return;
46695
46713
  }),
46696
- anchor.click({ timeout: 3000 })
46714
+ box ? page.mouse.up() : anchor.click({ timeout: 3000 })
46697
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
+ }
46698
46724
  } else {
46725
+ viaFallback = true;
46699
46726
  t = Date.now();
46700
46727
  await page.goto(targetUrl, { waitUntil: "domcontentloaded", timeout: NAV_CAP_MS }).catch(() => {
46701
46728
  return;
@@ -46709,7 +46736,62 @@ async function navigateWithHover(page, targetUrl, productImage = false) {
46709
46736
  ok = await waitReady(page);
46710
46737
  }
46711
46738
  const navMs = Date.now() - t;
46712
- 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
+ });
46713
46795
  }
46714
46796
  var HAMBURGER_SELECTORS = [
46715
46797
  'button[aria-label*="menu" i]',
@@ -46889,7 +46971,13 @@ async function clickShelfProduct(page, ctx) {
46889
46971
  return "";
46890
46972
  }
46891
46973
  })();
46892
- 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;
46893
46981
  }
46894
46982
  async function onePass(page, ctx, targets, paginations, measure) {
46895
46983
  const shot = async (label, fullPage) => {
@@ -46994,7 +47082,8 @@ async function onePass(page, ctx, targets, paginations, measure) {
46994
47082
  ms: pdpNav.navMs,
46995
47083
  url: page.url(),
46996
47084
  ok: pdpOk,
46997
- note: pdpOk ? undefined : pdpBroken ? "página não encontrada / erro" : !reachedPdp() ? "produto não encontrado (após retry)" : "imagem do produto não carregou"
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)
46998
47087
  };
46999
47088
  await scrollPageInChunks(page).catch(() => {
47000
47089
  return;
@@ -47052,7 +47141,8 @@ async function onePass(page, ctx, targets, paginations, measure) {
47052
47141
  ms: shelfHit?.navMs ?? 0,
47053
47142
  url: page.url(),
47054
47143
  ok: shelfOk,
47055
- note: shelfBroken ? "página não encontrada / erro" : !shelfHit ? "shelf sem produto (após retry)" : !shelfHit.imgOk ? "imagem do produto da shelf não carregou" : "produto da shelf (SPA→SPA)"
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)
47056
47146
  };
47057
47147
  await scrollPageInChunks(page).catch(() => {
47058
47148
  return;
@@ -47474,6 +47564,7 @@ async function runSideBenchmark(opts) {
47474
47564
  deviceScaleFactor: 1,
47475
47565
  cohortCookieValue: "control"
47476
47566
  });
47567
+ trackSpeculativeRequests(ctx);
47477
47568
  try {
47478
47569
  const page = await ctx.newPage();
47479
47570
  const flowCtx = flowCtxFor(ctx);
@@ -47554,12 +47645,16 @@ async function runSideBenchmark(opts) {
47554
47645
  };
47555
47646
  }
47556
47647
  function aggregatePhase(step, samples) {
47648
+ const pf = samples.filter((s) => s.prefetched !== undefined);
47557
47649
  return {
47558
47650
  step,
47559
47651
  ms: median(samples.map((s) => s.ms)),
47560
47652
  url: samples[0]?.url,
47561
47653
  ok: samples.length > 0 && samples.every((s) => s.ok),
47562
- 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
+ } : {}
47563
47658
  };
47564
47659
  }
47565
47660
  function aggregatePaginationTotal(measured) {
@@ -47648,7 +47743,7 @@ async function resolveContentPaths(opts) {
47648
47743
  };
47649
47744
  await dismissAll(page, flow);
47650
47745
  const brand = await captureBrand(page);
47651
- const hrefs = await page.evaluate(() => Array.from(document.querySelectorAll("header a[href], nav a[href], a[href]")).map((a) => a.getAttribute("href")).filter((h) => !!h)).catch(() => []);
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(() => []);
47652
47747
  const candidates = filterContentPaths(hrefs, opts.prodBase);
47653
47748
  const ok = [];
47654
47749
  for (const path of candidates) {
@@ -47672,6 +47767,38 @@ async function resolveContentPaths(opts) {
47672
47767
  });
47673
47768
  }
47674
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
+ }
47675
47802
  async function onePassContent(page, ctx, paths, measure) {
47676
47803
  const shot = async (label, fullPage) => {
47677
47804
  if (!measure)
@@ -47699,27 +47826,24 @@ async function onePassContent(page, ctx, paths, measure) {
47699
47826
  });
47700
47827
  const homeShot = await shot("home", true);
47701
47828
  await scrollToTop(page);
47702
- const urlA = new URL(paths.pageA, ctx.baseUrl).toString();
47703
- const a = await navigateWithHover(page, urlA, false);
47704
- const nav1Broken = await pageLooksBroken(page);
47705
- const nav1 = {
47706
- step: "nav-to-page-1",
47707
- ms: a.navMs,
47708
- url: page.url(),
47709
- ok: a.ok && !nav1Broken,
47710
- note: !a.ok ? `atingiu o cap de espera sem sinal de prontidão (${paths.pageA})` : nav1Broken ? "página não encontrada / erro" : paths.pageA
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
+ };
47711
47843
  };
47844
+ const nav1 = await hop("nav-to-page-1", paths.pageA);
47712
47845
  const shotA = await shot("page1", true);
47713
- const urlB = new URL(paths.pageB, ctx.baseUrl).toString();
47714
- const b = await navigateWithHover(page, urlB, false);
47715
- const nav2Broken = await pageLooksBroken(page);
47716
- const nav2 = {
47717
- step: "nav-to-page-2",
47718
- ms: b.navMs,
47719
- url: page.url(),
47720
- ok: b.ok && !nav2Broken,
47721
- note: !b.ok ? `atingiu o cap de espera sem sinal de prontidão (${paths.pageB})` : nav2Broken ? "página não encontrada / erro" : paths.pageB
47722
- };
47846
+ const nav2 = await hop("nav-to-page-2", paths.pageB);
47723
47847
  const shotB = await shot("page2", true);
47724
47848
  return { home, nav1, nav2, screenshots: { home: homeShot, plp: shotA, pdp: shotB } };
47725
47849
  }
@@ -47743,6 +47867,7 @@ async function runSideBenchmarkContent(opts) {
47743
47867
  deviceScaleFactor: 1,
47744
47868
  cohortCookieValue: "control"
47745
47869
  });
47870
+ trackSpeculativeRequests(ctx);
47746
47871
  const flowCtx = {
47747
47872
  baseUrl: opts.base,
47748
47873
  side: opts.side,
@@ -48572,6 +48697,11 @@ function renderStep(step, prod, cand, lang) {
48572
48697
  const delta = failed ? `<div class="step-delta"><strong style="color:${DECK.bad}">⚠ ${L("erro", "error", lang)}</strong>
48573
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>
48574
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>` : "";
48575
48705
  return `
48576
48706
  <section class="step${failed ? " step-failed" : ""}">
48577
48707
  <div class="step-head">
@@ -48584,6 +48714,7 @@ function renderStep(step, prod, cand, lang) {
48584
48714
  ${subSteps}
48585
48715
  </div>
48586
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}
48587
48718
  <div class="step-shots">
48588
48719
  ${figure(shotKey ? prod.screenshots[shotKey] : undefined, "Fresh", prodFailed ? DECK.bad : DECK.faint, prodStep?.url, scroll)}
48589
48720
  ${figure(shotKey ? cand.screenshots[shotKey] : undefined, "TanStack", candFailed ? DECK.bad : DECK.soft, candStep?.url, scroll)}
@@ -49171,7 +49302,8 @@ function printSummary2(report) {
49171
49302
  for (const cs of cand.steps) {
49172
49303
  const ps = prod.steps.find((s) => s.step === cs.step);
49173
49304
  const flag = ps?.ok === false || cs.ok === false ? chalk5.red(` ✗ ERRO: ${cs.ok === false ? "cand" : "prod"} ${cs.note ?? ""}`) : "";
49174
- console.log(` ${cs.step.padEnd(16)} prod ${fmt(ps?.ms ?? 0).padStart(8)} cand ${fmt(cs.ms).padStart(8)}${flag}`);
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}`) : ""}`);
49175
49307
  }
49176
49308
  }
49177
49309
  const failed = report.sides.flatMap((s) => s.steps.filter((st) => st.ok === false).map((st) => `${s.side}/${st.step}`));
@@ -61934,6 +62066,7 @@ async function captureSectionArtifacts(page, opts) {
61934
62066
  const matches = $(opts.selector);
61935
62067
  if (matches.length === 0) {
61936
62068
  result.htmlError = `seletor '${opts.selector}' não casou nenhum elemento`;
62069
+ result.htmlNoMatch = true;
61937
62070
  } else {
61938
62071
  result.html = $.html(matches.first());
61939
62072
  }
@@ -62434,6 +62567,26 @@ function compactComponentHtml(html, maxChars = COMPONENT_HTML_MAX_CHARS) {
62434
62567
  truncated
62435
62568
  };
62436
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
+ }
62437
62590
 
62438
62591
  // src/commands/section.ts
62439
62592
  import { mkdirSync as mkdirSync12 } from "node:fs";
@@ -62915,7 +63068,7 @@ function mergePlanDecisions(fresh, previous) {
62915
63068
  return { plan: fresh, carried, keptUncaptured, droppedWithDecisions: [] };
62916
63069
  }
62917
63070
  var PLAN_FILE = "migration-plan.json";
62918
- var SETTLED = new Set(["done", "as-is", "upgrade", "skipped"]);
63071
+ var SETTLED = new Set(["done", "as-is", "upgrade", "skipped", "vanished"]);
62919
63072
  function loadPlan(dir) {
62920
63073
  const p = join22(dir, PLAN_FILE);
62921
63074
  if (!existsSync13(p))
@@ -62929,9 +63082,26 @@ function savePlan(dir, plan) {
62929
63082
  function setComponentStatus(plan, name, status, opts = {}) {
62930
63083
  const k = key(name);
62931
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
+ };
62932
63102
  if (component) {
62933
63103
  component.status = status;
62934
- return component;
63104
+ return withNote(component);
62935
63105
  }
62936
63106
  if (!opts.create)
62937
63107
  return null;
@@ -62947,7 +63117,7 @@ function setComponentStatus(plan, name, status, opts = {}) {
62947
63117
  verified: null
62948
63118
  };
62949
63119
  plan.components.push(created);
62950
- return created;
63120
+ return withNote(created);
62951
63121
  }
62952
63122
  function setComponentProvenance(plan, name, provenance) {
62953
63123
  const k = key(name);
@@ -63009,10 +63179,15 @@ function planProgress(plan) {
63009
63179
  done: 0,
63010
63180
  "as-is": 0,
63011
63181
  upgrade: 0,
63012
- skipped: 0
63182
+ skipped: 0,
63183
+ vanished: 0
63013
63184
  };
63014
63185
  const settled = [];
63015
- const settledByStatus = { done: [], skipped: [] };
63186
+ const settledByStatus = {
63187
+ done: [],
63188
+ skipped: [],
63189
+ vanished: []
63190
+ };
63016
63191
  const accepted = { asIs: [], upgrade: [] };
63017
63192
  const remaining = [];
63018
63193
  for (const c of plan.components) {
@@ -63025,6 +63200,8 @@ function planProgress(plan) {
63025
63200
  settledByStatus.done.push(c.name);
63026
63201
  if (c.status === "skipped")
63027
63202
  settledByStatus.skipped.push(c.name);
63203
+ if (c.status === "vanished")
63204
+ settledByStatus.vanished.push(c.name);
63028
63205
  if (SETTLED.has(c.status))
63029
63206
  settled.push(c.name);
63030
63207
  else
@@ -63081,7 +63258,7 @@ function sourcePath(plan, c) {
63081
63258
  function disposition(c) {
63082
63259
  if (c.status === "pending" || c.status === "partial")
63083
63260
  return "build";
63084
- if (c.status === "skipped")
63261
+ if (c.status === "skipped" || c.status === "vanished")
63085
63262
  return "settled";
63086
63263
  if (c.status === "as-is")
63087
63264
  return "as-is";
@@ -65469,10 +65646,229 @@ function listCommand(output) {
65469
65646
  return 0;
65470
65647
  }
65471
65648
 
65472
- // src/commands/migrate.ts
65473
- import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync24, writeFileSync as writeFileSync25 } from "node:fs";
65474
- import { resolve as resolve7 } from "node:path";
65649
+ // src/commands/loadtest.ts
65650
+ import { existsSync as existsSync14, readFileSync as readFileSync20 } from "node:fs";
65475
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";
65476
65872
  import open from "open";
65477
65873
 
65478
65874
  // src/migrate/pdp-discovery.ts
@@ -65900,7 +66296,7 @@ function escapePipes2(s) {
65900
66296
  }
65901
66297
 
65902
66298
  // src/migrate/exporters/html.ts
65903
- import { readFileSync as readFileSync20, writeFileSync as writeFileSync24 } from "node:fs";
66299
+ import { readFileSync as readFileSync21, writeFileSync as writeFileSync24 } from "node:fs";
65904
66300
  import { join as join27 } from "node:path";
65905
66301
 
65906
66302
  // src/migrate/targets/faststore-v4.ts
@@ -66242,7 +66638,7 @@ function dataUri2(absPath) {
66242
66638
  const mime = MIME2[ext];
66243
66639
  if (!mime)
66244
66640
  return null;
66245
- return `data:${mime};base64,${readFileSync20(absPath).toString("base64")}`;
66641
+ return `data:${mime};base64,${readFileSync21(absPath).toString("base64")}`;
66246
66642
  } catch {
66247
66643
  return null;
66248
66644
  }
@@ -66491,7 +66887,7 @@ function buildMigrationPrompt(bundle, playbook, source) {
66491
66887
  }
66492
66888
 
66493
66889
  // src/migrate/sources/deco-fresh.ts
66494
- import { existsSync as existsSync14, readFileSync as readFileSync21 } from "node:fs";
66890
+ import { existsSync as existsSync15, readFileSync as readFileSync22 } from "node:fs";
66495
66891
  import { join as join29 } from "node:path";
66496
66892
 
66497
66893
  // src/migrate/sources/walk.ts
@@ -66537,13 +66933,13 @@ function walkFiles(dir, exts) {
66537
66933
  function isDecoFresh(repoDir) {
66538
66934
  const denoJson = join29(repoDir, "deno.json");
66539
66935
  const denoJsonc = join29(repoDir, "deno.jsonc");
66540
- const file = existsSync14(denoJson) ? denoJson : existsSync14(denoJsonc) ? denoJsonc : null;
66936
+ const file = existsSync15(denoJson) ? denoJson : existsSync15(denoJsonc) ? denoJsonc : null;
66541
66937
  if (!file)
66542
66938
  return false;
66543
- if (!existsSync14(join29(repoDir, "fresh.gen.ts")))
66939
+ if (!existsSync15(join29(repoDir, "fresh.gen.ts")))
66544
66940
  return false;
66545
66941
  try {
66546
- return readFileSync21(file, "utf8").includes("@deco/deco");
66942
+ return readFileSync22(file, "utf8").includes("@deco/deco");
66547
66943
  } catch {
66548
66944
  return false;
66549
66945
  }
@@ -66552,7 +66948,7 @@ var GLOBAL_HINT = /\b(header|footer|navbar|menu|topbar)\b/i;
66552
66948
  function inventory(repoDir) {
66553
66949
  const components = [];
66554
66950
  const sectionsDir = join29(repoDir, "sections");
66555
- if (existsSync14(sectionsDir)) {
66951
+ if (existsSync15(sectionsDir)) {
66556
66952
  for (const rel of walkFiles(sectionsDir, [".tsx"])) {
66557
66953
  const key = rel.replace(/\.tsx$/, "");
66558
66954
  components.push({
@@ -66566,9 +66962,9 @@ function inventory(repoDir) {
66566
66962
  const notes = [
66567
66963
  "Source: Deco on Fresh/Deno (Preact + signals, JSX). Sections are the CMS unit."
66568
66964
  ];
66569
- if (existsSync14(join29(repoDir, "islands")))
66965
+ if (existsSync15(join29(repoDir, "islands")))
66570
66966
  notes.push("Has islands/ — client-interactive components.");
66571
- if (existsSync14(join29(repoDir, "loaders")))
66967
+ if (existsSync15(join29(repoDir, "loaders")))
66572
66968
  notes.push("Has loaders/ — server data functions to port.");
66573
66969
  return { components, notes };
66574
66970
  }
@@ -66608,14 +67004,14 @@ captured HTML/computed-styles as the source of truth for structure and styling.`
66608
67004
  };
66609
67005
 
66610
67006
  // src/migrate/sources/vtex-io.ts
66611
- import { existsSync as existsSync15, readFileSync as readFileSync22 } from "node:fs";
67007
+ import { existsSync as existsSync16, readFileSync as readFileSync23 } from "node:fs";
66612
67008
  import { join as join30 } from "node:path";
66613
67009
  function readManifest(repoDir) {
66614
67010
  const file = join30(repoDir, "manifest.json");
66615
- if (!existsSync15(file))
67011
+ if (!existsSync16(file))
66616
67012
  return null;
66617
67013
  try {
66618
- return JSON.parse(readFileSync22(file, "utf8"));
67014
+ return JSON.parse(readFileSync23(file, "utf8"));
66619
67015
  } catch {
66620
67016
  return null;
66621
67017
  }
@@ -66638,12 +67034,12 @@ var GLOBAL_HINT2 = /header|footer|menu|minicart|navbar/i;
66638
67034
  function inventory2(repoDir) {
66639
67035
  const blocksDir = join30(repoDir, "store", "blocks");
66640
67036
  const seen = new Map;
66641
- if (existsSync15(blocksDir)) {
67037
+ if (existsSync16(blocksDir)) {
66642
67038
  for (const rel of walkFiles(blocksDir, [".json", ".jsonc"])) {
66643
67039
  const abs = join30(blocksDir, rel);
66644
67040
  let parsed;
66645
67041
  try {
66646
- parsed = JSON.parse(stripJsonc(readFileSync22(abs, "utf8")));
67042
+ parsed = JSON.parse(stripJsonc(readFileSync23(abs, "utf8")));
66647
67043
  } catch {
66648
67044
  continue;
66649
67045
  }
@@ -66687,7 +67083,7 @@ CMS placeholders.`
66687
67083
  };
66688
67084
 
66689
67085
  // src/migrate/sources/find.ts
66690
- import { existsSync as existsSync16, readdirSync as readdirSync5, statSync } from "node:fs";
67086
+ import { existsSync as existsSync17, readdirSync as readdirSync5, statSync } from "node:fs";
66691
67087
  import { basename as basename4, join as join31, resolve as resolve6 } from "node:path";
66692
67088
  var GENERIC_LABELS = new Set(["www", "m", "www2", "loja", "shop", "store", "secure", "web"]);
66693
67089
  var TARGET_SUFFIXES = ["-tanstack", "-faststore", "-next", "-cand", "-candidate", "-migration"];
@@ -66745,7 +67141,7 @@ function scoreCandidate(dir, slug) {
66745
67141
  }
66746
67142
  function findSourceCandidates(opts) {
66747
67143
  const slug = slugFromUrl(opts.url);
66748
- 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));
66749
67145
  if (!slug)
66750
67146
  return { roots, candidates: [] };
66751
67147
  const excluded = new Set((opts.exclude ?? []).map((p) => resolve6(p)));
@@ -66809,7 +67205,7 @@ function formatSourceHunt(result) {
66809
67205
  `);
66810
67206
  }
66811
67207
  // src/migrate/sources/project.ts
66812
- 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";
66813
67209
  import { join as join32 } from "node:path";
66814
67210
  var MAX_PROPS_CHARS = 4000;
66815
67211
  var MAX_PAGES = 60;
@@ -66884,7 +67280,7 @@ function readComponentDetail(repoDir, file) {
66884
67280
  const abs = join32(repoDir, file);
66885
67281
  let source;
66886
67282
  try {
66887
- source = readFileSync23(abs, "utf8");
67283
+ source = readFileSync24(abs, "utf8");
66888
67284
  } catch {
66889
67285
  return null;
66890
67286
  }
@@ -66907,11 +67303,11 @@ var TOKEN_CANDIDATES = [
66907
67303
  "styles/configs/color.json"
66908
67304
  ];
66909
67305
  function findTokenFiles(repoDir) {
66910
- return TOKEN_CANDIDATES.filter((f) => existsSync17(join32(repoDir, f)));
67306
+ return TOKEN_CANDIDATES.filter((f) => existsSync18(join32(repoDir, f)));
66911
67307
  }
66912
67308
  function readDecoPages(repoDir) {
66913
67309
  const blocksDir = join32(repoDir, ".deco", "blocks");
66914
- if (!existsSync17(blocksDir))
67310
+ if (!existsSync18(blocksDir))
66915
67311
  return { pages: [], total: 0 };
66916
67312
  let files;
66917
67313
  try {
@@ -66925,7 +67321,7 @@ function readDecoPages(repoDir) {
66925
67321
  break;
66926
67322
  let parsed;
66927
67323
  try {
66928
- parsed = JSON.parse(readFileSync23(join32(blocksDir, file), "utf8"));
67324
+ parsed = JSON.parse(readFileSync24(join32(blocksDir, file), "utf8"));
66929
67325
  } catch {
66930
67326
  continue;
66931
67327
  }
@@ -67475,22 +67871,25 @@ async function captureInteractions(page, selector) {
67475
67871
  async function migrateCommand(opts) {
67476
67872
  const viewport = parseViewport3(opts.viewport);
67477
67873
  if (!viewport) {
67478
- 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)`));
67479
67875
  return 2;
67480
67876
  }
67481
67877
  const viewports = (opts.viewports ? opts.viewports.split(",") : [opts.viewport]).map((v) => parseViewport3(v.trim())).filter((v) => Boolean(v));
67482
67878
  if (viewports.length === 0) {
67483
- console.error(chalk21.red(`--viewports inválido: ${opts.viewports}`));
67879
+ console.error(chalk22.red(`--viewports inválido: ${opts.viewports}`));
67484
67880
  return 2;
67485
67881
  }
67486
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
+ }
67487
67886
  if (!isValidUrl4(opts.url)) {
67488
- console.error(chalk21.red(`--url inválido: ${opts.url}`));
67887
+ console.error(chalk22.red(`--url inválido: ${opts.url}`));
67489
67888
  return 2;
67490
67889
  }
67491
67890
  const format = normalizeFormat2(opts.format);
67492
67891
  if (!format) {
67493
- 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)`));
67494
67893
  return 2;
67495
67894
  }
67496
67895
  let pageTokens;
@@ -67500,14 +67899,14 @@ async function migrateCommand(opts) {
67500
67899
  fallback: ["/", "category-auto", "pdp-auto"]
67501
67900
  });
67502
67901
  } catch (err) {
67503
- console.error(chalk21.red(err.message));
67902
+ console.error(chalk22.red(err.message));
67504
67903
  return 2;
67505
67904
  }
67506
67905
  let playbook;
67507
67906
  if (opts.target) {
67508
67907
  playbook = getTargetPlaybook(opts.target);
67509
67908
  if (!playbook) {
67510
- 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(", ")})`));
67511
67910
  return 2;
67512
67911
  }
67513
67912
  }
@@ -67517,7 +67916,7 @@ async function migrateCommand(opts) {
67517
67916
  if (opts.sourceKind) {
67518
67917
  const s = getSource(opts.sourceKind);
67519
67918
  if (!s) {
67520
- 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(", ")})`));
67521
67920
  return 2;
67522
67921
  }
67523
67922
  source = s;
@@ -67525,24 +67924,24 @@ async function migrateCommand(opts) {
67525
67924
  let sourceHunt = null;
67526
67925
  let sourceProject = null;
67527
67926
  if (opts.source) {
67528
- if (!existsSync18(opts.source)) {
67529
- 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}`));
67530
67929
  return 2;
67531
67930
  }
67532
67931
  if (!opts.sourceKind)
67533
67932
  source = detectSource(opts.source);
67534
67933
  sourceInventory = source.inventory(opts.source);
67535
- 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`));
67536
67935
  sourceProject = readSourceProject(opts.source, sourceInventory.components);
67537
67936
  for (const note of sourceProject.notes)
67538
- console.log(chalk21.dim(` ${note}`));
67937
+ console.log(chalk22.dim(` ${note}`));
67539
67938
  } else if (!opts.noSourceHunt) {
67540
67939
  sourceHunt = findSourceCandidates({
67541
67940
  url: opts.url,
67542
67941
  roots: defaultSearchRoots()
67543
67942
  });
67544
67943
  const message = formatSourceHunt(sourceHunt);
67545
- 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));
67546
67945
  }
67547
67946
  const host = safeHost6(opts.url);
67548
67947
  const runDir = resolve7(opts.outDir, host);
@@ -67559,16 +67958,16 @@ async function migrateCommand(opts) {
67559
67958
  let screenshots;
67560
67959
  let vtexBlocks = null;
67561
67960
  let contentMap = {};
67562
- if (!opts.refresh && existsSync18(themePath) && existsSync18(assetsPath)) {
67961
+ if (!opts.refresh && existsSync19(themePath) && existsSync19(assetsPath)) {
67563
67962
  theme = readJson(themePath);
67564
67963
  const meta = readJson(assetsPath);
67565
67964
  platform = meta.platform;
67566
67965
  stack = meta.stack ?? null;
67567
67966
  assets = meta.assets;
67568
67967
  screenshots = meta.screenshots ?? [];
67569
- console.log(chalk21.dim(" phase 1 theme+assets: cached"));
67968
+ console.log(chalk22.dim(" phase 1 theme+assets: cached"));
67570
67969
  } else {
67571
- console.log(chalk21.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67970
+ console.log(chalk22.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67572
67971
  mkdirSync16(resolve7(runDir, "screenshots"), { recursive: true });
67573
67972
  const samples = [];
67574
67973
  screenshots = [];
@@ -67593,9 +67992,9 @@ async function migrateCommand(opts) {
67593
67992
  platformSeen = detectPlatform({ url: opts.url, html: pageHtml });
67594
67993
  const cookieNames = await ctx.cookies().then((cs) => cs.map((c) => c.name).join("; ")).catch(() => "");
67595
67994
  stack = classifyLiveStack(pageHtml, cookieNames);
67596
- console.log(chalk21.dim(` stack: ${describeStack(stack)}`));
67995
+ console.log(chalk22.dim(` stack: ${describeStack(stack)}`));
67597
67996
  if (!opts.source && stack.frontend !== "unknown") {
67598
- console.warn(chalk21.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67997
+ console.warn(chalk22.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67599
67998
  Re-run with --source <repo> for structural porting (real class strings, not measured pixels).`));
67600
67999
  }
67601
68000
  const rawAssets = await collectSiteAssets(page);
@@ -67629,11 +68028,11 @@ async function migrateCommand(opts) {
67629
68028
  }
67630
68029
  const sitemapPath = resolve7(runDir, "sitemap.json");
67631
68030
  let resolvedPages;
67632
- if (!opts.refresh && existsSync18(sitemapPath)) {
68031
+ if (!opts.refresh && existsSync19(sitemapPath)) {
67633
68032
  resolvedPages = readJson(sitemapPath).pages;
67634
- 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))`));
67635
68034
  } else {
67636
- console.log(chalk21.dim(" phase 2 sitemap: resolving pages…"));
68035
+ console.log(chalk22.dim(" phase 2 sitemap: resolving pages…"));
67637
68036
  const ctx = await newContext(browser, { viewport: primaryViewport });
67638
68037
  const page = await ctx.newPage();
67639
68038
  let sitemapUrls = [];
@@ -67661,33 +68060,34 @@ async function migrateCommand(opts) {
67661
68060
  a[p.kind] = (a[p.kind] ?? 0) + 1;
67662
68061
  return a;
67663
68062
  }, {});
67664
- 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(", ")})`));
67665
68064
  }
67666
68065
  writeFileSync25(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
67667
68066
  `, "utf8");
67668
68067
  }
67669
68068
  if (resolvedPages.length === 0) {
67670
- 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"));
67671
68070
  return 1;
67672
68071
  }
67673
68072
  const capturePath = resolve7(runDir, "capture.json");
67674
68073
  let pages;
67675
68074
  let components;
67676
- if (!opts.refresh && existsSync18(capturePath)) {
68075
+ if (!opts.refresh && existsSync19(capturePath)) {
67677
68076
  const cached = readJson(capturePath);
67678
68077
  pages = cached.pages;
67679
68078
  components = cached.components;
67680
68079
  vtexBlocks = cached.vtexBlocks ?? null;
67681
68080
  contentMap = cached.contentMap ?? {};
67682
- console.log(chalk21.dim(` phase 3 components: cached (${components.length})`));
68081
+ console.log(chalk22.dim(` phase 3 components: cached (${components.length})`));
67683
68082
  } else {
67684
- console.log(chalk21.dim(" phase 3 components: capturing…"));
68083
+ console.log(chalk22.dim(" phase 3 components: capturing…"));
67685
68084
  ({ pages, components, vtexBlocks, contentMap } = await capturePages(browser, primaryViewport, resolvedPages, theme, {
67686
68085
  allowlist,
67687
68086
  llm: !opts.noLlm,
67688
68087
  runDir,
67689
68088
  baseUrl: opts.url,
67690
- vtexScrape: opts.source ? source.kind === "vtex-io" : true
68089
+ vtexScrape: opts.source ? source.kind === "vtex-io" : true,
68090
+ extraViewports: opts.componentViewports ? viewports.slice(1) : []
67691
68091
  }));
67692
68092
  writeFileSync25(capturePath, `${JSON.stringify({ pages, components, vtexBlocks, contentMap }, null, 2)}
67693
68093
  `, "utf8");
@@ -67744,13 +68144,13 @@ async function migrateCommand(opts) {
67744
68144
  const projectPath = resolve7(runDir, "source-project.json");
67745
68145
  writeFileSync25(projectPath, `${JSON.stringify(sourceProject, null, 2)}
67746
68146
  `, "utf8");
67747
- console.log(chalk21.dim(` source-project.json — ${sourceProject.totals.components} component detail(s), ${sourceProject.totals.pages} CMS page(s), ${sourceProject.tokenFiles.length} token file(s)`));
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)`));
67748
68148
  }
67749
68149
  if (merged.carried.length) {
67750
- 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`));
67751
68151
  }
67752
68152
  if (merged.keptUncaptured.length) {
67753
- console.log(chalk21.yellow(` plan: ${merged.keptUncaptured.length} row(s) kept although this capture no longer sees them — ${merged.keptUncaptured.join(", ")}. They carry a decision or were added by hand; the capture owns the captured row set, not rows it cannot see.`));
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.`));
67754
68154
  }
67755
68155
  bundle.components.push(...syntheticSourceComponents(plan));
67756
68156
  if (format === "json" || format === "both")
@@ -67799,6 +68199,7 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67799
68199
  const ctx = await newContext(browser, { viewport, keepMotion: true });
67800
68200
  const page = await ctx.newPage();
67801
68201
  const pageComponents = [];
68202
+ const capturedHere = [];
67802
68203
  try {
67803
68204
  await page.goto(target.url, { waitUntil: "domcontentloaded", timeout: 30000 });
67804
68205
  await page.waitForLoadState("networkidle", { timeout: 8000 }).catch(() => {
@@ -67830,6 +68231,7 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67830
68231
  const interactions = await captureInteractions(page, component.selector);
67831
68232
  const migrated = toMigratedComponent(extracted, interactions, global ? "global" : "page", theme.tokens, repeated);
67832
68233
  components.push(migrated);
68234
+ capturedHere.push({ migrated, componentDir });
67833
68235
  if (!global)
67834
68236
  pageComponents.push(migrated);
67835
68237
  }
@@ -67858,6 +68260,9 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67858
68260
  return;
67859
68261
  });
67860
68262
  }
68263
+ if (cfg.extraViewports.length && capturedHere.length) {
68264
+ await captureViewportVariants(browser, target.url, cfg.extraViewports, capturedHere, cfg.runDir);
68265
+ }
67861
68266
  }
67862
68267
  return {
67863
68268
  pages,
@@ -67866,6 +68271,89 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67866
68271
  contentMap
67867
68272
  };
67868
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
+ }
67869
68357
  async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67870
68358
  const out = [];
67871
68359
  const plp = pickPlpFromHomeHtml(homeHtml, baseUrl);
@@ -67874,12 +68362,12 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67874
68362
  if (plp)
67875
68363
  out.push({ path: token, url: plp, kind: "plp" });
67876
68364
  else
67877
- console.warn(chalk21.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
68365
+ console.warn(chalk22.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
67878
68366
  continue;
67879
68367
  }
67880
68368
  if (token === "pdp-auto") {
67881
68369
  if (!plp) {
67882
- console.warn(chalk21.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
68370
+ console.warn(chalk22.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
67883
68371
  continue;
67884
68372
  }
67885
68373
  let html = null;
@@ -67896,7 +68384,7 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67896
68384
  if (pdp)
67897
68385
  out.push({ path: token, url: pdp, kind: "pdp" });
67898
68386
  else
67899
- console.warn(chalk21.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
68387
+ console.warn(chalk22.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
67900
68388
  continue;
67901
68389
  }
67902
68390
  try {
@@ -67990,31 +68478,31 @@ function kindOf(url) {
67990
68478
  }
67991
68479
  }
67992
68480
  function printResults4(runDir, bundle) {
67993
- console.log(chalk21.bold(`
68481
+ console.log(chalk22.bold(`
67994
68482
  parity migrate`));
67995
- console.log(chalk21.dim(` url: ${bundle.url}`));
67996
- console.log(chalk21.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
67997
- console.log(chalk21.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
67998
- console.log(chalk21.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
67999
- console.log(chalk21.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
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}`));
68000
68488
  if (bundle.vtex) {
68001
68489
  const mapped = bundle.vtex.map.filter((m) => m.strategy === "mapped").length;
68002
68490
  const withContent = bundle.vtex.blocks.filter((x) => x.props).length;
68003
68491
  const contentImgs = countContentImages(bundle.vtex.blocks);
68004
- console.log(chalk21.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
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`));
68005
68493
  }
68006
- console.log(chalk21.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
68007
- 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}`));
68008
68496
  console.log("");
68009
- console.log(chalk21.bold(` ${bundle.components.length} component(s):`));
68497
+ console.log(chalk22.bold(` ${bundle.components.length} component(s):`));
68010
68498
  for (const c of bundle.components) {
68011
- console.log(` ${chalk21.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk21.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
68499
+ console.log(` ${chalk22.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk22.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
68012
68500
  }
68013
68501
  console.log("");
68014
68502
  }
68015
68503
  function readJson(path) {
68016
68504
  try {
68017
- return JSON.parse(readFileSync24(path, "utf8"));
68505
+ return JSON.parse(readFileSync25(path, "utf8"));
68018
68506
  } catch {
68019
68507
  return null;
68020
68508
  }
@@ -68057,67 +68545,84 @@ function isValidUrl4(s) {
68057
68545
  }
68058
68546
 
68059
68547
  // src/commands/plan.ts
68060
- import { readFileSync as readFileSync25 } from "node:fs";
68061
- import chalk22 from "chalk";
68062
- var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
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
+ ];
68063
68559
  var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
68064
68560
  function planSetStatusCommand(dir, name, status, opts = {}) {
68065
68561
  if (!STATUSES.includes(status)) {
68066
- 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(", ")}`));
68067
68563
  return 1;
68068
68564
  }
68069
68565
  const plan = loadPlan(dir);
68070
68566
  if (!plan) {
68071
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68567
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68072
68568
  return 1;
68073
68569
  }
68074
68570
  const existed = plan.components.length;
68075
- 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
+ }
68076
68581
  if (!component) {
68077
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68078
- console.error(chalk22.yellow("A capture can miss a component that exists — a zero-height overlay header, a portal-rendered panel. Add it with --create global|page if this is one of those, so the plan can hold a decision about it."));
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."));
68079
68584
  return 1;
68080
68585
  }
68081
68586
  if (plan.components.length > existed) {
68082
- 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`));
68083
68588
  }
68084
68589
  savePlan(dir, plan);
68085
- console.log(`${chalk22.green("✓")} ${component.name} → ${status}`);
68590
+ console.log(`${chalk23.green("✓")} ${component.name} → ${status}`);
68086
68591
  if ((status === "upgrade" || status === "as-is") && !component.reference) {
68087
- console.log(chalk22.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
68592
+ console.log(chalk23.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
68088
68593
  }
68089
68594
  return 0;
68090
68595
  }
68091
68596
  function planSetPageStatusCommand(dir, path, status) {
68092
68597
  if (!PAGE_STATUSES.includes(status)) {
68093
- 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(", ")}`));
68094
68599
  return 1;
68095
68600
  }
68096
68601
  const plan = loadPlan(dir);
68097
68602
  if (!plan) {
68098
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68603
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68099
68604
  return 1;
68100
68605
  }
68101
68606
  const page = setPageStatus(plan, path, status);
68102
68607
  if (!page) {
68103
- console.error(chalk22.red(`No page matching "${path}" in the plan`));
68608
+ console.error(chalk23.red(`No page matching "${path}" in the plan`));
68104
68609
  return 1;
68105
68610
  }
68106
68611
  savePlan(dir, plan);
68107
- console.log(`${chalk22.green("✓")} ${page.path} → ${status}`);
68612
+ console.log(`${chalk23.green("✓")} ${page.path} → ${status}`);
68108
68613
  return 0;
68109
68614
  }
68110
68615
  var DISPOSITION_STYLE = {
68111
- build: chalk22.red,
68112
- validate: chalk22.yellow,
68113
- upgrade: chalk22.cyan,
68114
- "as-is": chalk22.gray,
68115
- settled: chalk22.green
68616
+ build: chalk23.red,
68617
+ validate: chalk23.yellow,
68618
+ upgrade: chalk23.cyan,
68619
+ "as-is": chalk23.gray,
68620
+ settled: chalk23.green
68116
68621
  };
68117
68622
  function planSetReferenceCommand(dir, name, opts) {
68118
68623
  const plan = loadPlan(dir);
68119
68624
  if (!plan) {
68120
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68625
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68121
68626
  return 1;
68122
68627
  }
68123
68628
  const component = setComponentReference(plan, name, {
@@ -68126,76 +68631,76 @@ function planSetReferenceCommand(dir, name, opts) {
68126
68631
  note: opts.note
68127
68632
  });
68128
68633
  if (!component) {
68129
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68634
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68130
68635
  return 1;
68131
68636
  }
68132
68637
  savePlan(dir, plan);
68133
- console.log(`${chalk22.green("✓")} ${component.name} → reference ${component.reference?.url}`);
68638
+ console.log(`${chalk23.green("✓")} ${component.name} → reference ${component.reference?.url}`);
68134
68639
  return 0;
68135
68640
  }
68136
68641
  function planVerifyCommand(dir, name, verdict, opts) {
68137
68642
  if (verdict !== "pass" && verdict !== "fail" && verdict !== "inconclusive") {
68138
- 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.`));
68139
68644
  return 1;
68140
68645
  }
68141
68646
  const plan = loadPlan(dir);
68142
68647
  if (!plan) {
68143
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68648
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68144
68649
  return 1;
68145
68650
  }
68146
68651
  const component = setComponentVerified(plan, name, verdict, opts.at ?? new Date().toISOString(), opts.note);
68147
68652
  if (!component) {
68148
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68653
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68149
68654
  return 1;
68150
68655
  }
68151
68656
  savePlan(dir, plan);
68152
- 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("✗");
68153
68658
  console.log(`${mark} ${component.name} → ${verdict} (against ${component.verified?.against})`);
68154
68659
  return 0;
68155
68660
  }
68156
68661
  function planMergeCommand(dir, sourceDir) {
68157
68662
  const fresh = loadPlan(sourceDir);
68158
68663
  if (!fresh) {
68159
- console.error(chalk22.red(`No migration-plan.json found in ${sourceDir}`));
68664
+ console.error(chalk23.red(`No migration-plan.json found in ${sourceDir}`));
68160
68665
  return 1;
68161
68666
  }
68162
68667
  const existing = loadPlan(dir);
68163
68668
  const { plan, carried, keptUncaptured } = mergePlanDecisions(fresh, existing);
68164
68669
  savePlan(dir, plan);
68165
68670
  if (!existing) {
68166
- console.log(`${chalk22.green("✓")} plan written to ${dir} (nothing to merge)`);
68671
+ console.log(`${chalk23.green("✓")} plan written to ${dir} (nothing to merge)`);
68167
68672
  return 0;
68168
68673
  }
68169
- 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`);
68170
68675
  if (keptUncaptured.length) {
68171
- 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(", ")}`));
68172
68677
  }
68173
68678
  return 0;
68174
68679
  }
68175
68680
  function planPageCommand(dir, path, opts) {
68176
68681
  const plan = loadPlan(dir);
68177
68682
  if (!plan) {
68178
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68683
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68179
68684
  return 1;
68180
68685
  }
68181
68686
  const page = pagePlan(plan, path, opts.cand);
68182
68687
  if (!page) {
68183
- console.error(chalk22.red(`No page matching "${path}" in the plan`));
68184
- console.error(chalk22.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
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(", ")}`));
68185
68690
  return 1;
68186
68691
  }
68187
68692
  if (opts.json) {
68188
68693
  console.log(JSON.stringify(page, null, 2));
68189
68694
  return 0;
68190
68695
  }
68191
- console.log(chalk22.bold(`
68192
- ${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") : ""));
68193
68698
  if (page.tasks === null) {
68194
- console.log(chalk22.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
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"));
68195
68700
  return 0;
68196
68701
  }
68197
68702
  if (page.tasks.length === 0) {
68198
- console.log(chalk22.gray(`
68703
+ console.log(chalk23.gray(`
68199
68704
  The capture saw no components on this page.
68200
68705
  `));
68201
68706
  return 0;
@@ -68206,22 +68711,22 @@ ${page.path} ${chalk22.gray(`(${page.kind})`)} — ${page.status}`) + (page.read
68206
68711
  if (!rows.length)
68207
68712
  continue;
68208
68713
  console.log(`
68209
- ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
68714
+ ${DISPOSITION_STYLE[d](chalk23.bold(d))} (${rows.length})`);
68210
68715
  for (const t of rows) {
68211
- 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})`)}`);
68212
68717
  if (t.note)
68213
- console.log(chalk22.gray(` why: ${t.note}`));
68718
+ console.log(chalk23.gray(` why: ${t.note}`));
68214
68719
  if (t.against?.kind === "reference") {
68215
- console.log(chalk22.cyan(` reference: ${t.against.url}`));
68720
+ console.log(chalk23.cyan(` reference: ${t.against.url}`));
68216
68721
  }
68217
68722
  if (t.source)
68218
- console.log(chalk22.green(` source: ${t.source}`));
68723
+ console.log(chalk23.green(` source: ${t.source}`));
68219
68724
  if (t.command)
68220
- console.log(chalk22.gray(` $ ${t.command}`));
68725
+ console.log(chalk23.gray(` $ ${t.command}`));
68221
68726
  }
68222
68727
  }
68223
68728
  if (page.counts.validate > 0 && !opts.cand) {
68224
- 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."));
68225
68730
  }
68226
68731
  console.log("");
68227
68732
  return 0;
@@ -68229,8 +68734,8 @@ ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
68229
68734
  function planStatusCommand(dir, asJson) {
68230
68735
  const plan = loadPlan(dir);
68231
68736
  if (!plan) {
68232
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68233
- console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
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."));
68234
68739
  return 1;
68235
68740
  }
68236
68741
  const p = planProgress(plan);
@@ -68241,59 +68746,63 @@ function planStatusCommand(dir, asJson) {
68241
68746
  return 0;
68242
68747
  }
68243
68748
  const c = p.components;
68244
- console.log(chalk22.bold(`
68749
+ console.log(chalk23.bold(`
68245
68750
  Migration plan — ${plan.url}${plan.target.name ? ` → ${plan.target.name}` : ""}`));
68751
+ const vanished = c.byStatus.vanished ? `, ${chalk23.gray(`${c.byStatus.vanished} vanished`)}` : "";
68246
68752
  console.log(`
68247
- ${chalk22.bold("Components")} (${c.total}): ` + `${chalk22.green(`${c.byStatus.done} done`)}, ` + `${chalk22.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk22.red(`${c.byStatus.pending} pending`)}, ` + `${chalk22.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk22.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk22.gray(`${c.byStatus.skipped} skipped`)}`);
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}`);
68248
68754
  if (c.accepted.upgrade.length) {
68249
- 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(", ")}`));
68250
68756
  }
68251
68757
  if (c.accepted.asIs.length) {
68252
- console.log(chalk22.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68758
+ console.log(chalk23.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68253
68759
  }
68254
68760
  if (provenance.library > 0 || provenance.built > 0) {
68255
- const unrecorded = provenance.unrecorded > 0 ? chalk22.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68256
- console.log(` reuse: ${chalk22.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
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}`);
68257
68763
  }
68258
68764
  if (touches > 0) {
68259
- console.log(chalk22.dim(` human touches: ${touches} across this migration`));
68765
+ console.log(chalk23.dim(` human touches: ${touches} across this migration`));
68260
68766
  }
68261
68767
  if (c.settledByStatus.done.length) {
68262
- console.log(chalk22.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68768
+ console.log(chalk23.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68263
68769
  }
68264
68770
  if (c.settledByStatus.skipped.length) {
68265
- 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(", ")}`));
68266
68775
  }
68267
68776
  for (const r of c.remaining) {
68268
- const tag = r.status === "partial" ? chalk22.yellow("partial") : chalk22.red("pending");
68269
- console.log(` ${tag} ${r.name} ${chalk22.gray(`(${r.scope}, ${r.origin})`)}`);
68777
+ const tag = r.status === "partial" ? chalk23.yellow("partial") : chalk23.red("pending");
68778
+ console.log(` ${tag} ${r.name} ${chalk23.gray(`(${r.scope}, ${r.origin})`)}`);
68270
68779
  }
68271
68780
  const pg = p.pages;
68272
68781
  console.log(`
68273
- ${chalk22.bold("Pages")} (${pg.total}): ` + `${chalk22.green(`${pg.byStatus.done} done`)}, ` + `${chalk22.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk22.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk22.gray(`${pg.byStatus.skipped} skipped`)}`);
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`)}`);
68274
68783
  if (pg.awaitingContent.length) {
68275
- console.log(chalk22.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68784
+ console.log(chalk23.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68276
68785
  }
68277
68786
  for (const r of pg.remaining.filter((r) => r.status === "pending")) {
68278
- console.log(` ${chalk22.red("pending")} ${r.path} ${chalk22.gray(`(${r.kind})`)}`);
68787
+ console.log(` ${chalk23.red("pending")} ${r.path} ${chalk23.gray(`(${r.kind})`)}`);
68279
68788
  }
68280
68789
  console.log("");
68281
68790
  return 0;
68282
68791
  }
68283
68792
  var COLUMN_ORDER = ["triage", "backlog", "building", "review", "done"];
68284
68793
  var COLUMN_STYLE = {
68285
- triage: chalk22.magenta,
68286
- backlog: chalk22.red,
68287
- building: chalk22.yellow,
68288
- review: chalk22.cyan,
68289
- done: chalk22.green,
68290
- skipped: chalk22.gray
68794
+ triage: chalk23.magenta,
68795
+ backlog: chalk23.red,
68796
+ building: chalk23.yellow,
68797
+ review: chalk23.cyan,
68798
+ done: chalk23.green,
68799
+ skipped: chalk23.gray
68291
68800
  };
68292
68801
  async function planBoardCommand(dir, opts) {
68293
68802
  const plan = loadPlan(dir);
68294
68803
  if (!plan) {
68295
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68296
- console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
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."));
68297
68806
  return 1;
68298
68807
  }
68299
68808
  const board = planBoard(plan, opts.cand);
@@ -68301,46 +68810,46 @@ async function planBoardCommand(dir, opts) {
68301
68810
  console.log(JSON.stringify(board, null, 2));
68302
68811
  return 0;
68303
68812
  }
68304
- console.log(chalk22.bold(`
68813
+ console.log(chalk23.bold(`
68305
68814
  Board — ${board.url}`));
68306
- 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.`));
68307
68816
  if (board.shell.length) {
68308
68817
  console.log(`
68309
- ${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(", "))}`);
68310
68819
  }
68311
68820
  for (const column of COLUMN_ORDER) {
68312
68821
  const cards = board.columns[column];
68313
68822
  if (!cards.length)
68314
68823
  continue;
68315
68824
  console.log(`
68316
- ${COLUMN_STYLE[column](chalk22.bold(column))} (${cards.length})`);
68825
+ ${COLUMN_STYLE[column](chalk23.bold(column))} (${cards.length})`);
68317
68826
  for (const card of cards) {
68318
- console.log(` ${card.path} ${chalk22.gray(`(${card.kind})`)}`);
68827
+ console.log(` ${card.path} ${chalk23.gray(`(${card.kind})`)}`);
68319
68828
  if (card.blockers.length) {
68320
- console.log(chalk22.gray(` blocked by: ${card.blockers.join(", ")}`));
68829
+ console.log(chalk23.gray(` blocked by: ${card.blockers.join(", ")}`));
68321
68830
  }
68322
68831
  }
68323
68832
  }
68324
68833
  const skipped = board.columns.skipped;
68325
68834
  if (skipped.length) {
68326
68835
  console.log(`
68327
- ${chalk22.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68836
+ ${chalk23.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68328
68837
  }
68329
68838
  if (board.unassigned.length) {
68330
68839
  console.log(`
68331
- ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled page)")}
68332
- ${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(", "))}`);
68333
68842
  }
68334
68843
  console.log("");
68335
68844
  if (opts.board === "studio") {
68336
68845
  const cfg = studioConfigFromEnv();
68337
68846
  if (!cfg) {
68338
- 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.
68339
68848
  `));
68340
68849
  return 0;
68341
68850
  }
68342
68851
  try {
68343
- const fixes = opts.fixes ? JSON.parse(readFileSync25(opts.fixes, "utf8")) : undefined;
68852
+ const fixes = opts.fixes ? JSON.parse(readFileSync26(opts.fixes, "utf8")) : undefined;
68344
68853
  const synced = await syncBoardToStudio(board, cfg, { repo: opts.repo, fixes });
68345
68854
  let stored = 0;
68346
68855
  for (const [path, id] of Object.entries(synced.ids)) {
@@ -68349,10 +68858,10 @@ ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled
68349
68858
  }
68350
68859
  if (stored)
68351
68860
  savePlan(dir, plan);
68352
- 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.
68353
68862
  `));
68354
68863
  } catch (err) {
68355
- 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.
68356
68865
  `));
68357
68866
  }
68358
68867
  }
@@ -68361,27 +68870,27 @@ ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled
68361
68870
  async function planNotesCommand(dir, opts) {
68362
68871
  const plan = loadPlan(dir);
68363
68872
  if (!plan) {
68364
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68873
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68365
68874
  return 1;
68366
68875
  }
68367
68876
  const cfg = studioConfigFromEnv();
68368
68877
  if (!cfg) {
68369
- console.error(chalk22.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68878
+ console.error(chalk23.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68370
68879
  return 1;
68371
68880
  }
68372
68881
  if (opts.post) {
68373
68882
  const page = plan.pages.find((p) => p.path === opts.page);
68374
68883
  if (!page?.boardItemId) {
68375
- 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`));
68376
68885
  return 1;
68377
68886
  }
68378
68887
  await postParityComment(page.boardItemId, opts.post, cfg);
68379
- console.log(`${chalk22.green("✓")} comment posted on ${page.path}`);
68888
+ console.log(`${chalk23.green("✓")} comment posted on ${page.path}`);
68380
68889
  return 0;
68381
68890
  }
68382
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 }));
68383
68892
  if (!pages.length) {
68384
- 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."));
68385
68894
  return 1;
68386
68895
  }
68387
68896
  const notes = await fetchClientNotes(pages, cfg);
@@ -68390,47 +68899,47 @@ async function planNotesCommand(dir, opts) {
68390
68899
  return 0;
68391
68900
  }
68392
68901
  if (!notes.length) {
68393
- console.log(chalk22.gray(`
68902
+ console.log(chalk23.gray(`
68394
68903
  No open client notes.
68395
68904
  `));
68396
68905
  return 0;
68397
68906
  }
68398
- console.log(chalk22.bold(`
68907
+ console.log(chalk23.bold(`
68399
68908
  Client notes (${notes.length})`));
68400
68909
  for (const n of notes) {
68401
68910
  console.log(`
68402
- ${chalk22.cyan(n.path)} ${chalk22.gray(n.createdAt)}`);
68911
+ ${chalk23.cyan(n.path)} ${chalk23.gray(n.createdAt)}`);
68403
68912
  for (const line of n.body.split(`
68404
68913
  `))
68405
68914
  console.log(` ${line}`);
68406
68915
  }
68407
- console.log(chalk22.gray('\nThese are PROPOSALS. Apply with `parity plan set-reference` / `set-status`, then confirm with `parity plan notes --page <path> --post "<what you did>"`.\n'));
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'));
68408
68917
  return 0;
68409
68918
  }
68410
68919
  var PROVENANCES = ["library", "built"];
68411
68920
  function planSetProvenanceCommand(dir, name, provenance) {
68412
68921
  if (!PROVENANCES.includes(provenance)) {
68413
- 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(", ")}`));
68414
68923
  return 1;
68415
68924
  }
68416
68925
  const plan = loadPlan(dir);
68417
68926
  if (!plan) {
68418
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68927
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68419
68928
  return 1;
68420
68929
  }
68421
68930
  const component = setComponentProvenance(plan, name, provenance);
68422
68931
  if (!component) {
68423
- console.error(chalk22.red(`No component matching "${name}" in the plan`));
68932
+ console.error(chalk23.red(`No component matching "${name}" in the plan`));
68424
68933
  return 1;
68425
68934
  }
68426
68935
  savePlan(dir, plan);
68427
- console.log(`${chalk22.green("✓")} ${component.name} → ${provenance}`);
68936
+ console.log(`${chalk23.green("✓")} ${component.name} → ${provenance}`);
68428
68937
  return 0;
68429
68938
  }
68430
68939
  function planTouchCommand(dir, page, opts) {
68431
68940
  const plan = loadPlan(dir);
68432
68941
  if (!plan) {
68433
- console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68942
+ console.error(chalk23.red(`No migration-plan.json found in ${dir}`));
68434
68943
  return 1;
68435
68944
  }
68436
68945
  const count = recordTouch(plan, page);
@@ -68438,20 +68947,20 @@ function planTouchCommand(dir, page, opts) {
68438
68947
  if (opts.json) {
68439
68948
  console.log(JSON.stringify({ page, touches: count, total: totalTouches(plan) }));
68440
68949
  } else {
68441
- 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`);
68442
68951
  }
68443
68952
  return 0;
68444
68953
  }
68445
68954
 
68446
68955
  // src/commands/pr.ts
68447
- 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";
68448
68957
  import { join as join35 } from "node:path";
68449
- import chalk25 from "chalk";
68958
+ import chalk26 from "chalk";
68450
68959
 
68451
68960
  // src/commands/run.ts
68452
- 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";
68453
68962
  import { join as join34 } from "node:path";
68454
- import chalk24 from "chalk";
68963
+ import chalk25 from "chalk";
68455
68964
  import ora8 from "ora";
68456
68965
 
68457
68966
  // src/diff/score-band.ts
@@ -69039,11 +69548,11 @@ function formatMs(ms) {
69039
69548
  }
69040
69549
 
69041
69550
  // src/commands/serve.ts
69042
- import { existsSync as existsSync20 } from "node:fs";
69043
- import chalk23 from "chalk";
69551
+ import { existsSync as existsSync21 } from "node:fs";
69552
+ import chalk24 from "chalk";
69044
69553
 
69045
69554
  // src/server/proxy-server.ts
69046
- 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";
69047
69556
  import { createServer } from "node:http";
69048
69557
  import { extname, join as join33, normalize as normalize3, resolve as resolve8, sep } from "node:path";
69049
69558
  var MIME3 = {
@@ -69083,7 +69592,7 @@ var STRIPPED_REQUEST_HEADERS = new Set([
69083
69592
  var scrollBeacons = [];
69084
69593
  async function startProxyServer(runDir, opts = {}) {
69085
69594
  const absRunDir = resolve8(runDir);
69086
- if (!existsSync19(absRunDir)) {
69595
+ if (!existsSync20(absRunDir)) {
69087
69596
  throw new Error(`Run directory not found: ${runDir}`);
69088
69597
  }
69089
69598
  const server = createServer((req, res) => {
@@ -69154,12 +69663,12 @@ async function handleRequest(req, res, runDir) {
69154
69663
  }
69155
69664
  function serveReportHtml(res, runDir) {
69156
69665
  const filePath = join33(runDir, "report.html");
69157
- if (!existsSync19(filePath)) {
69666
+ if (!existsSync20(filePath)) {
69158
69667
  res.statusCode = 404;
69159
69668
  res.end("report.html not found");
69160
69669
  return;
69161
69670
  }
69162
- const html = readFileSync26(filePath, "utf8");
69671
+ const html = readFileSync27(filePath, "utf8");
69163
69672
  const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
69164
69673
  const out = html.includes("</head>") ? html.replace("</head>", `${inject}</head>`) : `${inject}${html}`;
69165
69674
  res.statusCode = 200;
@@ -69175,7 +69684,7 @@ function serveStatic(res, runDir, path) {
69175
69684
  res.end("forbidden");
69176
69685
  return;
69177
69686
  }
69178
- if (!existsSync19(filePath)) {
69687
+ if (!existsSync20(filePath)) {
69179
69688
  res.statusCode = 404;
69180
69689
  res.end("not found");
69181
69690
  return;
@@ -69190,7 +69699,7 @@ function serveStatic(res, runDir, path) {
69190
69699
  res.statusCode = 200;
69191
69700
  res.setHeader("content-type", MIME3[ext] ?? "application/octet-stream");
69192
69701
  res.setHeader("cache-control", "no-store");
69193
- res.end(readFileSync26(filePath));
69702
+ res.end(readFileSync27(filePath));
69194
69703
  }
69195
69704
  async function proxyRequest(req, res, targetUrl, opts = {}) {
69196
69705
  let target;
@@ -69313,16 +69822,16 @@ async function serveRunAndBlock(runDir, opts = {}) {
69313
69822
  try {
69314
69823
  handle = await startProxyServer(runDir, { port: opts.port });
69315
69824
  } catch (err) {
69316
- console.error(chalk23.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69825
+ console.error(chalk24.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69317
69826
  return 2;
69318
69827
  }
69319
69828
  const label = opts.label ?? "parity serve";
69320
69829
  console.log("");
69321
- console.log(chalk23.bold(` ${label}`));
69322
- console.log(` ${chalk23.green("●")} ${handle.url}`);
69323
- console.log(chalk23.dim(` Servindo: ${runDir}`));
69324
- console.log(chalk23.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69325
- console.log(chalk23.dim(` Ctrl+C pra parar (2x pra forçar saída).
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).
69326
69835
  `));
69327
69836
  if (opts.open !== false) {
69328
69837
  const { default: open } = await import("open");
@@ -69354,12 +69863,12 @@ async function serveRunAndBlock(runDir, opts = {}) {
69354
69863
  }
69355
69864
  async function serveCommand(runId, opts) {
69356
69865
  const paths = getRunPaths(opts.output, runId);
69357
- if (!existsSync20(paths.runDir)) {
69358
- 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})`));
69359
69868
  return 1;
69360
69869
  }
69361
- if (!existsSync20(paths.reportHtml)) {
69362
- 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}`));
69363
69872
  return 1;
69364
69873
  }
69365
69874
  return serveRunAndBlock(paths.runDir, {
@@ -69509,7 +70018,7 @@ function evaluateFailOnGate(allIssues, failOn, verdictStatus) {
69509
70018
  var SCORE_BAND_RUNS = 4;
69510
70019
  function readRunChecks(reportPath) {
69511
70020
  try {
69512
- const raw = JSON.parse(readFileSync27(reportPath, "utf8"));
70021
+ const raw = JSON.parse(readFileSync28(reportPath, "utf8"));
69513
70022
  return (raw.checks ?? []).filter((c) => typeof c.name === "string" && typeof c.status === "string").map((c) => ({ name: c.name, status: c.status }));
69514
70023
  } catch {
69515
70024
  return [];
@@ -69518,14 +70027,14 @@ function readRunChecks(reportPath) {
69518
70027
  async function runCommand(rawOpts) {
69519
70028
  if (!rawOpts.prod) {
69520
70029
  const target = rawOpts.cand ?? "<url>";
69521
- console.error(`${chalk24.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
69522
- For one site, use: ${chalk24.cyan(`parity e2e --url ${target}`)}
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}`)}
69523
70032
  (runs the functional flows + all checks in single-site mode — no prod baseline needed).`);
69524
70033
  return 2;
69525
70034
  }
69526
70035
  let opts = applyPreset(rawOpts);
69527
70036
  if (rawOpts.preset) {
69528
- console.log(chalk24.dim(` preset: ${rawOpts.preset}`));
70037
+ console.log(chalk25.dim(` preset: ${rawOpts.preset}`));
69529
70038
  }
69530
70039
  if (opts.pt)
69531
70040
  setLlmLanguage("pt");
@@ -69533,14 +70042,14 @@ async function runCommand(rawOpts) {
69533
70042
  disableInteractive();
69534
70043
  const llmCfgErr = applyLlmOptions(opts);
69535
70044
  if (llmCfgErr) {
69536
- console.error(chalk24.red(` ${llmCfgErr}`));
70045
+ console.error(chalk25.red(` ${llmCfgErr}`));
69537
70046
  return 2;
69538
70047
  }
69539
70048
  const llmStillAvailable = isLlmAvailable();
69540
70049
  const preSmart = opts;
69541
70050
  opts = applySmartDefaults(opts, llmStillAvailable);
69542
70051
  if (!llmStillAvailable && opts.visualPages !== preSmart.visualPages) {
69543
- console.log(chalk24.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
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)"));
69544
70053
  }
69545
70054
  let interactivePromptShown = false;
69546
70055
  if (!opts.only && !opts.skip && !rawOpts.preset) {
@@ -69566,14 +70075,14 @@ async function runCommand(rawOpts) {
69566
70075
  if (isContentProfile && !opts.only && !opts.skip) {
69567
70076
  opts.only = "seo,visual,vitals,cache,console,html,network";
69568
70077
  moduleDropReason = "profile: content → e2e module dropped (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force";
69569
- console.log(chalk24.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
70078
+ console.log(chalk25.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
69570
70079
  }
69571
70080
  const selection = resolveSelection({ only: opts.only, skip: opts.skip });
69572
70081
  if (selection.errors.length > 0) {
69573
- console.error(chalk24.red(" --only/--skip: invalid value(s):"));
70082
+ console.error(chalk25.red(" --only/--skip: invalid value(s):"));
69574
70083
  for (const e of selection.errors)
69575
- console.error(chalk24.red(` - ${e}`));
69576
- console.error(chalk24.dim(`
70084
+ console.error(chalk25.red(` - ${e}`));
70085
+ console.error(chalk25.dim(`
69577
70086
  valid modules: ${Object.keys(MODULES).join(", ")}`));
69578
70087
  return 2;
69579
70088
  }
@@ -69585,14 +70094,14 @@ async function runCommand(rawOpts) {
69585
70094
  const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
69586
70095
  const scoped = resolveScopedFlows({ explicitFlows, selectionFlows: selection.flows });
69587
70096
  flows = scoped.flows;
69588
- 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)" : ""}`));
69589
70098
  if (scoped.starved.length > 0) {
69590
- console.log(chalk24.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
70099
+ console.log(chalk25.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
69591
70100
  }
69592
70101
  } else {
69593
70102
  flows = opts.flows.split(",").map((s) => s.trim());
69594
70103
  if (!interactivePromptShown) {
69595
- console.log(chalk24.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
70104
+ console.log(chalk25.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
69596
70105
  }
69597
70106
  }
69598
70107
  if (isContentProfile) {
@@ -69601,12 +70110,12 @@ async function runCommand(rawOpts) {
69601
70110
  if (!flows.includes("homepage"))
69602
70111
  flows.unshift("homepage");
69603
70112
  if (before !== flows.join(",")) {
69604
- 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`));
69605
70114
  }
69606
70115
  }
69607
70116
  const pagesScopeWarning = pagesFlowsScopeWarning(opts, flows);
69608
70117
  if (pagesScopeWarning) {
69609
- console.log(chalk24.dim(` ${pagesScopeWarning}`));
70118
+ console.log(chalk25.dim(` ${pagesScopeWarning}`));
69610
70119
  }
69611
70120
  if (hasSelection) {
69612
70121
  const needsSitemapPages = selection.modules.some((m) => MODULES[m].needsSitemapPages);
@@ -69615,12 +70124,12 @@ async function runCommand(rawOpts) {
69615
70124
  const VISUAL_PAGES_DEFAULT = 5;
69616
70125
  if (!needsSitemapPages && opts.vitalsPages === VITALS_PAGES_DEFAULT) {
69617
70126
  opts.vitalsPages = 0;
69618
- 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)"));
69619
70128
  }
69620
70129
  if (!needsLlmPass && opts.visualPages === VISUAL_PAGES_DEFAULT) {
69621
70130
  opts.visualPages = 0;
69622
70131
  opts.noVisualDiff = true;
69623
- 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)"));
69624
70133
  }
69625
70134
  }
69626
70135
  const viewports = opts.viewports.split(",").map((s) => s.trim());
@@ -69634,37 +70143,37 @@ async function runCommand(rawOpts) {
69634
70143
  const ignore = loadParityIgnore();
69635
70144
  if (opts.clearCache) {
69636
70145
  const cacheFile = join34(opts.output, "cache", "verdicts.json");
69637
- if (existsSync21(cacheFile)) {
70146
+ if (existsSync22(cacheFile)) {
69638
70147
  try {
69639
70148
  unlinkSync3(cacheFile);
69640
- console.log(chalk24.dim(` cache wiped: ${cacheFile}`));
70149
+ console.log(chalk25.dim(` cache wiped: ${cacheFile}`));
69641
70150
  } catch (err) {
69642
- console.log(chalk24.yellow(` cache wipe falhou: ${err.message}`));
70151
+ console.log(chalk25.yellow(` cache wipe falhou: ${err.message}`));
69643
70152
  }
69644
70153
  }
69645
70154
  }
69646
70155
  const llmTimeoutRaw = opts.llmTimeout ?? 60;
69647
70156
  if (!Number.isFinite(llmTimeoutRaw)) {
69648
- 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`));
69649
70158
  return 2;
69650
70159
  }
69651
70160
  const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
69652
70161
  if (isLlmAvailable()) {
69653
- console.log(chalk24.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
70162
+ console.log(chalk25.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
69654
70163
  } else {
69655
- 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)"));
69656
70165
  }
69657
70166
  if (isInteractiveMode()) {
69658
- 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."));
69659
70168
  }
69660
70169
  const primaryViewport = viewports[0] ?? "mobile";
69661
70170
  const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
69662
70171
  if (!preflight.ok) {
69663
- console.error(chalk24.red(`
70172
+ console.error(chalk25.red(`
69664
70173
  ✖ pre-flight falhou:`));
69665
70174
  for (const err of preflight.errors)
69666
- console.error(chalk24.red(` - ${err}`));
69667
- console.error(chalk24.dim(`
70175
+ console.error(chalk25.red(` - ${err}`));
70176
+ console.error(chalk25.dim(`
69668
70177
  dica: verifique se as URLs estão corretas e acessíveis`));
69669
70178
  return 2;
69670
70179
  }
@@ -69675,7 +70184,7 @@ async function runCommand(rawOpts) {
69675
70184
  if (prodHomeHtml) {
69676
70185
  platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
69677
70186
  if (platform !== "custom") {
69678
- console.log(chalk24.dim(` Detected platform: ${platform}`));
70187
+ console.log(chalk25.dim(` Detected platform: ${platform}`));
69679
70188
  }
69680
70189
  }
69681
70190
  const prodHost = hostOf3(opts.prod);
@@ -69710,11 +70219,11 @@ async function runCommand(rawOpts) {
69710
70219
  viewports,
69711
70220
  timestamp
69712
70221
  });
69713
- console.log(chalk24.bold(`
70222
+ console.log(chalk25.bold(`
69714
70223
  parity run ${runId}`));
69715
- console.log(chalk24.dim(` prod: ${opts.prod}`));
69716
- console.log(chalk24.dim(` cand: ${opts.cand}`));
69717
- console.log(chalk24.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
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}` : ""}
69718
70227
  `));
69719
70228
  const spinner = ora8("Launching browser…").start();
69720
70229
  let browser = null;
@@ -69726,7 +70235,7 @@ async function runCommand(rawOpts) {
69726
70235
  const min = Math.floor(elapsedSec / 60);
69727
70236
  const sec = elapsedSec % 60;
69728
70237
  const mmss = `${min.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
69729
- spinner.text = `${chalk24.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
70238
+ spinner.text = `${chalk25.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
69730
70239
  };
69731
70240
  const setSpinnerLabel = (label) => {
69732
70241
  currentSpinnerLabel = label;
@@ -69846,8 +70355,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69846
70355
  for (const flow of flows) {
69847
70356
  const flowStart = Date.now();
69848
70357
  let lastStepTotal = 0;
69849
- const sideTag = side === "prod" ? chalk24.cyan("prod") : chalk24.magenta("cand");
69850
- 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("]")}`;
69851
70360
  setSpinnerLabel(`${prefix} ${flow}: starting…`);
69852
70361
  const cap = await runFlow(flow, {
69853
70362
  baseUrl,
@@ -69864,7 +70373,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69864
70373
  onStep: (event) => {
69865
70374
  if (event.phase === "start") {
69866
70375
  lastStepTotal = event.total;
69867
- setSpinnerLabel(`${prefix} ${flow} ${chalk24.dim(`${event.index}/${event.total}`)} ${event.name}…`);
70376
+ setSpinnerLabel(`${prefix} ${flow} ${chalk25.dim(`${event.index}/${event.total}`)} ${event.name}…`);
69868
70377
  }
69869
70378
  }
69870
70379
  });
@@ -69873,18 +70382,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69873
70382
  const target = lastStepTotal || recorded;
69874
70383
  const failed = cap.steps?.find((s) => s.status === "failed");
69875
70384
  const lastStep = cap.steps?.[cap.steps.length - 1];
69876
- const elapsedDim = chalk24.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
69877
- const counts = target > 0 ? chalk24.dim(`${okSteps}/${target}`) : "";
70385
+ const elapsedDim = chalk25.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
70386
+ const counts = target > 0 ? chalk25.dim(`${okSteps}/${target}`) : "";
69878
70387
  let glyph;
69879
70388
  let detail;
69880
70389
  if (failed) {
69881
- glyph = chalk24.red("✗");
69882
- detail = `stopped at ${chalk24.yellow(failed.name)}`;
70390
+ glyph = chalk25.red("✗");
70391
+ detail = `stopped at ${chalk25.yellow(failed.name)}`;
69883
70392
  } else if (target > 0 && okSteps < target) {
69884
- glyph = chalk24.yellow("▴");
69885
- detail = lastStep ? `ended at ${chalk24.dim(lastStep.name)}` : "incomplete";
70393
+ glyph = chalk25.yellow("▴");
70394
+ detail = lastStep ? `ended at ${chalk25.dim(lastStep.name)}` : "incomplete";
69886
70395
  } else {
69887
- glyph = chalk24.green("✓");
70396
+ glyph = chalk25.green("✓");
69888
70397
  detail = "";
69889
70398
  }
69890
70399
  const summary = `${glyph} ${prefix} ${flow} ${counts} ${detail} ${elapsedDim}`.replace(/\s+/g, " ").trim();
@@ -69946,7 +70455,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69946
70455
  const vitalsPagesLimit = opts.vitalsPages ?? vitalsPagesDefault;
69947
70456
  const vitalsRuns = Math.max(1, Number.parseInt(opts.runs, 10) || 1);
69948
70457
  if (candIsDevServer && vitalsPagesLimit > 0) {
69949
- 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)`));
69950
70459
  }
69951
70460
  if (browser && vitalsPagesLimit > 0) {
69952
70461
  currentPhase = "vitals-pages";
@@ -70293,12 +70802,12 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
70293
70802
  totalIssues: allIssues.length,
70294
70803
  verdict: { status: verdict.status, score: verdict.score, scoreVersion: SCORE_VERSION }
70295
70804
  });
70296
- printSummary7(run, paths.reportHtml, { promotedCount, deprecatedCount, platform });
70805
+ printSummary8(run, paths.reportHtml, { promotedCount, deprecatedCount, platform });
70297
70806
  console.log(`
70298
70807
  ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
70299
70808
  const failOnGate = evaluateFailOnGate(allIssues, failOn, verdict.status);
70300
70809
  if (failOnGate.exitCode === 1) {
70301
- console.log(chalk24.red(failOnGate.message));
70810
+ console.log(chalk25.red(failOnGate.message));
70302
70811
  return 1;
70303
70812
  }
70304
70813
  if (opts.open) {
@@ -70368,10 +70877,10 @@ function parsePagePair(entry) {
70368
70877
  }
70369
70878
  function resolveExplicitPages(pagesFile, pagesList) {
70370
70879
  if (pagesFile) {
70371
- if (!existsSync21(pagesFile)) {
70880
+ if (!existsSync22(pagesFile)) {
70372
70881
  throw new Error(`--pages-file não encontrado: ${pagesFile}`);
70373
70882
  }
70374
- const raw = readFileSync27(pagesFile, "utf-8");
70883
+ const raw = readFileSync28(pagesFile, "utf-8");
70375
70884
  const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
70376
70885
  for (const line of lines)
70377
70886
  validatePageEntry(line, [], true);
@@ -70522,63 +71031,63 @@ function hostOf3(url) {
70522
71031
  return url;
70523
71032
  }
70524
71033
  }
70525
- function printSummary7(run, htmlPath, meta) {
71034
+ function printSummary8(run, htmlPath, meta) {
70526
71035
  const { verdict } = run;
70527
71036
  const inconclusive = verdict.status === "inconclusive";
70528
- const emoji = inconclusive ? chalk24.dim("○") : verdict.status === "pass" ? chalk24.green("✔") : verdict.status === "warn" ? chalk24.yellow("⚠") : chalk24.red("✖");
70529
- const score = inconclusive ? chalk24.dim("—") : verdict.status === "pass" ? chalk24.green(verdict.score) : verdict.status === "warn" ? chalk24.yellow(verdict.score) : chalk24.red(verdict.score);
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);
70530
71039
  const prev = run.previousRun;
70531
- const scoreDelta = !prev ? chalk24.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk24.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk24.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk24.dim(` (= run anterior: ${prev.score})`);
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})`);
70532
71041
  console.log("");
70533
71042
  if (inconclusive) {
70534
71043
  console.log(` ${emoji} parity INCONCLUSIVE · nothing was measured (0 checks ran)`);
70535
71044
  } else {
70536
71045
  console.log(` ${emoji} parity ${verdict.status.toUpperCase()} · score ${score}/100${scoreDelta}`);
70537
71046
  }
70538
- console.log(` checks: ${chalk24.green(verdict.checksPassed)} pass · ${chalk24.red(verdict.checksFailed)} fail · ${chalk24.dim(`${verdict.checksSkipped} skipped`)}`);
70539
- console.log(` issues: ${chalk24.red(verdict.critical)} critical · ${chalk24.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk24.dim(`${verdict.low} low`)}`);
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`)}`);
70540
71049
  const band = run.scoreBand;
70541
71050
  const bandLine = band ? formatScoreBand(band) : null;
70542
71051
  if (band && bandLine) {
70543
- console.log(` ${chalk24.dim(bandLine)}`);
71052
+ console.log(` ${chalk25.dim(bandLine)}`);
70544
71053
  const caveat = scoreBandCaveat(band);
70545
71054
  if (caveat)
70546
- console.log(` ${chalk24.yellow("⚠")} ${caveat}`);
71055
+ console.log(` ${chalk25.yellow("⚠")} ${caveat}`);
70547
71056
  }
70548
71057
  for (const c of run.caveats ?? []) {
70549
- const mark = c.level === "warn" ? chalk24.yellow("⚠") : chalk24.dim("ℹ");
71058
+ const mark = c.level === "warn" ? chalk25.yellow("⚠") : chalk25.dim("ℹ");
70550
71059
  console.log(` ${mark} ${c.summary}`);
70551
71060
  }
70552
71061
  if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
70553
71062
  const perModule = run.moduleVerdicts.map((mv) => {
70554
- const colored = mv.status === "pass" ? chalk24.green(mv.score) : mv.status === "warn" ? chalk24.yellow(mv.score) : chalk24.red(mv.score);
71063
+ const colored = mv.status === "pass" ? chalk25.green(mv.score) : mv.status === "warn" ? chalk25.yellow(mv.score) : chalk25.red(mv.score);
70555
71064
  return `${mv.module} ${colored}`;
70556
71065
  }).join(" · ");
70557
71066
  console.log(` modules: ${perModule} → composite ${score}`);
70558
71067
  }
70559
71068
  if (run.visualDiff) {
70560
71069
  const vd = run.visualDiff;
70561
- const parityIcon = vd.parityOk ? chalk24.green("✔") : chalk24.red("✖");
70562
- const parityLabel = vd.parityOk ? chalk24.green("OK") : chalk24.red("DIFFS");
70563
- const cacheNote = vd.pagesFromCache > 0 ? chalk24.dim(` · ${vd.pagesFromCache} cached`) : "";
70564
- console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk24.red(vd.pagesWithDiffs)} diffs · ${chalk24.green(vd.pagesPassed)} pass${cacheNote}`);
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}`);
70565
71074
  }
70566
71075
  if (run.topIssues.length > 0) {
70567
71076
  console.log("");
70568
- console.log(chalk24.bold(" Top issues:"));
71077
+ console.log(chalk25.bold(" Top issues:"));
70569
71078
  for (const g of groupIssues(run.topIssues).slice(0, 5)) {
70570
71079
  const i = g.sample;
70571
- const sev = i.severity === "critical" ? chalk24.red(`[${i.severity}]`) : i.severity === "high" ? chalk24.yellow(`[${i.severity}]`) : chalk24.dim(`[${i.severity}]`);
70572
- const pagesNote = g.pages.length > 1 ? chalk24.dim(` (${g.pages.length} páginas)`) : "";
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)`) : "";
70573
71082
  console.log(` ${sev} ${i.summary}${pagesNote}`);
70574
71083
  }
70575
71084
  }
70576
71085
  if (meta.promotedCount > 0 || meta.deprecatedCount > 0) {
70577
71086
  console.log("");
70578
- 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`));
70579
71088
  }
70580
71089
  console.log("");
70581
- console.log(chalk24.dim(` → ${htmlPath}`));
71090
+ console.log(chalk25.dim(` → ${htmlPath}`));
70582
71091
  console.log("");
70583
71092
  }
70584
71093
 
@@ -70602,26 +71111,26 @@ async function prCommand(opts) {
70602
71111
  preset: opts.preset ?? "ci",
70603
71112
  open: false
70604
71113
  };
70605
- console.log(chalk25.dim(` prod : ${opts.prod}`));
70606
- console.log(chalk25.dim(` preview : ${opts.preview}`));
71114
+ console.log(chalk26.dim(` prod : ${opts.prod}`));
71115
+ console.log(chalk26.dim(` preview : ${opts.preview}`));
70607
71116
  console.log("");
70608
71117
  const runCode = await runCommand(runOpts);
70609
71118
  const runs = listRuns(opts.output);
70610
71119
  if (runs.length === 0) {
70611
- 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"));
70612
71121
  return runCode || 1;
70613
71122
  }
70614
71123
  const latest = runs[0];
70615
71124
  const reportJsonPath = join35(opts.output, "runs", latest.id, "report.json");
70616
- if (!existsSync22(reportJsonPath)) {
70617
- console.error(chalk25.red(`report.json not found at ${reportJsonPath}`));
71125
+ if (!existsSync23(reportJsonPath)) {
71126
+ console.error(chalk26.red(`report.json not found at ${reportJsonPath}`));
70618
71127
  return runCode || 1;
70619
71128
  }
70620
- const run = JSON.parse(readFileSync28(reportJsonPath, "utf8"));
71129
+ const run = JSON.parse(readFileSync29(reportJsonPath, "utf8"));
70621
71130
  const markdown = buildPrComment(run, opts);
70622
71131
  if (opts.out) {
70623
71132
  writeFileSync26(opts.out, markdown, "utf8");
70624
- console.log(chalk25.dim(` wrote PR comment: ${opts.out}`));
71133
+ console.log(chalk26.dim(` wrote PR comment: ${opts.out}`));
70625
71134
  } else {
70626
71135
  process.stdout.write(`
70627
71136
  ${markdown}
@@ -70631,7 +71140,7 @@ ${markdown}
70631
71140
  try {
70632
71141
  writeFileSync26(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
70633
71142
  } catch (err) {
70634
- 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}`));
70635
71144
  }
70636
71145
  }
70637
71146
  return runCode;
@@ -70691,14 +71200,14 @@ function buildPrComment(run, opts) {
70691
71200
  }
70692
71201
 
70693
71202
  // src/commands/prompt.ts
70694
- import { existsSync as existsSync23, writeFileSync as writeFileSync27 } from "node:fs";
70695
- import chalk26 from "chalk";
71203
+ import { existsSync as existsSync24, writeFileSync as writeFileSync27 } from "node:fs";
71204
+ import chalk27 from "chalk";
70696
71205
  function promptCommand(runId, opts) {
70697
71206
  let run;
70698
71207
  try {
70699
71208
  run = loadRun(opts.output, runId);
70700
71209
  } catch (err) {
70701
- console.error(chalk26.red(`✖ ${err.message}`));
71210
+ console.error(chalk27.red(`✖ ${err.message}`));
70702
71211
  return 1;
70703
71212
  }
70704
71213
  const md = buildLlmPrompt(run, {
@@ -70707,10 +71216,10 @@ function promptCommand(runId, opts) {
70707
71216
  });
70708
71217
  if (opts.out) {
70709
71218
  writeFileSync27(opts.out, md, "utf8");
70710
- console.log(chalk26.green(`✔ prompt salvo em ${opts.out}`));
70711
- if (existsSync23(opts.out)) {
71219
+ console.log(chalk27.green(`✔ prompt salvo em ${opts.out}`));
71220
+ if (existsSync24(opts.out)) {
70712
71221
  const sizeKb = (md.length / 1024).toFixed(1);
70713
- console.log(chalk26.dim(` ${md.length} chars (${sizeKb} KB)`));
71222
+ console.log(chalk27.dim(` ${md.length} chars (${sizeKb} KB)`));
70714
71223
  }
70715
71224
  } else {
70716
71225
  process.stdout.write(md);
@@ -70719,9 +71228,9 @@ function promptCommand(runId, opts) {
70719
71228
  }
70720
71229
 
70721
71230
  // src/commands/report.ts
70722
- 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";
70723
71232
  import { join as join36 } from "node:path";
70724
- import chalk27 from "chalk";
71233
+ import chalk28 from "chalk";
70725
71234
  import open2 from "open";
70726
71235
 
70727
71236
  // src/report/deck-template.ts
@@ -71025,7 +71534,7 @@ function blockPages(blocks, lang) {
71025
71534
  const legend = `<div class="legend">${[
71026
71535
  ["ok", "feito", "done"],
71027
71536
  ["new", "upgrade", "upgrade"],
71028
- ["warn", "parcial / as-is / skipped", "partial / as-is / skipped"],
71537
+ ["warn", "parcial / as-is / skipped / vanished", "partial / as-is / skipped / vanished"],
71029
71538
  ["gap", "pendente", "pending"]
71030
71539
  ].map(([tone, pt, en]) => `<span class="lg"><i class="cell ${CELL_CLASS[tone]}"></i>${L2(pt, en, lang)}</span>`).join("")}</div>`;
71031
71540
  const zones = blocks.zones.map((z) => {
@@ -71131,6 +71640,7 @@ var TONE_BY_STATUS = {
71131
71640
  partial: "warn",
71132
71641
  "as-is": "warn",
71133
71642
  skipped: "warn",
71643
+ vanished: "warn",
71134
71644
  pending: "gap"
71135
71645
  };
71136
71646
  function buildDeckBlocks(plan) {
@@ -71401,7 +71911,7 @@ async function reportCommand(runId, opts) {
71401
71911
  try {
71402
71912
  run = loadRun(opts.output, runId);
71403
71913
  } catch (err) {
71404
- console.error(chalk27.red(`failed to load run: ${err.message}`));
71914
+ console.error(chalk28.red(`failed to load run: ${err.message}`));
71405
71915
  return 1;
71406
71916
  }
71407
71917
  let plan = null;
@@ -71409,29 +71919,29 @@ async function reportCommand(runId, opts) {
71409
71919
  try {
71410
71920
  plan = loadPlan(opts.planDir);
71411
71921
  } catch (err) {
71412
- 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}`));
71413
71923
  return 1;
71414
71924
  }
71415
71925
  if (!plan) {
71416
- console.error(chalk27.red(`no migration-plan.json in ${opts.planDir}`));
71926
+ console.error(chalk28.red(`no migration-plan.json in ${opts.planDir}`));
71417
71927
  return 1;
71418
71928
  }
71419
71929
  }
71420
71930
  const html = renderDeckHtml(buildDeckModel(run, plan), opts.lang ?? "en");
71421
71931
  const dest = opts.out ?? join36(paths.runDir, "deck.html");
71422
71932
  writeFileSync28(dest, html, "utf8");
71423
- console.log(`${chalk27.green("✓")} deck → ${dest}`);
71933
+ console.log(`${chalk28.green("✓")} deck → ${dest}`);
71424
71934
  if (opts.open) {
71425
71935
  await open2(dest).catch((err) => {
71426
- console.error(chalk27.red(`failed to open: ${err.message}`));
71936
+ console.error(chalk28.red(`failed to open: ${err.message}`));
71427
71937
  });
71428
71938
  }
71429
71939
  return 0;
71430
71940
  }
71431
71941
  if (opts.section) {
71432
71942
  if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
71433
- console.error(chalk27.red(`unknown section "${opts.section}"`));
71434
- console.error(chalk27.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71943
+ console.error(chalk28.red(`unknown section "${opts.section}"`));
71944
+ console.error(chalk28.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71435
71945
  return 1;
71436
71946
  }
71437
71947
  if (opts.json) {
@@ -71439,40 +71949,40 @@ async function reportCommand(runId, opts) {
71439
71949
  const run = loadRun(opts.output, runId);
71440
71950
  const payload = extractReportSection({ kind: "json", section: opts.section, run });
71441
71951
  if (payload === null) {
71442
- 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`));
71443
71953
  return 1;
71444
71954
  }
71445
71955
  process.stdout.write(`${JSON.stringify(payload, null, 2)}
71446
71956
  `);
71447
71957
  return 0;
71448
71958
  } catch (err) {
71449
- console.error(chalk27.red(`failed to load run: ${err.message}`));
71959
+ console.error(chalk28.red(`failed to load run: ${err.message}`));
71450
71960
  return 1;
71451
71961
  }
71452
71962
  }
71453
- if (!existsSync24(paths.reportHtml)) {
71454
- 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}`));
71455
71965
  return 1;
71456
71966
  }
71457
- const html = readFileSync29(paths.reportHtml, "utf8");
71967
+ const html = readFileSync30(paths.reportHtml, "utf8");
71458
71968
  const slice = extractReportSection({ kind: "html", section: opts.section, html });
71459
71969
  if (slice === null) {
71460
- 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`));
71461
71971
  return 1;
71462
71972
  }
71463
71973
  process.stdout.write(slice);
71464
71974
  return 0;
71465
71975
  }
71466
- console.log(chalk27.dim(`opening ${paths.reportHtml}`));
71976
+ console.log(chalk28.dim(`opening ${paths.reportHtml}`));
71467
71977
  await open2(paths.reportHtml).catch((err) => {
71468
- console.error(chalk27.red(`failed to open: ${err.message}`));
71978
+ console.error(chalk28.red(`failed to open: ${err.message}`));
71469
71979
  });
71470
71980
  return 0;
71471
71981
  }
71472
71982
 
71473
71983
  // src/commands/event.ts
71474
71984
  import { resolve as resolve9 } from "node:path";
71475
- import chalk28 from "chalk";
71985
+ import chalk29 from "chalk";
71476
71986
 
71477
71987
  // src/events.ts
71478
71988
  import { appendFileSync, mkdirSync as mkdirSync17 } from "node:fs";
@@ -71496,24 +72006,24 @@ function eventCommand(type, opts) {
71496
72006
  if (parsed && typeof parsed === "object")
71497
72007
  data = parsed;
71498
72008
  else {
71499
- console.error(chalk28.red("--data must be a JSON object"));
72009
+ console.error(chalk29.red("--data must be a JSON object"));
71500
72010
  return 1;
71501
72011
  }
71502
72012
  } catch {
71503
- console.error(chalk28.red(`--data is not valid JSON: ${opts.data}`));
72013
+ console.error(chalk29.red(`--data is not valid JSON: ${opts.data}`));
71504
72014
  return 1;
71505
72015
  }
71506
72016
  }
71507
72017
  const dir = resolve9(opts.dir);
71508
72018
  emitEvent(dir, type, data);
71509
- console.log(`${chalk28.green("✓")} ${type} → ${dir}/events.jsonl`);
72019
+ console.log(`${chalk29.green("✓")} ${type} → ${dir}/events.jsonl`);
71510
72020
  return 0;
71511
72021
  }
71512
72022
 
71513
72023
  // src/commands/bench.ts
71514
- 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";
71515
72025
  import { resolve as resolve10 } from "node:path";
71516
- import chalk29 from "chalk";
72026
+ import chalk30 from "chalk";
71517
72027
 
71518
72028
  // src/diff/motion.ts
71519
72029
  var WEIGHT = {
@@ -71944,20 +72454,20 @@ async function gatherBenchSide(browser, opts) {
71944
72454
  async function benchCommand(opts) {
71945
72455
  const viewport = parseViewport3(opts.viewport);
71946
72456
  if (!viewport) {
71947
- console.error(chalk29.red(`--viewport inválido: ${opts.viewport}`));
72457
+ console.error(chalk30.red(`--viewport inválido: ${opts.viewport}`));
71948
72458
  return 2;
71949
72459
  }
71950
72460
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
71951
72461
  let props;
71952
72462
  if (opts.props) {
71953
- if (!existsSync25(opts.props)) {
71954
- 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}`));
71955
72465
  return 2;
71956
72466
  }
71957
72467
  try {
71958
- props = JSON.parse(readFileSync30(opts.props, "utf8"));
72468
+ props = JSON.parse(readFileSync31(opts.props, "utf8"));
71959
72469
  } catch (err) {
71960
- 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}`));
71961
72471
  return 2;
71962
72472
  }
71963
72473
  }
@@ -71972,7 +72482,7 @@ async function benchCommand(opts) {
71972
72482
  const prefix = `bench-${slug}-${viewport}`;
71973
72483
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
71974
72484
  if (aliasNote)
71975
- console.log(chalk29.dim(` ${aliasNote}`));
72485
+ console.log(chalk30.dim(` ${aliasNote}`));
71976
72486
  const browser = await launchBrowser({ headless: true });
71977
72487
  try {
71978
72488
  const [prodSide, candSide] = await Promise.all([
@@ -71997,7 +72507,7 @@ async function benchCommand(opts) {
71997
72507
  if (opts.json)
71998
72508
  console.log(JSON.stringify(payload));
71999
72509
  else
72000
- console.error(chalk29.red(` bench falhou — ${readErr}`));
72510
+ console.error(chalk30.red(` bench falhou — ${readErr}`));
72001
72511
  return 2;
72002
72512
  }
72003
72513
  const geometry = diffBoxTrees(prodSide.boxNodes.nodes, candSide.boxNodes.nodes, {
@@ -72027,9 +72537,9 @@ async function benchCommand(opts) {
72027
72537
  console.log(JSON.stringify(result));
72028
72538
  } else {
72029
72539
  console.log("");
72030
- console.log(chalk29.bold(` ${opts.component} — isolated (${viewport})`));
72031
- console.log(chalk29.dim(` prod ${prodUrl}`));
72032
- console.log(chalk29.dim(` cand ${candUrl}`));
72540
+ console.log(chalk30.bold(` ${opts.component} — isolated (${viewport})`));
72541
+ console.log(chalk30.dim(` prod ${prodUrl}`));
72542
+ console.log(chalk30.dim(` cand ${candUrl}`));
72033
72543
  console.log("");
72034
72544
  for (const line of formatBoxTreeDiff(geometry).split(`
72035
72545
  `))
@@ -72040,7 +72550,7 @@ async function benchCommand(opts) {
72040
72550
  ]) {
72041
72551
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
72042
72552
  if (caveat)
72043
- console.log(chalk29.yellow(` ${caveat}`));
72553
+ console.log(chalk30.yellow(` ${caveat}`));
72044
72554
  }
72045
72555
  if (motion) {
72046
72556
  console.log("");
@@ -72049,7 +72559,7 @@ async function benchCommand(opts) {
72049
72559
  console.log(` ${line}`);
72050
72560
  }
72051
72561
  console.log("");
72052
- console.log(chalk29.dim(` ${resultPath}`));
72562
+ console.log(chalk30.dim(` ${resultPath}`));
72053
72563
  }
72054
72564
  return clean || !opts.failOnDiff ? 0 : 1;
72055
72565
  } finally {
@@ -72060,7 +72570,7 @@ async function benchCommand(opts) {
72060
72570
  }
72061
72571
 
72062
72572
  // src/commands/locate.ts
72063
- import chalk30 from "chalk";
72573
+ import chalk31 from "chalk";
72064
72574
  var hitOf = (n, nodes) => ({
72065
72575
  key: n.key,
72066
72576
  label: n.label,
@@ -72185,22 +72695,22 @@ function printResult3(r) {
72185
72695
  const side = (name, a) => {
72186
72696
  if (a.found) {
72187
72697
  console.log(` ${name.padEnd(5)} ${a.hit.tag.padEnd(8)} ${formatHit(a.hit)}`);
72188
- console.log(chalk30.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
72698
+ console.log(chalk31.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
72189
72699
  return;
72190
72700
  }
72191
- console.log(chalk30.yellow(` ${name.padEnd(5)} ${a.reason}`));
72701
+ console.log(chalk31.yellow(` ${name.padEnd(5)} ${a.reason}`));
72192
72702
  for (const c of a.candidates ?? [])
72193
- console.log(chalk30.dim(` candidate: ${c}`));
72703
+ console.log(chalk31.dim(` candidate: ${c}`));
72194
72704
  };
72195
72705
  console.log("");
72196
- console.log(chalk30.bold(` ${r.label} — ${r.viewport}`));
72706
+ console.log(chalk31.bold(` ${r.label} — ${r.viewport}`));
72197
72707
  side("prod", r.prod);
72198
72708
  side("cand", r.cand);
72199
72709
  if (r.prod.found && r.cand.found) {
72200
72710
  const delta = formatDelta(r.prod.hit, r.cand.hit);
72201
72711
  console.log(` ${"diff".padEnd(5)} ${delta ?? "identical box and type"}`);
72202
72712
  for (const note of pairingNotes(r.prod.hit, r.cand.hit)) {
72203
- console.log(chalk30.yellow(` note ${note}`));
72713
+ console.log(chalk31.yellow(` note ${note}`));
72204
72714
  }
72205
72715
  }
72206
72716
  }
@@ -72208,22 +72718,22 @@ async function locateCommand(opts) {
72208
72718
  const selector = opts.selector ?? "body";
72209
72719
  const waitMs = Number.parseInt(opts.wait, 10);
72210
72720
  if (!Number.isFinite(waitMs) || waitMs < 0) {
72211
- console.error(chalk30.red(`--wait inválido: ${opts.wait}`));
72721
+ console.error(chalk31.red(`--wait inválido: ${opts.wait}`));
72212
72722
  return 2;
72213
72723
  }
72214
72724
  if (opts.labels.length === 0) {
72215
- 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"));
72216
72726
  return 2;
72217
72727
  }
72218
72728
  const viewports = opts.viewports.split(",").map((v) => v.trim());
72219
72729
  const bad = viewports.find((v) => parseViewport3(v) === null);
72220
72730
  if (bad) {
72221
- console.error(chalk30.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
72731
+ console.error(chalk31.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
72222
72732
  return 2;
72223
72733
  }
72224
72734
  const { aliases, note } = resolveAliases(opts.planDir);
72225
72735
  if (note && !opts.json)
72226
- console.log(chalk30.dim(` ${note}`));
72736
+ console.log(chalk31.dim(` ${note}`));
72227
72737
  const results = [];
72228
72738
  const caveats = [];
72229
72739
  const browser = await launchBrowser({ headless: true });
@@ -72278,39 +72788,39 @@ async function locateCommand(opts) {
72278
72788
  for (const r of results)
72279
72789
  printResult3(r);
72280
72790
  for (const c of caveats)
72281
- console.log(chalk30.yellow(` ${c}`));
72791
+ console.log(chalk31.yellow(` ${c}`));
72282
72792
  console.log("");
72283
72793
  if (unresolved.length > 0) {
72284
- console.log(chalk30.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72794
+ console.log(chalk31.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72285
72795
  } else {
72286
- 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`));
72287
72797
  }
72288
72798
  return unresolved.length > 0 ? 1 : 0;
72289
72799
  }
72290
72800
 
72291
72801
  // src/commands/cockpit.ts
72292
72802
  import { resolve as resolve15 } from "node:path";
72293
- import chalk31 from "chalk";
72803
+ import chalk32 from "chalk";
72294
72804
 
72295
72805
  // src/server/cockpit.ts
72296
- import { readFileSync as readFileSync35 } from "node:fs";
72806
+ import { readFileSync as readFileSync36 } from "node:fs";
72297
72807
  import { createServer as createServer2 } from "node:http";
72298
72808
  import { dirname as dirname8, join as join42, resolve as resolve14 } from "node:path";
72299
72809
 
72300
72810
  // src/server/cockpit-actions.ts
72301
72811
  import { spawn as spawn3 } from "node:child_process";
72302
- import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync32, readdirSync as readdirSync7, writeFileSync as writeFileSync31 } from "node:fs";
72812
+ import { existsSync as existsSync28, mkdirSync as mkdirSync20, readFileSync as readFileSync33, readdirSync as readdirSync7, writeFileSync as writeFileSync31 } from "node:fs";
72303
72813
  import { join as join39, resolve as resolve12 } from "node:path";
72304
72814
 
72305
72815
  // src/server/cockpit-settings.ts
72306
72816
  import { execFileSync as execFileSync3 } from "node:child_process";
72307
- import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync31, writeFileSync as writeFileSync30 } from "node:fs";
72817
+ import { chmodSync, existsSync as existsSync27, mkdirSync as mkdirSync19, readFileSync as readFileSync32, writeFileSync as writeFileSync30 } from "node:fs";
72308
72818
  import { homedir as homedir3 } from "node:os";
72309
72819
  import { join as join38, resolve as resolve11 } from "node:path";
72310
72820
  var FILE = () => join38(process.env.PARITY_HOME ?? join38(homedir3(), ".parity"), "config.json");
72311
72821
  function readAll() {
72312
72822
  try {
72313
- return JSON.parse(readFileSync31(FILE(), "utf8"));
72823
+ return JSON.parse(readFileSync32(FILE(), "utf8"));
72314
72824
  } catch {
72315
72825
  return {};
72316
72826
  }
@@ -72463,12 +72973,13 @@ var COMPONENT_STATUSES = [
72463
72973
  "done",
72464
72974
  "as-is",
72465
72975
  "upgrade",
72466
- "skipped"
72976
+ "skipped",
72977
+ "vanished"
72467
72978
  ];
72468
72979
  var PAGE_STATUSES2 = ["pending", "code", "done", "skipped"];
72469
72980
  function readState(planDir) {
72470
72981
  try {
72471
- return JSON.parse(readFileSync32(join39(planDir, "migration.json"), "utf8"));
72982
+ return JSON.parse(readFileSync33(join39(planDir, "migration.json"), "utf8"));
72472
72983
  } catch {
72473
72984
  return null;
72474
72985
  }
@@ -72542,10 +73053,10 @@ function setComponent(planDir, name, status, decision = {}) {
72542
73053
  const plan = loadPlan(planDir);
72543
73054
  if (!plan)
72544
73055
  throw new Error("no migration-plan.json");
72545
- const c = setComponentStatus(plan, name, status);
73056
+ const note = decision.note?.trim() ?? "";
73057
+ const c = setComponentStatus(plan, name, status, { note });
72546
73058
  if (!c)
72547
73059
  throw new Error(`no component "${name}" in the plan`);
72548
- const note = decision.note?.trim() ?? "";
72549
73060
  if (note || url || design) {
72550
73061
  setComponentReference(plan, name, {
72551
73062
  url,
@@ -72574,10 +73085,10 @@ function setComponentSelector(planDir, name, selector) {
72574
73085
  }
72575
73086
  function captured(planDir, host, name) {
72576
73087
  const file = join39(planDir, host, "capture.json");
72577
- if (!existsSync27(file))
73088
+ if (!existsSync28(file))
72578
73089
  return null;
72579
73090
  try {
72580
- const cap = JSON.parse(readFileSync32(file, "utf8"));
73091
+ const cap = JSON.parse(readFileSync33(file, "utf8"));
72581
73092
  const rows = Array.isArray(cap.components) ? cap.components : [];
72582
73093
  return rows.find((r) => r.role === name || r.name === name) ?? null;
72583
73094
  } catch {
@@ -72599,7 +73110,7 @@ function componentDetail(planDir, name) {
72599
73110
  }
72600
73111
  })();
72601
73112
  const cap = host ? captured(planDir, host, name) : null;
72602
- 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;
72603
73114
  const styles = cap?.computedStyles ?? {};
72604
73115
  return {
72605
73116
  name: c.name,
@@ -72628,7 +73139,7 @@ function componentShot(planDir, name) {
72628
73139
  const p = typeof cap?.screenshotPath === "string" ? cap.screenshotPath : null;
72629
73140
  if (!p || !resolve12(p).startsWith(resolve12(join39(planDir, host))))
72630
73141
  return null;
72631
- return existsSync27(p) ? readFileSync32(p) : null;
73142
+ return existsSync28(p) ? readFileSync33(p) : null;
72632
73143
  }
72633
73144
  function setPage(planDir, path, status) {
72634
73145
  if (!PAGE_STATUSES2.includes(status)) {
@@ -72646,13 +73157,13 @@ function setPage(planDir, path, status) {
72646
73157
  var jobsDir = (planDir) => join39(planDir, "jobs");
72647
73158
  function lastJob(planDir, kind) {
72648
73159
  const dir = jobsDir(planDir);
72649
- if (!existsSync27(dir))
73160
+ if (!existsSync28(dir))
72650
73161
  return null;
72651
73162
  const id = readdirSync7(dir).filter((d) => d.startsWith(`${kind}-`)).sort().pop();
72652
73163
  if (!id)
72653
73164
  return null;
72654
73165
  const j = join39(dir, id);
72655
- 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;
72656
73167
  const exit = read("exit");
72657
73168
  const pid = Number(read("pid") ?? 0);
72658
73169
  let alive = false;
@@ -72711,14 +73222,14 @@ function remoteUrl(dir) {
72711
73222
  }
72712
73223
 
72713
73224
  // src/server/cockpit-api.ts
72714
- 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";
72715
73226
  import { join as join40 } from "node:path";
72716
73227
  var notFound = (what) => ({ status: 404, body: { error: what } });
72717
73228
  function readJson2(path) {
72718
- if (!existsSync28(path))
73229
+ if (!existsSync29(path))
72719
73230
  return null;
72720
73231
  try {
72721
- return JSON.parse(readFileSync33(path, "utf8"));
73232
+ return JSON.parse(readFileSync34(path, "utf8"));
72722
73233
  } catch {
72723
73234
  return null;
72724
73235
  }
@@ -72727,7 +73238,7 @@ function withPlan(ctx) {
72727
73238
  return loadPlan(ctx.planDir);
72728
73239
  }
72729
73240
  function listBenchResults(benchDir) {
72730
- if (!existsSync28(benchDir))
73241
+ if (!existsSync29(benchDir))
72731
73242
  return [];
72732
73243
  let files;
72733
73244
  try {
@@ -72762,7 +73273,7 @@ function cockpitApi(path, params, ctx) {
72762
73273
  benchDir: ctx.benchDir,
72763
73274
  prodUrl: ctx.prodUrl ?? null,
72764
73275
  candUrl: ctx.candUrl ?? null,
72765
- hasPlan: existsSync28(join40(ctx.planDir, "migration-plan.json"))
73276
+ hasPlan: existsSync29(join40(ctx.planDir, "migration-plan.json"))
72766
73277
  }
72767
73278
  };
72768
73279
  case "/api/state": {
@@ -73332,13 +73843,13 @@ import { execFileSync as execFileSync4, spawn as spawn4 } from "node:child_proce
73332
73843
  import { randomUUID } from "node:crypto";
73333
73844
  import {
73334
73845
  appendFileSync as appendFileSync2,
73335
- existsSync as existsSync29,
73846
+ existsSync as existsSync30,
73336
73847
  mkdirSync as mkdirSync21,
73337
- readFileSync as readFileSync34,
73848
+ readFileSync as readFileSync35,
73338
73849
  readdirSync as readdirSync9,
73339
73850
  realpathSync,
73340
73851
  renameSync as renameSync2,
73341
- rmSync,
73852
+ rmSync as rmSync2,
73342
73853
  statSync as statSync3,
73343
73854
  symlinkSync,
73344
73855
  unlinkSync as unlinkSync4,
@@ -73360,12 +73871,12 @@ function validTaskId(id) {
73360
73871
  }
73361
73872
  function pluginDir() {
73362
73873
  const root = resolve13(dirname7(fileURLToPath(import.meta.url)), "../../../..");
73363
- return existsSync29(join41(root, ".claude-plugin", "plugin.json")) ? root : null;
73874
+ return existsSync30(join41(root, ".claude-plugin", "plugin.json")) ? root : null;
73364
73875
  }
73365
73876
  function targetDir(planDir) {
73366
73877
  try {
73367
- const state = JSON.parse(readFileSync34(join41(planDir, "migration.json"), "utf8"));
73368
- 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))
73369
73880
  return state.target.dir;
73370
73881
  } catch {}
73371
73882
  return dirname7(resolve13(planDir));
@@ -73462,7 +73973,7 @@ function locateSource(html, root) {
73462
73973
  continue;
73463
73974
  const file = join41(dir, e.name);
73464
73975
  if (/\.(s?css|less)$/.test(e.name)) {
73465
- const lines = readFileSync34(file, "utf8").split(`
73976
+ const lines = readFileSync35(file, "utf8").split(`
73466
73977
  `);
73467
73978
  for (const local of mods.get(stem) ?? []) {
73468
73979
  const leaf = local.split("__").pop() ?? local;
@@ -73474,7 +73985,7 @@ function locateSource(html, root) {
73474
73985
  }
73475
73986
  }
73476
73987
  };
73477
- walk(existsSync29(join41(root, "src")) ? join41(root, "src") : root, 0);
73988
+ walk(existsSync30(join41(root, "src")) ? join41(root, "src") : root, 0);
73478
73989
  return hits;
73479
73990
  }
73480
73991
  function grid(s) {
@@ -73624,7 +74135,7 @@ function prompt(task, planDir, dir) {
73624
74135
  "",
73625
74136
  "Steps:",
73626
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.`,
73627
- existsSync29(join41(dir, "sizes.md")) ? `1. The numbers are already measured and written to ${join41(dir, "sizes.md")} (prod = target, cand = now, plus the source file and CSS rule). Dispatch \`fixer\` DIRECTLY with the note, sizes.md, context.json, the screenshots, and the TARGET repo's conventions.rules + gates from migration.json. Do not dispatch \`briefer\` — sizes.md is the brief.` : `1. Nothing was measured. Dispatch \`briefer\` first (note, screenshots, target dir; out: ${join41(dir, "brief.md")}), then \`fixer\` with brief.md and the TARGET repo's conventions.rules + gates.`,
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.`,
73628
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.",
73629
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.`,
73630
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:",
@@ -73664,7 +74175,7 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73664
74175
  return false;
73665
74176
  }
73666
74177
  })();
73667
- 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"))) {
73668
74179
  symlinkSync(join41(repo, "node_modules"), join41(wt, "node_modules"));
73669
74180
  }
73670
74181
  return { worktree: wt, branch, base: { ref, sha } };
@@ -73719,7 +74230,7 @@ function retryTask(planDir, id, note) {
73719
74230
  const n = (task.attempts?.length ?? 0) + 2;
73720
74231
  const previousBranch = task.branch ?? d.delivery?.branch ?? null;
73721
74232
  let moved = false;
73722
- if (!task.worktree || !existsSync29(task.worktree)) {
74233
+ if (!task.worktree || !existsSync30(task.worktree)) {
73723
74234
  Object.assign(task, prepareWorktree(task, planDir, dir, `cockpit/${task.id}-r${n}`));
73724
74235
  if (!task.worktree)
73725
74236
  throw new Error(`could not create a worktree: ${task.worktreeError}`);
@@ -73744,11 +74255,11 @@ function retryTask(planDir, id, note) {
73744
74255
  const promptFile = join41(dir, `prompt-${n}.md`);
73745
74256
  writeFileSync32(promptFile, lines.join(`
73746
74257
  `));
73747
- if (existsSync29(join41(dir, "stderr.log")))
74258
+ if (existsSync30(join41(dir, "stderr.log")))
73748
74259
  renameSync2(join41(dir, "stderr.log"), join41(dir, `stderr-${n - 1}.log`));
73749
- if (existsSync29(join41(dir, "exit")))
74260
+ if (existsSync30(join41(dir, "exit")))
73750
74261
  unlinkSync4(join41(dir, "exit"));
73751
- if (existsSync29(join41(dir, "stopped")))
74262
+ if (existsSync30(join41(dir, "stopped")))
73752
74263
  unlinkSync4(join41(dir, "stopped"));
73753
74264
  task.attempts = [
73754
74265
  ...task.attempts ?? [],
@@ -73799,7 +74310,7 @@ async function createTask(planDir, note) {
73799
74310
  }
73800
74311
  var procCache = new Map;
73801
74312
  function taskProcesses(worktree) {
73802
- if (!worktree || !existsSync29(worktree))
74313
+ if (!worktree || !existsSync30(worktree))
73803
74314
  return [];
73804
74315
  const real = realpathSync(worktree);
73805
74316
  if (!real || real === "/")
@@ -73842,11 +74353,11 @@ function taskProcesses(worktree) {
73842
74353
  function stopTask(planDir, id) {
73843
74354
  const dir = taskDir(planDir, id);
73844
74355
  const file = join41(dir, "task.json");
73845
- if (!existsSync29(file))
74356
+ if (!existsSync30(file))
73846
74357
  throw new Error("no such task");
73847
- const task = JSON.parse(readFileSync34(file, "utf8"));
74358
+ const task = JSON.parse(readFileSync35(file, "utf8"));
73848
74359
  let stopped = 0;
73849
- if (task.pid && alive(task.pid) && !existsSync29(join41(dir, "exit"))) {
74360
+ if (task.pid && alive(task.pid) && !existsSync30(join41(dir, "exit"))) {
73850
74361
  try {
73851
74362
  process.kill(-task.pid, "SIGTERM");
73852
74363
  stopped += 1;
@@ -73912,7 +74423,7 @@ function prPlan(planDir, id, baseOverride) {
73912
74423
  throw new Error("no such task");
73913
74424
  const task = d.task;
73914
74425
  const branch = d.delivery?.branch;
73915
- if (!branch || !task.worktree || !existsSync29(task.worktree))
74426
+ if (!branch || !task.worktree || !existsSync30(task.worktree))
73916
74427
  throw new Error("this task has no local branch to push");
73917
74428
  const eff = effectiveSettings(planDir, targetDir(planDir));
73918
74429
  const settings = { prBase: eff.prBase, githubUser: eff.githubUser };
@@ -73956,7 +74467,7 @@ function openPr(planDir, id, baseOverride) {
73956
74467
  if (!plan.commits.length)
73957
74468
  throw new Error("the branch has no commits of its own");
73958
74469
  const dir = taskDir(planDir, id);
73959
- const task = JSON.parse(readFileSync34(join41(dir, "task.json"), "utf8"));
74470
+ const task = JSON.parse(readFileSync35(join41(dir, "task.json"), "utf8"));
73960
74471
  const wt = task.worktree;
73961
74472
  const env = { ...process.env, ...ghEnv(plan.account ?? undefined) };
73962
74473
  const git = (...a) => execFileSync4("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
@@ -74017,7 +74528,7 @@ function autoOpenPrs(planDir) {
74017
74528
  if (t.status !== "done" || t.prUrl)
74018
74529
  continue;
74019
74530
  const mark = join41(taskDir(planDir, t.id), "pr-auto.json");
74020
- if (existsSync29(mark))
74531
+ if (existsSync30(mark))
74021
74532
  continue;
74022
74533
  const at = new Date().toISOString();
74023
74534
  try {
@@ -74114,12 +74625,12 @@ function autoMergePrs(planDir) {
74114
74625
  if (t.status !== "done")
74115
74626
  continue;
74116
74627
  const dir = taskDir(planDir, t.id);
74117
- if (existsSync29(join41(dir, "pr-merge.json")))
74628
+ if (existsSync30(join41(dir, "pr-merge.json")))
74118
74629
  continue;
74119
74630
  const d = readTask(planDir, t.id);
74120
74631
  const branch = d?.delivery?.branch;
74121
74632
  const wt = d?.task.worktree;
74122
- if (!d || !branch || !wt || !existsSync29(wt))
74633
+ if (!d || !branch || !wt || !existsSync30(wt))
74123
74634
  continue;
74124
74635
  const pr = prInfo(branch, wt, dir, true, true);
74125
74636
  if (!pr || pr.state !== "OPEN")
@@ -74158,8 +74669,8 @@ function autoMergePrs(planDir) {
74158
74669
  writeFileSync32(join41(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
74159
74670
  `)[0] }));
74160
74671
  }
74161
- rmSync(join41(dir, "pr.json"), { force: true });
74162
- } 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"))) {
74163
74674
  writeFileSync32(join41(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
74164
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.`);
74165
74676
  }
@@ -74170,7 +74681,7 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
74170
74681
  return null;
74171
74682
  const cache = join41(dir, "pr.json");
74172
74683
  try {
74173
- const c = JSON.parse(readFileSync34(cache, "utf8"));
74684
+ const c = JSON.parse(readFileSync35(cache, "utf8"));
74174
74685
  if (!fresh && Date.now() - c.checkedAt < 60000)
74175
74686
  return c.info ?? (c.url ? { url: c.url } : null);
74176
74687
  } catch {}
@@ -74200,9 +74711,9 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
74200
74711
  function readTask(planDir, id) {
74201
74712
  const dir = taskDir(planDir, id);
74202
74713
  const file = join41(dir, "task.json");
74203
- if (!existsSync29(file))
74714
+ if (!existsSync30(file))
74204
74715
  return null;
74205
- const task = JSON.parse(readFileSync34(file, "utf8"));
74716
+ const task = JSON.parse(readFileSync35(file, "utf8"));
74206
74717
  const streamFile = join41(dir, "stream.jsonl");
74207
74718
  const exitFile = join41(dir, "exit");
74208
74719
  const steps = [];
@@ -74213,7 +74724,7 @@ function readTask(planDir, id) {
74213
74724
  let lastTs;
74214
74725
  let rawResult = "";
74215
74726
  const actorOf = (parent) => parent && agents.get(parent)?.type || "orchestrator";
74216
- const lines = existsSync29(streamFile) ? readFileSync34(streamFile, "utf8").split(`
74727
+ const lines = existsSync30(streamFile) ? readFileSync35(streamFile, "utf8").split(`
74217
74728
  `) : [];
74218
74729
  for (const line of lines) {
74219
74730
  if (!line.trim())
@@ -74307,8 +74818,8 @@ function readTask(planDir, id) {
74307
74818
  if (agent) {
74308
74819
  const scan = (t) => [...t.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74309
74820
  let res = scan(String(m.summary ?? ""));
74310
- if (!res && typeof m.output_file === "string" && existsSync29(m.output_file)) {
74311
- res = scan(agentText(readFileSync34(m.output_file, "utf8")));
74821
+ if (!res && typeof m.output_file === "string" && existsSync30(m.output_file)) {
74822
+ res = scan(agentText(readFileSync35(m.output_file, "utf8")));
74312
74823
  }
74313
74824
  if (res) {
74314
74825
  try {
@@ -74333,8 +74844,8 @@ function readTask(planDir, id) {
74333
74844
  steps.push({ actor: "orchestrator", kind: "result", text: result.text, isError: !result.ok });
74334
74845
  }
74335
74846
  }
74336
- const exit = existsSync29(exitFile) ? Number(readFileSync34(exitFile, "utf8").trim()) : null;
74337
- const stderrRaw = existsSync29(join41(dir, "stderr.log")) ? readFileSync34(join41(dir, "stderr.log"), "utf8") : "";
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") : "";
74338
74849
  const finalLine = [...rawResult.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74339
74850
  let verdict = null;
74340
74851
  try {
@@ -74346,7 +74857,7 @@ function readTask(planDir, id) {
74346
74857
  let reason;
74347
74858
  let status;
74348
74859
  if (exit !== null) {
74349
- if (existsSync29(join41(dir, "stopped"))) {
74860
+ if (existsSync30(join41(dir, "stopped"))) {
74350
74861
  reason = "stopped from the cockpit";
74351
74862
  } else if (/Background tasks still running .* terminating/.test(stderrRaw)) {
74352
74863
  reason = `claude stopped waiting for background agents (${unfinished.join(", ") || "?"}) and terminated them`;
@@ -74365,17 +74876,17 @@ function readTask(planDir, id) {
74365
74876
  else if (!alive(task.pid))
74366
74877
  status = "failed";
74367
74878
  else {
74368
- const last = existsSync29(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74879
+ const last = existsSync30(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74369
74880
  status = Date.now() - last > STALL_MS ? "stalled" : "running";
74370
74881
  }
74371
- 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;
74372
74883
  const stderr = clip(stderrRaw, 1500);
74373
74884
  const fixer = [...agents.values()].reverse().find((a) => a.type === "fixer" && a.result);
74374
74885
  const fr = fixer?.result ?? {};
74375
74886
  const branch = verdict?.branch ?? fr.branch ?? null;
74376
74887
  let delivery = null;
74377
74888
  if (branch) {
74378
- 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)));
74379
74890
  const baseSha = task.base?.sha ?? fr.base;
74380
74891
  const git = (...a) => {
74381
74892
  try {
@@ -74406,7 +74917,7 @@ function readTask(planDir, id) {
74406
74917
  model,
74407
74918
  prError: (() => {
74408
74919
  try {
74409
- const m = JSON.parse(readFileSync34(join41(dir, "pr-auto.json"), "utf8"));
74920
+ const m = JSON.parse(readFileSync35(join41(dir, "pr-auto.json"), "utf8"));
74410
74921
  return m.ok ? null : String(m.error);
74411
74922
  } catch {
74412
74923
  return null;
@@ -74426,7 +74937,7 @@ function readTask(planDir, id) {
74426
74937
  }
74427
74938
  function listTasks2(planDir) {
74428
74939
  const dir = tasksDir(planDir);
74429
- if (!existsSync29(dir))
74940
+ if (!existsSync30(dir))
74430
74941
  return [];
74431
74942
  return readdirSync9(dir).filter(validTaskId).sort().reverse().map((id) => readTask(planDir, id)).filter((t) => t !== null).map(({ task, status, agents, result, delivery }) => ({
74432
74943
  ...task,
@@ -74441,7 +74952,7 @@ function taskShot(planDir, id, side) {
74441
74952
  if (!validTaskId(id) || side !== "prod" && side !== "cand")
74442
74953
  return null;
74443
74954
  const file = join41(taskDir(planDir, id), `${side}.png`);
74444
- return existsSync29(file) ? readFileSync34(file) : null;
74955
+ return existsSync30(file) ? readFileSync35(file) : null;
74445
74956
  }
74446
74957
 
74447
74958
  // src/server/cockpit.ts
@@ -74726,7 +75237,7 @@ async function actions(req, res, path, ctx) {
74726
75237
  }
74727
75238
  function targetDirOf(planDir) {
74728
75239
  try {
74729
- const st = JSON.parse(readFileSync35(join42(planDir, "migration.json"), "utf8"));
75240
+ const st = JSON.parse(readFileSync36(join42(planDir, "migration.json"), "utf8"));
74730
75241
  if (typeof st?.target?.dir === "string")
74731
75242
  return st.target.dir;
74732
75243
  } catch {}
@@ -74749,19 +75260,19 @@ async function cockpitCommand(opts) {
74749
75260
  host: opts.host
74750
75261
  });
74751
75262
  } catch (err) {
74752
- console.error(chalk31.red(` ✖ could not start the cockpit: ${err.message}`));
75263
+ console.error(chalk32.red(` ✖ could not start the cockpit: ${err.message}`));
74753
75264
  return 2;
74754
75265
  }
74755
75266
  console.log("");
74756
- console.log(chalk31.bold(" parity cockpit"));
74757
- console.log(` ${chalk31.green("●")} ${handle.url}`);
74758
- console.log(chalk31.dim(` plan ${ctx.planDir}`));
74759
- console.log(chalk31.dim(` runs ${ctx.output}`));
74760
- console.log(chalk31.dim(` bench ${ctx.benchDir}`));
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}`));
74761
75272
  if (opts.host && opts.host !== "127.0.0.1" && opts.host !== "localhost") {
74762
- console.log(chalk31.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
75273
+ console.log(chalk32.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
74763
75274
  }
74764
- console.log(chalk31.dim(` Ctrl+C to stop.
75275
+ console.log(chalk32.dim(` Ctrl+C to stop.
74765
75276
  `));
74766
75277
  if (opts.open !== false) {
74767
75278
  const { default: openUrl } = await import("open");
@@ -74781,15 +75292,15 @@ async function cockpitCommand(opts) {
74781
75292
 
74782
75293
  // src/commands/ios.ts
74783
75294
  import { execFileSync as execFileSync5 } from "node:child_process";
74784
- import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync37, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
75295
+ import { existsSync as existsSync32, mkdirSync as mkdirSync22, readFileSync as readFileSync38, rmSync as rmSync3, writeFileSync as writeFileSync33 } from "node:fs";
74785
75296
  import { homedir as homedir4, tmpdir as tmpdir2 } from "node:os";
74786
75297
  import { join as join44, resolve as resolve16 } from "node:path";
74787
- import chalk33 from "chalk";
75298
+ import chalk34 from "chalk";
74788
75299
 
74789
75300
  // src/commands/pair.ts
74790
- import { existsSync as existsSync30, readFileSync as readFileSync36 } from "node:fs";
75301
+ import { existsSync as existsSync31, readFileSync as readFileSync37 } from "node:fs";
74791
75302
  import { join as join43 } from "node:path";
74792
- import chalk32 from "chalk";
75303
+ import chalk33 from "chalk";
74793
75304
 
74794
75305
  // src/engine/pair.ts
74795
75306
  function signatureOf(target, doc = document) {
@@ -74989,7 +75500,7 @@ async function open3(browser, url, viewport, waitMs) {
74989
75500
  async function pairCommand(opts) {
74990
75501
  const viewport = parseViewport3(opts.viewport);
74991
75502
  if (!viewport) {
74992
- 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)`));
74993
75504
  return 2;
74994
75505
  }
74995
75506
  const from = opts.side;
@@ -75031,27 +75542,27 @@ function report(opts, from, source, match, problem) {
75031
75542
  ambiguous: match?.ambiguous ?? 0
75032
75543
  }));
75033
75544
  } else {
75034
- 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})`) : "";
75035
75546
  if (source)
75036
75547
  console.log(`${from} ${source.selector} ${box(source)}`);
75037
75548
  if (match) {
75038
- 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}`)}`);
75039
75550
  }
75040
75551
  if (problem)
75041
- console.log(chalk32.yellow(problem));
75552
+ console.log(chalk33.yellow(problem));
75042
75553
  else if (match?.by === "position") {
75043
- 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"));
75044
75555
  }
75045
75556
  }
75046
75557
  return problem ? 2 : 0;
75047
75558
  }
75048
75559
  function sectionArgsFromTask(taskDir) {
75049
75560
  const file = join43(taskDir, "task.json");
75050
- if (!existsSync30(file))
75561
+ if (!existsSync31(file))
75051
75562
  throw new Error(`no task.json in ${taskDir}`);
75052
- const task = JSON.parse(readFileSync36(file, "utf8"));
75563
+ const task = JSON.parse(readFileSync37(file, "utf8"));
75053
75564
  const ctxFile = join43(taskDir, "context.json");
75054
- const ctx = existsSync30(ctxFile) ? JSON.parse(readFileSync36(ctxFile, "utf8")) : {};
75565
+ const ctx = existsSync31(ctxFile) ? JSON.parse(readFileSync37(ctxFile, "utf8")) : {};
75055
75566
  const prodSel = task.side === "prod" ? task.selector : ctx.prod?.selector ?? task.counterpart;
75056
75567
  const candSel = task.side === "cand" ? task.selector : ctx.cand?.selector ?? task.counterpart;
75057
75568
  if (!prodSel || !candSel) {
@@ -75086,7 +75597,7 @@ async function takeLock() {
75086
75597
  mkdirSync22(join44(homedir4(), ".parity"), { recursive: true });
75087
75598
  const until = Date.now() + 5 * 60000;
75088
75599
  for (;; ) {
75089
- const holder = existsSync31(LOCK) ? Number(readFileSync37(LOCK, "utf8")) : 0;
75600
+ const holder = existsSync32(LOCK) ? Number(readFileSync38(LOCK, "utf8")) : 0;
75090
75601
  if (!holder || !alive2(holder) || holder === process.pid)
75091
75602
  break;
75092
75603
  if (Date.now() > until)
@@ -75107,7 +75618,7 @@ async function iosCommand(opts) {
75107
75618
  try {
75108
75619
  execFileSync5("xcrun", ["simctl", "help"], { stdio: "ignore" });
75109
75620
  } catch {
75110
- 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."));
75111
75622
  return 2;
75112
75623
  }
75113
75624
  let { prod, cand, selector, candSelector } = opts;
@@ -75164,9 +75675,9 @@ async function iosCommand(opts) {
75164
75675
  simctl("shutdown", device.udid);
75165
75676
  } catch {}
75166
75677
  }
75167
- rmSync2(scratch, { recursive: true, force: true });
75168
- if (existsSync31(LOCK) && Number(readFileSync37(LOCK, "utf8")) === process.pid)
75169
- rmSync2(LOCK);
75678
+ rmSync3(scratch, { recursive: true, force: true });
75679
+ if (existsSync32(LOCK) && Number(readFileSync38(LOCK, "utf8")) === process.pid)
75680
+ rmSync3(LOCK);
75170
75681
  }
75171
75682
  const missing = Object.entries(found).filter(([, v]) => v !== true).map(([k]) => k);
75172
75683
  let diff = null;
@@ -75182,11 +75693,11 @@ async function iosCommand(opts) {
75182
75693
  if (opts.json)
75183
75694
  console.log(JSON.stringify(report));
75184
75695
  else {
75185
- console.log(`${chalk33.bold("iOS Safari")} · ${device.name}`);
75696
+ console.log(`${chalk34.bold("iOS Safari")} · ${device.name}`);
75186
75697
  for (const [k, v] of Object.entries(shots))
75187
75698
  console.log(` ${k.padEnd(5)} ${v}`);
75188
75699
  for (const side of missing) {
75189
- console.log(chalk33.yellow(` ${side}: the element was ${found[side] === false ? "not found" : "not reported"} in Safari — no diff (pass a selector that holds, e.g. from \`parity pair\`)`));
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\`)`));
75190
75701
  }
75191
75702
  if (diff)
75192
75703
  console.log(` diff ${(diff.pctDiff * 100).toFixed(2)}% (${diff.diffPixels} px) → ${diff.heatmapPath}`);
@@ -75199,7 +75710,7 @@ import { createInterface as createInterface3 } from "node:readline";
75199
75710
  import { resolve as resolve18 } from "node:path";
75200
75711
 
75201
75712
  // src/util/version.ts
75202
- import { readFileSync as readFileSync38 } from "node:fs";
75713
+ import { readFileSync as readFileSync39 } from "node:fs";
75203
75714
  import { dirname as dirname9, resolve as resolve17 } from "node:path";
75204
75715
  import { fileURLToPath as fileURLToPath2 } from "node:url";
75205
75716
  function getPackageVersion() {
@@ -75208,7 +75719,7 @@ function getPackageVersion() {
75208
75719
  for (const up of ["..", "../..", "../../.."]) {
75209
75720
  try {
75210
75721
  const pkgPath = resolve17(here, up, "package.json");
75211
- const raw = readFileSync38(pkgPath, "utf8");
75722
+ const raw = readFileSync39(pkgPath, "utf8");
75212
75723
  const parsed = JSON.parse(raw);
75213
75724
  if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
75214
75725
  return parsed.version;
@@ -75319,7 +75830,7 @@ function parseLine(line) {
75319
75830
  }
75320
75831
 
75321
75832
  // src/mcp/tools.ts
75322
- import { existsSync as existsSync32, readFileSync as readFileSync39 } from "node:fs";
75833
+ import { existsSync as existsSync33, readFileSync as readFileSync40 } from "node:fs";
75323
75834
  import { join as join45 } from "node:path";
75324
75835
  var STR = { type: "string" };
75325
75836
  var NONE = { type: "object", properties: {}, additionalProperties: false };
@@ -75357,11 +75868,11 @@ function createTools(ctx) {
75357
75868
  inputSchema: NONE,
75358
75869
  handler: () => {
75359
75870
  const p = join45(ctx.planDir, "migration.json");
75360
- if (!existsSync32(p)) {
75871
+ if (!existsSync33(p)) {
75361
75872
  return fail2(`no migration.json in ${ctx.planDir} — no migration has been started here`);
75362
75873
  }
75363
75874
  try {
75364
- return json2(JSON.parse(readFileSync39(p, "utf8")));
75875
+ return json2(JSON.parse(readFileSync40(p, "utf8")));
75365
75876
  } catch (err) {
75366
75877
  return fail2(`migration.json is not valid JSON: ${err.message}`);
75367
75878
  }
@@ -75460,10 +75971,10 @@ function createTools(ctx) {
75460
75971
  },
75461
75972
  {
75462
75973
  name: "SET_STATUS",
75463
- description: "Flip a component's porting status: pending | partial | done | as-is | upgrade | skipped. `as-is` and `upgrade` mean 'stop opening work for this' and are the USER's call — an agent setting them itself is how a real gap disappears from view.",
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>\").",
75464
75975
  inputSchema: {
75465
75976
  type: "object",
75466
- properties: { name: STR, status: STR },
75977
+ properties: { name: STR, status: STR, note: STR },
75467
75978
  required: ["name", "status"],
75468
75979
  additionalProperties: false
75469
75980
  },
@@ -75473,14 +75984,19 @@ function createTools(ctx) {
75473
75984
  const status = str(args, "status");
75474
75985
  if (!name || !status)
75475
75986
  return fail2("name and status are required");
75476
- const allowed = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
75987
+ const allowed = ["pending", "partial", "done", "as-is", "upgrade", "skipped", "vanished"];
75477
75988
  if (!allowed.includes(status)) {
75478
75989
  return fail2(`invalid status "${status}". Use one of: ${allowed.join(", ")}`);
75479
75990
  }
75480
- return mutate(ctx, (plan) => {
75481
- const c = setComponentStatus(plan, name, status);
75482
- return c ? `${c.name} → ${status}` : null;
75483
- });
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
+ }
75484
76000
  }
75485
76001
  },
75486
76002
  {
@@ -75593,7 +76109,7 @@ async function mcpCommand(opts) {
75593
76109
  // src/commands/heatmap.ts
75594
76110
  import { mkdirSync as mkdirSync23 } from "node:fs";
75595
76111
  import { resolve as resolve19 } from "node:path";
75596
- import chalk34 from "chalk";
76112
+ import chalk35 from "chalk";
75597
76113
 
75598
76114
  // src/diff/hotspot-findings.ts
75599
76115
  var TYPOGRAPHY_PROPS = /^(font-family|font-weight|font-size|font-style|line-height|letter-spacing|text-transform)$/;
@@ -75692,13 +76208,13 @@ function describe2(type, hotspot, nodes, imageHostDelta, because) {
75692
76208
  }
75693
76209
 
75694
76210
  // src/diff/noise-mask.ts
75695
- import { readFileSync as readFileSync40, writeFileSync as writeFileSync34 } from "node:fs";
76211
+ import { readFileSync as readFileSync41, writeFileSync as writeFileSync34 } from "node:fs";
75696
76212
  import { PNG as PNG5 } from "pngjs";
75697
76213
  var DEFAULT_DILATE = 2;
75698
76214
  var MAX_MASK_COVERAGE = 0.2;
75699
76215
  function buildNoiseMask(firstPng, secondPng, dilate = DEFAULT_DILATE) {
75700
- const a = PNG5.sync.read(readFileSync40(firstPng));
75701
- const b = PNG5.sync.read(readFileSync40(secondPng));
76216
+ const a = PNG5.sync.read(readFileSync41(firstPng));
76217
+ const b = PNG5.sync.read(readFileSync41(secondPng));
75702
76218
  if (a.width !== b.width || a.height !== b.height)
75703
76219
  return null;
75704
76220
  const { width, height } = a;
@@ -75738,7 +76254,7 @@ function dilateMask(src, width, height, radius) {
75738
76254
  return pass(pass(src, true), false);
75739
76255
  }
75740
76256
  function applyMask(pngPath, mask, outPath) {
75741
- const png = PNG5.sync.read(readFileSync40(pngPath));
76257
+ const png = PNG5.sync.read(readFileSync41(pngPath));
75742
76258
  if (png.width !== mask.width || png.height !== mask.height) {
75743
76259
  throw new Error(`applyMask: image is ${png.width}x${png.height} but the mask is ${mask.width}x${mask.height}`);
75744
76260
  }
@@ -75755,7 +76271,7 @@ function applyMask(pngPath, mask, outPath) {
75755
76271
  }
75756
76272
  function readPngSize(pngPath) {
75757
76273
  try {
75758
- const head = readFileSync40(pngPath).subarray(0, 24);
76274
+ const head = readFileSync41(pngPath).subarray(0, 24);
75759
76275
  if (head.length < 24)
75760
76276
  return null;
75761
76277
  return { width: head.readUInt32BE(16), height: head.readUInt32BE(20) };
@@ -76007,16 +76523,16 @@ function exitCodeFor(verdict) {
76007
76523
  async function heatmapCommand(opts) {
76008
76524
  const specs = parseViewports2(opts.viewports);
76009
76525
  if (typeof specs === "string") {
76010
- console.error(chalk34.red(specs));
76526
+ console.error(chalk35.red(specs));
76011
76527
  return EXIT_INCONCLUSIVE;
76012
76528
  }
76013
76529
  const waitMs = Number.parseInt(opts.wait, 10);
76014
76530
  if (!Number.isFinite(waitMs) || waitMs < 0) {
76015
- console.error(chalk34.red(`--wait inválido: ${opts.wait}`));
76531
+ console.error(chalk35.red(`--wait inválido: ${opts.wait}`));
76016
76532
  return EXIT_INCONCLUSIVE;
76017
76533
  }
76018
76534
  if (!isValidUrl5(opts.prod) || !isValidUrl5(opts.cand)) {
76019
- console.error(chalk34.red("--prod ou --cand inválido"));
76535
+ console.error(chalk35.red("--prod ou --cand inválido"));
76020
76536
  return EXIT_INCONCLUSIVE;
76021
76537
  }
76022
76538
  const selector = opts.selector?.trim() || null;
@@ -76055,7 +76571,7 @@ async function heatmapCommand(opts) {
76055
76571
  };
76056
76572
  if (opts.pr) {
76057
76573
  await postQaComment({ report, pr: opts.pr, repo: opts.repo }).catch((err) => {
76058
- console.error(chalk34.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
76574
+ console.error(chalk35.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
76059
76575
  });
76060
76576
  }
76061
76577
  if (opts.json)
@@ -76167,6 +76683,18 @@ function judgePair(args) {
76167
76683
  const blocked = firstBlocker(prod, cand);
76168
76684
  if (blocked)
76169
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
+ }
76170
76698
  if (!args.prodRepeatScreenshot) {
76171
76699
  return {
76172
76700
  ...base,
@@ -76289,6 +76817,37 @@ function judgePair(args) {
76289
76817
  reason: diff.diffPixels === 0 ? undefined : `${diff.diffPixels} differing pixels in ${analysis.hotspots.length} region(s)`
76290
76818
  };
76291
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
+ }
76292
76851
  function explainHotspots(hotspots, prod, cand, paths, prodBoxTree, candBoxTree) {
76293
76852
  if (hotspots.length === 0)
76294
76853
  return [];
@@ -76364,6 +76923,7 @@ async function captureSide(browser, args) {
76364
76923
  });
76365
76924
  side.devicePixelRatio = await page.evaluate(() => window.devicePixelRatio);
76366
76925
  side.fontsStatus = await page.evaluate(() => document.fonts?.status ?? "unknown");
76926
+ side.horizontalOverflow = await readHorizontalOverflow(page);
76367
76927
  if (args.selector) {
76368
76928
  const loc = page.locator(args.selector);
76369
76929
  side.matches = await loc.count();
@@ -76445,6 +77005,46 @@ async function isAlreadyOnScreen(page, selector) {
76445
77005
  return false;
76446
77006
  }
76447
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
+ }
76448
77048
  async function readImageHosts(page, selector) {
76449
77049
  return page.evaluate((sel) => {
76450
77050
  const root = sel ? document.querySelector(sel) : document.body;
@@ -76481,35 +77081,46 @@ function isValidUrl5(s) {
76481
77081
  }
76482
77082
  }
76483
77083
  var MARK = {
76484
- identical: chalk34.green("✓"),
76485
- differs: chalk34.red("✗"),
76486
- inconclusive: chalk34.yellow("?")
77084
+ identical: chalk35.green("✓"),
77085
+ differs: chalk35.red("✗"),
77086
+ inconclusive: chalk35.yellow("?")
76487
77087
  };
76488
77088
  function printReport(report) {
76489
77089
  console.log("");
76490
- console.log(chalk34.bold(` parity heatmap — ${report.mode}`));
76491
- console.log(chalk34.dim(` prod: ${report.prodUrl}`));
76492
- console.log(chalk34.dim(` cand: ${report.candUrl}`));
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}`));
76493
77093
  console.log("");
76494
77094
  for (const v of report.viewports) {
76495
- 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");
76496
77096
  console.log(` ${MARK[v.verdict]} ${v.label.padEnd(12)} ${detail}`);
76497
77097
  if (v.maskedCoverage != null && v.maskedCoverage > 0) {
76498
- console.log(chalk34.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
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
+ }
76499
77110
  }
76500
77111
  for (const f of v.findings.slice(0, 5)) {
76501
- console.log(chalk34.dim(` [${f.type}] ${f.summary}`));
77112
+ console.log(chalk35.dim(` [${f.type}] ${f.summary}`));
76502
77113
  }
76503
77114
  if (v.heatmapPath && v.verdict === "differs") {
76504
- console.log(chalk34.dim(` ${v.heatmapPath}`));
77115
+ console.log(chalk35.dim(` ${v.heatmapPath}`));
76505
77116
  }
76506
77117
  const hosts = imageHostDelta(v.prod.imageHosts, v.cand.imageHosts);
76507
77118
  if (hosts.onlyProd.length > 0 || hosts.onlyCand.length > 0) {
76508
- console.log(chalk34.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
77119
+ console.log(chalk35.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
76509
77120
  }
76510
77121
  }
76511
77122
  console.log("");
76512
- 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}` : ""}`);
76513
77124
  console.log("");
76514
77125
  }
76515
77126
  function imageHostDelta(prod, cand) {
@@ -76529,8 +77140,193 @@ function formatHostDelta(d) {
76529
77140
  return parts.join(" · ");
76530
77141
  }
76531
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
+
76532
77328
  // src/commands/states.ts
76533
- import chalk35 from "chalk";
77329
+ import chalk37 from "chalk";
76534
77330
  var HOVERABLE = "a,button,summary,[role='button'],[role='menuitem'],label";
76535
77331
  var SETTLE_RETRY_FACTOR = 4;
76536
77332
  async function readStateEffects(page, opts) {
@@ -76745,7 +77541,7 @@ function statesVerdict(counts) {
76745
77541
  async function statesCommand(opts) {
76746
77542
  const viewport = parseViewport3(opts.viewport);
76747
77543
  if (!viewport) {
76748
- console.error(chalk35.red(`--viewport inválido: ${opts.viewport}`));
77544
+ console.error(chalk37.red(`--viewport inválido: ${opts.viewport}`));
76749
77545
  return 2;
76750
77546
  }
76751
77547
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
@@ -76754,12 +77550,12 @@ async function statesCommand(opts) {
76754
77550
  const prodSelector = opts.prodSelector?.trim() || opts.selector?.trim();
76755
77551
  const candSelector = opts.candSelector?.trim() || opts.selector?.trim();
76756
77552
  if (!prodSelector || !candSelector) {
76757
- 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"));
76758
77554
  return 2;
76759
77555
  }
76760
77556
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
76761
77557
  if (aliasNote)
76762
- console.log(chalk35.dim(` ${aliasNote}`));
77558
+ console.log(chalk37.dim(` ${aliasNote}`));
76763
77559
  const browser = await launchBrowser({ headless: true });
76764
77560
  try {
76765
77561
  const [prodSide, candSide] = await Promise.all([
@@ -76782,7 +77578,7 @@ async function statesCommand(opts) {
76782
77578
  ]);
76783
77579
  if (prodSide.baseError || candSide.baseError) {
76784
77580
  const which = prodSide.baseError ? `prod: ${prodSide.baseError}` : `cand: ${candSide.baseError}`;
76785
- 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}`));
76786
77582
  return 2;
76787
77583
  }
76788
77584
  const motion = prodSide.motion.found && candSide.motion.found ? diffMotion(prodSide.motion, candSide.motion, {
@@ -76819,58 +77615,58 @@ async function statesCommand(opts) {
76819
77615
  ]) {
76820
77616
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
76821
77617
  if (caveat)
76822
- console.log(chalk35.yellow(` ${caveat}`));
77618
+ console.log(chalk37.yellow(` ${caveat}`));
76823
77619
  }
76824
77620
  console.log("");
76825
- console.log(chalk35.bold(" Declared motion"));
77621
+ console.log(chalk37.bold(" Declared motion"));
76826
77622
  if (!motion) {
76827
77623
  const err = prodSide.motion.found ? candSide.motion : prodSide.motion;
76828
- console.log(chalk35.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
77624
+ console.log(chalk37.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
76829
77625
  } else {
76830
77626
  for (const line of formatMotionDiff(motion).split(`
76831
77627
  `))
76832
77628
  console.log(` ${line}`);
76833
77629
  }
76834
77630
  console.log("");
76835
- 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)`));
76836
77632
  const nothing = effects.lost.length === 0 && effects.changed.length === 0 && effects.added.length === 0 && effects.unpaired.length === 0;
76837
77633
  if (nothing && !exercised) {
76838
- console.log(chalk35.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
77634
+ console.log(chalk37.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
76839
77635
  } else if (nothing) {
76840
77636
  console.log(" clean — every hover that changes something in prod changes the same in cand");
76841
77637
  }
76842
77638
  for (const e of effects.lost) {
76843
- console.log(chalk35.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
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`));
76844
77640
  }
76845
77641
  for (const { prod, extra, notComparable, onElement } of effects.changed) {
76846
77642
  console.log(` DIFFERS ${prod.target}${prod.label ? ` (${prod.label})` : ""}`);
76847
77643
  if (onElement.length) {
76848
- 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`));
76849
77645
  }
76850
77646
  if (extra.length)
76851
77647
  console.log(` cand also moves [${extra.join(", ")}]`);
76852
77648
  if (notComparable.length) {
76853
- console.log(chalk35.dim(` not comparable: [${notComparable.join(", ")}] — prod's hover renumbered ${prod.renumberedNodes} of the changed paths, so these were read on elements that are not the same ones before and after. Bench the component, or pick a selector whose subtree the hover does not restructure.`));
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.`));
76854
77650
  }
76855
77651
  if (onElement.length === 0 && extra.length === 0) {
76856
- console.log(chalk35.dim(" nothing comparable differs."));
77652
+ console.log(chalk37.dim(" nothing comparable differs."));
76857
77653
  }
76858
77654
  }
76859
77655
  for (const e of effects.unpaired) {
76860
- console.log(chalk35.dim(` UNPAIRED ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; no matching element found on the cand side (not a defect — the port may have changed the element, or it is outside --selector)`));
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)`));
76861
77657
  }
76862
77658
  for (const e of effects.added) {
76863
77659
  console.log(` ADDED ${e.target} — cand moves [${e.properties.join(", ")}]; prod does not`);
76864
77660
  }
76865
77661
  if (effects.unpaired.length > 0 && effects.lost.length === 0 && effects.changed.length === 0) {
76866
77662
  console.log("");
76867
- console.log(chalk35.yellow(` ${effects.unpaired.length} prod effect(s) had no counterpart and NOTHING paired. That is a pairing failure, not a set of defects — check --selector contains the same component on both sides, and that ported roots carry data-section.`));
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.`));
76868
77664
  }
76869
77665
  if (prodSide.ambient > 0 || candSide.ambient > 0) {
76870
- console.log(chalk35.dim(` ${prodSide.ambient} prod / ${candSide.ambient} cand node+property pair(s) were moving with no interaction (carousel, autoplaying video, anything on a timer) and were subtracted. A large count means --selector contains something animating on its own; narrow it.`));
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.`));
76871
77667
  }
76872
77668
  if (prodSide.truncated || candSide.truncated) {
76873
- 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"));
76874
77670
  }
76875
77671
  return inconclusive || effects.lost.length > 0 || (motion?.findings.length ?? 0) > 0 ? 1 : 0;
76876
77672
  } finally {
@@ -76881,7 +77677,7 @@ async function statesCommand(opts) {
76881
77677
  }
76882
77678
 
76883
77679
  // src/commands/variance.ts
76884
- import chalk36 from "chalk";
77680
+ import chalk38 from "chalk";
76885
77681
 
76886
77682
  // src/diff/variance.ts
76887
77683
  var uniq2 = (xs) => [...new Set(xs)];
@@ -76985,7 +77781,7 @@ function formatVariance(report, opts = {}) {
76985
77781
  // src/commands/variance.ts
76986
77782
  function varianceCommand(opts) {
76987
77783
  if (opts.runIds.length < 2) {
76988
- 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> [...]"));
76989
77785
  return 2;
76990
77786
  }
76991
77787
  const budget = Number.parseFloat(opts.scoreBudget ?? "1");
@@ -76994,7 +77790,7 @@ function varianceCommand(opts) {
76994
77790
  try {
76995
77791
  runs.push(loadRun(opts.output, id));
76996
77792
  } catch (err) {
76997
- console.error(chalk36.red(` ✖ ${err.message}`));
77793
+ console.error(chalk38.red(` ✖ ${err.message}`));
76998
77794
  return 2;
76999
77795
  }
77000
77796
  }
@@ -77003,7 +77799,7 @@ function varianceCommand(opts) {
77003
77799
  console.log(JSON.stringify({ ...report, stable: isStable(report, budget), scoreBudget: budget }));
77004
77800
  } else {
77005
77801
  console.log("");
77006
- console.log(chalk36.bold(" Score variance"));
77802
+ console.log(chalk38.bold(" Score variance"));
77007
77803
  for (const line of formatVariance(report, { scoreBudget: budget }).split(`
77008
77804
  `)) {
77009
77805
  console.log(` ${line}`);
@@ -77015,10 +77811,10 @@ function varianceCommand(opts) {
77015
77811
  }
77016
77812
 
77017
77813
  // src/commands/vitals.ts
77018
- 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";
77019
77815
  import { availableParallelism } from "node:os";
77020
77816
  import { join as join46 } from "node:path";
77021
- import chalk37 from "chalk";
77817
+ import chalk39 from "chalk";
77022
77818
  import ora9 from "ora";
77023
77819
 
77024
77820
  // src/checks/agentic-nav.ts
@@ -77316,10 +78112,10 @@ async function vitalsCommand(opts) {
77316
78112
  const runId = newRunId();
77317
78113
  const paths = createRunDir(opts.output, runId);
77318
78114
  const t0 = Date.now();
77319
- console.log(chalk37.bold(`
78115
+ console.log(chalk39.bold(`
77320
78116
  parity vitals ${runId}`));
77321
- console.log(chalk37.dim(` prod: ${opts.prod}`));
77322
- console.log(chalk37.dim(` cand: ${opts.cand}`));
78117
+ console.log(chalk39.dim(` prod: ${opts.prod}`));
78118
+ console.log(chalk39.dim(` cand: ${opts.cand}`));
77323
78119
  const discoverSpinner = ora9("Descobrindo páginas…").start();
77324
78120
  const pagePaths = await discoverPagePaths2(opts.prod, opts);
77325
78121
  if (pagePaths.length === 0) {
@@ -77351,7 +78147,7 @@ async function vitalsCommand(opts) {
77351
78147
  completed++;
77352
78148
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
77353
78149
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
77354
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
78150
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk39.cyan("prod") : chalk39.magenta("cand")} ${task.path} (${task.viewport})`;
77355
78151
  }
77356
78152
  });
77357
78153
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
@@ -77380,7 +78176,7 @@ async function vitalsCommand(opts) {
77380
78176
  }
77381
78177
  lhCompleted++;
77382
78178
  const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
77383
- lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
78179
+ lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk39.cyan("prod") : chalk39.magenta("cand")} ${task.path} (${task.viewport})`;
77384
78180
  });
77385
78181
  lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
77386
78182
  }
@@ -77456,10 +78252,10 @@ async function vitalsCommand(opts) {
77456
78252
  opportunities: aggregateOpportunities(checkCtx.candPages)
77457
78253
  }, null, 2)}
77458
78254
  `, "utf8");
77459
- printSummary8(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
78255
+ printSummary9(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
77460
78256
  console.log("");
77461
- console.log(chalk37.dim(` → ${paths.reportHtml}`));
77462
- 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`));
77463
78259
  console.log("");
77464
78260
  if (opts.open) {
77465
78261
  const { default: open } = await import("open");
@@ -77549,15 +78345,15 @@ async function discoverPagePaths2(prodUrl, opts) {
77549
78345
  function parseUrlList(input) {
77550
78346
  if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
77551
78347
  const path = input.replace(/^file:\/\//, "");
77552
- if (existsSync33(path)) {
77553
- return readFileSync41(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
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}`);
77554
78350
  }
77555
78351
  }
77556
78352
  return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
77557
78353
  }
77558
- function printSummary8(vitals, cache, scores, opportunities, agentic) {
78354
+ function printSummary9(vitals, cache, scores, opportunities, agentic) {
77559
78355
  console.log("");
77560
- console.log(chalk37.bold(" Summary:"));
78356
+ console.log(chalk39.bold(" Summary:"));
77561
78357
  console.log(` ${vitals.summary}`);
77562
78358
  console.log(` ${cache.summary}`);
77563
78359
  if (scores.status !== "skipped")
@@ -77620,13 +78416,14 @@ program.command("list").description("List saved runs").option("--output <dir>",
77620
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) => {
77621
78417
  process.exit(listModulesCommand(Boolean(opts.json)));
77622
78418
  }));
77623
- program.command("plan").description("Inspect/update the migration-plan.json component contract").addCommand(new Command("set-status").description("Mark a component's outcome as the orchestrator works. `as-is` = divergence accepted (prod is still the reference); `upgrade` = the target is deliberately ahead, so prod is NOT the reference — pair it with `plan set-reference`.").argument("<name>", "Component name (case- and separator-insensitive)").argument("<status>", "pending | partial | done | as-is | upgrade | skipped").option("--create <scope>", "Create the row when the capture never found this component — `global` or `page`. A zero-height overlay header or a portal-rendered panel can be missed by detection, which leaves the plan unable to hold a decision about it. Recorded as origin `manual`, so it stays visible that somebody added it rather than the capture observing it.").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, status, opts) => {
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) => {
77624
78420
  if (opts.create && opts.create !== "global" && opts.create !== "page") {
77625
78421
  console.error("--create must be `global` or `page`");
77626
78422
  process.exit(2);
77627
78423
  }
77628
78424
  process.exit(planSetStatusCommand(opts.dir, name, status, {
77629
- create: opts.create
78425
+ create: opts.create,
78426
+ note: opts.note
77630
78427
  }));
77631
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) => {
77632
78429
  process.exit(planSetPageStatusCommand(opts.dir, path, status));
@@ -77742,6 +78539,9 @@ function buildCacheProbeCommand(name, deprecated) {
77742
78539
  }
77743
78540
  cacheTopCommand.addCommand(buildCacheProbeCommand("probe", false));
77744
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
+ });
77745
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) => {
77746
78546
  process.exit(await vitalsCommand(opts));
77747
78547
  });
@@ -77950,6 +78750,19 @@ program.command("states").description("Compare a component's INTERACTIVE states,
77950
78750
  json: opts.json
77951
78751
  }));
77952
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
+ });
77953
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) => {
77954
78767
  deprecatedNotice("fix", "section --all");
77955
78768
  if (opts.pt) {
@@ -77981,7 +78794,7 @@ program.command("extract").description("Single-site AI-ready component extractio
77981
78794
  }));
77982
78795
  });
77983
78796
  function buildCaptureCommand(name, deprecated) {
77984
- return new Command(name).description(`${deprecated ? "[deprecated: use `parity capture`] " : ""}Single-site, phased migration capture (theme → sitemap → components). No prod×cand comparison — produces a target-agnostic, token-lean bundle + prompt for a migration agent: site theme (colors/typography/spacing as Tailwind tokens), classified pages, and per-component detail (suggested Tailwind classes, interaction hints, e2e selectors). Works whether or not the source code exists. Pass --target faststore to append a target playbook. Resumable: re-runs skip a completed phase unless --refresh.`).requiredOption("--url <url>", "Site to capture from").option("--pages <list>", 'Comma-separated pages: literal paths/URLs, and/or "category-auto"/"pdp-auto". Default: "/,category-auto,pdp-auto" (home + a PLP + a PDP).').option("--components <list>", "Comma-separated role allowlist, e.g. header,footer,nav,shelf,minicart. Default: all detected.").option("--target <name>", "Target playbook to append to the prompt (e.g. faststore)").option("--viewport <viewport>", "Primary viewport for component capture: mobile | desktop | tablet", "mobile").option("--viewports <list>", "Comma-separated viewports for theme + site screenshots (e.g. mobile,desktop). Default: --viewport only.").option("--sample <spec>", "Extra pages to sample from the sitemap by kind, e.g. 'plp=2,pdp=2,other=3,search=1' (other = institutional). Default samples a few of each incl. institutional pages.").option("--format <fmt>", "md | json | both", "both").option("--source <dir>", "Path to the source repo. When set, the component inventory is read from CODE (exhaustive, exact names) and the VTEX-IO runtime scrape is gated on the source actually being VTEX IO. Without it, everything comes from the live capture (original behaviour).").option("--source-kind <kind>", "Override source auto-detection: deco-fresh | vtex-io | live-only. Only needed when detection fails.").option("--no-source-hunt", "Skip the on-disk search for a source repo when --source is omitted. Without --source the command sweeps sibling directories for one.").option("--out <dir>", "Output directory (stable per host, for resume)", "./parity-migrate").option("--refresh", "Re-run all phases even if cached artifacts exist", false).option("--open", "Open the generated index.html visual report in the browser", false).option("--no-llm", "Skip the optional LLM component-relabeling pass (heuristic detection always runs regardless).").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
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) => {
77985
78798
  if (deprecated)
77986
78799
  deprecatedNotice("migrate", "capture");
77987
78800
  process.exit(await migrateCommand({
@@ -77994,6 +78807,7 @@ function buildCaptureCommand(name, deprecated) {
77994
78807
  noSourceHunt: !opts.sourceHunt,
77995
78808
  viewport: opts.viewport,
77996
78809
  viewports: opts.viewports,
78810
+ componentViewports: opts.componentViewports,
77997
78811
  sample: opts.sample,
77998
78812
  format: opts.format,
77999
78813
  outDir: opts.out,