@decocms/parity 0.28.5 → 0.29.1

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 +1490 -816
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -49462,6 +49462,112 @@ function hash(s) {
49462
49462
  return Math.abs(h).toString(36);
49463
49463
  }
49464
49464
 
49465
+ // src/checks/content-structure.ts
49466
+ init_esm10();
49467
+ var CONTENT_PATH = /(politica|policy|termos|terminos|terms|tyc|privacidad|privacy|sobre|about|garantia|warranty|institucional|institutional|contacta|contact)/i;
49468
+ var TOLERANCE = 0.8;
49469
+ function readStructure(html3) {
49470
+ const $2 = load(html3);
49471
+ $2("script, style, nav, header, footer").remove();
49472
+ const root2 = $2("main").length > 0 ? $2("main") : $2("body");
49473
+ const boldish = root2.find("strong, b, span, em").filter((_, el) => {
49474
+ const tag = el.tagName?.toLowerCase();
49475
+ if (tag === "strong" || tag === "b")
49476
+ return true;
49477
+ const cls = String($2(el).attr("class") ?? "");
49478
+ return /(^|\s)b(\s|$)/.test(cls) || /strong|bold/i.test(cls);
49479
+ }).length;
49480
+ return {
49481
+ chars: root2.text().replace(/\s+/g, " ").trim().length,
49482
+ paragraphs: root2.find("p").length,
49483
+ breaks: root2.find("br").length,
49484
+ bold: boldish,
49485
+ links: root2.find("a[href]").length
49486
+ };
49487
+ }
49488
+ function pathOf2(url) {
49489
+ try {
49490
+ return new URL(url).pathname.replace(/\/+$/, "") || "/";
49491
+ } catch {
49492
+ return url;
49493
+ }
49494
+ }
49495
+ function pair(prod, cand) {
49496
+ const byPath = new Map;
49497
+ for (const c of cand)
49498
+ if (!byPath.has(pathOf2(c.url)))
49499
+ byPath.set(pathOf2(c.url), c);
49500
+ const pairs = [];
49501
+ for (const p of prod) {
49502
+ const match = byPath.get(pathOf2(p.url));
49503
+ if (match && CONTENT_PATH.test(pathOf2(p.url)))
49504
+ pairs.push([p, match]);
49505
+ }
49506
+ return pairs;
49507
+ }
49508
+ function contentStructureParity(ctx) {
49509
+ const start = Date.now();
49510
+ const issues = [];
49511
+ const pairs = pair(ctx.prodPages, ctx.candPages);
49512
+ if (pairs.length === 0) {
49513
+ return {
49514
+ name: "content-structure",
49515
+ status: "skipped",
49516
+ severity: "medium",
49517
+ durationMs: Date.now() - start,
49518
+ summary: "Nenhuma página editorial capturada nos dois lados — comparação de estrutura desabilitada",
49519
+ issues: []
49520
+ };
49521
+ }
49522
+ for (const [prodPage, candPage] of pairs) {
49523
+ const path = pathOf2(prodPage.url);
49524
+ const a = readStructure(prodPage.html);
49525
+ const b = readStructure(candPage.html);
49526
+ if (a.chars < 500)
49527
+ continue;
49528
+ if (b.chars < a.chars * TOLERANCE) {
49529
+ issues.push({
49530
+ id: `content:missing-body:${path}`,
49531
+ severity: "high",
49532
+ category: "functional",
49533
+ check: "content-structure",
49534
+ summary: `${path}: corpo incompleto — ${b.chars} caracteres contra ${a.chars} no prod`,
49535
+ details: "A página existe e responde 200, mas o conteúdo não foi migrado por inteiro."
49536
+ });
49537
+ continue;
49538
+ }
49539
+ const lost = [];
49540
+ if (a.bold > 0 && b.bold < a.bold * TOLERANCE)
49541
+ lost.push(`negrito ${b.bold}/${a.bold}`);
49542
+ if (a.breaks > 0 && b.breaks < a.breaks * TOLERANCE)
49543
+ lost.push(`quebras de linha ${b.breaks}/${a.breaks}`);
49544
+ if (a.links > 0 && b.links < a.links * TOLERANCE)
49545
+ lost.push(`links ${b.links}/${a.links}`);
49546
+ if (a.paragraphs > 0 && b.paragraphs < a.paragraphs * TOLERANCE) {
49547
+ lost.push(`parágrafos ${b.paragraphs}/${a.paragraphs}`);
49548
+ }
49549
+ if (lost.length > 0) {
49550
+ issues.push({
49551
+ id: `content:lost-formatting:${path}`,
49552
+ severity: "medium",
49553
+ category: "visual",
49554
+ check: "content-structure",
49555
+ summary: `${path}: texto migrado sem a formatação — ${lost.join(", ")}`,
49556
+ details: "O número de caracteres bate, então um diff de texto não acusa. Costuma ser extração por " + "`innerText`, que achata `<br>` e perde marcação de negrito quando ela vem por classe " + '(`<span class="b">`) em vez de `<strong>`.'
49557
+ });
49558
+ }
49559
+ }
49560
+ const status = issues.some((i) => i.severity === "high") ? "fail" : issues.length > 0 ? "warn" : "pass";
49561
+ return {
49562
+ name: "content-structure",
49563
+ status,
49564
+ severity: "high",
49565
+ durationMs: Date.now() - start,
49566
+ summary: issues.length === 0 ? `${pairs.length} página(s) editorial(is) com estrutura equivalente ao prod` : `${issues.length} página(s) editorial(is) com conteúdo ou formatação faltando`,
49567
+ issues
49568
+ };
49569
+ }
49570
+
49465
49571
  // src/checks/cookie-cep-modal-cls.ts
49466
49572
  var CLS_HIGH_THRESHOLD = 0.1;
49467
49573
  var CLS_REGRESSION_RATIO = 1.5;
@@ -49782,8 +49888,8 @@ async function footerLinksHealth(ctx) {
49782
49888
  const candLinks = extractFooterLinks(candHome, { followExternal, maxLinks });
49783
49889
  const prodResults = await probeLinks(prodLinks);
49784
49890
  const candResults = await probeLinks(candLinks);
49785
- const prodByPath = new Map(prodResults.map((r) => [pathOf2(r.url), r]));
49786
- const candByPath = new Map(candResults.map((r) => [pathOf2(r.url), r]));
49891
+ const prodByPath = new Map(prodResults.map((r) => [pathOf3(r.url), r]));
49892
+ const candByPath = new Map(candResults.map((r) => [pathOf3(r.url), r]));
49787
49893
  for (const [path, candR] of candByPath) {
49788
49894
  const prodR = prodByPath.get(path);
49789
49895
  const candBroken = candR.status >= 400 || candR.status === 0;
@@ -49889,7 +49995,7 @@ async function probeLinks(urls) {
49889
49995
  }
49890
49996
  }));
49891
49997
  }
