@decocms/parity 0.35.11 → 0.35.13

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +338 -252
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -75,7 +75,7 @@ Three providers, auto-detected in this order — **none required** if you have t
75
75
 
76
76
  Force with `--llm <anthropic|openrouter|claude-code|none|auto>`. Override per-feature with `--llm-model visual-diff=claude-opus-5,explain=claude-opus-5`, or flatten everything to one tier with `--llm-tier-default <haiku|sonnet|opus>`. Default tiers: **Sonnet** for selector discovery / recovery / matching / vision / aggregation (the structural-reasoning calls), **Haiku** for short copy-list classification (`search-terms`), **Opus** for `explain`. Cost-conscious? Try `--llm-tier-default haiku` and bump features back to Sonnet selectively if you hit selector misses.
77
77
 
78
- Without any provider, the CLI still runs and outputs raw check results — only the LLM-tagged tabs (Visual Diff, LLM Prompt) hide themselves and a banner explains why.
78
+ Without any provider, the CLI still runs and outputs raw check results.
79
79
 
80
80
  ## Output
81
81
 
package/dist/cli.js CHANGED
@@ -78911,6 +78911,57 @@ function extractSectionIds(entries) {
78911
78911
  return out;
78912
78912
  }
78913
78913
 
78914
+ // src/checks/lib/html-snapshot.ts
78915
+ function htmlUnread(page) {
78916
+ return page.htmlSnapshotFailed === true || !page.html;
78917
+ }
78918
+ function withHtmlSnapshot(check) {
78919
+ const guarded = async (ctx) => {
78920
+ const unread = new Map;
78921
+ for (const [side, pages] of [
78922
+ ["prod", ctx.prodPages],
78923
+ ["cand", ctx.candPages]
78924
+ ]) {
78925
+ const readKeys = new Set(pages.filter((p) => !htmlUnread(p)).map(captureKey));
78926
+ for (const p of pages) {
78927
+ const key = captureKey(p);
78928
+ if (readKeys.has(key))
78929
+ continue;
78930
+ const entry = unread.get(key) ?? { sides: [], page: p };
78931
+ if (!entry.sides.includes(side))
78932
+ entry.sides.push(side);
78933
+ unread.set(key, entry);
78934
+ }
78935
+ }
78936
+ if (unread.size === 0)
78937
+ return check(ctx);
78938
+ const keep = (pages) => pages.filter((p) => !unread.has(captureKey(p)));
78939
+ const result = await check({
78940
+ ...ctx,
78941
+ prodPages: keep(ctx.prodPages),
78942
+ candPages: keep(ctx.candPages)
78943
+ });
78944
+ const issues = [...unread].map(([key, { sides, page }]) => ({
78945
+ id: `${result.name}:snapshot-missing:${key}`,
78946
+ severity: "low",
78947
+ inconclusive: true,
78948
+ category: "functional",
78949
+ page: key,
78950
+ check: result.name,
78951
+ summary: `HTML não capturado em ${sides.join(" e ")} (${key}) — página não comparada por ${result.name}`,
78952
+ details: "The page answered but its HTML snapshot came back empty (capture budget spent or the read failed), so this check had nothing to judge on that side. Not a finding: re-run the page, or capture it with `parity html --url`.",
78953
+ evidence: page.screenshotPath ? [{ kind: "screenshot", path: page.screenshotPath }] : []
78954
+ }));
78955
+ return {
78956
+ ...result,
78957
+ status: result.status === "pass" ? "warn" : result.status,
78958
+ issues: [...result.issues, ...issues]
78959
+ };
78960
+ };
78961
+ Object.defineProperty(guarded, "name", { value: check.name });
78962
+ return guarded;
78963
+ }
78964
+
78914
78965
  // src/checks/login-flow.ts
