@decocms/parity 0.33.54 → 0.33.55

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 +967 -837
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -39153,6 +39153,7 @@ async function newContext(browser, opts) {
39153
39153
  ...baseContext,
39154
39154
  ...opts.viewportSize ? { viewport: opts.viewportSize, screen: opts.viewportSize } : {},
39155
39155
  ...opts.deviceScaleFactor != null ? { deviceScaleFactor: opts.deviceScaleFactor } : {},
39156
+ ...opts.storageState ? { storageState: opts.storageState } : {},
39156
39157
  recordHar: opts.harPath ? { path: opts.harPath, mode: "full", content: "omit" } : undefined,
39157
39158
  bypassCSP: true,
39158
39159
  ignoreHTTPSErrors: true,
@@ -39175,6 +39176,23 @@ async function newContext(browser, opts) {
39175
39176
  } catch (e) {}
39176
39177
  `
39177
39178
  });
39179
+ if (opts.hideScrollbars) {
39180
+ await ctx.addInitScript({
39181
+ content: `
39182
+ (function () {
39183
+ var apply = function () {
39184
+ var style = document.createElement('style');
39185
+ style.textContent = 'html, body, * { scrollbar-width: none !important; } ::-webkit-scrollbar { display: none !important; }';
39186
+ document.documentElement.appendChild(style);
39187
+ };
39188
+ if (document.documentElement) return apply();
39189
+ new MutationObserver(function (_, o) {
39190
+ if (document.documentElement) { o.disconnect(); apply(); }
39191
+ }).observe(document, { childList: true });
39192
+ })();
39193
+ `
39194
+ });
39195
+ }
39178
39196
  await ctx.addInitScript({ content: CAROUSEL_STABILIZER_INIT_SCRIPT });
39179
39197
  if (opts.cohortCookieValue) {
39180
39198
  await ctx.addCookies([
@@ -39194,6 +39212,32 @@ async function stopTracing(ctx, path) {
39194
39212
  await ctx.tracing.stop({ path });
39195
39213
  }
39196
39214
 
39215
+ // src/engine/cookie-banner.ts
39216
+ var ACCEPT_SELECTORS = [
39217
+ "#onetrust-accept-btn-handler",
39218
+ 'button:has-text("Accept All Cookies")',
39219
+ 'button:has-text("Aceitar todos")',
39220
+ 'button:has-text("Aceitar tudo")',
39221
+ 'button[id*="accept" i][id*="cookie" i]'
39222
+ ];
39223
+ var LOOSE_ACCEPT_SELECTOR = 'button:has-text("Aceitar")';
39224
+ async function acceptCookieBanner(page, opts = {}) {
39225
+ const selectors = opts.loose ? [...ACCEPT_SELECTORS, LOOSE_ACCEPT_SELECTOR] : ACCEPT_SELECTORS;
39226
+ for (const sel of selectors) {
39227
+ const b = page.locator(sel).first();
39228
+ if (await b.isVisible({ timeout: 400 }).catch(() => false)) {
39229
+ await b.click({ timeout: 1500 }).catch(() => {
39230
+ return;
39231
+ });
39232
+ await page.waitForTimeout(300).catch(() => {
39233
+ return;
39234
+ });
39235
+ return true;
39236
+ }
39237
+ }
39238
+ return false;
39239
+ }
39240
+
39197
39241
  // src/engine/collect.ts
39198
39242
  var DEBUG_PARITY = process.env.DEBUG_PARITY === "1" || process.env.DEBUG_PARITY === "true";
39199
39243
  var DEBUG_START = Date.now();
@@ -39466,6 +39510,7 @@ async function settlePage(page, opts = {}) {
39466
39510
  fonts = true,
39467
39511
  layoutStable = true,
39468
39512
  stabilize = true,
39513
+ dismissCookies = false,
39469
39514
  scroll = true,
39470
39515
  scrollBudgetMs = 30000,
39471
39516
  skeletons = scroll
@@ -39477,6 +39522,10 @@ async function settlePage(page, opts = {}) {
39477
39522
  await reloadIfOptionalFonts(page, waitMs);
39478
39523
  if (layoutStable)
39479
39524
  out.settle = await waitForLayoutStable(page);
39525
+ if (dismissCookies)
39526
+ await acceptCookieBanner(page).catch(() => {
39527
+ return;
39528
+ });
39480
39529
  if (stabilize) {
39481
39530
  await Promise.race([
39482
39531
  stabilizeCarousels(page).catch(() => {
@@ -39501,6 +39550,14 @@ async function settlePage(page, opts = {}) {
39501
39550
  new Promise((r) => setTimeout(r, 5000))
39502
39551
  ]);
39503
39552
  }
39553
+ if (stabilize && (scroll || skeletons)) {
39554
+ await Promise.race([
39555
+ stabilizeCarousels(page).catch(() => {
39556
+ return;
39557
+ }),
39558
+ new Promise((r) => setTimeout(r, 3000))
39559
+ ]);
39560
+ }
39504
39561
  return out;
39505
39562
  }
39506
39563
  async function waitForSkeletonsToResolve(page, maxMs = 1e4) {
@@ -46621,14 +46678,6 @@ async function navigateWithHover(page, targetUrl, productImage = false) {
46621
46678
  const navMs = Date.now() - t;
46622
46679
  return { ok, navMs };
46623
46680
  }
46624
- var COOKIE_ACCEPT_SELECTORS = [
46625
- "#onetrust-accept-btn-handler",
46626
- 'button:has-text("Accept All Cookies")',
46627
- 'button:has-text("Aceitar todos")',
46628
- 'button:has-text("Aceitar tudo")',
46629
- 'button:has-text("Aceitar")',
46630
- 'button[id*="accept" i][id*="cookie" i]'
46631
- ];
46632
46681
  var HAMBURGER_SELECTORS = [
46633
46682
  'button[aria-label*="menu" i]',
46634
46683
  '[aria-label*="abrir menu" i]',
@@ -46646,16 +46695,7 @@ async function dismissAll(page, ctx) {
46646
46695
  await dismissOverlays(page, ctx).catch(() => {
46647
46696
  return;
46648
46697
  });
46649
- for (const sel of COOKIE_ACCEPT_SELECTORS) {
46650
- const b = page.locator(sel).first();
46651
- if (await b.isVisible({ timeout: 400 }).catch(() => false)) {
46652
- await b.click({ timeout: 1500 }).catch(() => {
46653
- return;
46654
- });
46655
- await page.waitForTimeout(300);
46656
- break;
46657
- }
46658
- }
46698
+ await acceptCookieBanner(page, { loose: true });
46659
46699
  }
46660
46700
  async function scrollToTop(page) {
46661
46701
  await page.evaluate(() => window.scrollTo({ top: 0 })).catch(() => {
@@ -58249,48 +58289,126 @@ function printResult(result, meta) {
58249
58289
  }
58250
58290
  }
58251
58291
 
58252
- // src/commands/compare.ts
58292
+ // src/commands/css-modules.ts
58293
+ import { readFileSync as readFileSync15, readdirSync as readdirSync3 } from "node:fs";
58294
+ import { basename as basename2, dirname as dirname4, join as join17, resolve as resolve3 } from "node:path";
58253
58295
  import chalk9 from "chalk";
58296
+ var SKIP_DIRS = new Set(["node_modules", ".git", ".next", ".faststore", "dist", "build"]);
58297
+ var MODULE_RE = /\.module\.(scss|sass|css)$/;
58298
+ var COMPONENT_RE = /\.(tsx|jsx|ts|js)$/;
58299
+ function walk(dir, out = []) {
58300
+ for (const e of readdirSync3(dir, { withFileTypes: true })) {
58301
+ if (e.isDirectory()) {
58302
+ if (!SKIP_DIRS.has(e.name))
58303
+ walk(join17(dir, e.name), out);
58304
+ } else
58305
+ out.push(join17(dir, e.name));
58306
+ }
58307
+ return out;
58308
+ }
58309
+ function declaredClasses(css) {
58310
+ const clean = css.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\/\/.*$/gm, "").replace(/url\([^)]*\)/g, "");
58311
+ return new Set([...clean.matchAll(/\.([a-zA-Z_][\w-]*)/g)].map((m) => m[1]));
58312
+ }
58313
+ function scanCssModules(root) {
58314
+ const files = walk(root);
58315
+ const components = files.filter((f) => COMPONENT_RE.test(f) && !MODULE_RE.test(f));
58316
+ const scan = { modules: 0, components: 0, findings: [] };
58317
+ const seen = new Set;
58318
+ for (const mod of files.filter((f) => MODULE_RE.test(f))) {
58319
+ scan.modules++;
58320
+ const classes = declaredClasses(readFileSync15(mod, "utf8"));
58321
+ const modName = basename2(mod);
58322
+ for (const file of components.filter((c) => dirname4(c) === dirname4(mod))) {
58323
+ const src = readFileSync15(file, "utf8");
58324
+ const imp = src.match(new RegExp(`import\\s+(\\w+)\\s+from\\s+["'][^"']*${modName.replace(/\./g, "\\.")}["']`));
58325
+ if (!imp)
58326
+ continue;
58327
+ if (!seen.has(file))
58328
+ scan.components++;
58329
+ seen.add(file);
58330
+ for (const lit of src.matchAll(/(["'])([^"'\n]+)\1/g)) {
58331
+ const at = lit.index ?? 0;
58332
+ const before = src.slice(0, at);
58333
+ if (before.endsWith(`${imp[1]}[`))
58334
+ continue;
58335
+ if (/\(\s*$/.test(before))
58336
+ continue;
58337
+ for (const token of lit[2].split(/\s+/)) {
58338
+ if (!classes.has(token))
58339
+ continue;
58340
+ scan.findings.push({
58341
+ file,
58342
+ line: before.split(`
58343
+ `).length,
58344
+ className: token,
58345
+ module: modName
58346
+ });
58347
+ }
58348
+ }
58349
+ }
58350
+ }
58351
+ return scan;
58352
+ }
58353
+ function cssModulesCommand(opts) {
58354
+ const scan = scanCssModules(resolve3(opts.dir));
58355
+ if (opts.json)
58356
+ console.log(JSON.stringify(scan));
58357
+ else {
58358
+ for (const f of scan.findings)
58359
+ console.log(`${chalk9.red("✗")} ${f.file}:${f.line} "${f.className}" is declared in ${f.module} — use styles["${f.className}"]`);
58360
+ console.log(chalk9.dim(`${scan.modules} modules, ${scan.components} components, ${scan.findings.length} dead literals`));
58361
+ }
58362
+ if (scan.components === 0) {
58363
+ if (!opts.json)
58364
+ console.error(chalk9.yellow("nothing scanned — no component imports a CSS module here"));
58365
+ return 2;
58366
+ }
58367
+ return scan.findings.length > 0 ? 1 : 0;
58368
+ }
58369
+
58370
+ // src/commands/compare.ts
58371
+ import chalk10 from "chalk";
58254
58372
  function compareCommand(runId, baselineName, output) {
58255
58373
  try {
58256
58374
  const run = loadRun(output, runId);
58257
58375
  const baseline = loadBaseline(baselineName);
58258
58376
  const delta = compareToBaseline(run, baseline);
58259
- console.log(chalk9.bold(`
58377
+ console.log(chalk10.bold(`
58260
58378
  Delta ${runId} vs baseline "${baselineName}"`));
58261
- console.log(` ${chalk9.green("✓ resolved")}: ${delta.resolved.length}`);
58262
- console.log(` ${chalk9.yellow("+ new")}: ${delta.new.length}`);
58263
- console.log(` ${chalk9.red("⚠ regressed")}: ${delta.regressions.length}`);
58379
+ console.log(` ${chalk10.green("✓ resolved")}: ${delta.resolved.length}`);
58380
+ console.log(` ${chalk10.yellow("+ new")}: ${delta.new.length}`);
58381
+ console.log(` ${chalk10.red("⚠ regressed")}: ${delta.regressions.length}`);
58264
58382
  if (delta.new.length > 0) {
58265
- console.log(chalk9.bold(`
58383
+ console.log(chalk10.bold(`
58266
58384
  Novos issue ids:`));
58267
58385
  for (const id of delta.new)
58268
58386
  console.log(` - ${id}`);
58269
58387
  }
58270
58388
  if (delta.regressions.length > 0) {
58271
- console.log(chalk9.bold(`
58389
+ console.log(chalk10.bold(`
58272
58390
  Regressões (severity piorou):`));
58273
58391
  for (const id of delta.regressions)
58274
58392
  console.log(` - ${id}`);
58275
58393
  }
58276
58394
  return 0;
58277
58395
  } catch (err) {
58278
- console.error(chalk9.red(`✖ ${err.message}`));
58396
+ console.error(chalk10.red(`✖ ${err.message}`));
58279
58397
  return 1;
58280
58398
  }
58281
58399
  }
58282
58400
 
58283
58401
  // src/commands/console.ts
58284
- import chalk10 from "chalk";
58402
+ import chalk11 from "chalk";
58285
58403
  async function consoleCommand(opts) {
58286
58404
  const viewport = parseViewport2(opts.viewport);
58287
58405
  if (!viewport) {
58288
- console.error(chalk10.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
58406
+ console.error(chalk11.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
58289
58407
  return 2;
58290
58408
  }
58291
58409
  const waitMs = Number.parseInt(opts.wait, 10);
58292
58410
  if (!Number.isFinite(waitMs) || waitMs < 0) {
58293
- console.error(chalk10.red(`--wait inválido: ${opts.wait}`));
58411
+ console.error(chalk11.red(`--wait inválido: ${opts.wait}`));
58294
58412
  return 2;
58295
58413
  }
58296
58414
  const filter = parseFilter(opts.filter);
@@ -58298,7 +58416,7 @@ async function consoleCommand(opts) {
58298
58416
  try {
58299
58417
  url = new URL(opts.url);
58300
58418
  } catch {
58301
- console.error(chalk10.red(`--url inválido: ${opts.url}`));
58419
+ console.error(chalk11.red(`--url inválido: ${opts.url}`));
58302
58420
  return 2;
58303
58421
  }
58304
58422
  const browser = await launchBrowser({ headless: true });
@@ -58347,24 +58465,24 @@ function printResults(entries, meta) {
58347
58465
  return;
58348
58466
  }
58349
58467
  if (entries.length === 0) {
58350
- console.log(chalk10.dim(` ${meta.viewport} · ${meta.url}
58468
+ console.log(chalk11.dim(` ${meta.viewport} · ${meta.url}
58351
58469
  nenhuma entrada de console nos filtros pedidos`));
58352
58470
  return;
58353
58471
  }
58354
- console.log(chalk10.bold(`
58472
+ console.log(chalk11.bold(`
58355
58473
  ${meta.viewport} · ${meta.url}`));
58356
- console.log(chalk10.dim(` ${entries.length} entrada(s)
58474
+ console.log(chalk11.dim(` ${entries.length} entrada(s)
58357
58475
  `));
58358
58476
  for (const e of entries) {
58359
- const tag = e.type === "error" ? chalk10.red("[error ]") : e.type === "warning" ? chalk10.yellow("[warn ]") : chalk10.dim(`[${e.type.padEnd(7)}]`);
58360
- const loc = e.location ? chalk10.dim(` ← ${e.location}`) : "";
58477
+ const tag = e.type === "error" ? chalk11.red("[error ]") : e.type === "warning" ? chalk11.yellow("[warn ]") : chalk11.dim(`[${e.type.padEnd(7)}]`);
58478
+ const loc = e.location ? chalk11.dim(` ← ${e.location}`) : "";
58361
58479
  const text = e.text.length > 400 ? `${e.text.slice(0, 397)}...` : e.text;
58362
58480
  console.log(` ${tag} ${text}${loc}`);
58363
58481
  }
58364
58482
  }
58365
58483
 
58366
58484
  // src/commands/css-trace.ts
58367
- import chalk11 from "chalk";
58485
+ import chalk12 from "chalk";
58368
58486
  async function tracePage(page, url, selector, settleMs) {
58369
58487
  await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 });
58370
58488
  await page.waitForLoadState("load", { timeout: 12000 }).catch(() => {
@@ -58475,35 +58593,35 @@ function applyFilter(result, filter) {
58475
58593
  return { ...result, computed, rules };
58476
58594
  }
58477
58595
  function printResult2(result, header) {
58478
- console.log(chalk11.bold(`
58596
+ console.log(chalk12.bold(`
58479
58597
  ${header}`));
58480
- console.log(chalk11.dim(`URL: ${result.url}`));
58481
- console.log(chalk11.dim(`Selector: ${result.selector}`));
58598
+ console.log(chalk12.dim(`URL: ${result.url}`));
58599
+ console.log(chalk12.dim(`Selector: ${result.selector}`));
58482
58600
  if (!result.found) {
58483
- console.log(chalk11.red("✖ Element not found"));
58601
+ console.log(chalk12.red("✖ Element not found"));
58484
58602
  return;
58485
58603
  }
58486
58604
  const computedKeys = Object.keys(result.computed);
58487
58605
  if (computedKeys.length > 0) {
58488
- console.log(chalk11.bold(`
58606
+ console.log(chalk12.bold(`
58489
58607
  Computed:`));
58490
58608
  for (const k of computedKeys) {
58491
- console.log(` ${chalk11.cyan(k)}: ${result.computed[k]}`);
58609
+ console.log(` ${chalk12.cyan(k)}: ${result.computed[k]}`);
58492
58610
  }
58493
58611
  }
58494
58612
  if (result.rules.length === 0) {
58495
- console.log(chalk11.yellow(`
58613
+ console.log(chalk12.yellow(`
58496
58614
  No matching rules after filter.`));
58497
58615
  return;
58498
58616
  }
58499
- console.log(chalk11.bold(`
58617
+ console.log(chalk12.bold(`
58500
58618
  Rules (ordered by CDP — most specific last):`));
58501
58619
  for (const r of result.rules) {
58502
- const inheritLabel = r.inheritedFromDistance !== undefined ? chalk11.yellow(` ↑ inherited from ancestor (${r.inheritedFromDistance})`) : "";
58503
- console.log(` ${chalk11.magenta(r.source)}${inheritLabel}`);
58504
- console.log(` ${chalk11.green(r.selector)} {`);
58620
+ const inheritLabel = r.inheritedFromDistance !== undefined ? chalk12.yellow(` ↑ inherited from ancestor (${r.inheritedFromDistance})`) : "";
58621
+ console.log(` ${chalk12.magenta(r.source)}${inheritLabel}`);
58622
+ console.log(` ${chalk12.green(r.selector)} {`);
58505
58623
  for (const p of r.properties) {
58506
- const bang = p.important ? chalk11.red(" !important") : "";
58624
+ const bang = p.important ? chalk12.red(" !important") : "";
58507
58625
  console.log(` ${p.name}: ${p.value}${bang};`);
58508
58626
  }
58509
58627
  console.log(" }");
@@ -58524,38 +58642,38 @@ function printComparison(prod, cand) {
58524
58642
  printResult2(prod, "── PROD ──────────────────────────────────────────────");
58525
58643
  printResult2(cand, "── CAND ──────────────────────────────────────────────");
58526
58644
  const diffs = diffComputed(prod, cand);
58527
- console.log(chalk11.bold(`
58645
+ console.log(chalk12.bold(`
58528
58646
  ── DIFF (computed) ───────────────────────────────────`));
58529
58647
  if (diffs.length === 0) {
58530
- console.log(chalk11.green(" No computed-style differences in the filtered set."));
58648
+ console.log(chalk12.green(" No computed-style differences in the filtered set."));
58531
58649
  return;
58532
58650
  }
58533
58651
  for (const d of diffs) {
58534
- console.log(` ${chalk11.cyan(d.property)}`);
58535
- console.log(` prod: ${chalk11.green(d.prod ?? "(unset)")}`);
58536
- console.log(` cand: ${chalk11.red(d.cand ?? "(unset)")}`);
58652
+ console.log(` ${chalk12.cyan(d.property)}`);
58653
+ console.log(` prod: ${chalk12.green(d.prod ?? "(unset)")}`);
58654
+ console.log(` cand: ${chalk12.red(d.cand ?? "(unset)")}`);
58537
58655
  }
58538
58656
  }
58539
58657
  async function cssTraceCommand(opts) {
58540
58658
  const viewport = opts.viewport ?? "desktop";
58541
58659
  const settleMs = opts.settleMs ?? 1500;
58542
58660
  if (!opts.selector) {
58543
- console.error(chalk11.red("--selector is required"));
58661
+ console.error(chalk12.red("--selector is required"));
58544
58662
  return 1;
58545
58663
  }
58546
58664
  const hasUrl = !!opts.url;
58547
58665
  const hasProd = !!opts.prod;
58548
58666
  const hasCand = !!opts.cand;
58549
58667
  if (hasUrl && (hasProd || hasCand)) {
58550
- console.error(chalk11.red("--url is mutually exclusive with --prod / --cand. Pass one mode only."));
58668
+ console.error(chalk12.red("--url is mutually exclusive with --prod / --cand. Pass one mode only."));
58551
58669
  return 1;
58552
58670
  }
58553
58671
  if (hasProd && !hasCand || !hasProd && hasCand) {
58554
- console.error(chalk11.red("Comparison mode needs both --prod and --cand (got only one)."));
58672
+ console.error(chalk12.red("Comparison mode needs both --prod and --cand (got only one)."));
58555
58673
  return 1;
58556
58674
  }
58557
58675
  if (!hasUrl && !hasProd && !hasCand) {
58558
- console.error(chalk11.red("Provide either --url or both --prod and --cand."));
58676
+ console.error(chalk12.red("Provide either --url or both --prod and --cand."));
58559
58677
  return 1;
58560
58678
  }
58561
58679
  const isCompare = hasProd && hasCand;
@@ -58606,7 +58724,7 @@ async function cssTraceCommand(opts) {
58606
58724
  }
58607
58725
  return 0;
58608
58726
  } catch (err) {
58609
- console.error(chalk11.red(`Error: ${err.message}`));
58727
+ console.error(chalk12.red(`Error: ${err.message}`));
58610
58728
  return 1;
58611
58729
  } finally {
58612
58730
  await browser?.close().catch(() => {
@@ -58618,7 +58736,7 @@ async function cssTraceCommand(opts) {
58618
58736
  // src/commands/e2e.ts
58619
58737
  import { writeFileSync as writeFileSync14 } from "node:fs";
58620
58738
  import { spawn as spawn2 } from "node:child_process";
58621
- import chalk12 from "chalk";
58739
+ import chalk13 from "chalk";
58622
58740
  import ora6 from "ora";
58623
58741
 
58624
58742
  // src/engine/flows/cart-interactions.ts
@@ -59568,8 +59686,8 @@ async function flowLogin(ctx) {
59568
59686
 
59569
59687
  // src/llm/resolve-search-terms.ts
59570
59688
  init_client();
59571
- import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync15, writeFileSync as writeFileSync13 } from "node:fs";
59572
- import { join as join17 } from "node:path";
59689
+ import { existsSync as existsSync12, mkdirSync as mkdirSync9, readFileSync as readFileSync16, writeFileSync as writeFileSync13 } from "node:fs";
59690
+ import { join as join18 } from "node:path";
59573
59691
  var CACHE_DIR2 = ".parity-cache";
59574
59692
  var FALLBACK_TERMS = ["produto", "preto", "promocao"];
59575
59693
  function makeNoResults(runId) {
@@ -59649,10 +59767,10 @@ async function resolveSearchTerms(url, html, opts = {}) {
59649
59767
  }
59650
59768
  const host = safeHost3(url);
59651
59769
  const cacheDir = opts.cacheDir ?? CACHE_DIR2;
59652
- const cachePath = join17(cacheDir, `search-terms-${host}.json`);
59770
+ const cachePath = join18(cacheDir, `search-terms-${host}.json`);
59653
59771
  if (!opts.noCache && existsSync12(cachePath)) {
59654
59772
  try {
59655
- const cached = JSON.parse(readFileSync15(cachePath, "utf8"));
59773
+ const cached = JSON.parse(readFileSync16(cachePath, "utf8"));
59656
59774
  if (cached.withResults?.trim()) {
59657
59775
  return { withResults: cached.withResults.trim(), noResults };
59658
59776
  }
@@ -60687,19 +60805,19 @@ function formatWatchdogMessage(timeoutMs, graceMs) {
60687
60805
  async function e2eCommand(opts) {
60688
60806
  const viewports = parseViewports(opts.viewports);
60689
60807
  if (viewports.length === 0) {
60690
- console.error(chalk12.red(`--viewports inválido: ${opts.viewports} (use mobile,desktop,tablet)`));
60808
+ console.error(chalk13.red(`--viewports inválido: ${opts.viewports} (use mobile,desktop,tablet)`));
60691
60809
  return 2;
60692
60810
  }
60693
60811
  let baseUrl;
60694
60812
  try {
60695
60813
  baseUrl = new URL(opts.url);
60696
60814
  } catch {
60697
- console.error(chalk12.red(`--url inválido: ${opts.url}`));
60815
+ console.error(chalk13.red(`--url inválido: ${opts.url}`));
60698
60816
  return 2;
60699
60817
  }
60700
60818
  const flows = parseFlows(opts.flows);
60701
60819
  if (flows.length === 0) {
60702
- console.error(chalk12.red(`--flows inválido: ${opts.flows}`));
60820
+ console.error(chalk13.red(`--flows inválido: ${opts.flows}`));
60703
60821
  return 2;
60704
60822
  }
60705
60823
  const rc = loadParityRc();
@@ -60730,12 +60848,12 @@ async function e2eCommand(opts) {
60730
60848
  const paths = createRunDir(opts.output, runId);
60731
60849
  const startedAt = Date.now();
60732
60850
  if (!opts.json) {
60733
- console.log(chalk12.bold(`
60851
+ console.log(chalk13.bold(`
60734
60852
  parity e2e ${runId}`));
60735
- console.log(chalk12.dim(` url: ${opts.url}`));
60736
- console.log(chalk12.dim(` flows: ${flows.join(", ")}`));
60737
- console.log(chalk12.dim(` viewports: ${viewports.join(", ")}`));
60738
- console.log(chalk12.dim(` cep: ${rc.cep}
60853
+ console.log(chalk13.dim(` url: ${opts.url}`));
60854
+ console.log(chalk13.dim(` flows: ${flows.join(", ")}`));
60855
+ console.log(chalk13.dim(` viewports: ${viewports.join(", ")}`));
60856
+ console.log(chalk13.dim(` cep: ${rc.cep}
60739
60857
  `));
60740
60858
  }
60741
60859
  let platform = "custom";
@@ -60743,7 +60861,7 @@ async function e2eCommand(opts) {
60743
60861
  if (homeHtml) {
60744
60862
  platform = detectPlatform({ url: opts.url, html: homeHtml });
60745
60863
  if (platform !== "custom" && !opts.json) {
60746
- console.log(chalk12.dim(` Detected platform: ${platform}`));
60864
+ console.log(chalk13.dim(` Detected platform: ${platform}`));
60747
60865
  }
60748
60866
  }
60749
60867
  const wantsAutoSelectors = opts.autoSelectors !== false && isLlmAvailable();
@@ -60783,7 +60901,7 @@ async function e2eCommand(opts) {
60783
60901
  watchdogTimedOut = true;
60784
60902
  if (spinner)
60785
60903
  spinner.stop();
60786
- console.error(chalk12.red(`
60904
+ console.error(chalk13.red(`
60787
60905
  ${formatWatchdogMessage(E2E_TIMEOUT_MS, WATCHDOG_GRACE_MS)}`));
60788
60906
  };
60789
60907
  process.once("SIGUSR2", onWatchdogFired);
@@ -60851,14 +60969,14 @@ async function e2eCommand(opts) {
60851
60969
  });
60852
60970
  }
60853
60971
  if (watchdogTimedOut && !opts.json) {
60854
- console.log(chalk12.yellow(`
60972
+ console.log(chalk13.yellow(`
60855
60973
  ⚠ relatório parcial — o watchdog encerrou o run antes de todos os fluxos/viewports terminarem.`));
60856
60974
  }
60857
60975
  if (opts.learn !== false && JSON.stringify(learned) !== learnedBefore) {
60858
60976
  saveLearned(learned);
60859
60977
  }
60860
60978
  if (allPages.length === 0) {
60861
- console.error(chalk12.red(`
60979
+ console.error(chalk13.red(`
60862
60980
  ✖ nenhuma captura completada`));
60863
60981
  return 2;
60864
60982
  }
@@ -60981,17 +61099,17 @@ function parseFlows(raw) {
60981
61099
  }
60982
61100
  function printSummary5(result, reportPath) {
60983
61101
  const { totals } = result;
60984
- const verdict = totals.critical > 0 ? chalk12.red.bold("✖ FAIL") : totals.high > 0 ? chalk12.red("✖ FAIL") : totals.issues > 0 ? chalk12.yellow("⚠ WARN") : chalk12.green.bold("✓ PASS");
61102
+ const verdict = totals.critical > 0 ? chalk13.red.bold("✖ FAIL") : totals.high > 0 ? chalk13.red("✖ FAIL") : totals.issues > 0 ? chalk13.yellow("⚠ WARN") : chalk13.green.bold("✓ PASS");
60985
61103
  console.log(`
60986
61104
  ${verdict}`);
60987
61105
  console.log(` ${totals.pages} página(s) · ${totals.issues} issue(s)`);
60988
- console.log(` ${chalk12.red(`${totals.critical} critical`)} · ${chalk12.red(`${totals.high} high`)} · ${chalk12.yellow(`${totals.medium} medium`)} · ${chalk12.dim(`${totals.low} low`)}`);
61106
+ console.log(` ${chalk13.red(`${totals.critical} critical`)} · ${chalk13.red(`${totals.high} high`)} · ${chalk13.yellow(`${totals.medium} medium`)} · ${chalk13.dim(`${totals.low} low`)}`);
60989
61107
  const top = result.allIssues.slice(0, 5);
60990
61108
  if (top.length > 0) {
60991
61109
  console.log(`
60992
61110
  Top issues:`);
60993
61111
  for (const issue of top) {
60994
- const sevTag = issue.severity === "critical" ? chalk12.red.bold("[critical]") : issue.severity === "high" ? chalk12.red("[high] ") : issue.severity === "medium" ? chalk12.yellow("[medium] ") : chalk12.dim("[low] ");
61112
+ const sevTag = issue.severity === "critical" ? chalk13.red.bold("[critical]") : issue.severity === "high" ? chalk13.red("[high] ") : issue.severity === "medium" ? chalk13.yellow("[medium] ") : chalk13.dim("[low] ");
60995
61113
  console.log(` ${sevTag} ${issue.summary.slice(0, 200)}`);
60996
61114
  }
60997
61115
  }
@@ -61007,7 +61125,7 @@ async function openReport2(path) {
61007
61125
 
61008
61126
  // src/commands/explain.ts
61009
61127
  init_client();
61010
- import chalk13 from "chalk";
61128
+ import chalk14 from "chalk";
61011
61129
 
61012
61130
  // src/llm/system-prompt.ts
61013
61131
  var ISSUE_AGGREGATOR_SYSTEM_PROMPT = `
@@ -61092,17 +61210,17 @@ Cada issue tem:
61092
61210
  // src/commands/explain.ts
61093
61211
  async function explainCommand(runId, issueId, output) {
61094
61212
  if (!isLlmAvailable()) {
61095
- console.error(chalk13.red("Nenhuma API key de LLM encontrada — set ANTHROPIC_API_KEY ou OPENROUTER_API_KEY."));
61213
+ console.error(chalk14.red("Nenhuma API key de LLM encontrada — set ANTHROPIC_API_KEY ou OPENROUTER_API_KEY."));
61096
61214
  return 1;
61097
61215
  }
61098
61216
  const run = loadRun(output, runId);
61099
61217
  const issue = run.issues.find((i) => i.id === issueId) || run.topIssues.find((i) => i.id === issueId);
61100
61218
  if (!issue) {
61101
- console.error(chalk13.red(`Issue não encontrada: ${issueId}`));
61219
+ console.error(chalk14.red(`Issue não encontrada: ${issueId}`));
61102
61220
  return 1;
61103
61221
  }
61104
61222
  const checks = run.checks.filter((c) => c.issues.some((i) => i.id === issueId || i.check === issue.check));
61105
- console.log(chalk13.dim(`Consultando LLM…
61223
+ console.log(chalk14.dim(`Consultando LLM…
61106
61224
  `));
61107
61225
  const text = await callMessage({
61108
61226
  feature: "explain",
@@ -61123,12 +61241,12 @@ ${JSON.stringify(checks.map((c) => ({ name: c.name, status: c.status, summary: c
61123
61241
 
61124
61242
  // src/commands/extract.ts
61125
61243
  import { mkdirSync as mkdirSync13 } from "node:fs";
61126
- import { resolve as resolve4 } from "node:path";
61127
- import chalk15 from "chalk";
61244
+ import { resolve as resolve5 } from "node:path";
61245
+ import chalk16 from "chalk";
61128
61246
 
61129
61247
  // src/llm/section-understanding.ts
61130
61248
  init_client();
61131
- import { readFileSync as readFileSync16 } from "node:fs";
61249
+ import { readFileSync as readFileSync17 } from "node:fs";
61132
61250
  var SUMMARIZE_TOOL = {
61133
61251
  name: "summarize_understanding",
61134
61252
  description: "Return a single paragraph describing what you understood from the section diff signals. NO code — only diagnosis.",
@@ -61166,7 +61284,7 @@ async function invokeUnderstandingSummary(input) {
61166
61284
  return null;
61167
61285
  let markdown;
61168
61286
  try {
61169
- markdown = readFileSync16(input.markdownPath, "utf8");
61287
+ markdown = readFileSync17(input.markdownPath, "utf8");
61170
61288
  } catch (err) {
61171
61289
  console.error(`[section-understanding] failed to read markdown: ${err.message}`);
61172
61290
  return null;
@@ -61176,7 +61294,7 @@ async function invokeUnderstandingSummary(input) {
61176
61294
  if (!p)
61177
61295
  continue;
61178
61296
  try {
61179
- const buf = readFileSync16(p);
61297
+ const buf = readFileSync17(p);
61180
61298
  images.push({ base64: buf.toString("base64"), mediaType: "image/png" });
61181
61299
  } catch (err) {
61182
61300
  console.error(`[section-understanding] skipping image ${p}: ${err.message}`);
@@ -61455,11 +61573,11 @@ function collectCandidatesInPage() {
61455
61573
 
61456
61574
  // src/extract/exporters/json.ts
61457
61575
  import { writeFileSync as writeFileSync15 } from "node:fs";
61458
- import { join as join18 } from "node:path";
61576
+ import { join as join19 } from "node:path";
61459
61577
  var jsonExporter = {
61460
61578
  name: "json",
61461
61579
  async export(bundle, outDir) {
61462
- const path = join18(outDir, "manifest.json");
61580
+ const path = join19(outDir, "manifest.json");
61463
61581
  writeFileSync15(path, `${JSON.stringify(bundle, null, 2)}
61464
61582
  `, "utf8");
61465
61583
  }
@@ -61467,7 +61585,7 @@ var jsonExporter = {
61467
61585
 
61468
61586
  // src/extract/exporters/markdown.ts
61469
61587
  import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync16 } from "node:fs";
61470
- import { join as join19 } from "node:path";
61588
+ import { join as join20 } from "node:path";
61471
61589
 
61472
61590
  // src/extract/naming.ts
61473
61591
  function componentDirName(role, index) {
@@ -61481,13 +61599,13 @@ var markdownExporter = {
61481
61599
  async export(bundle, outDir) {
61482
61600
  const dirNames = bundle.components.map((c, i) => componentDirName(c.role, i + 1));
61483
61601
  const indexMd = renderIndex(bundle, dirNames);
61484
- writeFileSync16(join19(outDir, "index.md"), indexMd, "utf8");
61602
+ writeFileSync16(join20(outDir, "index.md"), indexMd, "utf8");
61485
61603
  bundle.components.forEach((component, i) => {
61486
61604
  const dirName = dirNames[i];
61487
- const componentDir = join19(outDir, "components", dirName);
61605
+ const componentDir = join20(outDir, "components", dirName);
61488
61606
  mkdirSync10(componentDir, { recursive: true });
61489
61607
  const readme = renderComponentReadme(bundle, component);
61490
- writeFileSync16(join19(componentDir, "README.md"), readme, "utf8");
61608
+ writeFileSync16(join20(componentDir, "README.md"), readme, "utf8");
61491
61609
  });
61492
61610
  }
61493
61611
  };
@@ -62286,18 +62404,18 @@ function compactComponentHtml(html, maxChars = COMPONENT_HTML_MAX_CHARS) {
62286
62404
 
62287
62405
  // src/commands/section.ts
62288
62406
  import { mkdirSync as mkdirSync12 } from "node:fs";
62289
- import { resolve as resolve3 } from "node:path";
62290
- import chalk14 from "chalk";
62407
+ import { resolve as resolve4 } from "node:path";
62408
+ import chalk15 from "chalk";
62291
62409
  import * as diff from "diff";
62292
62410
  import prettier from "prettier";
62293
62411
 
62294
62412
  // src/diff/heatmap-regions.ts
62295
- import { readFileSync as readFileSync17 } from "node:fs";
62413
+ import { readFileSync as readFileSync18 } from "node:fs";
62296
62414
  import { PNG as PNG4 } from "pngjs";
62297
62415
  var DEFAULT_MAX_HOTSPOTS = 5;
62298
62416
  var DEFAULT_MIN_COMPONENT_PIXELS = 50;
62299
62417
  function analyzeHeatmapRegions(pngPath, opts = {}) {
62300
- const png = PNG4.sync.read(readFileSync17(pngPath));
62418
+ const png = PNG4.sync.read(readFileSync18(pngPath));
62301
62419
  return analyzeHeatmapBuffer(png.data, png.width, png.height, opts);
62302
62420
  }
62303
62421
  function analyzeHeatmapBuffer(data, width, height, opts = {}) {
@@ -62411,7 +62529,7 @@ function analyzeHeatmapBuffer(data, width, height, opts = {}) {
62411
62529
 
62412
62530
  // src/diff/section-bundle.ts
62413
62531
  import { writeFileSync as writeFileSync18 } from "node:fs";
62414
- import { basename as basename2, dirname as dirname4, join as join20, relative as relative3 } from "node:path";
62532
+ import { basename as basename3, dirname as dirname5, join as join21, relative as relative3 } from "node:path";
62415
62533
  function buildStyleDeltas(input) {
62416
62534
  const cs = input.computedStyles;
62417
62535
  if (!cs)
@@ -62455,11 +62573,11 @@ function assembleSectionDiffBundle(input) {
62455
62573
  boundingRects: styleResultsToRects(input.computedStyles),
62456
62574
  styleDeltas
62457
62575
  };
62458
- const jsonPath = join20(input.outDir, `${input.filePrefix}-bundle.json`);
62576
+ const jsonPath = join21(input.outDir, `${input.filePrefix}-bundle.json`);
62459
62577
  writeFileSync18(jsonPath, `${JSON.stringify(json, mapReplacer, 2)}
62460
62578
  `, "utf8");
62461
62579
  const markdown = renderMarkdownBundle(input, styleDeltas);
62462
- const markdownPath = join20(input.outDir, `${input.filePrefix}-prompt.md`);
62580
+ const markdownPath = join21(input.outDir, `${input.filePrefix}-prompt.md`);
62463
62581
  writeFileSync18(markdownPath, markdown, "utf8");
62464
62582
  const summary = oneLineSummary(input, styleDeltas);
62465
62583
  return { jsonPath, markdownPath, summary };
@@ -62608,8 +62726,8 @@ function renderMarkdownBundle(input, deltas) {
62608
62726
  }
62609
62727
  function relativeOrAbs(outDir, absPath) {
62610
62728
  try {
62611
- if (dirname4(absPath) === outDir)
62612
- return basename2(absPath);
62729
+ if (dirname5(absPath) === outDir)
62730
+ return basename3(absPath);
62613
62731
  return relative3(outDir, absPath);
62614
62732
  } catch {
62615
62733
  return absPath;
@@ -62640,8 +62758,8 @@ function capDiff(diff, maxLines) {
62640
62758
  }
62641
62759
 
62642
62760
  // src/migrate/plan.ts
62643
- import { existsSync as existsSync13, readFileSync as readFileSync18, writeFileSync as writeFileSync19 } from "node:fs";
62644
- import { join as join21 } from "node:path";
62761
+ import { existsSync as existsSync13, readFileSync as readFileSync19, writeFileSync as writeFileSync19 } from "node:fs";
62762
+ import { join as join22 } from "node:path";
62645
62763
  function dedupe(names) {
62646
62764
  return [...new Set(names)];
62647
62765
  }
@@ -62766,13 +62884,13 @@ function mergePlanDecisions(fresh, previous) {
62766
62884
  var PLAN_FILE = "migration-plan.json";
62767
62885
  var SETTLED = new Set(["done", "as-is", "upgrade", "skipped"]);
62768
62886
  function loadPlan(dir) {
62769
- const p = join21(dir, PLAN_FILE);
62887
+ const p = join22(dir, PLAN_FILE);
62770
62888
  if (!existsSync13(p))
62771
62889
  return null;
62772
- return JSON.parse(readFileSync18(p, "utf8"));
62890
+ return JSON.parse(readFileSync19(p, "utf8"));
62773
62891
  }
62774
62892
  function savePlan(dir, plan) {
62775
- writeFileSync19(join21(dir, PLAN_FILE), `${JSON.stringify(plan, null, 2)}
62893
+ writeFileSync19(join22(dir, PLAN_FILE), `${JSON.stringify(plan, null, 2)}
62776
62894
  `, "utf8");
62777
62895
  }
62778
62896
  function setComponentStatus(plan, name, status, opts = {}) {
@@ -63666,20 +63784,20 @@ async function readBoxTree(page, selector, opts = {}) {
63666
63784
  async function sectionCommand(opts) {
63667
63785
  const viewport = parseViewport3(opts.viewport);
63668
63786
  if (!viewport) {
63669
- console.error(chalk14.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
63787
+ console.error(chalk15.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
63670
63788
  return 2;
63671
63789
  }
63672
63790
  const waitMs = Number.parseInt(opts.wait, 10);
63673
63791
  if (!Number.isFinite(waitMs) || waitMs < 0) {
63674
- console.error(chalk14.red(`--wait inválido: ${opts.wait}`));
63792
+ console.error(chalk15.red(`--wait inválido: ${opts.wait}`));
63675
63793
  return 2;
63676
63794
  }
63677
63795
  if (!opts.selector || opts.selector.trim().length === 0) {
63678
- console.error(chalk14.red("--selector é obrigatório"));
63796
+ console.error(chalk15.red("--selector é obrigatório"));
63679
63797
  return 2;
63680
63798
  }
63681
63799
  if (!isValidUrl(opts.prod) || !isValidUrl(opts.cand)) {
63682
- console.error(chalk14.red("--prod ou --cand inválido"));
63800
+ console.error(chalk15.red("--prod ou --cand inválido"));
63683
63801
  return 2;
63684
63802
  }
63685
63803
  const candSelector = opts.candSelector?.trim() || opts.selector;
@@ -63700,18 +63818,19 @@ async function sectionCommand(opts) {
63700
63818
  const hash = hashSelector(opts.selector);
63701
63819
  const filePrefix = `section-${hash}-${viewport}`;
63702
63820
  const screenshotPaths = {
63703
- prod: resolve3(opts.outDir, `${filePrefix}-prod.png`),
63704
- cand: resolve3(opts.outDir, `${filePrefix}-cand.png`)
63821
+ prod: resolve4(opts.outDir, `${filePrefix}-prod.png`),
63822
+ cand: resolve4(opts.outDir, `${filePrefix}-cand.png`)
63705
63823
  };
63706
- const heatmapPath = resolve3(opts.outDir, `${filePrefix}-heatmap.png`);
63824
+ const heatmapPath = resolve4(opts.outDir, `${filePrefix}-heatmap.png`);
63707
63825
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
63708
63826
  if (aliasNote)
63709
- console.log(chalk14.dim(` ${aliasNote}`));
63827
+ console.log(chalk15.dim(` ${aliasNote}`));
63710
63828
  const browser = await launchBrowser({ headless: true });
63711
63829
  try {
63712
63830
  const [prodSide, candSide] = await Promise.all([
63713
63831
  gatherSide(browser, {
63714
63832
  url: opts.prod,
63833
+ storageState: opts.prodStorageState,
63715
63834
  viewport,
63716
63835
  viewportSize: opts.viewportSize,
63717
63836
  waitMs,
@@ -63725,6 +63844,7 @@ async function sectionCommand(opts) {
63725
63844
  }),
63726
63845
  gatherSide(browser, {
63727
63846
  url: opts.cand,
63847
+ storageState: opts.candStorageState,
63728
63848
  viewport,
63729
63849
  viewportSize: opts.viewportSize,
63730
63850
  waitMs,
@@ -63785,7 +63905,7 @@ async function sectionCommand(opts) {
63785
63905
  ]) {
63786
63906
  const caveat = data.settle && formatSettleCaveat(side, data.settle);
63787
63907
  if (caveat)
63788
- console.log(chalk14.yellow(` ${caveat}`));
63908
+ console.log(chalk15.yellow(` ${caveat}`));
63789
63909
  }
63790
63910
  if (heatmap)
63791
63911
  printHeatmap(heatmap, heatmapPath);
@@ -63813,9 +63933,9 @@ function computeBoxTreeDiff(prodSide, candSide, aliases) {
63813
63933
  }
63814
63934
  function printBoxTree(result) {
63815
63935
  console.log("");
63816
- console.log(chalk14.bold(" Box tree"));
63936
+ console.log(chalk15.bold(" Box tree"));
63817
63937
  if ("error" in result) {
63818
- console.log(chalk14.yellow(` não foi possível comparar — ${result.error}`));
63938
+ console.log(chalk15.yellow(` não foi possível comparar — ${result.error}`));
63819
63939
  return;
63820
63940
  }
63821
63941
  for (const line of formatBoxTreeDiff(result).split(`
@@ -63826,7 +63946,9 @@ function printBoxTree(result) {
63826
63946
  async function gatherSide(browser, opts) {
63827
63947
  const ctx = await newContext(browser, {
63828
63948
  viewport: opts.viewport,
63829
- ...opts.viewportSize ? { viewportSize: opts.viewportSize } : {}
63949
+ ...opts.viewportSize ? { viewportSize: opts.viewportSize } : {},
63950
+ ...opts.storageState ? { storageState: opts.storageState } : {},
63951
+ hideScrollbars: true
63830
63952
  });
63831
63953
  const page = await ctx.newPage();
63832
63954
  const result = {
@@ -63841,6 +63963,7 @@ async function gatherSide(browser, opts) {
63841
63963
  });
63842
63964
  const settled = await settlePage(page, {
63843
63965
  waitMs: opts.waitMs,
63966
+ dismissCookies: true,
63844
63967
  scroll: opts.wantScreenshot
63845
63968
  });
63846
63969
  result.settle = settled.settle;
@@ -63926,17 +64049,17 @@ function verdict(prod, cand) {
63926
64049
  async function printResults2(args) {
63927
64050
  const { opts, viewport, candSelector, prodSide, candSide, screenshotPaths, want } = args;
63928
64051
  const crossSelector = candSelector !== opts.selector;
63929
- console.log(chalk14.bold(`
64052
+ console.log(chalk15.bold(`
63930
64053
  parity section`));
63931
64054
  if (crossSelector) {
63932
- console.log(chalk14.dim(` selector: ${opts.selector} (prod)`));
63933
- console.log(chalk14.dim(` ${candSelector} (cand)`));
64055
+ console.log(chalk15.dim(` selector: ${opts.selector} (prod)`));
64056
+ console.log(chalk15.dim(` ${candSelector} (cand)`));
63934
64057
  } else {
63935
- console.log(chalk14.dim(` selector: ${opts.selector}`));
64058
+ console.log(chalk15.dim(` selector: ${opts.selector}`));
63936
64059
  }
63937
- console.log(chalk14.dim(` viewport: ${viewport}`));
63938
- console.log(chalk14.dim(` prod: ${opts.prod}`));
63939
- console.log(chalk14.dim(` cand: ${opts.cand}`));
64060
+ console.log(chalk15.dim(` viewport: ${viewport}`));
64061
+ console.log(chalk15.dim(` prod: ${opts.prod}`));
64062
+ console.log(chalk15.dim(` cand: ${opts.cand}`));
63940
64063
  console.log("");
63941
64064
  if (want.html) {
63942
64065
  await printHtmlDiff(prodSide, candSide, crossSelector ? `${opts.selector} → ${candSelector}` : opts.selector);
@@ -63947,22 +64070,22 @@ async function printResults2(args) {
63947
64070
  printScreenshotPaths(prodSide, candSide, screenshotPaths);
63948
64071
  }
63949
64072
  async function printHtmlDiff(prod, cand, selector) {
63950
- console.log(chalk14.bold(" HTML diff"));
64073
+ console.log(chalk15.bold(" HTML diff"));
63951
64074
  if (prod.htmlError) {
63952
- console.log(chalk14.red(` prod: ${prod.htmlError}`));
64075
+ console.log(chalk15.red(` prod: ${prod.htmlError}`));
63953
64076
  return;
63954
64077
  }
63955
64078
  if (cand.htmlError) {
63956
- console.log(chalk14.red(` cand: ${cand.htmlError}`));
64079
+ console.log(chalk15.red(` cand: ${cand.htmlError}`));
63957
64080
  return;
63958
64081
  }
63959
64082
  if (!prod.html || !cand.html) {
63960
- console.log(chalk14.dim(" (nenhum lado tem HTML disponível)"));
64083
+ console.log(chalk15.dim(" (nenhum lado tem HTML disponível)"));
63961
64084
  return;
63962
64085
  }
63963
64086
  const [prodFmt, candFmt] = await Promise.all([formatHtml(prod.html), formatHtml(cand.html)]);
63964
64087
  if (prodFmt === candFmt) {
63965
- console.log(chalk14.green(" ✓ idêntico após pretty-print"));
64088
+ console.log(chalk15.green(" ✓ idêntico após pretty-print"));
63966
64089
  console.log("");
63967
64090
  return;
63968
64091
  }
@@ -63971,17 +64094,17 @@ async function printHtmlDiff(prod, cand, selector) {
63971
64094
  console.log("");
63972
64095
  }
63973
64096
  function printStylesDiff(prod, cand) {
63974
- console.log(chalk14.bold(" Computed styles diff"));
64097
+ console.log(chalk15.bold(" Computed styles diff"));
63975
64098
  if (!prod.styles || !cand.styles) {
63976
- console.log(chalk14.dim(" (styles não foram coletados)"));
64099
+ console.log(chalk15.dim(" (styles não foram coletados)"));
63977
64100
  return;
63978
64101
  }
63979
64102
  if (!prod.styles.found) {
63980
- console.log(chalk14.red(` prod: ${prod.styles.error}`));
64103
+ console.log(chalk15.red(` prod: ${prod.styles.error}`));
63981
64104
  return;
63982
64105
  }
63983
64106
  if (!cand.styles.found) {
63984
- console.log(chalk14.red(` cand: ${cand.styles.error}`));
64107
+ console.log(chalk15.red(` cand: ${cand.styles.error}`));
63985
64108
  return;
63986
64109
  }
63987
64110
  const rows = [];
@@ -64008,27 +64131,27 @@ function printStylesDiff(prod, cand) {
64008
64131
  });
64009
64132
  }
64010
64133
  if (rows.length === 0) {
64011
- console.log(chalk14.green(" ✓ todos os SECTION_STYLE_KEYS são iguais"));
64134
+ console.log(chalk15.green(" ✓ todos os SECTION_STYLE_KEYS são iguais"));
64012
64135
  console.log("");
64013
64136
  return;
64014
64137
  }
64015
64138
  const keyWidth = Math.max(...rows.map((r) => r.key.length));
64016
64139
  for (const r of rows) {
64017
- console.log(` ${chalk14.cyan(r.key.padEnd(keyWidth))} ${chalk14.red(`prod=${r.prod || "(vazio)"}`)} ${chalk14.green(`cand=${r.cand || "(vazio)"}`)}`);
64140
+ console.log(` ${chalk15.cyan(r.key.padEnd(keyWidth))} ${chalk15.red(`prod=${r.prod || "(vazio)"}`)} ${chalk15.green(`cand=${r.cand || "(vazio)"}`)}`);
64018
64141
  }
64019
64142
  console.log("");
64020
64143
  }
64021
64144
  function printScreenshotPaths(prod, cand, paths) {
64022
- console.log(chalk14.bold(" Screenshots"));
64145
+ console.log(chalk15.bold(" Screenshots"));
64023
64146
  if (prod.screenshotError) {
64024
- console.log(chalk14.red(` prod: ${prod.screenshotError}`));
64147
+ console.log(chalk15.red(` prod: ${prod.screenshotError}`));
64025
64148
  } else if (prod.screenshotTaken) {
64026
- console.log(` prod: ${chalk14.dim(paths.prod)}`);
64149
+ console.log(` prod: ${chalk15.dim(paths.prod)}`);
64027
64150
  }
64028
64151
  if (cand.screenshotError) {
64029
- console.log(chalk14.red(` cand: ${cand.screenshotError}`));
64152
+ console.log(chalk15.red(` cand: ${cand.screenshotError}`));
64030
64153
  } else if (cand.screenshotTaken) {
64031
- console.log(` cand: ${chalk14.dim(paths.cand)}`);
64154
+ console.log(` cand: ${chalk15.dim(paths.cand)}`);
64032
64155
  }
64033
64156
  console.log("");
64034
64157
  }
@@ -64051,13 +64174,13 @@ function colorPatch(patch) {
64051
64174
  if (line.startsWith("Index:") || line.startsWith("==="))
64052
64175
  continue;
64053
64176
  if (line.startsWith("---") || line.startsWith("+++"))
64054
- out.push(chalk14.dim(line));
64177
+ out.push(chalk15.dim(line));
64055
64178
  else if (line.startsWith("@@"))
64056
- out.push(chalk14.cyan(line));
64179
+ out.push(chalk15.cyan(line));
64057
64180
  else if (line.startsWith("+"))
64058
- out.push(chalk14.green(line));
64181
+ out.push(chalk15.green(line));
64059
64182
  else if (line.startsWith("-"))
64060
- out.push(chalk14.red(line));
64183
+ out.push(chalk15.red(line));
64061
64184
  else
64062
64185
  out.push(line);
64063
64186
  }
@@ -64126,7 +64249,7 @@ async function buildPromptBundle(args) {
64126
64249
  }
64127
64250
  async function maybeRunLlmSummary(args) {
64128
64251
  if (!isUnderstandingAvailable()) {
64129
- console.warn(chalk14.yellow(" --llm-summary pulado: nenhum ANTHROPIC_API_KEY ou OPENROUTER_API_KEY configurado."));
64252
+ console.warn(chalk15.yellow(" --llm-summary pulado: nenhum ANTHROPIC_API_KEY ou OPENROUTER_API_KEY configurado."));
64130
64253
  return null;
64131
64254
  }
64132
64255
  const result = await invokeUnderstandingSummary({
@@ -64138,42 +64261,42 @@ async function maybeRunLlmSummary(args) {
64138
64261
  return result?.summary ?? null;
64139
64262
  }
64140
64263
  function printHeatmap(state, heatmapPath) {
64141
- console.log(chalk14.bold(" Heatmap"));
64264
+ console.log(chalk15.bold(" Heatmap"));
64142
64265
  if (state.error) {
64143
- console.log(chalk14.yellow(` ${state.error}`));
64266
+ console.log(chalk15.yellow(` ${state.error}`));
64144
64267
  console.log("");
64145
64268
  return;
64146
64269
  }
64147
64270
  if (!state.analysis) {
64148
- console.log(chalk14.dim(" (sem dados de heatmap)"));
64271
+ console.log(chalk15.dim(" (sem dados de heatmap)"));
64149
64272
  console.log("");
64150
64273
  return;
64151
64274
  }
64152
64275
  const a = state.analysis;
64153
64276
  const pct = (a.pctDiff * 100).toFixed(2);
64154
- console.log(` ${chalk14.cyan("diffPixels")}: ${a.diffPixels} (${pct}%)`);
64277
+ console.log(` ${chalk15.cyan("diffPixels")}: ${a.diffPixels} (${pct}%)`);
64155
64278
  if (a.boundingBox) {
64156
64279
  const bb = a.boundingBox;
64157
- console.log(` ${chalk14.cyan("boundingBox")}: x=${bb.x} y=${bb.y} w=${bb.width} h=${bb.height}`);
64280
+ console.log(` ${chalk15.cyan("boundingBox")}: x=${bb.x} y=${bb.y} w=${bb.width} h=${bb.height}`);
64158
64281
  }
64159
64282
  if (a.hotspots.length > 0) {
64160
- console.log(` ${chalk14.cyan("hotspots")}:`);
64283
+ console.log(` ${chalk15.cyan("hotspots")}:`);
64161
64284
  for (const h of a.hotspots.slice(0, 5)) {
64162
64285
  console.log(` (${h.x}, ${h.y}) ${h.width}×${h.height} — ${h.pixelCount} px`);
64163
64286
  }
64164
64287
  }
64165
- console.log(` ${chalk14.dim(`heatmap: ${heatmapPath}`)}`);
64288
+ console.log(` ${chalk15.dim(`heatmap: ${heatmapPath}`)}`);
64166
64289
  console.log("");
64167
64290
  }
64168
64291
  function printBundlePaths(b) {
64169
- console.log(chalk14.bold(" Bundle"));
64170
- console.log(` ${chalk14.cyan("summary")}: ${b.summary}`);
64171
- console.log(` ${chalk14.cyan("json")}: ${chalk14.dim(b.jsonPath)}`);
64172
- console.log(` ${chalk14.cyan("prompt")}: ${chalk14.dim(b.markdownPath)}`);
64292
+ console.log(chalk15.bold(" Bundle"));
64293
+ console.log(` ${chalk15.cyan("summary")}: ${b.summary}`);
64294
+ console.log(` ${chalk15.cyan("json")}: ${chalk15.dim(b.jsonPath)}`);
64295
+ console.log(` ${chalk15.cyan("prompt")}: ${chalk15.dim(b.markdownPath)}`);
64173
64296
  console.log("");
64174
64297
  }
64175
64298
  function printLlmSummary(summary) {
64176
- console.log(chalk14.bold(" What the LLM understood"));
64299
+ console.log(chalk15.bold(" What the LLM understood"));
64177
64300
  console.log(` ${summary.split(`
64178
64301
  `).join(`
64179
64302
  `)}`);
@@ -64188,36 +64311,36 @@ function planExtractComponents(detected, signatures) {
64188
64311
  async function extractCommand(opts) {
64189
64312
  const viewport = parseViewport3(opts.viewport);
64190
64313
  if (!viewport) {
64191
- console.error(chalk15.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64314
+ console.error(chalk16.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64192
64315
  return 2;
64193
64316
  }
64194
64317
  if (!isValidUrl2(opts.url)) {
64195
- console.error(chalk15.red(`--url inválido: ${opts.url}`));
64318
+ console.error(chalk16.red(`--url inválido: ${opts.url}`));
64196
64319
  return 2;
64197
64320
  }
64198
64321
  const format = normalizeFormat(opts.format);
64199
64322
  if (!format) {
64200
- console.error(chalk15.red(`--format inválido: ${opts.format} (use md|json|both)`));
64323
+ console.error(chalk16.red(`--format inválido: ${opts.format} (use md|json|both)`));
64201
64324
  return 2;
64202
64325
  }
64203
64326
  const allowlist = parseAllowlist(opts.components);
64204
64327
  const host = safeHost4(opts.url);
64205
64328
  const timestamp = new Date().toISOString();
64206
64329
  const runDirTimestamp = timestamp.replace(/[:.]/g, "-");
64207
- const runDir = resolve4(opts.outDir, host, runDirTimestamp);
64330
+ const runDir = resolve5(opts.outDir, host, runDirTimestamp);
64208
64331
  mkdirSync13(runDir, { recursive: true });
64209
64332
  let pageTokens;
64210
64333
  try {
64211
64334
  pageTokens = parsePageList(opts.pages, { tokens: PLP_PDP_AUTO_TOKENS, fallback: ["/"] });
64212
64335
  } catch (err) {
64213
- console.error(chalk15.red(err.message));
64336
+ console.error(chalk16.red(err.message));
64214
64337
  return 2;
64215
64338
  }
64216
64339
  const browser = await launchBrowser({ headless: true });
64217
64340
  try {
64218
64341
  const resolvedPages = await resolvePages(opts.url, pageTokens);
64219
64342
  if (resolvedPages.length === 0) {
64220
- console.error(chalk15.red("nenhuma página resolvida a partir de --pages"));
64343
+ console.error(chalk16.red("nenhuma página resolvida a partir de --pages"));
64221
64344
  return 1;
64222
64345
  }
64223
64346
  let globalIndex = 0;
@@ -64266,7 +64389,7 @@ async function extractCommand(opts) {
64266
64389
  seenGlobalRoles.add(component.role);
64267
64390
  globalIndex++;
64268
64391
  const dirName = componentDirName(component.role, globalIndex);
64269
- const componentDir = resolve4(runDir, "components", dirName);
64392
+ const componentDir = resolve5(runDir, "components", dirName);
64270
64393
  const extracted = await extractComponent(page, component, {
64271
64394
  outDir: componentDir,
64272
64395
  index: globalIndex,
@@ -64311,17 +64434,17 @@ async function extractCommand(opts) {
64311
64434
  }
64312
64435
  }
64313
64436
  function printResults3(runDir, bundle) {
64314
- console.log(chalk15.bold(`
64437
+ console.log(chalk16.bold(`
64315
64438
  parity extract`));
64316
- console.log(chalk15.dim(` url: ${bundle.url}`));
64317
- console.log(chalk15.dim(` viewport: ${bundle.viewport}`));
64318
- console.log(chalk15.dim(` pages: ${bundle.pages?.length ?? 0}`));
64319
- console.log(chalk15.dim(` out: ${runDir}`));
64439
+ console.log(chalk16.dim(` url: ${bundle.url}`));
64440
+ console.log(chalk16.dim(` viewport: ${bundle.viewport}`));
64441
+ console.log(chalk16.dim(` pages: ${bundle.pages?.length ?? 0}`));
64442
+ console.log(chalk16.dim(` out: ${runDir}`));
64320
64443
  console.log("");
64321
- console.log(chalk15.bold(` ${bundle.components.length} component(s) detected:`));
64444
+ console.log(chalk16.bold(` ${bundle.components.length} component(s) detected:`));
64322
64445
  for (const c of bundle.components) {
64323
- const repeated = c.repeated && c.repeated > 1 ? chalk15.dim(` ×${c.repeated}`) : "";
64324
- console.log(` ${chalk15.cyan(c.role.padEnd(24))} ${chalk15.dim(c.selector)}${repeated}`);
64446
+ const repeated = c.repeated && c.repeated > 1 ? chalk16.dim(` ×${c.repeated}`) : "";
64447
+ console.log(` ${chalk16.cyan(c.role.padEnd(24))} ${chalk16.dim(c.selector)}${repeated}`);
64325
64448
  }
64326
64449
  console.log("");
64327
64450
  }
@@ -64433,23 +64556,23 @@ async function fixCommand(opts) {
64433
64556
 
64434
64557
  // src/commands/html.ts
64435
64558
  init_esm10();
64436
- import chalk16 from "chalk";
64559
+ import chalk17 from "chalk";
64437
64560
  import * as diff2 from "diff";
64438
64561
  import prettier2 from "prettier";
64439
64562
  async function htmlCommand(opts) {
64440
64563
  const viewport = parseViewport4(opts.viewport);
64441
64564
  if (!viewport) {
64442
- console.error(chalk16.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64565
+ console.error(chalk17.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64443
64566
  return 2;
64444
64567
  }
64445
64568
  const waitMs = parseWaitMs(opts.wait);
64446
64569
  if (waitMs === null) {
64447
- console.error(chalk16.red(`--wait inválido: ${opts.wait} (precisa ser inteiro >= 0)`));
64570
+ console.error(chalk17.red(`--wait inválido: ${opts.wait} (precisa ser inteiro >= 0)`));
64448
64571
  return 2;
64449
64572
  }
64450
64573
  const mode = resolveMode(opts);
64451
64574
  if (mode.kind === "error") {
64452
- console.error(chalk16.red(mode.message));
64575
+ console.error(chalk17.red(mode.message));
64453
64576
  return 2;
64454
64577
  }
64455
64578
  const browser = await launchBrowser({ headless: true });
@@ -64458,11 +64581,11 @@ async function htmlCommand(opts) {
64458
64581
  const html = await fetchSnapshot(browser, mode.url, viewport, waitMs);
64459
64582
  const piece = extractSelector(html, opts.selector);
64460
64583
  if (piece.error) {
64461
- console.error(chalk16.red(piece.error));
64584
+ console.error(chalk17.red(piece.error));
64462
64585
  return 2;
64463
64586
  }
64464
64587
  if (piece.warning)
64465
- console.error(chalk16.yellow(` ⚠ ${piece.warning}`));
64588
+ console.error(chalk17.yellow(` ⚠ ${piece.warning}`));
64466
64589
  const finalText = await maybePretty(piece.html, opts.pretty === true);
64467
64590
  if (opts.json) {
64468
64591
  console.log(JSON.stringify({
@@ -64483,17 +64606,17 @@ async function htmlCommand(opts) {
64483
64606
  const prodPiece = extractSelector(prodHtml, opts.selector);
64484
64607
  const candPiece = extractSelector(candHtml, opts.selector);
64485
64608
  if (prodPiece.error) {
64486
- console.error(chalk16.red(`prod: ${prodPiece.error}`));
64609
+ console.error(chalk17.red(`prod: ${prodPiece.error}`));
64487
64610
  return 2;
64488
64611
  }
64489
64612
  if (candPiece.error) {
64490
- console.error(chalk16.red(`cand: ${candPiece.error}`));
64613
+ console.error(chalk17.red(`cand: ${candPiece.error}`));
64491
64614
  return 2;
64492
64615
  }
64493
64616
  if (prodPiece.warning)
64494
- console.error(chalk16.yellow(` ⚠ prod: ${prodPiece.warning}`));
64617
+ console.error(chalk17.yellow(` ⚠ prod: ${prodPiece.warning}`));
64495
64618
  if (candPiece.warning)
64496
- console.error(chalk16.yellow(` ⚠ cand: ${candPiece.warning}`));
64619
+ console.error(chalk17.yellow(` ⚠ cand: ${candPiece.warning}`));
64497
64620
  const [prodFmt, candFmt] = await Promise.all([
64498
64621
  maybePretty(prodPiece.html, opts.pretty !== false),
64499
64622
  maybePretty(candPiece.html, opts.pretty !== false)
@@ -64641,19 +64764,19 @@ function formatPatch(patch) {
64641
64764
  if (line.startsWith("Index:") || line.startsWith("==="))
64642
64765
  continue;
64643
64766
  if (line.startsWith("---") || line.startsWith("+++")) {
64644
- out.push(chalk16.dim(line));
64767
+ out.push(chalk17.dim(line));
64645
64768
  continue;
64646
64769
  }
64647
64770
  if (line.startsWith("@@")) {
64648
- out.push(chalk16.cyan(line));
64771
+ out.push(chalk17.cyan(line));
64649
64772
  continue;
64650
64773
  }
64651
64774
  if (line.startsWith("+")) {
64652
- out.push(chalk16.green(line));
64775
+ out.push(chalk17.green(line));
64653
64776
  continue;
64654
64777
  }
64655
64778
  if (line.startsWith("-")) {
64656
- out.push(chalk16.red(line));
64779
+ out.push(chalk17.red(line));
64657
64780
  continue;
64658
64781
  }
64659
64782
  out.push(line);
@@ -64664,14 +64787,14 @@ function formatPatch(patch) {
64664
64787
 
64665
64788
  // src/commands/journey.ts
64666
64789
  import { writeFileSync as writeFileSync20 } from "node:fs";
64667
- import { join as join22 } from "node:path";
64668
- import chalk17 from "chalk";
64790
+ import { join as join23 } from "node:path";
64791
+ import chalk18 from "chalk";
64669
64792
  import ora7 from "ora";
64670
64793
  init_client();
64671
64794
  async function journeyCommand(opts) {
64672
64795
  const viewports = opts.viewports.split(",").map((s) => s.trim()).filter((s) => s === "mobile" || s === "desktop");
64673
64796
  if (viewports.length === 0) {
64674
- console.error(chalk17.red("Nenhum viewport válido (use mobile,desktop)"));
64797
+ console.error(chalk18.red("Nenhum viewport válido (use mobile,desktop)"));
64675
64798
  return 2;
64676
64799
  }
64677
64800
  const rc = loadParityRc();
@@ -64681,13 +64804,13 @@ async function journeyCommand(opts) {
64681
64804
  const runId = newRunId();
64682
64805
  const paths = createRunDir(opts.output, runId);
64683
64806
  if (!opts.json) {
64684
- console.log(chalk17.bold(`
64807
+ console.log(chalk18.bold(`
64685
64808
  parity journey ${runId}`));
64686
- console.log(chalk17.dim(` prod: ${opts.prod}`));
64687
- console.log(chalk17.dim(` cand: ${opts.cand}`));
64688
- console.log(chalk17.dim(` viewports: ${viewports.join(", ")} · CEP: ${rc.cep}`));
64809
+ console.log(chalk18.dim(` prod: ${opts.prod}`));
64810
+ console.log(chalk18.dim(` cand: ${opts.cand}`));
64811
+ console.log(chalk18.dim(` viewports: ${viewports.join(", ")} · CEP: ${rc.cep}`));
64689
64812
  if (isLlmAvailable())
64690
- console.log(chalk17.dim(` llm: ${providerLabel()}`));
64813
+ console.log(chalk18.dim(` llm: ${providerLabel()}`));
64691
64814
  console.log("");
64692
64815
  }
64693
64816
  let platform = "custom";
@@ -64721,20 +64844,20 @@ async function journeyCommand(opts) {
64721
64844
  const onStepFor = (viewport, side) => (event) => {
64722
64845
  if (opts.json)
64723
64846
  return;
64724
- const sideTag = side === "prod" ? chalk17.cyan("prod") : chalk17.magenta("cand");
64725
- const prefix = ` ${chalk17.dim(`[${viewport}/`)}${sideTag}${chalk17.dim("]")}`;
64847
+ const sideTag = side === "prod" ? chalk18.cyan("prod") : chalk18.magenta("cand");
64848
+ const prefix = ` ${chalk18.dim(`[${viewport}/`)}${sideTag}${chalk18.dim("]")}`;
64726
64849
  if (event.phase === "start") {
64727
- console.log(`${prefix} ${chalk17.dim(`${event.index}/${event.total}`)} ▶ ${chalk17.bold(stepLabel(event.name))}`);
64850
+ console.log(`${prefix} ${chalk18.dim(`${event.index}/${event.total}`)} ▶ ${chalk18.bold(stepLabel(event.name))}`);
64728
64851
  } else {
64729
- const glyph = event.status === "ok" ? chalk17.green("✓") : event.status === "skipped" ? chalk17.yellow("○") : chalk17.red("✗");
64730
- const noteText = event.note ? chalk17.dim(` (${event.note})`) : "";
64731
- const time = chalk17.dim(`${(event.durationMs / 1000).toFixed(1)}s`);
64732
- console.log(`${prefix} ${chalk17.dim(`${event.index}/${event.total}`)} ${glyph} ${stepLabel(event.name)} ${time}${noteText}`);
64852
+ const glyph = event.status === "ok" ? chalk18.green("✓") : event.status === "skipped" ? chalk18.yellow("○") : chalk18.red("✗");
64853
+ const noteText = event.note ? chalk18.dim(` (${event.note})`) : "";
64854
+ const time = chalk18.dim(`${(event.durationMs / 1000).toFixed(1)}s`);
64855
+ console.log(`${prefix} ${chalk18.dim(`${event.index}/${event.total}`)} ${glyph} ${stepLabel(event.name)} ${time}${noteText}`);
64733
64856
  }
64734
64857
  };
64735
64858
  async function runOneSide(browserInstance, viewport, side) {
64736
64859
  const baseUrl = side === "prod" ? opts.prod : opts.cand;
64737
- const tracePath = join22(paths.tracesDir, `${viewport}-${side}.zip`);
64860
+ const tracePath = join23(paths.tracesDir, `${viewport}-${side}.zip`);
64738
64861
  const ctx = await newContext(browserInstance, {
64739
64862
  viewport,
64740
64863
  tracesDir: paths.tracesDir,
@@ -64768,7 +64891,7 @@ async function journeyCommand(opts) {
64768
64891
  spinner?.succeed("Browser pronto");
64769
64892
  for (const viewport of viewports) {
64770
64893
  if (!opts.json)
64771
- console.log(chalk17.bold(`
64894
+ console.log(chalk18.bold(`
64772
64895
  ── ${viewport} ─────────────────────────────────────────────`));
64773
64896
  const [prodCap, candCap] = await Promise.all([
64774
64897
  runOneSide(browser, viewport, "prod"),
@@ -64803,11 +64926,11 @@ async function journeyCommand(opts) {
64803
64926
  if (totalDeprecated > 0)
64804
64927
  bits.push(`${totalDeprecated} depreciado(s)`);
64805
64928
  if (bits.length > 0)
64806
- console.log(chalk17.dim(` learned-selectors atualizado: ${bits.join(", ")}`));
64929
+ console.log(chalk18.dim(` learned-selectors atualizado: ${bits.join(", ")}`));
64807
64930
  }
64808
64931
  } catch (err) {
64809
64932
  if (!opts.json) {
64810
- console.warn(chalk17.yellow(` warn: failed to persist learned-selectors: ${err.message}`));
64933
+ console.warn(chalk18.yellow(` warn: failed to persist learned-selectors: ${err.message}`));
64811
64934
  }
64812
64935
  }
64813
64936
  }
@@ -64828,7 +64951,7 @@ async function journeyCommand(opts) {
64828
64951
  if (opts.junit) {
64829
64952
  writeFileSync20(opts.junit, buildJUnit(rows, failures), "utf8");
64830
64953
  if (!opts.json)
64831
- console.log(chalk17.dim(` → JUnit XML: ${opts.junit}`));
64954
+ console.log(chalk18.dim(` → JUnit XML: ${opts.junit}`));
64832
64955
  }
64833
64956
  return failures.some((f) => f.critical) ? 1 : 0;
64834
64957
  } catch (err) {
@@ -64893,14 +65016,14 @@ function collectFailures(rows) {
64893
65016
  function printTable(viewports, rows) {
64894
65017
  console.log("");
64895
65018
  for (const viewport of viewports) {
64896
- console.log(chalk17.bold(` [${viewport}]`));
65019
+ console.log(chalk18.bold(` [${viewport}]`));
64897
65020
  const vrows = rows.filter((r) => r.viewport === viewport);
64898
65021
  for (const r of vrows) {
64899
65022
  const label = PJ_STEP_LABELS_NUMBERED[r.name] ?? r.name;
64900
65023
  const p = statusGlyph(r.prod?.status);
64901
65024
  const c = statusGlyph(r.cand?.status);
64902
- const status = r.prod?.status === "ok" && r.cand?.status !== "ok" ? chalk17.red("FAILED") : "";
64903
- const note = r.cand?.status === "failed" || r.cand?.status === "skipped" ? chalk17.dim(`(${r.cand?.note ?? r.cand?.status})`) : "";
65025
+ const status = r.prod?.status === "ok" && r.cand?.status !== "ok" ? chalk18.red("FAILED") : "";
65026
+ const note = r.cand?.status === "failed" || r.cand?.status === "skipped" ? chalk18.dim(`(${r.cand?.note ?? r.cand?.status})`) : "";
64904
65027
  console.log(` ${label.padEnd(24)} prod ${p} cand ${c} ${status} ${note}`);
64905
65028
  }
64906
65029
  console.log("");
@@ -64908,12 +65031,12 @@ function printTable(viewports, rows) {
64908
65031
  }
64909
65032
  function statusGlyph(status) {
64910
65033
  if (!status)
64911
- return chalk17.dim("—");
65034
+ return chalk18.dim("—");
64912
65035
  if (status === "ok")
64913
- return chalk17.green("✓");
65036
+ return chalk18.green("✓");
64914
65037
  if (status === "skipped")
64915
- return chalk17.yellow("○");
64916
- return chalk17.red("✗");
65038
+ return chalk18.yellow("○");
65039
+ return chalk18.red("✗");
64917
65040
  }
64918
65041
  function printSummary6(rows, failures, htmlPath) {
64919
65042
  const byViewport = new Map;
@@ -64924,25 +65047,25 @@ function printSummary6(rows, failures, htmlPath) {
64924
65047
  v.passed++;
64925
65048
  byViewport.set(r.viewport, v);
64926
65049
  }
64927
- console.log(chalk17.bold(" Summary:"));
65050
+ console.log(chalk18.bold(" Summary:"));
64928
65051
  for (const [vp, { passed, total }] of byViewport) {
64929
- const stat = passed === total ? chalk17.green("✓") : chalk17.yellow(`${passed}/${total}`);
65052
+ const stat = passed === total ? chalk18.green("✓") : chalk18.yellow(`${passed}/${total}`);
64930
65053
  console.log(` ${vp.padEnd(8)} ${stat} steps em cand`);
64931
65054
  }
64932
65055
  if (failures.length > 0) {
64933
65056
  const crit = failures.filter((f) => f.critical).length;
64934
65057
  console.log("");
64935
- console.log(chalk17.red(` ✗ ${failures.length} step(s) divergent(es) (${crit} crítico)`));
65058
+ console.log(chalk18.red(` ✗ ${failures.length} step(s) divergent(es) (${crit} crítico)`));
64936
65059
  for (const f of failures) {
64937
- const tag = f.critical ? chalk17.red("[critical]") : chalk17.yellow("[warn]");
65060
+ const tag = f.critical ? chalk18.red("[critical]") : chalk18.yellow("[warn]");
64938
65061
  console.log(` ${tag} [${f.viewport}] ${f.step}: ${f.reason}`);
64939
65062
  }
64940
65063
  } else {
64941
65064
  console.log("");
64942
- console.log(chalk17.green(" ✓ jornada completa em cand"));
65065
+ console.log(chalk18.green(" ✓ jornada completa em cand"));
64943
65066
  }
64944
65067
  console.log("");
64945
- console.log(chalk17.dim(` → ${htmlPath}`));
65068
+ console.log(chalk18.dim(` → ${htmlPath}`));
64946
65069
  console.log("");
64947
65070
  }
64948
65071
  function emitGithubAnnotations(failures) {
@@ -65177,26 +65300,26 @@ function safeHost5(url) {
65177
65300
  }
65178
65301
 
65179
65302
  // src/commands/learned.ts
65180
- import chalk18 from "chalk";
65303
+ import chalk19 from "chalk";
65181
65304
  init_client();
65182
65305
  function learnedStats() {
65183
65306
  const lib = loadLearned();
65184
65307
  const stats = statsFromLib(lib);
65185
65308
  if (stats.platforms.length === 0) {
65186
- console.log(chalk18.dim(`Biblioteca vazia: ${LEARNED_PATH}`));
65187
- console.log(chalk18.dim("Rode `parity run ...` em algum site para começar a popular."));
65309
+ console.log(chalk19.dim(`Biblioteca vazia: ${LEARNED_PATH}`));
65310
+ console.log(chalk19.dim("Rode `parity run ...` em algum site para começar a popular."));
65188
65311
  return 0;
65189
65312
  }
65190
- console.log(chalk18.bold(`
65313
+ console.log(chalk19.bold(`
65191
65314
  learned-selectors stats (${LEARNED_PATH})
65192
65315
  `));
65193
65316
  for (const p of stats.platforms) {
65194
- const staleNote = p.staleSelectors > 0 ? ` · ${chalk18.yellow(`${p.staleSelectors} stale`)}` : "";
65195
- console.log(`${chalk18.cyan(p.platform)}: ${p.activeSelectors} active (${p.verifiedSelectors} verified, ${p.llmGuessSelectors} llm-guess) · ${chalk18.dim(`${p.deprecatedSelectors} deprecated`)}${staleNote}`);
65317
+ const staleNote = p.staleSelectors > 0 ? ` · ${chalk19.yellow(`${p.staleSelectors} stale`)}` : "";
65318
+ console.log(`${chalk19.cyan(p.platform)}: ${p.activeSelectors} active (${p.verifiedSelectors} verified, ${p.llmGuessSelectors} llm-guess) · ${chalk19.dim(`${p.deprecatedSelectors} deprecated`)}${staleNote}`);
65196
65319
  for (const top of p.topByKey) {
65197
65320
  const sr = `${(top.successRate * 100).toFixed(0)}%`;
65198
- const originTag = top.origin === "llm-guess" ? chalk18.yellow(" [guess]") : "";
65199
- console.log(` ${chalk18.dim(top.key.padEnd(18))} ${chalk18.green(sr.padStart(4))} ${chalk18.dim(`(${top.hosts} hosts)`)} ${top.selector}${originTag}`);
65321
+ const originTag = top.origin === "llm-guess" ? chalk19.yellow(" [guess]") : "";
65322
+ console.log(` ${chalk19.dim(top.key.padEnd(18))} ${chalk19.green(sr.padStart(4))} ${chalk19.dim(`(${top.hosts} hosts)`)} ${top.selector}${originTag}`);
65200
65323
  }
65201
65324
  console.log("");
65202
65325
  }
@@ -65204,10 +65327,10 @@ learned-selectors stats (${LEARNED_PATH})
65204
65327
  }
65205
65328
  async function learnedValidate(url) {
65206
65329
  if (!isLlmAvailable()) {
65207
- console.error(chalk18.red(" ✖ nenhuma chave de LLM configurada (ANTHROPIC_API_KEY / OPENROUTER_API_KEY) — discovery precisa do LLM"));
65330
+ console.error(chalk19.red(" ✖ nenhuma chave de LLM configurada (ANTHROPIC_API_KEY / OPENROUTER_API_KEY) — discovery precisa do LLM"));
65208
65331
  return 2;
65209
65332
  }
65210
- console.log(chalk18.dim(` Baixando home de ${url}…`));
65333
+ console.log(chalk19.dim(` Baixando home de ${url}…`));
65211
65334
  let html;
65212
65335
  try {
65213
65336
  const res = await fetch(url, {
@@ -65216,20 +65339,20 @@ async function learnedValidate(url) {
65216
65339
  });
65217
65340
  html = res.ok ? await res.text() : null;
65218
65341
  } catch (err) {
65219
- console.error(chalk18.red(` ✖ falha ao baixar ${url}: ${err.message}`));
65342
+ console.error(chalk19.red(` ✖ falha ao baixar ${url}: ${err.message}`));
65220
65343
  return 2;
65221
65344
  }
65222
65345
  if (!html) {
65223
- console.error(chalk18.red(` ✖ falha ao baixar ${url} (HTTP não-2xx ou erro de rede)`));
65346
+ console.error(chalk19.red(` ✖ falha ao baixar ${url} (HTTP não-2xx ou erro de rede)`));
65224
65347
  return 2;
65225
65348
  }
65226
- console.log(chalk18.dim(" Descobrindo seletores via LLM…"));
65349
+ console.log(chalk19.dim(" Descobrindo seletores via LLM…"));
65227
65350
  const discovered = await discoverSelectorsFromUrl(url, html, { noCache: true });
65228
65351
  if (!discovered) {
65229
- console.error(chalk18.red(" ✖ LLM não retornou seletores"));
65352
+ console.error(chalk19.red(" ✖ LLM não retornou seletores"));
65230
65353
  return 2;
65231
65354
  }
65232
- console.log(chalk18.dim(" Validando ao vivo (browser headless)…"));
65355
+ console.log(chalk19.dim(" Validando ao vivo (browser headless)…"));
65233
65356
  let browser = null;
65234
65357
  try {
65235
65358
  browser = await launchBrowser({ headless: true });
@@ -65239,7 +65362,7 @@ async function learnedValidate(url) {
65239
65362
  const { validated } = await validateSelectors(page, discovered);
65240
65363
  await ctx.close();
65241
65364
  const lowConfidence = new Set(discovered.lowConfidenceKeys ?? []);
65242
- console.log(chalk18.bold(`
65365
+ console.log(chalk19.bold(`
65243
65366
  learned validate — ${url}
65244
65367
  `));
65245
65368
  for (const key of Object.keys(discovered)) {
@@ -65247,17 +65370,17 @@ learned validate — ${url}
65247
65370
  continue;
65248
65371
  const selector = discovered[key];
65249
65372
  if (!selector) {
65250
- console.log(` ${chalk18.dim(key.padEnd(20))} ${chalk18.dim("(vazio — LLM não detectou)")}`);
65373
+ console.log(` ${chalk19.dim(key.padEnd(20))} ${chalk19.dim("(vazio — LLM não detectou)")}`);
65251
65374
  continue;
65252
65375
  }
65253
- const state = validated[key] === true ? chalk18.green("validated") : validated[key] === false ? chalk18.red("not-validated") : chalk18.yellow("not-checked");
65254
- const guessTag = lowConfidence.has(key) ? chalk18.yellow(" [low-confidence]") : "";
65376
+ const state = validated[key] === true ? chalk19.green("validated") : validated[key] === false ? chalk19.red("not-validated") : chalk19.yellow("not-checked");
65377
+ const guessTag = lowConfidence.has(key) ? chalk19.yellow(" [low-confidence]") : "";
65255
65378
  console.log(` ${key.padEnd(20)} ${state.padEnd(22)} ${selector}${guessTag}`);
65256
65379
  }
65257
65380
  console.log("");
65258
65381
  return 0;
65259
65382
  } catch (err) {
65260
- console.error(chalk18.red(` ✖ validação ao vivo falhou: ${err.message}`));
65383
+ console.error(chalk19.red(` ✖ validação ao vivo falhou: ${err.message}`));
65261
65384
  return 2;
65262
65385
  } finally {
65263
65386
  if (browser)
@@ -65266,20 +65389,20 @@ learned validate — ${url}
65266
65389
  }
65267
65390
 
65268
65391
  // src/commands/list.ts
65269
- import chalk19 from "chalk";
65392
+ import chalk20 from "chalk";
65270
65393
  function listModulesCommand(json) {
65271
65394
  if (json) {
65272
65395
  console.log(JSON.stringify(MODULES, null, 2));
65273
65396
  return 0;
65274
65397
  }
65275
65398
  for (const mod of Object.values(MODULES)) {
65276
- console.log(` ${chalk19.bold(mod.name)} ${chalk19.dim(mod.description)}`);
65399
+ console.log(` ${chalk20.bold(mod.name)} ${chalk20.dim(mod.description)}`);
65277
65400
  console.log(` checks: ${mod.checks.join(", ")}`);
65278
65401
  console.log(` flows: ${mod.flows.join(", ")}`);
65279
65402
  if (mod.needsSitemapPages)
65280
- console.log(chalk19.dim(" needs sitemap-page crawling"));
65403
+ console.log(chalk20.dim(" needs sitemap-page crawling"));
65281
65404
  if (mod.needsLlm)
65282
- console.log(chalk19.dim(" needs an LLM pass for full value"));
65405
+ console.log(chalk20.dim(" needs an LLM pass for full value"));
65283
65406
  console.log("");
65284
65407
  }
65285
65408
  return 0;
@@ -65287,27 +65410,27 @@ function listModulesCommand(json) {
65287
65410
  function listCommand(output) {
65288
65411
  const runs = listRuns(output);
65289
65412
  if (runs.length === 0) {
65290
- console.log(chalk19.dim(`Nenhum run salvo em ${output}`));
65413
+ console.log(chalk20.dim(`Nenhum run salvo em ${output}`));
65291
65414
  return 0;
65292
65415
  }
65293
65416
  for (const r of runs) {
65294
65417
  try {
65295
65418
  const run = loadRun(output, r.id);
65296
65419
  const v = run.verdict;
65297
- const status = v.status === "inconclusive" ? chalk19.dim(v.status) : v.status === "pass" ? chalk19.green(v.status) : v.status === "warn" ? chalk19.yellow(v.status) : chalk19.red(v.status);
65420
+ const status = v.status === "inconclusive" ? chalk20.dim(v.status) : v.status === "pass" ? chalk20.green(v.status) : v.status === "warn" ? chalk20.yellow(v.status) : chalk20.red(v.status);
65298
65421
  const score = v.status === "inconclusive" ? "—" : v.score;
65299
- console.log(` ${chalk19.bold(r.id)} ${status} score=${score} critical=${v.critical} high=${v.high} ${chalk19.dim(r.timestamp)}`);
65422
+ console.log(` ${chalk20.bold(r.id)} ${status} score=${score} critical=${v.critical} high=${v.high} ${chalk20.dim(r.timestamp)}`);
65300
65423
  } catch {
65301
- console.log(` ${chalk19.bold(r.id)} ${chalk19.dim("(report.json ausente)")}`);
65424
+ console.log(` ${chalk20.bold(r.id)} ${chalk20.dim("(report.json ausente)")}`);
65302
65425
  }
65303
65426
  }
65304
65427
  return 0;
65305
65428
  }
65306
65429
 
65307
65430
  // src/commands/migrate.ts
65308
- import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync23, writeFileSync as writeFileSync25 } from "node:fs";
65309
- import { resolve as resolve6 } from "node:path";
65310
- import chalk20 from "chalk";
65431
+ import { existsSync as existsSync18, mkdirSync as mkdirSync16, readFileSync as readFileSync24, writeFileSync as writeFileSync25 } from "node:fs";
65432
+ import { resolve as resolve7 } from "node:path";
65433
+ import chalk21 from "chalk";
65311
65434
  import open from "open";
65312
65435
 
65313
65436
  // src/migrate/pdp-discovery.ts
@@ -65375,22 +65498,22 @@ async function nodeFetchText(url) {
65375
65498
 
65376
65499
  // src/migrate/exporters/json.ts
65377
65500
  import { writeFileSync as writeFileSync21 } from "node:fs";
65378
- import { join as join23 } from "node:path";
65501
+ import { join as join24 } from "node:path";
65379
65502
  var jsonExporter2 = {
65380
65503
  name: "json",
65381
65504
  async export(bundle, outDir) {
65382
- writeFileSync21(join23(outDir, "manifest.json"), `${JSON.stringify(bundle, null, 2)}
65505
+ writeFileSync21(join24(outDir, "manifest.json"), `${JSON.stringify(bundle, null, 2)}
65383
65506
  `, "utf8");
65384
65507
  }
65385
65508
  };
65386
65509
 
65387
65510
  // src/migrate/exporters/markdown.ts
65388
65511
  import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync23 } from "node:fs";
65389
- import { join as join25 } from "node:path";
65512
+ import { join as join26 } from "node:path";
65390
65513
 
65391
65514
  // src/migrate/vtex/content-assets.ts
65392
65515
  import { mkdirSync as mkdirSync14, writeFileSync as writeFileSync22 } from "node:fs";
65393
- import { join as join24 } from "node:path";
65516
+ import { join as join25 } from "node:path";
65394
65517
  var MAX_IMAGES = 150;
65395
65518
  var IMG_EXT = /\.(jpe?g|png|webp|gif|svg|avif)(\?|#|$)/i;
65396
65519
  var VTEX_ASSET = /vtexassets\.com|vteximg\.com\.br|\/arquivos\/(ids|assets)\//i;
@@ -65499,7 +65622,7 @@ async function downloadContentImages(urls, runDir, fetchBytes) {
65499
65622
  const map = {};
65500
65623
  if (urls.length === 0)
65501
65624
  return { map, downloaded: 0, skipped: 0 };
65502
- const dir = join24(runDir, "assets", "content");
65625
+ const dir = join25(runDir, "assets", "content");
65503
65626
  mkdirSync14(dir, { recursive: true });
65504
65627
  const used = new Set;
65505
65628
  const take = urls.slice(0, MAX_IMAGES);
@@ -65509,7 +65632,7 @@ async function downloadContentImages(urls, runDir, fetchBytes) {
65509
65632
  if (!got)
65510
65633
  continue;
65511
65634
  const name = contentImageName(url, i, used);
65512
- writeFileSync22(join24(dir, name), got.buf);
65635
+ writeFileSync22(join25(dir, name), got.buf);
65513
65636
  map[url] = `assets/content/${name}`;
65514
65637
  downloaded++;
65515
65638
  }
@@ -65524,16 +65647,16 @@ var markdownExporter2 = {
65524
65647
  const notes = [];
65525
65648
  bundle.components.forEach((component, i) => {
65526
65649
  const dirName = dirNames[i];
65527
- const componentDir = join25(outDir, "components", dirName);
65650
+ const componentDir = join26(outDir, "components", dirName);
65528
65651
  mkdirSync15(componentDir, { recursive: true });
65529
65652
  const compact = compactComponentHtml(component.html);
65530
65653
  if (compact.collapsed > 0)
65531
65654
  notes.push(`\`${dirName}\`: collapsed ${compact.collapsed} repeated child element(s)`);
65532
65655
  if (compact.truncated)
65533
65656
  notes.push(`\`${dirName}\`: HTML truncated to fit the per-component token ceiling`);
65534
- writeFileSync23(join25(componentDir, "README.md"), renderComponentReadme2(bundle.url, component, compact.html), "utf8");
65657
+ writeFileSync23(join26(componentDir, "README.md"), renderComponentReadme2(bundle.url, component, compact.html), "utf8");
65535
65658
  });
65536
- writeFileSync23(join25(outDir, "index.md"), renderIndex2(bundle, notes), "utf8");
65659
+ writeFileSync23(join26(outDir, "index.md"), renderIndex2(bundle, notes), "utf8");
65537
65660
  }
65538
65661
  };
65539
65662
  function renderIndex2(bundle, notes) {
@@ -65735,8 +65858,8 @@ function escapePipes2(s) {
65735
65858
  }
65736
65859
 
65737
65860
  // src/migrate/exporters/html.ts
65738
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync24 } from "node:fs";
65739
- import { join as join26 } from "node:path";
65861
+ import { readFileSync as readFileSync20, writeFileSync as writeFileSync24 } from "node:fs";
65862
+ import { join as join27 } from "node:path";
65740
65863
 
65741
65864
  // src/migrate/targets/faststore-v4.ts
65742
65865
  function pickBreakpointTiers(breakpoints) {
@@ -66057,9 +66180,9 @@ var TARGET_NAMES = Object.keys(TARGETS);
66057
66180
  var htmlExporter = {
66058
66181
  name: "html",
66059
66182
  async export(bundle, outDir) {
66060
- writeFileSync24(join26(outDir, "index.html"), renderHtml(bundle, (p) => p ?? null), "utf8");
66061
- const inline = (p) => p ? dataUri2(join26(outDir, p)) ?? p : null;
66062
- writeFileSync24(join26(outDir, "report.html"), renderHtml(bundle, inline), "utf8");
66183
+ writeFileSync24(join27(outDir, "index.html"), renderHtml(bundle, (p) => p ?? null), "utf8");
66184
+ const inline = (p) => p ? dataUri2(join27(outDir, p)) ?? p : null;
66185
+ writeFileSync24(join27(outDir, "report.html"), renderHtml(bundle, inline), "utf8");
66063
66186
  }
66064
66187
  };
66065
66188
  var MIME2 = {
@@ -66077,7 +66200,7 @@ function dataUri2(absPath) {
66077
66200
  const mime = MIME2[ext];
66078
66201
  if (!mime)
66079
66202
  return null;
66080
- return `data:${mime};base64,${readFileSync19(absPath).toString("base64")}`;
66203
+ return `data:${mime};base64,${readFileSync20(absPath).toString("base64")}`;
66081
66204
  } catch {
66082
66205
  return null;
66083
66206
  }
@@ -66326,12 +66449,12 @@ function buildMigrationPrompt(bundle, playbook, source) {
66326
66449
  }
66327
66450
 
66328
66451
  // src/migrate/sources/deco-fresh.ts
66329
- import { existsSync as existsSync14, readFileSync as readFileSync20 } from "node:fs";
66330
- import { join as join28 } from "node:path";
66452
+ import { existsSync as existsSync14, readFileSync as readFileSync21 } from "node:fs";
66453
+ import { join as join29 } from "node:path";
66331
66454
 
66332
66455
  // src/migrate/sources/walk.ts
66333
- import { readdirSync as readdirSync3 } from "node:fs";
66334
- import { join as join27 } from "node:path";
66456
+ import { readdirSync as readdirSync4 } from "node:fs";
66457
+ import { join as join28 } from "node:path";
66335
66458
  var SKIP = new Set([
66336
66459
  "node_modules",
66337
66460
  ".git",
@@ -66347,7 +66470,7 @@ function walkFiles(dir, exts) {
66347
66470
  const recurse = (abs, rel) => {
66348
66471
  let entries;
66349
66472
  try {
66350
- entries = readdirSync3(abs, { withFileTypes: true });
66473
+ entries = readdirSync4(abs, { withFileTypes: true });
66351
66474
  } catch {
66352
66475
  return;
66353
66476
  }
@@ -66358,7 +66481,7 @@ function walkFiles(dir, exts) {
66358
66481
  continue;
66359
66482
  const childRel = rel ? `${rel}/${e.name}` : e.name;
66360
66483
  if (e.isDirectory()) {
66361
- recurse(join27(abs, e.name), childRel);
66484
+ recurse(join28(abs, e.name), childRel);
66362
66485
  } else if (exts.some((ext) => e.name.endsWith(ext))) {
66363
66486
  out.push(childRel);
66364
66487
  }
@@ -66370,15 +66493,15 @@ function walkFiles(dir, exts) {
66370
66493
 
66371
66494
  // src/migrate/sources/deco-fresh.ts
66372
66495
  function isDecoFresh(repoDir) {
66373
- const denoJson = join28(repoDir, "deno.json");
66374
- const denoJsonc = join28(repoDir, "deno.jsonc");
66496
+ const denoJson = join29(repoDir, "deno.json");
66497
+ const denoJsonc = join29(repoDir, "deno.jsonc");
66375
66498
  const file = existsSync14(denoJson) ? denoJson : existsSync14(denoJsonc) ? denoJsonc : null;
66376
66499
  if (!file)
66377
66500
  return false;
66378
- if (!existsSync14(join28(repoDir, "fresh.gen.ts")))
66501
+ if (!existsSync14(join29(repoDir, "fresh.gen.ts")))
66379
66502
  return false;
66380
66503
  try {
66381
- return readFileSync20(file, "utf8").includes("@deco/deco");
66504
+ return readFileSync21(file, "utf8").includes("@deco/deco");
66382
66505
  } catch {
66383
66506
  return false;
66384
66507
  }
@@ -66386,13 +66509,13 @@ function isDecoFresh(repoDir) {
66386
66509
  var GLOBAL_HINT = /\b(header|footer|navbar|menu|topbar)\b/i;
66387
66510
  function inventory(repoDir) {
66388
66511
  const components = [];
66389
- const sectionsDir = join28(repoDir, "sections");
66512
+ const sectionsDir = join29(repoDir, "sections");
66390
66513
  if (existsSync14(sectionsDir)) {
66391
66514
  for (const rel of walkFiles(sectionsDir, [".tsx"])) {
66392
66515
  const key = rel.replace(/\.tsx$/, "");
66393
66516
  components.push({
66394
66517
  name: key,
66395
- file: join28("sections", rel),
66518
+ file: join29("sections", rel),
66396
66519
  role: "section",
66397
66520
  scope: GLOBAL_HINT.test(key) ? "global" : "page"
66398
66521
  });
@@ -66401,9 +66524,9 @@ function inventory(repoDir) {
66401
66524
  const notes = [
66402
66525
  "Source: Deco on Fresh/Deno (Preact + signals, JSX). Sections are the CMS unit."
66403
66526
  ];
66404
- if (existsSync14(join28(repoDir, "islands")))
66527
+ if (existsSync14(join29(repoDir, "islands")))
66405
66528
  notes.push("Has islands/ — client-interactive components.");
66406
- if (existsSync14(join28(repoDir, "loaders")))
66529
+ if (existsSync14(join29(repoDir, "loaders")))
66407
66530
  notes.push("Has loaders/ — server data functions to port.");
66408
66531
  return { components, notes };
66409
66532
  }
@@ -66443,14 +66566,14 @@ captured HTML/computed-styles as the source of truth for structure and styling.`
66443
66566
  };
66444
66567
 
66445
66568
  // src/migrate/sources/vtex-io.ts
66446
- import { existsSync as existsSync15, readFileSync as readFileSync21 } from "node:fs";
66447
- import { join as join29 } from "node:path";
66569
+ import { existsSync as existsSync15, readFileSync as readFileSync22 } from "node:fs";
66570
+ import { join as join30 } from "node:path";
66448
66571
  function readManifest(repoDir) {
66449
- const file = join29(repoDir, "manifest.json");
66572
+ const file = join30(repoDir, "manifest.json");
66450
66573
  if (!existsSync15(file))
66451
66574
  return null;
66452
66575
  try {
66453
- return JSON.parse(readFileSync21(file, "utf8"));
66576
+ return JSON.parse(readFileSync22(file, "utf8"));
66454
66577
  } catch {
66455
66578
  return null;
66456
66579
  }
@@ -66471,14 +66594,14 @@ function blockName(id) {
66471
66594
  }
66472
66595
  var GLOBAL_HINT2 = /header|footer|menu|minicart|navbar/i;
66473
66596
  function inventory2(repoDir) {
66474
- const blocksDir = join29(repoDir, "store", "blocks");
66597
+ const blocksDir = join30(repoDir, "store", "blocks");
66475
66598
  const seen = new Map;
66476
66599
  if (existsSync15(blocksDir)) {
66477
66600
  for (const rel of walkFiles(blocksDir, [".json", ".jsonc"])) {
66478
- const abs = join29(blocksDir, rel);
66601
+ const abs = join30(blocksDir, rel);
66479
66602
  let parsed;
66480
66603
  try {
66481
- parsed = JSON.parse(stripJsonc(readFileSync21(abs, "utf8")));
66604
+ parsed = JSON.parse(stripJsonc(readFileSync22(abs, "utf8")));
66482
66605
  } catch {
66483
66606
  continue;
66484
66607
  }
@@ -66488,7 +66611,7 @@ function inventory2(repoDir) {
66488
66611
  continue;
66489
66612
  seen.set(name, {
66490
66613
  name,
66491
- file: join29("store", "blocks", rel),
66614
+ file: join30("store", "blocks", rel),
66492
66615
  role: "section",
66493
66616
  scope: GLOBAL_HINT2.test(name) ? "global" : "page"
66494
66617
  });
@@ -66522,8 +66645,8 @@ CMS placeholders.`
66522
66645
  };
66523
66646
 
66524
66647
  // src/migrate/sources/find.ts
66525
- import { existsSync as existsSync16, readdirSync as readdirSync4, statSync } from "node:fs";
66526
- import { basename as basename3, join as join30, resolve as resolve5 } from "node:path";
66648
+ import { existsSync as existsSync16, readdirSync as readdirSync5, statSync } from "node:fs";
66649
+ import { basename as basename4, join as join31, resolve as resolve6 } from "node:path";
66527
66650
  var GENERIC_LABELS = new Set(["www", "m", "www2", "loja", "shop", "store", "secure", "web"]);
66528
66651
  var TARGET_SUFFIXES = ["-tanstack", "-faststore", "-next", "-cand", "-candidate", "-migration"];
66529
66652
  var IGNORED_DIRS = new Set(["node_modules", ".git", "dist", "build", ".next", "_archive"]);
@@ -66550,7 +66673,7 @@ function isDir(p) {
66550
66673
  }
66551
66674
  }
66552
66675
  function scoreCandidate(dir, slug) {
66553
- const name = basename3(dir);
66676
+ const name = basename4(dir);
66554
66677
  const n = norm(name);
66555
66678
  const s = norm(slug);
66556
66679
  if (!n.startsWith(s))
@@ -66580,23 +66703,23 @@ function scoreCandidate(dir, slug) {
66580
66703
  }
66581
66704
  function findSourceCandidates(opts) {
66582
66705
  const slug = slugFromUrl(opts.url);
66583
- const roots = opts.roots.map((r) => resolve5(r)).filter((r) => existsSync16(r) && isDir(r));
66706
+ const roots = opts.roots.map((r) => resolve6(r)).filter((r) => existsSync16(r) && isDir(r));
66584
66707
  if (!slug)
66585
66708
  return { roots, candidates: [] };
66586
- const excluded = new Set((opts.exclude ?? []).map((p) => resolve5(p)));
66709
+ const excluded = new Set((opts.exclude ?? []).map((p) => resolve6(p)));
66587
66710
  const seen = new Set;
66588
66711
  const candidates = [];
66589
66712
  for (const root of roots) {
66590
66713
  let entries;
66591
66714
  try {
66592
- entries = readdirSync4(root);
66715
+ entries = readdirSync5(root);
66593
66716
  } catch {
66594
66717
  continue;
66595
66718
  }
66596
66719
  for (const entry of entries) {
66597
66720
  if (IGNORED_DIRS.has(entry) || entry.startsWith("."))
66598
66721
  continue;
66599
- const dir = join30(root, entry);
66722
+ const dir = join31(root, entry);
66600
66723
  if (seen.has(dir) || excluded.has(dir) || !isDir(dir))
66601
66724
  continue;
66602
66725
  seen.add(dir);
@@ -66610,10 +66733,10 @@ function findSourceCandidates(opts) {
66610
66733
  }
66611
66734
  function defaultSearchRoots(opts = {}) {
66612
66735
  const cwd = opts.cwd ?? process.cwd();
66613
- const roots = [join30(cwd, ".."), join30(cwd, "..", "..")];
66736
+ const roots = [join31(cwd, ".."), join31(cwd, "..", "..")];
66614
66737
  if (opts.targetDir)
66615
- roots.push(join30(opts.targetDir, ".."), join30(opts.targetDir, "..", ".."));
66616
- return [...new Set(roots.map((r) => resolve5(r)))];
66738
+ roots.push(join31(opts.targetDir, ".."), join31(opts.targetDir, "..", ".."));
66739
+ return [...new Set(roots.map((r) => resolve6(r)))];
66617
66740
  }
66618
66741
  function formatSourceHunt(result) {
66619
66742
  const searched = result.roots.length ? result.roots.map((r) => ` - ${r}`).join(`
@@ -66644,8 +66767,8 @@ function formatSourceHunt(result) {
66644
66767
  `);
66645
66768
  }
66646
66769
  // src/migrate/sources/project.ts
66647
- import { existsSync as existsSync17, readFileSync as readFileSync22, readdirSync as readdirSync5 } from "node:fs";
66648
- import { join as join31 } from "node:path";
66770
+ import { existsSync as existsSync17, readFileSync as readFileSync23, readdirSync as readdirSync6 } from "node:fs";
66771
+ import { join as join32 } from "node:path";
66649
66772
  var MAX_PROPS_CHARS = 4000;
66650
66773
  var MAX_PAGES = 60;
66651
66774
  var MAX_SECTIONS_PER_PAGE = 40;
@@ -66716,10 +66839,10 @@ function classifyImports(source, fromFile) {
66716
66839
  };
66717
66840
  }
66718
66841
  function readComponentDetail(repoDir, file) {
66719
- const abs = join31(repoDir, file);
66842
+ const abs = join32(repoDir, file);
66720
66843
  let source;
66721
66844
  try {
66722
- source = readFileSync22(abs, "utf8");
66845
+ source = readFileSync23(abs, "utf8");
66723
66846
  } catch {
66724
66847
  return null;
66725
66848
  }
@@ -66742,15 +66865,15 @@ var TOKEN_CANDIDATES = [
66742
66865
  "styles/configs/color.json"
66743
66866
  ];
66744
66867
  function findTokenFiles(repoDir) {
66745
- return TOKEN_CANDIDATES.filter((f) => existsSync17(join31(repoDir, f)));
66868
+ return TOKEN_CANDIDATES.filter((f) => existsSync17(join32(repoDir, f)));
66746
66869
  }
66747
66870
  function readDecoPages(repoDir) {
66748
- const blocksDir = join31(repoDir, ".deco", "blocks");
66871
+ const blocksDir = join32(repoDir, ".deco", "blocks");
66749
66872
  if (!existsSync17(blocksDir))
66750
66873
  return { pages: [], total: 0 };
66751
66874
  let files;
66752
66875
  try {
66753
- files = readdirSync5(blocksDir).filter((f) => f.startsWith("pages-") && f.endsWith(".json"));
66876
+ files = readdirSync6(blocksDir).filter((f) => f.startsWith("pages-") && f.endsWith(".json"));
66754
66877
  } catch {
66755
66878
  return { pages: [], total: 0 };
66756
66879
  }
@@ -66760,7 +66883,7 @@ function readDecoPages(repoDir) {
66760
66883
  break;
66761
66884
  let parsed;
66762
66885
  try {
66763
- parsed = JSON.parse(readFileSync22(join31(blocksDir, file), "utf8"));
66886
+ parsed = JSON.parse(readFileSync23(join32(blocksDir, file), "utf8"));
66764
66887
  } catch {
66765
66888
  continue;
66766
66889
  }
@@ -67310,22 +67433,22 @@ async function captureInteractions(page, selector) {
67310
67433
  async function migrateCommand(opts) {
67311
67434
  const viewport = parseViewport3(opts.viewport);
67312
67435
  if (!viewport) {
67313
- console.error(chalk20.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
67436
+ console.error(chalk21.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
67314
67437
  return 2;
67315
67438
  }
67316
67439
  const viewports = (opts.viewports ? opts.viewports.split(",") : [opts.viewport]).map((v) => parseViewport3(v.trim())).filter((v) => Boolean(v));
67317
67440
  if (viewports.length === 0) {
67318
- console.error(chalk20.red(`--viewports inválido: ${opts.viewports}`));
67441
+ console.error(chalk21.red(`--viewports inválido: ${opts.viewports}`));
67319
67442
  return 2;
67320
67443
  }
67321
67444
  const primaryViewport = viewports[0];
67322
67445
  if (!isValidUrl4(opts.url)) {
67323
- console.error(chalk20.red(`--url inválido: ${opts.url}`));
67446
+ console.error(chalk21.red(`--url inválido: ${opts.url}`));
67324
67447
  return 2;
67325
67448
  }
67326
67449
  const format = normalizeFormat2(opts.format);
67327
67450
  if (!format) {
67328
- console.error(chalk20.red(`--format inválido: ${opts.format} (use md|json|both)`));
67451
+ console.error(chalk21.red(`--format inválido: ${opts.format} (use md|json|both)`));
67329
67452
  return 2;
67330
67453
  }
67331
67454
  let pageTokens;
@@ -67335,14 +67458,14 @@ async function migrateCommand(opts) {
67335
67458
  fallback: ["/", "category-auto", "pdp-auto"]
67336
67459
  });
67337
67460
  } catch (err) {
67338
- console.error(chalk20.red(err.message));
67461
+ console.error(chalk21.red(err.message));
67339
67462
  return 2;
67340
67463
  }
67341
67464
  let playbook;
67342
67465
  if (opts.target) {
67343
67466
  playbook = getTargetPlaybook(opts.target);
67344
67467
  if (!playbook) {
67345
- console.error(chalk20.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
67468
+ console.error(chalk21.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
67346
67469
  return 2;
67347
67470
  }
67348
67471
  }
@@ -67352,7 +67475,7 @@ async function migrateCommand(opts) {
67352
67475
  if (opts.sourceKind) {
67353
67476
  const s = getSource(opts.sourceKind);
67354
67477
  if (!s) {
67355
- console.error(chalk20.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
67478
+ console.error(chalk21.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
67356
67479
  return 2;
67357
67480
  }
67358
67481
  source = s;
@@ -67361,32 +67484,32 @@ async function migrateCommand(opts) {
67361
67484
  let sourceProject = null;
67362
67485
  if (opts.source) {
67363
67486
  if (!existsSync18(opts.source)) {
67364
- console.error(chalk20.red(`--source não encontrado: ${opts.source}`));
67487
+ console.error(chalk21.red(`--source não encontrado: ${opts.source}`));
67365
67488
  return 2;
67366
67489
  }
67367
67490
  if (!opts.sourceKind)
67368
67491
  source = detectSource(opts.source);
67369
67492
  sourceInventory = source.inventory(opts.source);
67370
- console.log(chalk20.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
67493
+ console.log(chalk21.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
67371
67494
  sourceProject = readSourceProject(opts.source, sourceInventory.components);
67372
67495
  for (const note of sourceProject.notes)
67373
- console.log(chalk20.dim(` ${note}`));
67496
+ console.log(chalk21.dim(` ${note}`));
67374
67497
  } else if (!opts.noSourceHunt) {
67375
67498
  sourceHunt = findSourceCandidates({
67376
67499
  url: opts.url,
67377
67500
  roots: defaultSearchRoots()
67378
67501
  });
67379
67502
  const message = formatSourceHunt(sourceHunt);
67380
- console.log(sourceHunt.candidates.length > 0 ? chalk20.yellow(message) : chalk20.dim(message));
67503
+ console.log(sourceHunt.candidates.length > 0 ? chalk21.yellow(message) : chalk21.dim(message));
67381
67504
  }
67382
67505
  const host = safeHost6(opts.url);
67383
- const runDir = resolve6(opts.outDir, host);
67506
+ const runDir = resolve7(opts.outDir, host);
67384
67507
  mkdirSync16(runDir, { recursive: true });
67385
67508
  const browser = await launchBrowser({ headless: true });
67386
67509
  try {
67387
- const themePath = resolve6(runDir, "theme.json");
67388
- const assetsPath = resolve6(runDir, "assets.json");
67389
- const blocksPath = resolve6(runDir, "blocks.json");
67510
+ const themePath = resolve7(runDir, "theme.json");
67511
+ const assetsPath = resolve7(runDir, "assets.json");
67512
+ const blocksPath = resolve7(runDir, "blocks.json");
67390
67513
  let theme;
67391
67514
  let platform;
67392
67515
  let stack = null;
@@ -67401,10 +67524,10 @@ async function migrateCommand(opts) {
67401
67524
  stack = meta.stack ?? null;
67402
67525
  assets = meta.assets;
67403
67526
  screenshots = meta.screenshots ?? [];
67404
- console.log(chalk20.dim(" phase 1 theme+assets: cached"));
67527
+ console.log(chalk21.dim(" phase 1 theme+assets: cached"));
67405
67528
  } else {
67406
- console.log(chalk20.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67407
- mkdirSync16(resolve6(runDir, "screenshots"), { recursive: true });
67529
+ console.log(chalk21.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
67530
+ mkdirSync16(resolve7(runDir, "screenshots"), { recursive: true });
67408
67531
  const samples = [];
67409
67532
  screenshots = [];
67410
67533
  let platformSeen = null;
@@ -67419,7 +67542,7 @@ async function migrateCommand(opts) {
67419
67542
  });
67420
67543
  await settlePage(page, { fonts: false, layoutStable: false });
67421
67544
  samples.push(await scrapeThemeSamples(page));
67422
- const shot = resolve6(runDir, "screenshots", `${vp}.png`);
67545
+ const shot = resolve7(runDir, "screenshots", `${vp}.png`);
67423
67546
  await page.screenshot({ path: shot, fullPage: true, animations: "disabled", timeout: 15000 }).then(() => screenshots.push({ viewport: vp, path: `screenshots/${vp}.png` })).catch(() => {
67424
67547
  return;
67425
67548
  });
@@ -67428,16 +67551,16 @@ async function migrateCommand(opts) {
67428
67551
  platformSeen = detectPlatform({ url: opts.url, html: pageHtml });
67429
67552
  const cookieNames = await ctx.cookies().then((cs) => cs.map((c) => c.name).join("; ")).catch(() => "");
67430
67553
  stack = classifyLiveStack(pageHtml, cookieNames);
67431
- console.log(chalk20.dim(` stack: ${describeStack(stack)}`));
67554
+ console.log(chalk21.dim(` stack: ${describeStack(stack)}`));
67432
67555
  if (!opts.source && stack.frontend !== "unknown") {
67433
- console.warn(chalk20.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67556
+ console.warn(chalk21.red(` ! live-only capture, but the live HTML is ${stack.frontend} (${stack.evidence.join(", ")}) — a source repo exists.
67434
67557
  Re-run with --source <repo> for structural porting (real class strings, not measured pixels).`));
67435
67558
  }
67436
67559
  const rawAssets = await collectSiteAssets(page);
67437
67560
  const fetchBytes = async (url) => await browserFetchBytes(page, url) ?? await nodeFetchBytes(url);
67438
67561
  assetsResolved = await downloadSiteAssets(rawAssets, runDir, fetchBytes);
67439
67562
  if (rawAssets.logo?.type === "svg" || rawAssets.logo && !assetsResolved.logo) {
67440
- const logoPng = resolve6(runDir, "assets", "logo.png");
67563
+ const logoPng = resolve7(runDir, "assets", "logo.png");
67441
67564
  const ok = await page.locator("[data-parity-logo]").first().screenshot({ path: logoPng, timeout: 8000 }).then(() => true).catch(() => false);
67442
67565
  if (ok) {
67443
67566
  assetsResolved.logo = "assets/logo.png";
@@ -67462,13 +67585,13 @@ async function migrateCommand(opts) {
67462
67585
  writeFileSync25(assetsPath, `${JSON.stringify({ platform, stack, assets, screenshots }, null, 2)}
67463
67586
  `, "utf8");
67464
67587
  }
67465
- const sitemapPath = resolve6(runDir, "sitemap.json");
67588
+ const sitemapPath = resolve7(runDir, "sitemap.json");
67466
67589
  let resolvedPages;
67467
67590
  if (!opts.refresh && existsSync18(sitemapPath)) {
67468
67591
  resolvedPages = readJson(sitemapPath).pages;
67469
- console.log(chalk20.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
67592
+ console.log(chalk21.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
67470
67593
  } else {
67471
- console.log(chalk20.dim(" phase 2 sitemap: resolving pages…"));
67594
+ console.log(chalk21.dim(" phase 2 sitemap: resolving pages…"));
67472
67595
  const ctx = await newContext(browser, { viewport: primaryViewport });
67473
67596
  const page = await ctx.newPage();
67474
67597
  let sitemapUrls = [];
@@ -67496,16 +67619,16 @@ async function migrateCommand(opts) {
67496
67619
  a[p.kind] = (a[p.kind] ?? 0) + 1;
67497
67620
  return a;
67498
67621
  }, {});
67499
- console.log(chalk20.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
67622
+ console.log(chalk21.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
67500
67623
  }
67501
67624
  writeFileSync25(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
67502
67625
  `, "utf8");
67503
67626
  }
67504
67627
  if (resolvedPages.length === 0) {
67505
- console.error(chalk20.red("nenhuma página resolvida a partir de --pages"));
67628
+ console.error(chalk21.red("nenhuma página resolvida a partir de --pages"));
67506
67629
  return 1;
67507
67630
  }
67508
- const capturePath = resolve6(runDir, "capture.json");
67631
+ const capturePath = resolve7(runDir, "capture.json");
67509
67632
  let pages;
67510
67633
  let components;
67511
67634
  if (!opts.refresh && existsSync18(capturePath)) {
@@ -67514,9 +67637,9 @@ async function migrateCommand(opts) {
67514
67637
  components = cached.components;
67515
67638
  vtexBlocks = cached.vtexBlocks ?? null;
67516
67639
  contentMap = cached.contentMap ?? {};
67517
- console.log(chalk20.dim(` phase 3 components: cached (${components.length})`));
67640
+ console.log(chalk21.dim(` phase 3 components: cached (${components.length})`));
67518
67641
  } else {
67519
- console.log(chalk20.dim(" phase 3 components: capturing…"));
67642
+ console.log(chalk21.dim(" phase 3 components: capturing…"));
67520
67643
  ({ pages, components, vtexBlocks, contentMap } = await capturePages(browser, primaryViewport, resolvedPages, theme, {
67521
67644
  allowlist,
67522
67645
  llm: !opts.noLlm,
@@ -67531,7 +67654,7 @@ async function migrateCommand(opts) {
67531
67654
  writeFileSync25(blocksPath, `${JSON.stringify(vtexBlocks, null, 2)}
67532
67655
  `, "utf8");
67533
67656
  if (Object.keys(contentMap).length)
67534
- writeFileSync25(resolve6(runDir, "content-assets.json"), `${JSON.stringify(contentMap, null, 2)}
67657
+ writeFileSync25(resolve7(runDir, "content-assets.json"), `${JSON.stringify(contentMap, null, 2)}
67535
67658
  `, "utf8");
67536
67659
  const bundle = {
67537
67660
  url: opts.url,
@@ -67576,16 +67699,16 @@ async function migrateCommand(opts) {
67576
67699
  const plan = merged.plan;
67577
67700
  savePlan(runDir, plan);
67578
67701
  if (sourceProject) {
67579
- const projectPath = resolve6(runDir, "source-project.json");
67702
+ const projectPath = resolve7(runDir, "source-project.json");
67580
67703
  writeFileSync25(projectPath, `${JSON.stringify(sourceProject, null, 2)}
67581
67704
  `, "utf8");
67582
- console.log(chalk20.dim(` source-project.json — ${sourceProject.totals.components} component detail(s), ${sourceProject.totals.pages} CMS page(s), ${sourceProject.tokenFiles.length} token file(s)`));
67705
+ 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)`));
67583
67706
  }
67584
67707
  if (merged.carried.length) {
67585
- console.log(chalk20.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
67708
+ console.log(chalk21.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
67586
67709
  }
67587
67710
  if (merged.keptUncaptured.length) {
67588
- console.log(chalk20.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.`));
67711
+ 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.`));
67589
67712
  }
67590
67713
  bundle.components.push(...syntheticSourceComponents(plan));
67591
67714
  if (format === "json" || format === "both")
@@ -67593,17 +67716,17 @@ async function migrateCommand(opts) {
67593
67716
  if (format === "md" || format === "both") {
67594
67717
  await markdownExporter2.export(bundle, runDir);
67595
67718
  await htmlExporter.export(bundle, runDir);
67596
- writeFileSync25(resolve6(runDir, "MIGRATION_PROMPT.md"), buildMigrationPrompt(bundle, playbook, {
67719
+ writeFileSync25(resolve7(runDir, "MIGRATION_PROMPT.md"), buildMigrationPrompt(bundle, playbook, {
67597
67720
  playbook: source.playbook,
67598
67721
  notes: sourceInventory.notes
67599
67722
  }), "utf8");
67600
67723
  }
67601
67724
  const targetTheme = opts.target ? getTargetTheme(opts.target) : null;
67602
67725
  if (targetTheme) {
67603
- writeFileSync25(resolve6(runDir, targetTheme.filename), targetTheme.build(theme), "utf8");
67726
+ writeFileSync25(resolve7(runDir, targetTheme.filename), targetTheme.build(theme), "utf8");
67604
67727
  }
67605
67728
  if (bundle.vtex) {
67606
- writeFileSync25(resolve6(runDir, "component-map.json"), `${JSON.stringify(bundle.vtex.map, null, 2)}
67729
+ writeFileSync25(resolve7(runDir, "component-map.json"), `${JSON.stringify(bundle.vtex.map, null, 2)}
67607
67730
  `, "utf8");
67608
67731
  }
67609
67732
  if (opts.json) {
@@ -67612,7 +67735,7 @@ async function migrateCommand(opts) {
67612
67735
  }
67613
67736
  printResults4(runDir, bundle);
67614
67737
  if (opts.open && format !== "json") {
67615
- await open(resolve6(runDir, "report.html")).catch(() => {
67738
+ await open(resolve7(runDir, "report.html")).catch(() => {
67616
67739
  return;
67617
67740
  });
67618
67741
  }
@@ -67656,7 +67779,7 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
67656
67779
  if (global)
67657
67780
  seenGlobalRoles.add(component.role);
67658
67781
  const idx = components.length + 1;
67659
- const componentDir = resolve6(cfg.runDir, "components", componentDirName(component.role, idx));
67782
+ const componentDir = resolve7(cfg.runDir, "components", componentDirName(component.role, idx));
67660
67783
  const extracted = await extractComponent(page, component, {
67661
67784
  outDir: componentDir,
67662
67785
  index: idx,
@@ -67709,12 +67832,12 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67709
67832
  if (plp)
67710
67833
  out.push({ path: token, url: plp, kind: "plp" });
67711
67834
  else
67712
- console.warn(chalk20.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
67835
+ console.warn(chalk21.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
67713
67836
  continue;
67714
67837
  }
67715
67838
  if (token === "pdp-auto") {
67716
67839
  if (!plp) {
67717
- console.warn(chalk20.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
67840
+ console.warn(chalk21.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
67718
67841
  continue;
67719
67842
  }
67720
67843
  let html = null;
@@ -67731,7 +67854,7 @@ async function resolvePages2(page, baseUrl, tokens, homeHtml, platform) {
67731
67854
  if (pdp)
67732
67855
  out.push({ path: token, url: pdp, kind: "pdp" });
67733
67856
  else
67734
- console.warn(chalk20.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
67857
+ console.warn(chalk21.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
67735
67858
  continue;
67736
67859
  }
67737
67860
  try {
@@ -67825,31 +67948,31 @@ function kindOf(url) {
67825
67948
  }
67826
67949
  }
67827
67950
  function printResults4(runDir, bundle) {
67828
- console.log(chalk20.bold(`
67951
+ console.log(chalk21.bold(`
67829
67952
  parity migrate`));
67830
- console.log(chalk20.dim(` url: ${bundle.url}`));
67831
- console.log(chalk20.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
67832
- console.log(chalk20.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
67833
- console.log(chalk20.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
67834
- console.log(chalk20.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
67953
+ console.log(chalk21.dim(` url: ${bundle.url}`));
67954
+ console.log(chalk21.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
67955
+ console.log(chalk21.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
67956
+ console.log(chalk21.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
67957
+ console.log(chalk21.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
67835
67958
  if (bundle.vtex) {
67836
67959
  const mapped = bundle.vtex.map.filter((m) => m.strategy === "mapped").length;
67837
67960
  const withContent = bundle.vtex.blocks.filter((x) => x.props).length;
67838
67961
  const contentImgs = countContentImages(bundle.vtex.blocks);
67839
- console.log(chalk20.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
67962
+ 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`));
67840
67963
  }
67841
- console.log(chalk20.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
67842
- console.log(chalk20.dim(` out: ${runDir}`));
67964
+ console.log(chalk21.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
67965
+ console.log(chalk21.dim(` out: ${runDir}`));
67843
67966
  console.log("");
67844
- console.log(chalk20.bold(` ${bundle.components.length} component(s):`));
67967
+ console.log(chalk21.bold(` ${bundle.components.length} component(s):`));
67845
67968
  for (const c of bundle.components) {
67846
- console.log(` ${chalk20.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk20.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
67969
+ console.log(` ${chalk21.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk21.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
67847
67970
  }
67848
67971
  console.log("");
67849
67972
  }
67850
67973
  function readJson(path) {
67851
67974
  try {
67852
- return JSON.parse(readFileSync23(path, "utf8"));
67975
+ return JSON.parse(readFileSync24(path, "utf8"));
67853
67976
  } catch {
67854
67977
  return null;
67855
67978
  }
@@ -67892,67 +68015,67 @@ function isValidUrl4(s) {
67892
68015
  }
67893
68016
 
67894
68017
  // src/commands/plan.ts
67895
- import { readFileSync as readFileSync24 } from "node:fs";
67896
- import chalk21 from "chalk";
68018
+ import { readFileSync as readFileSync25 } from "node:fs";
68019
+ import chalk22 from "chalk";
67897
68020
  var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
67898
68021
  var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
67899
68022
  function planSetStatusCommand(dir, name, status, opts = {}) {
67900
68023
  if (!STATUSES.includes(status)) {
67901
- console.error(chalk21.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
68024
+ console.error(chalk22.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
67902
68025
  return 1;
67903
68026
  }
67904
68027
  const plan = loadPlan(dir);
67905
68028
  if (!plan) {
67906
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68029
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
67907
68030
  return 1;
67908
68031
  }
67909
68032
  const existed = plan.components.length;
67910
68033
  const component = setComponentStatus(plan, name, status, opts.create ? { create: { scope: opts.create } } : {});
67911
68034
  if (!component) {
67912
- console.error(chalk21.red(`No component matching "${name}" in the plan`));
67913
- console.error(chalk21.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."));
68035
+ console.error(chalk22.red(`No component matching "${name}" in the plan`));
68036
+ 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."));
67914
68037
  return 1;
67915
68038
  }
67916
68039
  if (plan.components.length > existed) {
67917
- console.log(chalk21.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
68040
+ console.log(chalk22.yellow(` + created ${component.name} (${opts.create}, origin: manual) — not from the capture`));
67918
68041
  }
67919
68042
  savePlan(dir, plan);
67920
- console.log(`${chalk21.green("✓")} ${component.name} → ${status}`);
68043
+ console.log(`${chalk22.green("✓")} ${component.name} → ${status}`);
67921
68044
  if ((status === "upgrade" || status === "as-is") && !component.reference) {
67922
- console.log(chalk21.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
68045
+ console.log(chalk22.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
67923
68046
  }
67924
68047
  return 0;
67925
68048
  }
67926
68049
  function planSetPageStatusCommand(dir, path, status) {
67927
68050
  if (!PAGE_STATUSES.includes(status)) {
67928
- console.error(chalk21.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
68051
+ console.error(chalk22.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
67929
68052
  return 1;
67930
68053
  }
67931
68054
  const plan = loadPlan(dir);
67932
68055
  if (!plan) {
67933
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68056
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
67934
68057
  return 1;
67935
68058
  }
67936
68059
  const page = setPageStatus(plan, path, status);
67937
68060
  if (!page) {
67938
- console.error(chalk21.red(`No page matching "${path}" in the plan`));
68061
+ console.error(chalk22.red(`No page matching "${path}" in the plan`));
67939
68062
  return 1;
67940
68063
  }
67941
68064
  savePlan(dir, plan);
67942
- console.log(`${chalk21.green("✓")} ${page.path} → ${status}`);
68065
+ console.log(`${chalk22.green("✓")} ${page.path} → ${status}`);
67943
68066
  return 0;
67944
68067
  }
67945
68068
  var DISPOSITION_STYLE = {
67946
- build: chalk21.red,
67947
- validate: chalk21.yellow,
67948
- upgrade: chalk21.cyan,
67949
- "as-is": chalk21.gray,
67950
- settled: chalk21.green
68069
+ build: chalk22.red,
68070
+ validate: chalk22.yellow,
68071
+ upgrade: chalk22.cyan,
68072
+ "as-is": chalk22.gray,
68073
+ settled: chalk22.green
67951
68074
  };
67952
68075
  function planSetReferenceCommand(dir, name, opts) {
67953
68076
  const plan = loadPlan(dir);
67954
68077
  if (!plan) {
67955
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68078
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
67956
68079
  return 1;
67957
68080
  }
67958
68081
  const component = setComponentReference(plan, name, {
@@ -67961,76 +68084,76 @@ function planSetReferenceCommand(dir, name, opts) {
67961
68084
  note: opts.note
67962
68085
  });
67963
68086
  if (!component) {
67964
- console.error(chalk21.red(`No component matching "${name}" in the plan`));
68087
+ console.error(chalk22.red(`No component matching "${name}" in the plan`));
67965
68088
  return 1;
67966
68089
  }
67967
68090
  savePlan(dir, plan);
67968
- console.log(`${chalk21.green("✓")} ${component.name} → reference ${component.reference?.url}`);
68091
+ console.log(`${chalk22.green("✓")} ${component.name} → reference ${component.reference?.url}`);
67969
68092
  return 0;
67970
68093
  }
67971
68094
  function planVerifyCommand(dir, name, verdict, opts) {
67972
68095
  if (verdict !== "pass" && verdict !== "fail" && verdict !== "inconclusive") {
67973
- console.error(chalk21.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
68096
+ console.error(chalk22.red(`Invalid verdict "${verdict}". Use pass, fail or inconclusive.`));
67974
68097
  return 1;
67975
68098
  }
67976
68099
  const plan = loadPlan(dir);
67977
68100
  if (!plan) {
67978
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68101
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
67979
68102
  return 1;
67980
68103
  }
67981
68104
  const component = setComponentVerified(plan, name, verdict, opts.at ?? new Date().toISOString(), opts.note);
67982
68105
  if (!component) {
67983
- console.error(chalk21.red(`No component matching "${name}" in the plan`));
68106
+ console.error(chalk22.red(`No component matching "${name}" in the plan`));
67984
68107
  return 1;
67985
68108
  }
67986
68109
  savePlan(dir, plan);
67987
- const mark = verdict === "pass" ? chalk21.green("✓") : verdict === "inconclusive" ? chalk21.yellow("?") : chalk21.red("✗");
68110
+ const mark = verdict === "pass" ? chalk22.green("✓") : verdict === "inconclusive" ? chalk22.yellow("?") : chalk22.red("✗");
67988
68111
  console.log(`${mark} ${component.name} → ${verdict} (against ${component.verified?.against})`);
67989
68112
  return 0;
67990
68113
  }
67991
68114
  function planMergeCommand(dir, sourceDir) {
67992
68115
  const fresh = loadPlan(sourceDir);
67993
68116
  if (!fresh) {
67994
- console.error(chalk21.red(`No migration-plan.json found in ${sourceDir}`));
68117
+ console.error(chalk22.red(`No migration-plan.json found in ${sourceDir}`));
67995
68118
  return 1;
67996
68119
  }
67997
68120
  const existing = loadPlan(dir);
67998
68121
  const { plan, carried, keptUncaptured } = mergePlanDecisions(fresh, existing);
67999
68122
  savePlan(dir, plan);
68000
68123
  if (!existing) {
68001
- console.log(`${chalk21.green("✓")} plan written to ${dir} (nothing to merge)`);
68124
+ console.log(`${chalk22.green("✓")} plan written to ${dir} (nothing to merge)`);
68002
68125
  return 0;
68003
68126
  }
68004
- console.log(`${chalk21.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
68127
+ console.log(`${chalk22.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
68005
68128
  if (keptUncaptured.length) {
68006
- console.log(chalk21.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
68129
+ console.log(chalk22.yellow(` kept although no longer in the capture: ${keptUncaptured.join(", ")}`));
68007
68130
  }
68008
68131
  return 0;
68009
68132
  }
68010
68133
  function planPageCommand(dir, path, opts) {
68011
68134
  const plan = loadPlan(dir);
68012
68135
  if (!plan) {
68013
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68136
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68014
68137
  return 1;
68015
68138
  }
68016
68139
  const page = pagePlan(plan, path, opts.cand);
68017
68140
  if (!page) {
68018
- console.error(chalk21.red(`No page matching "${path}" in the plan`));
68019
- console.error(chalk21.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
68141
+ console.error(chalk22.red(`No page matching "${path}" in the plan`));
68142
+ console.error(chalk22.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
68020
68143
  return 1;
68021
68144
  }
68022
68145
  if (opts.json) {
68023
68146
  console.log(JSON.stringify(page, null, 2));
68024
68147
  return 0;
68025
68148
  }
68026
- console.log(chalk21.bold(`
68027
- ${page.path} ${chalk21.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk21.green(" ready") : ""));
68149
+ console.log(chalk22.bold(`
68150
+ ${page.path} ${chalk22.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk22.green(" ready") : ""));
68028
68151
  if (page.tasks === null) {
68029
- console.log(chalk21.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
68152
+ 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"));
68030
68153
  return 0;
68031
68154
  }
68032
68155
  if (page.tasks.length === 0) {
68033
- console.log(chalk21.gray(`
68156
+ console.log(chalk22.gray(`
68034
68157
  The capture saw no components on this page.
68035
68158
  `));
68036
68159
  return 0;
@@ -68041,20 +68164,20 @@ ${page.path} ${chalk21.gray(`(${page.kind})`)} — ${page.status}`) + (page.read
68041
68164
  if (!rows.length)
68042
68165
  continue;
68043
68166
  console.log(`
68044
- ${DISPOSITION_STYLE[d](chalk21.bold(d))} (${rows.length})`);
68167
+ ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
68045
68168
  for (const t of rows) {
68046
- console.log(` ${t.name} ${chalk21.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
68169
+ console.log(` ${t.name} ${chalk22.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
68047
68170
  if (t.note)
68048
- console.log(chalk21.gray(` why: ${t.note}`));
68171
+ console.log(chalk22.gray(` why: ${t.note}`));
68049
68172
  if (t.against?.kind === "reference") {
68050
- console.log(chalk21.cyan(` reference: ${t.against.url}`));
68173
+ console.log(chalk22.cyan(` reference: ${t.against.url}`));
68051
68174
  }
68052
68175
  if (t.command)
68053
- console.log(chalk21.gray(` $ ${t.command}`));
68176
+ console.log(chalk22.gray(` $ ${t.command}`));
68054
68177
  }
68055
68178
  }
68056
68179
  if (page.counts.validate > 0 && !opts.cand) {
68057
- console.log(chalk21.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
68180
+ console.log(chalk22.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
68058
68181
  }
68059
68182
  console.log("");
68060
68183
  return 0;
@@ -68062,8 +68185,8 @@ ${DISPOSITION_STYLE[d](chalk21.bold(d))} (${rows.length})`);
68062
68185
  function planStatusCommand(dir, asJson) {
68063
68186
  const plan = loadPlan(dir);
68064
68187
  if (!plan) {
68065
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68066
- console.error(chalk21.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
68188
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68189
+ console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
68067
68190
  return 1;
68068
68191
  }
68069
68192
  const p = planProgress(plan);
@@ -68074,59 +68197,59 @@ function planStatusCommand(dir, asJson) {
68074
68197
  return 0;
68075
68198
  }
68076
68199
  const c = p.components;
68077
- console.log(chalk21.bold(`
68200
+ console.log(chalk22.bold(`
68078
68201
  Migration plan — ${plan.url}${plan.target.name ? ` → ${plan.target.name}` : ""}`));
68079
68202
  console.log(`
68080
- ${chalk21.bold("Components")} (${c.total}): ` + `${chalk21.green(`${c.byStatus.done} done`)}, ` + `${chalk21.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk21.red(`${c.byStatus.pending} pending`)}, ` + `${chalk21.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk21.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk21.gray(`${c.byStatus.skipped} skipped`)}`);
68203
+ ${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`)}`);
68081
68204
  if (c.accepted.upgrade.length) {
68082
- console.log(chalk21.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
68205
+ console.log(chalk22.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
68083
68206
  }
68084
68207
  if (c.accepted.asIs.length) {
68085
- console.log(chalk21.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68208
+ console.log(chalk22.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
68086
68209
  }
68087
68210
  if (provenance.library > 0 || provenance.built > 0) {
68088
- const unrecorded = provenance.unrecorded > 0 ? chalk21.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68089
- console.log(` reuse: ${chalk21.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
68211
+ const unrecorded = provenance.unrecorded > 0 ? chalk22.dim(`, ${provenance.unrecorded} unrecorded`) : "";
68212
+ console.log(` reuse: ${chalk22.green(`${provenance.library} from the library`)}, ${provenance.built} written here${unrecorded}`);
68090
68213
  }
68091
68214
  if (touches > 0) {
68092
- console.log(chalk21.dim(` human touches: ${touches} across this migration`));
68215
+ console.log(chalk22.dim(` human touches: ${touches} across this migration`));
68093
68216
  }
68094
68217
  if (c.settledByStatus.done.length) {
68095
- console.log(chalk21.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68218
+ console.log(chalk22.green(` ported and validated: ${c.settledByStatus.done.join(", ")}`));
68096
68219
  }
68097
68220
  if (c.settledByStatus.skipped.length) {
68098
- console.log(chalk21.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
68221
+ console.log(chalk22.gray(` skipped: ${c.settledByStatus.skipped.join(", ")}`));
68099
68222
  }
68100
68223
  for (const r of c.remaining) {
68101
- const tag = r.status === "partial" ? chalk21.yellow("partial") : chalk21.red("pending");
68102
- console.log(` ${tag} ${r.name} ${chalk21.gray(`(${r.scope}, ${r.origin})`)}`);
68224
+ const tag = r.status === "partial" ? chalk22.yellow("partial") : chalk22.red("pending");
68225
+ console.log(` ${tag} ${r.name} ${chalk22.gray(`(${r.scope}, ${r.origin})`)}`);
68103
68226
  }
68104
68227
  const pg = p.pages;
68105
68228
  console.log(`
68106
- ${chalk21.bold("Pages")} (${pg.total}): ` + `${chalk21.green(`${pg.byStatus.done} done`)}, ` + `${chalk21.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk21.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk21.gray(`${pg.byStatus.skipped} skipped`)}`);
68229
+ ${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`)}`);
68107
68230
  if (pg.awaitingContent.length) {
68108
- console.log(chalk21.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68231
+ console.log(chalk22.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
68109
68232
  }
68110
68233
  for (const r of pg.remaining.filter((r) => r.status === "pending")) {
68111
- console.log(` ${chalk21.red("pending")} ${r.path} ${chalk21.gray(`(${r.kind})`)}`);
68234
+ console.log(` ${chalk22.red("pending")} ${r.path} ${chalk22.gray(`(${r.kind})`)}`);
68112
68235
  }
68113
68236
  console.log("");
68114
68237
  return 0;
68115
68238
  }
68116
68239
  var COLUMN_ORDER = ["triage", "backlog", "building", "review", "done"];
68117
68240
  var COLUMN_STYLE = {
68118
- triage: chalk21.magenta,
68119
- backlog: chalk21.red,
68120
- building: chalk21.yellow,
68121
- review: chalk21.cyan,
68122
- done: chalk21.green,
68123
- skipped: chalk21.gray
68241
+ triage: chalk22.magenta,
68242
+ backlog: chalk22.red,
68243
+ building: chalk22.yellow,
68244
+ review: chalk22.cyan,
68245
+ done: chalk22.green,
68246
+ skipped: chalk22.gray
68124
68247
  };
68125
68248
  async function planBoardCommand(dir, opts) {
68126
68249
  const plan = loadPlan(dir);
68127
68250
  if (!plan) {
68128
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68129
- console.error(chalk21.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
68251
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68252
+ console.error(chalk22.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
68130
68253
  return 1;
68131
68254
  }
68132
68255
  const board = planBoard(plan, opts.cand);
@@ -68134,46 +68257,46 @@ async function planBoardCommand(dir, opts) {
68134
68257
  console.log(JSON.stringify(board, null, 2));
68135
68258
  return 0;
68136
68259
  }
68137
- console.log(chalk21.bold(`
68260
+ console.log(chalk22.bold(`
68138
68261
  Board — ${board.url}`));
68139
- console.log(chalk21.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
68262
+ console.log(chalk22.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
68140
68263
  if (board.shell.length) {
68141
68264
  console.log(`
68142
- ${chalk21.bold("shell")} ${chalk21.gray("(global — blocks every page)")}: ${chalk21.yellow(board.shell.join(", "))}`);
68265
+ ${chalk22.bold("shell")} ${chalk22.gray("(global — blocks every page)")}: ${chalk22.yellow(board.shell.join(", "))}`);
68143
68266
  }
68144
68267
  for (const column of COLUMN_ORDER) {
68145
68268
  const cards = board.columns[column];
68146
68269
  if (!cards.length)
68147
68270
  continue;
68148
68271
  console.log(`
68149
- ${COLUMN_STYLE[column](chalk21.bold(column))} (${cards.length})`);
68272
+ ${COLUMN_STYLE[column](chalk22.bold(column))} (${cards.length})`);
68150
68273
  for (const card of cards) {
68151
- console.log(` ${card.path} ${chalk21.gray(`(${card.kind})`)}`);
68274
+ console.log(` ${card.path} ${chalk22.gray(`(${card.kind})`)}`);
68152
68275
  if (card.blockers.length) {
68153
- console.log(chalk21.gray(` blocked by: ${card.blockers.join(", ")}`));
68276
+ console.log(chalk22.gray(` blocked by: ${card.blockers.join(", ")}`));
68154
68277
  }
68155
68278
  }
68156
68279
  }
68157
68280
  const skipped = board.columns.skipped;
68158
68281
  if (skipped.length) {
68159
68282
  console.log(`
68160
- ${chalk21.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68283
+ ${chalk22.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
68161
68284
  }
68162
68285
  if (board.unassigned.length) {
68163
68286
  console.log(`
68164
- ${chalk21.bold("no page")} ${chalk21.gray("(in the code, not seen on any sampled page)")}
68165
- ${chalk21.gray(board.unassigned.join(", "))}`);
68287
+ ${chalk22.bold("no page")} ${chalk22.gray("(in the code, not seen on any sampled page)")}
68288
+ ${chalk22.gray(board.unassigned.join(", "))}`);
68166
68289
  }
68167
68290
  console.log("");
68168
68291
  if (opts.board === "studio") {
68169
68292
  const cfg = studioConfigFromEnv();
68170
68293
  if (!cfg) {
68171
- console.log(chalk21.yellow(`Studio board skipped — ${STUDIO_LOGIN_HINT}. Showing the terminal board instead.
68294
+ console.log(chalk22.yellow(`Studio board skipped — ${STUDIO_LOGIN_HINT}. Showing the terminal board instead.
68172
68295
  `));
68173
68296
  return 0;
68174
68297
  }
68175
68298
  try {
68176
- const fixes = opts.fixes ? JSON.parse(readFileSync24(opts.fixes, "utf8")) : undefined;
68299
+ const fixes = opts.fixes ? JSON.parse(readFileSync25(opts.fixes, "utf8")) : undefined;
68177
68300
  const synced = await syncBoardToStudio(board, cfg, { repo: opts.repo, fixes });
68178
68301
  let stored = 0;
68179
68302
  for (const [path, id] of Object.entries(synced.ids)) {
@@ -68182,10 +68305,10 @@ ${chalk21.bold("no page")} ${chalk21.gray("(in the code, not seen on any sampled
68182
68305
  }
68183
68306
  if (stored)
68184
68307
  savePlan(dir, plan);
68185
- console.log(chalk21.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
68308
+ console.log(chalk22.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
68186
68309
  `));
68187
68310
  } catch (err) {
68188
- console.log(chalk21.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
68311
+ console.log(chalk22.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
68189
68312
  `));
68190
68313
  }
68191
68314
  }
@@ -68194,27 +68317,27 @@ ${chalk21.bold("no page")} ${chalk21.gray("(in the code, not seen on any sampled
68194
68317
  async function planNotesCommand(dir, opts) {
68195
68318
  const plan = loadPlan(dir);
68196
68319
  if (!plan) {
68197
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68320
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68198
68321
  return 1;
68199
68322
  }
68200
68323
  const cfg = studioConfigFromEnv();
68201
68324
  if (!cfg) {
68202
- console.error(chalk21.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68325
+ console.error(chalk22.yellow(`Studio not configured — ${STUDIO_LOGIN_HINT}.`));
68203
68326
  return 1;
68204
68327
  }
68205
68328
  if (opts.post) {
68206
68329
  const page = plan.pages.find((p) => p.path === opts.page);
68207
68330
  if (!page?.boardItemId) {
68208
- console.error(chalk21.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
68331
+ console.error(chalk22.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
68209
68332
  return 1;
68210
68333
  }
68211
68334
  await postParityComment(page.boardItemId, opts.post, cfg);
68212
- console.log(`${chalk21.green("✓")} comment posted on ${page.path}`);
68335
+ console.log(`${chalk22.green("✓")} comment posted on ${page.path}`);
68213
68336
  return 0;
68214
68337
  }
68215
68338
  const pages = plan.pages.filter((p) => p.boardItemId).filter((p) => !opts.page || p.path === opts.page).map((p) => ({ path: p.path, boardItemId: p.boardItemId }));
68216
68339
  if (!pages.length) {
68217
- console.error(chalk21.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
68340
+ console.error(chalk22.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
68218
68341
  return 1;
68219
68342
  }
68220
68343
  const notes = await fetchClientNotes(pages, cfg);
@@ -68223,47 +68346,47 @@ async function planNotesCommand(dir, opts) {
68223
68346
  return 0;
68224
68347
  }
68225
68348
  if (!notes.length) {
68226
- console.log(chalk21.gray(`
68349
+ console.log(chalk22.gray(`
68227
68350
  No open client notes.
68228
68351
  `));
68229
68352
  return 0;
68230
68353
  }
68231
- console.log(chalk21.bold(`
68354
+ console.log(chalk22.bold(`
68232
68355
  Client notes (${notes.length})`));
68233
68356
  for (const n of notes) {
68234
68357
  console.log(`
68235
- ${chalk21.cyan(n.path)} ${chalk21.gray(n.createdAt)}`);
68358
+ ${chalk22.cyan(n.path)} ${chalk22.gray(n.createdAt)}`);
68236
68359
  for (const line of n.body.split(`
68237
68360
  `))
68238
68361
  console.log(` ${line}`);
68239
68362
  }
68240
- console.log(chalk21.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'));
68363
+ 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'));
68241
68364
  return 0;
68242
68365
  }
68243
68366
  var PROVENANCES = ["library", "built"];
68244
68367
  function planSetProvenanceCommand(dir, name, provenance) {
68245
68368
  if (!PROVENANCES.includes(provenance)) {
68246
- console.error(chalk21.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
68369
+ console.error(chalk22.red(`Invalid provenance "${provenance}". Use one of: ${PROVENANCES.join(", ")}`));
68247
68370
  return 1;
68248
68371
  }
68249
68372
  const plan = loadPlan(dir);
68250
68373
  if (!plan) {
68251
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68374
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68252
68375
  return 1;
68253
68376
  }
68254
68377
  const component = setComponentProvenance(plan, name, provenance);
68255
68378
  if (!component) {
68256
- console.error(chalk21.red(`No component matching "${name}" in the plan`));
68379
+ console.error(chalk22.red(`No component matching "${name}" in the plan`));
68257
68380
  return 1;
68258
68381
  }
68259
68382
  savePlan(dir, plan);
68260
- console.log(`${chalk21.green("✓")} ${component.name} → ${provenance}`);
68383
+ console.log(`${chalk22.green("✓")} ${component.name} → ${provenance}`);
68261
68384
  return 0;
68262
68385
  }
68263
68386
  function planTouchCommand(dir, page, opts) {
68264
68387
  const plan = loadPlan(dir);
68265
68388
  if (!plan) {
68266
- console.error(chalk21.red(`No migration-plan.json found in ${dir}`));
68389
+ console.error(chalk22.red(`No migration-plan.json found in ${dir}`));
68267
68390
  return 1;
68268
68391
  }
68269
68392
  const count = recordTouch(plan, page);
@@ -68271,20 +68394,20 @@ function planTouchCommand(dir, page, opts) {
68271
68394
  if (opts.json) {
68272
68395
  console.log(JSON.stringify({ page, touches: count, total: totalTouches(plan) }));
68273
68396
  } else {
68274
- console.log(`${chalk21.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
68397
+ console.log(`${chalk22.green("✓")} ${page} → ${count} human touch(es); ${totalTouches(plan)} in this migration`);
68275
68398
  }
68276
68399
  return 0;
68277
68400
  }
68278
68401
 
68279
68402
  // src/commands/pr.ts
68280
- import { existsSync as existsSync22, readFileSync as readFileSync27, writeFileSync as writeFileSync26 } from "node:fs";
68281
- import { join as join34 } from "node:path";
68282
- import chalk24 from "chalk";
68403
+ import { existsSync as existsSync22, readFileSync as readFileSync28, writeFileSync as writeFileSync26 } from "node:fs";
68404
+ import { join as join35 } from "node:path";
68405
+ import chalk25 from "chalk";
68283
68406
 
68284
68407
  // src/commands/run.ts
68285
- import { existsSync as existsSync21, readFileSync as readFileSync26, unlinkSync as unlinkSync3 } from "node:fs";
68286
- import { join as join33 } from "node:path";
68287
- import chalk23 from "chalk";
68408
+ import { existsSync as existsSync21, readFileSync as readFileSync27, unlinkSync as unlinkSync3 } from "node:fs";
68409
+ import { join as join34 } from "node:path";
68410
+ import chalk24 from "chalk";
68288
68411
  import ora8 from "ora";
68289
68412
 
68290
68413
  // src/diff/score-band.ts
@@ -68873,12 +68996,12 @@ function formatMs(ms) {
68873
68996
 
68874
68997
  // src/commands/serve.ts
68875
68998
  import { existsSync as existsSync20 } from "node:fs";
68876
- import chalk22 from "chalk";
68999
+ import chalk23 from "chalk";
68877
69000
 
68878
69001
  // src/server/proxy-server.ts
68879
- import { existsSync as existsSync19, readFileSync as readFileSync25, statSync as statSync2 } from "node:fs";
69002
+ import { existsSync as existsSync19, readFileSync as readFileSync26, statSync as statSync2 } from "node:fs";
68880
69003
  import { createServer } from "node:http";
68881
- import { extname, join as join32, normalize as normalize3, resolve as resolve7, sep } from "node:path";
69004
+ import { extname, join as join33, normalize as normalize3, resolve as resolve8, sep } from "node:path";
68882
69005
  var MIME3 = {
68883
69006
  ".html": "text/html; charset=utf-8",
68884
69007
  ".css": "text/css; charset=utf-8",
@@ -68915,7 +69038,7 @@ var STRIPPED_REQUEST_HEADERS = new Set([
68915
69038
  ]);
68916
69039
  var scrollBeacons = [];
68917
69040
  async function startProxyServer(runDir, opts = {}) {
68918
- const absRunDir = resolve7(runDir);
69041
+ const absRunDir = resolve8(runDir);
68919
69042
  if (!existsSync19(absRunDir)) {
68920
69043
  throw new Error(`Run directory not found: ${runDir}`);
68921
69044
  }
@@ -68986,13 +69109,13 @@ async function handleRequest(req, res, runDir) {
68986
69109
  return serveStatic(res, runDir, path);
68987
69110
  }
68988
69111
  function serveReportHtml(res, runDir) {
68989
- const filePath = join32(runDir, "report.html");
69112
+ const filePath = join33(runDir, "report.html");
68990
69113
  if (!existsSync19(filePath)) {
68991
69114
  res.statusCode = 404;
68992
69115
  res.end("report.html not found");
68993
69116
  return;
68994
69117
  }
68995
- const html = readFileSync25(filePath, "utf8");
69118
+ const html = readFileSync26(filePath, "utf8");
68996
69119
  const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
68997
69120
  const out = html.includes("</head>") ? html.replace("</head>", `${inject}</head>`) : `${inject}${html}`;
68998
69121
  res.statusCode = 200;
@@ -69002,7 +69125,7 @@ function serveReportHtml(res, runDir) {
69002
69125
  }
69003
69126
  function serveStatic(res, runDir, path) {
69004
69127
  const safePath = normalize3(path).replace(/^[/\\]+/, "");
69005
- const filePath = resolve7(runDir, safePath);
69128
+ const filePath = resolve8(runDir, safePath);
69006
69129
  if (!filePath.startsWith(runDir + sep) && filePath !== runDir) {
69007
69130
  res.statusCode = 403;
69008
69131
  res.end("forbidden");
@@ -69023,7 +69146,7 @@ function serveStatic(res, runDir, path) {
69023
69146
  res.statusCode = 200;
69024
69147
  res.setHeader("content-type", MIME3[ext] ?? "application/octet-stream");
69025
69148
  res.setHeader("cache-control", "no-store");
69026
- res.end(readFileSync25(filePath));
69149
+ res.end(readFileSync26(filePath));
69027
69150
  }
69028
69151
  async function proxyRequest(req, res, targetUrl, opts = {}) {
69029
69152
  let target;
@@ -69146,16 +69269,16 @@ async function serveRunAndBlock(runDir, opts = {}) {
69146
69269
  try {
69147
69270
  handle = await startProxyServer(runDir, { port: opts.port });
69148
69271
  } catch (err) {
69149
- console.error(chalk22.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69272
+ console.error(chalk23.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
69150
69273
  return 2;
69151
69274
  }
69152
69275
  const label = opts.label ?? "parity serve";
69153
69276
  console.log("");
69154
- console.log(chalk22.bold(` ${label}`));
69155
- console.log(` ${chalk22.green("●")} ${handle.url}`);
69156
- console.log(chalk22.dim(` Servindo: ${runDir}`));
69157
- console.log(chalk22.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69158
- console.log(chalk22.dim(` Ctrl+C pra parar (2x pra forçar saída).
69277
+ console.log(chalk23.bold(` ${label}`));
69278
+ console.log(` ${chalk23.green("●")} ${handle.url}`);
69279
+ console.log(chalk23.dim(` Servindo: ${runDir}`));
69280
+ console.log(chalk23.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
69281
+ console.log(chalk23.dim(` Ctrl+C pra parar (2x pra forçar saída).
69159
69282
  `));
69160
69283
  if (opts.open !== false) {
69161
69284
  const { default: open } = await import("open");
@@ -69188,11 +69311,11 @@ async function serveRunAndBlock(runDir, opts = {}) {
69188
69311
  async function serveCommand(runId, opts) {
69189
69312
  const paths = getRunPaths(opts.output, runId);
69190
69313
  if (!existsSync20(paths.runDir)) {
69191
- console.error(chalk22.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
69314
+ console.error(chalk23.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
69192
69315
  return 1;
69193
69316
  }
69194
69317
  if (!existsSync20(paths.reportHtml)) {
69195
- console.error(chalk22.red(`✖ report.html não existe em ${paths.runDir}`));
69318
+ console.error(chalk23.red(`✖ report.html não existe em ${paths.runDir}`));
69196
69319
  return 1;
69197
69320
  }
69198
69321
  return serveRunAndBlock(paths.runDir, {
@@ -69342,7 +69465,7 @@ function evaluateFailOnGate(allIssues, failOn, verdictStatus) {
69342
69465
  var SCORE_BAND_RUNS = 4;
69343
69466
  function readRunChecks(reportPath) {
69344
69467
  try {
69345
- const raw = JSON.parse(readFileSync26(reportPath, "utf8"));
69468
+ const raw = JSON.parse(readFileSync27(reportPath, "utf8"));
69346
69469
  return (raw.checks ?? []).filter((c) => typeof c.name === "string" && typeof c.status === "string").map((c) => ({ name: c.name, status: c.status }));
69347
69470
  } catch {
69348
69471
  return [];
@@ -69351,14 +69474,14 @@ function readRunChecks(reportPath) {
69351
69474
  async function runCommand(rawOpts) {
69352
69475
  if (!rawOpts.prod) {
69353
69476
  const target = rawOpts.cand ?? "<url>";
69354
- console.error(`${chalk23.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
69355
- For one site, use: ${chalk23.cyan(`parity e2e --url ${target}`)}
69477
+ console.error(`${chalk24.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
69478
+ For one site, use: ${chalk24.cyan(`parity e2e --url ${target}`)}
69356
69479
  (runs the functional flows + all checks in single-site mode — no prod baseline needed).`);
69357
69480
  return 2;
69358
69481
  }
69359
69482
  let opts = applyPreset(rawOpts);
69360
69483
  if (rawOpts.preset) {
69361
- console.log(chalk23.dim(` preset: ${rawOpts.preset}`));
69484
+ console.log(chalk24.dim(` preset: ${rawOpts.preset}`));
69362
69485
  }
69363
69486
  if (opts.pt)
69364
69487
  setLlmLanguage("pt");
@@ -69366,14 +69489,14 @@ async function runCommand(rawOpts) {
69366
69489
  disableInteractive();
69367
69490
  const llmCfgErr = applyLlmOptions(opts);
69368
69491
  if (llmCfgErr) {
69369
- console.error(chalk23.red(` ${llmCfgErr}`));
69492
+ console.error(chalk24.red(` ${llmCfgErr}`));
69370
69493
  return 2;
69371
69494
  }
69372
69495
  const llmStillAvailable = isLlmAvailable();
69373
69496
  const preSmart = opts;
69374
69497
  opts = applySmartDefaults(opts, llmStillAvailable);
69375
69498
  if (!llmStillAvailable && opts.visualPages !== preSmart.visualPages) {
69376
- console.log(chalk23.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
69499
+ console.log(chalk24.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
69377
69500
  }
69378
69501
  let interactivePromptShown = false;
69379
69502
  if (!opts.only && !opts.skip && !rawOpts.preset) {
@@ -69399,14 +69522,14 @@ async function runCommand(rawOpts) {
69399
69522
  if (isContentProfile && !opts.only && !opts.skip) {
69400
69523
  opts.only = "seo,visual,vitals,cache,console,html,network";
69401
69524
  moduleDropReason = "profile: content → e2e module dropped (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force";
69402
- console.log(chalk23.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
69525
+ console.log(chalk24.yellow(` INCONCLUSIVE: ${moduleDropReason}`));
69403
69526
  }
69404
69527
  const selection = resolveSelection({ only: opts.only, skip: opts.skip });
69405
69528
  if (selection.errors.length > 0) {
69406
- console.error(chalk23.red(" --only/--skip: invalid value(s):"));
69529
+ console.error(chalk24.red(" --only/--skip: invalid value(s):"));
69407
69530
  for (const e of selection.errors)
69408
- console.error(chalk23.red(` - ${e}`));
69409
- console.error(chalk23.dim(`
69531
+ console.error(chalk24.red(` - ${e}`));
69532
+ console.error(chalk24.dim(`
69410
69533
  valid modules: ${Object.keys(MODULES).join(", ")}`));
69411
69534
  return 2;
69412
69535
  }
@@ -69418,14 +69541,14 @@ async function runCommand(rawOpts) {
69418
69541
  const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
69419
69542
  const scoped = resolveScopedFlows({ explicitFlows, selectionFlows: selection.flows });
69420
69543
  flows = scoped.flows;
69421
- console.log(chalk23.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
69544
+ console.log(chalk24.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
69422
69545
  if (scoped.starved.length > 0) {
69423
- console.log(chalk23.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
69546
+ console.log(chalk24.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
69424
69547
  }
69425
69548
  } else {
69426
69549
  flows = opts.flows.split(",").map((s) => s.trim());
69427
69550
  if (!interactivePromptShown) {
69428
- console.log(chalk23.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
69551
+ console.log(chalk24.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
69429
69552
  }
69430
69553
  }
69431
69554
  if (isContentProfile) {
@@ -69434,12 +69557,12 @@ async function runCommand(rawOpts) {
69434
69557
  if (!flows.includes("homepage"))
69435
69558
  flows.unshift("homepage");
69436
69559
  if (before !== flows.join(",")) {
69437
- console.log(chalk23.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
69560
+ console.log(chalk24.dim(` profile: content → flows scoped to ${flows.join(",")} (dropped plp/pdp; was: ${before}); CEP skipped`));
69438
69561
  }
69439
69562
  }
69440
69563
  const pagesScopeWarning = pagesFlowsScopeWarning(opts, flows);
69441
69564
  if (pagesScopeWarning) {
69442
- console.log(chalk23.dim(` ${pagesScopeWarning}`));
69565
+ console.log(chalk24.dim(` ${pagesScopeWarning}`));
69443
69566
  }
69444
69567
  if (hasSelection) {
69445
69568
  const needsSitemapPages = selection.modules.some((m) => MODULES[m].needsSitemapPages);
@@ -69448,12 +69571,12 @@ async function runCommand(rawOpts) {
69448
69571
  const VISUAL_PAGES_DEFAULT = 5;
69449
69572
  if (!needsSitemapPages && opts.vitalsPages === VITALS_PAGES_DEFAULT) {
69450
69573
  opts.vitalsPages = 0;
69451
- console.log(chalk23.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
69574
+ console.log(chalk24.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
69452
69575
  }
69453
69576
  if (!needsLlmPass && opts.visualPages === VISUAL_PAGES_DEFAULT) {
69454
69577
  opts.visualPages = 0;
69455
69578
  opts.noVisualDiff = true;
69456
- console.log(chalk23.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
69579
+ console.log(chalk24.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
69457
69580
  }
69458
69581
  }
69459
69582
  const viewports = opts.viewports.split(",").map((s) => s.trim());
@@ -69466,38 +69589,38 @@ async function runCommand(rawOpts) {
69466
69589
  }
69467
69590
  const ignore = loadParityIgnore();
69468
69591
  if (opts.clearCache) {
69469
- const cacheFile = join33(opts.output, "cache", "verdicts.json");
69592
+ const cacheFile = join34(opts.output, "cache", "verdicts.json");
69470
69593
  if (existsSync21(cacheFile)) {
69471
69594
  try {
69472
69595
  unlinkSync3(cacheFile);
69473
- console.log(chalk23.dim(` cache wiped: ${cacheFile}`));
69596
+ console.log(chalk24.dim(` cache wiped: ${cacheFile}`));
69474
69597
  } catch (err) {
69475
- console.log(chalk23.yellow(` cache wipe falhou: ${err.message}`));
69598
+ console.log(chalk24.yellow(` cache wipe falhou: ${err.message}`));
69476
69599
  }
69477
69600
  }
69478
69601
  }
69479
69602
  const llmTimeoutRaw = opts.llmTimeout ?? 60;
69480
69603
  if (!Number.isFinite(llmTimeoutRaw)) {
69481
- console.error(chalk23.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
69604
+ console.error(chalk24.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
69482
69605
  return 2;
69483
69606
  }
69484
69607
  const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
69485
69608
  if (isLlmAvailable()) {
69486
- console.log(chalk23.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
69609
+ console.log(chalk24.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
69487
69610
  } else {
69488
- console.log(chalk23.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
69611
+ console.log(chalk24.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
69489
69612
  }
69490
69613
  if (isInteractiveMode()) {
69491
- console.log(chalk23.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
69614
+ console.log(chalk24.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
69492
69615
  }
69493
69616
  const primaryViewport = viewports[0] ?? "mobile";
69494
69617
  const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
69495
69618
  if (!preflight.ok) {
69496
- console.error(chalk23.red(`
69619
+ console.error(chalk24.red(`
69497
69620
  ✖ pre-flight falhou:`));
69498
69621
  for (const err of preflight.errors)
69499
- console.error(chalk23.red(` - ${err}`));
69500
- console.error(chalk23.dim(`
69622
+ console.error(chalk24.red(` - ${err}`));
69623
+ console.error(chalk24.dim(`
69501
69624
  dica: verifique se as URLs estão corretas e acessíveis`));
69502
69625
  return 2;
69503
69626
  }
@@ -69508,7 +69631,7 @@ async function runCommand(rawOpts) {
69508
69631
  if (prodHomeHtml) {
69509
69632
  platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
69510
69633
  if (platform !== "custom") {
69511
- console.log(chalk23.dim(` Detected platform: ${platform}`));
69634
+ console.log(chalk24.dim(` Detected platform: ${platform}`));
69512
69635
  }
69513
69636
  }
69514
69637
  const prodHost = hostOf3(opts.prod);
@@ -69543,11 +69666,11 @@ async function runCommand(rawOpts) {
69543
69666
  viewports,
69544
69667
  timestamp
69545
69668
  });
69546
- console.log(chalk23.bold(`
69669
+ console.log(chalk24.bold(`
69547
69670
  parity run ${runId}`));
69548
- console.log(chalk23.dim(` prod: ${opts.prod}`));
69549
- console.log(chalk23.dim(` cand: ${opts.cand}`));
69550
- console.log(chalk23.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
69671
+ console.log(chalk24.dim(` prod: ${opts.prod}`));
69672
+ console.log(chalk24.dim(` cand: ${opts.cand}`));
69673
+ console.log(chalk24.dim(` profile: ${profile} · flows: ${flows.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
69551
69674
  `));
69552
69675
  const spinner = ora8("Launching browser…").start();
69553
69676
  let browser = null;
@@ -69559,7 +69682,7 @@ async function runCommand(rawOpts) {
69559
69682
  const min = Math.floor(elapsedSec / 60);
69560
69683
  const sec = elapsedSec % 60;
69561
69684
  const mmss = `${min.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
69562
- spinner.text = `${chalk23.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
69685
+ spinner.text = `${chalk24.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
69563
69686
  };
69564
69687
  const setSpinnerLabel = (label) => {
69565
69688
  currentSpinnerLabel = label;
@@ -69663,8 +69786,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69663
69786
  const traceEnabled = process.env.PARITY_TRACE === "1";
69664
69787
  const runOneSide = async (viewport, side) => {
69665
69788
  const baseUrl = side === "prod" ? opts.prod : opts.cand;
69666
- const harPath = join33(paths.harDir, `${viewport}-${side}.har`);
69667
- const tracePath = traceEnabled ? join33(paths.tracesDir, `${viewport}-${side}.zip`) : null;
69789
+ const harPath = join34(paths.harDir, `${viewport}-${side}.har`);
69790
+ const tracePath = traceEnabled ? join34(paths.tracesDir, `${viewport}-${side}.zip`) : null;
69668
69791
  const ctx = await newContext(browser, {
69669
69792
  viewport,
69670
69793
  harPath,
@@ -69679,8 +69802,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69679
69802
  for (const flow of flows) {
69680
69803
  const flowStart = Date.now();
69681
69804
  let lastStepTotal = 0;
69682
- const sideTag = side === "prod" ? chalk23.cyan("prod") : chalk23.magenta("cand");
69683
- const prefix = `${chalk23.dim(`[${viewport}/`)}${sideTag}${chalk23.dim("]")}`;
69805
+ const sideTag = side === "prod" ? chalk24.cyan("prod") : chalk24.magenta("cand");
69806
+ const prefix = `${chalk24.dim(`[${viewport}/`)}${sideTag}${chalk24.dim("]")}`;
69684
69807
  setSpinnerLabel(`${prefix} ${flow}: starting…`);
69685
69808
  const cap = await runFlow(flow, {
69686
69809
  baseUrl,
@@ -69697,7 +69820,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69697
69820
  onStep: (event) => {
69698
69821
  if (event.phase === "start") {
69699
69822
  lastStepTotal = event.total;
69700
- setSpinnerLabel(`${prefix} ${flow} ${chalk23.dim(`${event.index}/${event.total}`)} ${event.name}…`);
69823
+ setSpinnerLabel(`${prefix} ${flow} ${chalk24.dim(`${event.index}/${event.total}`)} ${event.name}…`);
69701
69824
  }
69702
69825
  }
69703
69826
  });
@@ -69706,18 +69829,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69706
69829
  const target = lastStepTotal || recorded;
69707
69830
  const failed = cap.steps?.find((s) => s.status === "failed");
69708
69831
  const lastStep = cap.steps?.[cap.steps.length - 1];
69709
- const elapsedDim = chalk23.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
69710
- const counts = target > 0 ? chalk23.dim(`${okSteps}/${target}`) : "";
69832
+ const elapsedDim = chalk24.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
69833
+ const counts = target > 0 ? chalk24.dim(`${okSteps}/${target}`) : "";
69711
69834
  let glyph;
69712
69835
  let detail;
69713
69836
  if (failed) {
69714
- glyph = chalk23.red("✗");
69715
- detail = `stopped at ${chalk23.yellow(failed.name)}`;
69837
+ glyph = chalk24.red("✗");
69838
+ detail = `stopped at ${chalk24.yellow(failed.name)}`;
69716
69839
  } else if (target > 0 && okSteps < target) {
69717
- glyph = chalk23.yellow("▴");
69718
- detail = lastStep ? `ended at ${chalk23.dim(lastStep.name)}` : "incomplete";
69840
+ glyph = chalk24.yellow("▴");
69841
+ detail = lastStep ? `ended at ${chalk24.dim(lastStep.name)}` : "incomplete";
69719
69842
  } else {
69720
- glyph = chalk23.green("✓");
69843
+ glyph = chalk24.green("✓");
69721
69844
  detail = "";
69722
69845
  }
69723
69846
  const summary = `${glyph} ${prefix} ${flow} ${counts} ${detail} ${elapsedDim}`.replace(/\s+/g, " ").trim();
@@ -69779,7 +69902,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69779
69902
  const vitalsPagesLimit = opts.vitalsPages ?? vitalsPagesDefault;
69780
69903
  const vitalsRuns = Math.max(1, Number.parseInt(opts.runs, 10) || 1);
69781
69904
  if (candIsDevServer && vitalsPagesLimit > 0) {
69782
- console.log(chalk23.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
69905
+ console.log(chalk24.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
69783
69906
  }
69784
69907
  if (browser && vitalsPagesLimit > 0) {
69785
69908
  currentPhase = "vitals-pages";
@@ -69986,7 +70109,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
69986
70109
  setSpinnerLabel("Rodando checks…");
69987
70110
  spinner.start();
69988
70111
  const checksHb = attachSpinnerHeartbeat(spinner, { baseText: "Rodando checks…" });
69989
- const cacheDir = join33(opts.output, "cache");
70112
+ const cacheDir = join34(opts.output, "cache");
69990
70113
  const checkCtx = {
69991
70114
  prodPages: allPageCaptures.filter((p) => p.side === "prod"),
69992
70115
  candPages: allPageCaptures.filter((p) => p.side === "cand"),
@@ -70131,7 +70254,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
70131
70254
  ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
70132
70255
  const failOnGate = evaluateFailOnGate(allIssues, failOn, verdict.status);
70133
70256
  if (failOnGate.exitCode === 1) {
70134
- console.log(chalk23.red(failOnGate.message));
70257
+ console.log(chalk24.red(failOnGate.message));
70135
70258
  return 1;
70136
70259
  }
70137
70260
  if (opts.open) {
@@ -70204,7 +70327,7 @@ function resolveExplicitPages(pagesFile, pagesList) {
70204
70327
  if (!existsSync21(pagesFile)) {
70205
70328
  throw new Error(`--pages-file não encontrado: ${pagesFile}`);
70206
70329
  }
70207
- const raw = readFileSync26(pagesFile, "utf-8");
70330
+ const raw = readFileSync27(pagesFile, "utf-8");
70208
70331
  const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
70209
70332
  for (const line of lines)
70210
70333
  validatePageEntry(line, [], true);
@@ -70358,60 +70481,60 @@ function hostOf3(url) {
70358
70481
  function printSummary7(run, htmlPath, meta) {
70359
70482
  const { verdict } = run;
70360
70483
  const inconclusive = verdict.status === "inconclusive";
70361
- const emoji = inconclusive ? chalk23.dim("○") : verdict.status === "pass" ? chalk23.green("✔") : verdict.status === "warn" ? chalk23.yellow("⚠") : chalk23.red("✖");
70362
- const score = inconclusive ? chalk23.dim("—") : verdict.status === "pass" ? chalk23.green(verdict.score) : verdict.status === "warn" ? chalk23.yellow(verdict.score) : chalk23.red(verdict.score);
70484
+ const emoji = inconclusive ? chalk24.dim("○") : verdict.status === "pass" ? chalk24.green("✔") : verdict.status === "warn" ? chalk24.yellow("⚠") : chalk24.red("✖");
70485
+ const score = inconclusive ? chalk24.dim("—") : verdict.status === "pass" ? chalk24.green(verdict.score) : verdict.status === "warn" ? chalk24.yellow(verdict.score) : chalk24.red(verdict.score);
70363
70486
  const prev = run.previousRun;
70364
- const scoreDelta = !prev ? chalk23.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk23.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk23.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk23.dim(` (= run anterior: ${prev.score})`);
70487
+ 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})`);
70365
70488
  console.log("");
70366
70489
  if (inconclusive) {
70367
70490
  console.log(` ${emoji} parity INCONCLUSIVE · nothing was measured (0 checks ran)`);
70368
70491
  } else {
70369
70492
  console.log(` ${emoji} parity ${verdict.status.toUpperCase()} · score ${score}/100${scoreDelta}`);
70370
70493
  }
70371
- console.log(` checks: ${chalk23.green(verdict.checksPassed)} pass · ${chalk23.red(verdict.checksFailed)} fail · ${chalk23.dim(`${verdict.checksSkipped} skipped`)}`);
70372
- console.log(` issues: ${chalk23.red(verdict.critical)} critical · ${chalk23.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk23.dim(`${verdict.low} low`)}`);
70494
+ console.log(` checks: ${chalk24.green(verdict.checksPassed)} pass · ${chalk24.red(verdict.checksFailed)} fail · ${chalk24.dim(`${verdict.checksSkipped} skipped`)}`);
70495
+ console.log(` issues: ${chalk24.red(verdict.critical)} critical · ${chalk24.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk24.dim(`${verdict.low} low`)}`);
70373
70496
  const band = run.scoreBand;
70374
70497
  const bandLine = band ? formatScoreBand(band) : null;
70375
70498
  if (band && bandLine) {
70376
- console.log(` ${chalk23.dim(bandLine)}`);
70499
+ console.log(` ${chalk24.dim(bandLine)}`);
70377
70500
  const caveat = scoreBandCaveat(band);
70378
70501
  if (caveat)
70379
- console.log(` ${chalk23.yellow("⚠")} ${caveat}`);
70502
+ console.log(` ${chalk24.yellow("⚠")} ${caveat}`);
70380
70503
  }
70381
70504
  for (const c of run.caveats ?? []) {
70382
- const mark = c.level === "warn" ? chalk23.yellow("⚠") : chalk23.dim("ℹ");
70505
+ const mark = c.level === "warn" ? chalk24.yellow("⚠") : chalk24.dim("ℹ");
70383
70506
  console.log(` ${mark} ${c.summary}`);
70384
70507
  }
70385
70508
  if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
70386
70509
  const perModule = run.moduleVerdicts.map((mv) => {
70387
- const colored = mv.status === "pass" ? chalk23.green(mv.score) : mv.status === "warn" ? chalk23.yellow(mv.score) : chalk23.red(mv.score);
70510
+ const colored = mv.status === "pass" ? chalk24.green(mv.score) : mv.status === "warn" ? chalk24.yellow(mv.score) : chalk24.red(mv.score);
70388
70511
  return `${mv.module} ${colored}`;
70389
70512
  }).join(" · ");
70390
70513
  console.log(` modules: ${perModule} → composite ${score}`);
70391
70514
  }
70392
70515
  if (run.visualDiff) {
70393
70516
  const vd = run.visualDiff;
70394
- const parityIcon = vd.parityOk ? chalk23.green("✔") : chalk23.red("✖");
70395
- const parityLabel = vd.parityOk ? chalk23.green("OK") : chalk23.red("DIFFS");
70396
- const cacheNote = vd.pagesFromCache > 0 ? chalk23.dim(` · ${vd.pagesFromCache} cached`) : "";
70397
- console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk23.red(vd.pagesWithDiffs)} diffs · ${chalk23.green(vd.pagesPassed)} pass${cacheNote}`);
70517
+ const parityIcon = vd.parityOk ? chalk24.green("✔") : chalk24.red("✖");
70518
+ const parityLabel = vd.parityOk ? chalk24.green("OK") : chalk24.red("DIFFS");
70519
+ const cacheNote = vd.pagesFromCache > 0 ? chalk24.dim(` · ${vd.pagesFromCache} cached`) : "";
70520
+ console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk24.red(vd.pagesWithDiffs)} diffs · ${chalk24.green(vd.pagesPassed)} pass${cacheNote}`);
70398
70521
  }
70399
70522
  if (run.topIssues.length > 0) {
70400
70523
  console.log("");
70401
- console.log(chalk23.bold(" Top issues:"));
70524
+ console.log(chalk24.bold(" Top issues:"));
70402
70525
  for (const g of groupIssues(run.topIssues).slice(0, 5)) {
70403
70526
  const i = g.sample;
70404
- const sev = i.severity === "critical" ? chalk23.red(`[${i.severity}]`) : i.severity === "high" ? chalk23.yellow(`[${i.severity}]`) : chalk23.dim(`[${i.severity}]`);
70405
- const pagesNote = g.pages.length > 1 ? chalk23.dim(` (${g.pages.length} páginas)`) : "";
70527
+ const sev = i.severity === "critical" ? chalk24.red(`[${i.severity}]`) : i.severity === "high" ? chalk24.yellow(`[${i.severity}]`) : chalk24.dim(`[${i.severity}]`);
70528
+ const pagesNote = g.pages.length > 1 ? chalk24.dim(` (${g.pages.length} páginas)`) : "";
70406
70529
  console.log(` ${sev} ${i.summary}${pagesNote}`);
70407
70530
  }
70408
70531
  }
70409
70532
  if (meta.promotedCount > 0 || meta.deprecatedCount > 0) {
70410
70533
  console.log("");
70411
- console.log(chalk23.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk23.green(`+${meta.promotedCount}`)} promoted · ${chalk23.yellow(meta.deprecatedCount)} deprecated`));
70534
+ console.log(chalk24.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk24.green(`+${meta.promotedCount}`)} promoted · ${chalk24.yellow(meta.deprecatedCount)} deprecated`));
70412
70535
  }
70413
70536
  console.log("");
70414
- console.log(chalk23.dim(` → ${htmlPath}`));
70537
+ console.log(chalk24.dim(` → ${htmlPath}`));
70415
70538
  console.log("");
70416
70539
  }
70417
70540
 
@@ -70435,26 +70558,26 @@ async function prCommand(opts) {
70435
70558
  preset: opts.preset ?? "ci",
70436
70559
  open: false
70437
70560
  };
70438
- console.log(chalk24.dim(` prod : ${opts.prod}`));
70439
- console.log(chalk24.dim(` preview : ${opts.preview}`));
70561
+ console.log(chalk25.dim(` prod : ${opts.prod}`));
70562
+ console.log(chalk25.dim(` preview : ${opts.preview}`));
70440
70563
  console.log("");
70441
70564
  const runCode = await runCommand(runOpts);
70442
70565
  const runs = listRuns(opts.output);
70443
70566
  if (runs.length === 0) {
70444
- console.error(chalk24.red("no run was produced — cannot build PR comment"));
70567
+ console.error(chalk25.red("no run was produced — cannot build PR comment"));
70445
70568
  return runCode || 1;
70446
70569
  }
70447
70570
  const latest = runs[0];
70448
- const reportJsonPath = join34(opts.output, "runs", latest.id, "report.json");
70571
+ const reportJsonPath = join35(opts.output, "runs", latest.id, "report.json");
70449
70572
  if (!existsSync22(reportJsonPath)) {
70450
- console.error(chalk24.red(`report.json not found at ${reportJsonPath}`));
70573
+ console.error(chalk25.red(`report.json not found at ${reportJsonPath}`));
70451
70574
  return runCode || 1;
70452
70575
  }
70453
- const run = JSON.parse(readFileSync27(reportJsonPath, "utf8"));
70576
+ const run = JSON.parse(readFileSync28(reportJsonPath, "utf8"));
70454
70577
  const markdown = buildPrComment(run, opts);
70455
70578
  if (opts.out) {
70456
70579
  writeFileSync26(opts.out, markdown, "utf8");
70457
- console.log(chalk24.dim(` wrote PR comment: ${opts.out}`));
70580
+ console.log(chalk25.dim(` wrote PR comment: ${opts.out}`));
70458
70581
  } else {
70459
70582
  process.stdout.write(`
70460
70583
  ${markdown}
@@ -70464,7 +70587,7 @@ ${markdown}
70464
70587
  try {
70465
70588
  writeFileSync26(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
70466
70589
  } catch (err) {
70467
- console.error(chalk24.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
70590
+ console.error(chalk25.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
70468
70591
  }
70469
70592
  }
70470
70593
  return runCode;
@@ -70525,13 +70648,13 @@ function buildPrComment(run, opts) {
70525
70648
 
70526
70649
  // src/commands/prompt.ts
70527
70650
  import { existsSync as existsSync23, writeFileSync as writeFileSync27 } from "node:fs";
70528
- import chalk25 from "chalk";
70651
+ import chalk26 from "chalk";
70529
70652
  function promptCommand(runId, opts) {
70530
70653
  let run;
70531
70654
  try {
70532
70655
  run = loadRun(opts.output, runId);
70533
70656
  } catch (err) {
70534
- console.error(chalk25.red(`✖ ${err.message}`));
70657
+ console.error(chalk26.red(`✖ ${err.message}`));
70535
70658
  return 1;
70536
70659
  }
70537
70660
  const md = buildLlmPrompt(run, {
@@ -70540,10 +70663,10 @@ function promptCommand(runId, opts) {
70540
70663
  });
70541
70664
  if (opts.out) {
70542
70665
  writeFileSync27(opts.out, md, "utf8");
70543
- console.log(chalk25.green(`✔ prompt salvo em ${opts.out}`));
70666
+ console.log(chalk26.green(`✔ prompt salvo em ${opts.out}`));
70544
70667
  if (existsSync23(opts.out)) {
70545
70668
  const sizeKb = (md.length / 1024).toFixed(1);
70546
- console.log(chalk25.dim(` ${md.length} chars (${sizeKb} KB)`));
70669
+ console.log(chalk26.dim(` ${md.length} chars (${sizeKb} KB)`));
70547
70670
  }
70548
70671
  } else {
70549
70672
  process.stdout.write(md);
@@ -70552,9 +70675,9 @@ function promptCommand(runId, opts) {
70552
70675
  }
70553
70676
 
70554
70677
  // src/commands/report.ts
70555
- import { existsSync as existsSync24, readFileSync as readFileSync28, writeFileSync as writeFileSync28 } from "node:fs";
70556
- import { join as join35 } from "node:path";
70557
- import chalk26 from "chalk";
70678
+ import { existsSync as existsSync24, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "node:fs";
70679
+ import { join as join36 } from "node:path";
70680
+ import chalk27 from "chalk";
70558
70681
  import open2 from "open";
70559
70682
 
70560
70683
  // src/report/deck-template.ts
@@ -71146,24 +71269,24 @@ async function reportCommand(runId, opts) {
71146
71269
  try {
71147
71270
  run = loadRun(opts.output, runId);
71148
71271
  } catch (err) {
71149
- console.error(chalk26.red(`failed to load run: ${err.message}`));
71272
+ console.error(chalk27.red(`failed to load run: ${err.message}`));
71150
71273
  return 1;
71151
71274
  }
71152
71275
  const html = renderDeckHtml(buildDeckModel(run), opts.lang ?? "en");
71153
- const dest = opts.out ?? join35(paths.runDir, "deck.html");
71276
+ const dest = opts.out ?? join36(paths.runDir, "deck.html");
71154
71277
  writeFileSync28(dest, html, "utf8");
71155
- console.log(`${chalk26.green("✓")} deck → ${dest}`);
71278
+ console.log(`${chalk27.green("✓")} deck → ${dest}`);
71156
71279
  if (opts.open) {
71157
71280
  await open2(dest).catch((err) => {
71158
- console.error(chalk26.red(`failed to open: ${err.message}`));
71281
+ console.error(chalk27.red(`failed to open: ${err.message}`));
71159
71282
  });
71160
71283
  }
71161
71284
  return 0;
71162
71285
  }
71163
71286
  if (opts.section) {
71164
71287
  if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
71165
- console.error(chalk26.red(`unknown section "${opts.section}"`));
71166
- console.error(chalk26.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71288
+ console.error(chalk27.red(`unknown section "${opts.section}"`));
71289
+ console.error(chalk27.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
71167
71290
  return 1;
71168
71291
  }
71169
71292
  if (opts.json) {
@@ -71171,48 +71294,48 @@ async function reportCommand(runId, opts) {
71171
71294
  const run = loadRun(opts.output, runId);
71172
71295
  const payload = extractReportSection({ kind: "json", section: opts.section, run });
71173
71296
  if (payload === null) {
71174
- console.error(chalk26.red(`section "${opts.section}" not present in this run`));
71297
+ console.error(chalk27.red(`section "${opts.section}" not present in this run`));
71175
71298
  return 1;
71176
71299
  }
71177
71300
  process.stdout.write(`${JSON.stringify(payload, null, 2)}
71178
71301
  `);
71179
71302
  return 0;
71180
71303
  } catch (err) {
71181
- console.error(chalk26.red(`failed to load run: ${err.message}`));
71304
+ console.error(chalk27.red(`failed to load run: ${err.message}`));
71182
71305
  return 1;
71183
71306
  }
71184
71307
  }
71185
71308
  if (!existsSync24(paths.reportHtml)) {
71186
- console.error(chalk26.red(`report.html not found at ${paths.reportHtml}`));
71309
+ console.error(chalk27.red(`report.html not found at ${paths.reportHtml}`));
71187
71310
  return 1;
71188
71311
  }
71189
- const html = readFileSync28(paths.reportHtml, "utf8");
71312
+ const html = readFileSync29(paths.reportHtml, "utf8");
71190
71313
  const slice = extractReportSection({ kind: "html", section: opts.section, html });
71191
71314
  if (slice === null) {
71192
- console.error(chalk26.red(`section "${opts.section}" not present in this report`));
71315
+ console.error(chalk27.red(`section "${opts.section}" not present in this report`));
71193
71316
  return 1;
71194
71317
  }
71195
71318
  process.stdout.write(slice);
71196
71319
  return 0;
71197
71320
  }
71198
- console.log(chalk26.dim(`opening ${paths.reportHtml}`));
71321
+ console.log(chalk27.dim(`opening ${paths.reportHtml}`));
71199
71322
  await open2(paths.reportHtml).catch((err) => {
71200
- console.error(chalk26.red(`failed to open: ${err.message}`));
71323
+ console.error(chalk27.red(`failed to open: ${err.message}`));
71201
71324
  });
71202
71325
  return 0;
71203
71326
  }
71204
71327
 
71205
71328
  // src/commands/event.ts
71206
- import { resolve as resolve8 } from "node:path";
71207
- import chalk27 from "chalk";
71329
+ import { resolve as resolve9 } from "node:path";
71330
+ import chalk28 from "chalk";
71208
71331
 
71209
71332
  // src/events.ts
71210
71333
  import { appendFileSync, mkdirSync as mkdirSync17 } from "node:fs";
71211
- import { dirname as dirname5, join as join36 } from "node:path";
71334
+ import { dirname as dirname6, join as join37 } from "node:path";
71212
71335
  function emitEvent(dir, type, data = {}) {
71213
71336
  try {
71214
- const file = join36(dir, "events.jsonl");
71215
- mkdirSync17(dirname5(file), { recursive: true });
71337
+ const file = join37(dir, "events.jsonl");
71338
+ mkdirSync17(dirname6(file), { recursive: true });
71216
71339
  const event = { ts: new Date().toISOString(), type, ...data };
71217
71340
  appendFileSync(file, `${JSON.stringify(event)}
71218
71341
  `);
@@ -71228,24 +71351,24 @@ function eventCommand(type, opts) {
71228
71351
  if (parsed && typeof parsed === "object")
71229
71352
  data = parsed;
71230
71353
  else {
71231
- console.error(chalk27.red("--data must be a JSON object"));
71354
+ console.error(chalk28.red("--data must be a JSON object"));
71232
71355
  return 1;
71233
71356
  }
71234
71357
  } catch {
71235
- console.error(chalk27.red(`--data is not valid JSON: ${opts.data}`));
71358
+ console.error(chalk28.red(`--data is not valid JSON: ${opts.data}`));
71236
71359
  return 1;
71237
71360
  }
71238
71361
  }
71239
- const dir = resolve8(opts.dir);
71362
+ const dir = resolve9(opts.dir);
71240
71363
  emitEvent(dir, type, data);
71241
- console.log(`${chalk27.green("✓")} ${type} → ${dir}/events.jsonl`);
71364
+ console.log(`${chalk28.green("✓")} ${type} → ${dir}/events.jsonl`);
71242
71365
  return 0;
71243
71366
  }
71244
71367
 
71245
71368
  // src/commands/bench.ts
71246
- import { existsSync as existsSync25, mkdirSync as mkdirSync18, readFileSync as readFileSync29, writeFileSync as writeFileSync29 } from "node:fs";
71247
- import { resolve as resolve9 } from "node:path";
71248
- import chalk28 from "chalk";
71369
+ import { existsSync as existsSync25, mkdirSync as mkdirSync18, readFileSync as readFileSync30, writeFileSync as writeFileSync29 } from "node:fs";
71370
+ import { resolve as resolve10 } from "node:path";
71371
+ import chalk29 from "chalk";
71249
71372
 
71250
71373
  // src/diff/motion.ts
71251
71374
  var WEIGHT = {
@@ -71673,20 +71796,20 @@ async function gatherBenchSide(browser, opts) {
71673
71796
  async function benchCommand(opts) {
71674
71797
  const viewport = parseViewport3(opts.viewport);
71675
71798
  if (!viewport) {
71676
- console.error(chalk28.red(`--viewport inválido: ${opts.viewport}`));
71799
+ console.error(chalk29.red(`--viewport inválido: ${opts.viewport}`));
71677
71800
  return 2;
71678
71801
  }
71679
71802
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
71680
71803
  let props;
71681
71804
  if (opts.props) {
71682
71805
  if (!existsSync25(opts.props)) {
71683
- console.error(chalk28.red(`--props não encontrado: ${opts.props}`));
71806
+ console.error(chalk29.red(`--props não encontrado: ${opts.props}`));
71684
71807
  return 2;
71685
71808
  }
71686
71809
  try {
71687
- props = JSON.parse(readFileSync29(opts.props, "utf8"));
71810
+ props = JSON.parse(readFileSync30(opts.props, "utf8"));
71688
71811
  } catch (err) {
71689
- console.error(chalk28.red(`--props não é JSON válido: ${err.message}`));
71812
+ console.error(chalk29.red(`--props não é JSON válido: ${err.message}`));
71690
71813
  return 2;
71691
71814
  }
71692
71815
  }
@@ -71701,7 +71824,7 @@ async function benchCommand(opts) {
71701
71824
  const prefix = `bench-${slug}-${viewport}`;
71702
71825
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
71703
71826
  if (aliasNote)
71704
- console.log(chalk28.dim(` ${aliasNote}`));
71827
+ console.log(chalk29.dim(` ${aliasNote}`));
71705
71828
  const browser = await launchBrowser({ headless: true });
71706
71829
  try {
71707
71830
  const [prodSide, candSide] = await Promise.all([
@@ -71710,14 +71833,14 @@ async function benchCommand(opts) {
71710
71833
  selector: prodSelector,
71711
71834
  viewport,
71712
71835
  waitMs,
71713
- screenshotPath: resolve9(opts.outDir, `${prefix}-prod.png`)
71836
+ screenshotPath: resolve10(opts.outDir, `${prefix}-prod.png`)
71714
71837
  }),
71715
71838
  gatherBenchSide(browser, {
71716
71839
  url: candUrl,
71717
71840
  selector: candSelector,
71718
71841
  viewport,
71719
71842
  waitMs,
71720
- screenshotPath: resolve9(opts.outDir, `${prefix}-cand.png`)
71843
+ screenshotPath: resolve10(opts.outDir, `${prefix}-cand.png`)
71721
71844
  })
71722
71845
  ]);
71723
71846
  const readErr = prodSide.error ?? candSide.error ?? (!prodSide.boxNodes.found ? `prod: ${prodSide.boxNodes.error}` : undefined) ?? (!candSide.boxNodes.found ? `cand: ${candSide.boxNodes.error}` : undefined);
@@ -71726,7 +71849,7 @@ async function benchCommand(opts) {
71726
71849
  if (opts.json)
71727
71850
  console.log(JSON.stringify(payload));
71728
71851
  else
71729
- console.error(chalk28.red(` bench falhou — ${readErr}`));
71852
+ console.error(chalk29.red(` bench falhou — ${readErr}`));
71730
71853
  return 2;
71731
71854
  }
71732
71855
  const geometry = diffBoxTrees(prodSide.boxNodes.nodes, candSide.boxNodes.nodes, {
@@ -71749,16 +71872,16 @@ async function benchCommand(opts) {
71749
71872
  screenshots: { prod: prodSide.screenshotPath ?? null, cand: candSide.screenshotPath ?? null },
71750
71873
  settle: { prod: prodSide.settle ?? null, cand: candSide.settle ?? null }
71751
71874
  };
71752
- const resultPath = resolve9(opts.outDir, `${prefix}.json`);
71875
+ const resultPath = resolve10(opts.outDir, `${prefix}.json`);
71753
71876
  writeFileSync29(resultPath, `${JSON.stringify(result, null, 2)}
71754
71877
  `, "utf8");
71755
71878
  if (opts.json) {
71756
71879
  console.log(JSON.stringify(result));
71757
71880
  } else {
71758
71881
  console.log("");
71759
- console.log(chalk28.bold(` ${opts.component} — isolated (${viewport})`));
71760
- console.log(chalk28.dim(` prod ${prodUrl}`));
71761
- console.log(chalk28.dim(` cand ${candUrl}`));
71882
+ console.log(chalk29.bold(` ${opts.component} — isolated (${viewport})`));
71883
+ console.log(chalk29.dim(` prod ${prodUrl}`));
71884
+ console.log(chalk29.dim(` cand ${candUrl}`));
71762
71885
  console.log("");
71763
71886
  for (const line of formatBoxTreeDiff(geometry).split(`
71764
71887
  `))
@@ -71769,7 +71892,7 @@ async function benchCommand(opts) {
71769
71892
  ]) {
71770
71893
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
71771
71894
  if (caveat)
71772
- console.log(chalk28.yellow(` ${caveat}`));
71895
+ console.log(chalk29.yellow(` ${caveat}`));
71773
71896
  }
71774
71897
  if (motion) {
71775
71898
  console.log("");
@@ -71778,7 +71901,7 @@ async function benchCommand(opts) {
71778
71901
  console.log(` ${line}`);
71779
71902
  }
71780
71903
  console.log("");
71781
- console.log(chalk28.dim(` ${resultPath}`));
71904
+ console.log(chalk29.dim(` ${resultPath}`));
71782
71905
  }
71783
71906
  return clean || !opts.failOnDiff ? 0 : 1;
71784
71907
  } finally {
@@ -71789,7 +71912,7 @@ async function benchCommand(opts) {
71789
71912
  }
71790
71913
 
71791
71914
  // src/commands/locate.ts
71792
- import chalk29 from "chalk";
71915
+ import chalk30 from "chalk";
71793
71916
  var hitOf = (n, nodes) => ({
71794
71917
  key: n.key,
71795
71918
  label: n.label,
@@ -71914,22 +72037,22 @@ function printResult3(r) {
71914
72037
  const side = (name, a) => {
71915
72038
  if (a.found) {
71916
72039
  console.log(` ${name.padEnd(5)} ${a.hit.tag.padEnd(8)} ${formatHit(a.hit)}`);
71917
- console.log(chalk29.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
72040
+ console.log(chalk30.dim(` node: ${a.hit.key}${a.hit.label ? ` (${a.hit.label})` : ""}`));
71918
72041
  return;
71919
72042
  }
71920
- console.log(chalk29.yellow(` ${name.padEnd(5)} ${a.reason}`));
72043
+ console.log(chalk30.yellow(` ${name.padEnd(5)} ${a.reason}`));
71921
72044
  for (const c of a.candidates ?? [])
71922
- console.log(chalk29.dim(` candidate: ${c}`));
72045
+ console.log(chalk30.dim(` candidate: ${c}`));
71923
72046
  };
71924
72047
  console.log("");
71925
- console.log(chalk29.bold(` ${r.label} — ${r.viewport}`));
72048
+ console.log(chalk30.bold(` ${r.label} — ${r.viewport}`));
71926
72049
  side("prod", r.prod);
71927
72050
  side("cand", r.cand);
71928
72051
  if (r.prod.found && r.cand.found) {
71929
72052
  const delta = formatDelta(r.prod.hit, r.cand.hit);
71930
72053
  console.log(` ${"diff".padEnd(5)} ${delta ?? "identical box and type"}`);
71931
72054
  for (const note of pairingNotes(r.prod.hit, r.cand.hit)) {
71932
- console.log(chalk29.yellow(` note ${note}`));
72055
+ console.log(chalk30.yellow(` note ${note}`));
71933
72056
  }
71934
72057
  }
71935
72058
  }
@@ -71937,22 +72060,22 @@ async function locateCommand(opts) {
71937
72060
  const selector = opts.selector ?? "body";
71938
72061
  const waitMs = Number.parseInt(opts.wait, 10);
71939
72062
  if (!Number.isFinite(waitMs) || waitMs < 0) {
71940
- console.error(chalk29.red(`--wait inválido: ${opts.wait}`));
72063
+ console.error(chalk30.red(`--wait inválido: ${opts.wait}`));
71941
72064
  return 2;
71942
72065
  }
71943
72066
  if (opts.labels.length === 0) {
71944
- console.error(chalk29.red("nenhum --label passado — o comando procura por label, não por seletor"));
72067
+ console.error(chalk30.red("nenhum --label passado — o comando procura por label, não por seletor"));
71945
72068
  return 2;
71946
72069
  }
71947
72070
  const viewports = opts.viewports.split(",").map((v) => v.trim());
71948
72071
  const bad = viewports.find((v) => parseViewport3(v) === null);
71949
72072
  if (bad) {
71950
- console.error(chalk29.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
72073
+ console.error(chalk30.red(`viewport inválido: ${bad} (mobile | tablet | desktop)`));
71951
72074
  return 2;
71952
72075
  }
71953
72076
  const { aliases, note } = resolveAliases(opts.planDir);
71954
72077
  if (note && !opts.json)
71955
- console.log(chalk29.dim(` ${note}`));
72078
+ console.log(chalk30.dim(` ${note}`));
71956
72079
  const results = [];
71957
72080
  const caveats = [];
71958
72081
  const browser = await launchBrowser({ headless: true });
@@ -72007,45 +72130,45 @@ async function locateCommand(opts) {
72007
72130
  for (const r of results)
72008
72131
  printResult3(r);
72009
72132
  for (const c of caveats)
72010
- console.log(chalk29.yellow(` ${c}`));
72133
+ console.log(chalk30.yellow(` ${c}`));
72011
72134
  console.log("");
72012
72135
  if (unresolved.length > 0) {
72013
- console.log(chalk29.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72136
+ console.log(chalk30.yellow(` ${unresolved.length} of ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} unresolved — those rows are not a measurement`));
72014
72137
  } else {
72015
- console.log(chalk29.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
72138
+ console.log(chalk30.green(` ${results.length} label×viewport pair${results.length === 1 ? "" : "s"} located on both sides`));
72016
72139
  }
72017
72140
  return unresolved.length > 0 ? 1 : 0;
72018
72141
  }
72019
72142
 
72020
72143
  // src/commands/cockpit.ts
72021
- import { resolve as resolve14 } from "node:path";
72022
- import chalk30 from "chalk";
72144
+ import { resolve as resolve15 } from "node:path";
72145
+ import chalk31 from "chalk";
72023
72146
 
72024
72147
  // src/server/cockpit.ts
72025
- import { readFileSync as readFileSync34 } from "node:fs";
72148
+ import { readFileSync as readFileSync35 } from "node:fs";
72026
72149
  import { createServer as createServer2 } from "node:http";
72027
- import { dirname as dirname7, join as join41, resolve as resolve13 } from "node:path";
72150
+ import { dirname as dirname8, join as join42, resolve as resolve14 } from "node:path";
72028
72151
 
72029
72152
  // src/server/cockpit-actions.ts
72030
72153
  import { spawn as spawn3 } from "node:child_process";
72031
- import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync31, readdirSync as readdirSync6, writeFileSync as writeFileSync31 } from "node:fs";
72032
- import { join as join38, resolve as resolve11 } from "node:path";
72154
+ import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync32, readdirSync as readdirSync7, writeFileSync as writeFileSync31 } from "node:fs";
72155
+ import { join as join39, resolve as resolve12 } from "node:path";
72033
72156
 
72034
72157
  // src/server/cockpit-settings.ts
72035
72158
  import { execFileSync as execFileSync3 } from "node:child_process";
72036
- import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync30, writeFileSync as writeFileSync30 } from "node:fs";
72159
+ import { chmodSync, existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync31, writeFileSync as writeFileSync30 } from "node:fs";
72037
72160
  import { homedir as homedir3 } from "node:os";
72038
- import { join as join37, resolve as resolve10 } from "node:path";
72039
- var FILE = () => join37(process.env.PARITY_HOME ?? join37(homedir3(), ".parity"), "config.json");
72161
+ import { join as join38, resolve as resolve11 } from "node:path";
72162
+ var FILE = () => join38(process.env.PARITY_HOME ?? join38(homedir3(), ".parity"), "config.json");
72040
72163
  function readAll() {
72041
72164
  try {
72042
- return JSON.parse(readFileSync30(FILE(), "utf8"));
72165
+ return JSON.parse(readFileSync31(FILE(), "utf8"));
72043
72166
  } catch {
72044
72167
  return {};
72045
72168
  }
72046
72169
  }
72047
72170
  function getSettings(planDir) {
72048
- return readAll().migrations?.[resolve10(planDir)] ?? {};
72171
+ return readAll().migrations?.[resolve11(planDir)] ?? {};
72049
72172
  }
72050
72173
  function saveSettings(planDir, next) {
72051
72174
  for (const [k, v] of Object.entries(next)) {
@@ -72058,9 +72181,9 @@ function saveSettings(planDir, next) {
72058
72181
  const all = readAll();
72059
72182
  all.migrations = {
72060
72183
  ...all.migrations ?? {},
72061
- [resolve10(planDir)]: { ...getSettings(planDir), ...next }
72184
+ [resolve11(planDir)]: { ...getSettings(planDir), ...next }
72062
72185
  };
72063
- mkdirSync19(join37(FILE(), ".."), { recursive: true });
72186
+ mkdirSync19(join38(FILE(), ".."), { recursive: true });
72064
72187
  writeFileSync30(FILE(), JSON.stringify(all, null, 2));
72065
72188
  chmodSync(FILE(), 384);
72066
72189
  return getSettings(planDir);
@@ -72197,7 +72320,7 @@ var COMPONENT_STATUSES = [
72197
72320
  var PAGE_STATUSES2 = ["pending", "code", "done", "skipped"];
72198
72321
  function readState(planDir) {
72199
72322
  try {
72200
- return JSON.parse(readFileSync31(join38(planDir, "migration.json"), "utf8"));
72323
+ return JSON.parse(readFileSync32(join39(planDir, "migration.json"), "utf8"));
72201
72324
  } catch {
72202
72325
  return null;
72203
72326
  }
@@ -72302,11 +72425,11 @@ function setComponentSelector(planDir, name, selector) {
72302
72425
  return c;
72303
72426
  }
72304
72427
  function captured(planDir, host, name) {
72305
- const file = join38(planDir, host, "capture.json");
72428
+ const file = join39(planDir, host, "capture.json");
72306
72429
  if (!existsSync27(file))
72307
72430
  return null;
72308
72431
  try {
72309
- const cap = JSON.parse(readFileSync31(file, "utf8"));
72432
+ const cap = JSON.parse(readFileSync32(file, "utf8"));
72310
72433
  const rows = Array.isArray(cap.components) ? cap.components : [];
72311
72434
  return rows.find((r) => r.role === name || r.name === name) ?? null;
72312
72435
  } catch {
@@ -72355,9 +72478,9 @@ function componentShot(planDir, name) {
72355
72478
  }
72356
72479
  const cap = captured(planDir, host, name);
72357
72480
  const p = typeof cap?.screenshotPath === "string" ? cap.screenshotPath : null;
72358
- if (!p || !resolve11(p).startsWith(resolve11(join38(planDir, host))))
72481
+ if (!p || !resolve12(p).startsWith(resolve12(join39(planDir, host))))
72359
72482
  return null;
72360
- return existsSync27(p) ? readFileSync31(p) : null;
72483
+ return existsSync27(p) ? readFileSync32(p) : null;
72361
72484
  }
72362
72485
  function setPage(planDir, path, status) {
72363
72486
  if (!PAGE_STATUSES2.includes(status)) {
@@ -72372,16 +72495,16 @@ function setPage(planDir, path, status) {
72372
72495
  savePlan(planDir, plan);
72373
72496
  return p;
72374
72497
  }
72375
- var jobsDir = (planDir) => join38(planDir, "jobs");
72498
+ var jobsDir = (planDir) => join39(planDir, "jobs");
72376
72499
  function lastJob(planDir, kind) {
72377
72500
  const dir = jobsDir(planDir);
72378
72501
  if (!existsSync27(dir))
72379
72502
  return null;
72380
- const id = readdirSync6(dir).filter((d) => d.startsWith(`${kind}-`)).sort().pop();
72503
+ const id = readdirSync7(dir).filter((d) => d.startsWith(`${kind}-`)).sort().pop();
72381
72504
  if (!id)
72382
72505
  return null;
72383
- const j = join38(dir, id);
72384
- const read = (f) => existsSync27(join38(j, f)) ? readFileSync31(join38(j, f), "utf8") : null;
72506
+ const j = join39(dir, id);
72507
+ const read = (f) => existsSync27(join39(j, f)) ? readFileSync32(join39(j, f), "utf8") : null;
72385
72508
  const exit = read("exit");
72386
72509
  const pid = Number(read("pid") ?? 0);
72387
72510
  let alive = false;
@@ -72413,25 +72536,25 @@ function startReindex(planDir) {
72413
72536
  throw new Error("no prod URL in migration.json or the plan");
72414
72537
  const target = state?.target?.name ?? plan?.target?.name;
72415
72538
  const id = `reindex-${new Date().toISOString().replace(/[-:T]/g, "").slice(0, 14)}`;
72416
- const dir = join38(jobsDir(planDir), id);
72539
+ const dir = join39(jobsDir(planDir), id);
72417
72540
  mkdirSync20(dir, { recursive: true });
72418
- writeFileSync31(join38(jobsDir(planDir), ".gitignore"), `*
72541
+ writeFileSync31(join39(jobsDir(planDir), ".gitignore"), `*
72419
72542
  `);
72420
- writeFileSync31(join38(dir, "started"), new Date().toISOString());
72543
+ writeFileSync31(join39(dir, "started"), new Date().toISOString());
72421
72544
  const host = new URL(url).host;
72422
72545
  const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
72423
- const cli = `${q(process.execPath)} ${q(resolve11(process.argv[1] ?? ""))}`;
72424
- const out = join38(dir, "capture");
72546
+ const cli = `${q(process.execPath)} ${q(resolve12(process.argv[1] ?? ""))}`;
72547
+ const out = join39(dir, "capture");
72425
72548
  const sh = [
72426
72549
  `${cli} capture --url ${q(url)}${target ? ` --target ${q(target)}` : ""} --out ${q(out)} --refresh`,
72427
- `${cli} plan merge ${q(join38(out, host))} --dir ${q(resolve11(planDir))}`
72550
+ `${cli} plan merge ${q(join39(out, host))} --dir ${q(resolve12(planDir))}`
72428
72551
  ].join(" && ");
72429
- const child = spawn3("sh", ["-c", `(${sh}) > ${q(join38(dir, "log"))} 2>&1; echo $? > ${q(join38(dir, "exit"))}`], {
72552
+ const child = spawn3("sh", ["-c", `(${sh}) > ${q(join39(dir, "log"))} 2>&1; echo $? > ${q(join39(dir, "exit"))}`], {
72430
72553
  detached: true,
72431
72554
  stdio: "ignore"
72432
72555
  });
72433
72556
  child.unref();
72434
- writeFileSync31(join38(dir, "pid"), String(child.pid ?? ""));
72557
+ writeFileSync31(join39(dir, "pid"), String(child.pid ?? ""));
72435
72558
  return lastJob(planDir, "reindex");
72436
72559
  }
72437
72560
  function remoteUrl(dir) {
@@ -72440,14 +72563,14 @@ function remoteUrl(dir) {
72440
72563
  }
72441
72564
 
72442
72565
  // src/server/cockpit-api.ts
72443
- import { existsSync as existsSync28, readFileSync as readFileSync32, readdirSync as readdirSync7 } from "node:fs";
72444
- import { join as join39 } from "node:path";
72566
+ import { existsSync as existsSync28, readFileSync as readFileSync33, readdirSync as readdirSync8 } from "node:fs";
72567
+ import { join as join40 } from "node:path";
72445
72568
  var notFound = (what) => ({ status: 404, body: { error: what } });
72446
72569
  function readJson2(path) {
72447
72570
  if (!existsSync28(path))
72448
72571
  return null;
72449
72572
  try {
72450
- return JSON.parse(readFileSync32(path, "utf8"));
72573
+ return JSON.parse(readFileSync33(path, "utf8"));
72451
72574
  } catch {
72452
72575
  return null;
72453
72576
  }
@@ -72460,13 +72583,13 @@ function listBenchResults(benchDir) {
72460
72583
  return [];
72461
72584
  let files;
72462
72585
  try {
72463
- files = readdirSync7(benchDir).filter((f) => f.startsWith("bench-") && f.endsWith(".json"));
72586
+ files = readdirSync8(benchDir).filter((f) => f.startsWith("bench-") && f.endsWith(".json"));
72464
72587
  } catch {
72465
72588
  return [];
72466
72589
  }
72467
72590
  const out = [];
72468
72591
  for (const file of files) {
72469
- const raw = readJson2(join39(benchDir, file));
72592
+ const raw = readJson2(join40(benchDir, file));
72470
72593
  if (!raw?.component)
72471
72594
  continue;
72472
72595
  out.push({
@@ -72491,11 +72614,11 @@ function cockpitApi(path, params, ctx) {
72491
72614
  benchDir: ctx.benchDir,
72492
72615
  prodUrl: ctx.prodUrl ?? null,
72493
72616
  candUrl: ctx.candUrl ?? null,
72494
- hasPlan: existsSync28(join39(ctx.planDir, "migration-plan.json"))
72617
+ hasPlan: existsSync28(join40(ctx.planDir, "migration-plan.json"))
72495
72618
  }
72496
72619
  };
72497
72620
  case "/api/state": {
72498
- const state = readJson2(join39(ctx.planDir, "migration.json"));
72621
+ const state = readJson2(join40(ctx.planDir, "migration.json"));
72499
72622
  return state ? { status: 200, body: state } : notFound("no migration.json — no migration has been started here");
72500
72623
  }
72501
72624
  case "/api/plan": {
@@ -72570,7 +72693,7 @@ function cockpitApi(path, params, ctx) {
72570
72693
  if (file.includes("/") || file.includes("\\") || !/^bench-[\w.-]+\.json$/.test(file)) {
72571
72694
  return { status: 400, body: { error: "bad file name" } };
72572
72695
  }
72573
- const raw = readJson2(join39(ctx.benchDir, file));
72696
+ const raw = readJson2(join40(ctx.benchDir, file));
72574
72697
  return raw ? { status: 200, body: raw } : notFound(`no bench result ${file}`);
72575
72698
  }
72576
72699
  default:
@@ -73063,8 +73186,8 @@ import {
73063
73186
  appendFileSync as appendFileSync2,
73064
73187
  existsSync as existsSync29,
73065
73188
  mkdirSync as mkdirSync21,
73066
- readFileSync as readFileSync33,
73067
- readdirSync as readdirSync8,
73189
+ readFileSync as readFileSync34,
73190
+ readdirSync as readdirSync9,
73068
73191
  realpathSync,
73069
73192
  renameSync as renameSync2,
73070
73193
  rmSync,
@@ -73073,7 +73196,7 @@ import {
73073
73196
  unlinkSync as unlinkSync4,
73074
73197
  writeFileSync as writeFileSync32
73075
73198
  } from "node:fs";
73076
- import { dirname as dirname6, join as join40, resolve as resolve12 } from "node:path";
73199
+ import { dirname as dirname7, join as join41, resolve as resolve13 } from "node:path";
73077
73200
  import { fileURLToPath } from "node:url";
73078
73201
  var VIEWPORT = {
73079
73202
  mobile: { width: 412, height: 839 },
@@ -73082,22 +73205,22 @@ var VIEWPORT = {
73082
73205
  };
73083
73206
  var MOBILE_UA2 = "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.0 Mobile/15E148 Safari/604.1";
73084
73207
  var STALL_MS = Number(process.env.PARITY_STALL_MS ?? 10 * 60000);
73085
- var tasksDir = (planDir) => join40(planDir, "tasks");
73086
- var taskDir = (planDir, id) => join40(tasksDir(planDir), id);
73208
+ var tasksDir = (planDir) => join41(planDir, "tasks");
73209
+ var taskDir = (planDir, id) => join41(tasksDir(planDir), id);
73087
73210
  function validTaskId(id) {
73088
73211
  return /^[\w-]{6,64}$/.test(id);
73089
73212
  }
73090
73213
  function pluginDir() {
73091
- const root = resolve12(dirname6(fileURLToPath(import.meta.url)), "../../../..");
73092
- return existsSync29(join40(root, ".claude-plugin", "plugin.json")) ? root : null;
73214
+ const root = resolve13(dirname7(fileURLToPath(import.meta.url)), "../../../..");
73215
+ return existsSync29(join41(root, ".claude-plugin", "plugin.json")) ? root : null;
73093
73216
  }
73094
73217
  function targetDir(planDir) {
73095
73218
  try {
73096
- const state = JSON.parse(readFileSync33(join40(planDir, "migration.json"), "utf8"));
73219
+ const state = JSON.parse(readFileSync34(join41(planDir, "migration.json"), "utf8"));
73097
73220
  if (typeof state?.target?.dir === "string" && existsSync29(state.target.dir))
73098
73221
  return state.target.dir;
73099
73222
  } catch {}
73100
- return dirname6(resolve12(planDir));
73223
+ return dirname7(resolve13(planDir));
73101
73224
  }
73102
73225
  function withPath(base, path) {
73103
73226
  try {
@@ -73133,7 +73256,7 @@ async function capture(task, dir) {
73133
73256
  await page.waitForTimeout(2500);
73134
73257
  const el = page.locator(selector).first();
73135
73258
  await el.scrollIntoViewIfNeeded({ timeout: 8000 });
73136
- const file = join40(dir, `${side}.png`);
73259
+ const file = join41(dir, `${side}.png`);
73137
73260
  await el.screenshot({ path: file, timeout: 1e4 });
73138
73261
  shots[side] = file;
73139
73262
  } catch (err) {
@@ -73148,7 +73271,7 @@ async function capture(task, dir) {
73148
73271
  }
73149
73272
  return { shots, ...misses.length ? { captureError: misses.join("; ") } : {} };
73150
73273
  }
73151
- var SKIP_DIRS = new Set([
73274
+ var SKIP_DIRS2 = new Set([
73152
73275
  "node_modules",
73153
73276
  ".git",
73154
73277
  ".next",
@@ -73176,22 +73299,22 @@ function locateSource(html, root) {
73176
73299
  return;
73177
73300
  let entries;
73178
73301
  try {
73179
- entries = readdirSync8(dir, { withFileTypes: true });
73302
+ entries = readdirSync9(dir, { withFileTypes: true });
73180
73303
  } catch {
73181
73304
  return;
73182
73305
  }
73183
73306
  for (const e of entries) {
73184
73307
  if (e.isDirectory()) {
73185
- if (!SKIP_DIRS.has(e.name) && !e.name.startsWith("."))
73186
- walk(join40(dir, e.name), depth + 1);
73308
+ if (!SKIP_DIRS2.has(e.name) && !e.name.startsWith("."))
73309
+ walk(join41(dir, e.name), depth + 1);
73187
73310
  continue;
73188
73311
  }
73189
73312
  const stem = e.name.split(".")[0] ?? "";
73190
73313
  if (!mods.has(stem))
73191
73314
  continue;
73192
- const file = join40(dir, e.name);
73315
+ const file = join41(dir, e.name);
73193
73316
  if (/\.(s?css|less)$/.test(e.name)) {
73194
- const lines = readFileSync33(file, "utf8").split(`
73317
+ const lines = readFileSync34(file, "utf8").split(`
73195
73318
  `);
73196
73319
  for (const local of mods.get(stem) ?? []) {
73197
73320
  const leaf = local.split("__").pop() ?? local;
@@ -73203,7 +73326,7 @@ function locateSource(html, root) {
73203
73326
  }
73204
73327
  }
73205
73328
  };
73206
- walk(existsSync29(join40(root, "src")) ? join40(root, "src") : root, 0);
73329
+ walk(existsSync29(join41(root, "src")) ? join41(root, "src") : root, 0);
73207
73330
  return hits;
73208
73331
  }
73209
73332
  function grid(s) {
@@ -73305,7 +73428,7 @@ function contextLines(task, dir) {
73305
73428
  ${diff.map((k) => ` ${k}: ${prod.styles[k]} → ${cand.styles[k]}`).join(`
73306
73429
  `)}` : "- Computed styles: no difference in the tracked properties (the difference is in children or content).");
73307
73430
  }
73308
- out.push(`- Full measurements (styles, children, HTML of both sides): ${join40(dir, "context.json")}`);
73431
+ out.push(`- Full measurements (styles, children, HTML of both sides): ${join41(dir, "context.json")}`);
73309
73432
  return out;
73310
73433
  }
73311
73434
  function deliveryRule(planDir, task) {
@@ -73337,7 +73460,7 @@ function prompt(task, planDir, dir) {
73337
73460
  const other = task.side === "prod" ? "cand" : "prod";
73338
73461
  return [
73339
73462
  "You are the parity migration orchestrator. Load the `parity:migration-orchestrator` skill and follow its rules (dispatch, never work inline; shell goes through `runner`).",
73340
- `The migration state is in ${join40(resolve12(planDir), "migration.json")}.`,
73463
+ `The migration state is in ${join41(resolve13(planDir), "migration.json")}.`,
73341
73464
  "",
73342
73465
  "A reviewer left this note in the parity cockpit. Treat it as ONE scoped fix round for this element only — not a full migration pass.",
73343
73466
  `- Note: ${JSON.stringify(task.text)}`,
@@ -73353,7 +73476,7 @@ function prompt(task, planDir, dir) {
73353
73476
  "",
73354
73477
  "Steps:",
73355
73478
  `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.`,
73356
- existsSync29(join40(dir, "sizes.md")) ? `1. The numbers are already measured and written to ${join40(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: ${join40(dir, "brief.md")}), then \`fixer\` with brief.md and the TARGET repo's conventions.rules + gates.`,
73479
+ 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.`,
73357
73480
  " 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.",
73358
73481
  `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.`,
73359
73482
  "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:",
@@ -73380,7 +73503,7 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73380
73503
  }
73381
73504
  }
73382
73505
  const sha = git("rev-parse", ref);
73383
- const wt = join40(dir, "wt");
73506
+ const wt = join41(dir, "wt");
73384
73507
  git("worktree", "add", "-b", branch, wt, sha);
73385
73508
  const locks = ["package.json", "yarn.lock", "bun.lock", "package-lock.json", "pnpm-lock.yaml"];
73386
73509
  const sameDeps = (() => {
@@ -73393,8 +73516,8 @@ function prepareWorktree(task, planDir, dir, branch = `cockpit/${task.id}`) {
73393
73516
  return false;
73394
73517
  }
73395
73518
  })();
73396
- if (sameDeps && existsSync29(join40(repo, "node_modules")) && !existsSync29(join40(wt, "node_modules"))) {
73397
- symlinkSync(join40(repo, "node_modules"), join40(wt, "node_modules"));
73519
+ if (sameDeps && existsSync29(join41(repo, "node_modules")) && !existsSync29(join41(wt, "node_modules"))) {
73520
+ symlinkSync(join41(repo, "node_modules"), join41(wt, "node_modules"));
73398
73521
  }
73399
73522
  return { worktree: wt, branch, base: { ref, sha } };
73400
73523
  } catch (err) {
@@ -73407,7 +73530,7 @@ function sweepShell(worktree) {
73407
73530
  return `d=$(cd ${q(worktree)} 2>/dev/null && pwd -P); if [ -n "$d" ] && [ "$d" != "/" ]; then lsof -d cwd -Fpn 2>/dev/null | awk -v d="$d/" '/^p/{p=substr($0,2)} /^n/{n=substr($0,2)"/"; if(index(n,d)==1) print p}' | while read p; do kill "$p" 2>/dev/null; done; fi`;
73408
73531
  }
73409
73532
  function launch(task, planDir, dir, resume) {
73410
- const promptFile = resume?.promptFile ?? join40(dir, "prompt.md");
73533
+ const promptFile = resume?.promptFile ?? join41(dir, "prompt.md");
73411
73534
  if (!resume)
73412
73535
  writeFileSync32(promptFile, prompt(task, planDir, dir));
73413
73536
  const plugin = pluginDir();
@@ -73426,7 +73549,7 @@ function launch(task, planDir, dir, resume) {
73426
73549
  ].filter(Boolean);
73427
73550
  const out = resume ? ">>" : ">";
73428
73551
  const sweep = task.worktree ? `; ${sweepShell(task.worktree)}` : "";
73429
- const sh = `${args.join(" ")} ${out} ${q(join40(dir, "stream.jsonl"))} 2> ${q(join40(dir, "stderr.log"))}; code=$?${sweep}; echo $code > ${q(join40(dir, "exit"))}`;
73552
+ const sh = `${args.join(" ")} ${out} ${q(join41(dir, "stream.jsonl"))} 2> ${q(join41(dir, "stderr.log"))}; code=$?${sweep}; echo $code > ${q(join41(dir, "exit"))}`;
73430
73553
  task.cwd ??= task.worktree ?? targetDir(planDir);
73431
73554
  const child = spawn4("sh", ["-c", sh], {
73432
73555
  env: { ...process.env, ...ghEnv(effectiveSettings(planDir, targetDir(planDir)).githubUser) },
@@ -73467,39 +73590,39 @@ function retryTask(planDir, id, note) {
73467
73590
  note ? `The reviewer adds: ${JSON.stringify(note)}` : "",
73468
73591
  `Preview: ONE server for this task at http://localhost:${previewPort(task.id)} — reuse it if it is already up, rebuild and restart it only after a new commit; never a second one. QA: ${qaCommand(task, dir)}`,
73469
73592
  "Before any new fix, if it was never shown that the difference reproduces on the deployed cand, reproduce it first with `parity section --task` (no build); if it does not, stop and say so.",
73470
- `Same rules as ${join40(dir, "prompt.md")}, and this delivery rule:`,
73593
+ `Same rules as ${join41(dir, "prompt.md")}, and this delivery rule:`,
73471
73594
  deliveryRule(planDir, task)
73472
73595
  ].filter(Boolean);
73473
- const promptFile = join40(dir, `prompt-${n}.md`);
73596
+ const promptFile = join41(dir, `prompt-${n}.md`);
73474
73597
  writeFileSync32(promptFile, lines.join(`
73475
73598
  `));
73476
- if (existsSync29(join40(dir, "stderr.log")))
73477
- renameSync2(join40(dir, "stderr.log"), join40(dir, `stderr-${n - 1}.log`));
73478
- if (existsSync29(join40(dir, "exit")))
73479
- unlinkSync4(join40(dir, "exit"));
73480
- if (existsSync29(join40(dir, "stopped")))
73481
- unlinkSync4(join40(dir, "stopped"));
73599
+ if (existsSync29(join41(dir, "stderr.log")))
73600
+ renameSync2(join41(dir, "stderr.log"), join41(dir, `stderr-${n - 1}.log`));
73601
+ if (existsSync29(join41(dir, "exit")))
73602
+ unlinkSync4(join41(dir, "exit"));
73603
+ if (existsSync29(join41(dir, "stopped")))
73604
+ unlinkSync4(join41(dir, "stopped"));
73482
73605
  task.attempts = [
73483
73606
  ...task.attempts ?? [],
73484
73607
  { at: new Date().toISOString(), reason: d.reason ?? d.status, ...note ? { note } : {} }
73485
73608
  ];
73486
73609
  task.cwd ??= targetDir(planDir);
73487
- appendFileSync2(join40(dir, "stream.jsonl"), `${JSON.stringify({ type: "parity", subtype: "attempt", n, at: new Date().toISOString() })}
73610
+ appendFileSync2(join41(dir, "stream.jsonl"), `${JSON.stringify({ type: "parity", subtype: "attempt", n, at: new Date().toISOString() })}
73488
73611
  `);
73489
73612
  task.pid = launch(task, planDir, dir, { promptFile });
73490
- writeFileSync32(join40(dir, "task.json"), JSON.stringify(task, null, 2));
73613
+ writeFileSync32(join41(dir, "task.json"), JSON.stringify(task, null, 2));
73491
73614
  return task;
73492
73615
  }
73493
73616
  async function createTask(planDir, note) {
73494
73617
  const id = `${new Date().toISOString().replace(/[-:T]/g, "").slice(0, 14)}-${randomUUID().slice(0, 6)}`;
73495
73618
  const dir = taskDir(planDir, id);
73496
73619
  mkdirSync21(dir, { recursive: true });
73497
- writeFileSync32(join40(tasksDir(planDir), ".gitignore"), `*
73620
+ writeFileSync32(join41(tasksDir(planDir), ".gitignore"), `*
73498
73621
  `);
73499
73622
  if (note.context) {
73500
- writeFileSync32(join40(dir, "context.json"), JSON.stringify(note.context, null, 2));
73623
+ writeFileSync32(join41(dir, "context.json"), JSON.stringify(note.context, null, 2));
73501
73624
  const sources = note.context.cand ? locateSource(note.context.cand.html, targetDir(planDir)) : [];
73502
- writeFileSync32(join40(dir, "sizes.md"), sizesMarkdown(note, sources));
73625
+ writeFileSync32(join41(dir, "sizes.md"), sizesMarkdown(note, sources));
73503
73626
  }
73504
73627
  const task = {
73505
73628
  ...note,
@@ -73508,7 +73631,7 @@ async function createTask(planDir, note) {
73508
73631
  sessionId: randomUUID(),
73509
73632
  shots: { prod: null, cand: null }
73510
73633
  };
73511
- const save = () => writeFileSync32(join40(dir, "task.json"), JSON.stringify(task, null, 2));
73634
+ const save = () => writeFileSync32(join41(dir, "task.json"), JSON.stringify(task, null, 2));
73512
73635
  save();
73513
73636
  (async () => {
73514
73637
  try {
@@ -73570,18 +73693,18 @@ function taskProcesses(worktree) {
73570
73693
  }
73571
73694
  function stopTask(planDir, id) {
73572
73695
  const dir = taskDir(planDir, id);
73573
- const file = join40(dir, "task.json");
73696
+ const file = join41(dir, "task.json");
73574
73697
  if (!existsSync29(file))
73575
73698
  throw new Error("no such task");
73576
- const task = JSON.parse(readFileSync33(file, "utf8"));
73699
+ const task = JSON.parse(readFileSync34(file, "utf8"));
73577
73700
  let stopped = 0;
73578
- if (task.pid && alive(task.pid) && !existsSync29(join40(dir, "exit"))) {
73701
+ if (task.pid && alive(task.pid) && !existsSync29(join41(dir, "exit"))) {
73579
73702
  try {
73580
73703
  process.kill(-task.pid, "SIGTERM");
73581
73704
  stopped += 1;
73582
73705
  } catch {}
73583
- writeFileSync32(join40(dir, "stopped"), new Date().toISOString());
73584
- writeFileSync32(join40(dir, "exit"), `143
73706
+ writeFileSync32(join41(dir, "stopped"), new Date().toISOString());
73707
+ writeFileSync32(join41(dir, "exit"), `143
73585
73708
  `);
73586
73709
  }
73587
73710
  procCache.delete(task.worktree ?? "");
@@ -73685,7 +73808,7 @@ function openPr(planDir, id, baseOverride) {
73685
73808
  if (!plan.commits.length)
73686
73809
  throw new Error("the branch has no commits of its own");
73687
73810
  const dir = taskDir(planDir, id);
73688
- const task = JSON.parse(readFileSync33(join40(dir, "task.json"), "utf8"));
73811
+ const task = JSON.parse(readFileSync34(join41(dir, "task.json"), "utf8"));
73689
73812
  const wt = task.worktree;
73690
73813
  const env = { ...process.env, ...ghEnv(plan.account ?? undefined) };
73691
73814
  const git = (...a) => execFileSync4("git", ["-C", wt, ...a], { encoding: "utf8", timeout: 120000, env }).trim();
@@ -73720,7 +73843,7 @@ function openPr(planDir, id, baseOverride) {
73720
73843
  ...plan.commits.map((c) => `- ${c}`)
73721
73844
  ].join(`
73722
73845
  `);
73723
- const bodyFile = join40(dir, "pr-body.md");
73846
+ const bodyFile = join41(dir, "pr-body.md");
73724
73847
  writeFileSync32(bodyFile, body);
73725
73848
  const out = execFileSync4("gh", [
73726
73849
  "pr",
@@ -73738,14 +73861,14 @@ function openPr(planDir, id, baseOverride) {
73738
73861
  ], { encoding: "utf8", timeout: 60000, env, cwd: wt }).trim();
73739
73862
  const url = out.split(`
73740
73863
  `).find((l) => l.startsWith("https://")) ?? out;
73741
- writeFileSync32(join40(dir, "pr.json"), JSON.stringify({ checkedAt: Date.now(), url }));
73864
+ writeFileSync32(join41(dir, "pr.json"), JSON.stringify({ checkedAt: Date.now(), url }));
73742
73865
  return { url, created: true };
73743
73866
  }
73744
73867
  function autoOpenPrs(planDir) {
73745
73868
  for (const t of listTasks2(planDir)) {
73746
73869
  if (t.status !== "done" || t.prUrl)
73747
73870
  continue;
73748
- const mark = join40(taskDir(planDir, t.id), "pr-auto.json");
73871
+ const mark = join41(taskDir(planDir, t.id), "pr-auto.json");
73749
73872
  if (existsSync29(mark))
73750
73873
  continue;
73751
73874
  const at = new Date().toISOString();
@@ -73843,7 +73966,7 @@ function autoMergePrs(planDir) {
73843
73966
  if (t.status !== "done")
73844
73967
  continue;
73845
73968
  const dir = taskDir(planDir, t.id);
73846
- if (existsSync29(join40(dir, "pr-merge.json")))
73969
+ if (existsSync29(join41(dir, "pr-merge.json")))
73847
73970
  continue;
73848
73971
  const d = readTask(planDir, t.id);
73849
73972
  const branch = d?.delivery?.branch;
@@ -73882,14 +74005,14 @@ function autoMergePrs(planDir) {
73882
74005
  timeout: 60000,
73883
74006
  env
73884
74007
  });
73885
- writeFileSync32(join40(dir, "pr-merge.json"), JSON.stringify({ at, ok: true, number: pr.number, waived: waivers }));
74008
+ writeFileSync32(join41(dir, "pr-merge.json"), JSON.stringify({ at, ok: true, number: pr.number, waived: waivers }));
73886
74009
  } catch (err) {
73887
- writeFileSync32(join40(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
74010
+ writeFileSync32(join41(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
73888
74011
  `)[0] }));
73889
74012
  }
73890
- rmSync(join40(dir, "pr.json"), { force: true });
73891
- } else if (pr.checks.failed > 0 && !existsSync29(join40(dir, "ci-retry.json"))) {
73892
- writeFileSync32(join40(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
74013
+ rmSync(join41(dir, "pr.json"), { force: true });
74014
+ } else if (pr.checks.failed > 0 && !existsSync29(join41(dir, "ci-retry.json"))) {
74015
+ writeFileSync32(join41(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
73893
74016
  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.`);
73894
74017
  }
73895
74018
  }
@@ -73897,9 +74020,9 @@ function autoMergePrs(planDir) {
73897
74020
  function prInfo(branch, repo, dir, ended, fresh = false) {
73898
74021
  if (!ended)
73899
74022
  return null;
73900
- const cache = join40(dir, "pr.json");
74023
+ const cache = join41(dir, "pr.json");
73901
74024
  try {
73902
- const c = JSON.parse(readFileSync33(cache, "utf8"));
74025
+ const c = JSON.parse(readFileSync34(cache, "utf8"));
73903
74026
  if (!fresh && Date.now() - c.checkedAt < 60000)
73904
74027
  return c.info ?? (c.url ? { url: c.url } : null);
73905
74028
  } catch {}
@@ -73910,7 +74033,7 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
73910
74033
  encoding: "utf8",
73911
74034
  timeout: 1e4,
73912
74035
  stdio: ["ignore", "pipe", "ignore"],
73913
- env: { ...process.env, ...ghEnv(getSettings(dirname6(dirname6(dir))).githubUser) }
74036
+ env: { ...process.env, ...ghEnv(getSettings(dirname7(dirname7(dir))).githubUser) }
73914
74037
  });
73915
74038
  const j = JSON.parse(out);
73916
74039
  info = {
@@ -73928,12 +74051,12 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
73928
74051
  }
73929
74052
  function readTask(planDir, id) {
73930
74053
  const dir = taskDir(planDir, id);
73931
- const file = join40(dir, "task.json");
74054
+ const file = join41(dir, "task.json");
73932
74055
  if (!existsSync29(file))
73933
74056
  return null;
73934
- const task = JSON.parse(readFileSync33(file, "utf8"));
73935
- const streamFile = join40(dir, "stream.jsonl");
73936
- const exitFile = join40(dir, "exit");
74057
+ const task = JSON.parse(readFileSync34(file, "utf8"));
74058
+ const streamFile = join41(dir, "stream.jsonl");
74059
+ const exitFile = join41(dir, "exit");
73937
74060
  const steps = [];
73938
74061
  const agents = new Map;
73939
74062
  let result = null;
@@ -73942,7 +74065,7 @@ function readTask(planDir, id) {
73942
74065
  let lastTs;
73943
74066
  let rawResult = "";
73944
74067
  const actorOf = (parent) => parent && agents.get(parent)?.type || "orchestrator";
73945
- const lines = existsSync29(streamFile) ? readFileSync33(streamFile, "utf8").split(`
74068
+ const lines = existsSync29(streamFile) ? readFileSync34(streamFile, "utf8").split(`
73946
74069
  `) : [];
73947
74070
  for (const line of lines) {
73948
74071
  if (!line.trim())
@@ -74037,7 +74160,7 @@ function readTask(planDir, id) {
74037
74160
  const scan = (t) => [...t.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74038
74161
  let res = scan(String(m.summary ?? ""));
74039
74162
  if (!res && typeof m.output_file === "string" && existsSync29(m.output_file)) {
74040
- res = scan(agentText(readFileSync33(m.output_file, "utf8")));
74163
+ res = scan(agentText(readFileSync34(m.output_file, "utf8")));
74041
74164
  }
74042
74165
  if (res) {
74043
74166
  try {
@@ -74062,8 +74185,8 @@ function readTask(planDir, id) {
74062
74185
  steps.push({ actor: "orchestrator", kind: "result", text: result.text, isError: !result.ok });
74063
74186
  }
74064
74187
  }
74065
- const exit = existsSync29(exitFile) ? Number(readFileSync33(exitFile, "utf8").trim()) : null;
74066
- const stderrRaw = existsSync29(join40(dir, "stderr.log")) ? readFileSync33(join40(dir, "stderr.log"), "utf8") : "";
74188
+ const exit = existsSync29(exitFile) ? Number(readFileSync34(exitFile, "utf8").trim()) : null;
74189
+ const stderrRaw = existsSync29(join41(dir, "stderr.log")) ? readFileSync34(join41(dir, "stderr.log"), "utf8") : "";
74067
74190
  const finalLine = [...rawResult.matchAll(/PARITY_RESULT:\s*(\{[^\n]*\})/g)].pop()?.[1];
74068
74191
  let verdict = null;
74069
74192
  try {
@@ -74075,7 +74198,7 @@ function readTask(planDir, id) {
74075
74198
  let reason;
74076
74199
  let status;
74077
74200
  if (exit !== null) {
74078
- if (existsSync29(join40(dir, "stopped"))) {
74201
+ if (existsSync29(join41(dir, "stopped"))) {
74079
74202
  reason = "stopped from the cockpit";
74080
74203
  } else if (/Background tasks still running .* terminating/.test(stderrRaw)) {
74081
74204
  reason = `claude stopped waiting for background agents (${unfinished.join(", ") || "?"}) and terminated them`;
@@ -74097,14 +74220,14 @@ function readTask(planDir, id) {
74097
74220
  const last = existsSync29(streamFile) ? statSync3(streamFile).mtimeMs : Date.parse(task.createdAt);
74098
74221
  status = Date.now() - last > STALL_MS ? "stalled" : "running";
74099
74222
  }
74100
- const read = (f) => existsSync29(join40(dir, f)) ? readFileSync33(join40(dir, f), "utf8") : null;
74223
+ const read = (f) => existsSync29(join41(dir, f)) ? readFileSync34(join41(dir, f), "utf8") : null;
74101
74224
  const stderr = clip(stderrRaw, 1500);
74102
74225
  const fixer = [...agents.values()].reverse().find((a) => a.type === "fixer" && a.result);
74103
74226
  const fr = fixer?.result ?? {};
74104
74227
  const branch = verdict?.branch ?? fr.branch ?? null;
74105
74228
  let delivery = null;
74106
74229
  if (branch) {
74107
- const repo = task.worktree && existsSync29(task.worktree) ? task.worktree : targetDir(dirname6(dirname6(dir)));
74230
+ const repo = task.worktree && existsSync29(task.worktree) ? task.worktree : targetDir(dirname7(dirname7(dir)));
74108
74231
  const baseSha = task.base?.sha ?? fr.base;
74109
74232
  const git = (...a) => {
74110
74233
  try {
@@ -74135,7 +74258,7 @@ function readTask(planDir, id) {
74135
74258
  model,
74136
74259
  prError: (() => {
74137
74260
  try {
74138
- const m = JSON.parse(readFileSync33(join40(dir, "pr-auto.json"), "utf8"));
74261
+ const m = JSON.parse(readFileSync34(join41(dir, "pr-auto.json"), "utf8"));
74139
74262
  return m.ok ? null : String(m.error);
74140
74263
  } catch {
74141
74264
  return null;
@@ -74157,7 +74280,7 @@ function listTasks2(planDir) {
74157
74280
  const dir = tasksDir(planDir);
74158
74281
  if (!existsSync29(dir))
74159
74282
  return [];
74160
- return readdirSync8(dir).filter(validTaskId).sort().reverse().map((id) => readTask(planDir, id)).filter((t) => t !== null).map(({ task, status, agents, result, delivery }) => ({
74283
+ return readdirSync9(dir).filter(validTaskId).sort().reverse().map((id) => readTask(planDir, id)).filter((t) => t !== null).map(({ task, status, agents, result, delivery }) => ({
74161
74284
  ...task,
74162
74285
  status,
74163
74286
  agents: agents.length,
@@ -74169,8 +74292,8 @@ function listTasks2(planDir) {
74169
74292
  function taskShot(planDir, id, side) {
74170
74293
  if (!validTaskId(id) || side !== "prod" && side !== "cand")
74171
74294
  return null;
74172
- const file = join40(taskDir(planDir, id), `${side}.png`);
74173
- return existsSync29(file) ? readFileSync33(file) : null;
74295
+ const file = join41(taskDir(planDir, id), `${side}.png`);
74296
+ return existsSync29(file) ? readFileSync34(file) : null;
74174
74297
  }
74175
74298
 
74176
74299
  // src/server/cockpit.ts
@@ -74455,19 +74578,19 @@ async function actions(req, res, path, ctx) {
74455
74578
  }
74456
74579
  function targetDirOf(planDir) {
74457
74580
  try {
74458
- const st = JSON.parse(readFileSync34(join41(planDir, "migration.json"), "utf8"));
74581
+ const st = JSON.parse(readFileSync35(join42(planDir, "migration.json"), "utf8"));
74459
74582
  if (typeof st?.target?.dir === "string")
74460
74583
  return st.target.dir;
74461
74584
  } catch {}
74462
- return dirname7(resolve13(planDir));
74585
+ return dirname8(resolve14(planDir));
74463
74586
  }
74464
74587
 
74465
74588
  // src/commands/cockpit.ts
74466
74589
  async function cockpitCommand(opts) {
74467
74590
  const ctx = {
74468
- planDir: resolve14(opts.dir),
74469
- output: resolve14(opts.output),
74470
- benchDir: resolve14(opts.benchDir),
74591
+ planDir: resolve15(opts.dir),
74592
+ output: resolve15(opts.output),
74593
+ benchDir: resolve15(opts.benchDir),
74471
74594
  prodUrl: opts.prodUrl,
74472
74595
  candUrl: opts.candUrl
74473
74596
  };
@@ -74478,19 +74601,19 @@ async function cockpitCommand(opts) {
74478
74601
  host: opts.host
74479
74602
  });
74480
74603
  } catch (err) {
74481
- console.error(chalk30.red(` ✖ could not start the cockpit: ${err.message}`));
74604
+ console.error(chalk31.red(` ✖ could not start the cockpit: ${err.message}`));
74482
74605
  return 2;
74483
74606
  }
74484
74607
  console.log("");
74485
- console.log(chalk30.bold(" parity cockpit"));
74486
- console.log(` ${chalk30.green("●")} ${handle.url}`);
74487
- console.log(chalk30.dim(` plan ${ctx.planDir}`));
74488
- console.log(chalk30.dim(` runs ${ctx.output}`));
74489
- console.log(chalk30.dim(` bench ${ctx.benchDir}`));
74608
+ console.log(chalk31.bold(" parity cockpit"));
74609
+ console.log(` ${chalk31.green("●")} ${handle.url}`);
74610
+ console.log(chalk31.dim(` plan ${ctx.planDir}`));
74611
+ console.log(chalk31.dim(` runs ${ctx.output}`));
74612
+ console.log(chalk31.dim(` bench ${ctx.benchDir}`));
74490
74613
  if (opts.host && opts.host !== "127.0.0.1" && opts.host !== "localhost") {
74491
- console.log(chalk30.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
74614
+ console.log(chalk31.yellow(` ⚠ bound to ${opts.host} — this server is unauthenticated, reads the repo, and proxies arbitrary URLs`));
74492
74615
  }
74493
- console.log(chalk30.dim(` Ctrl+C to stop.
74616
+ console.log(chalk31.dim(` Ctrl+C to stop.
74494
74617
  `));
74495
74618
  if (opts.open !== false) {
74496
74619
  const { default: openUrl } = await import("open");
@@ -74510,15 +74633,15 @@ async function cockpitCommand(opts) {
74510
74633
 
74511
74634
  // src/commands/ios.ts
74512
74635
  import { execFileSync as execFileSync5 } from "node:child_process";
74513
- import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync36, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
74636
+ import { existsSync as existsSync31, mkdirSync as mkdirSync22, readFileSync as readFileSync37, rmSync as rmSync2, writeFileSync as writeFileSync33 } from "node:fs";
74514
74637
  import { homedir as homedir4, tmpdir as tmpdir2 } from "node:os";
74515
- import { join as join43, resolve as resolve15 } from "node:path";
74516
- import chalk32 from "chalk";
74638
+ import { join as join44, resolve as resolve16 } from "node:path";
74639
+ import chalk33 from "chalk";
74517
74640
 
74518
74641
  // src/commands/pair.ts
74519
- import { existsSync as existsSync30, readFileSync as readFileSync35 } from "node:fs";
74520
- import { join as join42 } from "node:path";
74521
- import chalk31 from "chalk";
74642
+ import { existsSync as existsSync30, readFileSync as readFileSync36 } from "node:fs";
74643
+ import { join as join43 } from "node:path";
74644
+ import chalk32 from "chalk";
74522
74645
 
74523
74646
  // src/engine/pair.ts
74524
74647
  function signatureOf(target, doc = document) {
@@ -74718,7 +74841,7 @@ async function open3(browser, url, viewport, waitMs) {
74718
74841
  async function pairCommand(opts) {
74719
74842
  const viewport = parseViewport3(opts.viewport);
74720
74843
  if (!viewport) {
74721
- console.error(chalk31.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
74844
+ console.error(chalk32.red(`invalid viewport: ${opts.viewport} (use mobile|tablet|desktop)`));
74722
74845
  return 2;
74723
74846
  }
74724
74847
  const from = opts.side;
@@ -74760,27 +74883,27 @@ function report(opts, from, source, match, problem) {
74760
74883
  ambiguous: match?.ambiguous ?? 0
74761
74884
  }));
74762
74885
  } else {
74763
- const box = (s) => s ? chalk31.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
74886
+ const box = (s) => s ? chalk32.dim(`${s.rect.width}×${s.rect.height} at (${s.rect.x}, ${s.rect.y})`) : "";
74764
74887
  if (source)
74765
74888
  console.log(`${from} ${source.selector} ${box(source)}`);
74766
74889
  if (match) {
74767
- console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk31.dim(`by ${match.by}`)}`);
74890
+ console.log(`${to} ${match.snapshot.selector} ${box(match.snapshot)} ${chalk32.dim(`by ${match.by}`)}`);
74768
74891
  }
74769
74892
  if (problem)
74770
- console.log(chalk31.yellow(problem));
74893
+ console.log(chalk32.yellow(problem));
74771
74894
  else if (match?.by === "position") {
74772
- console.log(chalk31.yellow("matched by position only — verify it is the same element"));
74895
+ console.log(chalk32.yellow("matched by position only — verify it is the same element"));
74773
74896
  }
74774
74897
  }
74775
74898
  return problem ? 2 : 0;
74776
74899
  }
74777
74900
  function sectionArgsFromTask(taskDir) {
74778
- const file = join42(taskDir, "task.json");
74901
+ const file = join43(taskDir, "task.json");
74779
74902
  if (!existsSync30(file))
74780
74903
  throw new Error(`no task.json in ${taskDir}`);
74781
- const task = JSON.parse(readFileSync35(file, "utf8"));
74782
- const ctxFile = join42(taskDir, "context.json");
74783
- const ctx = existsSync30(ctxFile) ? JSON.parse(readFileSync35(ctxFile, "utf8")) : {};
74904
+ const task = JSON.parse(readFileSync36(file, "utf8"));
74905
+ const ctxFile = join43(taskDir, "context.json");
74906
+ const ctx = existsSync30(ctxFile) ? JSON.parse(readFileSync36(ctxFile, "utf8")) : {};
74784
74907
  const prodSel = task.side === "prod" ? task.selector : ctx.prod?.selector ?? task.counterpart;
74785
74908
  const candSel = task.side === "cand" ? task.selector : ctx.cand?.selector ?? task.counterpart;
74786
74909
  if (!prodSel || !candSel) {
@@ -74799,7 +74922,7 @@ function sectionArgsFromTask(taskDir) {
74799
74922
  }
74800
74923
 
74801
74924
  // src/commands/ios.ts
74802
- var LOCK = join43(homedir4(), ".parity", "ios.lock");
74925
+ var LOCK = join44(homedir4(), ".parity", "ios.lock");
74803
74926
  function simctl(...args) {
74804
74927
  return execFileSync5("xcrun", ["simctl", ...args], { encoding: "utf8", timeout: 180000 }).trim();
74805
74928
  }
@@ -74812,10 +74935,10 @@ function alive2(pid) {
74812
74935
  }
74813
74936
  }
74814
74937
  async function takeLock() {
74815
- mkdirSync22(join43(homedir4(), ".parity"), { recursive: true });
74938
+ mkdirSync22(join44(homedir4(), ".parity"), { recursive: true });
74816
74939
  const until = Date.now() + 5 * 60000;
74817
74940
  for (;; ) {
74818
- const holder = existsSync31(LOCK) ? Number(readFileSync36(LOCK, "utf8")) : 0;
74941
+ const holder = existsSync31(LOCK) ? Number(readFileSync37(LOCK, "utf8")) : 0;
74819
74942
  if (!holder || !alive2(holder) || holder === process.pid)
74820
74943
  break;
74821
74944
  if (Date.now() > until)
@@ -74836,7 +74959,7 @@ async function iosCommand(opts) {
74836
74959
  try {
74837
74960
  execFileSync5("xcrun", ["simctl", "help"], { stdio: "ignore" });
74838
74961
  } catch {
74839
- console.error(chalk32.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
74962
+ console.error(chalk33.yellow("xcrun simctl is not available — install Xcode to test on iOS Safari. Nothing was measured."));
74840
74963
  return 2;
74841
74964
  }
74842
74965
  let { prod, cand, selector, candSelector } = opts;
@@ -74856,9 +74979,9 @@ async function iosCommand(opts) {
74856
74979
  return 2;
74857
74980
  }
74858
74981
  await takeLock();
74859
- const out = resolve15(opts.outDir);
74982
+ const out = resolve16(opts.outDir);
74860
74983
  mkdirSync22(out, { recursive: true });
74861
- const scratch = join43(tmpdir2(), `parity-ios-${process.pid}`);
74984
+ const scratch = join44(tmpdir2(), `parity-ios-${process.pid}`);
74862
74985
  mkdirSync22(scratch, { recursive: true });
74863
74986
  let bootedHere = false;
74864
74987
  const device = findDevice(opts.device);
@@ -74878,7 +75001,7 @@ async function iosCommand(opts) {
74878
75001
  const via = `${proxy.url}proxy?url=${encodeURIComponent(s.url)}${s.sel ? `&scrollTo=${encodeURIComponent(s.sel)}` : ""}`;
74879
75002
  simctl("openurl", device.udid, via);
74880
75003
  await new Promise((r) => setTimeout(r, Number(opts.wait)));
74881
- const file = join43(out, `ios-${s.side}.png`);
75004
+ const file = join44(out, `ios-${s.side}.png`);
74882
75005
  simctl("io", device.udid, "screenshot", "--type=png", file);
74883
75006
  shots[s.side] = file;
74884
75007
  if (s.sel) {
@@ -74894,13 +75017,13 @@ async function iosCommand(opts) {
74894
75017
  } catch {}
74895
75018
  }
74896
75019
  rmSync2(scratch, { recursive: true, force: true });
74897
- if (existsSync31(LOCK) && Number(readFileSync36(LOCK, "utf8")) === process.pid)
75020
+ if (existsSync31(LOCK) && Number(readFileSync37(LOCK, "utf8")) === process.pid)
74898
75021
  rmSync2(LOCK);
74899
75022
  }
74900
75023
  const missing = Object.entries(found).filter(([, v]) => v !== true).map(([k]) => k);
74901
75024
  let diff = null;
74902
75025
  if (shots.prod && shots.cand && !missing.length)
74903
- diff = diffScreenshots(shots.prod, shots.cand, join43(out, "ios-diff.png"));
75026
+ diff = diffScreenshots(shots.prod, shots.cand, join44(out, "ios-diff.png"));
74904
75027
  const report = {
74905
75028
  device: device.name,
74906
75029
  shots,
@@ -74911,11 +75034,11 @@ async function iosCommand(opts) {
74911
75034
  if (opts.json)
74912
75035
  console.log(JSON.stringify(report));
74913
75036
  else {
74914
- console.log(`${chalk32.bold("iOS Safari")} · ${device.name}`);
75037
+ console.log(`${chalk33.bold("iOS Safari")} · ${device.name}`);
74915
75038
  for (const [k, v] of Object.entries(shots))
74916
75039
  console.log(` ${k.padEnd(5)} ${v}`);
74917
75040
  for (const side of missing) {
74918
- console.log(chalk32.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\`)`));
75041
+ 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\`)`));
74919
75042
  }
74920
75043
  if (diff)
74921
75044
  console.log(` diff ${(diff.pctDiff * 100).toFixed(2)}% (${diff.diffPixels} px) → ${diff.heatmapPath}`);
@@ -74925,19 +75048,19 @@ async function iosCommand(opts) {
74925
75048
 
74926
75049
  // src/commands/mcp.ts
74927
75050
  import { createInterface as createInterface3 } from "node:readline";
74928
- import { resolve as resolve17 } from "node:path";
75051
+ import { resolve as resolve18 } from "node:path";
74929
75052
 
74930
75053
  // src/util/version.ts
74931
- import { readFileSync as readFileSync37 } from "node:fs";
74932
- import { dirname as dirname8, resolve as resolve16 } from "node:path";
75054
+ import { readFileSync as readFileSync38 } from "node:fs";
75055
+ import { dirname as dirname9, resolve as resolve17 } from "node:path";
74933
75056
  import { fileURLToPath as fileURLToPath2 } from "node:url";
74934
75057
  function getPackageVersion() {
74935
75058
  try {
74936
- const here = dirname8(fileURLToPath2(import.meta.url));
75059
+ const here = dirname9(fileURLToPath2(import.meta.url));
74937
75060
  for (const up of ["..", "../..", "../../.."]) {
74938
75061
  try {
74939
- const pkgPath = resolve16(here, up, "package.json");
74940
- const raw = readFileSync37(pkgPath, "utf8");
75062
+ const pkgPath = resolve17(here, up, "package.json");
75063
+ const raw = readFileSync38(pkgPath, "utf8");
74941
75064
  const parsed = JSON.parse(raw);
74942
75065
  if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
74943
75066
  return parsed.version;
@@ -75048,8 +75171,8 @@ function parseLine(line) {
75048
75171
  }
75049
75172
 
75050
75173
  // src/mcp/tools.ts
75051
- import { existsSync as existsSync32, readFileSync as readFileSync38 } from "node:fs";
75052
- import { join as join44 } from "node:path";
75174
+ import { existsSync as existsSync32, readFileSync as readFileSync39 } from "node:fs";
75175
+ import { join as join45 } from "node:path";
75053
75176
  var STR = { type: "string" };
75054
75177
  var NONE = { type: "object", properties: {}, additionalProperties: false };
75055
75178
  function withPlan2(ctx, fn) {
@@ -75085,12 +75208,12 @@ function createTools(ctx) {
75085
75208
  description: "The orchestrator's own state: phase, stage, round, current page, score and trend, budget. Read this first — it says what the run is doing and what it is allowed to care about.",
75086
75209
  inputSchema: NONE,
75087
75210
  handler: () => {
75088
- const p = join44(ctx.planDir, "migration.json");
75211
+ const p = join45(ctx.planDir, "migration.json");
75089
75212
  if (!existsSync32(p)) {
75090
75213
  return fail2(`no migration.json in ${ctx.planDir} — no migration has been started here`);
75091
75214
  }
75092
75215
  try {
75093
- return json2(JSON.parse(readFileSync38(p, "utf8")));
75216
+ return json2(JSON.parse(readFileSync39(p, "utf8")));
75094
75217
  } catch (err) {
75095
75218
  return fail2(`migration.json is not valid JSON: ${err.message}`);
75096
75219
  }
@@ -75286,8 +75409,8 @@ function createTools(ctx) {
75286
75409
  async function mcpCommand(opts) {
75287
75410
  const version = getPackageVersion();
75288
75411
  const tools = createTools({
75289
- planDir: resolve17(opts.dir),
75290
- output: resolve17(opts.output),
75412
+ planDir: resolve18(opts.dir),
75413
+ output: resolve18(opts.output),
75291
75414
  candUrl: opts.candUrl
75292
75415
  });
75293
75416
  const write = (res) => process.stdout.write(`${JSON.stringify(res)}
@@ -75321,8 +75444,8 @@ async function mcpCommand(opts) {
75321
75444
 
75322
75445
  // src/commands/heatmap.ts
75323
75446
  import { mkdirSync as mkdirSync23 } from "node:fs";
75324
- import { resolve as resolve18 } from "node:path";
75325
- import chalk33 from "chalk";
75447
+ import { resolve as resolve19 } from "node:path";
75448
+ import chalk34 from "chalk";
75326
75449
 
75327
75450
  // src/diff/hotspot-findings.ts
75328
75451
  var TYPOGRAPHY_PROPS = /^(font-family|font-weight|font-size|font-style|line-height|letter-spacing|text-transform)$/;
@@ -75421,13 +75544,13 @@ function describe2(type, hotspot, nodes, imageHostDelta, because) {
75421
75544
  }
75422
75545
 
75423
75546
  // src/diff/noise-mask.ts
75424
- import { readFileSync as readFileSync39, writeFileSync as writeFileSync34 } from "node:fs";
75547
+ import { readFileSync as readFileSync40, writeFileSync as writeFileSync34 } from "node:fs";
75425
75548
  import { PNG as PNG5 } from "pngjs";
75426
75549
  var DEFAULT_DILATE = 2;
75427
75550
  var MAX_MASK_COVERAGE = 0.2;
75428
75551
  function buildNoiseMask(firstPng, secondPng, dilate = DEFAULT_DILATE) {
75429
- const a = PNG5.sync.read(readFileSync39(firstPng));
75430
- const b = PNG5.sync.read(readFileSync39(secondPng));
75552
+ const a = PNG5.sync.read(readFileSync40(firstPng));
75553
+ const b = PNG5.sync.read(readFileSync40(secondPng));
75431
75554
  if (a.width !== b.width || a.height !== b.height)
75432
75555
  return null;
75433
75556
  const { width, height } = a;
@@ -75467,7 +75590,7 @@ function dilateMask(src, width, height, radius) {
75467
75590
  return pass(pass(src, true), false);
75468
75591
  }
75469
75592
  function applyMask(pngPath, mask, outPath) {
75470
- const png = PNG5.sync.read(readFileSync39(pngPath));
75593
+ const png = PNG5.sync.read(readFileSync40(pngPath));
75471
75594
  if (png.width !== mask.width || png.height !== mask.height) {
75472
75595
  throw new Error(`applyMask: image is ${png.width}x${png.height} but the mask is ${mask.width}x${mask.height}`);
75473
75596
  }
@@ -75484,7 +75607,7 @@ function applyMask(pngPath, mask, outPath) {
75484
75607
  }
75485
75608
  function readPngSize(pngPath) {
75486
75609
  try {
75487
- const head = readFileSync39(pngPath).subarray(0, 24);
75610
+ const head = readFileSync40(pngPath).subarray(0, 24);
75488
75611
  if (head.length < 24)
75489
75612
  return null;
75490
75613
  return { width: head.readUInt32BE(16), height: head.readUInt32BE(20) };
@@ -75496,7 +75619,7 @@ function readPngSize(pngPath) {
75496
75619
  // src/report/qa-comment.ts
75497
75620
  import { execFile } from "node:child_process";
75498
75621
  import { readFile } from "node:fs/promises";
75499
- import { basename as basename4 } from "node:path";
75622
+ import { basename as basename5 } from "node:path";
75500
75623
  import { promisify } from "node:util";
75501
75624
  var exec = promisify(execFile);
75502
75625
  var QA_COMMENT_MARKER = "<!-- parity-qa -->";
@@ -75545,7 +75668,7 @@ async function uploadAttachment(path, repositoryId, cwd) {
75545
75668
  return null;
75546
75669
  const bytes = await readFile(path);
75547
75670
  const qs = new URLSearchParams({
75548
- name: basename4(path),
75671
+ name: basename5(path),
75549
75672
  content_type: "image/png",
75550
75673
  repository_id: String(repositoryId)
75551
75674
  });
@@ -75736,16 +75859,16 @@ function exitCodeFor(verdict) {
75736
75859
  async function heatmapCommand(opts) {
75737
75860
  const specs = parseViewports2(opts.viewports);
75738
75861
  if (typeof specs === "string") {
75739
- console.error(chalk33.red(specs));
75862
+ console.error(chalk34.red(specs));
75740
75863
  return EXIT_INCONCLUSIVE;
75741
75864
  }
75742
75865
  const waitMs = Number.parseInt(opts.wait, 10);
75743
75866
  if (!Number.isFinite(waitMs) || waitMs < 0) {
75744
- console.error(chalk33.red(`--wait inválido: ${opts.wait}`));
75867
+ console.error(chalk34.red(`--wait inválido: ${opts.wait}`));
75745
75868
  return EXIT_INCONCLUSIVE;
75746
75869
  }
75747
75870
  if (!isValidUrl5(opts.prod) || !isValidUrl5(opts.cand)) {
75748
- console.error(chalk33.red("--prod ou --cand inválido"));
75871
+ console.error(chalk34.red("--prod ou --cand inválido"));
75749
75872
  return EXIT_INCONCLUSIVE;
75750
75873
  }
75751
75874
  const selector = opts.selector?.trim() || null;
@@ -75784,7 +75907,7 @@ async function heatmapCommand(opts) {
75784
75907
  };
75785
75908
  if (opts.pr) {
75786
75909
  await postQaComment({ report, pr: opts.pr, repo: opts.repo }).catch((err) => {
75787
- console.error(chalk33.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
75910
+ console.error(chalk34.yellow(` aviso: não foi possível publicar no PR — ${err.message}`));
75788
75911
  });
75789
75912
  }
75790
75913
  if (opts.json)
@@ -75864,7 +75987,7 @@ function emptyResult2(spec) {
75864
75987
  };
75865
75988
  }
75866
75989
  function artifactPaths(outDir, prefix, label) {
75867
- const at = (suffix) => resolve18(outDir, `${prefix}-${label}-${suffix}.png`);
75990
+ const at = (suffix) => resolve19(outDir, `${prefix}-${label}-${suffix}.png`);
75868
75991
  return {
75869
75992
  prod: at("prod"),
75870
75993
  prodRepeat: at("prod-repeat"),
@@ -76077,7 +76200,8 @@ async function captureSide(browser, args) {
76077
76200
  const ctx = await newContext(browser, {
76078
76201
  viewport: args.spec.viewport,
76079
76202
  viewportSize: args.spec.size ?? undefined,
76080
- deviceScaleFactor: 1
76203
+ deviceScaleFactor: 1,
76204
+ hideScrollbars: true
76081
76205
  });
76082
76206
  const page = await ctx.newPage();
76083
76207
  try {
@@ -76087,6 +76211,7 @@ async function captureSide(browser, args) {
76087
76211
  });
76088
76212
  await settlePage(page, {
76089
76213
  waitMs: args.waitMs,
76214
+ dismissCookies: true,
76090
76215
  scroll: !await isAlreadyOnScreen(page, args.selector)
76091
76216
  });
76092
76217
  side.devicePixelRatio = await page.evaluate(() => window.devicePixelRatio);
@@ -76208,35 +76333,35 @@ function isValidUrl5(s) {
76208
76333
  }
76209
76334
  }
76210
76335
  var MARK = {
76211
- identical: chalk33.green("✓"),
76212
- differs: chalk33.red("✗"),
76213
- inconclusive: chalk33.yellow("?")
76336
+ identical: chalk34.green("✓"),
76337
+ differs: chalk34.red("✗"),
76338
+ inconclusive: chalk34.yellow("?")
76214
76339
  };
76215
76340
  function printReport(report) {
76216
76341
  console.log("");
76217
- console.log(chalk33.bold(` parity heatmap — ${report.mode}`));
76218
- console.log(chalk33.dim(` prod: ${report.prodUrl}`));
76219
- console.log(chalk33.dim(` cand: ${report.candUrl}`));
76342
+ console.log(chalk34.bold(` parity heatmap — ${report.mode}`));
76343
+ console.log(chalk34.dim(` prod: ${report.prodUrl}`));
76344
+ console.log(chalk34.dim(` cand: ${report.candUrl}`));
76220
76345
  console.log("");
76221
76346
  for (const v of report.viewports) {
76222
- const detail = v.verdict === "identical" ? chalk33.dim("0 pixels") : v.reason ?? chalk33.dim("no detail");
76347
+ const detail = v.verdict === "identical" ? chalk34.dim("0 pixels") : v.reason ?? chalk34.dim("no detail");
76223
76348
  console.log(` ${MARK[v.verdict]} ${v.label.padEnd(12)} ${detail}`);
76224
76349
  if (v.maskedCoverage != null && v.maskedCoverage > 0) {
76225
- console.log(chalk33.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
76350
+ console.log(chalk34.dim(` ${(v.maskedCoverage * 100).toFixed(1)}% of the frame excluded: prod does not reproduce those pixels`));
76226
76351
  }
76227
76352
  for (const f of v.findings.slice(0, 5)) {
76228
- console.log(chalk33.dim(` [${f.type}] ${f.summary}`));
76353
+ console.log(chalk34.dim(` [${f.type}] ${f.summary}`));
76229
76354
  }
76230
76355
  if (v.heatmapPath && v.verdict === "differs") {
76231
- console.log(chalk33.dim(` ${v.heatmapPath}`));
76356
+ console.log(chalk34.dim(` ${v.heatmapPath}`));
76232
76357
  }
76233
76358
  const hosts = imageHostDelta(v.prod.imageHosts, v.cand.imageHosts);
76234
76359
  if (hosts.onlyProd.length > 0 || hosts.onlyCand.length > 0) {
76235
- console.log(chalk33.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
76360
+ console.log(chalk34.yellow(` image hosts diverge — ${formatHostDelta(hosts)}`));
76236
76361
  }
76237
76362
  }
76238
76363
  console.log("");
76239
- console.log(` ${MARK[report.verdict]} ${chalk33.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
76364
+ console.log(` ${MARK[report.verdict]} ${chalk34.bold(report.verdict)}${report.reason ? ` — ${report.reason}` : ""}`);
76240
76365
  console.log("");
76241
76366
  }
76242
76367
  function imageHostDelta(prod, cand) {
@@ -76257,7 +76382,7 @@ function formatHostDelta(d) {
76257
76382
  }
76258
76383
 
76259
76384
  // src/commands/states.ts
76260
- import chalk34 from "chalk";
76385
+ import chalk35 from "chalk";
76261
76386
  var HOVERABLE = "a,button,summary,[role='button'],[role='menuitem'],label";
76262
76387
  var SETTLE_RETRY_FACTOR = 4;
76263
76388
  async function readStateEffects(page, opts) {
@@ -76469,7 +76594,7 @@ function statesVerdict(counts) {
76469
76594
  async function statesCommand(opts) {
76470
76595
  const viewport = parseViewport3(opts.viewport);
76471
76596
  if (!viewport) {
76472
- console.error(chalk34.red(`--viewport inválido: ${opts.viewport}`));
76597
+ console.error(chalk35.red(`--viewport inválido: ${opts.viewport}`));
76473
76598
  return 2;
76474
76599
  }
76475
76600
  const waitMs = Number.parseInt(opts.wait, 10) || 0;
@@ -76478,12 +76603,12 @@ async function statesCommand(opts) {
76478
76603
  const prodSelector = opts.prodSelector?.trim() || opts.selector?.trim();
76479
76604
  const candSelector = opts.candSelector?.trim() || opts.selector?.trim();
76480
76605
  if (!prodSelector || !candSelector) {
76481
- console.error(chalk34.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
76606
+ console.error(chalk35.red(" informe --selector (ambos os lados) ou --prod-selector e --cand-selector"));
76482
76607
  return 2;
76483
76608
  }
76484
76609
  const { aliases, note: aliasNote } = resolveAliases(opts.planDir);
76485
76610
  if (aliasNote)
76486
- console.log(chalk34.dim(` ${aliasNote}`));
76611
+ console.log(chalk35.dim(` ${aliasNote}`));
76487
76612
  const browser = await launchBrowser({ headless: true });
76488
76613
  try {
76489
76614
  const [prodSide, candSide] = await Promise.all([
@@ -76506,7 +76631,7 @@ async function statesCommand(opts) {
76506
76631
  ]);
76507
76632
  if (prodSide.baseError || candSide.baseError) {
76508
76633
  const which = prodSide.baseError ? `prod: ${prodSide.baseError}` : `cand: ${candSide.baseError}`;
76509
- console.error(chalk34.red(` não foi possível ler o componente — ${which}`));
76634
+ console.error(chalk35.red(` não foi possível ler o componente — ${which}`));
76510
76635
  return 2;
76511
76636
  }
76512
76637
  const motion = prodSide.motion.found && candSide.motion.found ? diffMotion(prodSide.motion, candSide.motion, {
@@ -76543,58 +76668,58 @@ async function statesCommand(opts) {
76543
76668
  ]) {
76544
76669
  const caveat = data.settle && formatSettleCaveat(name, data.settle);
76545
76670
  if (caveat)
76546
- console.log(chalk34.yellow(` ${caveat}`));
76671
+ console.log(chalk35.yellow(` ${caveat}`));
76547
76672
  }
76548
76673
  console.log("");
76549
- console.log(chalk34.bold(" Declared motion"));
76674
+ console.log(chalk35.bold(" Declared motion"));
76550
76675
  if (!motion) {
76551
76676
  const err = prodSide.motion.found ? candSide.motion : prodSide.motion;
76552
- console.log(chalk34.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
76677
+ console.log(chalk35.yellow(` não foi possível comparar — ${"error" in err ? err.error : "?"}`));
76553
76678
  } else {
76554
76679
  for (const line of formatMotionDiff(motion).split(`
76555
76680
  `))
76556
76681
  console.log(` ${line}`);
76557
76682
  }
76558
76683
  console.log("");
76559
- console.log(chalk34.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
76684
+ console.log(chalk35.bold(` Hover effects (${prodSide.effects.length} prod / ${candSide.effects.length} cand)`));
76560
76685
  const nothing = effects.lost.length === 0 && effects.changed.length === 0 && effects.added.length === 0 && effects.unpaired.length === 0;
76561
76686
  if (nothing && !exercised) {
76562
- console.log(chalk34.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
76687
+ console.log(chalk35.yellow(" INCONCLUSIVE — no hover changed anything on either side, so nothing was exercised. Check the selector holds an interactive element."));
76563
76688
  } else if (nothing) {
76564
76689
  console.log(" clean — every hover that changes something in prod changes the same in cand");
76565
76690
  }
76566
76691
  for (const e of effects.lost) {
76567
- console.log(chalk34.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
76692
+ console.log(chalk35.red(` LOST ${e.target}${e.label ? ` (${e.label})` : ""} — prod moves [${e.properties.join(", ")}]; cand's element was hovered and moved nothing`));
76568
76693
  }
76569
76694
  for (const { prod, extra, notComparable, onElement } of effects.changed) {
76570
76695
  console.log(` DIFFERS ${prod.target}${prod.label ? ` (${prod.label})` : ""}`);
76571
76696
  if (onElement.length) {
76572
- console.log(chalk34.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
76697
+ console.log(chalk35.yellow(` prod also moves [${onElement.join(", ")}] on the element itself`));
76573
76698
  }
76574
76699
  if (extra.length)
76575
76700
  console.log(` cand also moves [${extra.join(", ")}]`);
76576
76701
  if (notComparable.length) {
76577
- console.log(chalk34.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.`));
76702
+ 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.`));
76578
76703
  }
76579
76704
  if (onElement.length === 0 && extra.length === 0) {
76580
- console.log(chalk34.dim(" nothing comparable differs."));
76705
+ console.log(chalk35.dim(" nothing comparable differs."));
76581
76706
  }
76582
76707
  }
76583
76708
  for (const e of effects.unpaired) {
76584
- console.log(chalk34.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)`));
76709
+ 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)`));
76585
76710
  }
76586
76711
  for (const e of effects.added) {
76587
76712
  console.log(` ADDED ${e.target} — cand moves [${e.properties.join(", ")}]; prod does not`);
76588
76713
  }
76589
76714
  if (effects.unpaired.length > 0 && effects.lost.length === 0 && effects.changed.length === 0) {
76590
76715
  console.log("");
76591
- console.log(chalk34.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.`));
76716
+ 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.`));
76592
76717
  }
76593
76718
  if (prodSide.ambient > 0 || candSide.ambient > 0) {
76594
- console.log(chalk34.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.`));
76719
+ 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.`));
76595
76720
  }
76596
76721
  if (prodSide.truncated || candSide.truncated) {
76597
- console.log(chalk34.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
76722
+ console.log(chalk35.dim(" TRUNCATED — element cap hit; absence of a finding is not proof"));
76598
76723
  }
76599
76724
  return inconclusive || effects.lost.length > 0 || (motion?.findings.length ?? 0) > 0 ? 1 : 0;
76600
76725
  } finally {
@@ -76605,7 +76730,7 @@ async function statesCommand(opts) {
76605
76730
  }
76606
76731
 
76607
76732
  // src/commands/variance.ts
76608
- import chalk35 from "chalk";
76733
+ import chalk36 from "chalk";
76609
76734
 
76610
76735
  // src/diff/variance.ts
76611
76736
  var uniq2 = (xs) => [...new Set(xs)];
@@ -76709,7 +76834,7 @@ function formatVariance(report, opts = {}) {
76709
76834
  // src/commands/variance.ts
76710
76835
  function varianceCommand(opts) {
76711
76836
  if (opts.runIds.length < 2) {
76712
- console.error(chalk35.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
76837
+ console.error(chalk36.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
76713
76838
  return 2;
76714
76839
  }
76715
76840
  const budget = Number.parseFloat(opts.scoreBudget ?? "1");
@@ -76718,7 +76843,7 @@ function varianceCommand(opts) {
76718
76843
  try {
76719
76844
  runs.push(loadRun(opts.output, id));
76720
76845
  } catch (err) {
76721
- console.error(chalk35.red(` ✖ ${err.message}`));
76846
+ console.error(chalk36.red(` ✖ ${err.message}`));
76722
76847
  return 2;
76723
76848
  }
76724
76849
  }
@@ -76727,7 +76852,7 @@ function varianceCommand(opts) {
76727
76852
  console.log(JSON.stringify({ ...report, stable: isStable(report, budget), scoreBudget: budget }));
76728
76853
  } else {
76729
76854
  console.log("");
76730
- console.log(chalk35.bold(" Score variance"));
76855
+ console.log(chalk36.bold(" Score variance"));
76731
76856
  for (const line of formatVariance(report, { scoreBudget: budget }).split(`
76732
76857
  `)) {
76733
76858
  console.log(` ${line}`);
@@ -76739,10 +76864,10 @@ function varianceCommand(opts) {
76739
76864
  }
76740
76865
 
76741
76866
  // src/commands/vitals.ts
76742
- import { existsSync as existsSync33, readFileSync as readFileSync40, writeFileSync as writeFileSync35 } from "node:fs";
76867
+ import { existsSync as existsSync33, readFileSync as readFileSync41, writeFileSync as writeFileSync35 } from "node:fs";
76743
76868
  import { availableParallelism } from "node:os";
76744
- import { join as join45 } from "node:path";
76745
- import chalk36 from "chalk";
76869
+ import { join as join46 } from "node:path";
76870
+ import chalk37 from "chalk";
76746
76871
  import ora9 from "ora";
76747
76872
 
76748
76873
  // src/checks/agentic-nav.ts
@@ -77040,10 +77165,10 @@ async function vitalsCommand(opts) {
77040
77165
  const runId = newRunId();
77041
77166
  const paths = createRunDir(opts.output, runId);
77042
77167
  const t0 = Date.now();
77043
- console.log(chalk36.bold(`
77168
+ console.log(chalk37.bold(`
77044
77169
  parity vitals ${runId}`));
77045
- console.log(chalk36.dim(` prod: ${opts.prod}`));
77046
- console.log(chalk36.dim(` cand: ${opts.cand}`));
77170
+ console.log(chalk37.dim(` prod: ${opts.prod}`));
77171
+ console.log(chalk37.dim(` cand: ${opts.cand}`));
77047
77172
  const discoverSpinner = ora9("Descobrindo páginas…").start();
77048
77173
  const pagePaths = await discoverPagePaths2(opts.prod, opts);
77049
77174
  if (pagePaths.length === 0) {
@@ -77075,12 +77200,12 @@ async function vitalsCommand(opts) {
77075
77200
  completed++;
77076
77201
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
77077
77202
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
77078
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk36.cyan("prod") : chalk36.magenta("cand")} ${task.path} (${task.viewport})`;
77203
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
77079
77204
  }
77080
77205
  });
77081
77206
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
77082
77207
  if (opts.lighthouse !== false) {
77083
- const lhDir = join45(paths.runDir, "lighthouse");
77208
+ const lhDir = join46(paths.runDir, "lighthouse");
77084
77209
  const lhCap = opts.lighthouseConcurrency ?? Math.max(1, Math.min(2, Math.floor(availableParallelism() / 2)));
77085
77210
  const done = tasks.filter((t) => !!t.capture);
77086
77211
  const lhT0 = Date.now();
@@ -77104,7 +77229,7 @@ async function vitalsCommand(opts) {
77104
77229
  }
77105
77230
  lhCompleted++;
77106
77231
  const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
77107
- lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk36.cyan("prod") : chalk36.magenta("cand")} ${task.path} (${task.viewport})`;
77232
+ lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk37.cyan("prod") : chalk37.magenta("cand")} ${task.path} (${task.viewport})`;
77108
77233
  });
77109
77234
  lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
77110
77235
  }
@@ -77169,7 +77294,7 @@ async function vitalsCommand(opts) {
77169
77294
  writeRunReportJson(paths.runDir, run);
77170
77295
  const html = renderHtmlReport(run, paths.runDir);
77171
77296
  writeRunReportHtml(paths.runDir, html);
77172
- writeFileSync35(join45(paths.runDir, "vitals.json"), `${JSON.stringify({
77297
+ writeFileSync35(join46(paths.runDir, "vitals.json"), `${JSON.stringify({
77173
77298
  schemaVersion: "0.1",
77174
77299
  prodUrl: opts.prod,
77175
77300
  candUrl: opts.cand,
@@ -77182,8 +77307,8 @@ async function vitalsCommand(opts) {
77182
77307
  `, "utf8");
77183
77308
  printSummary8(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
77184
77309
  console.log("");
77185
- console.log(chalk36.dim(` → ${paths.reportHtml}`));
77186
- console.log(chalk36.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
77310
+ console.log(chalk37.dim(` → ${paths.reportHtml}`));
77311
+ console.log(chalk37.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
77187
77312
  console.log("");
77188
77313
  if (opts.open) {
77189
77314
  const { default: open } = await import("open");
@@ -77274,14 +77399,14 @@ function parseUrlList(input) {
77274
77399
  if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
77275
77400
  const path = input.replace(/^file:\/\//, "");
77276
77401
  if (existsSync33(path)) {
77277
- return readFileSync40(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
77402
+ return readFileSync41(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
77278
77403
  }
77279
77404
  }
77280
77405
  return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
77281
77406
  }
77282
77407
  function printSummary8(vitals, cache, scores, opportunities, agentic) {
77283
77408
  console.log("");
77284
- console.log(chalk36.bold(" Summary:"));
77409
+ console.log(chalk37.bold(" Summary:"));
77285
77410
  console.log(` ${vitals.summary}`);
77286
77411
  console.log(` ${cache.summary}`);
77287
77412
  if (scores.status !== "skipped")
@@ -77516,6 +77641,9 @@ program.command("css-trace").description("Inspect which CSS rules (from which st
77516
77641
  json: opts.json
77517
77642
  }));
77518
77643
  });
77644
+ program.command("css-modules").description('Find CSS Module classes passed as literal strings (`handle("a", "a--half")` instead of `styles["a--half"]`) — they never match the hashed name, so the style is silently dead after a migration. Exit 1 on findings, 2 when nothing was scanned (issue #388).').argument("[dir]", "Source root to scan", "src").option("--json", "Emit one-line JSON instead of human-readable text", false).action((dir, opts) => {
77645
+ process.exit(cssModulesCommand({ dir, json: opts.json }));
77646
+ });
77519
77647
  program.command("console").description("Single-page console capture. Boots Playwright on --url, waits for the page to settle, then prints any console errors/warnings + network failures. No LLM, no checks — designed for sub-10s debug loops (issue #31).").requiredOption("--url <url>", "URL to load").option("--viewport <viewport>", "mobile | desktop | tablet", "mobile").option("--wait <ms>", "Extra ms to wait after networkidle so client-side errors land", "2000").option("--filter <types>", "Comma-separated subset of error,warning,log,info,debug (default: error,warning)").option("--json", "Emit one-line JSON instead of human-readable text", false).action(async (opts) => {
77520
77648
  process.exit(await consoleCommand(opts));
77521
77649
  });
@@ -77546,7 +77674,7 @@ program.command("heatmap").description("Is the candidate PIXEL-IDENTICAL to prod
77546
77674
  json: opts.json
77547
77675
  }));
77548
77676
  });
77549
- program.command("section").description("Focused prod×cand comparison of one section: HTML diff + screenshot + computed-styles diff, plus an opt-in numeric box-tree diff (--box-tree). No flags = all 3 facets. Designed for the 'in DOM but invisible' debug loop (issue #31).").option("--prod <url>", "Production URL (base, e.g. https://www.example.com). Required unless --task.").option("--cand <url>", "Candidate URL (base, e.g. https://example.deco-cx.workers.dev). Required unless --task; with --task, pass it to point at a local build.").option("--selector <sel>", "CSS selector for the section to compare. Required unless --task.").option("--task <dir>", "A cockpit task dir (.parity/tasks/<id>): takes the page, the prod/cand pair and the exact frame size the reviewer saw. Explicit flags override it.").option("--cand-selector <sel>", "CSS selector on the CANDIDATE side, when the ported component no longer matches --selector (VTEX IO class names → hashed CSS Modules, data-fs-* attributes, …). Defaults to --selector.").option("--output-html", "Include the HTML diff facet (default: on if no facet flag passed)", false).option("--screenshot", "Include the screenshot facet (locator screenshot per side)", false).option("--computed-styles", "Include the computed-styles diff facet", false).option("--heatmap", "Run pixelmatch on the two screenshots and analyze diff regions (bounding box + hotspots). Implies --screenshot.", false).option("--box-tree", "Walk the selector's whole subtree on both sides and report numeric box deltas, biggest first (`margin-top: 32px → 24px -8`). Deterministic, no LLM — this is the answer to 'everything is a little off', which a pixelmatch percentage and a vision paragraph cannot give.", false).option("--css-source", "For each divergent computed-style property, resolve which CSS rule (stylesheet + selector) produced it via CDP. Useful when the LLM needs to know which file to edit.", false).option("--prompt", "Emit an LLM-ready bundle: <prefix>-bundle.json (machine-readable) + <prefix>-prompt.md (opinionated Markdown with embedded images). Implies all signals.", false).option("--llm-summary", "After building the bundle, invoke Claude (needs ANTHROPIC_API_KEY) and print a 1-paragraph 'what I understood' summary. Does NOT generate a patch. Implies --prompt.", false).option("--all", "Turn on every diagnostic facet at once (html + screenshot + computed-styles + heatmap + css-source + prompt + llm-summary) — the pixel-perfect debug shortcut formerly known as `parity fix`. Issue #415.", false).option("--no-llm", "With --all, skip the LLM call (still writes the markdown bundle). Use when offline or to avoid API costs.").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 screenshots", "./parity-output/sections").option("--plan-dir <dir>", "Run dir holding migration-plan.json. Its component rows are the only place the prod-side spelling of a component (`site/sections/Hero/HeroBannerV2.tsx`) and the cand-side one (`HeroSlideshow`) are written down together, so reading it lets the label pass pair nodes whose markup does not agree. Without it, unlabelled nodes fall back to the structural path.").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts, cmd) => {
77677
+ program.command("section").description("Focused prod×cand comparison of one section: HTML diff + screenshot + computed-styles diff, plus an opt-in numeric box-tree diff (--box-tree). No flags = all 3 facets. Designed for the 'in DOM but invisible' debug loop (issue #31).").option("--prod <url>", "Production URL (base, e.g. https://www.example.com). Required unless --task.").option("--cand <url>", "Candidate URL (base, e.g. https://example.deco-cx.workers.dev). Required unless --task; with --task, pass it to point at a local build.").option("--selector <sel>", "CSS selector for the section to compare. Required unless --task.").option("--task <dir>", "A cockpit task dir (.parity/tasks/<id>): takes the page, the prod/cand pair and the exact frame size the reviewer saw. Explicit flags override it.").option("--cand-selector <sel>", "CSS selector on the CANDIDATE side, when the ported component no longer matches --selector (VTEX IO class names → hashed CSS Modules, data-fs-* attributes, …). Defaults to --selector.").option("--output-html", "Include the HTML diff facet (default: on if no facet flag passed)", false).option("--screenshot", "Include the screenshot facet (locator screenshot per side)", false).option("--computed-styles", "Include the computed-styles diff facet", false).option("--heatmap", "Run pixelmatch on the two screenshots and analyze diff regions (bounding box + hotspots). Implies --screenshot.", false).option("--box-tree", "Walk the selector's whole subtree on both sides and report numeric box deltas, biggest first (`margin-top: 32px → 24px -8`). Deterministic, no LLM — this is the answer to 'everything is a little off', which a pixelmatch percentage and a vision paragraph cannot give.", false).option("--css-source", "For each divergent computed-style property, resolve which CSS rule (stylesheet + selector) produced it via CDP. Useful when the LLM needs to know which file to edit.", false).option("--prompt", "Emit an LLM-ready bundle: <prefix>-bundle.json (machine-readable) + <prefix>-prompt.md (opinionated Markdown with embedded images). Implies all signals.", false).option("--llm-summary", "After building the bundle, invoke Claude (needs ANTHROPIC_API_KEY) and print a 1-paragraph 'what I understood' summary. Does NOT generate a patch. Implies --prompt.", false).option("--all", "Turn on every diagnostic facet at once (html + screenshot + computed-styles + heatmap + css-source + prompt + llm-summary) — the pixel-perfect debug shortcut formerly known as `parity fix`. Issue #415.", false).option("--no-llm", "With --all, skip the LLM call (still writes the markdown bundle). Use when offline or to avoid API costs.").option("--prod-storage-state <file>", "Playwright storageState (cookies + localStorage) for the production side, to compare pages behind a login. Without it an authenticated page measures the login redirect.").option("--cand-storage-state <file>", "Same, for the candidate side").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 screenshots", "./parity-output/sections").option("--plan-dir <dir>", "Run dir holding migration-plan.json. Its component rows are the only place the prod-side spelling of a component (`site/sections/Hero/HeroBannerV2.tsx`) and the cand-side one (`HeroSlideshow`) are written down together, so reading it lets the label pass pair nodes whose markup does not agree. Without it, unlabelled nodes fall back to the structural path.").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts, cmd) => {
77550
77678
  let fromTask = null;
77551
77679
  if (opts.task) {
77552
77680
  try {
@@ -77571,6 +77699,8 @@ program.command("section").description("Focused prod×cand comparison of one sec
77571
77699
  cand,
77572
77700
  selector,
77573
77701
  candSelector: pick(opts.candSelector, fromTask?.candSelector),
77702
+ prodStorageState: opts.prodStorageState,
77703
+ candStorageState: opts.candStorageState,
77574
77704
  ...fromTask?.viewportSize && !viewportTyped ? { viewportSize: fromTask.viewportSize } : {},
77575
77705
  outputHtml: opts.all ? true : opts.outputHtml,
77576
77706
  screenshot: opts.all ? true : opts.screenshot,