49892
- function pathOf2(url) {
49998
+ function pathOf3(url) {
49893
49999
  try {
49894
50000
  return new URL(url).pathname;
49895
50001
  } catch {
@@ -49907,9 +50013,9 @@ function htmlStructuralDiff(ctx) {
49907
50013
  const start = Date.now();
49908
50014
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
49909
50015
  const issues = [];
49910
- for (const pair of pairs) {
49911
- const prodSnap = snapshotDom(pair.prod.html);
49912
- const candSnap = snapshotDom(pair.cand.html);
50016
+ for (const pair2 of pairs) {
50017
+ const prodSnap = snapshotDom(pair2.prod.html);
50018
+ const candSnap = snapshotDom(pair2.cand.html);
49913
50019
  const diff = diffDom(prodSnap, candSnap, { countTolerance: 2 });
49914
50020
  const NOISY = new Set(["imgs"]);
49915
50021
  const structural = Object.entries(diff.countsDelta).filter(([k]) => !NOISY.has(k));
@@ -49917,15 +50023,15 @@ function htmlStructuralDiff(ctx) {
49917
50023
  if (structural.length > 0) {
49918
50024
  const summary = structural.map(([k, v]) => `${k}: ${v?.prod}→${v?.cand} (Δ${v?.delta})`).join(", ");
49919
50025
  issues.push({
49920
- id: `html-structural:counts:${pair.key}`,
50026
+ id: `html-structural:counts:${pair2.key}`,
49921
50027
  severity: "high",
49922
50028
  category: "functional",
49923
- page: pair.key,
50029
+ page: pair2.key,
49924
50030
  check: "html-structural-diff",
49925
- summary: `Contagem de elementos divergente em ${pair.key}: ${summary}`,
50031
+ summary: `Contagem de elementos divergente em ${pair2.key}: ${summary}`,
49926
50032
  evidence: [
49927
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
49928
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
50033
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
50034
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
49929
50035
  ]
49930
50036
  });
49931
50037
  }
@@ -49934,24 +50040,24 @@ function htmlStructuralDiff(ctx) {
49934
50040
  const candUnique = new Set(candSnap.imageStats.src).size;
49935
50041
  const summary = noisy.map(([k, v]) => `${k}: ${v?.prod}→${v?.cand} (Δ${v?.delta})`).join(", ");
49936
50042
  issues.push({
49937
- id: `html-structural:counts-informational:${pair.key}`,
50043
+ id: `html-structural:counts-informational:${pair2.key}`,
49938
50044
  severity: "low",
49939
50045
  category: "visual",
49940
- page: pair.key,
50046
+ page: pair2.key,
49941
50047
  check: "html-structural-diff",
49942
50048
  inconclusive: true,
49943
- summary: `Contagem de imagens divergente em ${pair.key} (informativo — estratégias de render diferentes): ${summary}. Imagens únicas por src: prod=${prodUnique} cand=${candUnique}`,
50049
+ summary: `Contagem de imagens divergente em ${pair2.key} (informativo — estratégias de render diferentes): ${summary}. Imagens únicas por src: prod=${prodUnique} cand=${candUnique}`,
49944
50050
  details: "Contagem bruta de <img> não é sinal confiável quando prod defere (Lazy) e cand faz SSR, ou quando há clones de carousel / conteúdo dinâmico (geocoding). Compare imagens únicas por src acima."
49945
50051
  });
49946
50052
  }
49947
50053
  if (diff.decoSectionsOnlyProd.length > 0) {
49948
50054
  issues.push({
49949
- id: `html-structural:deco-missing:${pair.key}`,
50055
+ id: `html-structural:deco-missing:${pair2.key}`,
49950
50056
  severity: "high",
49951
50057
  category: "functional",
49952
- page: pair.key,
50058
+ page: pair2.key,
49953
50059
  check: "html-structural-diff",
49954
- summary: `Sections renderizadas em prod ausentes em cand (${pair.key}): ${diff.decoSectionsOnlyProd.join(", ")}`
50060
+ summary: `Sections renderizadas em prod ausentes em cand (${pair2.key}): ${diff.decoSectionsOnlyProd.join(", ")}`
49955
50061
  });
49956
50062
  }
49957
50063
  }
@@ -49982,18 +50088,18 @@ function httpStatusParity(ctx) {
49982
50088
  }
49983
50089
  const { pairs, orphansProd, orphansCand } = pairCaptures(ctx.prodPages, ctx.candPages);
49984
50090
  const issues = [];
49985
- for (const pair of pairs) {
49986
- if (pair.prod.status !== pair.cand.status) {
50091
+ for (const pair2 of pairs) {
50092
+ if (pair2.prod.status !== pair2.cand.status) {
49987
50093
  issues.push({
49988
- id: `http-status:${pair.key}`,
50094
+ id: `http-status:${pair2.key}`,
49989
50095
  severity: "critical",
49990
50096
  category: "functional",
49991
- page: pair.key,
50097
+ page: pair2.key,
49992
50098
  check: "http-status-parity",
49993
- summary: `Status divergente em ${pair.key}: prod=${pair.prod.status} cand=${pair.cand.status}`,
50099
+ summary: `Status divergente em ${pair2.key}: prod=${pair2.prod.status} cand=${pair2.cand.status}`,
49994
50100
  evidence: [
49995
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
49996
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
50101
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
50102
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
49997
50103
  ]
49998
50104
  });
49999
50105
  }
@@ -50036,26 +50142,26 @@ function imageLoadingHealth(ctx) {
50036
50142
  const start = Date.now();
50037
50143
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50038
50144
  const issues = [];
50039
- for (const pair of pairs) {
50040
- const prodSnap = snapshotDom(pair.prod.html);
50041
- const candSnap = snapshotDom(pair.cand.html);
50042
- const candFailedImgs = countFailedImageRequests(pair.cand.network);
50145
+ for (const pair2 of pairs) {
50146
+ const prodSnap = snapshotDom(pair2.prod.html);
50147
+ const candSnap = snapshotDom(pair2.cand.html);
50148
+ const candFailedImgs = countFailedImageRequests(pair2.cand.network);
50043
50149
  if (candFailedImgs > 0) {
50044
50150
  issues.push({
50045
- id: `images:failed:${pair.key}`,
50151
+ id: `images:failed:${pair2.key}`,
50046
50152
  severity: "medium",
50047
50153
  category: "network",
50048
- page: pair.key,
50154
+ page: pair2.key,
50049
50155
  check: "image-loading-health",
50050
- summary: `${candFailedImgs} imagem(ns) com falha de carregamento em cand (${pair.key})`
50156
+ summary: `${candFailedImgs} imagem(ns) com falha de carregamento em cand (${pair2.key})`
50051
50157
  });
50052
50158
  }
50053
50159
  if (candSnap.imageStats.withoutAlt - prodSnap.imageStats.withoutAlt > 1) {
50054
50160
  issues.push({
50055
- id: `images:alt:${pair.key}`,
50161
+ id: `images:alt:${pair2.key}`,
50056
50162
  severity: "low",
50057
50163
  category: "seo",
50058
- page: pair.key,
50164
+ page: pair2.key,
50059
50165
  check: "image-loading-health",
50060
50166
  summary: `Mais imagens sem alt em cand: prod=${prodSnap.imageStats.withoutAlt} cand=${candSnap.imageStats.withoutAlt}`
50061
50167
  });
@@ -50063,12 +50169,12 @@ function imageLoadingHealth(ctx) {
50063
50169
  const srcsetLoss = prodSnap.imageStats.withSrcset - candSnap.imageStats.withSrcset;
50064
50170
  if (srcsetLoss > 2) {
50065
50171
  issues.push({
50066
- id: `images:srcset:${pair.key}`,
50172
+ id: `images:srcset:${pair2.key}`,
50067
50173
  severity: "medium",
50068
50174
  category: "performance",
50069
- page: pair.key,
50175
+ page: pair2.key,
50070
50176
  check: "image-loading-health",
50071
- summary: `Perda de srcset em cand (${pair.key}): prod=${prodSnap.imageStats.withSrcset}, cand=${candSnap.imageStats.withSrcset}`
50177
+ summary: `Perda de srcset em cand (${pair2.key}): prod=${prodSnap.imageStats.withSrcset}, cand=${candSnap.imageStats.withSrcset}`
50072
50178
  });
50073
50179
  }
50074
50180
  }
@@ -50093,9 +50199,9 @@ function lazySectionPresence(ctx) {
50093
50199
  const start = Date.now();
50094
50200
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50095
50201
  const issues = [];
50096
- for (const pair of pairs) {
50097
- const prodSections = extractSectionIds(pair.prod.network);
50098
- const candSections = extractSectionIds(pair.cand.network);
50202
+ for (const pair2 of pairs) {
50203
+ const prodSections = extractSectionIds(pair2.prod.network);
50204
+ const candSections = extractSectionIds(pair2.cand.network);
50099
50205
  const onlyProd = [...prodSections].filter((s) => !candSections.has(s));
50100
50206
  const onlyCand = [...candSections].filter((s) => !prodSections.has(s));
50101
50207
  const union = prodSections.size + candSections.size;
@@ -50103,18 +50209,18 @@ function lazySectionPresence(ctx) {
50103
50209
  const jaccard = union === 0 ? 1 : intersection / (union - intersection);
50104
50210
  const candIsIntentionallyEager = detectIntentionalEager({
50105
50211
  candSections,
50106
- candHtml: pair.cand.html,
50107
- prodHtml: pair.prod.html
50212
+ candHtml: pair2.cand.html,
50213
+ prodHtml: pair2.prod.html
50108
50214
  });
50109
50215
  if (onlyProd.length > 0) {
50110
50216
  if (candIsIntentionallyEager) {
50111
50217
  issues.push({
50112
- id: `lazy:intentional-eager:${pair.key}`,
50218
+ id: `lazy:intentional-eager:${pair2.key}`,
50113
50219
  severity: "low",
50114
50220
  category: "performance",
50115
- page: pair.key,
50221
+ page: pair2.key,
50116
50222
  check: "lazy-section-presence",
50117
- summary: `[${pair.key}] cand renderiza ${onlyProd.length} section(s) eagerly que prod faz lazy — intentional-eager-rendering`,
50223
+ summary: `[${pair2.key}] cand renderiza ${onlyProd.length} section(s) eagerly que prod faz lazy — intentional-eager-rendering`,
50118
50224
  details: [
50119
50225
  `Faltando lazy em cand: ${onlyProd.join(", ")}`,
50120
50226
  "",
@@ -50132,12 +50238,12 @@ function lazySectionPresence(ctx) {
50132
50238
  });
50133
50239
  } else {
50134
50240
  issues.push({
50135
- id: `lazy:missing:${pair.key}`,
50241
+ id: `lazy:missing:${pair2.key}`,
50136
50242
  severity: "high",
50137
50243
  category: "functional",
50138
- page: pair.key,
50244
+ page: pair2.key,
50139
50245
  check: "lazy-section-presence",
50140
- summary: `${onlyProd.length} lazy section(s) presentes em prod ausentes em cand (${pair.key})`,
50246
+ summary: `${onlyProd.length} lazy section(s) presentes em prod ausentes em cand (${pair2.key})`,
50141
50247
  details: `Faltando: ${onlyProd.join(", ")}
50142
50248
  Novos em cand: ${onlyCand.join(", ") || "—"}`
50143
50249
  });
@@ -50145,12 +50251,12 @@ Novos em cand: ${onlyCand.join(", ") || "—"}`
50145
50251
  }
50146
50252
  if (jaccard < 0.9 && union > 4 && !candIsIntentionallyEager) {
50147
50253
  issues.push({
50148
- id: `lazy:overlap:${pair.key}`,
50254
+ id: `lazy:overlap:${pair2.key}`,
50149
50255
  severity: "medium",
50150
50256
  category: "functional",
50151
- page: pair.key,
50257
+ page: pair2.key,
50152
50258
  check: "lazy-section-presence",
50153
- summary: `Overlap de lazy sections < 90% em ${pair.key} (Jaccard ${jaccard.toFixed(2)})`
50259
+ summary: `Overlap de lazy sections < 90% em ${pair2.key} (Jaccard ${jaccard.toFixed(2)})`
50154
50260
  });
50155
50261
  }
50156
50262
  }
@@ -50301,20 +50407,20 @@ function metaSeoParity(ctx) {
50301
50407
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50302
50408
  const ignoreKeys = new Set(ctx.ignore.ignoreMetaKeys);
50303
50409
  const issues = [];
50304
- for (const pair of pairs) {
50305
- const prodSnap = snapshotDom(pair.prod.html);
50306
- const candSnap = snapshotDom(pair.cand.html);
50410
+ for (const pair2 of pairs) {
50411
+ const prodSnap = snapshotDom(pair2.prod.html);
50412
+ const candSnap = snapshotDom(pair2.cand.html);
50307
50413
  const diff = diffDom(prodSnap, candSnap);
50308
50414
  const divergent = diff.metaDelta.filter((m) => !m.equal && !ignoreKeys.has(m.key));
50309
50415
  if (divergent.length > 0) {
50310
50416
  const summary = divergent.slice(0, 5).map((m) => `${m.key}`).join(", ");
50311
50417
  issues.push({
50312
- id: `meta-seo:${pair.key}`,
50418
+ id: `meta-seo:${pair2.key}`,
50313
50419
  severity: divergent.some((d) => d.key === "title" || d.key === "canonical") ? "high" : "medium",
50314
50420
  category: "seo",
50315
- page: pair.key,
50421
+ page: pair2.key,
50316
50422
  check: "meta-seo-parity",
50317
- summary: `Meta/SEO divergente em ${pair.key} (${divergent.length} key(s) com diferença): ${summary}${divergent.length > 5 ? "…" : ""}`,
50423
+ summary: `Meta/SEO divergente em ${pair2.key} (${divergent.length} key(s) com diferença): ${summary}${divergent.length > 5 ? "…" : ""}`,
50318
50424
  details: divergent.map((d) => `• ${d.key}
50319
50425
  prod: ${d.prod ?? "—"}
50320
50426
  cand: ${d.cand ?? "—"}`).join(`
@@ -50488,19 +50594,19 @@ function networkSummaryDelta(ctx) {
50488
50594
  const start = Date.now();
50489
50595
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
50490
50596
  const issues = [];
50491
- for (const pair of pairs) {
50492
- const diff = diffNetwork(pair.prod.network, pair.cand.network, {
50597
+ for (const pair2 of pairs) {
50598
+ const diff = diffNetwork(pair2.prod.network, pair2.cand.network, {
50493
50599
  ignorePatterns: ctx.ignore.ignoreRequestPatterns,
50494
50600
  maxTotalPct: 0.3
50495
50601
  });
50496
50602
  if (diff.anyFailed) {
50497
50603
  issues.push({
50498
- id: `network:volume:${pair.key}`,
50604
+ id: `network:volume:${pair2.key}`,
50499
50605
  severity: "medium",
50500
50606
  category: "network",
50501
- page: pair.key,
50607
+ page: pair2.key,
50502
50608
  check: "network-summary-delta",
50503
- summary: `Volume de requests divergente em ${pair.key}: prod=${diff.prod.total}, cand=${diff.cand.total} (Δ ${(diff.delta.totalPct * 100).toFixed(0)}%)`,
50609
+ summary: `Volume de requests divergente em ${pair2.key}: prod=${diff.prod.total}, cand=${diff.cand.total} (Δ ${(diff.delta.totalPct * 100).toFixed(0)}%)`,
50504
50610
  details: [
50505
50611
  `Bytes Δ ${(diff.delta.bytesPct * 100).toFixed(0)}%`,
50506
50612
  `Cache hit rate prod=${(diff.prod.cacheHitRate * 100).toFixed(0)}%, cand=${(diff.cand.cacheHitRate * 100).toFixed(0)}%`,
@@ -50514,12 +50620,12 @@ function networkSummaryDelta(ctx) {
50514
50620
  for (const sec of prodApi) {
50515
50621
  if (!diff.cand.decoSectionsHit.includes(sec)) {
50516
50622
  issues.push({
50517
- id: `network:deco-section-gone:${pair.key}:${sec}`,
50623
+ id: `network:deco-section-gone:${pair2.key}:${sec}`,
50518
50624
  severity: "high",
50519
50625
  category: "network",
50520
- page: pair.key,
50626
+ page: pair2.key,
50521
50627
  check: "network-summary-delta",
50522
- summary: `Deco section renderizada em prod ausente em cand: "${sec}" (${pair.key})`
50628
+ summary: `Deco section renderizada em prod ausente em cand: "${sec}" (${pair2.key})`
50523
50629
  });
50524
50630
  }
50525
50631
  }
@@ -50911,7 +51017,7 @@ function pdpBreadcrumbs(ctx) {
50911
51017
  const single = prodPdps.length === 0 || candPdps.length === 0;
50912
51018
  const sourcePages = single ? candPdps.length > 0 ? candPdps : prodPdps : candPdps;
50913
51019
  for (const page of sourcePages) {
50914
- const pair = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
51020
+ const pair2 = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
50915
51021
  const candHas = hasAnyBreadcrumbSignal(page.html);
50916
51022
  if (single) {
50917
51023
  if (!candHas) {
@@ -50924,8 +51030,8 @@ function pdpBreadcrumbs(ctx) {
50924
51030
  page: page.url
50925
51031
  });
50926
51032
  }
50927
- } else if (pair) {
50928
- const prodHas = hasAnyBreadcrumbSignal(pair.html);
51033
+ } else if (pair2) {
51034
+ const prodHas = hasAnyBreadcrumbSignal(pair2.html);
50929
51035
  if (prodHas && !candHas) {
50930
51036
  issues.push({
50931
51037
  id: `pdp-breadcrumbs:${page.viewport}:lost`,
@@ -50991,7 +51097,7 @@ function pdpGalleryRelated(ctx) {
50991
51097
  const single = prodPdps.length === 0 || candPdps.length === 0;
50992
51098
  const sourcePages = single ? candPdps.length > 0 ? candPdps : prodPdps : candPdps;
50993
51099
  for (const page of sourcePages) {
50994
- const pair = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
51100
+ const pair2 = single ? undefined : prodPdps.find((p) => p.viewport === page.viewport);
50995
51101
  const hasGalleryMain = matchAny(page.html, GALLERY_MAIN_PATTERNS);
50996
51102
  const hasThumb = matchAny(page.html, GALLERY_THUMB_PATTERNS);
50997
51103
  const hasRelated = matchAny(page.html, RELATED_PATTERNS);
@@ -51026,10 +51132,10 @@ function pdpGalleryRelated(ctx) {
51026
51132
  page: page.url
51027
51133
  });
51028
51134
  }
51029
- } else if (pair) {
51030
- const prodGallery = matchAny(pair.html, GALLERY_MAIN_PATTERNS);
51031
- const prodThumb = matchAny(pair.html, GALLERY_THUMB_PATTERNS);
51032
- const prodRelated = matchAny(pair.html, RELATED_PATTERNS);
51135
+ } else if (pair2) {
51136
+ const prodGallery = matchAny(pair2.html, GALLERY_MAIN_PATTERNS);
51137
+ const prodThumb = matchAny(pair2.html, GALLERY_THUMB_PATTERNS);
51138
+ const prodRelated = matchAny(pair2.html, RELATED_PATTERNS);
51033
51139
  if (prodGallery && !hasGalleryMain) {
51034
51140
  issues.push({
51035
51141
  id: `pdp-gallery:${page.viewport}:lost-main`,
@@ -51755,34 +51861,34 @@ function redirectsParity(ctx) {
51755
51861
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
51756
51862
  const issues = [];
51757
51863
  let redirectsChecked = 0;
51758
- for (const pair of pairs) {
51759
- const prodRedirected = didRedirect(pair.prod.url, pair.prod.finalUrl);
51864
+ for (const pair2 of pairs) {
51865
+ const prodRedirected = didRedirect(pair2.prod.url, pair2.prod.finalUrl);
51760
51866
  if (!prodRedirected)
51761
51867
  continue;
51762
51868
  redirectsChecked++;
51763
- const candRedirected = didRedirect(pair.cand.url, pair.cand.finalUrl);
51869
+ const candRedirected = didRedirect(pair2.cand.url, pair2.cand.finalUrl);
51764
51870
  if (!candRedirected) {
51765
51871
  issues.push({
51766
- id: `redirect:not-preserved:${pair.key}`,
51872
+ id: `redirect:not-preserved:${pair2.key}`,
51767
51873
  severity: "high",
51768
51874
  category: "seo",
51769
- page: pair.key,
51875
+ page: pair2.key,
51770
51876
  check: "redirects-parity",
51771
- summary: `prod redireciona ${pair.key} para ${pathOf3(pair.prod.finalUrl)}, candidato não redireciona (serve o próprio caminho)`,
51877
+ summary: `prod redireciona ${pair2.key} para ${pathOf4(pair2.prod.finalUrl)}, candidato não redireciona (serve o próprio caminho)`,
51772
51878
  suggestedFix: "Confirme se a tabela de redirects legada foi migrada para este caminho."
51773
51879
  });
51774
51880
  continue;
51775
51881
  }
51776
- const prodDest = pathOf3(pair.prod.finalUrl);
51777
- const candDest = pathOf3(pair.cand.finalUrl);
51882
+ const prodDest = pathOf4(pair2.prod.finalUrl);
51883
+ const candDest = pathOf4(pair2.cand.finalUrl);
51778
51884
  if (prodDest !== candDest) {
51779
51885
  issues.push({
51780
- id: `redirect:destination-diff:${pair.key}`,
51886
+ id: `redirect:destination-diff:${pair2.key}`,
51781
51887
  severity: "medium",
51782
51888
  category: "seo",
51783
- page: pair.key,
51889
+ page: pair2.key,
51784
51890
  check: "redirects-parity",
51785
- summary: `Destino de redirect diverge em ${pair.key}: prod→${prodDest} cand→${candDest}`,
51891
+ summary: `Destino de redirect diverge em ${pair2.key}: prod→${prodDest} cand→${candDest}`,
51786
51892
  inconclusive: true
51787
51893
  });
51788
51894
  }
@@ -51799,9 +51905,9 @@ function redirectsParity(ctx) {
51799
51905
  function didRedirect(requested, final) {
51800
51906
  if (!requested || !final)
51801
51907
  return false;
51802
- return pathOf3(requested) !== pathOf3(final);
51908
+ return pathOf4(requested) !== pathOf4(final);
51803
51909
  }
51804
- function pathOf3(url) {
51910
+ function pathOf4(url) {
51805
51911
  try {
51806
51912
  const u = new URL(url);
51807
51913
  return u.pathname.replace(/\/+$/, "") || "/";
@@ -52123,11 +52229,11 @@ function sectionOrderParity(ctx) {
52123
52229
  }
52124
52230
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
52125
52231
  const issues = [];
52126
- for (const pair of pairs) {
52127
- if (!pair.prod.html || !pair.cand.html)
52232
+ for (const pair2 of pairs) {
52233
+ if (!pair2.prod.html || !pair2.cand.html)
52128
52234
  continue;
52129
- const prodOrder = snapshotDom(pair.prod.html).decoSectionsOrder;
52130
- const candOrder = snapshotDom(pair.cand.html).decoSectionsOrder;
52235
+ const prodOrder = snapshotDom(pair2.prod.html).decoSectionsOrder;
52236
+ const candOrder = snapshotDom(pair2.cand.html).decoSectionsOrder;
52131
52237
  if (prodOrder.length === 0 || candOrder.length === 0)
52132
52238
  continue;
52133
52239
  if (prodOrder.length !== candOrder.length)
@@ -52139,17 +52245,17 @@ function sectionOrderParity(ctx) {
52139
52245
  if (sameOrder)
52140
52246
  continue;
52141
52247
  issues.push({
52142
- id: `section-order:${pair.key}`,
52248
+ id: `section-order:${pair2.key}`,
52143
52249
  severity: "medium",
52144
52250
  category: "functional",
52145
- page: pair.key,
52251
+ page: pair2.key,
52146
52252
  check: "section-order-parity",
52147
- summary: `Seções na mesma página em ordem diferente em ${pair.key}`,
52253
+ summary: `Seções na mesma página em ordem diferente em ${pair2.key}`,
52148
52254
  details: `prod: ${prodOrder.join(" → ")}
52149
52255
  cand: ${candOrder.join(" → ")}`,
52150
52256
  evidence: [
52151
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
52152
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
52257
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
52258
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
52153
52259
  ]
52154
52260
  });
52155
52261
  }
@@ -52322,19 +52428,19 @@ async function seoDeepAudit(ctx) {
52322
52428
  candBaseUrl: originOf(sample.cand.url)
52323
52429
  };
52324
52430
  const pageSnapshots = [];
52325
- for (const pair of pairs) {
52431
+ for (const pair2 of pairs) {
52326
52432
  const pageIssues = [];
52327
- pageIssues.push(...checkMetaRobots(pair));
52328
- pageIssues.push(...checkXRobotsHeader(pair));
52329
- pageIssues.push(...checkCanonical(pair));
52330
- pageIssues.push(...checkHreflang(pair));
52331
- pageIssues.push(...checkJsonLd(pair));
52433
+ pageIssues.push(...checkMetaRobots(pair2));
52434
+ pageIssues.push(...checkXRobotsHeader(pair2));
52435
+ pageIssues.push(...checkCanonical(pair2));
52436
+ pageIssues.push(...checkHreflang(pair2));
52437
+ pageIssues.push(...checkJsonLd(pair2));
52332
52438
  issues.push(...pageIssues);
52333
- const prodSnap = snapshotDom(pair.prod.html);
52334
- const candSnap = snapshotDom(pair.cand.html);
52439
+ const prodSnap = snapshotDom(pair2.prod.html);
52440
+ const candSnap = snapshotDom(pair2.cand.html);
52335
52441
  pageSnapshots.push({
52336
- pageKey: pair.key,
52337
- pageLabel: labelForPageKey(pair.key),
52442
+ pageKey: pair2.key,
52443
+ pageLabel: labelForPageKey(pair2.key),
52338
52444
  prodTitle: prodSnap.meta.title,
52339
52445
  candTitle: candSnap.meta.title,
52340
52446
  prodDescription: prodSnap.meta.description,
@@ -52343,8 +52449,8 @@ async function seoDeepAudit(ctx) {
52343
52449
  candCanonical: candSnap.meta.canonical,
52344
52450
  prodRobots: prodSnap.meta.robots,
52345
52451
  candRobots: candSnap.meta.robots,
52346
- prodXRobotsTag: pair.prod.xRobotsTag ?? null,
52347
- candXRobotsTag: pair.cand.xRobotsTag ?? null,
52452
+ prodXRobotsTag: pair2.prod.xRobotsTag ?? null,
52453
+ candXRobotsTag: pair2.cand.xRobotsTag ?? null,
52348
52454
  prodJsonLdTypes: prodSnap.meta.jsonLdTypes,
52349
52455
  candJsonLdTypes: candSnap.meta.jsonLdTypes,
52350
52456
  maxSeverity: maxSeverity(pageIssues),
@@ -52373,9 +52479,9 @@ async function seoDeepAudit(ctx) {
52373
52479
  data: { pages: pairs.length, seo }
52374
52480
  };
52375
52481
  }
52376
- function checkMetaRobots(pair) {
52377
- const prodMeta = snapshotDom(pair.prod.html).meta.robots ?? "";
52378
- const candMeta = snapshotDom(pair.cand.html).meta.robots ?? "";
52482
+ function checkMetaRobots(pair2) {
52483
+ const prodMeta = snapshotDom(pair2.prod.html).meta.robots ?? "";
52484
+ const candMeta = snapshotDom(pair2.cand.html).meta.robots ?? "";
52379
52485
  const prodIndexable = !/\bnoindex\b/i.test(prodMeta);
52380
52486
  const candIndexable = !/\bnoindex\b/i.test(candMeta);
52381
52487
  const prodFollowable = !/\bnofollow\b/i.test(prodMeta);
@@ -52383,164 +52489,164 @@ function checkMetaRobots(pair) {
52383
52489
  const out = [];
52384
52490
  if (prodIndexable && !candIndexable) {
52385
52491
  out.push({
52386
- id: `seo:noindex-introduced:${pair.key}`,
52492
+ id: `seo:noindex-introduced:${pair2.key}`,
52387
52493
  severity: "critical",
52388
52494
  category: "seo",
52389
- page: pair.key,
52495
+ page: pair2.key,
52390
52496
  check: "seo-deep-audit",
52391
- summary: `cand introduziu 'noindex' em ${pair.key} (prod era indexável) — página sairá do Google`,
52497
+ summary: `cand introduziu 'noindex' em ${pair2.key} (prod era indexável) — página sairá do Google`,
52392
52498
  details: `prod meta robots: "${prodMeta || "—"}"
52393
52499
  cand meta robots: "${candMeta || "—"}"`
52394
52500
  });
52395
52501
  }
52396
52502
  if (prodFollowable && !candFollowable) {
52397
52503
  out.push({
52398
- id: `seo:nofollow-introduced:${pair.key}`,
52504
+ id: `seo:nofollow-introduced:${pair2.key}`,
52399
52505
  severity: "high",
52400
52506
  category: "seo",
52401
- page: pair.key,
52507
+ page: pair2.key,
52402
52508
  check: "seo-deep-audit",
52403
- summary: `cand introduziu 'nofollow' em ${pair.key} (prod era follow)`,
52509
+ summary: `cand introduziu 'nofollow' em ${pair2.key} (prod era follow)`,
52404
52510
  details: `prod meta robots: "${prodMeta || "—"}"
52405
52511
  cand meta robots: "${candMeta || "—"}"`
52406
52512
  });
52407
52513
  }
52408
52514
  return out;
52409
52515
  }
52410
- function checkXRobotsHeader(pair) {
52411
- const p = (pair.prod.xRobotsTag ?? "").toLowerCase();
52412
- const c = (pair.cand.xRobotsTag ?? "").toLowerCase();
52516
+ function checkXRobotsHeader(pair2) {
52517
+ const p = (pair2.prod.xRobotsTag ?? "").toLowerCase();
52518
+ const c = (pair2.cand.xRobotsTag ?? "").toLowerCase();
52413
52519
  const prodIndexable = !/noindex/.test(p);
52414
52520
  const candIndexable = !/noindex/.test(c);
52415
52521
  if (prodIndexable && !candIndexable) {
52416
52522
  return [
52417
52523
  {
52418
- id: `seo:x-robots-noindex:${pair.key}`,
52524
+ id: `seo:x-robots-noindex:${pair2.key}`,
52419
52525
  severity: "critical",
52420
52526
  category: "seo",
52421
- page: pair.key,
52527
+ page: pair2.key,
52422
52528
  check: "seo-deep-audit",
52423
- summary: `Header X-Robots-Tag em cand contém 'noindex' (prod=indexável) em ${pair.key}`,
52424
- details: `prod X-Robots-Tag: "${pair.prod.xRobotsTag ?? "—"}"
52425
- cand X-Robots-Tag: "${pair.cand.xRobotsTag ?? "—"}"`
52529
+ summary: `Header X-Robots-Tag em cand contém 'noindex' (prod=indexável) em ${pair2.key}`,
52530
+ details: `prod X-Robots-Tag: "${pair2.prod.xRobotsTag ?? "—"}"
52531
+ cand X-Robots-Tag: "${pair2.cand.xRobotsTag ?? "—"}"`
52426
52532
  }
52427
52533
  ];
52428
52534
  }
52429
52535
  if (p !== c && (p || c)) {
52430
52536
  return [
52431
52537
  {
52432
- id: `seo:x-robots-diff:${pair.key}`,
52538
+ id: `seo:x-robots-diff:${pair2.key}`,
52433
52539
  severity: "high",
52434
52540
  category: "seo",
52435
- page: pair.key,
52541
+ page: pair2.key,
52436
52542
  check: "seo-deep-audit",
52437
- summary: `Header X-Robots-Tag diverge em ${pair.key}`,
52438
- details: `prod: "${pair.prod.xRobotsTag ?? "—"}"
52439
- cand: "${pair.cand.xRobotsTag ?? "—"}"`
52543
+ summary: `Header X-Robots-Tag diverge em ${pair2.key}`,
52544
+ details: `prod: "${pair2.prod.xRobotsTag ?? "—"}"
52545
+ cand: "${pair2.cand.xRobotsTag ?? "—"}"`
52440
52546
  }
52441
52547
  ];
52442
52548
  }
52443
52549
  return [];
52444
52550
  }
52445
- function checkCanonical(pair) {
52446
- const prodSnap = snapshotDom(pair.prod.html);
52447
- const candSnap = snapshotDom(pair.cand.html);
52551
+ function checkCanonical(pair2) {
52552
+ const prodSnap = snapshotDom(pair2.prod.html);
52553
+ const candSnap = snapshotDom(pair2.cand.html);
52448
52554
  const prodCanon = prodSnap.meta.canonical;
52449
52555
  const candCanon = candSnap.meta.canonical;
52450
52556
  const out = [];
52451
52557
  if (prodCanon && !candCanon) {
52452
52558
  out.push({
52453
- id: `seo:canonical-missing:${pair.key}`,
52559
+ id: `seo:canonical-missing:${pair2.key}`,
52454
52560
  severity: "high",
52455
52561
  category: "seo",
52456
- page: pair.key,
52562
+ page: pair2.key,
52457
52563
  check: "seo-deep-audit",
52458
- summary: `Canonical sumiu em cand (${pair.key}) — prod tinha "${prodCanon}"`
52564
+ summary: `Canonical sumiu em cand (${pair2.key}) — prod tinha "${prodCanon}"`
52459
52565
  });
52460
52566
  return out;
52461
52567
  }
52462
52568
  if (candCanon) {
52463
52569
  if (!isAbsoluteUrl(candCanon)) {
52464
52570
  out.push({
52465
- id: `seo:canonical-relative:${pair.key}`,
52571
+ id: `seo:canonical-relative:${pair2.key}`,
52466
52572
  severity: "high",
52467
52573
  category: "seo",
52468
- page: pair.key,
52574
+ page: pair2.key,
52469
52575
  check: "seo-deep-audit",
52470
52576
  summary: `Canonical em cand não é URL absoluta: "${candCanon}"`
52471
52577
  });
52472
52578
  }
52473
52579
  try {
52474
- const candUrlPath = new URL(pair.cand.url).pathname;
52475
- const canonPath = new URL(candCanon, pair.cand.url).pathname;
52580
+ const candUrlPath = new URL(pair2.cand.url).pathname;
52581
+ const canonPath = new URL(candCanon, pair2.cand.url).pathname;
52476
52582
  if (canonPath !== candUrlPath && canonPath === "/" && candUrlPath !== "/") {
52477
52583
  out.push({
52478
- id: `seo:canonical-home:${pair.key}`,
52584
+ id: `seo:canonical-home:${pair2.key}`,
52479
52585
  severity: "medium",
52480
52586
  category: "seo",
52481
- page: pair.key,
52587
+ page: pair2.key,
52482
52588
  check: "seo-deep-audit",
52483
- summary: `Canonical aponta para home (/) em uma página interna (${pair.key}): "${candCanon}"`
52589
+ summary: `Canonical aponta para home (/) em uma página interna (${pair2.key}): "${candCanon}"`
52484
52590
  });
52485
52591
  }
52486
52592
  } catch {}
52487
52593
  }
52488
52594
  return out;
52489
52595
  }
52490
- function checkHreflang(pair) {
52596
+ function checkHreflang(pair2) {
52491
52597
  const re = /<link[^>]+rel=["']alternate["'][^>]+hreflang=["']([^"']+)["']/gi;
52492
- const prodLangs = [...pair.prod.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52493
- const candLangs = [...pair.cand.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52598
+ const prodLangs = [...pair2.prod.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52599
+ const candLangs = [...pair2.cand.html.matchAll(re)].map((m) => m[1]).filter(Boolean).sort();
52494
52600
  const prodSet = new Set(prodLangs);
52495
52601
  const candSet = new Set(candLangs);
52496
52602
  const onlyProd = [...prodSet].filter((l) => !candSet.has(l));
52497
52603
  if (onlyProd.length > 0) {
52498
52604
  return [
52499
52605
  {
52500
- id: `seo:hreflang-missing:${pair.key}`,
52606
+ id: `seo:hreflang-missing:${pair2.key}`,
52501
52607
  severity: "medium",
52502
52608
  category: "seo",
52503
- page: pair.key,
52609
+ page: pair2.key,
52504
52610
  check: "seo-deep-audit",
52505
- summary: `hreflang(s) ausentes em cand (${pair.key}): ${onlyProd.join(", ")}`
52611
+ summary: `hreflang(s) ausentes em cand (${pair2.key}): ${onlyProd.join(", ")}`
52506
52612
  }
52507
52613
  ];
52508
52614
  }
52509
52615
  return [];
52510
52616
  }
52511
- function checkJsonLd(pair) {
52617
+ function checkJsonLd(pair2) {
52512
52618
  const out = [];
52513
- const prodLd = extractJsonLd(pair.prod.html);
52514
- const candLd = extractJsonLd(pair.cand.html);
52619
+ const prodLd = extractJsonLd(pair2.prod.html);
52620
+ const candLd = extractJsonLd(pair2.cand.html);
52515
52621
  const productDiff = diffProductSchema(prodLd, candLd);
52516
52622
  if (productDiff.prodOnly) {
52517
52623
  out.push({
52518
- id: `seo:jsonld-product-missing:${pair.key}`,
52624
+ id: `seo:jsonld-product-missing:${pair2.key}`,
52519
52625
  severity: "high",
52520
52626
  category: "seo",
52521
- page: pair.key,
52627
+ page: pair2.key,
52522
52628
  check: "seo-deep-audit",
52523
- summary: `Product JSON-LD sumiu em cand (${pair.key}) — rich snippet de produto será perdido`
52629
+ summary: `Product JSON-LD sumiu em cand (${pair2.key}) — rich snippet de produto será perdido`
52524
52630
  });
52525
52631
  } else if (productDiff.bothPresent) {
52526
52632
  if (productDiff.missingFieldsInCand.length > 0) {
52527
52633
  out.push({
52528
- id: `seo:jsonld-product-fields:${pair.key}`,
52634
+ id: `seo:jsonld-product-fields:${pair2.key}`,
52529
52635
  severity: "high",
52530
52636
  category: "seo",
52531
- page: pair.key,
52637
+ page: pair2.key,
52532
52638
  check: "seo-deep-audit",
52533
- summary: `Campos críticos do Product JSON-LD ausentes em cand (${pair.key}): ${productDiff.missingFieldsInCand.join(", ")}`
52639
+ summary: `Campos críticos do Product JSON-LD ausentes em cand (${pair2.key}): ${productDiff.missingFieldsInCand.join(", ")}`
52534
52640
  });
52535
52641
  }
52536
52642
  if (productDiff.changedFields.length > 0) {
52537
52643
  out.push({
52538
- id: `seo:jsonld-product-changed:${pair.key}`,
52644
+ id: `seo:jsonld-product-changed:${pair2.key}`,
52539
52645
  severity: "medium",
52540
52646
  category: "seo",
52541
- page: pair.key,
52647
+ page: pair2.key,
52542
52648
  check: "seo-deep-audit",
52543
- summary: `Campos do Product JSON-LD mudaram em ${pair.key}: ${productDiff.changedFields.map((c) => c.field).join(", ")}`,
52649
+ summary: `Campos do Product JSON-LD mudaram em ${pair2.key}: ${productDiff.changedFields.map((c) => c.field).join(", ")}`,
52544
52650
  details: productDiff.changedFields.map((c) => `• ${c.field}
52545
52651
  prod: ${JSON.stringify(c.prod)}
52546
52652
  cand: ${JSON.stringify(c.cand)}`).join(`
@@ -52551,32 +52657,32 @@ function checkJsonLd(pair) {
52551
52657
  const breadcrumbDiff = diffBreadcrumbSchema(prodLd, candLd);
52552
52658
  if (breadcrumbDiff.prodOnly) {
52553
52659
  out.push({
52554
- id: `seo:jsonld-breadcrumb-missing:${pair.key}`,
52660
+ id: `seo:jsonld-breadcrumb-missing:${pair2.key}`,
52555
52661
  severity: "medium",
52556
52662
  category: "seo",
52557
- page: pair.key,
52663
+ page: pair2.key,
52558
52664
  check: "seo-deep-audit",
52559
- summary: `BreadcrumbList JSON-LD sumiu em cand (${pair.key})`
52665
+ summary: `BreadcrumbList JSON-LD sumiu em cand (${pair2.key})`
52560
52666
  });
52561
52667
  } else if (breadcrumbDiff.bothPresent && breadcrumbDiff.prodItemCount !== breadcrumbDiff.candItemCount) {
52562
52668
  out.push({
52563
- id: `seo:jsonld-breadcrumb-count:${pair.key}`,
52669
+ id: `seo:jsonld-breadcrumb-count:${pair2.key}`,
52564
52670
  severity: "medium",
52565
52671
  category: "seo",
52566
- page: pair.key,
52672
+ page: pair2.key,
52567
52673
  check: "seo-deep-audit",
52568
- summary: `Breadcrumb itens divergem em ${pair.key}: prod=${breadcrumbDiff.prodItemCount}, cand=${breadcrumbDiff.candItemCount}`
52674
+ summary: `Breadcrumb itens divergem em ${pair2.key}: prod=${breadcrumbDiff.prodItemCount}, cand=${breadcrumbDiff.candItemCount}`
52569
52675
  });
52570
52676
  }
52571
52677
  const orgDiff = diffOrganizationSchema(prodLd, candLd);
52572
52678
  if (orgDiff.prodPresent && !orgDiff.candPresent) {
52573
52679
  out.push({
52574
- id: `seo:jsonld-organization-missing:${pair.key}`,
52680
+ id: `seo:jsonld-organization-missing:${pair2.key}`,
52575
52681
  severity: "low",
52576
52682
  category: "seo",
52577
- page: pair.key,
52683
+ page: pair2.key,
52578
52684
  check: "seo-deep-audit",
52579
- summary: `Organization JSON-LD sumiu em cand (${pair.key})`
52685
+ summary: `Organization JSON-LD sumiu em cand (${pair2.key})`
52580
52686
  });
52581
52687
  }
52582
52688
  return out;
@@ -52995,22 +53101,22 @@ function thirdPartyScriptsParity(ctx) {
52995
53101
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
52996
53102
  const issues = [];
52997
53103
  let pairsChecked = 0;
52998
- for (const pair of pairs) {
52999
- if (pair.prod.network.length === 0 && pair.cand.network.length === 0)
53104
+ for (const pair2 of pairs) {
53105
+ if (pair2.prod.network.length === 0 && pair2.cand.network.length === 0)
53000
53106
  continue;
53001
53107
  pairsChecked++;
53002
- const prodOrigins = thirdPartyOrigins(pair.prod);
53003
- const candOrigins = thirdPartyOrigins(pair.cand);
53108
+ const prodOrigins = thirdPartyOrigins(pair2.prod);
53109
+ const candOrigins = thirdPartyOrigins(pair2.cand);
53004
53110
  const missing = [...prodOrigins].filter((o) => !candOrigins.has(o)).sort();
53005
53111
  const added = [...candOrigins].filter((o) => !prodOrigins.has(o)).sort();
53006
53112
  if (missing.length > 0) {
53007
53113
  issues.push({
53008
- id: `3p-scripts:missing:${pair.key}`,
53114
+ id: `3p-scripts:missing:${pair2.key}`,
53009
53115
  severity: "high",
53010
53116
  category: "network",
53011
- page: pair.key,
53117
+ page: pair2.key,
53012
53118
  check: "third-party-scripts-parity",
53013
- summary: `${missing.length} origem(ns) de terceiro presente(s) em prod mas ausente(s) no candidato em ${pair.key}`,
53119
+ summary: `${missing.length} origem(ns) de terceiro presente(s) em prod mas ausente(s) no candidato em ${pair2.key}`,
53014
53120
  details: missing.join(`
53015
53121
  `),
53016
53122
  suggestedFix: "Confirme se o script foi migrado deliberadamente ou se a tag (GTM, pixel, chat, avaliações, etc.) foi perdida na porta."
@@ -53018,12 +53124,12 @@ function thirdPartyScriptsParity(ctx) {
53018
53124
  }
53019
53125
  if (added.length > 0) {
53020
53126
  issues.push({
53021
- id: `3p-scripts:added:${pair.key}`,
53127
+ id: `3p-scripts:added:${pair2.key}`,
53022
53128
  severity: "low",
53023
53129
  category: "network",
53024
- page: pair.key,
53130
+ page: pair2.key,
53025
53131
  check: "third-party-scripts-parity",
53026
- summary: `${added.length} origem(ns) de terceiro nova(s) no candidato (ausente em prod) em ${pair.key}`,
53132
+ summary: `${added.length} origem(ns) de terceiro nova(s) no candidato (ausente em prod) em ${pair2.key}`,
53027
53133
  details: added.join(`
53028
53134
  `),
53029
53135
  inconclusive: true
@@ -53551,17 +53657,17 @@ async function visualRegressionKeyframes(ctx) {
53551
53657
  let llmCallsUsed = 0;
53552
53658
  const cache = ctx.cacheDir && !ctx.noCache ? readCache(ctx.cacheDir) : {};
53553
53659
  const prepared = [];
53554
- for (const pair of pairs) {
53555
- if (!existsSync9(pair.prod.screenshotPath) || !existsSync9(pair.cand.screenshotPath)) {
53660
+ for (const pair2 of pairs) {
53661
+ if (!existsSync9(pair2.prod.screenshotPath) || !existsSync9(pair2.cand.screenshotPath)) {
53556
53662
  continue;
53557
53663
  }
53558
- const heatmapName = `diff-${pair.viewport}-${basename(pair.key.replace(/[/:]/g, "_"))}.png`;
53664
+ const heatmapName = `diff-${pair2.viewport}-${basename(pair2.key.replace(/[/:]/g, "_"))}.png`;
53559
53665
  const heatmapPath = join12(diffDir, heatmapName);
53560
53666
  const preflightIssues = [];
53561
53667
  let pctDiff = 0;
53562
53668
  let heatmapWritten = false;
53563
53669
  try {
53564
- const r = diffScreenshots(pair.prod.screenshotPath, pair.cand.screenshotPath, heatmapPath, {
53670
+ const r = diffScreenshots(pair2.prod.screenshotPath, pair2.cand.screenshotPath, heatmapPath, {
53565
53671
  maxPctDiff: 999,
53566
53672
  threshold: PIXEL_THRESHOLD
53567
53673
  });
@@ -53569,16 +53675,16 @@ async function visualRegressionKeyframes(ctx) {
53569
53675
  heatmapWritten = true;
53570
53676
  } catch (err) {
53571
53677
  preflightIssues.push({
53572
- id: `visual:error:${pair.key}`,
53678
+ id: `visual:error:${pair2.key}`,
53573
53679
  severity: "low",
53574
53680
  category: "visual",
53575
- page: pair.key,
53681
+ page: pair2.key,
53576
53682
  check: "visual-regression-keyframes",
53577
- summary: `Falha ao comparar screenshots em ${pair.key}: ${err.message}`
53683
+ summary: `Falha ao comparar screenshots em ${pair2.key}: ${err.message}`
53578
53684
  });
53579
53685
  }
53580
- const prodSnapshot = pair.prod.html ? snapshotDom(pair.prod.html) : null;
53581
- const candSnapshot = pair.cand.html ? snapshotDom(pair.cand.html) : null;
53686
+ const prodSnapshot = pair2.prod.html ? snapshotDom(pair2.prod.html) : null;
53687
+ const candSnapshot = pair2.cand.html ? snapshotDom(pair2.cand.html) : null;
53582
53688
  const prodSections = prodSnapshot?.decoSectionsRendered ?? [];
53583
53689
  const candSections = candSnapshot?.decoSectionsRendered ?? [];
53584
53690
  const candSet = new Set(candSections);
@@ -53592,7 +53698,7 @@ async function visualRegressionKeyframes(ctx) {
53592
53698
  let cacheHit;
53593
53699
  if (ctx.cacheDir && !ctx.noCache) {
53594
53700
  try {
53595
- hash2 = hashScreenshotPair(pair.prod.screenshotPath, pair.cand.screenshotPath, LLM_PROMPT_VERSION);
53701
+ hash2 = hashScreenshotPair(pair2.prod.screenshotPath, pair2.cand.screenshotPath, LLM_PROMPT_VERSION);
53596
53702
  const entry = getCacheEntry(cache, hash2, LLM_PROMPT_VERSION);
53597
53703
  if (entry) {
53598
53704
  cacheHit = {
@@ -53604,7 +53710,7 @@ async function visualRegressionKeyframes(ctx) {
53604
53710
  } catch {}
53605
53711
  }
53606
53712
  prepared.push({
53607
- pair,
53713
+ pair: pair2,
53608
53714
  heatmapPath,
53609
53715
  heatmapWritten,
53610
53716
  pctDiff,
@@ -53878,8 +53984,8 @@ function webVitalsMobile(ctx) {
53878
53984
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
53879
53985
  const mobilePairs = pairs.filter((p) => p.viewport === "mobile");
53880
53986
  const issues = [];
53881
- for (const pair of mobilePairs) {
53882
- const diff = diffVitals(pair.prod.vitals, pair.cand.vitals, DEFAULT_THRESHOLDS);
53987
+ for (const pair2 of mobilePairs) {
53988
+ const diff = diffVitals(pair2.prod.vitals, pair2.cand.vitals, DEFAULT_THRESHOLDS);
53883
53989
  if (!diff.anyFailed)
53884
53990
  continue;
53885
53991
  const failed = ["lcp", "fcp", "ttfb", "inp", "cls"].filter((k) => !diff[k].passed);
@@ -53889,16 +53995,16 @@ function webVitalsMobile(ctx) {
53889
53995
  }).join(`
53890
53996
  `);
53891
53997
  issues.push({
53892
- id: `vitals:${pair.key}`,
53998
+ id: `vitals:${pair2.key}`,
53893
53999
  severity: "high",
53894
54000
  category: "performance",
53895
- page: pair.key,
54001
+ page: pair2.key,
53896
54002
  check: "web-vitals-mobile",
53897
- summary: `Regressão Web Vitals mobile em ${pair.key}: ${failed.map((f) => f.toUpperCase()).join(", ")}`,
54003
+ summary: `Regressão Web Vitals mobile em ${pair2.key}: ${failed.map((f) => f.toUpperCase()).join(", ")}`,
53898
54004
  details,
53899
54005
  evidence: [
53900
- { kind: "screenshot", path: pair.prod.screenshotPath, label: "prod" },
53901
- { kind: "screenshot", path: pair.cand.screenshotPath, label: "cand" }
54006
+ { kind: "screenshot", path: pair2.prod.screenshotPath, label: "prod" },
54007
+ { kind: "screenshot", path: pair2.cand.screenshotPath, label: "cand" }
53902
54008
  ]
53903
54009
  });
53904
54010
  }
@@ -53953,6 +54059,7 @@ var ALL_CHECKS = [
53953
54059
  serverFnHoverFlood,
53954
54060
  faviconParity,
53955
54061
  fontParity,
54062
+ contentStructureParity,
53956
54063
  ssrNoJs,
53957
54064
  navLinksHealth,
53958
54065
  redirectsParity,
@@ -53993,6 +54100,7 @@ var ALL_CHECKS_BY_NAME = {
53993
54100
  "serverfn-hover-flood": serverFnHoverFlood,
53994
54101
  "favicon-parity": faviconParity,
53995
54102
  "font-parity": fontParity,
54103
+ "content-structure": contentStructureParity,
53996
54104
  "ssr-no-js": ssrNoJs,
53997
54105
  "nav-links-health": navLinksHealth,
53998
54106
  "redirects-parity": redirectsParity,
@@ -54114,7 +54222,7 @@ var MODULES = {
54114
54222
  },
54115
54223
  html: {
54116
54224
  name: "html",
54117
- description: "HTML structure — structural diff, lazy sections, image loading health, missing picture dimensions",
54225
+ description: "HTML structure — structural diff, lazy sections, image loading health, missing picture dimensions, editorial content structure",
54118
54226
  checks: [
54119
54227
  "html-structural-diff",
54120
54228
  "lazy-section-presence",
@@ -54122,7 +54230,8 @@ var MODULES = {
54122
54230
  "picture-missing-dims",
54123
54231
  "font-parity",
54124
54232
  "ssr-no-js",
54125
- "section-order-parity"
54233
+ "section-order-parity",
54234
+ "content-structure"
54126
54235
  ],
54127
54236
  flows: ["homepage", "plp", "pdp"]
54128
54237
  },
@@ -55088,7 +55197,7 @@ function renderVitalsPanel(run) {
55088
55197
  continue;
55089
55198
  for (const p of fc.pages) {
55090
55199
  const v = p.vitals;
55091
- const pageKey = humanKey(`${pathOf4(p.url)}::${p.viewport}`);
55200
+ const pageKey = humanKey(`${pathOf5(p.url)}::${p.viewport}`);
55092
55201
  const sideLabel = p.side;
55093
55202
  rows.push({ page: pageKey, viewport: p.viewport, metric: "LCP", prod: 0, cand: 0 });
55094
55203
  rows.push({ page: pageKey, viewport: p.viewport, metric: "FCP", prod: 0, cand: 0 });
@@ -55103,7 +55212,7 @@ function renderVitalsPanel(run) {
55103
55212
  if (fc.viewport !== "mobile")
55104
55213
  continue;
55105
55214
  for (const p of fc.pages) {
55106
- const key = pathOf4(p.url);
55215
+ const key = pathOf5(p.url);
55107
55216
  const entry = pageVitals.get(key) ?? { viewport: p.viewport };
55108
55217
  if (p.side === "prod") {
55109
55218
  entry.prod = p.vitals;
@@ -55286,7 +55395,7 @@ function formatVital2(v, unit) {
55286
55395
  return v.toFixed(3);
55287
55396
  return `${v.toFixed(0)}ms`;
55288
55397
  }
55289
- function pathOf4(url) {
55398
+ function pathOf5(url) {
55290
55399
  try {
55291
55400
  return new URL(url).pathname || "/";
55292
55401
  } catch {
@@ -55303,7 +55412,7 @@ function renderPagesTable2(run) {
55303
55412
  continue;
55304
55413
  seen.add(k);
55305
55414
  rows.push({
55306
- key: humanKey(`${pathOf4(p.url)}::${p.viewport}`),
55415
+ key: humanKey(`${pathOf5(p.url)}::${p.viewport}`),
55307
55416
  viewport: p.viewport,
55308
55417
  side: p.side,
55309
55418
  status: String(p.status),
@@ -55341,7 +55450,7 @@ function renderNetworkPanel(run) {
55341
55450
  baseUrl = p.url;
55342
55451
  candEntries.push(...p.network);
55343
55452
  if (p.network.length > 0) {
55344
- perPage.push({ label: `${pathOf4(p.url)} · ${p.viewport}`, entries: p.network });
55453
+ perPage.push({ label: `${pathOf5(p.url)} · ${p.viewport}`, entries: p.network });
55345
55454
  }
55346
55455
  }
55347
55456
  }
@@ -55910,7 +56019,7 @@ function buildSideBySidePairs(run) {
55910
56019
  if (fc.side !== side || fc.viewport !== "mobile")
55911
56020
  continue;
55912
56021
  for (const p of fc.pages) {
55913
- const path = pathOf4(p.url);
56022
+ const path = pathOf5(p.url);
55914
56023
  if (path === "/" || path === "")
55915
56024
  continue;
55916
56025
  const role = classifyPath(path, !seenNonHome);
@@ -56579,48 +56688,577 @@ function printResult(result, meta) {
56579
56688
  }
56580
56689
  }
56581
56690
 
56582
- // src/commands/compare.ts
56691
+ // src/commands/cms.ts
56692
+ import { existsSync as existsSync13, mkdirSync as mkdirSync9, readFileSync as readFileSync16, writeFileSync as writeFileSync12 } from "node:fs";
56693
+ import { dirname as dirname4, join as join18 } from "node:path";
56583
56694
  import chalk6 from "chalk";
56695
+
56696
+ // src/cms/client.ts
56697
+ import { homedir as homedir2 } from "node:os";
56698
+ import { join as join15 } from "node:path";
56699
+ import { readFileSync as readFileSync13 } from "node:fs";
56700
+ var MANAGE = "api/content-platform/manage";
56701
+ var SCHEMAS = "api/content-platform/schemas";
56702
+ function tokenFromVtexSession(home = homedir2()) {
56703
+ try {
56704
+ const raw = readFileSync13(join15(home, ".config", "configstore", "vtex.json"), "utf8");
56705
+ const token = JSON.parse(raw).token;
56706
+ return token && token.length > 0 ? token : null;
56707
+ } catch {
56708
+ return null;
56709
+ }
56710
+ }
56711
+ function cmsConfigFromEnv(env = process.env, home = homedir2()) {
56712
+ const account = env.PARITY_CMS_ACCOUNT;
56713
+ const store = env.PARITY_CMS_STORE;
56714
+ const token = env.PARITY_CMS_TOKEN ?? tokenFromVtexSession(home);
56715
+ if (!account || !store || !token)
56716
+ return null;
56717
+ return { account, store, token };
56718
+ }
56719
+ function baseUrl(cfg) {
56720
+ return `https://${cfg.account}.myvtex.com`;
56721
+ }
56722
+ var callCms = async (cfg, req) => {
56723
+ const method = req.method ?? "GET";
56724
+ const res = await fetch(`${baseUrl(cfg)}/${req.path}`, {
56725
+ method,
56726
+ headers: {
56727
+ authorization: `Bearer ${cfg.token}`,
56728
+ accept: "application/json",
56729
+ ...req.body === undefined ? {} : { "content-type": "application/json" }
56730
+ },
56731
+ ...req.body === undefined ? {} : { body: JSON.stringify(req.body) }
56732
+ });
56733
+ const text3 = await res.text().catch(() => "");
56734
+ if (!res.ok) {
56735
+ throw new Error(`${method} ${req.path}: HTTP ${res.status} ${text3.slice(0, 300)}`);
56736
+ }
56737
+ return text3 ? JSON.parse(text3) : {};
56738
+ };
56739
+ async function listBranches(cfg, call = callCms) {
56740
+ return call(cfg, { path: `${MANAGE}/${cfg.account}/${cfg.store}/branches` });
56741
+ }
56742
+ async function listEntries(cfg, opts = {}, call = callCms) {
56743
+ const params = new URLSearchParams({
56744
+ contentTypes: opts.contentType ?? "",
56745
+ page: "1",
56746
+ pageSize: String(opts.pageSize ?? 100)
56747
+ });
56748
+ const res = await call(cfg, {
56749
+ path: `${MANAGE}/${cfg.account}/entries?${params}`
56750
+ });
56751
+ return res.entries ?? [];
56752
+ }
56753
+ async function getLastVersion(cfg, args, call = callCms) {
56754
+ const { contentType, entryId, branchId } = args;
56755
+ const at = (branch) => call(cfg, {
56756
+ path: `${MANAGE}/${cfg.account}/${cfg.store}/${contentType}/entries/${entryId}/last-version?branchId=${branch}`
56757
+ });
56758
+ try {
56759
+ return await at(branchId);
56760
+ } catch (err) {
56761
+ const missing = err instanceof Error && /ENTRY_VERSIONS_NOT_FOUND/.test(err.message);
56762
+ if (!missing || branchId === "main")
56763
+ throw err;
56764
+ const base = await at("main");
56765
+ return { ...base, branchId, inheritedFromMain: true };
56766
+ }
56767
+ }
56768
+ async function commitEntry(cfg, input, call = callCms) {
56769
+ if (!input.baseHash) {
56770
+ throw new Error("commitEntry: baseHash is required — it is the lock against clobbering a concurrent edit");
56771
+ }
56772
+ return call(cfg, {
56773
+ path: `${MANAGE}/${cfg.account}/${cfg.store}/branches/${input.branchId}/commits`,
56774
+ method: "POST",
56775
+ body: {
56776
+ author: input.author,
56777
+ contentTypeId: input.contentTypeId,
56778
+ message: input.message,
56779
+ data: input.data,
56780
+ entryId: input.entryId,
56781
+ entryName: input.entryName,
56782
+ baseHash: input.baseHash,
56783
+ identifierKeys: input.identifierKeys ?? null,
56784
+ search_keywords: input.searchKeywords ?? null
56785
+ }
56786
+ });
56787
+ }
56788
+ async function undoEntry(cfg, args, call = callCms) {
56789
+ await call(cfg, {
56790
+ path: `${MANAGE}/${cfg.account}/${cfg.store}/branches/${args.branchId}/entries/${args.entryId}/undo`,
56791
+ method: "DELETE"
56792
+ });
56793
+ }
56794
+ async function getContentTypes(cfg, call = callCms) {
56795
+ return call(cfg, {
56796
+ path: `${SCHEMAS}/${cfg.account}.${cfg.store}/content-types`
56797
+ });
56798
+ }
56799
+
56800
+ // src/cms/authoring.ts
56801
+ function collectionToArray(node2) {
56802
+ if (Array.isArray(node2))
56803
+ return node2;
56804
+ if (node2 && typeof node2 === "object") {
56805
+ const values = node2.values;
56806
+ if (values && typeof values === "object") {
56807
+ return Object.values(values);
56808
+ }
56809
+ }
56810
+ return [];
56811
+ }
56812
+ function sectionsOf(data2) {
56813
+ if (!data2)
56814
+ return [];
56815
+ return collectionToArray(data2.sections).map((s) => ({
56816
+ id: s.id ?? null,
56817
+ componentKey: String(s.$componentKey ?? "?"),
56818
+ position: typeof s.$position === "number" ? s.$position : null
56819
+ })).sort((a, b) => (a.position ?? 0) - (b.position ?? 0));
56820
+ }
56821
+ function summarizeSections(data2) {
56822
+ if (!data2)
56823
+ return [];
56824
+ const sections = collectionToArray(data2.sections);
56825
+ return sectionsOf(data2).map((s) => {
56826
+ const raw = sections.find((x) => x.id === s.id) ?? {};
56827
+ const counts = Object.entries(raw).filter(([, v]) => collectionToArray(v).length > 0).map(([k, v]) => `${k}=${collectionToArray(v).length}`);
56828
+ return counts.length > 0 ? `${s.componentKey} (${counts.join(", ")})` : s.componentKey;
56829
+ });
56830
+ }
56831
+
56832
+ // src/cms/session.ts
56833
+ import { existsSync as existsSync11, readFileSync as readFileSync14 } from "node:fs";
56834
+ import { homedir as homedir3 } from "node:os";
56835
+ import { delimiter, join as join16 } from "node:path";
56836
+ function sessionFile(home) {
56837
+ return join16(home, ".config", "configstore", "vtex.json");
56838
+ }
56839
+ function expiryOf(token) {
56840
+ const payload = token.split(".")[1];
56841
+ if (!payload)
56842
+ return null;
56843
+ try {
56844
+ const json = Buffer.from(payload.replace(/-/g, "+").replace(/_/g, "/"), "base64").toString("utf8");
56845
+ const exp = JSON.parse(json).exp;
56846
+ return typeof exp === "number" ? exp : null;
56847
+ } catch {
56848
+ return null;
56849
+ }
56850
+ }
56851
+ function readVtexSession(home = homedir3()) {
56852
+ try {
56853
+ const raw = JSON.parse(readFileSync14(sessionFile(home), "utf8"));
56854
+ const token = typeof raw.token === "string" ? raw.token : "";
56855
+ if (!token)
56856
+ return null;
56857
+ return {
56858
+ token,
56859
+ account: typeof raw.account === "string" ? raw.account : null,
56860
+ login: typeof raw.login === "string" ? raw.login : null,
56861
+ expiresAt: expiryOf(token)
56862
+ };
56863
+ } catch {
56864
+ return null;
56865
+ }
56866
+ }
56867
+ function vtexCliInstalled(env = process.env) {
56868
+ const dirs = (env.PATH ?? "").split(delimiter).filter(Boolean);
56869
+ return dirs.some((dir) => existsSync11(join16(dir, "vtex")));
56870
+ }
56871
+ function sessionState(expectedAccount, env = process.env, home = homedir3(), now = Date.now()) {
56872
+ if (env.PARITY_CMS_TOKEN)
56873
+ return { status: "env-token" };
56874
+ const session = readVtexSession(home);
56875
+ if (!session)
56876
+ return vtexCliInstalled(env) ? { status: "logged-out" } : { status: "no-cli" };
56877
+ if (session.expiresAt !== null && session.expiresAt * 1000 <= now) {
56878
+ return { status: "expired", session };
56879
+ }
56880
+ if (expectedAccount && session.account && session.account !== expectedAccount) {
56881
+ return { status: "wrong-account", session, expected: expectedAccount };
56882
+ }
56883
+ return { status: "ok", session };
56884
+ }
56885
+ function sessionAdvice(state, expectedAccount = "<account>") {
56886
+ switch (state.status) {
56887
+ case "no-cli":
56888
+ return [
56889
+ "The VTEX toolbelt is not installed, so there is no way to get a session token.",
56890
+ " npm i -g vtex",
56891
+ ` vtex login ${expectedAccount}`
56892
+ ].join(`
56893
+ `);
56894
+ case "logged-out":
56895
+ return [
56896
+ "Not logged into VTEX.",
56897
+ ` vtex login ${expectedAccount}`,
56898
+ " (opens a browser for SSO — a human has to complete it)"
56899
+ ].join(`
56900
+ `);
56901
+ case "expired":
56902
+ return [
56903
+ `VTEX session expired${state.session.login ? ` for ${state.session.login}` : ""} — the toolbelt token lasts about a day.`,
56904
+ ` vtex login ${expectedAccount}`
56905
+ ].join(`
56906
+ `);
56907
+ case "wrong-account":
56908
+ return [
56909
+ `Logged into "${state.session.account}", but this run targets "${state.expected}". Wrong-account requests answer 401, which looks like a broken token.`,
56910
+ ` vtex login ${state.expected}`
56911
+ ].join(`
56912
+ `);
56913
+ default:
56914
+ return "";
56915
+ }
56916
+ }
56917
+ function describeSession(state) {
56918
+ if (state.status === "env-token")
56919
+ return "using PARITY_CMS_TOKEN";
56920
+ if (state.status !== "ok")
56921
+ return "";
56922
+ const { login, account, expiresAt } = state.session;
56923
+ const left = expiresAt === null ? "" : ` · expires in ${Math.max(0, Math.round((expiresAt * 1000 - Date.now()) / 3600000))}h`;
56924
+ return `${login ?? "?"} on ${account ?? "?"}${left}`;
56925
+ }
56926
+
56927
+ // src/cms/schema.ts
56928
+ import { readFileSync as readFileSync15, readdirSync as readdirSync3, existsSync as existsSync12 } from "node:fs";
56929
+ import { join as join17 } from "node:path";
56930
+ function publishedComponentKeys(contentType) {
56931
+ const items = contentType?.properties?.sections?.items;
56932
+ const anyOf = items?.anyOf ?? [];
56933
+ return anyOf.map((s) => String(s.$componentKey ?? "")).filter(Boolean);
56934
+ }
56935
+ function localComponentKeys(repoDir, contentType) {
56936
+ const dir = join17(repoDir, "cms", "faststore", "pages");
56937
+ if (!existsSync12(dir))
56938
+ return null;
56939
+ const wanted = `cms_content_type__${contentType.toLowerCase()}.jsonc`;
56940
+ const file = readdirSync3(dir).find((f) => f.toLowerCase() === wanted);
56941
+ if (!file)
56942
+ return null;
56943
+ const raw = readFileSync15(join17(dir, file), "utf8");
56944
+ const start = raw.indexOf('"sections"');
56945
+ if (start < 0)
56946
+ return [];
56947
+ return [...raw.slice(start).matchAll(/"#\/components\/([A-Za-z0-9_-]+)"/g)].map((m) => m[1] ?? "").filter(Boolean);
56948
+ }
56949
+ function schemaDrift(published, repoDir) {
56950
+ const drift = [];
56951
+ for (const [contentType, schema] of Object.entries(published)) {
56952
+ const local = localComponentKeys(repoDir, contentType);
56953
+ if (!local)
56954
+ continue;
56955
+ const remote = publishedComponentKeys(schema);
56956
+ const missingOnAccount = local.filter((k) => !remote.includes(k));
56957
+ const missingInRepo = remote.filter((k) => !local.includes(k));
56958
+ if (missingOnAccount.length > 0 || missingInRepo.length > 0) {
56959
+ drift.push({ contentType, missingOnAccount, missingInRepo });
56960
+ }
56961
+ }
56962
+ return drift;
56963
+ }
56964
+ function unrenderableSections(usedKeys, contentType) {
56965
+ const allowed = publishedComponentKeys(contentType);
56966
+ if (allowed.length === 0)
56967
+ return [];
56968
+ return [...new Set(usedKeys.filter((k) => !allowed.includes(k)))];
56969
+ }
56970
+
56971
+ // src/commands/cms.ts
56972
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
56973
+ function config() {
56974
+ const account = process.env.PARITY_CMS_ACCOUNT;
56975
+ const store = process.env.PARITY_CMS_STORE;
56976
+ if (!account || !store) {
56977
+ console.error(chalk6.red("Missing target. Set PARITY_CMS_ACCOUNT and PARITY_CMS_STORE (the store id, not the account)."));
56978
+ return null;
56979
+ }
56980
+ const state = sessionState(account);
56981
+ if (state.status !== "ok" && state.status !== "env-token") {
56982
+ console.error(chalk6.red(sessionAdvice(state, account)));
56983
+ return null;
56984
+ }
56985
+ const cfg = cmsConfigFromEnv();
56986
+ if (!cfg) {
56987
+ console.error(chalk6.red("Could not read a VTEX token. Run `vtex login` or set PARITY_CMS_TOKEN."));
56988
+ }
56989
+ return cfg;
56990
+ }
56991
+ function fail(err) {
56992
+ console.error(chalk6.red(err instanceof Error ? err.message : String(err)));
56993
+ return 1;
56994
+ }
56995
+ function resolveBranch(branch, allowMain) {
56996
+ if (!branch)
56997
+ return new Error("--branch <id> is required. `parity cms ls --branches` lists them.");
56998
+ if (branch === "main") {
56999
+ return allowMain ? "main" : new Error("Refusing to write to main. Use a working branch, or pass --allow-main.");
57000
+ }
57001
+ if (!UUID.test(branch)) {
57002
+ return new Error(`"${branch}" is not a branch id. Branch names do not address a branch — pass the uuid from \`parity cms ls --branches\`.`);
57003
+ }
57004
+ return branch;
57005
+ }
57006
+ async function cmsDoctorCommand(opts, call = callCms) {
57007
+ const cfg = config();
57008
+ if (!cfg)
57009
+ return 1;
57010
+ const session = describeSession(sessionState(process.env.PARITY_CMS_ACCOUNT));
57011
+ try {
57012
+ const types = await getContentTypes(cfg, call);
57013
+ const drift = schemaDrift(types, opts.repo);
57014
+ if (opts.json) {
57015
+ console.log(JSON.stringify({ session, contentTypes: Object.keys(types), drift }, null, 2));
57016
+ return drift.some((d) => d.missingOnAccount.length > 0) ? 1 : 0;
57017
+ }
57018
+ if (session)
57019
+ console.log(`${chalk6.green("✓")} ${session}`);
57020
+ const blocking = drift.filter((d) => d.missingOnAccount.length > 0);
57021
+ if (blocking.length === 0) {
57022
+ console.log(`${chalk6.green("✓")} every section the repo declares is published on the account`);
57023
+ }
57024
+ for (const d of blocking) {
57025
+ console.log(`${chalk6.red("✗")} ${d.contentType}: ${d.missingOnAccount.join(", ")} ${chalk6.dim("— in the repo, not on the account. Upload the schema (`faststore cms-sync`) or it renders nothing.")}`);
57026
+ }
57027
+ for (const d of drift.filter((x) => x.missingInRepo.length > 0)) {
57028
+ console.log(`${chalk6.gray("·")} ${d.contentType}: ${d.missingInRepo.length} section(s) published but not in the repo ${chalk6.dim("(usually core components the repo never overrode)")}`);
57029
+ }
57030
+ return blocking.length > 0 ? 1 : 0;
57031
+ } catch (err) {
57032
+ return fail(err);
57033
+ }
57034
+ }
57035
+ async function cmsLsCommand(opts, call = callCms) {
57036
+ const cfg = config();
57037
+ if (!cfg)
57038
+ return 1;
57039
+ try {
57040
+ if (opts.branches) {
57041
+ const branches = await listBranches(cfg, call);
57042
+ if (opts.json)
57043
+ console.log(JSON.stringify(branches, null, 2));
57044
+ else
57045
+ for (const b of branches)
57046
+ console.log(`${b.id} ${b.name}`);
57047
+ return 0;
57048
+ }
57049
+ const entries = await listEntries(cfg, { contentType: opts.contentType }, call);
57050
+ if (opts.json) {
57051
+ console.log(JSON.stringify(entries, null, 2));
57052
+ return 0;
57053
+ }
57054
+ for (const e of entries) {
57055
+ const slug = e.search_keywords?.find((k) => k.startsWith("/")) ?? "";
57056
+ console.log(`${e.id} ${e.contentTypeId.padEnd(14)} ${slug.padEnd(34)} ${e.name}`);
57057
+ }
57058
+ return 0;
57059
+ } catch (err) {
57060
+ return fail(err);
57061
+ }
57062
+ }
57063
+ async function cmsPullCommand(opts, call = callCms) {
57064
+ const cfg = config();
57065
+ if (!cfg)
57066
+ return 1;
57067
+ const branch = resolveBranch(opts.branch, true);
57068
+ if (branch instanceof Error)
57069
+ return fail(branch);
57070
+ try {
57071
+ const version = await getLastVersion(cfg, { contentType: opts.contentType, entryId: opts.entry, branchId: branch }, call);
57072
+ const out = opts.out ?? join18("parity-output", "cms", `${opts.contentType}-${opts.entry}.json`);
57073
+ mkdirSync9(dirname4(out), { recursive: true });
57074
+ writeFileSync12(out, `${JSON.stringify(version, null, 2)}
57075
+ `);
57076
+ if (opts.json) {
57077
+ console.log(JSON.stringify({ out, sections: sectionsOf(version.data).length }, null, 2));
57078
+ return 0;
57079
+ }
57080
+ console.log(`${chalk6.green("✓")} ${out}`);
57081
+ if (version.inheritedFromMain) {
57082
+ console.log(chalk6.dim(" (this branch has no changes to this entry yet — content read from main)"));
57083
+ }
57084
+ for (const line of summarizeSections(version.data))
57085
+ console.log(` ${line}`);
57086
+ return 0;
57087
+ } catch (err) {
57088
+ return fail(err);
57089
+ }
57090
+ }
57091
+ function readPulled(file) {
57092
+ if (!existsSync13(file))
57093
+ return new Error(`No such file: ${file}`);
57094
+ try {
57095
+ return JSON.parse(readFileSync16(file, "utf8"));
57096
+ } catch (err) {
57097
+ return new Error(`${file} is not valid JSON: ${err instanceof Error ? err.message : err}`);
57098
+ }
57099
+ }
57100
+ async function cmsDiffCommand(opts, call = callCms) {
57101
+ const cfg = config();
57102
+ if (!cfg)
57103
+ return 1;
57104
+ const local = readPulled(opts.file);
57105
+ if (local instanceof Error)
57106
+ return fail(local);
57107
+ try {
57108
+ const remote = await getLastVersion(cfg, {
57109
+ contentType: local.contentType,
57110
+ entryId: local.entryId,
57111
+ branchId: opts.branch ?? local.branchId
57112
+ }, call);
57113
+ const changed = JSON.stringify(local.data) !== JSON.stringify(remote.data);
57114
+ const stale = remote.baseHash !== local.baseHash;
57115
+ const result = {
57116
+ changed,
57117
+ stale,
57118
+ local: summarizeSections(local.data),
57119
+ remote: summarizeSections(remote.data)
57120
+ };
57121
+ if (opts.json) {
57122
+ console.log(JSON.stringify(result, null, 2));
57123
+ return changed ? 1 : 0;
57124
+ }
57125
+ if (!changed) {
57126
+ console.log(`${chalk6.green("✓")} no changes`);
57127
+ return 0;
57128
+ }
57129
+ console.log(chalk6.yellow("remote → local (what push would write)"));
57130
+ const width = Math.max(result.local.length, result.remote.length);
57131
+ for (let i = 0;i < width; i += 1) {
57132
+ const l = result.local[i] ?? chalk6.dim("—");
57133
+ const r = result.remote[i] ?? chalk6.dim("—");
57134
+ console.log(` ${l === r ? chalk6.gray(l) : `${chalk6.red(r)} → ${chalk6.green(l)}`}`);
57135
+ }
57136
+ if (stale) {
57137
+ console.log(chalk6.yellow("! the remote moved since this was pulled — pull again before pushing, or the commit is rejected"));
57138
+ }
57139
+ return 1;
57140
+ } catch (err) {
57141
+ return fail(err);
57142
+ }
57143
+ }
57144
+ async function cmsPushCommand(opts, call = callCms) {
57145
+ const cfg = config();
57146
+ if (!cfg)
57147
+ return 1;
57148
+ const local = readPulled(opts.file);
57149
+ if (local instanceof Error)
57150
+ return fail(local);
57151
+ const branch = resolveBranch(opts.branch ?? local.branchId, Boolean(opts.allowMain));
57152
+ if (branch instanceof Error)
57153
+ return fail(branch);
57154
+ try {
57155
+ const types = await getContentTypes(cfg, call);
57156
+ const used = sectionsOf(local.data).map((s) => s.componentKey);
57157
+ const unrenderable = unrenderableSections(used, types[local.contentType]);
57158
+ if (unrenderable.length > 0) {
57159
+ return fail(new Error(`${unrenderable.join(", ")} not published on this account — the commit would succeed and render nothing. Upload the schema first (\`faststore cms-sync\`), or run \`parity cms doctor\`.`));
57160
+ }
57161
+ const remote = await getLastVersion(cfg, { contentType: local.contentType, entryId: local.entryId, branchId: branch }, call);
57162
+ if (remote.baseHash !== local.baseHash) {
57163
+ return fail(new Error(`Stale: pulled at ${local.baseHash.slice(0, 12)}, remote is at ${remote.baseHash.slice(0, 12)}. Pull again.`));
57164
+ }
57165
+ if (!opts.yes) {
57166
+ console.log(chalk6.yellow("dry run — nothing written. Pass --yes to commit."));
57167
+ for (const line of summarizeSections(local.data))
57168
+ console.log(` ${line}`);
57169
+ console.log(chalk6.dim(` branch ${branch} · entry ${local.entryId} · ${local.contentType}`));
57170
+ return 0;
57171
+ }
57172
+ const backup = join18("parity-output", "cms-backups", `${local.entryId}-${remote.baseHash.slice(0, 12)}.json`);
57173
+ mkdirSync9(dirname4(backup), { recursive: true });
57174
+ writeFileSync12(backup, `${JSON.stringify(remote, null, 2)}
57175
+ `);
57176
+ const commit = await commitEntry(cfg, {
57177
+ branchId: branch,
57178
+ contentTypeId: local.contentType,
57179
+ entryId: local.entryId,
57180
+ entryName: local.entryName,
57181
+ baseHash: local.baseHash,
57182
+ data: local.data,
57183
+ message: opts.message ?? "parity cms push",
57184
+ author: opts.author ?? "parity",
57185
+ identifierKeys: local.identifierKeys,
57186
+ searchKeywords: local.searchKeywords
57187
+ }, call);
57188
+ if (opts.json) {
57189
+ console.log(JSON.stringify({ commit, backup }, null, 2));
57190
+ return 0;
57191
+ }
57192
+ console.log(`${chalk6.green("✓")} commit ${commit.id} on ${branch}`);
57193
+ console.log(chalk6.dim(` rollback: parity cms undo --entry ${local.entryId} --branch ${branch}`));
57194
+ console.log(chalk6.dim(` backup: ${backup}`));
57195
+ return 0;
57196
+ } catch (err) {
57197
+ return fail(err);
57198
+ }
57199
+ }
57200
+ async function cmsUndoCommand(opts, call = callCms) {
57201
+ const cfg = config();
57202
+ if (!cfg)
57203
+ return 1;
57204
+ const branch = resolveBranch(opts.branch, Boolean(opts.allowMain));
57205
+ if (branch instanceof Error)
57206
+ return fail(branch);
57207
+ if (!opts.yes) {
57208
+ console.log(chalk6.yellow(`dry run — would drop ${opts.entry} changes on ${branch}. Pass --yes.`));
57209
+ return 0;
57210
+ }
57211
+ try {
57212
+ await undoEntry(cfg, { branchId: branch, entryId: opts.entry }, call);
57213
+ console.log(`${chalk6.green("✓")} ${opts.entry} reverted on ${branch}`);
57214
+ return 0;
57215
+ } catch (err) {
57216
+ return fail(err);
57217
+ }
57218
+ }
57219
+
57220
+ // src/commands/compare.ts
57221
+ import chalk7 from "chalk";
56584
57222
  function compareCommand(runId, baselineName, output) {
56585
57223
  try {
56586
57224
  const run = loadRun(output, runId);
56587
57225
  const baseline = loadBaseline(baselineName);
56588
57226
  const delta = compareToBaseline(run, baseline);
56589
- console.log(chalk6.bold(`
57227
+ console.log(chalk7.bold(`
56590
57228
  Delta ${runId} vs baseline "${baselineName}"`));
56591
- console.log(` ${chalk6.green("✓ resolved")}: ${delta.resolved.length}`);
56592
- console.log(` ${chalk6.yellow("+ new")}: ${delta.new.length}`);
56593
- console.log(` ${chalk6.red("⚠ regressed")}: ${delta.regressions.length}`);
57229
+ console.log(` ${chalk7.green("✓ resolved")}: ${delta.resolved.length}`);
57230
+ console.log(` ${chalk7.yellow("+ new")}: ${delta.new.length}`);
57231
+ console.log(` ${chalk7.red("⚠ regressed")}: ${delta.regressions.length}`);
56594
57232
  if (delta.new.length > 0) {
56595
- console.log(chalk6.bold(`
57233
+ console.log(chalk7.bold(`
56596
57234
  Novos issue ids:`));
56597
57235
  for (const id of delta.new)
56598
57236
  console.log(` - ${id}`);
56599
57237
  }
56600
57238
  if (delta.regressions.length > 0) {
56601
- console.log(chalk6.bold(`
57239
+ console.log(chalk7.bold(`
56602
57240
  Regressões (severity piorou):`));
56603
57241
  for (const id of delta.regressions)
56604
57242
  console.log(` - ${id}`);
56605
57243
  }
56606
57244
  return 0;
56607
57245
  } catch (err) {
56608
- console.error(chalk6.red(`✖ ${err.message}`));
57246
+ console.error(chalk7.red(`✖ ${err.message}`));
56609
57247
  return 1;
56610
57248
  }
56611
57249
  }
56612
57250
 
56613
57251
  // src/commands/console.ts
56614
- import chalk7 from "chalk";
57252
+ import chalk8 from "chalk";
56615
57253
  async function consoleCommand(opts) {
56616
57254
  const viewport = parseViewport2(opts.viewport);
56617
57255
  if (!viewport) {
56618
- console.error(chalk7.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
57256
+ console.error(chalk8.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
56619
57257
  return 2;
56620
57258
  }
56621
57259
  const waitMs = Number.parseInt(opts.wait, 10);
56622
57260
  if (!Number.isFinite(waitMs) || waitMs < 0) {
56623
- console.error(chalk7.red(`--wait inválido: ${opts.wait}`));
57261
+ console.error(chalk8.red(`--wait inválido: ${opts.wait}`));
56624
57262
  return 2;
56625
57263
  }
56626
57264
  const filter4 = parseFilter(opts.filter);
@@ -56628,7 +57266,7 @@ async function consoleCommand(opts) {
56628
57266
  try {
56629
57267
  url = new URL(opts.url);
56630
57268
  } catch {
56631
- console.error(chalk7.red(`--url inválido: ${opts.url}`));
57269
+ console.error(chalk8.red(`--url inválido: ${opts.url}`));
56632
57270
  return 2;
56633
57271
  }
56634
57272
  const browser = await launchBrowser({ headless: true });
@@ -56677,24 +57315,24 @@ function printResults(entries, meta) {
56677
57315
  return;
56678
57316
  }
56679
57317
  if (entries.length === 0) {
56680
- console.log(chalk7.dim(` ${meta.viewport} · ${meta.url}
57318
+ console.log(chalk8.dim(` ${meta.viewport} · ${meta.url}
56681
57319
  nenhuma entrada de console nos filtros pedidos`));
56682
57320
  return;
56683
57321
  }
56684
- console.log(chalk7.bold(`
57322
+ console.log(chalk8.bold(`
56685
57323
  ${meta.viewport} · ${meta.url}`));
56686
- console.log(chalk7.dim(` ${entries.length} entrada(s)
57324
+ console.log(chalk8.dim(` ${entries.length} entrada(s)
56687
57325
  `));
56688
57326
  for (const e of entries) {
56689
- const tag = e.type === "error" ? chalk7.red("[error ]") : e.type === "warning" ? chalk7.yellow("[warn ]") : chalk7.dim(`[${e.type.padEnd(7)}]`);
56690
- const loc = e.location ? chalk7.dim(` ← ${e.location}`) : "";
57327
+ const tag = e.type === "error" ? chalk8.red("[error ]") : e.type === "warning" ? chalk8.yellow("[warn ]") : chalk8.dim(`[${e.type.padEnd(7)}]`);
57328
+ const loc = e.location ? chalk8.dim(` ← ${e.location}`) : "";
56691
57329
  const text3 = e.text.length > 400 ? `${e.text.slice(0, 397)}...` : e.text;
56692
57330
  console.log(` ${tag} ${text3}${loc}`);
56693
57331
  }
56694
57332
  }
56695
57333
 
56696
57334
  // src/commands/css-trace.ts
56697
- import chalk8 from "chalk";
57335
+ import chalk9 from "chalk";
56698
57336
  async function tracePage(page, url, selector, settleMs) {
56699
57337
  await page.goto(url, { waitUntil: "domcontentloaded", timeout: 30000 });
56700
57338
  await page.waitForLoadState("load", { timeout: 12000 }).catch(() => {
@@ -56805,35 +57443,35 @@ function applyFilter(result, filter4) {
56805
57443
  return { ...result, computed, rules };
56806
57444
  }
56807
57445
  function printResult2(result, header) {
56808
- console.log(chalk8.bold(`
57446
+ console.log(chalk9.bold(`
56809
57447
  ${header}`));
56810
- console.log(chalk8.dim(`URL: ${result.url}`));
56811
- console.log(chalk8.dim(`Selector: ${result.selector}`));
57448
+ console.log(chalk9.dim(`URL: ${result.url}`));
57449
+ console.log(chalk9.dim(`Selector: ${result.selector}`));
56812
57450
  if (!result.found) {
56813
- console.log(chalk8.red("✖ Element not found"));
57451
+ console.log(chalk9.red("✖ Element not found"));
56814
57452
  return;
56815
57453
  }
56816
57454
  const computedKeys = Object.keys(result.computed);
56817
57455
  if (computedKeys.length > 0) {
56818
- console.log(chalk8.bold(`
57456
+ console.log(chalk9.bold(`
56819
57457
  Computed:`));
56820
57458
  for (const k of computedKeys) {
56821
- console.log(` ${chalk8.cyan(k)}: ${result.computed[k]}`);
57459
+ console.log(` ${chalk9.cyan(k)}: ${result.computed[k]}`);
56822
57460
  }
56823
57461
  }
56824
57462
  if (result.rules.length === 0) {
56825
- console.log(chalk8.yellow(`
57463
+ console.log(chalk9.yellow(`
56826
57464
  No matching rules after filter.`));
56827
57465
  return;
56828
57466
  }
56829
- console.log(chalk8.bold(`
57467
+ console.log(chalk9.bold(`
56830
57468
  Rules (ordered by CDP — most specific last):`));
56831
57469
  for (const r of result.rules) {
56832
- const inheritLabel = r.inheritedFromDistance !== undefined ? chalk8.yellow(` ↑ inherited from ancestor (${r.inheritedFromDistance})`) : "";
56833
- console.log(` ${chalk8.magenta(r.source)}${inheritLabel}`);
56834
- console.log(` ${chalk8.green(r.selector)} {`);
57470
+ const inheritLabel = r.inheritedFromDistance !== undefined ? chalk9.yellow(` ↑ inherited from ancestor (${r.inheritedFromDistance})`) : "";
57471
+ console.log(` ${chalk9.magenta(r.source)}${inheritLabel}`);
57472
+ console.log(` ${chalk9.green(r.selector)} {`);
56835
57473
  for (const p of r.properties) {
56836
- const bang = p.important ? chalk8.red(" !important") : "";
57474
+ const bang = p.important ? chalk9.red(" !important") : "";
56837
57475
  console.log(` ${p.name}: ${p.value}${bang};`);
56838
57476
  }
56839
57477
  console.log(" }");
@@ -56854,38 +57492,38 @@ function printComparison(prod, cand) {
56854
57492
  printResult2(prod, "── PROD ──────────────────────────────────────────────");
56855
57493
  printResult2(cand, "── CAND ──────────────────────────────────────────────");
56856
57494
  const diffs = diffComputed(prod, cand);
56857
- console.log(chalk8.bold(`
57495
+ console.log(chalk9.bold(`
56858
57496
  ── DIFF (computed) ───────────────────────────────────`));
56859
57497
  if (diffs.length === 0) {
56860
- console.log(chalk8.green(" No computed-style differences in the filtered set."));
57498
+ console.log(chalk9.green(" No computed-style differences in the filtered set."));
56861
57499
  return;
56862
57500
  }
56863
57501
  for (const d of diffs) {
56864
- console.log(` ${chalk8.cyan(d.property)}`);
56865
- console.log(` prod: ${chalk8.green(d.prod ?? "(unset)")}`);
56866
- console.log(` cand: ${chalk8.red(d.cand ?? "(unset)")}`);
57502
+ console.log(` ${chalk9.cyan(d.property)}`);
57503
+ console.log(` prod: ${chalk9.green(d.prod ?? "(unset)")}`);
57504
+ console.log(` cand: ${chalk9.red(d.cand ?? "(unset)")}`);
56867
57505
  }
56868
57506
  }
56869
57507
  async function cssTraceCommand(opts) {
56870
57508
  const viewport = opts.viewport ?? "desktop";
56871
57509
  const settleMs = opts.settleMs ?? 1500;
56872
57510
  if (!opts.selector) {
56873
- console.error(chalk8.red("--selector is required"));
57511
+ console.error(chalk9.red("--selector is required"));
56874
57512
  return 1;
56875
57513
  }
56876
57514
  const hasUrl = !!opts.url;
56877
57515
  const hasProd = !!opts.prod;
56878
57516
  const hasCand = !!opts.cand;
56879
57517
  if (hasUrl && (hasProd || hasCand)) {
56880
- console.error(chalk8.red("--url is mutually exclusive with --prod / --cand. Pass one mode only."));
57518
+ console.error(chalk9.red("--url is mutually exclusive with --prod / --cand. Pass one mode only."));
56881
57519
  return 1;
56882
57520
  }
56883
57521
  if (hasProd && !hasCand || !hasProd && hasCand) {
56884
- console.error(chalk8.red("Comparison mode needs both --prod and --cand (got only one)."));
57522
+ console.error(chalk9.red("Comparison mode needs both --prod and --cand (got only one)."));
56885
57523
  return 1;
56886
57524
  }
56887
57525
  if (!hasUrl && !hasProd && !hasCand) {
56888
- console.error(chalk8.red("Provide either --url or both --prod and --cand."));
57526
+ console.error(chalk9.red("Provide either --url or both --prod and --cand."));
56889
57527
  return 1;
56890
57528
  }
56891
57529
  const isCompare = hasProd && hasCand;
@@ -56936,7 +57574,7 @@ async function cssTraceCommand(opts) {
56936
57574
  }
56937
57575
  return 0;
56938
57576
  } catch (err) {
56939
- console.error(chalk8.red(`Error: ${err.message}`));
57577
+ console.error(chalk9.red(`Error: ${err.message}`));
56940
57578
  return 1;
56941
57579
  } finally {
56942
57580
  await browser?.close().catch(() => {
@@ -56946,9 +57584,9 @@ async function cssTraceCommand(opts) {
56946
57584
  }
56947
57585
 
56948
57586
  // src/commands/e2e.ts
56949
- import { writeFileSync as writeFileSync13 } from "node:fs";
57587
+ import { writeFileSync as writeFileSync14 } from "node:fs";
56950
57588
  import { spawn as spawn2 } from "node:child_process";
56951
- import chalk9 from "chalk";
57589
+ import chalk10 from "chalk";
56952
57590
  import ora5 from "ora";
56953
57591
 
56954
57592
  // src/engine/flows/cart-interactions.ts
@@ -57898,8 +58536,8 @@ async function flowLogin(ctx) {
57898
58536
 
57899
58537
  // src/llm/resolve-search-terms.ts
57900
58538
  init_client();
57901
- import { existsSync as existsSync11, mkdirSync as mkdirSync9, readFileSync as readFileSync13, writeFileSync as writeFileSync12 } from "node:fs";
57902
- import { join as join15 } from "node:path";
58539
+ import { existsSync as existsSync14, mkdirSync as mkdirSync10, readFileSync as readFileSync17, writeFileSync as writeFileSync13 } from "node:fs";
58540
+ import { join as join19 } from "node:path";
57903
58541
  var CACHE_DIR2 = ".parity-cache";
57904
58542
  var FALLBACK_TERMS = ["produto", "preto", "promocao"];
57905
58543
  function makeNoResults(runId) {
@@ -57979,10 +58617,10 @@ async function resolveSearchTerms(url, html3, opts = {}) {
57979
58617
  }
57980
58618
  const host = safeHost3(url);
57981
58619
  const cacheDir = opts.cacheDir ?? CACHE_DIR2;
57982
- const cachePath = join15(cacheDir, `search-terms-${host}.json`);
57983
- if (!opts.noCache && existsSync11(cachePath)) {
58620
+ const cachePath = join19(cacheDir, `search-terms-${host}.json`);
58621
+ if (!opts.noCache && existsSync14(cachePath)) {
57984
58622
  try {
57985
- const cached = JSON.parse(readFileSync13(cachePath, "utf8"));
58623
+ const cached = JSON.parse(readFileSync17(cachePath, "utf8"));
57986
58624
  if (cached.withResults?.trim()) {
57987
58625
  return { withResults: cached.withResults.trim(), noResults };
57988
58626
  }
@@ -57990,9 +58628,9 @@ async function resolveSearchTerms(url, html3, opts = {}) {
57990
58628
  }
57991
58629
  const suggested = await suggestTermViaLlm(url, html3);
57992
58630
  if (suggested) {
57993
- if (!existsSync11(cacheDir))
57994
- mkdirSync9(cacheDir, { recursive: true });
57995
- writeFileSync12(cachePath, `${JSON.stringify({ withResults: suggested, source: "llm" }, null, 2)}
58631
+ if (!existsSync14(cacheDir))
58632
+ mkdirSync10(cacheDir, { recursive: true });
58633
+ writeFileSync13(cachePath, `${JSON.stringify({ withResults: suggested, source: "llm" }, null, 2)}
57996
58634
  `, "utf8");
57997
58635
  return { withResults: suggested, noResults };
57998
58636
  }
@@ -58033,8 +58671,8 @@ ${capturedHtml}`;
58033
58671
  }
58034
58672
  return false;
58035
58673
  }
58036
- function searchUrlFor(baseUrl, term, path = "/search") {
58037
- const u = new URL(path, baseUrl);
58674
+ function searchUrlFor(baseUrl2, term, path = "/search") {
58675
+ const u = new URL(path, baseUrl2);
58038
58676
  u.searchParams.set("q", term);
58039
58677
  return u.toString();
58040
58678
  }
@@ -58775,14 +59413,14 @@ async function fetchHomeHtml(url, viewport = "desktop") {
58775
59413
  return null;
58776
59414
  }
58777
59415
  }
58778
- function firstProductHrefFromPlpHtml(html3, baseUrl) {
59416
+ function firstProductHrefFromPlpHtml(html3, baseUrl2) {
58779
59417
  const patterns = [/href="([^"]+\/p(?:\?[^"]*|\/[^"]+|))"/i, /href="([^"]+\/products\/[^"]+)"/i];
58780
59418
  for (const re of patterns) {
58781
59419
  const match = re.exec(html3);
58782
59420
  const href = match?.[1];
58783
59421
  if (href) {
58784
59422
  try {
58785
- return new URL(href, baseUrl).toString();
59423
+ return new URL(href, baseUrl2).toString();
58786
59424
  } catch {}
58787
59425
  }
58788
59426
  }
@@ -59008,19 +59646,19 @@ var DEFAULT_E2E_FLOWS = [
59008
59646
  async function e2eCommand(opts) {
59009
59647
  const viewports = parseViewports(opts.viewports);
59010
59648
  if (viewports.length === 0) {
59011
- console.error(chalk9.red(`--viewports inválido: ${opts.viewports} (use mobile,desktop,tablet)`));
59649
+ console.error(chalk10.red(`--viewports inválido: ${opts.viewports} (use mobile,desktop,tablet)`));
59012
59650
  return 2;
59013
59651
  }
59014
- let baseUrl;
59652
+ let baseUrl2;
59015
59653
  try {
59016
- baseUrl = new URL(opts.url);
59654
+ baseUrl2 = new URL(opts.url);
59017
59655
  } catch {
59018
- console.error(chalk9.red(`--url inválido: ${opts.url}`));
59656
+ console.error(chalk10.red(`--url inválido: ${opts.url}`));
59019
59657
  return 2;
59020
59658
  }
59021
59659
  const flows2 = parseFlows(opts.flows);
59022
59660
  if (flows2.length === 0) {
59023
- console.error(chalk9.red(`--flows inválido: ${opts.flows}`));
59661
+ console.error(chalk10.red(`--flows inválido: ${opts.flows}`));
59024
59662
  return 2;
59025
59663
  }
59026
59664
  const rc = loadParityRc();
@@ -59051,12 +59689,12 @@ async function e2eCommand(opts) {
59051
59689
  const paths = createRunDir(opts.output, runId);
59052
59690
  const startedAt = Date.now();
59053
59691
  if (!opts.json) {
59054
- console.log(chalk9.bold(`
59692
+ console.log(chalk10.bold(`
59055
59693
  parity e2e ${runId}`));
59056
- console.log(chalk9.dim(` url: ${opts.url}`));
59057
- console.log(chalk9.dim(` flows: ${flows2.join(", ")}`));
59058
- console.log(chalk9.dim(` viewports: ${viewports.join(", ")}`));
59059
- console.log(chalk9.dim(` cep: ${rc.cep}
59694
+ console.log(chalk10.dim(` url: ${opts.url}`));
59695
+ console.log(chalk10.dim(` flows: ${flows2.join(", ")}`));
59696
+ console.log(chalk10.dim(` viewports: ${viewports.join(", ")}`));
59697
+ console.log(chalk10.dim(` cep: ${rc.cep}
59060
59698
  `));
59061
59699
  }
59062
59700
  let platform = "custom";
@@ -59064,7 +59702,7 @@ async function e2eCommand(opts) {
59064
59702
  if (homeHtml) {
59065
59703
  platform = detectPlatform({ url: opts.url, html: homeHtml });
59066
59704
  if (platform !== "custom" && !opts.json) {
59067
- console.log(chalk9.dim(` Detected platform: ${platform}`));
59705
+ console.log(chalk10.dim(` Detected platform: ${platform}`));
59068
59706
  }
59069
59707
  }
59070
59708
  const wantsAutoSelectors = opts.autoSelectors !== false && isLlmAvailable();
@@ -59151,7 +59789,7 @@ async function e2eCommand(opts) {
59151
59789
  saveLearned(learned);
59152
59790
  }
59153
59791
  if (allPages.length === 0) {
59154
- console.error(chalk9.red(`
59792
+ console.error(chalk10.red(`
59155
59793
  ✖ nenhuma captura completada`));
59156
59794
  return 2;
59157
59795
  }
@@ -59210,8 +59848,8 @@ async function e2eCommand(opts) {
59210
59848
  generatedAt: new Date().toISOString(),
59211
59849
  durationMs
59212
59850
  });
59213
- writeFileSync13(paths.reportHtml, html3, "utf8");
59214
- writeFileSync13(paths.reportJson, `${JSON.stringify({
59851
+ writeFileSync14(paths.reportHtml, html3, "utf8");
59852
+ writeFileSync14(paths.reportJson, `${JSON.stringify({
59215
59853
  runId,
59216
59854
  mode: "e2e",
59217
59855
  url: opts.url,
@@ -59275,17 +59913,17 @@ function parseFlows(raw) {
59275
59913
  }
59276
59914
  function printSummary4(result, reportPath) {
59277
59915
  const { totals } = result;
59278
- const verdict = totals.critical > 0 ? chalk9.red.bold("✖ FAIL") : totals.high > 0 ? chalk9.red("✖ FAIL") : totals.issues > 0 ? chalk9.yellow("⚠ WARN") : chalk9.green.bold("✓ PASS");
59916
+ const verdict = totals.critical > 0 ? chalk10.red.bold("✖ FAIL") : totals.high > 0 ? chalk10.red("✖ FAIL") : totals.issues > 0 ? chalk10.yellow("⚠ WARN") : chalk10.green.bold("✓ PASS");
59279
59917
  console.log(`
59280
59918
  ${verdict}`);
59281
59919
  console.log(` ${totals.pages} página(s) · ${totals.issues} issue(s)`);
59282
- console.log(` ${chalk9.red(`${totals.critical} critical`)} · ${chalk9.red(`${totals.high} high`)} · ${chalk9.yellow(`${totals.medium} medium`)} · ${chalk9.dim(`${totals.low} low`)}`);
59920
+ console.log(` ${chalk10.red(`${totals.critical} critical`)} · ${chalk10.red(`${totals.high} high`)} · ${chalk10.yellow(`${totals.medium} medium`)} · ${chalk10.dim(`${totals.low} low`)}`);
59283
59921
  const top = result.allIssues.slice(0, 5);
59284
59922
  if (top.length > 0) {
59285
59923
  console.log(`
59286
59924
  Top issues:`);
59287
59925
  for (const issue of top) {
59288
- const sevTag = issue.severity === "critical" ? chalk9.red.bold("[critical]") : issue.severity === "high" ? chalk9.red("[high] ") : issue.severity === "medium" ? chalk9.yellow("[medium] ") : chalk9.dim("[low] ");
59926
+ const sevTag = issue.severity === "critical" ? chalk10.red.bold("[critical]") : issue.severity === "high" ? chalk10.red("[high] ") : issue.severity === "medium" ? chalk10.yellow("[medium] ") : chalk10.dim("[low] ");
59289
59927
  console.log(` ${sevTag} ${issue.summary.slice(0, 200)}`);
59290
59928
  }
59291
59929
  }
@@ -59301,7 +59939,7 @@ async function openReport2(path) {
59301
59939
 
59302
59940
  // src/commands/explain.ts
59303
59941
  init_client();
59304
- import chalk10 from "chalk";
59942
+ import chalk11 from "chalk";
59305
59943
 
59306
59944
  // src/llm/system-prompt.ts
59307
59945
  var ISSUE_AGGREGATOR_SYSTEM_PROMPT = `
@@ -59386,17 +60024,17 @@ Cada issue tem:
59386
60024
  // src/commands/explain.ts
59387
60025
  async function explainCommand(runId, issueId, output) {
59388
60026
  if (!isLlmAvailable()) {
59389
- console.error(chalk10.red("Nenhuma API key de LLM encontrada — set ANTHROPIC_API_KEY ou OPENROUTER_API_KEY."));
60027
+ console.error(chalk11.red("Nenhuma API key de LLM encontrada — set ANTHROPIC_API_KEY ou OPENROUTER_API_KEY."));
59390
60028
  return 1;
59391
60029
  }
59392
60030
  const run = loadRun(output, runId);
59393
60031
  const issue = run.issues.find((i) => i.id === issueId) || run.topIssues.find((i) => i.id === issueId);
59394
60032
  if (!issue) {
59395
- console.error(chalk10.red(`Issue não encontrada: ${issueId}`));
60033
+ console.error(chalk11.red(`Issue não encontrada: ${issueId}`));
59396
60034
  return 1;
59397
60035
  }
59398
60036
  const checks = run.checks.filter((c) => c.issues.some((i) => i.id === issueId || i.check === issue.check));
59399
- console.log(chalk10.dim(`Consultando LLM…
60037
+ console.log(chalk11.dim(`Consultando LLM…
59400
60038
  `));
59401
60039
  const text3 = await callMessage({
59402
60040
  feature: "explain",
@@ -59416,13 +60054,13 @@ ${JSON.stringify(checks.map((c) => ({ name: c.name, status: c.status, summary: c
59416
60054
  }
59417
60055
 
59418
60056
  // src/commands/extract.ts
59419
- import { mkdirSync as mkdirSync13 } from "node:fs";
60057
+ import { mkdirSync as mkdirSync14 } from "node:fs";
59420
60058
  import { resolve as resolve4 } from "node:path";
59421
- import chalk12 from "chalk";
60059
+ import chalk13 from "chalk";
59422
60060
 
59423
60061
  // src/llm/section-understanding.ts
59424
60062
  init_client();
59425
- import { readFileSync as readFileSync14 } from "node:fs";
60063
+ import { readFileSync as readFileSync18 } from "node:fs";
59426
60064
  var SUMMARIZE_TOOL = {
59427
60065
  name: "summarize_understanding",
59428
60066
  description: "Return a single paragraph describing what you understood from the section diff signals. NO code — only diagnosis.",
@@ -59460,7 +60098,7 @@ async function invokeUnderstandingSummary(input) {
59460
60098
  return null;
59461
60099
  let markdown;
59462
60100
  try {
59463
- markdown = readFileSync14(input.markdownPath, "utf8");
60101
+ markdown = readFileSync18(input.markdownPath, "utf8");
59464
60102
  } catch (err) {
59465
60103
  console.error(`[section-understanding] failed to read markdown: ${err.message}`);
59466
60104
  return null;
@@ -59470,7 +60108,7 @@ async function invokeUnderstandingSummary(input) {
59470
60108
  if (!p)
59471
60109
  continue;
59472
60110
  try {
59473
- const buf = readFileSync14(p);
60111
+ const buf = readFileSync18(p);
59474
60112
  images.push({ base64: buf.toString("base64"), mediaType: "image/png" });
59475
60113
  } catch (err) {
59476
60114
  console.error(`[section-understanding] skipping image ${p}: ${err.message}`);
@@ -59747,20 +60385,20 @@ function collectCandidatesInPage() {
59747
60385
  }
59748
60386
 
59749
60387
  // src/extract/exporters/json.ts
59750
- import { writeFileSync as writeFileSync14 } from "node:fs";
59751
- import { join as join16 } from "node:path";
60388
+ import { writeFileSync as writeFileSync15 } from "node:fs";
60389
+ import { join as join20 } from "node:path";
59752
60390
  var jsonExporter = {
59753
60391
  name: "json",
59754
60392
  async export(bundle, outDir) {
59755
- const path = join16(outDir, "manifest.json");
59756
- writeFileSync14(path, `${JSON.stringify(bundle, null, 2)}
60393
+ const path = join20(outDir, "manifest.json");
60394
+ writeFileSync15(path, `${JSON.stringify(bundle, null, 2)}
59757
60395
  `, "utf8");
59758
60396
  }
59759
60397
  };
59760
60398
 
59761
60399
  // src/extract/exporters/markdown.ts
59762
- import { mkdirSync as mkdirSync10, writeFileSync as writeFileSync15 } from "node:fs";
59763
- import { join as join17 } from "node:path";
60400
+ import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync16 } from "node:fs";
60401
+ import { join as join21 } from "node:path";
59764
60402
 
59765
60403
  // src/extract/naming.ts
59766
60404
  function componentDirName(role, index2) {
@@ -59774,13 +60412,13 @@ var markdownExporter = {
59774
60412
  async export(bundle, outDir) {
59775
60413
  const dirNames = bundle.components.map((c, i) => componentDirName(c.role, i + 1));
59776
60414
  const indexMd = renderIndex(bundle, dirNames);
59777
- writeFileSync15(join17(outDir, "index.md"), indexMd, "utf8");
60415
+ writeFileSync16(join21(outDir, "index.md"), indexMd, "utf8");
59778
60416
  bundle.components.forEach((component, i) => {
59779
60417
  const dirName = dirNames[i];
59780
- const componentDir = join17(outDir, "components", dirName);
59781
- mkdirSync10(componentDir, { recursive: true });
60418
+ const componentDir = join21(outDir, "components", dirName);
60419
+ mkdirSync11(componentDir, { recursive: true });
59782
60420
  const readme = renderComponentReadme(bundle, component);
59783
- writeFileSync15(join17(componentDir, "README.md"), readme, "utf8");
60421
+ writeFileSync16(join21(componentDir, "README.md"), readme, "utf8");
59784
60422
  });
59785
60423
  }
59786
60424
  };
@@ -59887,7 +60525,7 @@ function truncateHtml(html3, max) {
59887
60525
  }
59888
60526
 
59889
60527
  // src/extract/extract-component.ts
59890
- import { mkdirSync as mkdirSync11, writeFileSync as writeFileSync16 } from "node:fs";
60528
+ import { mkdirSync as mkdirSync12, writeFileSync as writeFileSync17 } from "node:fs";
59891
60529
 
59892
60530
  // src/engine/section-capture.ts
59893
60531
  init_esm10();
@@ -60129,7 +60767,7 @@ async function captureSectionScreenshot(page, selector, outPath, preCapturedFull
60129
60767
  // src/extract/extract-component.ts
60130
60768
  var LINK_CAP = 30;
60131
60769
  async function extractComponent(page, component, opts) {
60132
- mkdirSync11(opts.outDir, { recursive: true });
60770
+ mkdirSync12(opts.outDir, { recursive: true });
60133
60771
  const artifacts = await captureSectionArtifacts(page, {
60134
60772
  selector: component.selector,
60135
60773
  wantHtml: true,
@@ -60150,8 +60788,8 @@ async function extractComponent(page, component, opts) {
60150
60788
  links: capLinks(links, LINK_CAP),
60151
60789
  textContent: textContent2
60152
60790
  };
60153
- writeFileSync16(`${opts.outDir}/component.html`, extracted.html, "utf8");
60154
- writeFileSync16(`${opts.outDir}/styles.json`, `${JSON.stringify(computedStyles ?? {}, null, 2)}
60791
+ writeFileSync17(`${opts.outDir}/component.html`, extracted.html, "utf8");
60792
+ writeFileSync17(`${opts.outDir}/styles.json`, `${JSON.stringify(computedStyles ?? {}, null, 2)}
60155
60793
  `, "utf8");
60156
60794
  return extracted;
60157
60795
  }
@@ -60239,19 +60877,19 @@ function capLinks(links, max) {
60239
60877
  }
60240
60878
 
60241
60879
  // src/commands/section.ts
60242
- import { mkdirSync as mkdirSync12 } from "node:fs";
60880
+ import { mkdirSync as mkdirSync13 } from "node:fs";
60243
60881
  import { resolve as resolve3 } from "node:path";
60244
- import chalk11 from "chalk";
60882
+ import chalk12 from "chalk";
60245
60883
  import * as diff from "diff";
60246
60884
  import prettier from "prettier";
60247
60885
 
60248
60886
  // src/diff/heatmap-regions.ts
60249
- import { readFileSync as readFileSync15 } from "node:fs";
60887
+ import { readFileSync as readFileSync19 } from "node:fs";
60250
60888
  import { PNG as PNG4 } from "pngjs";
60251
60889
  var DEFAULT_MAX_HOTSPOTS = 5;
60252
60890
  var DEFAULT_MIN_COMPONENT_PIXELS = 50;
60253
60891
  function analyzeHeatmapRegions(pngPath, opts = {}) {
60254
- const png = PNG4.sync.read(readFileSync15(pngPath));
60892
+ const png = PNG4.sync.read(readFileSync19(pngPath));
60255
60893
  return analyzeHeatmapBuffer(png.data, png.width, png.height, opts);
60256
60894
  }
60257
60895
  function analyzeHeatmapBuffer(data2, width, height, opts = {}) {
@@ -60364,8 +61002,8 @@ function analyzeHeatmapBuffer(data2, width, height, opts = {}) {
60364
61002
  }
60365
61003
 
60366
61004
  // src/diff/section-bundle.ts
60367
- import { writeFileSync as writeFileSync17 } from "node:fs";
60368
- import { basename as basename2, dirname as dirname4, join as join18, relative as relative3 } from "node:path";
61005
+ import { writeFileSync as writeFileSync18 } from "node:fs";
61006
+ import { basename as basename2, dirname as dirname5, join as join22, relative as relative3 } from "node:path";
60369
61007
  function buildStyleDeltas(input) {
60370
61008
  const cs = input.computedStyles;
60371
61009
  if (!cs)
@@ -60409,12 +61047,12 @@ function assembleSectionDiffBundle(input) {
60409
61047
  boundingRects: styleResultsToRects(input.computedStyles),
60410
61048
  styleDeltas
60411
61049
  };
60412
- const jsonPath = join18(input.outDir, `${input.filePrefix}-bundle.json`);
60413
- writeFileSync17(jsonPath, `${JSON.stringify(json, mapReplacer, 2)}
61050
+ const jsonPath = join22(input.outDir, `${input.filePrefix}-bundle.json`);
61051
+ writeFileSync18(jsonPath, `${JSON.stringify(json, mapReplacer, 2)}
60414
61052
  `, "utf8");
60415
61053
  const markdown = renderMarkdownBundle(input, styleDeltas);
60416
- const markdownPath = join18(input.outDir, `${input.filePrefix}-prompt.md`);
60417
- writeFileSync17(markdownPath, markdown, "utf8");
61054
+ const markdownPath = join22(input.outDir, `${input.filePrefix}-prompt.md`);
61055
+ writeFileSync18(markdownPath, markdown, "utf8");
60418
61056
  const summary = oneLineSummary(input, styleDeltas);
60419
61057
  return { jsonPath, markdownPath, summary };
60420
61058
  }
@@ -60562,7 +61200,7 @@ function renderMarkdownBundle(input, deltas) {
60562
61200
  }
60563
61201
  function relativeOrAbs(outDir, absPath) {
60564
61202
  try {
60565
- if (dirname4(absPath) === outDir)
61203
+ if (dirname5(absPath) === outDir)
60566
61204
  return basename2(absPath);
60567
61205
  return relative3(outDir, absPath);
60568
61206
  } catch {
@@ -60597,20 +61235,20 @@ function capDiff(diff, maxLines) {
60597
61235
  async function sectionCommand(opts) {
60598
61236
  const viewport = parseViewport3(opts.viewport);
60599
61237
  if (!viewport) {
60600
- console.error(chalk11.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
61238
+ console.error(chalk12.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
60601
61239
  return 2;
60602
61240
  }
60603
61241
  const waitMs = Number.parseInt(opts.wait, 10);
60604
61242
  if (!Number.isFinite(waitMs) || waitMs < 0) {
60605
- console.error(chalk11.red(`--wait inválido: ${opts.wait}`));
61243
+ console.error(chalk12.red(`--wait inválido: ${opts.wait}`));
60606
61244
  return 2;
60607
61245
  }
60608
61246
  if (!opts.selector || opts.selector.trim().length === 0) {
60609
- console.error(chalk11.red("--selector é obrigatório"));
61247
+ console.error(chalk12.red("--selector é obrigatório"));
60610
61248
  return 2;
60611
61249
  }
60612
61250
  if (!isValidUrl(opts.prod) || !isValidUrl(opts.cand)) {
60613
- console.error(chalk11.red("--prod ou --cand inválido"));
61251
+ console.error(chalk12.red("--prod ou --cand inválido"));
60614
61252
  return 2;
60615
61253
  }
60616
61254
  const candSelector = opts.candSelector?.trim() || opts.selector;
@@ -60626,7 +61264,7 @@ async function sectionCommand(opts) {
60626
61264
  };
60627
61265
  if (want.heatmap)
60628
61266
  want.screenshot = true;
60629
- mkdirSync12(opts.outDir, { recursive: true });
61267
+ mkdirSync13(opts.outDir, { recursive: true });
60630
61268
  const hash2 = hashSelector(opts.selector);
60631
61269
  const filePrefix = `section-${hash2}-${viewport}`;
60632
61270
  const screenshotPaths = {
@@ -60826,17 +61464,17 @@ function verdict(prod, cand) {
60826
61464
  async function printResults2(args) {
60827
61465
  const { opts, viewport, candSelector, prodSide, candSide, screenshotPaths, want } = args;
60828
61466
  const crossSelector = candSelector !== opts.selector;
60829
- console.log(chalk11.bold(`
61467
+ console.log(chalk12.bold(`
60830
61468
  parity section`));
60831
61469
  if (crossSelector) {
60832
- console.log(chalk11.dim(` selector: ${opts.selector} (prod)`));
60833
- console.log(chalk11.dim(` ${candSelector} (cand)`));
61470
+ console.log(chalk12.dim(` selector: ${opts.selector} (prod)`));
61471
+ console.log(chalk12.dim(` ${candSelector} (cand)`));
60834
61472
  } else {
60835
- console.log(chalk11.dim(` selector: ${opts.selector}`));
61473
+ console.log(chalk12.dim(` selector: ${opts.selector}`));
60836
61474
  }
60837
- console.log(chalk11.dim(` viewport: ${viewport}`));
60838
- console.log(chalk11.dim(` prod: ${opts.prod}`));
60839
- console.log(chalk11.dim(` cand: ${opts.cand}`));
61475
+ console.log(chalk12.dim(` viewport: ${viewport}`));
61476
+ console.log(chalk12.dim(` prod: ${opts.prod}`));
61477
+ console.log(chalk12.dim(` cand: ${opts.cand}`));
60840
61478
  console.log("");
60841
61479
  if (want.html) {
60842
61480
  await printHtmlDiff(prodSide, candSide, crossSelector ? `${opts.selector} → ${candSelector}` : opts.selector);
@@ -60847,22 +61485,22 @@ async function printResults2(args) {
60847
61485
  printScreenshotPaths(prodSide, candSide, screenshotPaths);
60848
61486
  }
60849
61487
  async function printHtmlDiff(prod, cand, selector) {
60850
- console.log(chalk11.bold(" HTML diff"));
61488
+ console.log(chalk12.bold(" HTML diff"));
60851
61489
  if (prod.htmlError) {
60852
- console.log(chalk11.red(` prod: ${prod.htmlError}`));
61490
+ console.log(chalk12.red(` prod: ${prod.htmlError}`));
60853
61491
  return;
60854
61492
  }
60855
61493
  if (cand.htmlError) {
60856
- console.log(chalk11.red(` cand: ${cand.htmlError}`));
61494
+ console.log(chalk12.red(` cand: ${cand.htmlError}`));
60857
61495
  return;
60858
61496
  }
60859
61497
  if (!prod.html || !cand.html) {
60860
- console.log(chalk11.dim(" (nenhum lado tem HTML disponível)"));
61498
+ console.log(chalk12.dim(" (nenhum lado tem HTML disponível)"));
60861
61499
  return;
60862
61500
  }
60863
61501
  const [prodFmt, candFmt] = await Promise.all([formatHtml(prod.html), formatHtml(cand.html)]);
60864
61502
  if (prodFmt === candFmt) {
60865
- console.log(chalk11.green(" ✓ idêntico após pretty-print"));
61503
+ console.log(chalk12.green(" ✓ idêntico após pretty-print"));
60866
61504
  console.log("");
60867
61505
  return;
60868
61506
  }
@@ -60871,17 +61509,17 @@ async function printHtmlDiff(prod, cand, selector) {
60871
61509
  console.log("");
60872
61510
  }
60873
61511
  function printStylesDiff(prod, cand) {
60874
- console.log(chalk11.bold(" Computed styles diff"));
61512
+ console.log(chalk12.bold(" Computed styles diff"));
60875
61513
  if (!prod.styles || !cand.styles) {
60876
- console.log(chalk11.dim(" (styles não foram coletados)"));
61514
+ console.log(chalk12.dim(" (styles não foram coletados)"));
60877
61515
  return;
60878
61516
  }
60879
61517
  if (!prod.styles.found) {
60880
- console.log(chalk11.red(` prod: ${prod.styles.error}`));
61518
+ console.log(chalk12.red(` prod: ${prod.styles.error}`));
60881
61519
  return;
60882
61520
  }
60883
61521
  if (!cand.styles.found) {
60884
- console.log(chalk11.red(` cand: ${cand.styles.error}`));
61522
+ console.log(chalk12.red(` cand: ${cand.styles.error}`));
60885
61523
  return;
60886
61524
  }
60887
61525
  const rows = [];
@@ -60908,27 +61546,27 @@ function printStylesDiff(prod, cand) {
60908
61546
  });
60909
61547
  }
60910
61548
  if (rows.length === 0) {
60911
- console.log(chalk11.green(" ✓ todos os SECTION_STYLE_KEYS são iguais"));
61549
+ console.log(chalk12.green(" ✓ todos os SECTION_STYLE_KEYS são iguais"));
60912
61550
  console.log("");
60913
61551
  return;
60914
61552
  }
60915
61553
  const keyWidth = Math.max(...rows.map((r) => r.key.length));
60916
61554
  for (const r of rows) {
60917
- console.log(` ${chalk11.cyan(r.key.padEnd(keyWidth))} ${chalk11.red(`prod=${r.prod || "(vazio)"}`)} ${chalk11.green(`cand=${r.cand || "(vazio)"}`)}`);
61555
+ console.log(` ${chalk12.cyan(r.key.padEnd(keyWidth))} ${chalk12.red(`prod=${r.prod || "(vazio)"}`)} ${chalk12.green(`cand=${r.cand || "(vazio)"}`)}`);
60918
61556
  }
60919
61557
  console.log("");
60920
61558
  }
60921
61559
  function printScreenshotPaths(prod, cand, paths) {
60922
- console.log(chalk11.bold(" Screenshots"));
61560
+ console.log(chalk12.bold(" Screenshots"));
60923
61561
  if (prod.screenshotError) {
60924
- console.log(chalk11.red(` prod: ${prod.screenshotError}`));
61562
+ console.log(chalk12.red(` prod: ${prod.screenshotError}`));
60925
61563
  } else if (prod.screenshotTaken) {
60926
- console.log(` prod: ${chalk11.dim(paths.prod)}`);
61564
+ console.log(` prod: ${chalk12.dim(paths.prod)}`);
60927
61565
  }
60928
61566
  if (cand.screenshotError) {
60929
- console.log(chalk11.red(` cand: ${cand.screenshotError}`));
61567
+ console.log(chalk12.red(` cand: ${cand.screenshotError}`));
60930
61568
  } else if (cand.screenshotTaken) {
60931
- console.log(` cand: ${chalk11.dim(paths.cand)}`);
61569
+ console.log(` cand: ${chalk12.dim(paths.cand)}`);
60932
61570
  }
60933
61571
  console.log("");
60934
61572
  }
@@ -60951,13 +61589,13 @@ function colorPatch(patch) {
60951
61589
  if (line.startsWith("Index:") || line.startsWith("==="))
60952
61590
  continue;
60953
61591
  if (line.startsWith("---") || line.startsWith("+++"))
60954
- out.push(chalk11.dim(line));
61592
+ out.push(chalk12.dim(line));
60955
61593
  else if (line.startsWith("@@"))
60956
- out.push(chalk11.cyan(line));
61594
+ out.push(chalk12.cyan(line));
60957
61595
  else if (line.startsWith("+"))
60958
- out.push(chalk11.green(line));
61596
+ out.push(chalk12.green(line));
60959
61597
  else if (line.startsWith("-"))
60960
- out.push(chalk11.red(line));
61598
+ out.push(chalk12.red(line));
60961
61599
  else
60962
61600
  out.push(line);
60963
61601
  }
@@ -61026,7 +61664,7 @@ async function buildPromptBundle(args) {
61026
61664
  }
61027
61665
  async function maybeRunLlmSummary(args) {
61028
61666
  if (!isUnderstandingAvailable()) {
61029
- console.warn(chalk11.yellow(" --llm-summary pulado: nenhum ANTHROPIC_API_KEY ou OPENROUTER_API_KEY configurado."));
61667
+ console.warn(chalk12.yellow(" --llm-summary pulado: nenhum ANTHROPIC_API_KEY ou OPENROUTER_API_KEY configurado."));
61030
61668
  return null;
61031
61669
  }
61032
61670
  const result = await invokeUnderstandingSummary({
@@ -61038,42 +61676,42 @@ async function maybeRunLlmSummary(args) {
61038
61676
  return result?.summary ?? null;
61039
61677
  }
61040
61678
  function printHeatmap(state, heatmapPath) {
61041
- console.log(chalk11.bold(" Heatmap"));
61679
+ console.log(chalk12.bold(" Heatmap"));
61042
61680
  if (state.error) {
61043
- console.log(chalk11.yellow(` ${state.error}`));
61681
+ console.log(chalk12.yellow(` ${state.error}`));
61044
61682
  console.log("");
61045
61683
  return;
61046
61684
  }
61047
61685
  if (!state.analysis) {
61048
- console.log(chalk11.dim(" (sem dados de heatmap)"));
61686
+ console.log(chalk12.dim(" (sem dados de heatmap)"));
61049
61687
  console.log("");
61050
61688
  return;
61051
61689
  }
61052
61690
  const a = state.analysis;
61053
61691
  const pct = (a.pctDiff * 100).toFixed(2);
61054
- console.log(` ${chalk11.cyan("diffPixels")}: ${a.diffPixels} (${pct}%)`);
61692
+ console.log(` ${chalk12.cyan("diffPixels")}: ${a.diffPixels} (${pct}%)`);
61055
61693
  if (a.boundingBox) {
61056
61694
  const bb = a.boundingBox;
61057
- console.log(` ${chalk11.cyan("boundingBox")}: x=${bb.x} y=${bb.y} w=${bb.width} h=${bb.height}`);
61695
+ console.log(` ${chalk12.cyan("boundingBox")}: x=${bb.x} y=${bb.y} w=${bb.width} h=${bb.height}`);
61058
61696
  }
61059
61697
  if (a.hotspots.length > 0) {
61060
- console.log(` ${chalk11.cyan("hotspots")}:`);
61698
+ console.log(` ${chalk12.cyan("hotspots")}:`);
61061
61699
  for (const h of a.hotspots.slice(0, 5)) {
61062
61700
  console.log(` (${h.x}, ${h.y}) ${h.width}×${h.height} — ${h.pixelCount} px`);
61063
61701
  }
61064
61702
  }
61065
- console.log(` ${chalk11.dim(`heatmap: ${heatmapPath}`)}`);
61703
+ console.log(` ${chalk12.dim(`heatmap: ${heatmapPath}`)}`);
61066
61704
  console.log("");
61067
61705
  }
61068
61706
  function printBundlePaths(b) {
61069
- console.log(chalk11.bold(" Bundle"));
61070
- console.log(` ${chalk11.cyan("summary")}: ${b.summary}`);
61071
- console.log(` ${chalk11.cyan("json")}: ${chalk11.dim(b.jsonPath)}`);
61072
- console.log(` ${chalk11.cyan("prompt")}: ${chalk11.dim(b.markdownPath)}`);
61707
+ console.log(chalk12.bold(" Bundle"));
61708
+ console.log(` ${chalk12.cyan("summary")}: ${b.summary}`);
61709
+ console.log(` ${chalk12.cyan("json")}: ${chalk12.dim(b.jsonPath)}`);
61710
+ console.log(` ${chalk12.cyan("prompt")}: ${chalk12.dim(b.markdownPath)}`);
61073
61711
  console.log("");
61074
61712
  }
61075
61713
  function printLlmSummary(summary) {
61076
- console.log(chalk11.bold(" What the LLM understood"));
61714
+ console.log(chalk12.bold(" What the LLM understood"));
61077
61715
  console.log(` ${summary.split(`
61078
61716
  `).join(`
61079
61717
  `)}`);
@@ -61084,16 +61722,16 @@ function printLlmSummary(summary) {
61084
61722
  async function extractCommand(opts) {
61085
61723
  const viewport = parseViewport3(opts.viewport);
61086
61724
  if (!viewport) {
61087
- console.error(chalk12.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
61725
+ console.error(chalk13.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
61088
61726
  return 2;
61089
61727
  }
61090
61728
  if (!isValidUrl2(opts.url)) {
61091
- console.error(chalk12.red(`--url inválido: ${opts.url}`));
61729
+ console.error(chalk13.red(`--url inválido: ${opts.url}`));
61092
61730
  return 2;
61093
61731
  }
61094
61732
  const format = normalizeFormat(opts.format);
61095
61733
  if (!format) {
61096
- console.error(chalk12.red(`--format inválido: ${opts.format} (use md|json|both)`));
61734
+ console.error(chalk13.red(`--format inválido: ${opts.format} (use md|json|both)`));
61097
61735
  return 2;
61098
61736
  }
61099
61737
  const allowlist = parseAllowlist(opts.components);
@@ -61101,12 +61739,12 @@ async function extractCommand(opts) {
61101
61739
  const timestamp = new Date().toISOString();
61102
61740
  const runDirTimestamp = timestamp.replace(/[:.]/g, "-");
61103
61741
  const runDir = resolve4(opts.outDir, host, runDirTimestamp);
61104
- mkdirSync13(runDir, { recursive: true });
61742
+ mkdirSync14(runDir, { recursive: true });
61105
61743
  const browser = await launchBrowser({ headless: true });
61106
61744
  try {
61107
61745
  const resolvedPages = await resolvePages(opts.url, opts.pages);
61108
61746
  if (resolvedPages.length === 0) {
61109
- console.error(chalk12.red("nenhuma página resolvida a partir de --pages"));
61747
+ console.error(chalk13.red("nenhuma página resolvida a partir de --pages"));
61110
61748
  return 1;
61111
61749
  }
61112
61750
  let globalIndex = 0;
@@ -61190,27 +61828,27 @@ async function extractCommand(opts) {
61190
61828
  }
61191
61829
  }
61192
61830
  function printResults3(runDir, bundle) {
61193
- console.log(chalk12.bold(`
61831
+ console.log(chalk13.bold(`
61194
61832
  parity extract`));
61195
- console.log(chalk12.dim(` url: ${bundle.url}`));
61196
- console.log(chalk12.dim(` viewport: ${bundle.viewport}`));
61197
- console.log(chalk12.dim(` pages: ${bundle.pages?.length ?? 0}`));
61198
- console.log(chalk12.dim(` out: ${runDir}`));
61833
+ console.log(chalk13.dim(` url: ${bundle.url}`));
61834
+ console.log(chalk13.dim(` viewport: ${bundle.viewport}`));
61835
+ console.log(chalk13.dim(` pages: ${bundle.pages?.length ?? 0}`));
61836
+ console.log(chalk13.dim(` out: ${runDir}`));
61199
61837
  console.log("");
61200
- console.log(chalk12.bold(` ${bundle.components.length} component(s) detected:`));
61838
+ console.log(chalk13.bold(` ${bundle.components.length} component(s) detected:`));
61201
61839
  for (const c of bundle.components) {
61202
- console.log(` ${chalk12.cyan(c.role.padEnd(24))} ${chalk12.dim(c.selector)}`);
61840
+ console.log(` ${chalk13.cyan(c.role.padEnd(24))} ${chalk13.dim(c.selector)}`);
61203
61841
  }
61204
61842
  console.log("");
61205
61843
  }
61206
- async function resolvePages(baseUrl, pagesSpec) {
61844
+ async function resolvePages(baseUrl2, pagesSpec) {
61207
61845
  const tokens = (pagesSpec ?? "/").split(",").map((s) => s.trim()).filter(Boolean);
61208
61846
  const specs = tokens.length > 0 ? tokens : ["/"];
61209
61847
  const out = [];
61210
61848
  let cachedPlp;
61211
61849
  const resolvePlp = async () => {
61212
61850
  if (cachedPlp === undefined)
61213
- cachedPlp = await discoverPlpFromHome(baseUrl);
61851
+ cachedPlp = await discoverPlpFromHome(baseUrl2);
61214
61852
  return cachedPlp;
61215
61853
  };
61216
61854
  for (const token of specs) {
@@ -61233,7 +61871,7 @@ async function resolvePages(baseUrl, pagesSpec) {
61233
61871
  continue;
61234
61872
  }
61235
61873
  try {
61236
- out.push({ token, url: new URL(token, baseUrl).toString() });
61874
+ out.push({ token, url: new URL(token, baseUrl2).toString() });
61237
61875
  } catch {}
61238
61876
  }
61239
61877
  return out;
@@ -61312,23 +61950,23 @@ async function fixCommand(opts) {
61312
61950
 
61313
61951
  // src/commands/html.ts
61314
61952
  init_esm10();
61315
- import chalk13 from "chalk";
61953
+ import chalk14 from "chalk";
61316
61954
  import * as diff2 from "diff";
61317
61955
  import prettier2 from "prettier";
61318
61956
  async function htmlCommand(opts) {
61319
61957
  const viewport = parseViewport4(opts.viewport);
61320
61958
  if (!viewport) {
61321
- console.error(chalk13.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
61959
+ console.error(chalk14.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
61322
61960
  return 2;
61323
61961
  }
61324
61962
  const waitMs = parseWaitMs(opts.wait);
61325
61963
  if (waitMs === null) {
61326
- console.error(chalk13.red(`--wait inválido: ${opts.wait} (precisa ser inteiro >= 0)`));
61964
+ console.error(chalk14.red(`--wait inválido: ${opts.wait} (precisa ser inteiro >= 0)`));
61327
61965
  return 2;
61328
61966
  }
61329
61967
  const mode = resolveMode(opts);
61330
61968
  if (mode.kind === "error") {
61331
- console.error(chalk13.red(mode.message));
61969
+ console.error(chalk14.red(mode.message));
61332
61970
  return 2;
61333
61971
  }
61334
61972
  const browser = await launchBrowser({ headless: true });
@@ -61337,11 +61975,11 @@ async function htmlCommand(opts) {
61337
61975
  const html3 = await fetchSnapshot(browser, mode.url, viewport, waitMs);
61338
61976
  const piece = extractSelector(html3, opts.selector);
61339
61977
  if (piece.error) {
61340
- console.error(chalk13.red(piece.error));
61978
+ console.error(chalk14.red(piece.error));
61341
61979
  return 2;
61342
61980
  }
61343
61981
  if (piece.warning)
61344
- console.error(chalk13.yellow(` ⚠ ${piece.warning}`));
61982
+ console.error(chalk14.yellow(` ⚠ ${piece.warning}`));
61345
61983
  const finalText = await maybePretty(piece.html, opts.pretty === true);
61346
61984
  if (opts.json) {
61347
61985
  console.log(JSON.stringify({
@@ -61362,17 +62000,17 @@ async function htmlCommand(opts) {
61362
62000
  const prodPiece = extractSelector(prodHtml, opts.selector);
61363
62001
  const candPiece = extractSelector(candHtml, opts.selector);
61364
62002
  if (prodPiece.error) {
61365
- console.error(chalk13.red(`prod: ${prodPiece.error}`));
62003
+ console.error(chalk14.red(`prod: ${prodPiece.error}`));
61366
62004
  return 2;
61367
62005
  }
61368
62006
  if (candPiece.error) {
61369
- console.error(chalk13.red(`cand: ${candPiece.error}`));
62007
+ console.error(chalk14.red(`cand: ${candPiece.error}`));
61370
62008
  return 2;
61371
62009
  }
61372
62010
  if (prodPiece.warning)
61373
- console.error(chalk13.yellow(` ⚠ prod: ${prodPiece.warning}`));
62011
+ console.error(chalk14.yellow(` ⚠ prod: ${prodPiece.warning}`));
61374
62012
  if (candPiece.warning)
61375
- console.error(chalk13.yellow(` ⚠ cand: ${candPiece.warning}`));
62013
+ console.error(chalk14.yellow(` ⚠ cand: ${candPiece.warning}`));
61376
62014
  const [prodFmt, candFmt] = await Promise.all([
61377
62015
  maybePretty(prodPiece.html, opts.pretty !== false),
61378
62016
  maybePretty(candPiece.html, opts.pretty !== false)
@@ -61520,19 +62158,19 @@ function formatPatch(patch) {
61520
62158
  if (line.startsWith("Index:") || line.startsWith("==="))
61521
62159
  continue;
61522
62160
  if (line.startsWith("---") || line.startsWith("+++")) {
61523
- out.push(chalk13.dim(line));
62161
+ out.push(chalk14.dim(line));
61524
62162
  continue;
61525
62163
  }
61526
62164
  if (line.startsWith("@@")) {
61527
- out.push(chalk13.cyan(line));
62165
+ out.push(chalk14.cyan(line));
61528
62166
  continue;
61529
62167
  }
61530
62168
  if (line.startsWith("+")) {
61531
- out.push(chalk13.green(line));
62169
+ out.push(chalk14.green(line));
61532
62170
  continue;
61533
62171
  }
61534
62172
  if (line.startsWith("-")) {
61535
- out.push(chalk13.red(line));
62173
+ out.push(chalk14.red(line));
61536
62174
  continue;
61537
62175
  }
61538
62176
  out.push(line);
@@ -61542,15 +62180,15 @@ function formatPatch(patch) {
61542
62180
  }
61543
62181
 
61544
62182
  // src/commands/journey.ts
61545
- import { writeFileSync as writeFileSync18 } from "node:fs";
61546
- import { join as join19 } from "node:path";
61547
- import chalk14 from "chalk";
62183
+ import { writeFileSync as writeFileSync19 } from "node:fs";
62184
+ import { join as join23 } from "node:path";
62185
+ import chalk15 from "chalk";
61548
62186
  import ora6 from "ora";
61549
62187
  init_client();
61550
62188
  async function journeyCommand(opts) {
61551
62189
  const viewports = opts.viewports.split(",").map((s) => s.trim()).filter((s) => s === "mobile" || s === "desktop");
61552
62190
  if (viewports.length === 0) {
61553
- console.error(chalk14.red("Nenhum viewport válido (use mobile,desktop)"));
62191
+ console.error(chalk15.red("Nenhum viewport válido (use mobile,desktop)"));
61554
62192
  return 2;
61555
62193
  }
61556
62194
  const rc = loadParityRc();
@@ -61560,13 +62198,13 @@ async function journeyCommand(opts) {
61560
62198
  const runId = newRunId();
61561
62199
  const paths = createRunDir(opts.output, runId);
61562
62200
  if (!opts.json) {
61563
- console.log(chalk14.bold(`
62201
+ console.log(chalk15.bold(`
61564
62202
  parity journey ${runId}`));
61565
- console.log(chalk14.dim(` prod: ${opts.prod}`));
61566
- console.log(chalk14.dim(` cand: ${opts.cand}`));
61567
- console.log(chalk14.dim(` viewports: ${viewports.join(", ")} · CEP: ${rc.cep}`));
62203
+ console.log(chalk15.dim(` prod: ${opts.prod}`));
62204
+ console.log(chalk15.dim(` cand: ${opts.cand}`));
62205
+ console.log(chalk15.dim(` viewports: ${viewports.join(", ")} · CEP: ${rc.cep}`));
61568
62206
  if (isLlmAvailable())
61569
- console.log(chalk14.dim(` llm: ${providerLabel()}`));
62207
+ console.log(chalk15.dim(` llm: ${providerLabel()}`));
61570
62208
  console.log("");
61571
62209
  }
61572
62210
  let platform = "custom";
@@ -61600,20 +62238,20 @@ async function journeyCommand(opts) {
61600
62238
  const onStepFor = (viewport, side) => (event) => {
61601
62239
  if (opts.json)
61602
62240
  return;
61603
- const sideTag = side === "prod" ? chalk14.cyan("prod") : chalk14.magenta("cand");
61604
- const prefix = ` ${chalk14.dim(`[${viewport}/`)}${sideTag}${chalk14.dim("]")}`;
62241
+ const sideTag = side === "prod" ? chalk15.cyan("prod") : chalk15.magenta("cand");
62242
+ const prefix = ` ${chalk15.dim(`[${viewport}/`)}${sideTag}${chalk15.dim("]")}`;
61605
62243
  if (event.phase === "start") {
61606
- console.log(`${prefix} ${chalk14.dim(`${event.index}/${event.total}`)} ▶ ${chalk14.bold(stepLabel(event.name))}`);
62244
+ console.log(`${prefix} ${chalk15.dim(`${event.index}/${event.total}`)} ▶ ${chalk15.bold(stepLabel(event.name))}`);
61607
62245
  } else {
61608
- const glyph = event.status === "ok" ? chalk14.green("✓") : event.status === "skipped" ? chalk14.yellow("○") : chalk14.red("✗");
61609
- const noteText = event.note ? chalk14.dim(` (${event.note})`) : "";
61610
- const time = chalk14.dim(`${(event.durationMs / 1000).toFixed(1)}s`);
61611
- console.log(`${prefix} ${chalk14.dim(`${event.index}/${event.total}`)} ${glyph} ${stepLabel(event.name)} ${time}${noteText}`);
62246
+ const glyph = event.status === "ok" ? chalk15.green("✓") : event.status === "skipped" ? chalk15.yellow("○") : chalk15.red("✗");
62247
+ const noteText = event.note ? chalk15.dim(` (${event.note})`) : "";
62248
+ const time = chalk15.dim(`${(event.durationMs / 1000).toFixed(1)}s`);
62249
+ console.log(`${prefix} ${chalk15.dim(`${event.index}/${event.total}`)} ${glyph} ${stepLabel(event.name)} ${time}${noteText}`);
61612
62250
  }
61613
62251
  };
61614
62252
  async function runOneSide(browserInstance, viewport, side) {
61615
- const baseUrl = side === "prod" ? opts.prod : opts.cand;
61616
- const tracePath = join19(paths.tracesDir, `${viewport}-${side}.zip`);
62253
+ const baseUrl2 = side === "prod" ? opts.prod : opts.cand;
62254
+ const tracePath = join23(paths.tracesDir, `${viewport}-${side}.zip`);
61617
62255
  const ctx = await newContext(browserInstance, {
61618
62256
  viewport,
61619
62257
  tracesDir: paths.tracesDir,
@@ -61622,7 +62260,7 @@ async function journeyCommand(opts) {
61622
62260
  await installVitalsCollector(ctx);
61623
62261
  try {
61624
62262
  const cap = await runFlow("purchase-journey", {
61625
- baseUrl,
62263
+ baseUrl: baseUrl2,
61626
62264
  side,
61627
62265
  viewport,
61628
62266
  rc,
@@ -61647,7 +62285,7 @@ async function journeyCommand(opts) {
61647
62285
  spinner?.succeed("Browser pronto");
61648
62286
  for (const viewport of viewports) {
61649
62287
  if (!opts.json)
61650
- console.log(chalk14.bold(`
62288
+ console.log(chalk15.bold(`
61651
62289
  ── ${viewport} ─────────────────────────────────────────────`));
61652
62290
  const [prodCap, candCap] = await Promise.all([
61653
62291
  runOneSide(browser, viewport, "prod"),
@@ -61682,11 +62320,11 @@ async function journeyCommand(opts) {
61682
62320
  if (totalDeprecated > 0)
61683
62321
  bits.push(`${totalDeprecated} depreciado(s)`);
61684
62322
  if (bits.length > 0)
61685
- console.log(chalk14.dim(` learned-selectors atualizado: ${bits.join(", ")}`));
62323
+ console.log(chalk15.dim(` learned-selectors atualizado: ${bits.join(", ")}`));
61686
62324
  }
61687
62325
  } catch (err) {
61688
62326
  if (!opts.json) {
61689
- console.warn(chalk14.yellow(` warn: failed to persist learned-selectors: ${err.message}`));
62327
+ console.warn(chalk15.yellow(` warn: failed to persist learned-selectors: ${err.message}`));
61690
62328
  }
61691
62329
  }
61692
62330
  }
@@ -61705,9 +62343,9 @@ async function journeyCommand(opts) {
61705
62343
  if (opts.github)
61706
62344
  emitGithubAnnotations(failures);
61707
62345
  if (opts.junit) {
61708
- writeFileSync18(opts.junit, buildJUnit(rows, failures), "utf8");
62346
+ writeFileSync19(opts.junit, buildJUnit(rows, failures), "utf8");
61709
62347
  if (!opts.json)
61710
- console.log(chalk14.dim(` → JUnit XML: ${opts.junit}`));
62348
+ console.log(chalk15.dim(` → JUnit XML: ${opts.junit}`));
61711
62349
  }
61712
62350
  return failures.some((f) => f.critical) ? 1 : 0;
61713
62351
  } catch (err) {
@@ -61772,14 +62410,14 @@ function collectFailures(rows) {
61772
62410
  function printTable(viewports, rows) {
61773
62411
  console.log("");
61774
62412
  for (const viewport of viewports) {
61775
- console.log(chalk14.bold(` [${viewport}]`));
62413
+ console.log(chalk15.bold(` [${viewport}]`));
61776
62414
  const vrows = rows.filter((r) => r.viewport === viewport);
61777
62415
  for (const r of vrows) {
61778
62416
  const label = PJ_STEP_LABELS_NUMBERED[r.name] ?? r.name;
61779
62417
  const p = statusGlyph(r.prod?.status);
61780
62418
  const c = statusGlyph(r.cand?.status);
61781
- const status = r.prod?.status === "ok" && r.cand?.status !== "ok" ? chalk14.red("FAILED") : "";
61782
- const note = r.cand?.status === "failed" || r.cand?.status === "skipped" ? chalk14.dim(`(${r.cand?.note ?? r.cand?.status})`) : "";
62419
+ const status = r.prod?.status === "ok" && r.cand?.status !== "ok" ? chalk15.red("FAILED") : "";
62420
+ const note = r.cand?.status === "failed" || r.cand?.status === "skipped" ? chalk15.dim(`(${r.cand?.note ?? r.cand?.status})`) : "";
61783
62421
  console.log(` ${label.padEnd(24)} prod ${p} cand ${c} ${status} ${note}`);
61784
62422
  }
61785
62423
  console.log("");
@@ -61787,12 +62425,12 @@ function printTable(viewports, rows) {
61787
62425
  }
61788
62426
  function statusGlyph(status) {
61789
62427
  if (!status)
61790
- return chalk14.dim("—");
62428
+ return chalk15.dim("—");
61791
62429
  if (status === "ok")
61792
- return chalk14.green("✓");
62430
+ return chalk15.green("✓");
61793
62431
  if (status === "skipped")
61794
- return chalk14.yellow("○");
61795
- return chalk14.red("✗");
62432
+ return chalk15.yellow("○");
62433
+ return chalk15.red("✗");
61796
62434
  }
61797
62435
  function printSummary5(rows, failures, htmlPath) {
61798
62436
  const byViewport = new Map;
@@ -61803,25 +62441,25 @@ function printSummary5(rows, failures, htmlPath) {
61803
62441
  v.passed++;
61804
62442
  byViewport.set(r.viewport, v);
61805
62443
  }
61806
- console.log(chalk14.bold(" Summary:"));
62444
+ console.log(chalk15.bold(" Summary:"));
61807
62445
  for (const [vp, { passed, total }] of byViewport) {
61808
- const stat = passed === total ? chalk14.green("✓") : chalk14.yellow(`${passed}/${total}`);
62446
+ const stat = passed === total ? chalk15.green("✓") : chalk15.yellow(`${passed}/${total}`);
61809
62447
  console.log(` ${vp.padEnd(8)} ${stat} steps em cand`);
61810
62448
  }
61811
62449
  if (failures.length > 0) {
61812
62450
  const crit = failures.filter((f) => f.critical).length;
61813
62451
  console.log("");
61814
- console.log(chalk14.red(` ✗ ${failures.length} step(s) divergent(es) (${crit} crítico)`));
62452
+ console.log(chalk15.red(` ✗ ${failures.length} step(s) divergent(es) (${crit} crítico)`));
61815
62453
  for (const f of failures) {
61816
- const tag = f.critical ? chalk14.red("[critical]") : chalk14.yellow("[warn]");
62454
+ const tag = f.critical ? chalk15.red("[critical]") : chalk15.yellow("[warn]");
61817
62455
  console.log(` ${tag} [${f.viewport}] ${f.step}: ${f.reason}`);
61818
62456
  }
61819
62457
  } else {
61820
62458
  console.log("");
61821
- console.log(chalk14.green(" ✓ jornada completa em cand"));
62459
+ console.log(chalk15.green(" ✓ jornada completa em cand"));
61822
62460
  }
61823
62461
  console.log("");
61824
- console.log(chalk14.dim(` → ${htmlPath}`));
62462
+ console.log(chalk15.dim(` → ${htmlPath}`));
61825
62463
  console.log("");
61826
62464
  }
61827
62465
  function emitGithubAnnotations(failures) {
@@ -62056,26 +62694,26 @@ function safeHost5(url) {
62056
62694
  }
62057
62695
 
62058
62696
  // src/commands/learned.ts
62059
- import chalk15 from "chalk";
62697
+ import chalk16 from "chalk";
62060
62698
  init_client();
62061
62699
  function learnedStats() {
62062
62700
  const lib = loadLearned();
62063
62701
  const stats = statsFromLib(lib);
62064
62702
  if (stats.platforms.length === 0) {
62065
- console.log(chalk15.dim(`Biblioteca vazia: ${LEARNED_PATH}`));
62066
- console.log(chalk15.dim("Rode `parity run ...` em algum site para começar a popular."));
62703
+ console.log(chalk16.dim(`Biblioteca vazia: ${LEARNED_PATH}`));
62704
+ console.log(chalk16.dim("Rode `parity run ...` em algum site para começar a popular."));
62067
62705
  return 0;
62068
62706
  }
62069
- console.log(chalk15.bold(`
62707
+ console.log(chalk16.bold(`
62070
62708
  learned-selectors stats (${LEARNED_PATH})
62071
62709
  `));
62072
62710
  for (const p of stats.platforms) {
62073
- const staleNote = p.staleSelectors > 0 ? ` · ${chalk15.yellow(`${p.staleSelectors} stale`)}` : "";
62074
- console.log(`${chalk15.cyan(p.platform)}: ${p.activeSelectors} active (${p.verifiedSelectors} verified, ${p.llmGuessSelectors} llm-guess) · ${chalk15.dim(`${p.deprecatedSelectors} deprecated`)}${staleNote}`);
62711
+ const staleNote = p.staleSelectors > 0 ? ` · ${chalk16.yellow(`${p.staleSelectors} stale`)}` : "";
62712
+ console.log(`${chalk16.cyan(p.platform)}: ${p.activeSelectors} active (${p.verifiedSelectors} verified, ${p.llmGuessSelectors} llm-guess) · ${chalk16.dim(`${p.deprecatedSelectors} deprecated`)}${staleNote}`);
62075
62713
  for (const top of p.topByKey) {
62076
62714
  const sr = `${(top.successRate * 100).toFixed(0)}%`;
62077
- const originTag = top.origin === "llm-guess" ? chalk15.yellow(" [guess]") : "";
62078
- console.log(` ${chalk15.dim(top.key.padEnd(18))} ${chalk15.green(sr.padStart(4))} ${chalk15.dim(`(${top.hosts} hosts)`)} ${top.selector}${originTag}`);
62715
+ const originTag = top.origin === "llm-guess" ? chalk16.yellow(" [guess]") : "";
62716
+ console.log(` ${chalk16.dim(top.key.padEnd(18))} ${chalk16.green(sr.padStart(4))} ${chalk16.dim(`(${top.hosts} hosts)`)} ${top.selector}${originTag}`);
62079
62717
  }
62080
62718
  console.log("");
62081
62719
  }
@@ -62083,10 +62721,10 @@ learned-selectors stats (${LEARNED_PATH})
62083
62721
  }
62084
62722
  async function learnedValidate(url) {
62085
62723
  if (!isLlmAvailable()) {
62086
- console.error(chalk15.red(" ✖ nenhuma chave de LLM configurada (ANTHROPIC_API_KEY / OPENROUTER_API_KEY) — discovery precisa do LLM"));
62724
+ console.error(chalk16.red(" ✖ nenhuma chave de LLM configurada (ANTHROPIC_API_KEY / OPENROUTER_API_KEY) — discovery precisa do LLM"));
62087
62725
  return 2;
62088
62726
  }
62089
- console.log(chalk15.dim(` Baixando home de ${url}…`));
62727
+ console.log(chalk16.dim(` Baixando home de ${url}…`));
62090
62728
  let html3;
62091
62729
  try {
62092
62730
  const res = await fetch(url, {
@@ -62095,20 +62733,20 @@ async function learnedValidate(url) {
62095
62733
  });
62096
62734
  html3 = res.ok ? await res.text() : null;
62097
62735
  } catch (err) {
62098
- console.error(chalk15.red(` ✖ falha ao baixar ${url}: ${err.message}`));
62736
+ console.error(chalk16.red(` ✖ falha ao baixar ${url}: ${err.message}`));
62099
62737
  return 2;
62100
62738
  }
62101
62739
  if (!html3) {
62102
- console.error(chalk15.red(` ✖ falha ao baixar ${url} (HTTP não-2xx ou erro de rede)`));
62740
+ console.error(chalk16.red(` ✖ falha ao baixar ${url} (HTTP não-2xx ou erro de rede)`));
62103
62741
  return 2;
62104
62742
  }
62105
- console.log(chalk15.dim(" Descobrindo seletores via LLM…"));
62743
+ console.log(chalk16.dim(" Descobrindo seletores via LLM…"));
62106
62744
  const discovered = await discoverSelectorsFromUrl(url, html3, { noCache: true });
62107
62745
  if (!discovered) {
62108
- console.error(chalk15.red(" ✖ LLM não retornou seletores"));
62746
+ console.error(chalk16.red(" ✖ LLM não retornou seletores"));
62109
62747
  return 2;
62110
62748
  }
62111
- console.log(chalk15.dim(" Validando ao vivo (browser headless)…"));
62749
+ console.log(chalk16.dim(" Validando ao vivo (browser headless)…"));
62112
62750
  let browser = null;
62113
62751
  try {
62114
62752
  browser = await launchBrowser({ headless: true });
@@ -62118,7 +62756,7 @@ async function learnedValidate(url) {
62118
62756
  const { validated } = await validateSelectors(page, discovered);
62119
62757
  await ctx.close();
62120
62758
  const lowConfidence = new Set(discovered.lowConfidenceKeys ?? []);
62121
- console.log(chalk15.bold(`
62759
+ console.log(chalk16.bold(`
62122
62760
  learned validate — ${url}
62123
62761
  `));
62124
62762
  for (const key of Object.keys(discovered)) {
@@ -62126,17 +62764,17 @@ learned validate — ${url}
62126
62764
  continue;
62127
62765
  const selector = discovered[key];
62128
62766
  if (!selector) {
62129
- console.log(` ${chalk15.dim(key.padEnd(20))} ${chalk15.dim("(vazio — LLM não detectou)")}`);
62767
+ console.log(` ${chalk16.dim(key.padEnd(20))} ${chalk16.dim("(vazio — LLM não detectou)")}`);
62130
62768
  continue;
62131
62769
  }
62132
- const state = validated[key] === true ? chalk15.green("validated") : validated[key] === false ? chalk15.red("not-validated") : chalk15.yellow("not-checked");
62133
- const guessTag = lowConfidence.has(key) ? chalk15.yellow(" [low-confidence]") : "";
62770
+ const state = validated[key] === true ? chalk16.green("validated") : validated[key] === false ? chalk16.red("not-validated") : chalk16.yellow("not-checked");
62771
+ const guessTag = lowConfidence.has(key) ? chalk16.yellow(" [low-confidence]") : "";
62134
62772
  console.log(` ${key.padEnd(20)} ${state.padEnd(22)} ${selector}${guessTag}`);
62135
62773
  }
62136
62774
  console.log("");
62137
62775
  return 0;
62138
62776
  } catch (err) {
62139
- console.error(chalk15.red(` ✖ validação ao vivo falhou: ${err.message}`));
62777
+ console.error(chalk16.red(` ✖ validação ao vivo falhou: ${err.message}`));
62140
62778
  return 2;
62141
62779
  } finally {
62142
62780
  if (browser)
@@ -62145,20 +62783,20 @@ learned validate — ${url}
62145
62783
  }
62146
62784
 
62147
62785
  // src/commands/list.ts
62148
- import chalk16 from "chalk";
62786
+ import chalk17 from "chalk";
62149
62787
  function listModulesCommand(json) {
62150
62788
  if (json) {
62151
62789
  console.log(JSON.stringify(MODULES, null, 2));
62152
62790
  return 0;
62153
62791
  }
62154
62792
  for (const mod of Object.values(MODULES)) {
62155
- console.log(` ${chalk16.bold(mod.name)} ${chalk16.dim(mod.description)}`);
62793
+ console.log(` ${chalk17.bold(mod.name)} ${chalk17.dim(mod.description)}`);
62156
62794
  console.log(` checks: ${mod.checks.join(", ")}`);
62157
62795
  console.log(` flows: ${mod.flows.join(", ")}`);
62158
62796
  if (mod.needsSitemapPages)
62159
- console.log(chalk16.dim(" needs sitemap-page crawling"));
62797
+ console.log(chalk17.dim(" needs sitemap-page crawling"));
62160
62798
  if (mod.needsLlm)
62161
- console.log(chalk16.dim(" needs an LLM pass for full value"));
62799
+ console.log(chalk17.dim(" needs an LLM pass for full value"));
62162
62800
  console.log("");
62163
62801
  }
62164
62802
  return 0;
@@ -62166,26 +62804,26 @@ function listModulesCommand(json) {
62166
62804
  function listCommand(output) {
62167
62805
  const runs = listRuns(output);
62168
62806
  if (runs.length === 0) {
62169
- console.log(chalk16.dim(`Nenhum run salvo em ${output}`));
62807
+ console.log(chalk17.dim(`Nenhum run salvo em ${output}`));
62170
62808
  return 0;
62171
62809
  }
62172
62810
  for (const r of runs) {
62173
62811
  try {
62174
62812
  const run = loadRun(output, r.id);
62175
62813
  const v = run.verdict;
62176
- const status = v.status === "pass" ? chalk16.green(v.status) : v.status === "warn" ? chalk16.yellow(v.status) : chalk16.red(v.status);
62177
- console.log(` ${chalk16.bold(r.id)} ${status} score=${v.score} critical=${v.critical} high=${v.high} ${chalk16.dim(r.timestamp)}`);
62814
+ const status = v.status === "pass" ? chalk17.green(v.status) : v.status === "warn" ? chalk17.yellow(v.status) : chalk17.red(v.status);
62815
+ console.log(` ${chalk17.bold(r.id)} ${status} score=${v.score} critical=${v.critical} high=${v.high} ${chalk17.dim(r.timestamp)}`);
62178
62816
  } catch {
62179
- console.log(` ${chalk16.bold(r.id)} ${chalk16.dim("(report.json ausente)")}`);
62817
+ console.log(` ${chalk17.bold(r.id)} ${chalk17.dim("(report.json ausente)")}`);
62180
62818
  }
62181
62819
  }
62182
62820
  return 0;
62183
62821
  }
62184
62822
 
62185
62823
  // src/commands/migrate.ts
62186
- import { existsSync as existsSync15, mkdirSync as mkdirSync16, readFileSync as readFileSync20, writeFileSync as writeFileSync24 } from "node:fs";
62824
+ import { existsSync as existsSync18, mkdirSync as mkdirSync17, readFileSync as readFileSync24, writeFileSync as writeFileSync25 } from "node:fs";
62187
62825
  import { resolve as resolve5 } from "node:path";
62188
- import chalk17 from "chalk";
62826
+ import chalk18 from "chalk";
62189
62827
  import open from "open";
62190
62828
 
62191
62829
  // src/migrate/pdp-discovery.ts
@@ -62199,26 +62837,26 @@ var PLATFORM_PATTERNS = {
62199
62837
  "vtex-fs": [/href="([^"]*\/p(?:\?[^"]*|\/[^"]+|))"/gi]
62200
62838
  };
62201
62839
  var ACTION_URL = /(Wishlist|Cart|MiniCart|Login|Account|Address|Order|Compare)-|add-?to-?/i;
62202
- function acceptProductUrl(href, baseUrl) {
62840
+ function acceptProductUrl(href, baseUrl2) {
62203
62841
  if (ACTION_URL.test(href))
62204
62842
  return null;
62205
62843
  try {
62206
- return new URL(href, baseUrl).toString();
62844
+ return new URL(href, baseUrl2).toString();
62207
62845
  } catch {
62208
62846
  return null;
62209
62847
  }
62210
62848
  }
62211
- function firstProductHref(html3, baseUrl, platform) {
62849
+ function firstProductHref(html3, baseUrl2, platform) {
62212
62850
  const patterns = platform ? PLATFORM_PATTERNS[platform] ?? [] : [];
62213
62851
  for (const re of patterns) {
62214
62852
  re.lastIndex = 0;
62215
62853
  for (let m = re.exec(html3);m; m = re.exec(html3)) {
62216
- const url = m[1] ? acceptProductUrl(m[1], baseUrl) : null;
62854
+ const url = m[1] ? acceptProductUrl(m[1], baseUrl2) : null;
62217
62855
  if (url)
62218
62856
  return url;
62219
62857
  }
62220
62858
  }
62221
- return firstProductHrefFromPlpHtml(html3, baseUrl);
62859
+ return firstProductHrefFromPlpHtml(html3, baseUrl2);
62222
62860
  }
62223
62861
 
62224
62862
  // src/engine/sitemap-discover.ts
@@ -62629,23 +63267,23 @@ function compactComponentHtml(html3, maxChars = COMPONENT_HTML_MAX_CHARS) {
62629
63267
  }
62630
63268
 
62631
63269
  // src/migrate/exporters/json.ts
62632
- import { writeFileSync as writeFileSync19 } from "node:fs";
62633
- import { join as join20 } from "node:path";
63270
+ import { writeFileSync as writeFileSync20 } from "node:fs";
63271
+ import { join as join24 } from "node:path";
62634
63272
  var jsonExporter2 = {
62635
63273
  name: "json",
62636
63274
  async export(bundle, outDir) {
62637
- writeFileSync19(join20(outDir, "manifest.json"), `${JSON.stringify(bundle, null, 2)}
63275
+ writeFileSync20(join24(outDir, "manifest.json"), `${JSON.stringify(bundle, null, 2)}
62638
63276
  `, "utf8");
62639
63277
  }
62640
63278
  };
62641
63279
 
62642
63280
  // src/migrate/exporters/markdown.ts
62643
- import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync21 } from "node:fs";
62644
- import { join as join22 } from "node:path";
63281
+ import { mkdirSync as mkdirSync16, writeFileSync as writeFileSync22 } from "node:fs";
63282
+ import { join as join26 } from "node:path";
62645
63283
 
62646
63284
  // src/migrate/vtex/content-assets.ts
62647
- import { mkdirSync as mkdirSync14, writeFileSync as writeFileSync20 } from "node:fs";
62648
- import { join as join21 } from "node:path";
63285
+ import { mkdirSync as mkdirSync15, writeFileSync as writeFileSync21 } from "node:fs";
63286
+ import { join as join25 } from "node:path";
62649
63287
  var MAX_IMAGES = 150;
62650
63288
  var IMG_EXT = /\.(jpe?g|png|webp|gif|svg|avif)(\?|#|$)/i;
62651
63289
  var VTEX_ASSET = /vtexassets\.com|vteximg\.com\.br|\/arquivos\/(ids|assets)\//i;
@@ -62665,23 +63303,23 @@ function isImageRef(s) {
62665
63303
  return true;
62666
63304
  return v.startsWith("/") && !v.startsWith("//") && (IMG_EXT.test(v) || VTEX_ASSET.test(v) || v.startsWith("/img/"));
62667
63305
  }
62668
- function resolveRef(ref, baseUrl) {
63306
+ function resolveRef(ref, baseUrl2) {
62669
63307
  const v = ref.trim();
62670
63308
  try {
62671
63309
  if (v.startsWith("//"))
62672
63310
  return `https:${v}`;
62673
- return new URL(v, baseUrl).toString();
63311
+ return new URL(v, baseUrl2).toString();
62674
63312
  } catch {
62675
63313
  return null;
62676
63314
  }
62677
63315
  }
62678
- function collectImageRefs(blocks, baseUrl) {
63316
+ function collectImageRefs(blocks, baseUrl2) {
62679
63317
  const out = {};
62680
63318
  const walk = (v) => {
62681
63319
  if (typeof v === "string") {
62682
63320
  const s = v.trim();
62683
63321
  if (isImageRef(s) && !(s in out)) {
62684
- const abs = resolveRef(s, baseUrl);
63322
+ const abs = resolveRef(s, baseUrl2);
62685
63323
  if (abs)
62686
63324
  out[s] = abs;
62687
63325
  }
@@ -62754,8 +63392,8 @@ async function downloadContentImages(urls, runDir, fetchBytes) {
62754
63392
  const map2 = {};
62755
63393
  if (urls.length === 0)
62756
63394
  return { map: map2, downloaded: 0, skipped: 0 };
62757
- const dir = join21(runDir, "assets", "content");
62758
- mkdirSync14(dir, { recursive: true });
63395
+ const dir = join25(runDir, "assets", "content");
63396
+ mkdirSync15(dir, { recursive: true });
62759
63397
  const used = new Set;
62760
63398
  const take = urls.slice(0, MAX_IMAGES);
62761
63399
  let downloaded = 0;
@@ -62764,7 +63402,7 @@ async function downloadContentImages(urls, runDir, fetchBytes) {
62764
63402
  if (!got)
62765
63403
  continue;
62766
63404
  const name = contentImageName(url, i, used);
62767
- writeFileSync20(join21(dir, name), got.buf);
63405
+ writeFileSync21(join25(dir, name), got.buf);
62768
63406
  map2[url] = `assets/content/${name}`;
62769
63407
  downloaded++;
62770
63408
  }
@@ -62779,16 +63417,16 @@ var markdownExporter2 = {
62779
63417
  const notes = [];
62780
63418
  bundle.components.forEach((component, i) => {
62781
63419
  const dirName = dirNames[i];
62782
- const componentDir = join22(outDir, "components", dirName);
62783
- mkdirSync15(componentDir, { recursive: true });
63420
+ const componentDir = join26(outDir, "components", dirName);
63421
+ mkdirSync16(componentDir, { recursive: true });
62784
63422
  const compact = compactComponentHtml(component.html);
62785
63423
  if (compact.collapsed > 0)
62786
63424
  notes.push(`\`${dirName}\`: collapsed ${compact.collapsed} repeated child element(s)`);
62787
63425
  if (compact.truncated)
62788
63426
  notes.push(`\`${dirName}\`: HTML truncated to fit the per-component token ceiling`);
62789
- writeFileSync21(join22(componentDir, "README.md"), renderComponentReadme2(bundle.url, component, compact.html), "utf8");
63427
+ writeFileSync22(join26(componentDir, "README.md"), renderComponentReadme2(bundle.url, component, compact.html), "utf8");
62790
63428
  });
62791
- writeFileSync21(join22(outDir, "index.md"), renderIndex2(bundle, notes), "utf8");
63429
+ writeFileSync22(join26(outDir, "index.md"), renderIndex2(bundle, notes), "utf8");
62792
63430
  }
62793
63431
  };
62794
63432
  function renderIndex2(bundle, notes) {
@@ -62990,8 +63628,8 @@ function escapePipes2(s) {
62990
63628
  }
62991
63629
 
62992
63630
  // src/migrate/exporters/html.ts
62993
- import { readFileSync as readFileSync16, writeFileSync as writeFileSync22 } from "node:fs";
62994
- import { join as join23 } from "node:path";
63631
+ import { readFileSync as readFileSync20, writeFileSync as writeFileSync23 } from "node:fs";
63632
+ import { join as join27 } from "node:path";
62995
63633
 
62996
63634
  // src/migrate/targets/faststore-v4.ts
62997
63635
  function pickBreakpointTiers(breakpoints) {
@@ -63311,9 +63949,9 @@ var TARGET_NAMES = Object.keys(TARGETS);
63311
63949
  var htmlExporter = {
63312
63950
  name: "html",
63313
63951
  async export(bundle, outDir) {
63314
- writeFileSync22(join23(outDir, "index.html"), renderHtml(bundle, (p) => p ?? null), "utf8");
63315
- const inline = (p) => p ? dataUri2(join23(outDir, p)) ?? p : null;
63316
- writeFileSync22(join23(outDir, "report.html"), renderHtml(bundle, inline), "utf8");
63952
+ writeFileSync23(join27(outDir, "index.html"), renderHtml(bundle, (p) => p ?? null), "utf8");
63953
+ const inline = (p) => p ? dataUri2(join27(outDir, p)) ?? p : null;
63954
+ writeFileSync23(join27(outDir, "report.html"), renderHtml(bundle, inline), "utf8");
63317
63955
  }
63318
63956
  };
63319
63957
  var MIME2 = {
@@ -63331,7 +63969,7 @@ function dataUri2(absPath) {
63331
63969
  const mime = MIME2[ext];
63332
63970
  if (!mime)
63333
63971
  return null;
63334
- return `data:${mime};base64,${readFileSync16(absPath).toString("base64")}`;
63972
+ return `data:${mime};base64,${readFileSync20(absPath).toString("base64")}`;
63335
63973
  } catch {
63336
63974
  return null;
63337
63975
  }
@@ -63635,8 +64273,8 @@ function buildMigrationPrompt(bundle, playbook, source) {
63635
64273
  }
63636
64274
 
63637
64275
  // src/migrate/plan.ts
63638
- import { existsSync as existsSync12, readFileSync as readFileSync17, writeFileSync as writeFileSync23 } from "node:fs";
63639
- import { join as join24 } from "node:path";
64276
+ import { existsSync as existsSync15, readFileSync as readFileSync21, writeFileSync as writeFileSync24 } from "node:fs";
64277
+ import { join as join28 } from "node:path";
63640
64278
  function dedupe(names) {
63641
64279
  return [...new Set(names)];
63642
64280
  }
@@ -63728,13 +64366,13 @@ function mergePlanDecisions(fresh, previous) {
63728
64366
  var PLAN_FILE = "migration-plan.json";
63729
64367
  var SETTLED = new Set(["done", "as-is", "upgrade", "skipped"]);
63730
64368
  function loadPlan(dir) {
63731
- const p = join24(dir, PLAN_FILE);
63732
- if (!existsSync12(p))
64369
+ const p = join28(dir, PLAN_FILE);
64370
+ if (!existsSync15(p))
63733
64371
  return null;
63734
- return JSON.parse(readFileSync17(p, "utf8"));
64372
+ return JSON.parse(readFileSync21(p, "utf8"));
63735
64373
  }
63736
64374
  function savePlan(dir, plan) {
63737
- writeFileSync23(join24(dir, PLAN_FILE), `${JSON.stringify(plan, null, 2)}
64375
+ writeFileSync24(join28(dir, PLAN_FILE), `${JSON.stringify(plan, null, 2)}
63738
64376
  `, "utf8");
63739
64377
  }
63740
64378
  function setComponentStatus(plan, name, status) {
@@ -63969,12 +64607,12 @@ function syntheticSourceComponents(plan) {
63969
64607
  }
63970
64608
 
63971
64609
  // src/migrate/sources/deco-fresh.ts
63972
- import { existsSync as existsSync13, readFileSync as readFileSync18 } from "node:fs";
63973
- import { join as join26 } from "node:path";
64610
+ import { existsSync as existsSync16, readFileSync as readFileSync22 } from "node:fs";
64611
+ import { join as join30 } from "node:path";
63974
64612
 
63975
64613
  // src/migrate/sources/walk.ts
63976
- import { readdirSync as readdirSync3 } from "node:fs";
63977
- import { join as join25 } from "node:path";
64614
+ import { readdirSync as readdirSync4 } from "node:fs";
64615
+ import { join as join29 } from "node:path";
63978
64616
  var SKIP = new Set([
63979
64617
  "node_modules",
63980
64618
  ".git",
@@ -63990,7 +64628,7 @@ function walkFiles(dir, exts) {
63990
64628
  const recurse = (abs, rel) => {
63991
64629
  let entries;
63992
64630
  try {
63993
- entries = readdirSync3(abs, { withFileTypes: true });
64631
+ entries = readdirSync4(abs, { withFileTypes: true });
63994
64632
  } catch {
63995
64633
  return;
63996
64634
  }
@@ -64001,7 +64639,7 @@ function walkFiles(dir, exts) {
64001
64639
  continue;
64002
64640
  const childRel = rel ? `${rel}/${e.name}` : e.name;
64003
64641
  if (e.isDirectory()) {
64004
- recurse(join25(abs, e.name), childRel);
64642
+ recurse(join29(abs, e.name), childRel);
64005
64643
  } else if (exts.some((ext) => e.name.endsWith(ext))) {
64006
64644
  out.push(childRel);
64007
64645
  }
@@ -64013,15 +64651,15 @@ function walkFiles(dir, exts) {
64013
64651
 
64014
64652
  // src/migrate/sources/deco-fresh.ts
64015
64653
  function isDecoFresh(repoDir) {
64016
- const denoJson = join26(repoDir, "deno.json");
64017
- const denoJsonc = join26(repoDir, "deno.jsonc");
64018
- const file = existsSync13(denoJson) ? denoJson : existsSync13(denoJsonc) ? denoJsonc : null;
64654
+ const denoJson = join30(repoDir, "deno.json");
64655
+ const denoJsonc = join30(repoDir, "deno.jsonc");
64656
+ const file = existsSync16(denoJson) ? denoJson : existsSync16(denoJsonc) ? denoJsonc : null;
64019
64657
  if (!file)
64020
64658
  return false;
64021
- if (!existsSync13(join26(repoDir, "fresh.gen.ts")))
64659
+ if (!existsSync16(join30(repoDir, "fresh.gen.ts")))
64022
64660
  return false;
64023
64661
  try {
64024
- return readFileSync18(file, "utf8").includes("@deco/deco");
64662
+ return readFileSync22(file, "utf8").includes("@deco/deco");
64025
64663
  } catch {
64026
64664
  return false;
64027
64665
  }
@@ -64029,13 +64667,13 @@ function isDecoFresh(repoDir) {
64029
64667
  var GLOBAL_HINT = /\b(header|footer|navbar|menu|topbar)\b/i;
64030
64668
  function inventory(repoDir) {
64031
64669
  const components = [];
64032
- const sectionsDir = join26(repoDir, "sections");
64033
- if (existsSync13(sectionsDir)) {
64670
+ const sectionsDir = join30(repoDir, "sections");
64671
+ if (existsSync16(sectionsDir)) {
64034
64672
  for (const rel of walkFiles(sectionsDir, [".tsx"])) {
64035
64673
  const key2 = rel.replace(/\.tsx$/, "");
64036
64674
  components.push({
64037
64675
  name: key2,
64038
- file: join26("sections", rel),
64676
+ file: join30("sections", rel),
64039
64677
  role: "section",
64040
64678
  scope: GLOBAL_HINT.test(key2) ? "global" : "page"
64041
64679
  });
@@ -64044,9 +64682,9 @@ function inventory(repoDir) {
64044
64682
  const notes = [
64045
64683
  "Source: Deco on Fresh/Deno (Preact + signals, JSX). Sections are the CMS unit."
64046
64684
  ];
64047
- if (existsSync13(join26(repoDir, "islands")))
64685
+ if (existsSync16(join30(repoDir, "islands")))
64048
64686
  notes.push("Has islands/ — client-interactive components.");
64049
- if (existsSync13(join26(repoDir, "loaders")))
64687
+ if (existsSync16(join30(repoDir, "loaders")))
64050
64688
  notes.push("Has loaders/ — server data functions to port.");
64051
64689
  return { components, notes };
64052
64690
  }
@@ -64086,14 +64724,14 @@ captured HTML/computed-styles as the source of truth for structure and styling.`
64086
64724
  };
64087
64725
 
64088
64726
  // src/migrate/sources/vtex-io.ts
64089
- import { existsSync as existsSync14, readFileSync as readFileSync19 } from "node:fs";
64090
- import { join as join27 } from "node:path";
64727
+ import { existsSync as existsSync17, readFileSync as readFileSync23 } from "node:fs";
64728
+ import { join as join31 } from "node:path";
64091
64729
  function readManifest(repoDir) {
64092
- const file = join27(repoDir, "manifest.json");
64093
- if (!existsSync14(file))
64730
+ const file = join31(repoDir, "manifest.json");
64731
+ if (!existsSync17(file))
64094
64732
  return null;
64095
64733
  try {
64096
- return JSON.parse(readFileSync19(file, "utf8"));
64734
+ return JSON.parse(readFileSync23(file, "utf8"));
64097
64735
  } catch {
64098
64736
  return null;
64099
64737
  }
@@ -64114,14 +64752,14 @@ function blockName(id) {
64114
64752
  }
64115
64753
  var GLOBAL_HINT2 = /header|footer|menu|minicart|navbar/i;
64116
64754
  function inventory2(repoDir) {
64117
- const blocksDir = join27(repoDir, "store", "blocks");
64755
+ const blocksDir = join31(repoDir, "store", "blocks");
64118
64756
  const seen = new Map;
64119
- if (existsSync14(blocksDir)) {
64757
+ if (existsSync17(blocksDir)) {
64120
64758
  for (const rel of walkFiles(blocksDir, [".json", ".jsonc"])) {
64121
- const abs = join27(blocksDir, rel);
64759
+ const abs = join31(blocksDir, rel);
64122
64760
  let parsed;
64123
64761
  try {
64124
- parsed = JSON.parse(stripJsonc(readFileSync19(abs, "utf8")));
64762
+ parsed = JSON.parse(stripJsonc(readFileSync23(abs, "utf8")));
64125
64763
  } catch {
64126
64764
  continue;
64127
64765
  }
@@ -64131,7 +64769,7 @@ function inventory2(repoDir) {
64131
64769
  continue;
64132
64770
  seen.set(name, {
64133
64771
  name,
64134
- file: join27("store", "blocks", rel),
64772
+ file: join31("store", "blocks", rel),
64135
64773
  role: "section",
64136
64774
  scope: GLOBAL_HINT2.test(name) ? "global" : "page"
64137
64775
  });
@@ -64650,29 +65288,29 @@ async function captureInteractions(page, selector) {
64650
65288
  async function migrateCommand(opts) {
64651
65289
  const viewport = parseViewport3(opts.viewport);
64652
65290
  if (!viewport) {
64653
- console.error(chalk17.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
65291
+ console.error(chalk18.red(`viewport inválido: ${opts.viewport} (use mobile|desktop|tablet)`));
64654
65292
  return 2;
64655
65293
  }
64656
65294
  const viewports = (opts.viewports ? opts.viewports.split(",") : [opts.viewport]).map((v) => parseViewport3(v.trim())).filter((v) => Boolean(v));
64657
65295
  if (viewports.length === 0) {
64658
- console.error(chalk17.red(`--viewports inválido: ${opts.viewports}`));
65296
+ console.error(chalk18.red(`--viewports inválido: ${opts.viewports}`));
64659
65297
  return 2;
64660
65298
  }
64661
65299
  const primaryViewport = viewports[0];
64662
65300
  if (!isValidUrl4(opts.url)) {
64663
- console.error(chalk17.red(`--url inválido: ${opts.url}`));
65301
+ console.error(chalk18.red(`--url inválido: ${opts.url}`));
64664
65302
  return 2;
64665
65303
  }
64666
65304
  const format = normalizeFormat2(opts.format);
64667
65305
  if (!format) {
64668
- console.error(chalk17.red(`--format inválido: ${opts.format} (use md|json|both)`));
65306
+ console.error(chalk18.red(`--format inválido: ${opts.format} (use md|json|both)`));
64669
65307
  return 2;
64670
65308
  }
64671
65309
  let playbook;
64672
65310
  if (opts.target) {
64673
65311
  playbook = getTargetPlaybook(opts.target);
64674
65312
  if (!playbook) {
64675
- console.error(chalk17.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
65313
+ console.error(chalk18.red(`--target inválido: ${opts.target} (disponíveis: ${TARGET_NAMES.join(", ")})`));
64676
65314
  return 2;
64677
65315
  }
64678
65316
  }
@@ -64682,24 +65320,24 @@ async function migrateCommand(opts) {
64682
65320
  if (opts.sourceKind) {
64683
65321
  const s = getSource(opts.sourceKind);
64684
65322
  if (!s) {
64685
- console.error(chalk17.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
65323
+ console.error(chalk18.red(`--source-kind inválido: ${opts.sourceKind} (disponíveis: ${SOURCE_KINDS.join(", ")})`));
64686
65324
  return 2;
64687
65325
  }
64688
65326
  source = s;
64689
65327
  }
64690
65328
  if (opts.source) {
64691
- if (!existsSync15(opts.source)) {
64692
- console.error(chalk17.red(`--source não encontrado: ${opts.source}`));
65329
+ if (!existsSync18(opts.source)) {
65330
+ console.error(chalk18.red(`--source não encontrado: ${opts.source}`));
64693
65331
  return 2;
64694
65332
  }
64695
65333
  if (!opts.sourceKind)
64696
65334
  source = detectSource(opts.source);
64697
65335
  sourceInventory = source.inventory(opts.source);
64698
- console.log(chalk17.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
65336
+ console.log(chalk18.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
64699
65337
  }
64700
65338
  const host = safeHost6(opts.url);
64701
65339
  const runDir = resolve5(opts.outDir, host);
64702
- mkdirSync16(runDir, { recursive: true });
65340
+ mkdirSync17(runDir, { recursive: true });
64703
65341
  const browser = await launchBrowser({ headless: true });
64704
65342
  try {
64705
65343
  const themePath = resolve5(runDir, "theme.json");
@@ -64712,17 +65350,17 @@ async function migrateCommand(opts) {
64712
65350
  let screenshots;
64713
65351
  let vtexBlocks = null;
64714
65352
  let contentMap = {};
64715
- if (!opts.refresh && existsSync15(themePath) && existsSync15(assetsPath)) {
65353
+ if (!opts.refresh && existsSync18(themePath) && existsSync18(assetsPath)) {
64716
65354
  theme = readJson(themePath);
64717
65355
  const meta = readJson(assetsPath);
64718
65356
  platform = meta.platform;
64719
65357
  stack = meta.stack ?? null;
64720
65358
  assets = meta.assets;
64721
65359
  screenshots = meta.screenshots ?? [];
64722
- console.log(chalk17.dim(" phase 1 theme+assets: cached"));
65360
+ console.log(chalk18.dim(" phase 1 theme+assets: cached"));
64723
65361
  } else {
64724
- console.log(chalk17.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
64725
- mkdirSync16(resolve5(runDir, "screenshots"), { recursive: true });
65362
+ console.log(chalk18.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
65363
+ mkdirSync17(resolve5(runDir, "screenshots"), { recursive: true });
64726
65364
  const samples = [];
64727
65365
  screenshots = [];
64728
65366
  let platformSeen = null;
@@ -64757,7 +65395,7 @@ async function migrateCommand(opts) {
64757
65395
  platformSeen = detectPlatform({ url: opts.url, html: pageHtml });
64758
65396
  const cookieNames = await ctx.cookies().then((cs) => cs.map((c) => c.name).join("; ")).catch(() => "");
64759
65397
  stack = classifyLiveStack(pageHtml, cookieNames);
64760
- console.log(chalk17.dim(` stack: ${describeStack(stack)}`));
65398
+ console.log(chalk18.dim(` stack: ${describeStack(stack)}`));
64761
65399
  const rawAssets = await collectSiteAssets(page);
64762
65400
  const fetchBytes = async (url) => await browserFetchBytes(page, url) ?? await nodeFetchBytes(url);
64763
65401
  assetsResolved = await downloadSiteAssets(rawAssets, runDir, fetchBytes);
@@ -64782,18 +65420,18 @@ async function migrateCommand(opts) {
64782
65420
  theme = aggregateTheme(mergeRawThemeSamples(samples));
64783
65421
  platform = platformSeen ?? "custom";
64784
65422
  assets = assetsResolved;
64785
- writeFileSync24(themePath, `${JSON.stringify(theme, null, 2)}
65423
+ writeFileSync25(themePath, `${JSON.stringify(theme, null, 2)}
64786
65424
  `, "utf8");
64787
- writeFileSync24(assetsPath, `${JSON.stringify({ platform, stack, assets, screenshots }, null, 2)}
65425
+ writeFileSync25(assetsPath, `${JSON.stringify({ platform, stack, assets, screenshots }, null, 2)}
64788
65426
  `, "utf8");
64789
65427
  }
64790
65428
  const sitemapPath = resolve5(runDir, "sitemap.json");
64791
65429
  let resolvedPages;
64792
- if (!opts.refresh && existsSync15(sitemapPath)) {
65430
+ if (!opts.refresh && existsSync18(sitemapPath)) {
64793
65431
  resolvedPages = readJson(sitemapPath).pages;
64794
- console.log(chalk17.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
65432
+ console.log(chalk18.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
64795
65433
  } else {
64796
- console.log(chalk17.dim(" phase 2 sitemap: resolving pages…"));
65434
+ console.log(chalk18.dim(" phase 2 sitemap: resolving pages…"));
64797
65435
  const ctx = await newContext(browser, { viewport: primaryViewport });
64798
65436
  const page = await ctx.newPage();
64799
65437
  let sitemapUrls = [];
@@ -64821,27 +65459,27 @@ async function migrateCommand(opts) {
64821
65459
  a[p.kind] = (a[p.kind] ?? 0) + 1;
64822
65460
  return a;
64823
65461
  }, {});
64824
- console.log(chalk17.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
65462
+ console.log(chalk18.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
64825
65463
  }
64826
- writeFileSync24(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
65464
+ writeFileSync25(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
64827
65465
  `, "utf8");
64828
65466
  }
64829
65467
  if (resolvedPages.length === 0) {
64830
- console.error(chalk17.red("nenhuma página resolvida a partir de --pages"));
65468
+ console.error(chalk18.red("nenhuma página resolvida a partir de --pages"));
64831
65469
  return 1;
64832
65470
  }
64833
65471
  const capturePath = resolve5(runDir, "capture.json");
64834
65472
  let pages;
64835
65473
  let components;
64836
- if (!opts.refresh && existsSync15(capturePath)) {
65474
+ if (!opts.refresh && existsSync18(capturePath)) {
64837
65475
  const cached = readJson(capturePath);
64838
65476
  pages = cached.pages;
64839
65477
  components = cached.components;
64840
65478
  vtexBlocks = cached.vtexBlocks ?? null;
64841
65479
  contentMap = cached.contentMap ?? {};
64842
- console.log(chalk17.dim(` phase 3 components: cached (${components.length})`));
65480
+ console.log(chalk18.dim(` phase 3 components: cached (${components.length})`));
64843
65481
  } else {
64844
- console.log(chalk17.dim(" phase 3 components: capturing…"));
65482
+ console.log(chalk18.dim(" phase 3 components: capturing…"));
64845
65483
  ({ pages, components, vtexBlocks, contentMap } = await capturePages(browser, primaryViewport, resolvedPages, theme, {
64846
65484
  allowlist,
64847
65485
  llm: !opts.noLlm,
@@ -64849,14 +65487,14 @@ async function migrateCommand(opts) {
64849
65487
  baseUrl: opts.url,
64850
65488
  vtexScrape: opts.source ? source.kind === "vtex-io" : true
64851
65489
  }));
64852
- writeFileSync24(capturePath, `${JSON.stringify({ pages, components, vtexBlocks, contentMap }, null, 2)}
65490
+ writeFileSync25(capturePath, `${JSON.stringify({ pages, components, vtexBlocks, contentMap }, null, 2)}
64853
65491
  `, "utf8");
64854
65492
  }
64855
65493
  if (vtexBlocks)
64856
- writeFileSync24(blocksPath, `${JSON.stringify(vtexBlocks, null, 2)}
65494
+ writeFileSync25(blocksPath, `${JSON.stringify(vtexBlocks, null, 2)}
64857
65495
  `, "utf8");
64858
65496
  if (Object.keys(contentMap).length)
64859
- writeFileSync24(resolve5(runDir, "content-assets.json"), `${JSON.stringify(contentMap, null, 2)}
65497
+ writeFileSync25(resolve5(runDir, "content-assets.json"), `${JSON.stringify(contentMap, null, 2)}
64860
65498
  `, "utf8");
64861
65499
  const bundle = {
64862
65500
  url: opts.url,
@@ -64882,10 +65520,10 @@ async function migrateCommand(opts) {
64882
65520
  const plan = merged.plan;
64883
65521
  savePlan(runDir, plan);
64884
65522
  if (merged.carried.length) {
64885
- console.log(chalk17.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
65523
+ console.log(chalk18.gray(` plan: carried ${merged.carried.length} recorded decision(s) forward`));
64886
65524
  }
64887
65525
  if (merged.droppedWithDecisions.length) {
64888
- console.log(chalk17.yellow(` plan: ${merged.droppedWithDecisions.length} component(s) with recorded decisions are no longer in the capture — ${merged.droppedWithDecisions.join(", ")}`));
65526
+ console.log(chalk18.yellow(` plan: ${merged.droppedWithDecisions.length} component(s) with recorded decisions are no longer in the capture — ${merged.droppedWithDecisions.join(", ")}`));
64889
65527
  }
64890
65528
  bundle.components.push(...syntheticSourceComponents(plan));
64891
65529
  if (format === "json" || format === "both")
@@ -64893,17 +65531,17 @@ async function migrateCommand(opts) {
64893
65531
  if (format === "md" || format === "both") {
64894
65532
  await markdownExporter2.export(bundle, runDir);
64895
65533
  await htmlExporter.export(bundle, runDir);
64896
- writeFileSync24(resolve5(runDir, "MIGRATION_PROMPT.md"), buildMigrationPrompt(bundle, playbook, {
65534
+ writeFileSync25(resolve5(runDir, "MIGRATION_PROMPT.md"), buildMigrationPrompt(bundle, playbook, {
64897
65535
  playbook: source.playbook,
64898
65536
  notes: sourceInventory.notes
64899
65537
  }), "utf8");
64900
65538
  }
64901
65539
  const targetTheme = opts.target ? getTargetTheme(opts.target) : null;
64902
65540
  if (targetTheme) {
64903
- writeFileSync24(resolve5(runDir, targetTheme.filename), targetTheme.build(theme), "utf8");
65541
+ writeFileSync25(resolve5(runDir, targetTheme.filename), targetTheme.build(theme), "utf8");
64904
65542
  }
64905
65543
  if (bundle.vtex) {
64906
- writeFileSync24(resolve5(runDir, "component-map.json"), `${JSON.stringify(bundle.vtex.map, null, 2)}
65544
+ writeFileSync25(resolve5(runDir, "component-map.json"), `${JSON.stringify(bundle.vtex.map, null, 2)}
64907
65545
  `, "utf8");
64908
65546
  }
64909
65547
  if (opts.json) {
@@ -65012,21 +65650,21 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
65012
65650
  contentMap
65013
65651
  };
65014
65652
  }
65015
- async function resolvePages2(page, baseUrl, pagesSpec, homeHtml, platform) {
65653
+ async function resolvePages2(page, baseUrl2, pagesSpec, homeHtml, platform) {
65016
65654
  const tokens = (pagesSpec ?? "/,category-auto,pdp-auto").split(",").map((s) => s.trim()).filter(Boolean);
65017
65655
  const out = [];
65018
- const plp = pickPlpFromHomeHtml(homeHtml, baseUrl);
65656
+ const plp = pickPlpFromHomeHtml(homeHtml, baseUrl2);
65019
65657
  for (const token of tokens) {
65020
65658
  if (token === "category-auto") {
65021
65659
  if (plp)
65022
65660
  out.push({ path: token, url: plp, kind: "plp" });
65023
65661
  else
65024
- console.warn(chalk17.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
65662
+ console.warn(chalk18.yellow(" ⚠ category-auto: nenhuma PLP descoberta na home"));
65025
65663
  continue;
65026
65664
  }
65027
65665
  if (token === "pdp-auto") {
65028
65666
  if (!plp) {
65029
- console.warn(chalk17.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
65667
+ console.warn(chalk18.yellow(" ⚠ pdp-auto: sem PLP pra derivar PDP"));
65030
65668
  continue;
65031
65669
  }
65032
65670
  let html3 = null;
@@ -65043,19 +65681,19 @@ async function resolvePages2(page, baseUrl, pagesSpec, homeHtml, platform) {
65043
65681
  if (pdp)
65044
65682
  out.push({ path: token, url: pdp, kind: "pdp" });
65045
65683
  else
65046
- console.warn(chalk17.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
65684
+ console.warn(chalk18.yellow(" ⚠ pdp-auto: nenhum produto encontrado na PLP"));
65047
65685
  continue;
65048
65686
  }
65049
65687
  try {
65050
- const url = new URL(token, baseUrl).toString();
65688
+ const url = new URL(token, baseUrl2).toString();
65051
65689
  out.push({ path: token, url, kind: kindOf(url) });
65052
65690
  } catch {}
65053
65691
  }
65054
65692
  return out;
65055
65693
  }
65056
- async function discoverSitemapUrls(page, baseUrl) {
65694
+ async function discoverSitemapUrls(page, baseUrl2) {
65057
65695
  try {
65058
- const origin = new URL(baseUrl).origin;
65696
+ const origin = new URL(baseUrl2).origin;
65059
65697
  const rootXml = await browserFetchText(page, `${origin}/sitemap.xml`);
65060
65698
  if (!rootXml)
65061
65699
  return [];
@@ -65157,31 +65795,31 @@ function kindOf(url) {
65157
65795
  }
65158
65796
  }
65159
65797
  function printResults4(runDir, bundle) {
65160
- console.log(chalk17.bold(`
65798
+ console.log(chalk18.bold(`
65161
65799
  parity migrate`));
65162
- console.log(chalk17.dim(` url: ${bundle.url}`));
65163
- console.log(chalk17.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
65164
- console.log(chalk17.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
65165
- console.log(chalk17.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
65166
- console.log(chalk17.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
65800
+ console.log(chalk18.dim(` url: ${bundle.url}`));
65801
+ console.log(chalk18.dim(` platform: ${bundle.platform}${bundle.target ? ` → ${bundle.target}` : ""}`));
65802
+ console.log(chalk18.dim(` viewports:${(bundle.viewports ?? [bundle.viewport]).join(", ")}`));
65803
+ console.log(chalk18.dim(` theme: primary=${bundle.theme.colors.primary ?? "—"} text=${bundle.theme.colors.text ?? "—"}`));
65804
+ console.log(chalk18.dim(` assets: logo=${bundle.assets.logo ? "✓" : "✗"} favicon=${bundle.assets.favicon ? "✓" : "✗"} icons=${bundle.assets.icons.length} fonts=${bundle.assets.fontFiles.length}`));
65167
65805
  if (bundle.vtex) {
65168
65806
  const mapped = bundle.vtex.map.filter((m) => m.strategy === "mapped").length;
65169
65807
  const withContent = bundle.vtex.blocks.filter((x) => x.props).length;
65170
65808
  const contentImgs = countContentImages(bundle.vtex.blocks);
65171
- console.log(chalk17.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
65809
+ console.log(chalk18.dim(` vtex io: ${bundle.vtex.blocks.length} blocks (${withContent} with CMS content, ${contentImgs} content images local) · ${mapped}/${bundle.vtex.map.length} mapped`));
65172
65810
  }
65173
- console.log(chalk17.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
65174
- console.log(chalk17.dim(` out: ${runDir}`));
65811
+ console.log(chalk18.dim(` pages: ${bundle.pages.map((p) => p.kind).join(", ") || "—"}`));
65812
+ console.log(chalk18.dim(` out: ${runDir}`));
65175
65813
  console.log("");
65176
- console.log(chalk17.bold(` ${bundle.components.length} component(s):`));
65814
+ console.log(chalk18.bold(` ${bundle.components.length} component(s):`));
65177
65815
  for (const c of bundle.components) {
65178
- console.log(` ${chalk17.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk17.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
65816
+ console.log(` ${chalk18.cyan(`${c.scope}/${c.role}`.padEnd(28))} ${chalk18.dim(`${c.tailwind.length} tw · ${c.interactions.length} interactions`)}`);
65179
65817
  }
65180
65818
  console.log("");
65181
65819
  }
65182
65820
  function readJson(path) {
65183
65821
  try {
65184
- return JSON.parse(readFileSync20(path, "utf8"));
65822
+ return JSON.parse(readFileSync24(path, "utf8"));
65185
65823
  } catch {
65186
65824
  return null;
65187
65825
  }
@@ -65227,8 +65865,8 @@ function sleep2(ms) {
65227
65865
  }
65228
65866
 
65229
65867
  // src/commands/plan.ts
65230
- import { readFileSync as readFileSync21 } from "node:fs";
65231
- import chalk18 from "chalk";
65868
+ import { readFileSync as readFileSync25 } from "node:fs";
65869
+ import chalk19 from "chalk";
65232
65870
 
65233
65871
  // src/board/studio.ts
65234
65872
  var LANE_TO_STUDIO = {
@@ -65390,56 +66028,56 @@ var STATUSES = ["pending", "partial", "done", "as-is", "upgrade", "skipped"];
65390
66028
  var PAGE_STATUSES = ["pending", "code", "done", "skipped"];
65391
66029
  function planSetStatusCommand(dir, name, status) {
65392
66030
  if (!STATUSES.includes(status)) {
65393
- console.error(chalk18.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
66031
+ console.error(chalk19.red(`Invalid status "${status}". Use one of: ${STATUSES.join(", ")}`));
65394
66032
  return 1;
65395
66033
  }
65396
66034
  const plan = loadPlan(dir);
65397
66035
  if (!plan) {
65398
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
66036
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
65399
66037
  return 1;
65400
66038
  }
65401
66039
  const component = setComponentStatus(plan, name, status);
65402
66040
  if (!component) {
65403
- console.error(chalk18.red(`No component matching "${name}" in the plan`));
66041
+ console.error(chalk19.red(`No component matching "${name}" in the plan`));
65404
66042
  return 1;
65405
66043
  }
65406
66044
  savePlan(dir, plan);
65407
- console.log(`${chalk18.green("✓")} ${component.name} → ${status}`);
66045
+ console.log(`${chalk19.green("✓")} ${component.name} → ${status}`);
65408
66046
  if ((status === "upgrade" || status === "as-is") && !component.reference) {
65409
- console.log(chalk18.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
66047
+ console.log(chalk19.yellow(` no reason recorded — run \`parity plan set-reference ${component.name} --note "<why>"${status === "upgrade" ? " --url <reference site>" : ""}\``));
65410
66048
  }
65411
66049
  return 0;
65412
66050
  }
65413
66051
  function planSetPageStatusCommand(dir, path, status) {
65414
66052
  if (!PAGE_STATUSES.includes(status)) {
65415
- console.error(chalk18.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
66053
+ console.error(chalk19.red(`Invalid status "${status}". Use one of: ${PAGE_STATUSES.join(", ")}`));
65416
66054
  return 1;
65417
66055
  }
65418
66056
  const plan = loadPlan(dir);
65419
66057
  if (!plan) {
65420
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
66058
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
65421
66059
  return 1;
65422
66060
  }
65423
66061
  const page = setPageStatus(plan, path, status);
65424
66062
  if (!page) {
65425
- console.error(chalk18.red(`No page matching "${path}" in the plan`));
66063
+ console.error(chalk19.red(`No page matching "${path}" in the plan`));
65426
66064
  return 1;
65427
66065
  }
65428
66066
  savePlan(dir, plan);
65429
- console.log(`${chalk18.green("✓")} ${page.path} → ${status}`);
66067
+ console.log(`${chalk19.green("✓")} ${page.path} → ${status}`);
65430
66068
  return 0;
65431
66069
  }
65432
66070
  var DISPOSITION_STYLE = {
65433
- build: chalk18.red,
65434
- validate: chalk18.yellow,
65435
- upgrade: chalk18.cyan,
65436
- "as-is": chalk18.gray,
65437
- settled: chalk18.green
66071
+ build: chalk19.red,
66072
+ validate: chalk19.yellow,
66073
+ upgrade: chalk19.cyan,
66074
+ "as-is": chalk19.gray,
66075
+ settled: chalk19.green
65438
66076
  };
65439
66077
  function planSetReferenceCommand(dir, name, opts) {
65440
66078
  const plan = loadPlan(dir);
65441
66079
  if (!plan) {
65442
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
66080
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
65443
66081
  return 1;
65444
66082
  }
65445
66083
  const component = setComponentReference(plan, name, {
@@ -65448,76 +66086,76 @@ function planSetReferenceCommand(dir, name, opts) {
65448
66086
  note: opts.note
65449
66087
  });
65450
66088
  if (!component) {
65451
- console.error(chalk18.red(`No component matching "${name}" in the plan`));
66089
+ console.error(chalk19.red(`No component matching "${name}" in the plan`));
65452
66090
  return 1;
65453
66091
  }
65454
66092
  savePlan(dir, plan);
65455
- console.log(`${chalk18.green("✓")} ${component.name} → reference ${component.reference?.url}`);
66093
+ console.log(`${chalk19.green("✓")} ${component.name} → reference ${component.reference?.url}`);
65456
66094
  return 0;
65457
66095
  }
65458
66096
  function planVerifyCommand(dir, name, verdict2, opts) {
65459
66097
  if (verdict2 !== "pass" && verdict2 !== "fail") {
65460
- console.error(chalk18.red(`Invalid verdict "${verdict2}". Use pass or fail.`));
66098
+ console.error(chalk19.red(`Invalid verdict "${verdict2}". Use pass or fail.`));
65461
66099
  return 1;
65462
66100
  }
65463
66101
  const plan = loadPlan(dir);
65464
66102
  if (!plan) {
65465
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
66103
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
65466
66104
  return 1;
65467
66105
  }
65468
66106
  const component = setComponentVerified(plan, name, verdict2, opts.at ?? new Date().toISOString(), opts.note);
65469
66107
  if (!component) {
65470
- console.error(chalk18.red(`No component matching "${name}" in the plan`));
66108
+ console.error(chalk19.red(`No component matching "${name}" in the plan`));
65471
66109
  return 1;
65472
66110
  }
65473
66111
  savePlan(dir, plan);
65474
- const mark = verdict2 === "pass" ? chalk18.green("✓") : chalk18.red("✗");
66112
+ const mark = verdict2 === "pass" ? chalk19.green("✓") : chalk19.red("✗");
65475
66113
  console.log(`${mark} ${component.name} → ${verdict2} (against ${component.verified?.against})`);
65476
66114
  return 0;
65477
66115
  }
65478
66116
  function planMergeCommand(dir, sourceDir) {
65479
66117
  const fresh = loadPlan(sourceDir);
65480
66118
  if (!fresh) {
65481
- console.error(chalk18.red(`No migration-plan.json found in ${sourceDir}`));
66119
+ console.error(chalk19.red(`No migration-plan.json found in ${sourceDir}`));
65482
66120
  return 1;
65483
66121
  }
65484
66122
  const existing = loadPlan(dir);
65485
66123
  const { plan, carried, droppedWithDecisions } = mergePlanDecisions(fresh, existing);
65486
66124
  savePlan(dir, plan);
65487
66125
  if (!existing) {
65488
- console.log(`${chalk18.green("✓")} plan written to ${dir} (nothing to merge)`);
66126
+ console.log(`${chalk19.green("✓")} plan written to ${dir} (nothing to merge)`);
65489
66127
  return 0;
65490
66128
  }
65491
- console.log(`${chalk18.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
66129
+ console.log(`${chalk19.green("✓")} merged into ${dir} — ${carried.length} decision(s) kept`);
65492
66130
  if (droppedWithDecisions.length) {
65493
- console.log(chalk18.yellow(` no longer in the capture, decisions lost: ${droppedWithDecisions.join(", ")}`));
66131
+ console.log(chalk19.yellow(` no longer in the capture, decisions lost: ${droppedWithDecisions.join(", ")}`));
65494
66132
  }
65495
66133
  return 0;
65496
66134
  }
65497
66135
  function planPageCommand(dir, path, opts) {
65498
66136
  const plan = loadPlan(dir);
65499
66137
  if (!plan) {
65500
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
66138
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
65501
66139
  return 1;
65502
66140
  }
65503
66141
  const page = pagePlan(plan, path, opts.cand);
65504
66142
  if (!page) {
65505
- console.error(chalk18.red(`No page matching "${path}" in the plan`));
65506
- console.error(chalk18.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
66143
+ console.error(chalk19.red(`No page matching "${path}" in the plan`));
66144
+ console.error(chalk19.gray(` known pages: ${plan.pages.map((p) => p.path).join(", ")}`));
65507
66145
  return 1;
65508
66146
  }
65509
66147
  if (opts.json) {
65510
66148
  console.log(JSON.stringify(page, null, 2));
65511
66149
  return 0;
65512
66150
  }
65513
- console.log(chalk18.bold(`
65514
- ${page.path} ${chalk18.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk18.green(" ready") : ""));
66151
+ console.log(chalk19.bold(`
66152
+ ${page.path} ${chalk19.gray(`(${page.kind})`)} — ${page.status}`) + (page.ready ? chalk19.green(" ready") : ""));
65515
66153
  if (page.tasks === null) {
65516
- console.log(chalk18.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
66154
+ console.log(chalk19.yellow("\n This plan has no page/component edges — it predates them. Re-run `parity migrate` to get per-page work.\n"));
65517
66155
  return 0;
65518
66156
  }
65519
66157
  if (page.tasks.length === 0) {
65520
- console.log(chalk18.gray(`
66158
+ console.log(chalk19.gray(`
65521
66159
  The capture saw no components on this page.
65522
66160
  `));
65523
66161
  return 0;
@@ -65528,20 +66166,20 @@ ${page.path} ${chalk18.gray(`(${page.kind})`)} — ${page.status}`) + (page.read
65528
66166
  if (!rows.length)
65529
66167
  continue;
65530
66168
  console.log(`
65531
- ${DISPOSITION_STYLE[d](chalk18.bold(d))} (${rows.length})`);
66169
+ ${DISPOSITION_STYLE[d](chalk19.bold(d))} (${rows.length})`);
65532
66170
  for (const t of rows) {
65533
- console.log(` ${t.name} ${chalk18.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
66171
+ console.log(` ${t.name} ${chalk19.gray(`(${t.scope}, ${t.origin}, ${t.status})`)}`);
65534
66172
  if (t.note)
65535
- console.log(chalk18.gray(` why: ${t.note}`));
66173
+ console.log(chalk19.gray(` why: ${t.note}`));
65536
66174
  if (t.against?.kind === "reference") {
65537
- console.log(chalk18.cyan(` reference: ${t.against.url}`));
66175
+ console.log(chalk19.cyan(` reference: ${t.against.url}`));
65538
66176
  }
65539
66177
  if (t.command)
65540
- console.log(chalk18.gray(` $ ${t.command}`));
66178
+ console.log(chalk19.gray(` $ ${t.command}`));
65541
66179
  }
65542
66180
  }
65543
66181
  if (page.counts.validate > 0 && !opts.cand) {
65544
- console.log(chalk18.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
66182
+ console.log(chalk19.yellow("\n Pass --cand <url> to get runnable `parity section` commands."));
65545
66183
  }
65546
66184
  console.log("");
65547
66185
  return 0;
@@ -65549,8 +66187,8 @@ ${DISPOSITION_STYLE[d](chalk18.bold(d))} (${rows.length})`);
65549
66187
  function planStatusCommand(dir, asJson) {
65550
66188
  const plan = loadPlan(dir);
65551
66189
  if (!plan) {
65552
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
65553
- console.error(chalk18.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
66190
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
66191
+ console.error(chalk19.yellow("Run `parity migrate --url <prod>` first — without a plan there is no inventory."));
65554
66192
  return 1;
65555
66193
  }
65556
66194
  const p = planProgress(plan);
@@ -65559,49 +66197,49 @@ function planStatusCommand(dir, asJson) {
65559
66197
  return 0;
65560
66198
  }
65561
66199
  const c = p.components;
65562
- console.log(chalk18.bold(`
66200
+ console.log(chalk19.bold(`
65563
66201
  Migration plan — ${plan.url}${plan.target.name ? ` → ${plan.target.name}` : ""}`));
65564
66202
  console.log(`
65565
- ${chalk18.bold("Components")} (${c.total}): ` + `${chalk18.green(`${c.byStatus.done} done`)}, ` + `${chalk18.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk18.red(`${c.byStatus.pending} pending`)}, ` + `${chalk18.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk18.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk18.gray(`${c.byStatus.skipped} skipped`)}`);
66203
+ ${chalk19.bold("Components")} (${c.total}): ` + `${chalk19.green(`${c.byStatus.done} done`)}, ` + `${chalk19.yellow(`${c.byStatus.partial} partial`)}, ` + `${chalk19.red(`${c.byStatus.pending} pending`)}, ` + `${chalk19.cyan(`${c.byStatus.upgrade} upgrade`)}, ` + `${chalk19.gray(`${c.byStatus["as-is"]} as-is`)}, ` + `${chalk19.gray(`${c.byStatus.skipped} skipped`)}`);
65566
66204
  if (c.accepted.upgrade.length) {
65567
- console.log(chalk18.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
66205
+ console.log(chalk19.cyan(` deliberately ahead of prod: ${c.accepted.upgrade.join(", ")}`));
65568
66206
  }
65569
66207
  if (c.accepted.asIs.length) {
65570
- console.log(chalk18.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
66208
+ console.log(chalk19.gray(` divergence accepted: ${c.accepted.asIs.join(", ")}`));
65571
66209
  }
65572
66210
  if (c.settled.length) {
65573
- console.log(chalk18.gray(` no work needed: ${c.settled.join(", ")}`));
66211
+ console.log(chalk19.gray(` no work needed: ${c.settled.join(", ")}`));
65574
66212
  }
65575
66213
  for (const r of c.remaining) {
65576
- const tag = r.status === "partial" ? chalk18.yellow("partial") : chalk18.red("pending");
65577
- console.log(` ${tag} ${r.name} ${chalk18.gray(`(${r.scope}, ${r.origin})`)}`);
66214
+ const tag = r.status === "partial" ? chalk19.yellow("partial") : chalk19.red("pending");
66215
+ console.log(` ${tag} ${r.name} ${chalk19.gray(`(${r.scope}, ${r.origin})`)}`);
65578
66216
  }
65579
66217
  const pg = p.pages;
65580
66218
  console.log(`
65581
- ${chalk18.bold("Pages")} (${pg.total}): ` + `${chalk18.green(`${pg.byStatus.done} done`)}, ` + `${chalk18.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk18.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk18.gray(`${pg.byStatus.skipped} skipped`)}`);
66219
+ ${chalk19.bold("Pages")} (${pg.total}): ` + `${chalk19.green(`${pg.byStatus.done} done`)}, ` + `${chalk19.yellow(`${pg.byStatus.code} code-only`)}, ` + `${chalk19.red(`${pg.byStatus.pending} pending`)}, ` + `${chalk19.gray(`${pg.byStatus.skipped} skipped`)}`);
65582
66220
  if (pg.awaitingContent.length) {
65583
- console.log(chalk18.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
66221
+ console.log(chalk19.yellow(` awaiting CMS content: ${pg.awaitingContent.join(", ")}`));
65584
66222
  }
65585
66223
  for (const r of pg.remaining.filter((r2) => r2.status === "pending")) {
65586
- console.log(` ${chalk18.red("pending")} ${r.path} ${chalk18.gray(`(${r.kind})`)}`);
66224
+ console.log(` ${chalk19.red("pending")} ${r.path} ${chalk19.gray(`(${r.kind})`)}`);
65587
66225
  }
65588
66226
  console.log("");
65589
66227
  return 0;
65590
66228
  }
65591
66229
  var COLUMN_ORDER = ["triage", "backlog", "building", "review", "done"];
65592
66230
  var COLUMN_STYLE = {
65593
- triage: chalk18.magenta,
65594
- backlog: chalk18.red,
65595
- building: chalk18.yellow,
65596
- review: chalk18.cyan,
65597
- done: chalk18.green,
65598
- skipped: chalk18.gray
66231
+ triage: chalk19.magenta,
66232
+ backlog: chalk19.red,
66233
+ building: chalk19.yellow,
66234
+ review: chalk19.cyan,
66235
+ done: chalk19.green,
66236
+ skipped: chalk19.gray
65599
66237
  };
65600
66238
  async function planBoardCommand(dir, opts) {
65601
66239
  const plan = loadPlan(dir);
65602
66240
  if (!plan) {
65603
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
65604
- console.error(chalk18.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
66241
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
66242
+ console.error(chalk19.yellow("Run `parity migrate --url <prod>` first — no plan, no board."));
65605
66243
  return 1;
65606
66244
  }
65607
66245
  const board = planBoard(plan, opts.cand);
@@ -65609,46 +66247,46 @@ async function planBoardCommand(dir, opts) {
65609
66247
  console.log(JSON.stringify(board, null, 2));
65610
66248
  return 0;
65611
66249
  }
65612
- console.log(chalk18.bold(`
66250
+ console.log(chalk19.bold(`
65613
66251
  Board — ${board.url}`));
65614
- console.log(chalk18.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
66252
+ console.log(chalk19.gray(`${board.sampled} sampled page(s) — the capture's sample, not every URL on the site.`));
65615
66253
  if (board.shell.length) {
65616
66254
  console.log(`
65617
- ${chalk18.bold("shell")} ${chalk18.gray("(global — blocks every page)")}: ${chalk18.yellow(board.shell.join(", "))}`);
66255
+ ${chalk19.bold("shell")} ${chalk19.gray("(global — blocks every page)")}: ${chalk19.yellow(board.shell.join(", "))}`);
65618
66256
  }
65619
66257
  for (const column of COLUMN_ORDER) {
65620
66258
  const cards = board.columns[column];
65621
66259
  if (!cards.length)
65622
66260
  continue;
65623
66261
  console.log(`
65624
- ${COLUMN_STYLE[column](chalk18.bold(column))} (${cards.length})`);
66262
+ ${COLUMN_STYLE[column](chalk19.bold(column))} (${cards.length})`);
65625
66263
  for (const card of cards) {
65626
- console.log(` ${card.path} ${chalk18.gray(`(${card.kind})`)}`);
66264
+ console.log(` ${card.path} ${chalk19.gray(`(${card.kind})`)}`);
65627
66265
  if (card.blockers.length) {
65628
- console.log(chalk18.gray(` blocked by: ${card.blockers.join(", ")}`));
66266
+ console.log(chalk19.gray(` blocked by: ${card.blockers.join(", ")}`));
65629
66267
  }
65630
66268
  }
65631
66269
  }
65632
66270
  const skipped = board.columns.skipped;
65633
66271
  if (skipped.length) {
65634
66272
  console.log(`
65635
- ${chalk18.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
66273
+ ${chalk19.gray(`skipped (${skipped.length}): ${skipped.map((c) => c.path).join(", ")}`)}`);
65636
66274
  }
65637
66275
  if (board.unassigned.length) {
65638
66276
  console.log(`
65639
- ${chalk18.bold("no page")} ${chalk18.gray("(in the code, not seen on any sampled page)")}
65640
- ${chalk18.gray(board.unassigned.join(", "))}`);
66277
+ ${chalk19.bold("no page")} ${chalk19.gray("(in the code, not seen on any sampled page)")}
66278
+ ${chalk19.gray(board.unassigned.join(", "))}`);
65641
66279
  }
65642
66280
  console.log("");
65643
66281
  if (opts.board === "studio") {
65644
66282
  const cfg = studioConfigFromEnv();
65645
66283
  if (!cfg) {
65646
- console.log(chalk18.yellow(`Studio board skipped — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN. Showing the terminal board instead.
66284
+ console.log(chalk19.yellow(`Studio board skipped — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN. Showing the terminal board instead.
65647
66285
  `));
65648
66286
  return 0;
65649
66287
  }
65650
66288
  try {
65651
- const fixes = opts.fixes ? JSON.parse(readFileSync21(opts.fixes, "utf8")) : undefined;
66289
+ const fixes = opts.fixes ? JSON.parse(readFileSync25(opts.fixes, "utf8")) : undefined;
65652
66290
  const synced = await syncBoardToStudio(board, cfg, { repo: opts.repo, fixes });
65653
66291
  let stored = 0;
65654
66292
  for (const [path, id] of Object.entries(synced.ids)) {
@@ -65657,10 +66295,10 @@ ${chalk18.bold("no page")} ${chalk18.gray("(in the code, not seen on any sampled
65657
66295
  }
65658
66296
  if (stored)
65659
66297
  savePlan(dir, plan);
65660
- console.log(chalk18.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
66298
+ console.log(chalk19.green(`Studio board synced — ${synced.created} created, ${synced.updated} updated, ${synced.skipped} skipped.
65661
66299
  `));
65662
66300
  } catch (err) {
65663
- console.log(chalk18.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
66301
+ console.log(chalk19.yellow(`Studio board unavailable (${err instanceof Error ? err.message : String(err)}). Showing the terminal board instead.
65664
66302
  `));
65665
66303
  }
65666
66304
  }
@@ -65669,27 +66307,27 @@ ${chalk18.bold("no page")} ${chalk18.gray("(in the code, not seen on any sampled
65669
66307
  async function planNotesCommand(dir, opts) {
65670
66308
  const plan = loadPlan(dir);
65671
66309
  if (!plan) {
65672
- console.error(chalk18.red(`No migration-plan.json found in ${dir}`));
66310
+ console.error(chalk19.red(`No migration-plan.json found in ${dir}`));
65673
66311
  return 1;
65674
66312
  }
65675
66313
  const cfg = studioConfigFromEnv();
65676
66314
  if (!cfg) {
65677
- console.error(chalk18.yellow("Studio not configured — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN."));
66315
+ console.error(chalk19.yellow("Studio not configured — set PARITY_STUDIO_URL and PARITY_STUDIO_TOKEN."));
65678
66316
  return 1;
65679
66317
  }
65680
66318
  if (opts.post) {
65681
66319
  const page = plan.pages.find((p) => p.path === opts.page);
65682
66320
  if (!page?.boardItemId) {
65683
- console.error(chalk18.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
66321
+ console.error(chalk19.red(`No synced card for page "${opts.page}" — run \`parity plan board --board studio\` first`));
65684
66322
  return 1;
65685
66323
  }
65686
66324
  await postParityComment(page.boardItemId, opts.post, cfg);
65687
- console.log(`${chalk18.green("✓")} comment posted on ${page.path}`);
66325
+ console.log(`${chalk19.green("✓")} comment posted on ${page.path}`);
65688
66326
  return 0;
65689
66327
  }
65690
66328
  const pages = plan.pages.filter((p) => p.boardItemId).filter((p) => !opts.page || p.path === opts.page).map((p) => ({ path: p.path, boardItemId: p.boardItemId }));
65691
66329
  if (!pages.length) {
65692
- console.error(chalk18.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
66330
+ console.error(chalk19.yellow("No page has a synced card yet — run `parity plan board --board studio` first."));
65693
66331
  return 1;
65694
66332
  }
65695
66333
  const notes = await fetchClientNotes(pages, cfg);
@@ -65698,33 +66336,33 @@ async function planNotesCommand(dir, opts) {
65698
66336
  return 0;
65699
66337
  }
65700
66338
  if (!notes.length) {
65701
- console.log(chalk18.gray(`
66339
+ console.log(chalk19.gray(`
65702
66340
  No open client notes.
65703
66341
  `));
65704
66342
  return 0;
65705
66343
  }
65706
- console.log(chalk18.bold(`
66344
+ console.log(chalk19.bold(`
65707
66345
  Client notes (${notes.length})`));
65708
66346
  for (const n of notes) {
65709
66347
  console.log(`
65710
- ${chalk18.cyan(n.path)} ${chalk18.gray(n.createdAt)}`);
66348
+ ${chalk19.cyan(n.path)} ${chalk19.gray(n.createdAt)}`);
65711
66349
  for (const line of n.body.split(`
65712
66350
  `))
65713
66351
  console.log(` ${line}`);
65714
66352
  }
65715
- console.log(chalk18.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'));
66353
+ console.log(chalk19.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'));
65716
66354
  return 0;
65717
66355
  }
65718
66356
 
65719
66357
  // src/commands/pr.ts
65720
- import { existsSync as existsSync19, readFileSync as readFileSync24, writeFileSync as writeFileSync25 } from "node:fs";
65721
- import { join as join30 } from "node:path";
65722
- import chalk21 from "chalk";
66358
+ import { existsSync as existsSync22, readFileSync as readFileSync28, writeFileSync as writeFileSync26 } from "node:fs";
66359
+ import { join as join34 } from "node:path";
66360
+ import chalk22 from "chalk";
65723
66361
 
65724
66362
  // src/commands/run.ts
65725
- import { existsSync as existsSync18, readFileSync as readFileSync23, unlinkSync as unlinkSync3 } from "node:fs";
65726
- import { join as join29 } from "node:path";
65727
- import chalk20 from "chalk";
66363
+ import { existsSync as existsSync21, readFileSync as readFileSync27, unlinkSync as unlinkSync3 } from "node:fs";
66364
+ import { join as join33 } from "node:path";
66365
+ import chalk21 from "chalk";
65728
66366
  import ora7 from "ora";
65729
66367
 
65730
66368
  // src/engine/interactive-module-prompt.ts
@@ -66159,14 +66797,14 @@ function pairedPathMismatches(prodPages, candPages) {
66159
66797
  const prod = prodPages.find((p) => p.pairKey === cand.pairKey);
66160
66798
  if (!prod)
66161
66799
  continue;
66162
- const prodPath = pathOf5(prod.url);
66163
- const candPath = pathOf5(cand.url);
66800
+ const prodPath = pathOf6(prod.url);
66801
+ const candPath = pathOf6(cand.url);
66164
66802
  if (prodPath && candPath && prodPath !== candPath)
66165
66803
  out.push(`${prodPath} → ${candPath}`);
66166
66804
  }
66167
66805
  return [...new Set(out)];
66168
66806
  }
66169
- function pathOf5(raw) {
66807
+ function pathOf6(raw) {
66170
66808
  try {
66171
66809
  return new URL(raw).pathname;
66172
66810
  } catch {
@@ -66261,13 +66899,13 @@ function formatMs(ms) {
66261
66899
  }
66262
66900
 
66263
66901
  // src/commands/serve.ts
66264
- import { existsSync as existsSync17 } from "node:fs";
66265
- import chalk19 from "chalk";
66902
+ import { existsSync as existsSync20 } from "node:fs";
66903
+ import chalk20 from "chalk";
66266
66904
 
66267
66905
  // src/server/proxy-server.ts
66268
- import { existsSync as existsSync16, readFileSync as readFileSync22, statSync } from "node:fs";
66906
+ import { existsSync as existsSync19, readFileSync as readFileSync26, statSync } from "node:fs";
66269
66907
  import { createServer } from "node:http";
66270
- import { extname, join as join28, normalize as normalize3, resolve as resolve6, sep } from "node:path";
66908
+ import { extname, join as join32, normalize as normalize3, resolve as resolve6, sep } from "node:path";
66271
66909
  var MIME3 = {
66272
66910
  ".html": "text/html; charset=utf-8",
66273
66911
  ".css": "text/css; charset=utf-8",
@@ -66304,7 +66942,7 @@ var STRIPPED_REQUEST_HEADERS = new Set([
66304
66942
  ]);
66305
66943
  async function startProxyServer(runDir, opts = {}) {
66306
66944
  const absRunDir = resolve6(runDir);
66307
- if (!existsSync16(absRunDir)) {
66945
+ if (!existsSync19(absRunDir)) {
66308
66946
  throw new Error(`Run directory not found: ${runDir}`);
66309
66947
  }
66310
66948
  const server = createServer((req, res) => {
@@ -66361,13 +66999,13 @@ async function handleRequest(req, res, runDir) {
66361
66999
  return serveStatic(res, runDir, path);
66362
67000
  }
66363
67001
  function serveReportHtml(res, runDir) {
66364
- const filePath = join28(runDir, "report.html");
66365
- if (!existsSync16(filePath)) {
67002
+ const filePath = join32(runDir, "report.html");
67003
+ if (!existsSync19(filePath)) {
66366
67004
  res.statusCode = 404;
66367
67005
  res.end("report.html not found");
66368
67006
  return;
66369
67007
  }
66370
- const html3 = readFileSync22(filePath, "utf8");
67008
+ const html3 = readFileSync26(filePath, "utf8");
66371
67009
  const inject = `<script>window.__parity_proxy = "/proxy?url=";</script>`;
66372
67010
  const out = html3.includes("</head>") ? html3.replace("</head>", `${inject}</head>`) : `${inject}${html3}`;
66373
67011
  res.statusCode = 200;
@@ -66383,7 +67021,7 @@ function serveStatic(res, runDir, path) {
66383
67021
  res.end("forbidden");
66384
67022
  return;
66385
67023
  }
66386
- if (!existsSync16(filePath)) {
67024
+ if (!existsSync19(filePath)) {
66387
67025
  res.statusCode = 404;
66388
67026
  res.end("not found");
66389
67027
  return;
@@ -66398,7 +67036,7 @@ function serveStatic(res, runDir, path) {
66398
67036
  res.statusCode = 200;
66399
67037
  res.setHeader("content-type", MIME3[ext] ?? "application/octet-stream");
66400
67038
  res.setHeader("cache-control", "no-store");
66401
- res.end(readFileSync22(filePath));
67039
+ res.end(readFileSync26(filePath));
66402
67040
  }
66403
67041
  async function proxyRequest(req, res, targetUrl, opts = {}) {
66404
67042
  let target;
@@ -66496,16 +67134,16 @@ async function serveRunAndBlock(runDir, opts = {}) {
66496
67134
  try {
66497
67135
  handle = await startProxyServer(runDir, { port: opts.port });
66498
67136
  } catch (err) {
66499
- console.error(chalk19.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
67137
+ console.error(chalk20.red(` ✖ Falha ao iniciar servidor: ${err.message}`));
66500
67138
  return 2;
66501
67139
  }
66502
67140
  const label = opts.label ?? "parity serve";
66503
67141
  console.log("");
66504
- console.log(chalk19.bold(` ${label}`));
66505
- console.log(` ${chalk19.green("●")} ${handle.url}`);
66506
- console.log(chalk19.dim(` Servindo: ${runDir}`));
66507
- console.log(chalk19.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
66508
- console.log(chalk19.dim(` Ctrl+C pra parar (2x pra forçar saída).
67142
+ console.log(chalk20.bold(` ${label}`));
67143
+ console.log(` ${chalk20.green("●")} ${handle.url}`);
67144
+ console.log(chalk20.dim(` Servindo: ${runDir}`));
67145
+ console.log(chalk20.dim(` Proxy de iframes: ${handle.url}proxy?url=<encoded>`));
67146
+ console.log(chalk20.dim(` Ctrl+C pra parar (2x pra forçar saída).
66509
67147
  `));
66510
67148
  if (opts.open !== false) {
66511
67149
  const { default: open2 } = await import("open");
@@ -66537,12 +67175,12 @@ async function serveRunAndBlock(runDir, opts = {}) {
66537
67175
  }
66538
67176
  async function serveCommand(runId, opts) {
66539
67177
  const paths = getRunPaths(opts.output, runId);
66540
- if (!existsSync17(paths.runDir)) {
66541
- console.error(chalk19.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
67178
+ if (!existsSync20(paths.runDir)) {
67179
+ console.error(chalk20.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
66542
67180
  return 1;
66543
67181
  }
66544
- if (!existsSync17(paths.reportHtml)) {
66545
- console.error(chalk19.red(`✖ report.html não existe em ${paths.runDir}`));
67182
+ if (!existsSync20(paths.reportHtml)) {
67183
+ console.error(chalk20.red(`✖ report.html não existe em ${paths.runDir}`));
66546
67184
  return 1;
66547
67185
  }
66548
67186
  return serveRunAndBlock(paths.runDir, {
@@ -66679,14 +67317,14 @@ function evaluateFailOnGate(allIssues, failOn) {
66679
67317
  async function runCommand(rawOpts) {
66680
67318
  if (!rawOpts.prod) {
66681
67319
  const target = rawOpts.cand ?? "<url>";
66682
- console.error(`${chalk20.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
66683
- For one site, use: ${chalk20.cyan(`parity e2e --url ${target}`)}
67320
+ console.error(`${chalk21.yellow("Single-site run?")} \`parity run\` compares two URLs (prod↔cand).
67321
+ For one site, use: ${chalk21.cyan(`parity e2e --url ${target}`)}
66684
67322
  (runs the functional flows + all checks in single-site mode — no prod baseline needed).`);
66685
67323
  return 2;
66686
67324
  }
66687
67325
  let opts = applyPreset(rawOpts);
66688
67326
  if (rawOpts.preset) {
66689
- console.log(chalk20.dim(` preset: ${rawOpts.preset}`));
67327
+ console.log(chalk21.dim(` preset: ${rawOpts.preset}`));
66690
67328
  }
66691
67329
  if (opts.pt)
66692
67330
  setLlmLanguage("pt");
@@ -66694,14 +67332,14 @@ async function runCommand(rawOpts) {
66694
67332
  disableInteractive();
66695
67333
  const llmCfgErr = applyLlmOptions(opts);
66696
67334
  if (llmCfgErr) {
66697
- console.error(chalk20.red(` ${llmCfgErr}`));
67335
+ console.error(chalk21.red(` ${llmCfgErr}`));
66698
67336
  return 2;
66699
67337
  }
66700
67338
  const llmStillAvailable = isLlmAvailable();
66701
67339
  const preSmart = opts;
66702
67340
  opts = applySmartDefaults(opts, llmStillAvailable);
66703
67341
  if (!llmStillAvailable && opts.visualPages !== preSmart.visualPages) {
66704
- console.log(chalk20.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
67342
+ console.log(chalk21.dim(" visual-pages auto-set to 0 (no LLM available — analysis layer would be skipped; opt in with --visual-pages N)"));
66705
67343
  }
66706
67344
  let interactivePromptShown = false;
66707
67345
  if (!opts.only && !opts.skip && !rawOpts.preset) {
@@ -66725,14 +67363,14 @@ async function runCommand(rawOpts) {
66725
67363
  const isContentProfile = profile === "content";
66726
67364
  if (isContentProfile && !opts.only && !opts.skip) {
66727
67365
  opts.only = "seo,visual,vitals,cache,console,html,network";
66728
- console.log(chalk20.dim(" profile: content → skipping e2e module (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force"));
67366
+ console.log(chalk21.dim(" profile: content → skipping e2e module (commerce purchase-journey/cart make no sense on a content site); pass --profile commerce to force"));
66729
67367
  }
66730
67368
  const selection = resolveSelection({ only: opts.only, skip: opts.skip });
66731
67369
  if (selection.errors.length > 0) {
66732
- console.error(chalk20.red(" --only/--skip: invalid value(s):"));
67370
+ console.error(chalk21.red(" --only/--skip: invalid value(s):"));
66733
67371
  for (const e of selection.errors)
66734
- console.error(chalk20.red(` - ${e}`));
66735
- console.error(chalk20.dim(`
67372
+ console.error(chalk21.red(` - ${e}`));
67373
+ console.error(chalk21.dim(`
66736
67374
  valid modules: ${Object.keys(MODULES).join(", ")}`));
66737
67375
  return 2;
66738
67376
  }
@@ -66743,11 +67381,11 @@ async function runCommand(rawOpts) {
66743
67381
  if (hasSelection) {
66744
67382
  const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
66745
67383
  flows2 = Array.from(new Set([...explicitFlows, ...selection.flows]));
66746
- console.log(chalk20.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows2.join(",")}`));
67384
+ console.log(chalk21.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows2.join(",")}`));
66747
67385
  } else {
66748
67386
  flows2 = opts.flows.split(",").map((s) => s.trim());
66749
67387
  if (!interactivePromptShown) {
66750
- console.log(chalk20.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
67388
+ console.log(chalk21.dim(" no --only/--skip given — running ALL modules; pass --only to scope the run for a lighter/faster result"));
66751
67389
  }
66752
67390
  }
66753
67391
  if (isContentProfile) {
@@ -66756,12 +67394,12 @@ async function runCommand(rawOpts) {
66756
67394
  if (!flows2.includes("homepage"))
66757
67395
  flows2.unshift("homepage");
66758
67396
  if (before2 !== flows2.join(",")) {
66759
- console.log(chalk20.dim(` profile: content → flows scoped to ${flows2.join(",")} (dropped plp/pdp; was: ${before2}); CEP skipped`));
67397
+ console.log(chalk21.dim(` profile: content → flows scoped to ${flows2.join(",")} (dropped plp/pdp; was: ${before2}); CEP skipped`));
66760
67398
  }
66761
67399
  }
66762
67400
  const pagesScopeWarning = pagesFlowsScopeWarning(opts, flows2);
66763
67401
  if (pagesScopeWarning) {
66764
- console.log(chalk20.dim(` ${pagesScopeWarning}`));
67402
+ console.log(chalk21.dim(` ${pagesScopeWarning}`));
66765
67403
  }
66766
67404
  if (hasSelection) {
66767
67405
  const needsSitemapPages = selection.modules.some((m) => MODULES[m].needsSitemapPages);
@@ -66770,12 +67408,12 @@ async function runCommand(rawOpts) {
66770
67408
  const VISUAL_PAGES_DEFAULT = 5;
66771
67409
  if (!needsSitemapPages && opts.vitalsPages === VITALS_PAGES_DEFAULT) {
66772
67410
  opts.vitalsPages = 0;
66773
- console.log(chalk20.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
67411
+ console.log(chalk21.dim(" vitals-pages auto-set to 0 (no selected module needs sitemap-page crawling)"));
66774
67412
  }
66775
67413
  if (!needsLlmPass && opts.visualPages === VISUAL_PAGES_DEFAULT) {
66776
67414
  opts.visualPages = 0;
66777
67415
  opts.noVisualDiff = true;
66778
- console.log(chalk20.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
67416
+ console.log(chalk21.dim(" visual-pages auto-set to 0 (no selected module needs the visual-diff pass)"));
66779
67417
  }
66780
67418
  }
66781
67419
  const viewports = opts.viewports.split(",").map((s) => s.trim());
@@ -66788,38 +67426,38 @@ async function runCommand(rawOpts) {
66788
67426
  }
66789
67427
  const ignore = loadParityIgnore();
66790
67428
  if (opts.clearCache) {
66791
- const cacheFile = join29(opts.output, "cache", "verdicts.json");
66792
- if (existsSync18(cacheFile)) {
67429
+ const cacheFile = join33(opts.output, "cache", "verdicts.json");
67430
+ if (existsSync21(cacheFile)) {
66793
67431
  try {
66794
67432
  unlinkSync3(cacheFile);
66795
- console.log(chalk20.dim(` cache wiped: ${cacheFile}`));
67433
+ console.log(chalk21.dim(` cache wiped: ${cacheFile}`));
66796
67434
  } catch (err) {
66797
- console.log(chalk20.yellow(` cache wipe falhou: ${err.message}`));
67435
+ console.log(chalk21.yellow(` cache wipe falhou: ${err.message}`));
66798
67436
  }
66799
67437
  }
66800
67438
  }
66801
67439
  const llmTimeoutRaw = opts.llmTimeout ?? 60;
66802
67440
  if (!Number.isFinite(llmTimeoutRaw)) {
66803
- console.error(chalk20.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
67441
+ console.error(chalk21.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
66804
67442
  return 2;
66805
67443
  }
66806
67444
  const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
66807
67445
  if (isLlmAvailable()) {
66808
- console.log(chalk20.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
67446
+ console.log(chalk21.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
66809
67447
  } else {
66810
- console.log(chalk20.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
67448
+ console.log(chalk21.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
66811
67449
  }
66812
67450
  if (isInteractiveMode()) {
66813
- console.log(chalk20.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
67451
+ console.log(chalk21.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
66814
67452
  }
66815
67453
  const primaryViewport = viewports[0] ?? "mobile";
66816
67454
  const preflight = await preflightCheck(opts.prod, opts.cand, primaryViewport);
66817
67455
  if (!preflight.ok) {
66818
- console.error(chalk20.red(`
67456
+ console.error(chalk21.red(`
66819
67457
  ✖ pre-flight falhou:`));
66820
67458
  for (const err of preflight.errors)
66821
- console.error(chalk20.red(` - ${err}`));
66822
- console.error(chalk20.dim(`
67459
+ console.error(chalk21.red(` - ${err}`));
67460
+ console.error(chalk21.dim(`
66823
67461
  dica: verifique se as URLs estão corretas e acessíveis`));
66824
67462
  return 2;
66825
67463
  }
@@ -66830,7 +67468,7 @@ async function runCommand(rawOpts) {
66830
67468
  if (prodHomeHtml) {
66831
67469
  platform = detectPlatform({ url: opts.prod, html: prodHomeHtml });
66832
67470
  if (platform !== "custom") {
66833
- console.log(chalk20.dim(` Detected platform: ${platform}`));
67471
+ console.log(chalk21.dim(` Detected platform: ${platform}`));
66834
67472
  }
66835
67473
  }
66836
67474
  const prodHost = hostOf3(opts.prod);
@@ -66865,11 +67503,11 @@ async function runCommand(rawOpts) {
66865
67503
  viewports,
66866
67504
  timestamp
66867
67505
  });
66868
- console.log(chalk20.bold(`
67506
+ console.log(chalk21.bold(`
66869
67507
  parity run ${runId}`));
66870
- console.log(chalk20.dim(` prod: ${opts.prod}`));
66871
- console.log(chalk20.dim(` cand: ${opts.cand}`));
66872
- console.log(chalk20.dim(` profile: ${profile} · flows: ${flows2.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
67508
+ console.log(chalk21.dim(` prod: ${opts.prod}`));
67509
+ console.log(chalk21.dim(` cand: ${opts.cand}`));
67510
+ console.log(chalk21.dim(` profile: ${profile} · flows: ${flows2.join(", ")} · viewports: ${viewports.join(", ")}${rc.cep ? ` · CEP: ${rc.cep}` : ""}
66873
67511
  `));
66874
67512
  const spinner = ora7("Launching browser…").start();
66875
67513
  let browser = null;
@@ -66881,7 +67519,7 @@ async function runCommand(rawOpts) {
66881
67519
  const min = Math.floor(elapsedSec / 60);
66882
67520
  const sec = elapsedSec % 60;
66883
67521
  const mmss = `${min.toString().padStart(2, "0")}:${sec.toString().padStart(2, "0")}`;
66884
- spinner.text = `${chalk20.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
67522
+ spinner.text = `${chalk21.dim(`⏱ ${mmss} ·`)} ${currentSpinnerLabel}`;
66885
67523
  };
66886
67524
  const setSpinnerLabel = (label) => {
66887
67525
  currentSpinnerLabel = label;
@@ -66984,9 +67622,9 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
66984
67622
  }
66985
67623
  const traceEnabled = process.env.PARITY_TRACE === "1";
66986
67624
  const runOneSide = async (viewport, side) => {
66987
- const baseUrl = side === "prod" ? opts.prod : opts.cand;
66988
- const harPath = join29(paths.harDir, `${viewport}-${side}.har`);
66989
- const tracePath = traceEnabled ? join29(paths.tracesDir, `${viewport}-${side}.zip`) : null;
67625
+ const baseUrl2 = side === "prod" ? opts.prod : opts.cand;
67626
+ const harPath = join33(paths.harDir, `${viewport}-${side}.har`);
67627
+ const tracePath = traceEnabled ? join33(paths.tracesDir, `${viewport}-${side}.zip`) : null;
66990
67628
  const ctx = await newContext(browser, {
66991
67629
  viewport,
66992
67630
  harPath,
@@ -67001,11 +67639,11 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67001
67639
  for (const flow of flows2) {
67002
67640
  const flowStart = Date.now();
67003
67641
  let lastStepTotal = 0;
67004
- const sideTag = side === "prod" ? chalk20.cyan("prod") : chalk20.magenta("cand");
67005
- const prefix = `${chalk20.dim(`[${viewport}/`)}${sideTag}${chalk20.dim("]")}`;
67642
+ const sideTag = side === "prod" ? chalk21.cyan("prod") : chalk21.magenta("cand");
67643
+ const prefix = `${chalk21.dim(`[${viewport}/`)}${sideTag}${chalk21.dim("]")}`;
67006
67644
  setSpinnerLabel(`${prefix} ${flow}: starting…`);
67007
67645
  const cap = await runFlow(flow, {
67008
- baseUrl,
67646
+ baseUrl: baseUrl2,
67009
67647
  side,
67010
67648
  viewport,
67011
67649
  rc,
@@ -67019,7 +67657,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67019
67657
  onStep: (event) => {
67020
67658
  if (event.phase === "start") {
67021
67659
  lastStepTotal = event.total;
67022
- setSpinnerLabel(`${prefix} ${flow} ${chalk20.dim(`${event.index}/${event.total}`)} ${event.name}…`);
67660
+ setSpinnerLabel(`${prefix} ${flow} ${chalk21.dim(`${event.index}/${event.total}`)} ${event.name}…`);
67023
67661
  }
67024
67662
  }
67025
67663
  });
@@ -67028,18 +67666,18 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67028
67666
  const target = lastStepTotal || recorded;
67029
67667
  const failed = cap.steps?.find((s) => s.status === "failed");
67030
67668
  const lastStep = cap.steps?.[cap.steps.length - 1];
67031
- const elapsedDim = chalk20.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
67032
- const counts = target > 0 ? chalk20.dim(`${okSteps}/${target}`) : "";
67669
+ const elapsedDim = chalk21.dim(`${((Date.now() - flowStart) / 1000).toFixed(1)}s`);
67670
+ const counts = target > 0 ? chalk21.dim(`${okSteps}/${target}`) : "";
67033
67671
  let glyph;
67034
67672
  let detail;
67035
67673
  if (failed) {
67036
- glyph = chalk20.red("✗");
67037
- detail = `stopped at ${chalk20.yellow(failed.name)}`;
67674
+ glyph = chalk21.red("✗");
67675
+ detail = `stopped at ${chalk21.yellow(failed.name)}`;
67038
67676
  } else if (target > 0 && okSteps < target) {
67039
- glyph = chalk20.yellow("▴");
67040
- detail = lastStep ? `ended at ${chalk20.dim(lastStep.name)}` : "incomplete";
67677
+ glyph = chalk21.yellow("▴");
67678
+ detail = lastStep ? `ended at ${chalk21.dim(lastStep.name)}` : "incomplete";
67041
67679
  } else {
67042
- glyph = chalk20.green("✓");
67680
+ glyph = chalk21.green("✓");
67043
67681
  detail = "";
67044
67682
  }
67045
67683
  const summary = `${glyph} ${prefix} ${flow} ${counts} ${detail} ${elapsedDim}`.replace(/\s+/g, " ").trim();
@@ -67101,7 +67739,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67101
67739
  const vitalsPagesLimit = opts.vitalsPages ?? vitalsPagesDefault;
67102
67740
  const vitalsRuns = Math.max(1, Number.parseInt(opts.runs, 10) || 1);
67103
67741
  if (candIsDevServer && vitalsPagesLimit > 0) {
67104
- console.log(chalk20.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
67742
+ console.log(chalk21.dim(` cand=localhost detectado — vitals-pages=${vitalsPagesLimit}, networkidle desabilitado (issue #55)`));
67105
67743
  }
67106
67744
  if (browser && vitalsPagesLimit > 0) {
67107
67745
  currentPhase = "vitals-pages";
@@ -67155,9 +67793,9 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67155
67793
  }
67156
67794
  let done = 0;
67157
67795
  await runWithConcurrency2(tasks, 4, async (task) => {
67158
- const baseUrl = task.side === "prod" ? opts.prod : opts.cand;
67159
- const fullUrl = new URL(task.path, baseUrl).toString();
67160
- const targetIsDevServer = isLocalhost(baseUrl);
67796
+ const baseUrl2 = task.side === "prod" ? opts.prod : opts.cand;
67797
+ const fullUrl = new URL(task.path, baseUrl2).toString();
67798
+ const targetIsDevServer = isLocalhost(baseUrl2);
67161
67799
  const PER_TASK_WALLCLOCK_MS = 35000 + Math.max(0, vitalsRuns - 1) * 8000;
67162
67800
  try {
67163
67801
  const ctx = await newContext(browser, {
@@ -67238,11 +67876,11 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67238
67876
  const visualPaths = explicitPaths ?? (await discoverPagesFromSitemap(opts.prod, { sampleSize: visualPagesLimit })).all.map((p) => ({ prod: p.path, cand: p.path }));
67239
67877
  const tasks = [];
67240
67878
  for (const viewport of viewports) {
67241
- for (const pair of visualPaths) {
67879
+ for (const pair2 of visualPaths) {
67242
67880
  for (const side of ["prod", "cand"]) {
67243
67881
  tasks.push({
67244
- path: side === "prod" ? pair.prod : pair.cand,
67245
- pairKey: pair.prod,
67882
+ path: side === "prod" ? pair2.prod : pair2.cand,
67883
+ pairKey: pair2.prod,
67246
67884
  viewport,
67247
67885
  side
67248
67886
  });
@@ -67256,8 +67894,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67256
67894
  visualSpinner.text = `Visual diff: capturando ${tasks.length} screenshot(s) (${visualPaths.length} páginas × ${viewports.length} viewport(s) × 2 sides)…`;
67257
67895
  let done = 0;
67258
67896
  await runWithConcurrency2(tasks, 4, async (task) => {
67259
- const baseUrl = task.side === "prod" ? opts.prod : opts.cand;
67260
- const fullUrl = new URL(task.path, baseUrl).toString();
67897
+ const baseUrl2 = task.side === "prod" ? opts.prod : opts.cand;
67898
+ const fullUrl = new URL(task.path, baseUrl2).toString();
67261
67899
  const safePath3 = task.path.replace(/[/?&=]+/g, "_") || "_root";
67262
67900
  const screenshotPath2 = `${paths.screenshotsDir}/visual-${safePath3}-${task.viewport}-${task.side}.png`;
67263
67901
  try {
@@ -67308,7 +67946,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67308
67946
  setSpinnerLabel("Rodando checks…");
67309
67947
  spinner.start();
67310
67948
  const checksHb = attachSpinnerHeartbeat(spinner, { baseText: "Rodando checks…" });
67311
- const cacheDir = join29(opts.output, "cache");
67949
+ const cacheDir = join33(opts.output, "cache");
67312
67950
  const checkCtx = {
67313
67951
  prodPages: allPageCaptures.filter((p) => p.side === "prod"),
67314
67952
  candPages: allPageCaptures.filter((p) => p.side === "cand"),
@@ -67438,7 +68076,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
67438
68076
  ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
67439
68077
  const failOnGate = evaluateFailOnGate(allIssues, failOn);
67440
68078
  if (failOnGate.exitCode === 1) {
67441
- console.log(chalk20.red(failOnGate.message));
68079
+ console.log(chalk21.red(failOnGate.message));
67442
68080
  return 1;
67443
68081
  }
67444
68082
  if (opts.open) {
@@ -67508,10 +68146,10 @@ function parsePagePair(entry) {
67508
68146
  }
67509
68147
  function resolveExplicitPages(pagesFile, pagesList) {
67510
68148
  if (pagesFile) {
67511
- if (!existsSync18(pagesFile)) {
68149
+ if (!existsSync21(pagesFile)) {
67512
68150
  throw new Error(`--pages-file não encontrado: ${pagesFile}`);
67513
68151
  }
67514
- const raw = readFileSync23(pagesFile, "utf-8");
68152
+ const raw = readFileSync27(pagesFile, "utf-8");
67515
68153
  const lines = raw.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0 && !l.startsWith("#"));
67516
68154
  return lines.map(parsePagePair);
67517
68155
  }
@@ -67662,48 +68300,48 @@ function hostOf3(url) {
67662
68300
  }
67663
68301
  function printSummary6(run, htmlPath, meta) {
67664
68302
  const { verdict: verdict2 } = run;
67665
- const emoji = verdict2.status === "pass" ? chalk20.green("✔") : verdict2.status === "warn" ? chalk20.yellow("⚠") : chalk20.red("✖");
67666
- const score = verdict2.status === "pass" ? chalk20.green(verdict2.score) : verdict2.status === "warn" ? chalk20.yellow(verdict2.score) : chalk20.red(verdict2.score);
68303
+ const emoji = verdict2.status === "pass" ? chalk21.green("✔") : verdict2.status === "warn" ? chalk21.yellow("⚠") : chalk21.red("✖");
68304
+ const score = verdict2.status === "pass" ? chalk21.green(verdict2.score) : verdict2.status === "warn" ? chalk21.yellow(verdict2.score) : chalk21.red(verdict2.score);
67667
68305
  const prev2 = run.previousRun;
67668
- const scoreDelta = !prev2 ? chalk20.dim(" (sem run anterior comparável)") : prev2.scoreDelta > 0 ? chalk20.green(` (+${prev2.scoreDelta} vs run anterior: ${prev2.score})`) : prev2.scoreDelta < 0 ? chalk20.red(` (${prev2.scoreDelta} vs run anterior: ${prev2.score})`) : chalk20.dim(` (= run anterior: ${prev2.score})`);
68306
+ const scoreDelta = !prev2 ? chalk21.dim(" (sem run anterior comparável)") : prev2.scoreDelta > 0 ? chalk21.green(` (+${prev2.scoreDelta} vs run anterior: ${prev2.score})`) : prev2.scoreDelta < 0 ? chalk21.red(` (${prev2.scoreDelta} vs run anterior: ${prev2.score})`) : chalk21.dim(` (= run anterior: ${prev2.score})`);
67669
68307
  console.log("");
67670
68308
  console.log(` ${emoji} parity ${verdict2.status.toUpperCase()} · score ${score}/100${scoreDelta}`);
67671
- console.log(` checks: ${chalk20.green(verdict2.checksPassed)} pass · ${chalk20.red(verdict2.checksFailed)} fail · ${chalk20.dim(`${verdict2.checksSkipped} skipped`)}`);
67672
- console.log(` issues: ${chalk20.red(verdict2.critical)} critical · ${chalk20.yellow(verdict2.high)} high · ${verdict2.medium} medium · ${chalk20.dim(`${verdict2.low} low`)}`);
68309
+ console.log(` checks: ${chalk21.green(verdict2.checksPassed)} pass · ${chalk21.red(verdict2.checksFailed)} fail · ${chalk21.dim(`${verdict2.checksSkipped} skipped`)}`);
68310
+ console.log(` issues: ${chalk21.red(verdict2.critical)} critical · ${chalk21.yellow(verdict2.high)} high · ${verdict2.medium} medium · ${chalk21.dim(`${verdict2.low} low`)}`);
67673
68311
  for (const c of run.caveats ?? []) {
67674
- const mark = c.level === "warn" ? chalk20.yellow("⚠") : chalk20.dim("ℹ");
68312
+ const mark = c.level === "warn" ? chalk21.yellow("⚠") : chalk21.dim("ℹ");
67675
68313
  console.log(` ${mark} ${c.summary}`);
67676
68314
  }
67677
68315
  if (run.moduleVerdicts && run.moduleVerdicts.length > 0) {
67678
68316
  const perModule = run.moduleVerdicts.map((mv) => {
67679
- const colored = mv.status === "pass" ? chalk20.green(mv.score) : mv.status === "warn" ? chalk20.yellow(mv.score) : chalk20.red(mv.score);
68317
+ const colored = mv.status === "pass" ? chalk21.green(mv.score) : mv.status === "warn" ? chalk21.yellow(mv.score) : chalk21.red(mv.score);
67680
68318
  return `${mv.module} ${colored}`;
67681
68319
  }).join(" · ");
67682
68320
  console.log(` modules: ${perModule} → composite ${score}`);
67683
68321
  }
67684
68322
  if (run.visualDiff) {
67685
68323
  const vd = run.visualDiff;
67686
- const parityIcon = vd.parityOk ? chalk20.green("✔") : chalk20.red("✖");
67687
- const parityLabel = vd.parityOk ? chalk20.green("OK") : chalk20.red("DIFFS");
67688
- const cacheNote = vd.pagesFromCache > 0 ? chalk20.dim(` · ${vd.pagesFromCache} cached`) : "";
67689
- console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk20.red(vd.pagesWithDiffs)} diffs · ${chalk20.green(vd.pagesPassed)} pass${cacheNote}`);
68324
+ const parityIcon = vd.parityOk ? chalk21.green("✔") : chalk21.red("✖");
68325
+ const parityLabel = vd.parityOk ? chalk21.green("OK") : chalk21.red("DIFFS");
68326
+ const cacheNote = vd.pagesFromCache > 0 ? chalk21.dim(` · ${vd.pagesFromCache} cached`) : "";
68327
+ console.log(` visual: ${parityIcon} parityOk=${parityLabel} · ${vd.pagesChecked} pages · ${chalk21.red(vd.pagesWithDiffs)} diffs · ${chalk21.green(vd.pagesPassed)} pass${cacheNote}`);
67690
68328
  }
67691
68329
  if (run.topIssues.length > 0) {
67692
68330
  console.log("");
67693
- console.log(chalk20.bold(" Top issues:"));
68331
+ console.log(chalk21.bold(" Top issues:"));
67694
68332
  for (const g of groupIssues(run.topIssues).slice(0, 5)) {
67695
68333
  const i = g.sample;
67696
- const sev = i.severity === "critical" ? chalk20.red(`[${i.severity}]`) : i.severity === "high" ? chalk20.yellow(`[${i.severity}]`) : chalk20.dim(`[${i.severity}]`);
67697
- const pagesNote = g.pages.length > 1 ? chalk20.dim(` (${g.pages.length} páginas)`) : "";
68334
+ const sev = i.severity === "critical" ? chalk21.red(`[${i.severity}]`) : i.severity === "high" ? chalk21.yellow(`[${i.severity}]`) : chalk21.dim(`[${i.severity}]`);
68335
+ const pagesNote = g.pages.length > 1 ? chalk21.dim(` (${g.pages.length} páginas)`) : "";
67698
68336
  console.log(` ${sev} ${i.summary}${pagesNote}`);
67699
68337
  }
67700
68338
  }
67701
68339
  if (meta.promotedCount > 0 || meta.deprecatedCount > 0) {
67702
68340
  console.log("");
67703
- console.log(chalk20.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk20.green(`+${meta.promotedCount}`)} promoted · ${chalk20.yellow(meta.deprecatedCount)} deprecated`));
68341
+ console.log(chalk21.dim(` \uD83D\uDCDA learned-selectors [${meta.platform}]: ${chalk21.green(`+${meta.promotedCount}`)} promoted · ${chalk21.yellow(meta.deprecatedCount)} deprecated`));
67704
68342
  }
67705
68343
  console.log("");
67706
- console.log(chalk20.dim(` → ${htmlPath}`));
68344
+ console.log(chalk21.dim(` → ${htmlPath}`));
67707
68345
  console.log("");
67708
68346
  }
67709
68347
 
@@ -67727,26 +68365,26 @@ async function prCommand(opts) {
67727
68365
  preset: opts.preset ?? "ci",
67728
68366
  open: false
67729
68367
  };
67730
- console.log(chalk21.dim(` prod : ${opts.prod}`));
67731
- console.log(chalk21.dim(` preview : ${opts.preview}`));
68368
+ console.log(chalk22.dim(` prod : ${opts.prod}`));
68369
+ console.log(chalk22.dim(` preview : ${opts.preview}`));
67732
68370
  console.log("");
67733
68371
  const runCode = await runCommand(runOpts);
67734
68372
  const runs = listRuns(opts.output);
67735
68373
  if (runs.length === 0) {
67736
- console.error(chalk21.red("no run was produced — cannot build PR comment"));
68374
+ console.error(chalk22.red("no run was produced — cannot build PR comment"));
67737
68375
  return runCode || 1;
67738
68376
  }
67739
68377
  const latest = runs[0];
67740
- const reportJsonPath = join30(opts.output, "runs", latest.id, "report.json");
67741
- if (!existsSync19(reportJsonPath)) {
67742
- console.error(chalk21.red(`report.json not found at ${reportJsonPath}`));
68378
+ const reportJsonPath = join34(opts.output, "runs", latest.id, "report.json");
68379
+ if (!existsSync22(reportJsonPath)) {
68380
+ console.error(chalk22.red(`report.json not found at ${reportJsonPath}`));
67743
68381
  return runCode || 1;
67744
68382
  }
67745
- const run = JSON.parse(readFileSync24(reportJsonPath, "utf8"));
68383
+ const run = JSON.parse(readFileSync28(reportJsonPath, "utf8"));
67746
68384
  const markdown = buildPrComment(run, opts);
67747
68385
  if (opts.out) {
67748
- writeFileSync25(opts.out, markdown, "utf8");
67749
- console.log(chalk21.dim(` wrote PR comment: ${opts.out}`));
68386
+ writeFileSync26(opts.out, markdown, "utf8");
68387
+ console.log(chalk22.dim(` wrote PR comment: ${opts.out}`));
67750
68388
  } else {
67751
68389
  process.stdout.write(`
67752
68390
  ${markdown}
@@ -67754,9 +68392,9 @@ ${markdown}
67754
68392
  }
67755
68393
  if (opts.github && process.env.GITHUB_STEP_SUMMARY) {
67756
68394
  try {
67757
- writeFileSync25(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
68395
+ writeFileSync26(process.env.GITHUB_STEP_SUMMARY, markdown, { flag: "a" });
67758
68396
  } catch (err) {
67759
- console.error(chalk21.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
68397
+ console.error(chalk22.yellow(`failed to write GITHUB_STEP_SUMMARY: ${err.message}`));
67760
68398
  }
67761
68399
  }
67762
68400
  return runCode;
@@ -67815,14 +68453,14 @@ function buildPrComment(run, opts) {
67815
68453
  }
67816
68454
 
67817
68455
  // src/commands/prompt.ts
67818
- import { existsSync as existsSync20, writeFileSync as writeFileSync26 } from "node:fs";
67819
- import chalk22 from "chalk";
68456
+ import { existsSync as existsSync23, writeFileSync as writeFileSync27 } from "node:fs";
68457
+ import chalk23 from "chalk";
67820
68458
  function promptCommand(runId, opts) {
67821
68459
  let run;
67822
68460
  try {
67823
68461
  run = loadRun(opts.output, runId);
67824
68462
  } catch (err) {
67825
- console.error(chalk22.red(`✖ ${err.message}`));
68463
+ console.error(chalk23.red(`✖ ${err.message}`));
67826
68464
  return 1;
67827
68465
  }
67828
68466
  const md = buildLlmPrompt(run, {
@@ -67830,11 +68468,11 @@ function promptCommand(runId, opts) {
67830
68468
  limit: opts.limit
67831
68469
  });
67832
68470
  if (opts.out) {
67833
- writeFileSync26(opts.out, md, "utf8");
67834
- console.log(chalk22.green(`✔ prompt salvo em ${opts.out}`));
67835
- if (existsSync20(opts.out)) {
68471
+ writeFileSync27(opts.out, md, "utf8");
68472
+ console.log(chalk23.green(`✔ prompt salvo em ${opts.out}`));
68473
+ if (existsSync23(opts.out)) {
67836
68474
  const sizeKb = (md.length / 1024).toFixed(1);
67837
- console.log(chalk22.dim(` ${md.length} chars (${sizeKb} KB)`));
68475
+ console.log(chalk23.dim(` ${md.length} chars (${sizeKb} KB)`));
67838
68476
  }
67839
68477
  } else {
67840
68478
  process.stdout.write(md);
@@ -67843,9 +68481,9 @@ function promptCommand(runId, opts) {
67843
68481
  }
67844
68482
 
67845
68483
  // src/commands/report.ts
67846
- import { existsSync as existsSync21, readFileSync as readFileSync25, writeFileSync as writeFileSync27 } from "node:fs";
67847
- import { join as join31 } from "node:path";
67848
- import chalk23 from "chalk";
68484
+ import { existsSync as existsSync24, readFileSync as readFileSync29, writeFileSync as writeFileSync28 } from "node:fs";
68485
+ import { join as join35 } from "node:path";
68486
+ import chalk24 from "chalk";
67849
68487
  import open2 from "open";
67850
68488
 
67851
68489
  // src/report/deck-template.ts
@@ -68360,7 +68998,7 @@ function extractVitalsSlice(run) {
68360
68998
  for (const p of fc.pages) {
68361
68999
  if (!p.vitals)
68362
69000
  continue;
68363
- const k = `${p.side}::${p.viewport}::${pathOf6(p.url)}`;
69001
+ const k = `${p.side}::${p.viewport}::${pathOf7(p.url)}`;
68364
69002
  out[k] = p.vitalsFullPage ? { ...p.vitals, fullPage: p.vitalsFullPage } : p.vitals;
68365
69003
  }
68366
69004
  }
@@ -68405,8 +69043,8 @@ function extractSideBySideSlice(run) {
68405
69043
  for (const p of fc.pages) {
68406
69044
  if (p.side !== "prod")
68407
69045
  continue;
68408
- const candPath = pathOf6(p.url);
68409
- const cand = fc.pages.find((q) => q.side === "cand" && pathOf6(q.url) === candPath && q.viewport === p.viewport);
69046
+ const candPath = pathOf7(p.url);
69047
+ const cand = fc.pages.find((q) => q.side === "cand" && pathOf7(q.url) === candPath && q.viewport === p.viewport);
68410
69048
  if (!cand)
68411
69049
  continue;
68412
69050
  pairs.push({
@@ -68419,7 +69057,7 @@ function extractSideBySideSlice(run) {
68419
69057
  }
68420
69058
  return pairs;
68421
69059
  }
68422
- function pathOf6(url) {
69060
+ function pathOf7(url) {
68423
69061
  try {
68424
69062
  return new URL(url).pathname || "/";
68425
69063
  } catch {
@@ -68435,24 +69073,24 @@ async function reportCommand(runId, opts) {
68435
69073
  try {
68436
69074
  run = loadRun(opts.output, runId);
68437
69075
  } catch (err) {
68438
- console.error(chalk23.red(`failed to load run: ${err.message}`));
69076
+ console.error(chalk24.red(`failed to load run: ${err.message}`));
68439
69077
  return 1;
68440
69078
  }
68441
69079
  const html3 = renderDeckHtml(buildDeckModel(run), opts.lang ?? "en");
68442
- const dest = opts.out ?? join31(paths.runDir, "deck.html");
68443
- writeFileSync27(dest, html3, "utf8");
68444
- console.log(`${chalk23.green("✓")} deck → ${dest}`);
69080
+ const dest = opts.out ?? join35(paths.runDir, "deck.html");
69081
+ writeFileSync28(dest, html3, "utf8");
69082
+ console.log(`${chalk24.green("✓")} deck → ${dest}`);
68445
69083
  if (opts.open) {
68446
69084
  await open2(dest).catch((err) => {
68447
- console.error(chalk23.red(`failed to open: ${err.message}`));
69085
+ console.error(chalk24.red(`failed to open: ${err.message}`));
68448
69086
  });
68449
69087
  }
68450
69088
  return 0;
68451
69089
  }
68452
69090
  if (opts.section) {
68453
69091
  if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
68454
- console.error(chalk23.red(`unknown section "${opts.section}"`));
68455
- console.error(chalk23.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
69092
+ console.error(chalk24.red(`unknown section "${opts.section}"`));
69093
+ console.error(chalk24.gray(` valid: ${ALL_REPORT_SECTIONS.join(", ")}`));
68456
69094
  return 1;
68457
69095
  }
68458
69096
  if (opts.json) {
@@ -68460,42 +69098,42 @@ async function reportCommand(runId, opts) {
68460
69098
  const run = loadRun(opts.output, runId);
68461
69099
  const payload = extractReportSection({ kind: "json", section: opts.section, run });
68462
69100
  if (payload === null) {
68463
- console.error(chalk23.red(`section "${opts.section}" not present in this run`));
69101
+ console.error(chalk24.red(`section "${opts.section}" not present in this run`));
68464
69102
  return 1;
68465
69103
  }
68466
69104
  process.stdout.write(`${JSON.stringify(payload, null, 2)}
68467
69105
  `);
68468
69106
  return 0;
68469
69107
  } catch (err) {
68470
- console.error(chalk23.red(`failed to load run: ${err.message}`));
69108
+ console.error(chalk24.red(`failed to load run: ${err.message}`));
68471
69109
  return 1;
68472
69110
  }
68473
69111
  }
68474
- if (!existsSync21(paths.reportHtml)) {
68475
- console.error(chalk23.red(`report.html not found at ${paths.reportHtml}`));
69112
+ if (!existsSync24(paths.reportHtml)) {
69113
+ console.error(chalk24.red(`report.html not found at ${paths.reportHtml}`));
68476
69114
  return 1;
68477
69115
  }
68478
- const html3 = readFileSync25(paths.reportHtml, "utf8");
69116
+ const html3 = readFileSync29(paths.reportHtml, "utf8");
68479
69117
  const slice2 = extractReportSection({ kind: "html", section: opts.section, html: html3 });
68480
69118
  if (slice2 === null) {
68481
- console.error(chalk23.red(`section "${opts.section}" not present in this report`));
69119
+ console.error(chalk24.red(`section "${opts.section}" not present in this report`));
68482
69120
  return 1;
68483
69121
  }
68484
69122
  process.stdout.write(slice2);
68485
69123
  return 0;
68486
69124
  }
68487
- console.log(chalk23.dim(`opening ${paths.reportHtml}`));
69125
+ console.log(chalk24.dim(`opening ${paths.reportHtml}`));
68488
69126
  await open2(paths.reportHtml).catch((err) => {
68489
- console.error(chalk23.red(`failed to open: ${err.message}`));
69127
+ console.error(chalk24.red(`failed to open: ${err.message}`));
68490
69128
  });
68491
69129
  return 0;
68492
69130
  }
68493
69131
 
68494
69132
  // src/commands/vitals.ts
68495
- import { existsSync as existsSync22, readFileSync as readFileSync26, writeFileSync as writeFileSync28 } from "node:fs";
69133
+ import { existsSync as existsSync25, readFileSync as readFileSync30, writeFileSync as writeFileSync29 } from "node:fs";
68496
69134
  import { availableParallelism } from "node:os";
68497
- import { join as join32 } from "node:path";
68498
- import chalk24 from "chalk";
69135
+ import { join as join36 } from "node:path";
69136
+ import chalk25 from "chalk";
68499
69137
  import ora8 from "ora";
68500
69138
 
68501
69139
  // src/checks/agentic-nav.ts
@@ -68751,9 +69389,9 @@ function lighthouseScores(ctx) {
68751
69389
  const start = Date.now();
68752
69390
  const { pairs } = pairCaptures(ctx.prodPages, ctx.candPages);
68753
69391
  const issues = [];
68754
- for (const pair of pairs) {
68755
- const prod = pair.prod.lhScores;
68756
- const cand = pair.cand.lhScores;
69392
+ for (const pair2 of pairs) {
69393
+ const prod = pair2.prod.lhScores;
69394
+ const cand = pair2.cand.lhScores;
68757
69395
  if (!prod || !cand)
68758
69396
  continue;
68759
69397
  for (const { key: key2, label } of CATEGORIES) {
@@ -68765,12 +69403,12 @@ function lighthouseScores(ctx) {
68765
69403
  if (delta >= -REGRESSION_DELTA)
68766
69404
  continue;
68767
69405
  issues.push({
68768
- id: `lh-score:${key2}:${pair.key}`,
69406
+ id: `lh-score:${key2}:${pair2.key}`,
68769
69407
  severity: -delta >= 10 ? "high" : "medium",
68770
69408
  category: key2 === "seo" ? "seo" : key2 === "accessibility" ? "a11y" : "performance",
68771
- page: pair.key,
69409
+ page: pair2.key,
68772
69410
  check: "lighthouse-scores",
68773
- summary: `${label} regrediu em ${pair.key}: cand ${c} vs prod ${p} (${delta})`,
69411
+ summary: `${label} regrediu em ${pair2.key}: cand ${c} vs prod ${p} (${delta})`,
68774
69412
  details: `Objetivo da migração é igual ou melhor. ${label}: prod=${p}, cand=${c}. Recupere pelo menos o nível de prod.`
68775
69413
  });
68776
69414
  }
@@ -68793,10 +69431,10 @@ async function vitalsCommand(opts) {
68793
69431
  const runId = newRunId();
68794
69432
  const paths = createRunDir(opts.output, runId);
68795
69433
  const t0 = Date.now();
68796
- console.log(chalk24.bold(`
69434
+ console.log(chalk25.bold(`
68797
69435
  parity vitals ${runId}`));
68798
- console.log(chalk24.dim(` prod: ${opts.prod}`));
68799
- console.log(chalk24.dim(` cand: ${opts.cand}`));
69436
+ console.log(chalk25.dim(` prod: ${opts.prod}`));
69437
+ console.log(chalk25.dim(` cand: ${opts.cand}`));
68800
69438
  const discoverSpinner = ora8("Descobrindo páginas…").start();
68801
69439
  const pagePaths = await discoverPagePaths2(opts.prod, opts);
68802
69440
  if (pagePaths.length === 0) {
@@ -68828,12 +69466,12 @@ async function vitalsCommand(opts) {
68828
69466
  completed++;
68829
69467
  const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
68830
69468
  const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
68831
- progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk24.cyan("prod") : chalk24.magenta("cand")} ${task.path} (${task.viewport})`;
69469
+ progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk25.cyan("prod") : chalk25.magenta("cand")} ${task.path} (${task.viewport})`;
68832
69470
  }
68833
69471
  });
68834
69472
  progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
68835
69473
  if (opts.lighthouse !== false) {
68836
- const lhDir = join32(paths.runDir, "lighthouse");
69474
+ const lhDir = join36(paths.runDir, "lighthouse");
68837
69475
  const lhCap = opts.lighthouseConcurrency ?? Math.max(1, Math.min(2, Math.floor(availableParallelism() / 2)));
68838
69476
  const done = tasks.filter((t) => !!t.capture);
68839
69477
  const lhT0 = Date.now();
@@ -68857,7 +69495,7 @@ async function vitalsCommand(opts) {
68857
69495
  }
68858
69496
  lhCompleted++;
68859
69497
  const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
68860
- lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk24.cyan("prod") : chalk24.magenta("cand")} ${task.path} (${task.viewport})`;
69498
+ lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk25.cyan("prod") : chalk25.magenta("cand")} ${task.path} (${task.viewport})`;
68861
69499
  });
68862
69500
  lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
68863
69501
  }
@@ -68924,7 +69562,7 @@ async function vitalsCommand(opts) {
68924
69562
  writeRunReportJson(paths.runDir, run);
68925
69563
  const html3 = renderHtmlReport(run, paths.runDir);
68926
69564
  writeRunReportHtml(paths.runDir, html3);
68927
- writeFileSync28(join32(paths.runDir, "vitals.json"), `${JSON.stringify({
69565
+ writeFileSync29(join36(paths.runDir, "vitals.json"), `${JSON.stringify({
68928
69566
  schemaVersion: "0.1",
68929
69567
  prodUrl: opts.prod,
68930
69568
  candUrl: opts.cand,
@@ -68937,8 +69575,8 @@ async function vitalsCommand(opts) {
68937
69575
  `, "utf8");
68938
69576
  printSummary7(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
68939
69577
  console.log("");
68940
- console.log(chalk24.dim(` → ${paths.reportHtml}`));
68941
- console.log(chalk24.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
69578
+ console.log(chalk25.dim(` → ${paths.reportHtml}`));
69579
+ console.log(chalk25.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
68942
69580
  console.log("");
68943
69581
  if (opts.open) {
68944
69582
  const { default: open3 } = await import("open");
@@ -69028,8 +69666,8 @@ async function discoverPagePaths2(prodUrl, opts) {
69028
69666
  function parseUrlList(input) {
69029
69667
  if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
69030
69668
  const path = input.replace(/^file:\/\//, "");
69031
- if (existsSync22(path)) {
69032
- return readFileSync26(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
69669
+ if (existsSync25(path)) {
69670
+ return readFileSync30(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
69033
69671
  }
69034
69672
  }
69035
69673
  return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
@@ -69047,7 +69685,7 @@ async function runWithConcurrency3(items, workers, fn) {
69047
69685
  }
69048
69686
  function printSummary7(vitals, cache, scores, opportunities, agentic) {
69049
69687
  console.log("");
69050
- console.log(chalk24.bold(" Summary:"));
69688
+ console.log(chalk25.bold(" Summary:"));
69051
69689
  console.log(` ${vitals.summary}`);
69052
69690
  console.log(` ${cache.summary}`);
69053
69691
  if (scores.status !== "skipped")
@@ -69059,16 +69697,16 @@ function printSummary7(vitals, cache, scores, opportunities, agentic) {
69059
69697
  }
69060
69698
 
69061
69699
  // src/util/version.ts
69062
- import { readFileSync as readFileSync27 } from "node:fs";
69063
- import { dirname as dirname5, resolve as resolve7 } from "node:path";
69700
+ import { readFileSync as readFileSync31 } from "node:fs";
69701
+ import { dirname as dirname6, resolve as resolve7 } from "node:path";
69064
69702
  import { fileURLToPath } from "node:url";
69065
69703
  function getPackageVersion() {
69066
69704
  try {
69067
- const here = dirname5(fileURLToPath(import.meta.url));
69705
+ const here = dirname6(fileURLToPath(import.meta.url));
69068
69706
  for (const up of ["..", "../..", "../../.."]) {
69069
69707
  try {
69070
69708
  const pkgPath = resolve7(here, up, "package.json");
69071
- const raw = readFileSync27(pkgPath, "utf8");
69709
+ const raw = readFileSync31(pkgPath, "utf8");
69072
69710
  const parsed = JSON.parse(raw);
69073
69711
  if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
69074
69712
  return parsed.version;
@@ -69161,6 +69799,42 @@ program.command("plan").description("Inspect/update the migration-plan.json comp
69161
69799
  })).addCommand(new Command("verify").description("Record that a component was actually compared against its reference. A `done` row with no verification only means the code exists.").argument("<name>", "Component name (case- and separator-insensitive)").argument("<verdict>", "pass | fail").option("--note <text>", "What was seen").option("--at <iso>", "Timestamp (default: now)").option("--dir <path>", "Directory holding migration-plan.json (default: the target repo's .parity/)", ".parity").action((name, verdict2, opts) => {
69162
69800
  process.exit(planVerifyCommand(opts.dir, name, verdict2, { note: opts.note, at: opts.at }));
69163
69801
  }));
69802
+ program.command("cms").description("Read and write VTEX Content Platform entries — the CMS behind FastStore v4. Every write is a commit on a branch carrying the baseHash it was read at, so a concurrent edit fails the commit instead of silently winning. Needs PARITY_CMS_ACCOUNT + PARITY_CMS_STORE and a `vtex login` session (or PARITY_CMS_TOKEN).").addCommand(new Command("doctor").description("Compare the sections the repo declares against the ones published on the account. A section that exists in code but was never uploaded commits fine and renders nothing — this is the check that catches it.").option("--repo <path>", "Repo holding cms/faststore/pages/", ".").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
69803
+ process.exit(await cmsDoctorCommand({ repo: opts.repo, json: Boolean(opts.json) }));
69804
+ })).addCommand(new Command("ls").description("List entries, or branches with --branches. Branch ids are what every write needs.").option("--content-type <name>", "Filter by content type (home, landingPage, plp, ...)").option("--branches", "List branches instead of entries", false).option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
69805
+ process.exit(await cmsLsCommand({
69806
+ contentType: opts.contentType,
69807
+ branches: Boolean(opts.branches),
69808
+ json: Boolean(opts.json)
69809
+ }));
69810
+ })).addCommand(new Command("pull").description("Write one entry to a local JSON file, in the authoring shape. The file carries entryId, contentType, branch and baseHash, so push needs no flags.").requiredOption("--content-type <name>", "home, landingPage, plp, ...").requiredOption("--entry <id>", "Entry id (from `parity cms ls`)").requiredOption("--branch <id>", "Branch id, or main").option("--out <path>", "Output file (default: parity-output/cms/<contentType>-<entry>.json)").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
69811
+ process.exit(await cmsPullCommand({
69812
+ contentType: opts.contentType,
69813
+ entry: opts.entry,
69814
+ branch: opts.branch,
69815
+ out: opts.out,
69816
+ json: Boolean(opts.json)
69817
+ }));
69818
+ })).addCommand(new Command("diff").description("Compare a pulled file against the branch it came from. Exit 1 when they differ.").requiredOption("--file <path>", "File written by `parity cms pull`").option("--branch <id>", "Compare against a different branch").option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
69819
+ process.exit(await cmsDiffCommand({ file: opts.file, branch: opts.branch, json: Boolean(opts.json) }));
69820
+ })).addCommand(new Command("push").description("Commit a pulled file back. Dry run unless --yes. Refuses main without --allow-main, refuses a stale baseHash, refuses sections the account cannot render, and backs the remote up before writing.").requiredOption("--file <path>", "File written by `parity cms pull`").option("--branch <id>", "Target branch (default: the branch in the file)").option("--message <text>", "Commit message", "parity cms push").option("--author <email>", "Commit author", "parity").option("--yes", "Actually write. Without it, this is a dry run.", false).option("--allow-main", "Permit committing straight to main", false).option("--json", "Emit structured JSON instead of human-readable text", false).action(async (opts) => {
69821
+ process.exit(await cmsPushCommand({
69822
+ file: opts.file,
69823
+ branch: opts.branch,
69824
+ message: opts.message,
69825
+ author: opts.author,
69826
+ yes: Boolean(opts.yes),
69827
+ allowMain: Boolean(opts.allowMain),
69828
+ json: Boolean(opts.json)
69829
+ }));
69830
+ })).addCommand(new Command("undo").description("Drop an entry's changes on a branch — the platform's own rollback. Dry run unless --yes.").requiredOption("--entry <id>", "Entry id").requiredOption("--branch <id>", "Branch id").option("--yes", "Actually revert. Without it, this is a dry run.", false).option("--allow-main", "Permit reverting on main", false).action(async (opts) => {
69831
+ process.exit(await cmsUndoCommand({
69832
+ entry: opts.entry,
69833
+ branch: opts.branch,
69834
+ yes: Boolean(opts.yes),
69835
+ allowMain: Boolean(opts.allowMain)
69836
+ }));
69837
+ }));
69164
69838
  program.command("serve").argument("<runId>", "Run ID to serve").description("Spawns a local HTTP server that serves the report and proxies external iframes (strips X-Frame-Options/CSP), making the Side-by-side tab functional for any site.").option("--output <dir>", "Output directory where runs live", "./parity-output").option("--port <n>", "Fixed port (default: auto-pick free port)", (v) => Number(v)).option("--no-open", "Don't open the browser automatically").action(async (runId, opts) => {
69165
69839
  process.exit(await serveCommand(runId, opts));
69166
69840
  });