78915
78966
  var STEP_LABELS = {
78916
78967
  "visit-home": "Visitar home",
@@ -79842,35 +79893,66 @@ function matchAny(text, patterns) {
79842
79893
 
79843
79894
  // src/checks/picture-missing-dims.ts
79844
79895
  init_esm10();
79896
+ var FIX = "Adicione width + height (ou aspect-ratio) ao <img> dentro do <Picture>. Use as dimensões intrínsecas da imagem ou as do design (a media query é tratada pelo <source>).";
79845
79897
  function pictureMissingDims(ctx) {
79846
79898
  const start = Date.now();
79847
79899
  const issues = [];
79848
- const offendersByPage = new Map;
79849
- for (const cand of ctx.candPages) {
79850
- const offenders = scanForPictureMissingDims(cand);
79851
- if (offenders.length > 0) {
79852
- offendersByPage.set(`${cand.viewport}:${cand.url}`, offenders);
79853
- }
79854
- }
79855
- for (const [key, offenders] of offendersByPage) {
79856
- issues.push({
79900
+ const single = ctx.prodPages.length === 0;
79901
+ const prodByKey = new Map(ctx.prodPages.map((p) => [captureKey(p), p]));
79902
+ const candByKey = new Map(ctx.candPages.map((c) => [captureKey(c), c]));
79903
+ for (const [pairKey, cand] of candByKey) {
79904
+ const offenders = scanOffenders(cand);
79905
+ if (offenders.length === 0)
79906
+ continue;
79907
+ const key = `${cand.viewport}:${cand.url}`;
79908
+ const base = {
79857
79909
  id: `picture-missing-dims:${key}`,
79858
- severity: "medium",
79859
79910
  category: "performance",
79860
79911
  page: key,
79861
79912
  check: "picture-missing-dims",
79862
- summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — risco de CLS`,
79863
- details: [
79864
- "Picture/img fallbacks sem width+height fazem o browser não reservar espaço",
79865
- "antes do decode. Em network lento, isso vira layout-shift visível.",
79866
- "",
79867
- "Elementos afetados (até 10 mostrados):",
79868
- ...offenders.slice(0, 10).map((s, i) => ` ${i + 1}. ${s}`),
79869
- offenders.length > 10 ? ` … e mais ${offenders.length - 10}` : ""
79870
- ].filter(Boolean).join(`
79871
- `),
79872
- suggestedFix: "Adicione width + height (ou aspect-ratio) ao <img> dentro do <Picture>. Use as dimensões intrínsecas da imagem ou as do design (a media query é tratada pelo <source>)."
79873
- });
79913
+ suggestedFix: FIX
79914
+ };
79915
+ if (single) {
79916
+ issues.push({
79917
+ ...base,
79918
+ severity: "medium",
79919
+ summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — risco de CLS`,
79920
+ details: list("Elementos afetados", offenders)
79921
+ });
79922
+ continue;
79923
+ }
79924
+ const prod = prodByKey.get(pairKey);
79925
+ if (!prod?.html || prod.htmlSnapshotFailed) {
79926
+ issues.push({
79927
+ ...base,
79928
+ severity: "low",
79929
+ inconclusive: true,
79930
+ summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — sem HTML de prod pra comparar`,
79931
+ details: list("Elementos em cand", offenders)
79932
+ });
79933
+ continue;
79934
+ }
79935
+ const prodOffenders = scanOffenders(prod);
79936
+ const delta = offenders.length - prodOffenders.length;
79937
+ if (delta > 0) {
79938
+ const prodFiles = new Set(prodOffenders.map((o) => o.file));
79939
+ const fresh = offenders.filter((o) => !prodFiles.has(o.file));
79940
+ issues.push({
79941
+ ...base,
79942
+ severity: "medium",
79943
+ summary: `${delta} <Picture><img/> a mais sem width/height em ${key} que em prod (cand ${offenders.length} · prod ${prodOffenders.length}) — risco de CLS`,
79944
+ details: list("Elementos sem dimensões só em cand", fresh.length > 0 ? fresh : offenders)
79945
+ });
79946
+ } else {
79947
+ issues.push({
79948
+ ...base,
79949
+ severity: "low",
79950
+ summary: `${offenders.length} <Picture><img/> sem width/height em ${key} — pré-existente em prod (prod ${prodOffenders.length}), vale corrigir`,
79951
+ details: `${list("Elementos afetados", offenders)}
79952
+
79953
+ Prod ships the same gap: not a cand regression, but a CLS source worth fixing on both.`
79954
+ });
79955
+ }
79874
79956
  }
79875
79957
  const status = issues.length > 0 ? "warn" : "pass";
79876
79958
  return {
@@ -79878,12 +79960,23 @@ function pictureMissingDims(ctx) {
79878
79960
  status,
79879
79961
  severity: "medium",
79880
79962
  durationMs: Date.now() - start,
79881
- summary: issues.length === 0 ? `${ctx.candPages.length} página(s) sem <Picture><img/> sem dimensões` : `${issues.length} página(s) com <Picture><img/> sem width/height`,
79963
+ summary: issues.length === 0 ? `${candByKey.size} página(s) sem <Picture><img/> sem dimensões` : `${issues.length} página(s) com <Picture><img/> sem width/height`,
79882
79964
  issues,
79883
- data: { pagesScanned: ctx.candPages.length, pagesWithOffenders: issues.length }
79965
+ data: { pagesScanned: candByKey.size, pagesWithOffenders: issues.length }
79884
79966
  };
79885
79967
  }
79886
- function scanForPictureMissingDims(page) {
79968
+ function list(title, offenders) {
79969
+ return [
79970
+ "Picture/img fallbacks sem width+height fazem o browser não reservar espaço",
79971
+ "antes do decode. Em network lento, isso vira layout-shift visível.",
79972
+ "",
79973
+ `${title} (até 10 mostrados):`,
79974
+ ...offenders.slice(0, 10).map((o, i) => ` ${i + 1}. ${o.desc}`),
79975
+ offenders.length > 10 ? ` … e mais ${offenders.length - 10}` : ""
79976
+ ].filter(Boolean).join(`
79977
+ `);
79978
+ }
79979
+ function scanOffenders(page) {
79887
79980
  if (!page.html)
79888
79981
  return [];
79889
79982
  const $ = load(page.html);
@@ -79896,7 +79989,7 @@ function scanForPictureMissingDims(page) {
79896
79989
  const src = $img.attr("src") ?? $img.attr("data-src") ?? "(no src)";
79897
79990
  const cls = $img.attr("class");
79898
79991
  const desc = cls ? `<img class="${cls.slice(0, 40)}"… src="${src.slice(0, 80)}">` : `<img src="${src.slice(0, 80)}">`;
79899
- offenders.push(desc);
79992
+ offenders.push({ desc, file: src.split(/[?#]/)[0]?.split("/").pop() || src });
79900
79993
  });
79901
79994
  });
79902
79995
  return offenders;
@@ -82981,6 +83074,26 @@ function isFromHttpCache(resp) {
82981
83074
  return true;
82982
83075
  return false;
82983
83076
  }
83077
+ async function readHtml(page, capMs) {
83078
+ let timer;
83079
+ const html = await Promise.race([
83080
+ page.content().catch(() => ""),
83081
+ new Promise((resolve) => {
83082
+ timer = setTimeout(() => resolve(""), capMs);
83083
+ })
83084
+ ]);
83085
+ clearTimeout(timer);
83086
+ return html;
83087
+ }
83088
+ async function snapshotHtml(page, firstCapMs) {
83089
+ const html = await readHtml(page, firstCapMs);
83090
+ if (html)
83091
+ return html;
83092
+ await page.waitForLoadState("load", { timeout: 2000 }).catch(() => {
83093
+ return;
83094
+ });
83095
+ return readHtml(page, 5000);
83096
+ }
82984
83097
  async function capturePage(page, opts) {
82985
83098
  await warmBeforeCapture(page.context(), opts.url, opts.viewport);
82986
83099
  const start = Date.now();
@@ -82997,6 +83110,7 @@ async function capturePage(page, opts) {
82997
83110
  side: opts.side,
82998
83111
  durationMs: Date.now() - start,
82999
83112
  html,
83113
+ ...!html && (response?.status() ?? 0) > 0 ? { htmlSnapshotFailed: true } : {},
83000
83114
  vitals: vitals ?? { lcp: null, cls: null, fcp: null, ttfb: null, inp: null },
83001
83115
  vitalsStats,
83002
83116
  vitalsFullPage: vitalsFullPage ?? undefined,
@@ -83137,10 +83251,7 @@ async function capturePage(page, opts) {
83137
83251
  dlog(opts.side, opts.viewport, " capturePage: screenshot done");
83138
83252
  }
83139
83253
  dlog(opts.side, opts.viewport, ` capturePage: page.content() (cap=${Math.min(5000, remaining())}ms)`);
83140
- html = await Promise.race([
83141
- page.content().catch(() => ""),
83142
- new Promise((resolve) => setTimeout(() => resolve(""), Math.min(5000, remaining())))
83143
- ]);
83254
+ html = await snapshotHtml(page, Math.min(5000, remaining()));
83144
83255
  dlog(opts.side, opts.viewport, ` capturePage: flushCollectors (cap=${Math.min(3000, remaining())}ms)`);
83145
83256
  await flushCollectors(state, Math.min(3000, remaining()));
83146
83257
  const extraRuns = Math.max(0, (opts.runs ?? 1) - 1);
@@ -83169,15 +83280,18 @@ async function capturePage(page, opts) {
83169
83280
  };
83170
83281
  const SAFETY_MARGIN_MS = 1e4;
83171
83282
  const outerDeadlineMs = overallBudgetMs + SAFETY_MARGIN_MS;
83283
+ let outerTimer;
83172
83284
  const result = await Promise.race([
83173
83285
  inner(),
83174
- new Promise((resolve) => setTimeout(() => {
83175
- state.console.push({
83176
- type: "error",
83177
- text: `[capture-timeout] capturePage exceeded ${outerDeadlineMs}ms outer deadline — returning partial capture`
83178
- });
83179
- resolve(buildPartial());
83180
- }, outerDeadlineMs)),
83286
+ new Promise((resolve) => {
83287
+ outerTimer = setTimeout(() => {
83288
+ state.console.push({
83289
+ type: "error",
83290
+ text: `[capture-timeout] capturePage exceeded ${outerDeadlineMs}ms outer deadline — returning partial capture`
83291
+ });
83292
+ resolve(buildPartial());
83293
+ }, outerDeadlineMs);
83294
+ }),
83181
83295
  disconnectPromise.then(() => {
83182
83296
  state.console.push({
83183
83297
  type: "error",
@@ -83186,6 +83300,7 @@ async function capturePage(page, opts) {
83186
83300
  return buildPartial();
83187
83301
  })
83188
83302
  ]);
83303
+ clearTimeout(outerTimer);
83189
83304
  browser?.off("disconnected", handleBrowserDisconnect);
83190
83305
  page.off("crash", handlePageCrash);
83191
83306
  return result;
@@ -88940,89 +89055,106 @@ function fmt(n) {
88940
89055
  }
88941
89056
 
88942
89057
  // src/checks/index.ts
89058
+ var bannerAspectRatio2 = withHtmlSnapshot(bannerAspectRatio);
89059
+ var contentStructureParity2 = withHtmlSnapshot(contentStructureParity);
89060
+ var cookieCepModalCls2 = withHtmlSnapshot(cookieCepModalCls);
89061
+ var faviconParity2 = withHtmlSnapshot(faviconParity);
89062
+ var fontParity2 = withHtmlSnapshot(fontParity);
89063
+ var footerLinksHealth2 = withHtmlSnapshot(footerLinksHealth);
89064
+ var htmlStructuralDiff2 = withHtmlSnapshot(htmlStructuralDiff);
89065
+ var imageLoadingHealth2 = withHtmlSnapshot(imageLoadingHealth);
89066
+ var lazySectionPresence2 = withHtmlSnapshot(lazySectionPresence);
89067
+ var metaSeoParity2 = withHtmlSnapshot(metaSeoParity);
89068
+ var navLinksHealth2 = withHtmlSnapshot(navLinksHealth);
89069
+ var notFoundParity2 = withHtmlSnapshot(notFoundParity);
89070
+ var pdpBreadcrumbs2 = withHtmlSnapshot(pdpBreadcrumbs);
89071
+ var pdpGalleryRelated2 = withHtmlSnapshot(pdpGalleryRelated);
89072
+ var pictureMissingDims2 = withHtmlSnapshot(pictureMissingDims);
89073
+ var sectionOrderParity2 = withHtmlSnapshot(sectionOrderParity);
89074
+ var seoDeepAudit2 = withHtmlSnapshot(seoDeepAudit);
88943
89075
  var ALL_CHECKS = [
88944
89076
  httpStatusParity,
88945
89077
  consoleErrorsBaseline,
88946
- htmlStructuralDiff,
88947
- metaSeoParity,
89078
+ htmlStructuralDiff2,
89079
+ metaSeoParity2,
88948
89080
  visualRegressionKeyframes,
88949
89081
  purchaseJourneyFlow,
88950
89082
  networkSummaryDelta,
88951
89083
  webVitalsMobile,
88952
- imageLoadingHealth,
88953
- bannerAspectRatio,
89084
+ imageLoadingHealth2,
89085
+ bannerAspectRatio2,
88954
89086
  cartRevealModeDivergence,
88955
- lazySectionPresence,
88956
- seoDeepAudit,
89087
+ lazySectionPresence2,
89088
+ seoDeepAudit2,
88957
89089
  cacheCoverage,
88958
89090
  searchPresence,
88959
89091
  searchAutocomplete,
88960
89092
  searchResults,
88961
89093
  searchNoResults,
88962
89094
  cartInteractionsFlow,
88963
- notFoundParity,
88964
- cookieCepModalCls,
88965
- pdpGalleryRelated,
88966
- footerLinksHealth,
89095
+ notFoundParity2,
89096
+ cookieCepModalCls2,
89097
+ pdpGalleryRelated2,
89098
+ footerLinksHealth2,
88967
89099
  loginFlow,
88968
- pictureMissingDims,
89100
+ pictureMissingDims2,
88969
89101
  plpPagination,
88970
- pdpBreadcrumbs,
89102
+ pdpBreadcrumbs2,
88971
89103
  plpSorting,
88972
89104
  spaNavigationFlow,
88973
89105
  serverFnHoverFlood,
88974
- faviconParity,
88975
- fontParity,
88976
- contentStructureParity,
89106
+ faviconParity2,
89107
+ fontParity2,
89108
+ contentStructureParity2,
88977
89109
  ssrNoJs,
88978
- navLinksHealth,
89110
+ navLinksHealth2,
88979
89111
  redirectsParity,
88980
89112
  thirdPartyScriptsParity,
88981
89113
  analyticsBeaconParity,
88982
- sectionOrderParity,
89114
+ sectionOrderParity2,
88983
89115
  sweepFlows
88984
89116
  ];
88985
89117
  var ALL_CHECKS_BY_NAME = {
88986
89118
  "http-status-parity": httpStatusParity,
88987
89119
  "console-errors-baseline": consoleErrorsBaseline,
88988
- "html-structural-diff": htmlStructuralDiff,
88989
- "meta-seo-parity": metaSeoParity,
89120
+ "html-structural-diff": htmlStructuralDiff2,
89121
+ "meta-seo-parity": metaSeoParity2,
88990
89122
  "visual-regression-keyframes": visualRegressionKeyframes,
88991
89123
  "purchase-journey-flow": purchaseJourneyFlow,
88992
89124
  "network-summary-delta": networkSummaryDelta,
88993
89125
  "web-vitals-mobile": webVitalsMobile,
88994
- "image-loading-health": imageLoadingHealth,
88995
- "banner-aspect-ratio": bannerAspectRatio,
89126
+ "image-loading-health": imageLoadingHealth2,
89127
+ "banner-aspect-ratio": bannerAspectRatio2,
88996
89128
  "cart-reveal-mode-divergence": cartRevealModeDivergence,
88997
- "lazy-section-presence": lazySectionPresence,
88998
- "seo-deep-audit": seoDeepAudit,
89129
+ "lazy-section-presence": lazySectionPresence2,
89130
+ "seo-deep-audit": seoDeepAudit2,
88999
89131
  "cache-coverage": cacheCoverage,
89000
89132
  "search-presence": searchPresence,
89001
89133
  "search-autocomplete": searchAutocomplete,
89002
89134
  "search-results": searchResults,
89003
89135
  "search-no-results": searchNoResults,
89004
89136
  "cart-interactions-flow": cartInteractionsFlow,
89005
- "not-found-parity": notFoundParity,
89006
- "cookie-cep-modal-cls": cookieCepModalCls,
89007
- "pdp-gallery-related": pdpGalleryRelated,
89008
- "footer-links-health": footerLinksHealth,
89137
+ "not-found-parity": notFoundParity2,
89138
+ "cookie-cep-modal-cls": cookieCepModalCls2,
89139
+ "pdp-gallery-related": pdpGalleryRelated2,
89140
+ "footer-links-health": footerLinksHealth2,
89009
89141
  "login-flow": loginFlow,
89010
89142
  "sweep-flows": sweepFlows,
89011
- "picture-missing-dims": pictureMissingDims,
89143
+ "picture-missing-dims": pictureMissingDims2,
89012
89144
  "plp-pagination": plpPagination,
89013
- "pdp-breadcrumbs": pdpBreadcrumbs,
89145
+ "pdp-breadcrumbs": pdpBreadcrumbs2,
89014
89146
  "plp-sorting": plpSorting,
89015
89147
  "spa-navigation-flow": spaNavigationFlow,
89016
89148
  "serverfn-hover-flood": serverFnHoverFlood,
89017
- "favicon-parity": faviconParity,
89018
- "font-parity": fontParity,
89019
- "content-structure": contentStructureParity,
89149
+ "favicon-parity": faviconParity2,
89150
+ "font-parity": fontParity2,
89151
+ "content-structure": contentStructureParity2,
89020
89152
  "ssr-no-js": ssrNoJs,
89021
- "nav-links-health": navLinksHealth,
89153
+ "nav-links-health": navLinksHealth2,
89022
89154
  "redirects-parity": redirectsParity,
89023
89155
  "third-party-scripts-parity": thirdPartyScriptsParity,
89024
89156
  "analytics-beacon-parity": analyticsBeaconParity,
89025
- "section-order-parity": sectionOrderParity
89157
+ "section-order-parity": sectionOrderParity2
89026
89158
  };
89027
89159
  var FLOW_DEPENDENT_CHECKS = new Set([
89028
89160
  "purchase-journey-flow",
@@ -89323,6 +89455,7 @@ var PageCapture = z2.object({
89323
89455
  side: Side,
89324
89456
  durationMs: z2.number(),
89325
89457
  html: z2.string().optional(),
89458
+ htmlSnapshotFailed: z2.boolean().optional(),
89326
89459
  vitals: WebVitals,
89327
89460
  vitalsStats: WebVitalsStats.optional(),
89328
89461
  vitalsFullPage: WebVitals.optional(),
@@ -90898,7 +91031,7 @@ var REPORT_CSS = `
90898
91031
  .agentic-pillar { margin-top: 14px; }
90899
91032
  .agentic-pillar-head { font-weight: 600; margin-bottom: 6px; }
90900
91033
 
90901
- /* LLM Prompt panel */
91034
+ /* Markdown prompt toolbar + body (Visual Diff panel) */
90902
91035
  .prompt-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
90903
91036
  .prompt-toolbar button { background: var(--accent-action); color: var(--on-accent); border: none; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600; }
90904
91037
  .prompt-toolbar button:hover { opacity: 0.9; }
@@ -91955,34 +92088,6 @@ var REPORT_JS = `
91955
92088
  if (fCache) fCache.addEventListener('change', applyFilters);
91956
92089
  })();
91957
92090
 
91958
- // ---- LLM Prompt: copy + download ----
91959
- var copyBtn = document.getElementById('prompt-copy');
91960
- var dlBtn = document.getElementById('prompt-download');
91961
- var promptEl = document.getElementById('prompt-md');
91962
- var feedback = document.getElementById('prompt-feedback');
91963
- if (copyBtn && promptEl) {
91964
- copyBtn.addEventListener('click', function() {
91965
- var text = promptEl.textContent || '';
91966
- var done = function() {
91967
- feedback.textContent = '✓ copiado!';
91968
- feedback.classList.add('show');
91969
- setTimeout(function() { feedback.classList.remove('show'); }, 2000);
91970
- };
91971
- if (navigator.clipboard) navigator.clipboard.writeText(text).then(done).catch(done);
91972
- });
91973
- }
91974
- if (dlBtn && promptEl) {
91975
- dlBtn.addEventListener('click', function() {
91976
- var text = promptEl.textContent || '';
91977
- var blob = new Blob([text], { type: 'text/markdown' });
91978
- var a = document.createElement('a');
91979
- a.href = URL.createObjectURL(blob);
91980
- a.download = 'parity-prompt.md';
91981
- a.click();
91982
- setTimeout(function() { URL.revokeObjectURL(a.href); }, 1000);
91983
- });
91984
- }
91985
-
91986
92091
  // ---- Visual Diff: prompt copy/download ----
91987
92092
  (function() {
91988
92093
  var vCopy = document.getElementById('vprompt-copy');
@@ -92792,7 +92897,7 @@ function sameSet(a, b) {
92792
92897
  const sb = [...b].sort();
92793
92898
  return sa.every((v, i) => v === sb[i]);
92794
92899
  }
92795
- var list = (v) => v.length ? v.join(", ") : "none";
92900
+ var list2 = (v) => v.length ? v.join(", ") : "none";
92796
92901
  function descendantWithTransition(nodes, ancestorKey, props) {
92797
92902
  const wanted = new Set(props);
92798
92903
  for (const n of nodes) {
@@ -92813,20 +92918,20 @@ function diffTransitions(p, c, candNodes) {
92813
92918
  if (pOn && !cOn) {
92814
92919
  const inner = descendantWithTransition(candNodes, c.key, p.transition.properties);
92815
92920
  if (inner) {
92816
- out.push(finding(p, "moved-to-descendant", `prod transitions ${list(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms on this node; cand declares it on a DESCENDANT instead (${inner.key}: ${list(inner.transition.properties)} over ${Math.max(...inner.transition.durationsMs)}ms). The effect exists — the node carrying it differs, which is a structural difference, not a lost transition.`, at));
92921
+ out.push(finding(p, "moved-to-descendant", `prod transitions ${list2(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms on this node; cand declares it on a DESCENDANT instead (${inner.key}: ${list2(inner.transition.properties)} over ${Math.max(...inner.transition.durationsMs)}ms). The effect exists — the node carrying it differs, which is a structural difference, not a lost transition.`, at));
92817
92922
  return out;
92818
92923
  }
92819
- out.push(finding(p, "missing-transition", `prod transitions ${list(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms; cand's node ${c.key} has no transition, and no descendant of it declares one either (the change is instant)`, at));
92924
+ out.push(finding(p, "missing-transition", `prod transitions ${list2(p.transition.properties)} over ${Math.max(...p.transition.durationsMs)}ms; cand's node ${c.key} has no transition, and no descendant of it declares one either (the change is instant)`, at));
92820
92925
  return out;
92821
92926
  }
92822
92927
  if (!pOn && cOn) {
92823
- out.push(finding(p, "extra-transition", `cand transitions ${list(c.transition.properties)}; prod does not (the migration added motion)`, at));
92928
+ out.push(finding(p, "extra-transition", `cand transitions ${list2(c.transition.properties)}; prod does not (the migration added motion)`, at));
92824
92929
  return out;
92825
92930
  }
92826
92931
  if (!pOn && !cOn)
92827
92932
  return out;
92828
92933
  if (!sameSet(p.transition.properties, c.transition.properties)) {
92829
- out.push(finding(p, "property-set", `transitioned properties differ: prod [${list(p.transition.properties)}] vs cand [${list(c.transition.properties)}]`, at));
92934
+ out.push(finding(p, "property-set", `transitioned properties differ: prod [${list2(p.transition.properties)}] vs cand [${list2(c.transition.properties)}]`, at));
92830
92935
  }
92831
92936
  const pd = Math.max(...p.transition.durationsMs);
92832
92937
  const cd = Math.max(...c.transition.durationsMs);
@@ -92834,7 +92939,7 @@ function diffTransitions(p, c, candNodes) {
92834
92939
  out.push(finding(p, "duration", `transition duration ${pd}ms → ${cd}ms`, at));
92835
92940
  }
92836
92941
  if (!sameSet(p.transition.easings, c.transition.easings)) {
92837
- out.push(finding(p, "easing", `transition easing [${list(p.transition.easings)}] → [${list(c.transition.easings)}]`, at));
92942
+ out.push(finding(p, "easing", `transition easing [${list2(p.transition.easings)}] → [${list2(c.transition.easings)}]`, at));
92838
92943
  }
92839
92944
  const pdel = Math.max(0, ...p.transition.delaysMs);
92840
92945
  const cdel = Math.max(0, ...c.transition.delaysMs);
@@ -92852,11 +92957,11 @@ function diffAnimations(p, c) {
92852
92957
  const pNames = p.animation.names.filter((n) => n && n !== "none");
92853
92958
  const cNames = c.animation.names.filter((n) => n && n !== "none");
92854
92959
  if (pNames.length > 0 && cNames.length === 0) {
92855
- out.push(finding(p, "missing-animation", `prod animates [${list(pNames)}]; cand has no animation`, at));
92960
+ out.push(finding(p, "missing-animation", `prod animates [${list2(pNames)}]; cand has no animation`, at));
92856
92961
  return out;
92857
92962
  }
92858
92963
  if (pNames.length === 0 && cNames.length > 0) {
92859
- out.push(finding(p, "extra-animation", `cand animates [${list(cNames)}]; prod does not`, at));
92964
+ out.push(finding(p, "extra-animation", `cand animates [${list2(cNames)}]; prod does not`, at));
92860
92965
  return out;
92861
92966
  }
92862
92967
  if (pNames.length === 0)
@@ -99045,118 +99150,9 @@ function groupIssues(issues) {
99045
99150
  return [...groups.values()].sort((a, b) => SEVERITY_RANK3[a.severity] - SEVERITY_RANK3[b.severity] || b.count - a.count);
99046
99151
  }
99047
99152
 
99048
- // src/report/prompt-builder.ts
99049
- var SEVERITY_ORDER2 = {
99050
- critical: 0,
99051
- high: 1,
99052
- medium: 2,
99053
- low: 3
99054
- };
99055
- var SEVERITY_EMOJI = {
99056
- critical: "\uD83D\uDD34",
99057
- high: "\uD83D\uDFE0",
99058
- medium: "\uD83D\uDFE1",
99059
- low: "⚪"
99060
- };
99061
- function buildLlmPrompt(run, opts = {}) {
99062
- const minSev = opts.minSeverity ?? "low";
99063
- const limit = opts.limit ?? 20;
99064
- const baseIssues = run.topIssues.length > 0 ? run.topIssues : run.issues;
99065
- const filtered = baseIssues.filter((i) => SEVERITY_ORDER2[i.severity] <= SEVERITY_ORDER2[minSev]).sort((a, b) => SEVERITY_ORDER2[a.severity] - SEVERITY_ORDER2[b.severity]).slice(0, limit);
99066
- return buildPromptInner(run, filtered, baseIssues.length);
99067
- }
99068
- function buildPromptInner(run, issues, totalIssues) {
99069
- const v = run.verdict;
99070
- const sections = [];
99071
- sections.push(`# Migration Parity Report — ${run.id}
99072
-
99073
- You are reviewing the result of an automated E2E parity test between two versions of a site:
99074
-
99075
- - **prod (source of truth):** ${run.prodUrl} — running the old framework (Deno Fresh + Preact)
99076
- - **cand (candidate):** ${run.candUrl} — migrated version on the new stack (TanStack Start + React + Cloudflare Workers)
99077
-
99078
- The test ran flows \`${run.flows.join(", ")}\` in viewports \`${run.viewports.join(", ")}\` using CEP \`${run.cep}\`. Total duration: ${(run.durationMs / 1000).toFixed(1)}s.
99079
-
99080
- ## Verdict
99081
-
99082
- - **Status:** ${v.status.toUpperCase()}
99083
- - **Parity score:** ${v.score}/100
99084
- - **Issues:** ${v.critical} critical · ${v.high} high · ${v.medium} medium · ${v.low} low
99085
- - **Checks:** ${v.checksRun} run (${v.checksPassed} pass · ${v.checksFailed} fail · ${v.checksSkipped} skipped)
99086
-
99087
- The cand version must behave as close as possible to prod. Every divergence below is a regression unless explicitly intentional in the migration. Your job is to help me decide which to fix first and how.
99088
-
99089
- ---
99090
-
99091
- ## Top ${issues.length} of ${totalIssues} issues (ranked by severity)
99092
- `);
99093
- if (issues.length === 0) {
99094
- sections.push(`
99095
- _No issues at or above the requested severity._
99096
- `);
99097
- } else {
99098
- for (const [idx, issue] of issues.entries()) {
99099
- sections.push(renderIssueBlock(idx + 1, issue));
99100
- }
99101
- }
99102
- sections.push(`
99103
- ---
99104
-
99105
- ## What I need from you
99106
-
99107
- For each issue above, in order of severity:
99108
-
99109
- 1. **Diagnose** the most likely root cause specific to a Fresh → TanStack Start migration of a Deco storefront. Common patterns include:
99110
- - \`useDevice\` / \`usePlatform\` hydration mismatch (server returns one, client another)
99111
- - Section not registered in \`registerSections()\` in \`src/setup.ts\`
99112
- - Loader returning a different shape (different VTEX/Shopify endpoint mapping in @decocms/apps-start)
99113
- - Cache profile not covering this route type in \`@decocms/start\` (\`routeCacheDefaults\`)
99114
- - VTEX cookies not propagating (\`vtexFetchWithCookies\` issue) — affects cart, shipping
99115
- - Image helper or CDN URL drift, or lost \`preload\` on hero image
99116
- - \`<head>\` meta tags hoist not running server-side
99117
- 2. **Propose a concrete fix** — file path, what to change, why. If two fixes are plausible, list both.
99118
- 3. **Flag dependencies** between issues (e.g. "fixing #2 will likely fix #5 too").
99119
- 4. **Rank execution order** for me: which fix unlocks the most other fixes? Which is cheapest?
99120
-
99121
- Be terse. Skip preamble. If an issue is ambiguous, say what extra information you'd need from me (a HAR file, a specific page screenshot, a code path) and I'll fetch it.
99122
-
99123
- Don't suggest generic best practices — only fixes tied to specific issues above.
99124
- `);
99125
- return sections.join(`
99126
- `);
99127
- }
99128
- function renderIssueBlock(idx, issue) {
99129
- const lines = [];
99130
- const emoji = SEVERITY_EMOJI[issue.severity];
99131
- lines.push(`### ${idx}. ${emoji} [${issue.severity.toUpperCase()}] ${issue.summary}`, "", `- **Category:** \`${issue.category}\` · **Check:** \`${issue.check}\`${issue.page ? ` · **Page:** \`${humanKey2(issue.page)}\`` : ""}`);
99132
- if (issue.details) {
99133
- lines.push("", "**Details:**", "", "```", issue.details, "```");
99134
- }
99135
- if (issue.reproduction) {
99136
- lines.push("", "**Reproduction:**", "", issue.reproduction);
99137
- }
99138
- if (issue.suggestedFix) {
99139
- lines.push("", "**Suggested fix (preliminary):**", "", issue.suggestedFix);
99140
- }
99141
- if (issue.evidence && issue.evidence.length > 0) {
99142
- const refs = issue.evidence.map((e) => `\`${e.path}\`${e.label ? ` (${e.label})` : ""}`).join(", ");
99143
- lines.push("", `**Evidence:** ${refs}`);
99144
- }
99145
- lines.push("", "");
99146
- return lines.join(`
99147
- `);
99148
- }
99149
- function humanKey2(key) {
99150
- const parts = key.split("::");
99151
- const path = parts[0] ?? key;
99152
- const viewport = parts[1] ?? "";
99153
- const niceName = path === "/" || path === "" ? "Home" : path;
99154
- return viewport ? `${niceName} · ${viewport}` : niceName;
99155
- }
99156
-
99157
99153
  // src/report/visual-prompt-builder.ts
99158
99154
  import { relative as relative4 } from "node:path";
99159
- var SEVERITY_ORDER3 = {
99155
+ var SEVERITY_ORDER2 = {
99160
99156
  critical: 0,
99161
99157
  high: 1,
99162
99158
  medium: 2,
@@ -99179,7 +99175,7 @@ function pageMaxSeverity(page) {
99179
99175
  const sevs = severities(page);
99180
99176
  if (sevs.length === 0)
99181
99177
  return null;
99182
- return sevs.reduce((best, s) => SEVERITY_ORDER3[s] < SEVERITY_ORDER3[best] ? s : best);
99178
+ return sevs.reduce((best, s) => SEVERITY_ORDER2[s] < SEVERITY_ORDER2[best] ? s : best);
99183
99179
  }
99184
99180
  function buildVisualPrompt(run, runDir, opts = {}) {
99185
99181
  const minSev = opts.minSeverity ?? "low";
@@ -99194,7 +99190,7 @@ function buildVisualPrompt(run, runDir, opts = {}) {
99194
99190
  }
99195
99191
  const rank = (p) => {
99196
99192
  const sev = pageMaxSeverity(p);
99197
- return sev ? SEVERITY_ORDER3[sev] : p.verdict === "failed" ? 4 : 99;
99193
+ return sev ? SEVERITY_ORDER2[sev] : p.verdict === "failed" ? 4 : 99;
99198
99194
  };
99199
99195
  const pages = summary.results.filter((p) => {
99200
99196
  if (includePassed)
@@ -99202,7 +99198,7 @@ function buildVisualPrompt(run, runDir, opts = {}) {
99202
99198
  if (p.verdict === "failed")
99203
99199
  return true;
99204
99200
  const sev = pageMaxSeverity(p);
99205
- return sev !== null && SEVERITY_ORDER3[sev] <= SEVERITY_ORDER3[minSev];
99201
+ return sev !== null && SEVERITY_ORDER2[sev] <= SEVERITY_ORDER2[minSev];
99206
99202
  }).sort((a, b) => rank(a) - rank(b));
99207
99203
  if (pages.length === 0) {
99208
99204
  sections.push(`_All ${summary.pagesChecked} compared pages are identical to prod._`);
@@ -99381,7 +99377,6 @@ var TAB_HELP = {
99381
99377
  vitals: "Web Vitals (LCP / FCP / TTFB / INP / CLS) per page, prod vs cand. Δ green = cand better; Δ red = regression. Mobile is the default measurement viewport.",
99382
99378
  cache: "Cache hit rate and missed opportunities on cand. Opportunities = static assets with hashed URLs returning MISS — adding a cache rule for them is usually free perf.",
99383
99379
  checks: "Every check that ran in this run, with pass/fail status, duration, and one-line summary. Useful for narrowing down which check produced a confusing issue.",
99384
- prompt: "Copy-pasteable Markdown prompt that you can drop into any LLM (Claude, ChatGPT, etc.) to get a prioritized fix list. Includes issue context + migration-specific hints.",
99385
99380
  pages: "Every URL parity actually captured during the run, with status code and viewport. Use this to confirm coverage when a check reports something unexpected.",
99386
99381
  console: "JS console errors and network failures that fired on cand but not on prod. New errors are usually hydration mismatches, missing API endpoints, or broken third-party scripts.",
99387
99382
  network: "Every request captured on cand: type, status, size, cache decision. Sortable + filterable. Use this to spot bundle bloat or unexpected third-party calls.",
@@ -100609,22 +100604,6 @@ function renderSeoIssuesCard(issues, runDir) {
100609
100604
  ${issues.map((i) => renderIssue2(i, runDir)).join("")}
100610
100605
  </div>`;
100611
100606
  }
100612
- function renderPromptPanel(run) {
100613
- const md = buildLlmPrompt(run, { limit: 20 });
100614
- const charCount = md.length;
100615
- return `
100616
- <div class="card">
100617
- <h2>LLM prompt</h2>
100618
- <div class="hint">Ready to paste into Claude / ChatGPT / any chat. Lists ranked issues + migration context + specific diagnose-and-fix instructions.</div>
100619
- <div class="prompt-toolbar">
100620
- <button id="prompt-copy">\uD83D\uDCCB Copy markdown</button>
100621
- <button class="secondary" id="prompt-download">⬇ Download .md</button>
100622
- <span class="feedback" id="prompt-feedback"></span>
100623
- <div class="right">${charCount.toLocaleString("en-US")} chars · ${(charCount / 1024).toFixed(1)} KB</div>
100624
- </div>
100625
- <div class="prompt-md" id="prompt-md">${escapeHtml(md)}</div>
100626
- </div>`;
100627
- }
100628
100607
  function buildNav(run) {
100629
100608
  const vd = run.visualDiff;
100630
100609
  const entries = [
@@ -100653,7 +100632,6 @@ function buildNav(run) {
100653
100632
  { tab: "vitals", label: "Vitals", icon: "\uD83D\uDCCA" },
100654
100633
  { tab: "cache", label: "Cache", icon: "\uD83D\uDCBE" },
100655
100634
  { tab: "checks", label: "Checks", icon: "✓", count: run.checks.length },
100656
- { tab: "prompt", label: "Prompt LLM", icon: "\uD83E\uDD16" },
100657
100635
  { tab: "pages", label: "Pages", icon: "\uD83D\uDCC4" },
100658
100636
  { tab: "console", label: "Console", icon: "\uD83D\uDD27" },
100659
100637
  { tab: "network", label: "Network", icon: "\uD83C\uDF10" }
@@ -100738,7 +100716,6 @@ function renderHtmlReport(run, runDir) {
100738
100716
  ${tabHelp(TAB_HELP.checks)}
100739
100717
  ${renderChecksTable(run)}
100740
100718
  </section>
100741
- <section class="panel" data-panel="prompt">${tabHelp(TAB_HELP.prompt)}${renderPromptPanel(run)}</section>
100742
100719
  <section class="panel" data-panel="pages">
100743
100720
  ${tabHelp(TAB_HELP.pages)}
100744
100721
  ${renderPagesTable2(run)}
@@ -117609,7 +117586,7 @@ function printSummary8(run, htmlPath, meta) {
117609
117586
  }
117610
117587
 
117611
117588
  // src/commands/pr.ts
117612
- var SEVERITY_EMOJI2 = {
117589
+ var SEVERITY_EMOJI = {
117613
117590
  critical: "\uD83D\uDD34",
117614
117591
  high: "\uD83D\uDFE0",
117615
117592
  medium: "\uD83D\uDFE1",
@@ -117706,7 +117683,7 @@ function buildPrComment(run, opts) {
117706
117683
  for (const g of topGroups) {
117707
117684
  const i = g.sample;
117708
117685
  const where = g.pages.length > 1 ? ` · ${g.pages.length} pages` : i.page ? ` · page: \`${i.page}\`` : "";
117709
- lines.push(`- ${SEVERITY_EMOJI2[i.severity]} \`${i.category}\` · **${i.summary}** _(check: \`${i.check}\`${where})_`);
117686
+ lines.push(`- ${SEVERITY_EMOJI[i.severity]} \`${i.category}\` · **${i.summary}** _(check: \`${i.check}\`${where})_`);
117710
117687
  }
117711
117688
  }
117712
117689
  lines.push("");
@@ -117719,6 +117696,117 @@ function buildPrComment(run, opts) {
117719
117696
  // src/commands/prompt.ts
117720
117697
  import { existsSync as existsSync31, writeFileSync as writeFileSync33 } from "node:fs";
117721
117698
  import chalk36 from "chalk";
117699
+
117700
+ // src/report/prompt-builder.ts
117701
+ var SEVERITY_ORDER3 = {
117702
+ critical: 0,
117703
+ high: 1,
117704
+ medium: 2,
117705
+ low: 3
117706
+ };
117707
+ var SEVERITY_EMOJI2 = {
117708
+ critical: "\uD83D\uDD34",
117709
+ high: "\uD83D\uDFE0",
117710
+ medium: "\uD83D\uDFE1",
117711
+ low: "⚪"
117712
+ };
117713
+ function buildLlmPrompt(run, opts = {}) {
117714
+ const minSev = opts.minSeverity ?? "low";
117715
+ const limit = opts.limit ?? 20;
117716
+ const baseIssues = run.topIssues.length > 0 ? run.topIssues : run.issues;
117717
+ const filtered = baseIssues.filter((i) => SEVERITY_ORDER3[i.severity] <= SEVERITY_ORDER3[minSev]).sort((a, b) => SEVERITY_ORDER3[a.severity] - SEVERITY_ORDER3[b.severity]).slice(0, limit);
117718
+ return buildPromptInner(run, filtered, baseIssues.length);
117719
+ }
117720
+ function buildPromptInner(run, issues, totalIssues) {
117721
+ const v = run.verdict;
117722
+ const sections = [];
117723
+ sections.push(`# Migration Parity Report — ${run.id}
117724
+
117725
+ You are reviewing the result of an automated E2E parity test between two versions of a site:
117726
+
117727
+ - **prod (source of truth):** ${run.prodUrl} — running the old framework (Deno Fresh + Preact)
117728
+ - **cand (candidate):** ${run.candUrl} — migrated version on the new stack (TanStack Start + React + Cloudflare Workers)
117729
+
117730
+ The test ran flows \`${run.flows.join(", ")}\` in viewports \`${run.viewports.join(", ")}\` using CEP \`${run.cep}\`. Total duration: ${(run.durationMs / 1000).toFixed(1)}s.
117731
+
117732
+ ## Verdict
117733
+
117734
+ - **Status:** ${v.status.toUpperCase()}
117735
+ - **Parity score:** ${v.score}/100
117736
+ - **Issues:** ${v.critical} critical · ${v.high} high · ${v.medium} medium · ${v.low} low
117737
+ - **Checks:** ${v.checksRun} run (${v.checksPassed} pass · ${v.checksFailed} fail · ${v.checksSkipped} skipped)
117738
+
117739
+ The cand version must behave as close as possible to prod. Every divergence below is a regression unless explicitly intentional in the migration. Your job is to help me decide which to fix first and how.
117740
+
117741
+ ---
117742
+
117743
+ ## Top ${issues.length} of ${totalIssues} issues (ranked by severity)
117744
+ `);
117745
+ if (issues.length === 0) {
117746
+ sections.push(`
117747
+ _No issues at or above the requested severity._
117748
+ `);
117749
+ } else {
117750
+ for (const [idx, issue] of issues.entries()) {
117751
+ sections.push(renderIssueBlock(idx + 1, issue));
117752
+ }
117753
+ }
117754
+ sections.push(`
117755
+ ---
117756
+
117757
+ ## What I need from you
117758
+
117759
+ For each issue above, in order of severity:
117760
+
117761
+ 1. **Diagnose** the most likely root cause specific to a Fresh → TanStack Start migration of a Deco storefront. Common patterns include:
117762
+ - \`useDevice\` / \`usePlatform\` hydration mismatch (server returns one, client another)
117763
+ - Section not registered in \`registerSections()\` in \`src/setup.ts\`
117764
+ - Loader returning a different shape (different VTEX/Shopify endpoint mapping in @decocms/apps-start)
117765
+ - Cache profile not covering this route type in \`@decocms/start\` (\`routeCacheDefaults\`)
117766
+ - VTEX cookies not propagating (\`vtexFetchWithCookies\` issue) — affects cart, shipping
117767
+ - Image helper or CDN URL drift, or lost \`preload\` on hero image
117768
+ - \`<head>\` meta tags hoist not running server-side
117769
+ 2. **Propose a concrete fix** — file path, what to change, why. If two fixes are plausible, list both.
117770
+ 3. **Flag dependencies** between issues (e.g. "fixing #2 will likely fix #5 too").
117771
+ 4. **Rank execution order** for me: which fix unlocks the most other fixes? Which is cheapest?
117772
+
117773
+ Be terse. Skip preamble. If an issue is ambiguous, say what extra information you'd need from me (a HAR file, a specific page screenshot, a code path) and I'll fetch it.
117774
+
117775
+ Don't suggest generic best practices — only fixes tied to specific issues above.
117776
+ `);
117777
+ return sections.join(`
117778
+ `);
117779
+ }
117780
+ function renderIssueBlock(idx, issue) {
117781
+ const lines = [];
117782
+ const emoji = SEVERITY_EMOJI2[issue.severity];
117783
+ lines.push(`### ${idx}. ${emoji} [${issue.severity.toUpperCase()}] ${issue.summary}`, "", `- **Category:** \`${issue.category}\` · **Check:** \`${issue.check}\`${issue.page ? ` · **Page:** \`${humanKey2(issue.page)}\`` : ""}`);
117784
+ if (issue.details) {
117785
+ lines.push("", "**Details:**", "", "```", issue.details, "```");
117786
+ }
117787
+ if (issue.reproduction) {
117788
+ lines.push("", "**Reproduction:**", "", issue.reproduction);
117789
+ }
117790
+ if (issue.suggestedFix) {
117791
+ lines.push("", "**Suggested fix (preliminary):**", "", issue.suggestedFix);
117792
+ }
117793
+ if (issue.evidence && issue.evidence.length > 0) {
117794
+ const refs = issue.evidence.map((e) => `\`${e.path}\`${e.label ? ` (${e.label})` : ""}`).join(", ");
117795
+ lines.push("", `**Evidence:** ${refs}`);
117796
+ }
117797
+ lines.push("", "");
117798
+ return lines.join(`
117799
+ `);
117800
+ }
117801
+ function humanKey2(key) {
117802
+ const parts = key.split("::");
117803
+ const path = parts[0] ?? key;
117804
+ const viewport = parts[1] ?? "";
117805
+ const niceName = path === "/" || path === "" ? "Home" : path;
117806
+ return viewport ? `${niceName} · ${viewport}` : niceName;
117807
+ }
117808
+
117809
+ // src/commands/prompt.ts
117722
117810
  function promptCommand(runId, opts) {
117723
117811
  let run;
117724
117812
  try {
@@ -119839,7 +119927,6 @@ var ALL_REPORT_SECTIONS = [
119839
119927
  "vitals",
119840
119928
  "cache",
119841
119929
  "checks",
119842
- "prompt",
119843
119930
  "pages",
119844
119931
  "console",
119845
119932
  "network",
@@ -119896,12 +119983,6 @@ function extractJsonSection(run, section) {
119896
119983
  return extractPagesSlice(run);
119897
119984
  case "console":
119898
119985
  return run.checks.filter((c) => c.name === "console-errors-baseline").flatMap((c) => c.issues);
119899
- case "prompt":
119900
- return {
119901
- runId: run.id,
119902
- topIssuesCount: run.topIssues.length,
119903
- hint: "Use `parity prompt <runId>` to materialize the LLM-ready Markdown."
119904
- };
119905
119986
  case "diff":
119906
119987
  return run.baseline?.delta ?? null;
119907
119988
  }
@@ -119961,6 +120042,10 @@ function pathOf7(url) {
119961
120042
  }
119962
120043
 
119963
120044
  // src/commands/report.ts
120045
+ var REMOVED_SECTIONS = {
120046
+ sidebyside: "use `parity cockpit --prod <url> --cand <url>` for the live prod × cand view.",
120047
+ prompt: "use `parity prompt <runId>` for the LLM-ready Markdown."
120048
+ };
119964
120049
  async function reportCommand(runId, opts) {
119965
120050
  const paths = getRunPaths(opts.output, runId);
119966
120051
  if (opts.deck) {
@@ -119996,8 +120081,9 @@ async function reportCommand(runId, opts) {
119996
120081
  return 0;
119997
120082
  }
119998
120083
  if (opts.section) {
119999
- if (opts.section === "sidebyside") {
120000
- console.error(chalk39.yellow("⚠ section `sidebyside` was removed from the report — use `parity cockpit --prod <url> --cand <url>` for the live prod × cand view."));
120084
+ const movedTo = REMOVED_SECTIONS[opts.section];
120085
+ if (movedTo) {
120086
+ console.error(chalk39.yellow(`⚠ section \`${opts.section}\` was removed from the report — ${movedTo}`));
120001
120087
  return 1;
120002
120088
  }
120003
120089
  if (!ALL_REPORT_SECTIONS.includes(opts.section)) {
@@ -122087,7 +122173,7 @@ program.command("serve").argument("<runId>", "Run ID to serve").description("[de
122087
122173
  program.command("event").argument("<type>", "Event type: phase-change | dispatch | bench | score | note | …").description("Record a migration event into <dir>/events.jsonl — the sanctioned emission path for hooks and the orchestrator. The cockpit daemon tails this file into its live activity feed.").option("--dir <dir>", "Directory holding events.jsonl (the target's .parity/)", ".parity").option("--data <json>", `JSON object of event fields, e.g. '{"agent":"porter","component":"hero"}'`).action((type, opts) => {
122088
122174
  process.exit(eventCommand(type, opts));
122089
122175
  });
122090
- program.command("report").argument("<runId>", "Run ID to open").description("Open the HTML report for a run in the default browser. With --section, extract a single tab to stdout instead — useful for agents that need just the SEO/Network/Vitals slice without parsing the whole report. Issue #74.").option("--output <dir>", "Output directory", "./parity-output").option("--section <name>", "Extract one tab to stdout instead of opening the report. Valid names: summary, visualdiff, seo, issues, vitals, cache, checks, prompt, pages, console, network, diff.").option("--json", "Pair with --section to emit a normalized JSON projection of the section (from report.json) instead of the raw HTML slice.").option("--deck", "Render the presentation deck instead: one topic per full-viewport page, advanced sideways, in a single self-contained HTML file. For showing the result to someone rather than debugging it. Issue #290.", false).option("--out <path>", "Where to write the deck (default: deck.html in the run dir)").option("--lang <pt|en>", "Initial deck language; the in-page toggle still switches live", "en").option("--open", "Open the rendered deck in the browser", false).option("--plan-dir <dir>", "With --deck: dir holding migration-plan.json. Adds the component heat map (grouped by page, plus global) and the block-by-block table. Without it those pages are omitted, not drawn empty. Issue #291.").action(async (runId, opts) => {
122176
+ program.command("report").argument("<runId>", "Run ID to open").description("Open the HTML report for a run in the default browser. With --section, extract a single tab to stdout instead — useful for agents that need just the SEO/Network/Vitals slice without parsing the whole report. Issue #74.").option("--output <dir>", "Output directory", "./parity-output").option("--section <name>", "Extract one tab to stdout instead of opening the report. Valid names: summary, visualdiff, seo, issues, vitals, cache, checks, pages, console, network, diff.").option("--json", "Pair with --section to emit a normalized JSON projection of the section (from report.json) instead of the raw HTML slice.").option("--deck", "Render the presentation deck instead: one topic per full-viewport page, advanced sideways, in a single self-contained HTML file. For showing the result to someone rather than debugging it. Issue #290.", false).option("--out <path>", "Where to write the deck (default: deck.html in the run dir)").option("--lang <pt|en>", "Initial deck language; the in-page toggle still switches live", "en").option("--open", "Open the rendered deck in the browser", false).option("--plan-dir <dir>", "With --deck: dir holding migration-plan.json. Adds the component heat map (grouped by page, plus global) and the block-by-block table. Without it those pages are omitted, not drawn empty. Issue #291.").action(async (runId, opts) => {
122091
122177
  process.exit(await reportCommand(runId, {
122092
122178
  output: opts.output,
122093
122179
  section: opts.section,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.35.11",
3
+ "version": "0.35.13",
4
4
  "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with an LLM-ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",