@decocms/parity 0.35.13 → 0.35.14

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.
package/AGENTS.md CHANGED
@@ -56,7 +56,7 @@ Do **not** fake single-site with `parity run --prod X --cand X` — it runs ever
56
56
  // A FAIL from high findings keeps status "fail" but the score stays the formula — "91 · FAIL" is valid;
57
57
  // read status for the gate, score for progress. It's a progress meter: it RISES as issues get fixed.
58
58
  previousRun?: { id, timestamp, score, scoreDelta }, // trend vs last comparable run (same hosts + scoreVersion)
59
- topIssues: Issue[], // LLM-ranked, deduplicated; usually 5-10 items
59
+ topIssues: Issue[], // one per root cause (issue group), by severity then pages hit; ≤10, real ids + evidence
60
60
  issues: Issue[], // all raw issues from every check
61
61
  checks: CheckResult[], // one per check; .data has structured details
62
62
  visualDiff: {
@@ -102,9 +102,9 @@ The visual module runs on the `parity heatmap` engine — deterministic, no LLM.
102
102
  The most useful flow for an AI agent is:
103
103
 
104
104
  1. Run `parity run --preset full` → wait → read `report.json`
105
- 2. For each `topIssue` with severity ≥ high, open the file(s) referenced in `suggestedFix`
105
+ 2. For each `topIssue` with severity ≥ high, open its `evidence[]` and follow `suggestedFix` when the check set one; `parity explain <runId> <issueId>` for an LLM deep-dive on one issue
106
106
  3. For visual diffs: read `visualDiff.results[].findings` (element + property + px) and `.sectionsOnlyInProd` — the latter are Deco sections present in prod's DOM but missing in cand. Most likely cause: not registered in `src/setup.ts → registerSections()`.
107
- 4. For console errors: read `issues[].evidence[]` for HAR paths; the failed request is usually the root cause.
107
+ 4. For console errors: read `issues[].details` and the matching `flowCaptures[].network` rows; the failed request is usually the root cause. (HARs are not recorded by default — `PARITY_HAR=1` writes `har/<viewport>-<side>.har` for a human to open.)
108
108
  5. Re-run `parity journey` (cheaper) after each fix to confirm.
109
109
 
110
110
  **Important:** prod is the source of truth. Never modify prod-side code to make tests pass — always fix cand.
@@ -113,11 +113,11 @@ The most useful flow for an AI agent is:
113
113
 
114
114
  If neither `ANTHROPIC_API_KEY` nor `OPENROUTER_API_KEY` is set:
115
115
 
116
- - `topIssues` will fall back to deterministic severity-sorted merge (still useful)
116
+ - `topIssues` is unaffected — it is ranked deterministically from the issue groups, never by an LLM
117
117
  - the visual module is unaffected — it never used an LLM (heatmap engine)
118
118
  - Selector discovery is skipped; defaults from `.parityrc.json` or platform heuristics kick in
119
119
 
120
- The CLI never fails just because the LLM is unavailable. Issues will still be reported, just less polished.
120
+ The CLI never fails just because the LLM is unavailable.
121
121
 
122
122
  ## Cost-conscious usage
123
123
 
@@ -125,7 +125,7 @@ The visual module costs no LLM calls. In tight loops:
125
125
 
126
126
  - Use `--preset smoke` first (no LLM, ~30s) to validate the URLs respond
127
127
  - Use `--no-visual-diff` if you only care about functional checks
128
- - Use `parity journey` (no aggregation step) for the tightest CI loop
128
+ - Use `parity journey` (one flow, no visual pass) for the tightest CI loop
129
129
  - Use `parity heatmap` on the one page you just fixed instead of a whole run
130
130
 
131
131
  ## Picking which pages to verify
package/README.md CHANGED
@@ -73,7 +73,7 @@ Three providers, auto-detected in this order — **none required** if you have t
73
73
  2. `OPENROUTER_API_KEY` — OpenRouter
74
74
  3. **Local `claude` CLI** — uses [`@anthropic-ai/claude-agent-sdk`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk); goes through your existing Claude plan. No env vars needed
75
75
 
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.
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 (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
78
  Without any provider, the CLI still runs and outputs raw check results.
79
79
 
@@ -84,8 +84,8 @@ Without any provider, the CLI still runs and outputs raw check results.
84
84
  ├── report.html # links to screenshots/ by relative path — keep the two together
85
85
  ├── report.json # structured output for agents / CI / tooling
86
86
  ├── screenshots/ # per-page, per-viewport, per-side; includes pixelmatch heatmaps
87
- ├── har/ # Playwright HARs (one per viewport/side)
88
- └── traces/ # Playwright traces — drag into trace.playwright.dev
87
+ ├── har/ # Playwright HARs, one per viewport/side — only with PARITY_HAR=1
88
+ └── traces/ # Playwright traces (drag into trace.playwright.dev) — only with PARITY_TRACE=1
89
89
  ```
90
90
 
91
91
  ## Presets
package/dist/cli.js CHANGED
@@ -36662,7 +36662,6 @@ var init_models = __esm(() => {
36662
36662
  "pdp-matching",
36663
36663
  "section-understanding",
36664
36664
  "visual-diff",
36665
- "issue-aggregation",
36666
36665
  "explain",
36667
36666
  "component-detection"
36668
36667
  ];
@@ -36674,13 +36673,11 @@ var init_models = __esm(() => {
36674
36673
  "pdp-matching": "sonnet",
36675
36674
  "section-understanding": "sonnet",
36676
36675
  "visual-diff": "sonnet",
36677
- "issue-aggregation": "sonnet",
36678
36676
  explain: "sonnet",
36679
36677
  "component-detection": "sonnet"
36680
36678
  };
36681
36679
  PREMIUM_FEATURE_TIER = {
36682
36680
  explain: "opus",
36683
- "issue-aggregation": "opus",
36684
36681
  "visual-diff": "opus"
36685
36682
  };
36686
36683
  PROVIDER_MODELS = {
@@ -92396,8 +92393,8 @@ function pathOf4(url) {
92396
92393
  }
92397
92394
 
92398
92395
  // src/storage/fs.ts
92399
- import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync9, readdirSync, writeFileSync as writeFileSync8 } from "node:fs";
92400
- import { join as join7 } from "node:path";
92396
+ import { existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync9, readdirSync, rmSync, writeFileSync as writeFileSync8 } from "node:fs";
92397
+ import { dirname as dirname4, join as join7 } from "node:path";
92401
92398
  function newRunId() {
92402
92399
  return new Date().toISOString().replace(/[:.]/g, "-").replace("T", "T");
92403
92400
  }
@@ -92469,19 +92466,19 @@ function sameModuleSet(a, b) {
92469
92466
  return false;
92470
92467
  return true;
92471
92468
  }
92469
+ function hostOf2(url) {
92470
+ try {
92471
+ return new URL(url).hostname;
92472
+ } catch {
92473
+ return url;
92474
+ }
92475
+ }
92472
92476
  function findPreviousRun(outputDir, opts) {
92473
92477
  return findComparableRuns(outputDir, opts, 1)[0] ?? null;
92474
92478
  }
92475
92479
  function findComparableRuns(outputDir, opts, limit) {
92476
- const hostOf = (url) => {
92477
- try {
92478
- return new URL(url).hostname;
92479
- } catch {
92480
- return url;
92481
- }
92482
- };
92483
- const prodHost = hostOf(opts.prodUrl);
92484
- const candHost = hostOf(opts.candUrl);
92480
+ const prodHost = hostOf2(opts.prodUrl);
92481
+ const candHost = hostOf2(opts.candUrl);
92485
92482
  const out = [];
92486
92483
  for (const entry of listRuns(outputDir)) {
92487
92484
  if (out.length >= limit)
@@ -92496,7 +92493,7 @@ function findComparableRuns(outputDir, opts, limit) {
92496
92493
  continue;
92497
92494
  if (opts.scoreVersion !== undefined && raw.verdict.scoreVersion !== opts.scoreVersion)
92498
92495
  continue;
92499
- if (hostOf(raw.prodUrl ?? "") !== prodHost || hostOf(raw.candUrl ?? "") !== candHost)
92496
+ if (hostOf2(raw.prodUrl ?? "") !== prodHost || hostOf2(raw.candUrl ?? "") !== candHost)
92500
92497
  continue;
92501
92498
  if (opts.modulesRun && opts.modulesRun.length > 0) {
92502
92499
  const candidateModules = raw.verdict?.modulesRun ?? [];
@@ -92531,6 +92528,26 @@ function listRuns(outputDir) {
92531
92528
  }).sort((a, b) => b.id.localeCompare(a.id));
92532
92529
  return entries;
92533
92530
  }
92531
+ function pruneRuns(outputDir, opts) {
92532
+ const prodHost = hostOf2(opts.prodUrl);
92533
+ const candHost = hostOf2(opts.candUrl);
92534
+ const samePair = listRuns(outputDir).filter((entry) => {
92535
+ try {
92536
+ const raw = JSON.parse(readFileSync9(entry.reportPath, "utf8"));
92537
+ return hostOf2(raw.prodUrl ?? "") === prodHost && hostOf2(raw.candUrl ?? "") === candHost;
92538
+ } catch {
92539
+ return false;
92540
+ }
92541
+ });
92542
+ const pruned = [];
92543
+ for (const entry of samePair.slice(opts.keep)) {
92544
+ if (opts.protect.has(entry.id))
92545
+ continue;
92546
+ rmSync(dirname4(entry.reportPath), { recursive: true, force: true });
92547
+ pruned.push(entry.id);
92548
+ }
92549
+ return pruned;
92550
+ }
92534
92551
 
92535
92552
  // src/util/pages.ts
92536
92553
  import chalk6 from "chalk";
@@ -94746,6 +94763,13 @@ async function measureProductCards(page) {
94746
94763
 
94747
94764
  // src/engine/flows/purchase-journey.ts
94748
94765
  var PURCHASE_JOURNEY_TOTAL_STEPS = 9;
94766
+ async function beforeShot(ctx, page, label) {
94767
+ if (!ctx.beforeShots)
94768
+ return;
94769
+ const path = screenshotPath(ctx, label);
94770
+ await screenshotStable(page, { path, fullPage: false });
94771
+ return path;
94772
+ }
94749
94773
  var DEFAULT_ADD_TO_CART_CONFIRM_MS = 3000;
94750
94774
  function resolveAddToCartConfirmMs(rc) {
94751
94775
  const v = rc.addToCartConfirmMs;
@@ -94889,8 +94913,7 @@ async function flowPurchaseJourney(ctx) {
94889
94913
  reportStart(4, "select-variant");
94890
94914
  const t4 = Date.now();
94891
94915
  const beforeUrl4 = page.url();
94892
- const spBefore4 = screenshotPath(ctx, "pj-4-select-variant-before");
94893
- await screenshotStable(page, { path: spBefore4, fullPage: false });
94916
+ const spBefore4 = await beforeShot(ctx, page, "pj-4-select-variant-before");
94894
94917
  const variantResult = await selectVariant(page, ctx);
94895
94918
  let variantLlmAction = null;
94896
94919
  if (variantResult.actions.length === 0 && variantResult.variantRequired && budget.remaining > 0) {
@@ -94957,8 +94980,7 @@ async function flowPurchaseJourney(ctx) {
94957
94980
  if (cepInputPdp) {
94958
94981
  const t5 = Date.now();
94959
94982
  const beforeUrl5 = page.url();
94960
- const spBefore5 = screenshotPath(ctx, "pj-5-shipping-pdp-before");
94961
- await screenshotStable(page, { path: spBefore5, fullPage: false });
94983
+ const spBefore5 = await beforeShot(ctx, page, "pj-5-shipping-pdp-before");
94962
94984
  const ok = await fillCep(page, cepInputPdp, ctx.rc.cep);
94963
94985
  const sp = screenshotPath(ctx, "pj-5-shipping-pdp");
94964
94986
  await screenshotStable(page, { path: sp, fullPage: false });
@@ -95011,8 +95033,7 @@ async function flowPurchaseJourney(ctx) {
95011
95033
  }
95012
95034
  const t6 = Date.now();
95013
95035
  const beforeUrl6 = page.url();
95014
- const spBefore6 = screenshotPath(ctx, "pj-6-add-cart-before");
95015
- await screenshotStable(page, { path: spBefore6, fullPage: false });
95036
+ const spBefore6 = await beforeShot(ctx, page, "pj-6-add-cart-before");
95016
95037
  const cartCountBefore = await readCartCount(page, ctx);
95017
95038
  const drawersBefore = await visibleDrawerSelectors(page, ctx);
95018
95039
  const cartWatch = watchCartMutation(page);
@@ -95099,8 +95120,7 @@ async function flowPurchaseJourney(ctx) {
95099
95120
  reportStart(7, "open-minicart");
95100
95121
  const t7 = Date.now();
95101
95122
  const beforeUrl7 = page.url();
95102
- const spBefore7 = screenshotPath(ctx, "pj-7-minicart-before");
95103
- await screenshotStable(page, { path: spBefore7, fullPage: false });
95123
+ const spBefore7 = await beforeShot(ctx, page, "pj-7-minicart-before");
95104
95124
  let cartOpenMethod = "failed";
95105
95125
  let miniText = "";
95106
95126
  let cartRevealMode = "unknown";
@@ -95244,8 +95264,7 @@ async function flowPurchaseJourney(ctx) {
95244
95264
  if (cepInputCart) {
95245
95265
  const t8 = Date.now();
95246
95266
  const beforeUrl8 = page.url();
95247
- const spBefore8 = screenshotPath(ctx, "pj-8-shipping-cart-before");
95248
- await screenshotStable(page, { path: spBefore8, fullPage: false });
95267
+ const spBefore8 = await beforeShot(ctx, page, "pj-8-shipping-cart-before");
95249
95268
  const ok = await fillCep(page, cepInputCart, ctx.rc.cep);
95250
95269
  const sp8 = screenshotPath(ctx, "pj-8-shipping-cart");
95251
95270
  await screenshotStable(page, { path: sp8, fullPage: false });
@@ -95322,8 +95341,7 @@ async function flowPurchaseJourney(ctx) {
95322
95341
  reportEnd(9, "go-checkout", "skipped", 0, "no checkout button found");
95323
95342
  return { pages, steps };
95324
95343
  }
95325
- const spBefore9 = screenshotPath(ctx, "pj-9-checkout-before");
95326
- await screenshotStable(page, { path: spBefore9, fullPage: false });
95344
+ const spBefore9 = await beforeShot(ctx, page, "pj-9-checkout-before");
95327
95345
  await Promise.race([
95328
95346
  dismissOverlays(page, ctx),
95329
95347
  new Promise((resolve) => setTimeout(resolve, 4000))
@@ -99149,6 +99167,9 @@ function groupIssues(issues) {
99149
99167
  }
99150
99168
  return [...groups.values()].sort((a, b) => SEVERITY_RANK3[a.severity] - SEVERITY_RANK3[b.severity] || b.count - a.count);
99151
99169
  }
99170
+ function rankTopIssues(issues, limit = 10) {
99171
+ return groupIssues(issues).sort((a, b) => SEVERITY_RANK3[a.severity] - SEVERITY_RANK3[b.severity] || b.pages.length - a.pages.length || b.count - a.count).slice(0, limit).map((g) => g.sample);
99172
+ }
99152
99173
 
99153
99174
  // src/report/visual-prompt-builder.ts
99154
99175
  import { relative as relative4 } from "node:path";
@@ -101766,7 +101787,7 @@ import chalk14 from "chalk";
101766
101787
  // src/server/cockpit.ts
101767
101788
  import { readFileSync as readFileSync23 } from "node:fs";
101768
101789
  import { createServer as createServer2 } from "node:http";
101769
- import { dirname as dirname5, join as join24, resolve as resolve10 } from "node:path";
101790
+ import { dirname as dirname6, join as join24, resolve as resolve10 } from "node:path";
101770
101791
 
101771
101792
  // src/server/cockpit-actions.ts
101772
101793
  import { spawn as spawn2 } from "node:child_process";
@@ -102810,13 +102831,13 @@ import {
102810
102831
  readdirSync as readdirSync5,
102811
102832
  realpathSync,
102812
102833
  renameSync as renameSync2,
102813
- rmSync,
102834
+ rmSync as rmSync2,
102814
102835
  statSync,
102815
102836
  symlinkSync,
102816
102837
  unlinkSync as unlinkSync3,
102817
102838
  writeFileSync as writeFileSync20
102818
102839
  } from "node:fs";
102819
- import { dirname as dirname4, join as join22, resolve as resolve8 } from "node:path";
102840
+ import { dirname as dirname5, join as join22, resolve as resolve8 } from "node:path";
102820
102841
  import { fileURLToPath } from "node:url";
102821
102842
  var VIEWPORT = {
102822
102843
  mobile: { width: 412, height: 839 },
@@ -102831,7 +102852,7 @@ function validTaskId(id) {
102831
102852
  return /^[\w-]{6,64}$/.test(id);
102832
102853
  }
102833
102854
  function pluginDir() {
102834
- const root = resolve8(dirname4(fileURLToPath(import.meta.url)), "../../../..");
102855
+ const root = resolve8(dirname5(fileURLToPath(import.meta.url)), "../../../..");
102835
102856
  return existsSync17(join22(root, ".claude-plugin", "plugin.json")) ? root : null;
102836
102857
  }
102837
102858
  function targetDir(planDir) {
@@ -102840,7 +102861,7 @@ function targetDir(planDir) {
102840
102861
  if (typeof state?.target?.dir === "string" && existsSync17(state.target.dir))
102841
102862
  return state.target.dir;
102842
102863
  } catch {}
102843
- return dirname4(resolve8(planDir));
102864
+ return dirname5(resolve8(planDir));
102844
102865
  }
102845
102866
  function withPath(base, path) {
102846
102867
  try {
@@ -103630,7 +103651,7 @@ function autoMergePrs(planDir) {
103630
103651
  writeFileSync20(join22(dir, "pr-merge.json"), JSON.stringify({ at, ok: false, error: err.message.split(`
103631
103652
  `)[0] }));
103632
103653
  }
103633
- rmSync(join22(dir, "pr.json"), { force: true });
103654
+ rmSync2(join22(dir, "pr.json"), { force: true });
103634
103655
  } else if (pr.checks.failed > 0 && !existsSync17(join22(dir, "ci-retry.json"))) {
103635
103656
  writeFileSync20(join22(dir, "ci-retry.json"), JSON.stringify({ at, failing: pr.checks.failing }));
103636
103657
  retryTask(planDir, t.id, `CI failed on PR #${pr.number}: ${pr.checks.failing.join(", ")}.${waivers.length ? ` Not waivable: ${waivers.filter((w) => !w.waived).map((w) => w.why).join("; ")}.` : ""} Read the failing job logs, fix on the same branch, push, wait for every check, then merge.`);
@@ -103653,7 +103674,7 @@ function prInfo(branch, repo, dir, ended, fresh = false) {
103653
103674
  encoding: "utf8",
103654
103675
  timeout: 1e4,
103655
103676
  stdio: ["ignore", "pipe", "ignore"],
103656
- env: { ...process.env, ...ghEnv(getSettings(dirname4(dirname4(dir))).githubUser) }
103677
+ env: { ...process.env, ...ghEnv(getSettings(dirname5(dirname5(dir))).githubUser) }
103657
103678
  });
103658
103679
  const j = JSON.parse(out);
103659
103680
  info = {
@@ -103847,7 +103868,7 @@ function readTask(planDir, id) {
103847
103868
  const branch = verdict?.branch ?? fr.branch ?? null;
103848
103869
  let delivery = null;
103849
103870
  if (branch) {
103850
- const repo = task.worktree && existsSync17(task.worktree) ? task.worktree : targetDir(dirname4(dirname4(dir)));
103871
+ const repo = task.worktree && existsSync17(task.worktree) ? task.worktree : targetDir(dirname5(dirname5(dir)));
103851
103872
  const baseSha = task.base?.sha ?? fr.base;
103852
103873
  const git = (...a) => {
103853
103874
  try {
@@ -104452,7 +104473,7 @@ function targetDirOf(planDir) {
104452
104473
  if (typeof st?.target?.dir === "string")
104453
104474
  return st.target.dir;
104454
104475
  } catch {}
104455
- return dirname5(resolve10(planDir));
104476
+ return dirname6(resolve10(planDir));
104456
104477
  }
104457
104478
 
104458
104479
  // src/commands/cockpit.ts
@@ -104768,7 +104789,7 @@ async function contentFreshnessCommand(opts) {
104768
104789
 
104769
104790
  // src/commands/css-modules.ts
104770
104791
  import { readFileSync as readFileSync24, readdirSync as readdirSync6 } from "node:fs";
104771
- import { basename as basename3, dirname as dirname6, join as join25, resolve as resolve12 } from "node:path";
104792
+ import { basename as basename3, dirname as dirname7, join as join25, resolve as resolve12 } from "node:path";
104772
104793
  import chalk18 from "chalk";
104773
104794
  var SKIP_DIRS2 = new Set(["node_modules", ".git", ".next", ".faststore", "dist", "build"]);
104774
104795
  var MODULE_RE = /\.module\.(scss|sass|css)$/;
@@ -104796,7 +104817,7 @@ function scanCssModules(root) {
104796
104817
  scan.modules++;
104797
104818
  const classes = declaredClasses(readFileSync24(mod, "utf8"));
104798
104819
  const modName = basename3(mod);
104799
- for (const file of components.filter((c) => dirname6(c) === dirname6(mod))) {
104820
+ for (const file of components.filter((c) => dirname7(c) === dirname7(mod))) {
104800
104821
  const src = readFileSync24(file, "utf8");
104801
104822
  const imp = src.match(new RegExp(`import\\s+(\\w+)\\s+from\\s+["'][^"']*${modName.replace(/\./g, "\\.")}["']`));
104802
104823
  if (!imp)
@@ -108305,7 +108326,7 @@ async function e2eCommand(opts) {
108305
108326
  const ignore = loadParityIgnore();
108306
108327
  const learned = loadLearned();
108307
108328
  const learnedBefore = JSON.stringify(learned);
108308
- const host = hostOf2(opts.url);
108329
+ const host = hostOf3(opts.url);
108309
108330
  const primaryViewport = viewports[0] ?? "mobile";
108310
108331
  const failOn = (opts.failOn || "critical,high").split(",").map((s) => s.trim()).filter(Boolean);
108311
108332
  const runId = newRunId();
@@ -108613,7 +108634,7 @@ async function collectFlowVideos(flowVideos, videosDir, viewport) {
108613
108634
  entry.cap.videoPaths = paths;
108614
108635
  }
108615
108636
  }
108616
- function hostOf2(url) {
108637
+ function hostOf3(url) {
108617
108638
  try {
108618
108639
  return new URL(url).hostname;
108619
108640
  } catch {
@@ -108675,11 +108696,11 @@ import chalk20 from "chalk";
108675
108696
 
108676
108697
  // src/events.ts
108677
108698
  import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync16 } from "node:fs";
108678
- import { dirname as dirname7, join as join28 } from "node:path";
108699
+ import { dirname as dirname8, join as join28 } from "node:path";
108679
108700
  function emitEvent(dir, type, data = {}) {
108680
108701
  try {
108681
108702
  const file = join28(dir, "events.jsonl");
108682
- mkdirSync16(dirname7(file), { recursive: true });
108703
+ mkdirSync16(dirname8(file), { recursive: true });
108683
108704
  const event = { ts: new Date().toISOString(), type, ...data };
108684
108705
  appendFileSync2(file, `${JSON.stringify(event)}
108685
108706
  `);
@@ -110159,7 +110180,7 @@ function formatPatch(patch) {
110159
110180
 
110160
110181
  // src/commands/ios.ts
110161
110182
  import { execFileSync as execFileSync4 } from "node:child_process";
110162
- import { existsSync as existsSync21, mkdirSync as mkdirSync20, readFileSync as readFileSync27, rmSync as rmSync2, writeFileSync as writeFileSync26 } from "node:fs";
110183
+ import { existsSync as existsSync21, mkdirSync as mkdirSync20, readFileSync as readFileSync27, rmSync as rmSync3, writeFileSync as writeFileSync26 } from "node:fs";
110163
110184
  import { homedir as homedir3, tmpdir as tmpdir2 } from "node:os";
110164
110185
  import { join as join32, resolve as resolve15 } from "node:path";
110165
110186
  import chalk25 from "chalk";
@@ -110542,9 +110563,9 @@ async function iosCommand(opts) {
110542
110563
  simctl("shutdown", device.udid);
110543
110564
  } catch {}
110544
110565
  }
110545
- rmSync2(scratch, { recursive: true, force: true });
110566
+ rmSync3(scratch, { recursive: true, force: true });
110546
110567
  if (existsSync21(LOCK) && Number(readFileSync27(LOCK, "utf8")) === process.pid)
110547
- rmSync2(LOCK);
110568
+ rmSync3(LOCK);
110548
110569
  }
110549
110570
  const missing = Object.entries(found).filter(([, v]) => v !== true).map(([k]) => k);
110550
110571
  let diff = null;
@@ -110663,7 +110684,8 @@ async function journeyCommand(opts) {
110663
110684
  platform,
110664
110685
  recoveryBudget: 3,
110665
110686
  onStep: onStepFor(viewport, side),
110666
- acceptProdQuirks: opts.acceptProdQuirks
110687
+ acceptProdQuirks: opts.acceptProdQuirks,
110688
+ beforeShots: true
110667
110689
  });
110668
110690
  return cap;
110669
110691
  } finally {
@@ -111668,11 +111690,11 @@ import { resolve as resolve17 } from "node:path";
111668
111690
 
111669
111691
  // src/util/version.ts
111670
111692
  import { readFileSync as readFileSync29 } from "node:fs";
111671
- import { dirname as dirname8, resolve as resolve16 } from "node:path";
111693
+ import { dirname as dirname9, resolve as resolve16 } from "node:path";
111672
111694
  import { fileURLToPath as fileURLToPath2 } from "node:url";
111673
111695
  function getPackageVersion() {
111674
111696
  try {
111675
- const here = dirname8(fileURLToPath2(import.meta.url));
111697
+ const here = dirname9(fileURLToPath2(import.meta.url));
111676
111698
  for (const up of ["..", "../..", "../../.."]) {
111677
111699
  try {
111678
111700
  const pkgPath = resolve16(here, up, "package.json");
@@ -112064,7 +112086,7 @@ async function mcpCommand(opts) {
112064
112086
  }
112065
112087
 
112066
112088
  // src/commands/migrate.ts
112067
- import { existsSync as existsSync28, mkdirSync as mkdirSync22, readFileSync as readFileSync35, rmSync as rmSync3, writeFileSync as writeFileSync31 } from "node:fs";
112089
+ import { existsSync as existsSync28, mkdirSync as mkdirSync22, readFileSync as readFileSync35, rmSync as rmSync4, writeFileSync as writeFileSync31 } from "node:fs";
112068
112090
  import { relative as relative5, resolve as resolve19 } from "node:path";
112069
112091
  import chalk31 from "chalk";
112070
112092
  import open2 from "open";
@@ -114456,13 +114478,13 @@ async function captureViewportVariants(browser, url, extraViewports, captured, r
114456
114478
  const dir = resolve19(componentDir, vp);
114457
114479
  const d = deltas.find((x) => x.viewport === vp);
114458
114480
  if (!d || d.absent || d.failed)
114459
- rmSync3(dir, { recursive: true, force: true });
114481
+ rmSync4(dir, { recursive: true, force: true });
114460
114482
  if (!d)
114461
114483
  continue;
114462
114484
  if (d.html !== undefined)
114463
114485
  writeFileSync31(resolve19(dir, "component.html"), d.html, "utf8");
114464
114486
  if (!d.keepScreenshot)
114465
- rmSync3(resolve19(dir, "screenshot.png"), { force: true });
114487
+ rmSync4(resolve19(dir, "screenshot.png"), { force: true });
114466
114488
  variants.push({
114467
114489
  viewport: vp,
114468
114490
  ...d.absent ? { absent: true } : {},
@@ -115673,7 +115695,7 @@ import { join as join45 } from "node:path";
115673
115695
  import chalk35 from "chalk";
115674
115696
 
115675
115697
  // src/commands/run.ts
115676
- import { existsSync as existsSync29, readFileSync as readFileSync38 } from "node:fs";
115698
+ import { existsSync as existsSync29, readFileSync as readFileSync38, rmSync as rmSync5 } from "node:fs";
115677
115699
  import { join as join44 } from "node:path";
115678
115700
  import chalk34 from "chalk";
115679
115701
  import ora8 from "ora";
@@ -115772,113 +115794,6 @@ function readLine2(prompt) {
115772
115794
  });
115773
115795
  }
115774
115796
 
115775
- // src/llm/aggregate-issues.ts
115776
- init_client();
115777
- var REPORT_ISSUES_TOOL = {
115778
- name: "report_issues",
115779
- description: "Report a prioritized list of aggregated issues from the parity run.",
115780
- input_schema: {
115781
- type: "object",
115782
- properties: {
115783
- issues: {
115784
- type: "array",
115785
- items: {
115786
- type: "object",
115787
- properties: {
115788
- id: { type: "string" },
115789
- severity: { type: "string", enum: ["critical", "high", "medium", "low"] },
115790
- category: {
115791
- type: "string",
115792
- enum: ["functional", "visual", "performance", "seo", "console", "network"]
115793
- },
115794
- page: { type: "string" },
115795
- check: { type: "string" },
115796
- summary: { type: "string" },
115797
- details: { type: "string" },
115798
- reproduction: { type: "string" },
115799
- suggestedFix: { type: "string" }
115800
- },
115801
- required: ["id", "severity", "category", "check", "summary"]
115802
- }
115803
- }
115804
- },
115805
- required: ["issues"]
115806
- }
115807
- };
115808
- async function aggregateIssues(input) {
115809
- if (!isLlmAvailable())
115810
- return fallbackAggregate(input);
115811
- const failedChecks = input.checks.filter((c) => c.status === "fail" || c.status === "warn");
115812
- if (failedChecks.length === 0)
115813
- return [];
115814
- const rawIssues = input.checks.flatMap((c) => c.issues);
115815
- const userContent = JSON.stringify({
115816
- run: {
115817
- id: input.runId,
115818
- prod: input.prodUrl,
115819
- cand: input.candUrl,
115820
- viewports: input.viewports,
115821
- flows: input.flows
115822
- },
115823
- checks_summary: failedChecks.map((c) => ({
115824
- name: c.name,
115825
- status: c.status,
115826
- severity: c.severity,
115827
- summary: c.summary,
115828
- issueCount: c.issues.length,
115829
- data: c.data
115830
- })),
115831
- raw_issues: rawIssues.map((i) => ({
115832
- id: i.id,
115833
- severity: i.severity,
115834
- category: i.category,
115835
- page: i.page,
115836
- check: i.check,
115837
- summary: i.summary,
115838
- details: i.details
115839
- }))
115840
- }, null, 2);
115841
- const parsed = await callTool({
115842
- feature: "issue-aggregation",
115843
- systemPrompt: ISSUE_AGGREGATOR_SYSTEM_PROMPT,
115844
- userText: `Analise os resultados abaixo e produza issues priorizadas via report_issues.
115845
-
115846
- ${userContent}`,
115847
- maxTokens: 4096,
115848
- timeoutMs: input.timeoutMs,
115849
- tool: {
115850
- name: REPORT_ISSUES_TOOL.name,
115851
- description: REPORT_ISSUES_TOOL.description,
115852
- inputSchema: REPORT_ISSUES_TOOL.input_schema
115853
- }
115854
- });
115855
- if (!parsed)
115856
- return fallbackAggregate(input);
115857
- return (parsed.issues ?? []).filter((i) => i.id && i.severity && i.category && i.check && i.summary).map((i) => ({
115858
- id: i.id,
115859
- severity: i.severity,
115860
- category: i.category,
115861
- page: i.page,
115862
- check: i.check,
115863
- summary: i.summary,
115864
- details: i.details,
115865
- reproduction: i.reproduction,
115866
- suggestedFix: i.suggestedFix,
115867
- evidence: []
115868
- }));
115869
- }
115870
- function fallbackAggregate(input) {
115871
- const seen = new Map;
115872
- for (const c of input.checks) {
115873
- for (const i of c.issues) {
115874
- if (!seen.has(i.id))
115875
- seen.set(i.id, i);
115876
- }
115877
- }
115878
- const order = { critical: 0, high: 1, medium: 2, low: 3 };
115879
- return [...seen.values()].sort((a, b) => order[a.severity] - order[b.severity]).slice(0, 10);
115880
- }
115881
-
115882
115797
  // src/commands/run.ts
115883
115798
  init_client();
115884
115799
 
@@ -116524,16 +116439,10 @@ async function runCommand(rawOpts) {
116524
116439
  rc.addToCartConfirmMs = opts.addToCartTimeout;
116525
116440
  }
116526
116441
  const ignore = loadParityIgnore();
116527
- const llmTimeoutRaw = opts.llmTimeout ?? 60;
116528
- if (!Number.isFinite(llmTimeoutRaw)) {
116529
- console.error(chalk34.red(` --llm-timeout inválido: "${opts.llmTimeout}" não é um número`));
116530
- return 2;
116531
- }
116532
- const llmTimeoutSec = Math.max(5, Math.floor(llmTimeoutRaw));
116533
116442
  if (isLlmAvailable()) {
116534
- console.log(chalk34.dim(` llm: ${providerLabel()} (timeout=${llmTimeoutSec}s)`));
116443
+ console.log(chalk34.dim(` llm: ${providerLabel()}`));
116535
116444
  } else {
116536
- console.log(chalk34.dim(" llm: offline (LLM keys ausentes — agregação heurística)"));
116445
+ console.log(chalk34.dim(" llm: offline (LLM keys ausentes — selector discovery pulado)"));
116537
116446
  }
116538
116447
  if (isInteractiveMode()) {
116539
116448
  console.log(chalk34.dim(" interactive: enabled — TTY + no LLM. Missing selectors will pause to prompt (disable with --no-interactive). Issue #72."));
@@ -116559,7 +116468,7 @@ async function runCommand(rawOpts) {
116559
116468
  console.log(chalk34.dim(` Detected platform: ${platform}`));
116560
116469
  }
116561
116470
  }
116562
- const prodHost = hostOf3(opts.prod);
116471
+ const prodHost = hostOf4(opts.prod);
116563
116472
  let promotedCount = 0;
116564
116473
  let deprecatedCount = 0;
116565
116474
  const wantsAutoSelectors = opts.autoSelectors !== false && isLlmAvailable();
@@ -116708,7 +116617,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
116708
116617
  if (result.failed.length === 0) {
116709
116618
  warmupSpinner.succeed(`Warmup ok — ${result.succeeded}/${result.attempted} workers serviram resposta fresca`);
116710
116619
  } else if (result.succeeded > 0) {
116711
- const failureSummary = result.failed.slice(0, 3).map((f) => `${f.viewport}/${hostOf3(f.url)} (${f.reason})`).join("; ");
116620
+ const failureSummary = result.failed.slice(0, 3).map((f) => `${f.viewport}/${hostOf4(f.url)} (${f.reason})`).join("; ");
116712
116621
  warmupSpinner.warn(`Warmup parcial — ${result.succeeded}/${result.attempted} ok; ${result.failed.length} falha(s): ${failureSummary}`);
116713
116622
  } else {
116714
116623
  const firstReason = result.failed[0]?.reason ?? "unknown";
@@ -116718,7 +116627,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
116718
116627
  const traceEnabled = process.env.PARITY_TRACE === "1";
116719
116628
  const runOneSide = async (viewport, side) => {
116720
116629
  const baseUrl = side === "prod" ? opts.prod : opts.cand;
116721
- const harPath = join44(paths.harDir, `${viewport}-${side}.har`);
116630
+ const harEnabled = process.env.PARITY_HAR === "1";
116631
+ const harPath = harEnabled ? join44(paths.harDir, `${viewport}-${side}.har`) : undefined;
116722
116632
  const tracePath = traceEnabled ? join44(paths.tracesDir, `${viewport}-${side}.zip`) : null;
116723
116633
  const ctx = await newContext(browser, {
116724
116634
  viewport,
@@ -117075,6 +116985,12 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
117075
116985
  checksHb.stop();
117076
116986
  stampPhase("checks");
117077
116987
  spinner.succeed(`Checks concluídos (${checks.length})`);
116988
+ if (process.env.PARITY_KEEP_ARTIFACTS !== "1") {
116989
+ for (const probe of visualProbes.values()) {
116990
+ if (probe.repeatScreenshot)
116991
+ rmSync5(probe.repeatScreenshot, { force: true });
116992
+ }
116993
+ }
117078
116994
  if (jsonl) {
117079
116995
  for (const c of checks)
117080
116996
  jsonl.write(checkToJsonl(runId, c));
@@ -117083,24 +116999,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
117083
116999
  const acceptance = applyAcceptedFindings(checks, ignore.expectedDivergences ?? []);
117084
117000
  const remainingChecks = withoutAccepted(checks);
117085
117001
  const remainingIssues = remainingChecks.flatMap((c) => c.issues);
117086
- currentPhase = "llm-aggregate";
117087
- setSpinnerLabel(isLlmAvailable() ? `Agregando issues via LLM (${providerLabel()}, timeout=${llmTimeoutSec}s)…` : "Agregando issues (modo offline — sem LLM keys)…");
117088
- spinner.start();
117089
- const llmHb = attachSpinnerHeartbeat(spinner, {
117090
- baseText: isLlmAvailable() ? "Agregando issues via LLM (Sonnet 4.6)…" : "Agregando issues (modo offline)…"
117091
- });
117092
- const topIssues = await aggregateIssues({
117093
- runId,
117094
- prodUrl: opts.prod,
117095
- candUrl: opts.cand,
117096
- viewports,
117097
- flows,
117098
- checks: remainingChecks,
117099
- timeoutMs: llmTimeoutSec * 1000
117100
- });
117101
- llmHb.stop();
117102
- stampPhase("llm-aggregate");
117103
- spinner.succeed(`${topIssues.length} issue(s) priorizada(s)`);
117002
+ const topIssues = rankTopIssues(remainingIssues);
117104
117003
  currentPhase = "report";
117105
117004
  const pagesAnalyzed = pairCaptures(checkCtx.prodPages, checkCtx.candPages).pairs.length;
117106
117005
  const scoreOf = (c, i) => {
@@ -117229,6 +117128,7 @@ ${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
117229
117128
  ${formatPagePairTable(pagePairs)}`);
117230
117129
  const missed = pagePairs.filter((p) => !p.match).length;
117231
117130
  if (missed > 0) {
117131
+ pruneOldRuns(opts, runId);
117232
117132
  console.log(chalk34.red(`
117233
117133
  ✖ ${missed}/${pagePairs.length} requested page pair(s) were not measured as requested — this report describes other pages; fix the URLs or the capture`));
117234
117134
  }
@@ -117267,6 +117167,30 @@ ${formatPagePairTable(pagePairs)}`);
117267
117167
  jsonl?.close();
117268
117168
  }
117269
117169
  }
117170
+ function pruneOldRuns(opts, runId) {
117171
+ const keep = opts.keepRuns ?? 10;
117172
+ if (!Number.isFinite(keep) || keep <= 0)
117173
+ return;
117174
+ const protect = new Set([runId]);
117175
+ for (const b of listBaselines()) {
117176
+ try {
117177
+ protect.add(JSON.parse(readFileSync38(b.path, "utf8")).fromRunId);
117178
+ } catch {}
117179
+ }
117180
+ try {
117181
+ const pruned = pruneRuns(opts.output, {
117182
+ prodUrl: opts.prod,
117183
+ candUrl: opts.cand,
117184
+ keep,
117185
+ protect
117186
+ });
117187
+ if (pruned.length > 0) {
117188
+ console.log(chalk34.dim(` --keep-runs ${keep}: removed ${pruned.length} older run(s): ${pruned.join(", ")}`));
117189
+ }
117190
+ } catch (err) {
117191
+ console.log(chalk34.yellow(` --keep-runs: pruning skipped (${err.message})`));
117192
+ }
117193
+ }
117270
117194
  function buildPartialRun(args) {
117271
117195
  const allIssues = args.checks.flatMap((c) => c.issues);
117272
117196
  const verdict = computeVerdict(args.checks, allIssues);
@@ -117281,7 +117205,7 @@ function buildPartialRun(args) {
117281
117205
  cep: args.cep,
117282
117206
  durationMs: Date.now() - args.startedAt,
117283
117207
  verdict,
117284
- topIssues: [],
117208
+ topIssues: rankTopIssues(allIssues),
117285
117209
  issues: allIssues,
117286
117210
  checks: args.checks,
117287
117211
  flowCaptures: args.flowCaptures,
@@ -117513,7 +117437,7 @@ function findPdpCapture(flows, side) {
117513
117437
  }
117514
117438
  return;
117515
117439
  }
117516
- function hostOf3(url) {
117440
+ function hostOf4(url) {
117517
117441
  try {
117518
117442
  return new URL(url).hostname;
117519
117443
  } catch {
@@ -117834,7 +117758,7 @@ function promptCommand(runId, opts) {
117834
117758
 
117835
117759
  // src/commands/qa.ts
117836
117760
  import { existsSync as existsSync35, readFileSync as readFileSync42 } from "node:fs";
117837
- import { basename as basename5, dirname as dirname9, join as join49 } from "node:path";
117761
+ import { basename as basename5, dirname as dirname10, join as join49 } from "node:path";
117838
117762
  import chalk38 from "chalk";
117839
117763
 
117840
117764
  // src/board/sweep-cards.ts
@@ -117848,7 +117772,7 @@ var SEVERITY_RANK6 = {
117848
117772
  medium: 2,
117849
117773
  low: 3
117850
117774
  };
117851
- function hostOf4(url) {
117775
+ function hostOf5(url) {
117852
117776
  try {
117853
117777
  return new URL(url).host;
117854
117778
  } catch {
@@ -117965,7 +117889,7 @@ function evidenceRef(path, run) {
117965
117889
  return `${run.artifactsUrl.replace(/\/$/, "")}/${rel}`;
117966
117890
  }
117967
117891
  function summaryCardTitle(run) {
117968
- return `${QA_PREFIX} Sweep ${hostOf4(run.url)} ${monthOf(run.timestamp)}`;
117892
+ return `${QA_PREFIX} Sweep ${hostOf5(run.url)} ${monthOf(run.timestamp)}`;
117969
117893
  }
117970
117894
  function summaryCardBody(run, filed, belowThreshold) {
117971
117895
  const t = run.totals;
@@ -118172,7 +118096,7 @@ function readSpecs(entries) {
118172
118096
  function evidenceLibraryPath(p, run) {
118173
118097
  const idx = Math.max(p.indexOf("/screenshots/"), p.indexOf("/videos/"));
118174
118098
  const rel = idx >= 0 ? p.slice(idx + 1) : p.split("/").pop() ?? p;
118175
- return `parity-sweep/${hostOf4(run.url)}/${run.runId}/${rel}`;
118099
+ return `parity-sweep/${hostOf5(run.url)}/${run.runId}/${rel}`;
118176
118100
  }
118177
118101
  function cardEvidencePaths(entries) {
118178
118102
  const paths = new Set;
@@ -118982,7 +118906,7 @@ function findPreviousSweep(outputDir, host, excludeRunId) {
118982
118906
  if (r.id === excludeRunId)
118983
118907
  continue;
118984
118908
  const rep = readReport(r.reportPath);
118985
- if (!rep || rep.mode !== "sweep" || hostOf4(rep.url) !== host)
118909
+ if (!rep || rep.mode !== "sweep" || hostOf5(rep.url) !== host)
118986
118910
  continue;
118987
118911
  return { runId: r.id, report: rep };
118988
118912
  }
@@ -119003,7 +118927,7 @@ function annotateTrend(outputDir, runId) {
119003
118927
  const report = readReport(paths.reportJson);
119004
118928
  if (!report)
119005
118929
  return null;
119006
- const prev = findPreviousSweep(outputDir, hostOf4(report.url), runId);
118930
+ const prev = findPreviousSweep(outputDir, hostOf5(report.url), runId);
119007
118931
  if (!prev) {
119008
118932
  report.trend = null;
119009
118933
  writeFileSync34(paths.reportJson, `${JSON.stringify(report, null, 2)}
@@ -119260,7 +119184,7 @@ function countTotals(issues) {
119260
119184
  var DEFAULT_SWEEP_IMAGE = "ghcr.io/decocms/parity";
119261
119185
  var DEFAULT_SWEEP_CRON = "0 6 1 * *";
119262
119186
  function buildScheduleJob(opts) {
119263
- const host = hostOf4(opts.url);
119187
+ const host = hostOf5(opts.url);
119264
119188
  const args = ["sweep", "--url", opts.url, "--board", "studio", "--yes", "--json"];
119265
119189
  if (opts.maxPages)
119266
119190
  args.push("--max-pages", String(opts.maxPages));
@@ -119335,7 +119259,7 @@ async function qaFileCommand(opts) {
119335
119259
  console.error(chalk38.red(`${opts.issues}: ${parsed.error.message}`));
119336
119260
  return 2;
119337
119261
  }
119338
- const dir = dirname9(opts.issues);
119262
+ const dir = dirname10(opts.issues);
119339
119263
  const review = readCardReview(dir);
119340
119264
  for (const i of [...parsed.data, ...review.issues])
119341
119265
  for (const e of i.evidence ?? [])
@@ -119722,7 +119646,7 @@ function renderDeckHtml(model, lang = "en") {
119722
119646
  const pages = [];
119723
119647
  pages.push(`<section class="page cover"><div class="page-inner">
119724
119648
  <div class="eyebrow">${L2("Relatório de migração", "Migration report", lang)}</div>
119725
- <h1 class="cover-h1">${esc3(hostOf5(model.candUrl))}<br/><span class="dim">${esc3(hostOf5(model.prodUrl))}</span> → <span class="lime-ink">${esc3(hostOf5(model.candUrl))}</span></h1>
119649
+ <h1 class="cover-h1">${esc3(hostOf6(model.candUrl))}<br/><span class="dim">${esc3(hostOf6(model.prodUrl))}</span> → <span class="lime-ink">${esc3(hostOf6(model.candUrl))}</span></h1>
119726
119650
  <div class="cover-meta">
119727
119651
  <div><b>${model.score}</b><small>${L2("score parity", "parity score", lang)}</small></div>
119728
119652
  <div><b>${esc3(model.status)}</b><small>${L2("veredito", "verdict", lang)}</small></div>
@@ -119769,7 +119693,7 @@ function renderDeckHtml(model, lang = "en") {
119769
119693
  <style>${DECK_CSS}</style>
119770
119694
  </head><body>
119771
119695
  <div class="nav">
119772
- <b>parity · ${esc3(hostOf5(model.candUrl))}</b>
119696
+ <b>parity · ${esc3(hostOf6(model.candUrl))}</b>
119773
119697
  <span class="spacer"></span>
119774
119698
  <div class="dots"><!-- filled by DECK_JS, one per page --></div>
119775
119699
  <span class="counter"></span>
@@ -119779,7 +119703,7 @@ function renderDeckHtml(model, lang = "en") {
119779
119703
  <script>${DECK_JS}</script>
119780
119704
  </body></html>`;
119781
119705
  }
119782
- function hostOf5(raw) {
119706
+ function hostOf6(raw) {
119783
119707
  try {
119784
119708
  return new URL(raw).host;
119785
119709
  } catch {
@@ -122027,7 +121951,7 @@ program.command("run").description([
122027
121951
  " visual-pages=5, auto-selectors=ON (if LLM), learn=ON, visual-diff=ON,",
122028
121952
  " warmup=OFF, vitals warm=ON, bypass-cache=OFF, fail-on=critical (exit 1 if hit)."
122029
121953
  ].join(`
122030
- `)).option("--prod <url>", "Production URL (source of truth, e.g. Fresh site). Omit for a single site — the run will point you to `parity e2e` (issue #141).").requiredOption("--cand <url>", "Candidate URL (migrated site, e.g. TanStack)").option("--preset <name>", "Bundle of defaults: smoke (fast, ~30s, no LLM) | full (deep audit) | ci (CI-tuned)").option("--flows <list>", "Comma-separated flows: homepage,plp,pdp,purchase-journey", "purchase-journey").option("--viewports <list>", "Comma-separated viewports: mobile,desktop", "mobile,desktop").option("--cep <cep>", "CEP for shipping calculation", "01310-100").option("--add-to-cart-timeout <ms>", "How long (ms) the add-to-cart step polls for a success signal before failing. Default 3000. Raise/lower to match your site's success-toast lifetime (issue #143).", (v) => Number(v)).option("--runs <n>", "Repeat each measurement N times (median)", "1").option("--baseline <name>", "Compare against a saved baseline").option("--output <dir>", "Output directory", "./parity-output").option("--fail-on <severities>", "Comma-separated severities that cause exit 1 (default: critical)", "critical").option("--open", "Open the HTML report after the run completes", false).option("--no-auto-selectors", "Disable LLM-based selector discovery (uses defaults instead)").option("--refresh-selectors", "Bypass selector cache and re-run discovery", false).option("--no-learn", "Don't write to learned-selectors.json (read-only mode)").option("--vitals-pages <n>", "Extra pages from sitemap to crawl for Vitals coverage, beyond what --flows/--pages already cover (default 10). These are auto-sampled and can add significant unrelated noise to findings — pass 0 to scope the run to only the pages you explicitly requested.", (v) => Number(v), 10).option("--max-viewport-concurrency <n>", "How many viewports run concurrently during collect (default 2: mobile+desktop together). Set to 1 if you hit OOM with many viewports.", (v) => Number(v), 2).option("--visual-pages <n>", "Pages to compare visually with the heatmap engine — pixel diff + box-tree diff, no LLM (home + sampled PLPs/PDPs from sitemap, default 5)", (v) => Number(v), 5).option("--pages <list>", 'Comma-separated paths to compare visually (overrides sitemap discovery). E.g. "/,/account,/p/some-product". Use "prod->cand" for a page that lives at DIFFERENT paths on each side (partial migration), e.g. "/encimera-gc60/p->/ar-condicionado-12k/p". Use this when you want deterministic coverage instead of sampled. Scopes the visual-diff + vitals-extra-pages passes ONLY — the flows crawl (--flows, default purchase-journey) discovers its own target pages independently and ignores this flag. To scope which page(s) a flow visits, use --flows to pick a lighter flow and/or set the matching *UrlHint (e.g. plpUrlHint) in .parityrc.json. Issue #178.').option("--pages-file <path>", `Read paths to compare visually from a text file (one entry per line). Lines starting with # are ignored. Accepts the same "prod->cand" pair syntax as --pages. Overrides --pages when both are present. Same visual-diff/vitals-only scope as --pages — see that flag's help. Issue #178.`).option("--no-visual-diff", "Skip the visual diff capture pass entirely").option("--no-cache", "Deprecated, no effect (the visual verdict cache is gone).").option("--clear-cache", "Deprecated, no effect (the visual verdict cache is gone).", false).option("--bypass-cache", "Bypass CDN/edge caches AND the browser's own HTTP cache (CDP cache-disable), forcing a cold-visit fetch. Use right after a deploy to avoid false failures from stale CF edge content, or to approximate Lighthouse/CrUX-comparable TTFB/FCP/LCP numbers — without this flag, parity's vitals are a warm-connection/cache-enabled ('repeat visit') measurement, not a cold first-visit one, so they aren't directly comparable 1:1 to Lighthouse.", false).option("--warmup", "Before measurement, hit each target URL once (per viewport) with a cache-buster so the Worker serves a fresh response. Recommended after deploys.", false).option("--no-warm", "Don't warm each side's URL before measuring vitals. By default every vitals-measured page is loaded once on BOTH sides first, in a throwaway page (same device + cookies), so a cold edge/loader cache on whichever side hit the route first isn't reported as a Web Vitals or CLS regression. Ignored under --bypass-cache, which measures cold on purpose. Distinct from --warmup (a cache-busted homepage hit after a deploy).").option("--accept-prod-quirks", "Demote prod-side cart-empty journey failures (VTEX session quirk) from failed to skipped. The cart-reveal-mode-divergence check still emits critical if prod/cand markup intents differ, so this flag never masks a real regression. See issue #12.", false).option("--cand-is-production", "Cand is the final production domain, not a staging host. Disables staging detection (cand on another host with noindex everywhere), so noindex/nofollow on cand is critical and third-party origins missing on cand are high again.", false).option("--llm-timeout <seconds>", "Hard timeout for the LLM aggregation call (seconds). The run completes in offline mode if the LLM hangs past this. Default: 60.", (v) => Number(v), 60).option("--timeout <minutes>", "Hard wall-clock cap for the whole run (minutes). On expiry, parity writes a partial report and exits 130. Default: 30. Issue #56.", (v) => Number(v), 30).option("--flow <name>", "Alias for --flows when running a single flow (e.g. --flow cart). Issue #53.").option("--json <path|->", "Emit JSON-Lines (one line per check) to the given file path, or '-' for stdout. Schema versioned via leading metadata line. Issue #53.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Only affects LLM-generated content (issues, explain, prompts) — the static HTML report stays in English. Issue #67.").option("--llm <provider>", "Force LLM provider: anthropic | openrouter | claude-code | none. Default: auto-detect (anthropic key → openrouter key → local claude CLI → none). Issue #66.").option("--llm-model <overrides>", "Per-feature model override, e.g. visual-diff=claude-opus-5,explain=claude-opus-5. Features: selector-discovery, step-recovery, search-terms, plp-matching, pdp-matching, section-understanding, visual-diff, issue-aggregation, explain, component-detection. Issue #66.").option("--llm-tier-default <tier>", "Override the default tier (haiku | sonnet | opus) for every feature that doesn't have a per-feature override. Issue #66.").option("--llm-model-default <model>", "Force every LLM call to use this exact model ID, ignoring per-feature defaults. Issue #66.").option("--llm-premium", "Bump the reasoning-heavy features (explain/issue-aggregation/visual-diff) to opus. Defaults are sonnet-first for cost/latency (opus blew the 60s timeout on most runs); opt into opus for hard fixes. Issue #256.").option("--no-interactive", "Disable the interactive selector prompt that auto-fires in a TTY without an LLM provider. Use in scripts and CI where stdin is technically a TTY but you don't want to pause. Issue #72.").option("--only <modules>", "Scope the run to these modules and/or single checks (comma-separated). Module names: e2e, seo, visual, vitals, cache, console, html, network. Single-check granularity via `check:<name>`, e.g. `--only e2e,check:cache-coverage`. Run `parity list modules` for the full check/flow mapping. Default: all modules. M3 module selection.").option("--skip <modules>", "Subtract these modules and/or single checks (comma-separated, same syntax as --only) from whatever base set was chosen (all modules, or --only's set if both are given). M3 module selection.").option("--why <text>", "Free-text reason for this run's scope, stored in report.json as `selectionReason`. Purely informational. M3 module selection.").option("--profile <type>", "Site profile: commerce | content. Scopes modules/flows/CEP. `content` (blog/custom site with no storefront) drops the e2e purchase journey, scopes flows to the homepage, and skips CEP. Auto-detected from the platform when omitted. Issues #254/#255.").action(async (opts) => {
121954
+ `)).option("--prod <url>", "Production URL (source of truth, e.g. Fresh site). Omit for a single site — the run will point you to `parity e2e` (issue #141).").requiredOption("--cand <url>", "Candidate URL (migrated site, e.g. TanStack)").option("--preset <name>", "Bundle of defaults: smoke (fast, ~30s, no LLM) | full (deep audit) | ci (CI-tuned)").option("--flows <list>", "Comma-separated flows: homepage,plp,pdp,purchase-journey", "purchase-journey").option("--viewports <list>", "Comma-separated viewports: mobile,desktop", "mobile,desktop").option("--cep <cep>", "CEP for shipping calculation", "01310-100").option("--add-to-cart-timeout <ms>", "How long (ms) the add-to-cart step polls for a success signal before failing. Default 3000. Raise/lower to match your site's success-toast lifetime (issue #143).", (v) => Number(v)).option("--runs <n>", "Repeat each measurement N times (median)", "1").option("--baseline <name>", "Compare against a saved baseline").option("--output <dir>", "Output directory", "./parity-output").option("--fail-on <severities>", "Comma-separated severities that cause exit 1 (default: critical)", "critical").option("--open", "Open the HTML report after the run completes", false).option("--no-auto-selectors", "Disable LLM-based selector discovery (uses defaults instead)").option("--refresh-selectors", "Bypass selector cache and re-run discovery", false).option("--no-learn", "Don't write to learned-selectors.json (read-only mode)").option("--vitals-pages <n>", "Extra pages from sitemap to crawl for Vitals coverage, beyond what --flows/--pages already cover (default 10). These are auto-sampled and can add significant unrelated noise to findings — pass 0 to scope the run to only the pages you explicitly requested.", (v) => Number(v), 10).option("--max-viewport-concurrency <n>", "How many viewports run concurrently during collect (default 2: mobile+desktop together). Set to 1 if you hit OOM with many viewports.", (v) => Number(v), 2).option("--visual-pages <n>", "Pages to compare visually with the heatmap engine — pixel diff + box-tree diff, no LLM (home + sampled PLPs/PDPs from sitemap, default 5)", (v) => Number(v), 5).option("--pages <list>", 'Comma-separated paths to compare visually (overrides sitemap discovery). E.g. "/,/account,/p/some-product". Use "prod->cand" for a page that lives at DIFFERENT paths on each side (partial migration), e.g. "/encimera-gc60/p->/ar-condicionado-12k/p". Use this when you want deterministic coverage instead of sampled. Scopes the visual-diff + vitals-extra-pages passes ONLY — the flows crawl (--flows, default purchase-journey) discovers its own target pages independently and ignores this flag. To scope which page(s) a flow visits, use --flows to pick a lighter flow and/or set the matching *UrlHint (e.g. plpUrlHint) in .parityrc.json. Issue #178.').option("--pages-file <path>", `Read paths to compare visually from a text file (one entry per line). Lines starting with # are ignored. Accepts the same "prod->cand" pair syntax as --pages. Overrides --pages when both are present. Same visual-diff/vitals-only scope as --pages — see that flag's help. Issue #178.`).option("--no-visual-diff", "Skip the visual diff capture pass entirely").option("--no-cache", "Deprecated, no effect (the visual verdict cache is gone).").option("--clear-cache", "Deprecated, no effect (the visual verdict cache is gone).", false).option("--bypass-cache", "Bypass CDN/edge caches AND the browser's own HTTP cache (CDP cache-disable), forcing a cold-visit fetch. Use right after a deploy to avoid false failures from stale CF edge content, or to approximate Lighthouse/CrUX-comparable TTFB/FCP/LCP numbers — without this flag, parity's vitals are a warm-connection/cache-enabled ('repeat visit') measurement, not a cold first-visit one, so they aren't directly comparable 1:1 to Lighthouse.", false).option("--warmup", "Before measurement, hit each target URL once (per viewport) with a cache-buster so the Worker serves a fresh response. Recommended after deploys.", false).option("--no-warm", "Don't warm each side's URL before measuring vitals. By default every vitals-measured page is loaded once on BOTH sides first, in a throwaway page (same device + cookies), so a cold edge/loader cache on whichever side hit the route first isn't reported as a Web Vitals or CLS regression. Ignored under --bypass-cache, which measures cold on purpose. Distinct from --warmup (a cache-busted homepage hit after a deploy).").option("--accept-prod-quirks", "Demote prod-side cart-empty journey failures (VTEX session quirk) from failed to skipped. The cart-reveal-mode-divergence check still emits critical if prod/cand markup intents differ, so this flag never masks a real regression. See issue #12.", false).option("--cand-is-production", "Cand is the final production domain, not a staging host. Disables staging detection (cand on another host with noindex everywhere), so noindex/nofollow on cand is critical and third-party origins missing on cand are high again.", false).option("--llm-timeout <seconds>", "Deprecated, no effect: topIssues is ranked deterministically now, there is no LLM aggregation call to time out.").option("--keep-runs <n>", "After the run, delete all but the n newest runs of this prod/cand host pair under --output (other host pairs, runs without a readable report.json and baseline-referenced runs are never touched). 0 keeps everything. Default: 10.", (v) => Number(v), 10).option("--timeout <minutes>", "Hard wall-clock cap for the whole run (minutes). On expiry, parity writes a partial report and exits 130. Default: 30. Issue #56.", (v) => Number(v), 30).option("--flow <name>", "Alias for --flows when running a single flow (e.g. --flow cart). Issue #53.").option("--json <path|->", "Emit JSON-Lines (one line per check) to the given file path, or '-' for stdout. Schema versioned via leading metadata line. Issue #53.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Only affects LLM-generated content (issues, explain, prompts) — the static HTML report stays in English. Issue #67.").option("--llm <provider>", "Force LLM provider: anthropic | openrouter | claude-code | none. Default: auto-detect (anthropic key → openrouter key → local claude CLI → none). Issue #66.").option("--llm-model <overrides>", "Per-feature model override, e.g. visual-diff=claude-opus-5,explain=claude-opus-5. Features: selector-discovery, step-recovery, search-terms, plp-matching, pdp-matching, section-understanding, visual-diff, explain, component-detection. Issue #66.").option("--llm-tier-default <tier>", "Override the default tier (haiku | sonnet | opus) for every feature that doesn't have a per-feature override. Issue #66.").option("--llm-model-default <model>", "Force every LLM call to use this exact model ID, ignoring per-feature defaults. Issue #66.").option("--llm-premium", "Bump the reasoning-heavy features (explain/visual-diff) to opus. Defaults are sonnet-first for cost/latency (opus blew the 60s timeout on most runs); opt into opus for hard fixes. Issue #256.").option("--no-interactive", "Disable the interactive selector prompt that auto-fires in a TTY without an LLM provider. Use in scripts and CI where stdin is technically a TTY but you don't want to pause. Issue #72.").option("--only <modules>", "Scope the run to these modules and/or single checks (comma-separated). Module names: e2e, seo, visual, vitals, cache, console, html, network. Single-check granularity via `check:<name>`, e.g. `--only e2e,check:cache-coverage`. Run `parity list modules` for the full check/flow mapping. Default: all modules. M3 module selection.").option("--skip <modules>", "Subtract these modules and/or single checks (comma-separated, same syntax as --only) from whatever base set was chosen (all modules, or --only's set if both are given). M3 module selection.").option("--why <text>", "Free-text reason for this run's scope, stored in report.json as `selectionReason`. Purely informational. M3 module selection.").option("--profile <type>", "Site profile: commerce | content. Scopes modules/flows/CEP. `content` (blog/custom site with no storefront) drops the e2e purchase journey, scopes flows to the homepage, and skips CEP. Auto-detected from the platform when omitted. Issues #254/#255.").action(async (opts) => {
122031
121955
  if (opts.flow) {
122032
121956
  opts.flows = opts.flow;
122033
121957
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.35.13",
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.",
3
+ "version": "0.35.14",
4
+ "description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with a ranked HTML report.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {