@decocms/parity 0.20.0 → 0.21.0

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/CHANGELOG.md +12 -0
  2. package/dist/cli.js +162 -52
  3. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.21.0] — 2026-08-17
11
+
12
+ ### Added
13
+
14
+ * **`parity migrate` now covers the whole store, not just the home page.** It samples extra pages per kind from the classified sitemap (`--sample`, default `plp=2,pdp=2,other=3,search=1`, capped at 15) — including **institutional** pages (`other`, which prefers real about/contact/policy URLs over deep categories) — and reads the **VTEX block tree + content on every captured page**, merged by treePath. On Electrolux this took the captured content from home-only to home + PLP + PDP + institutional (`store.home`/`store.product`/`store.search`). (#214)
15
+ * **Report organized per page.** `index.md` / `index.html` / `report.html` show a "Global components" section (captured once) plus one section per captured page — a single report separated by page. (#214)
16
+
17
+ ### Fixed
18
+
19
+ * **Exact-duplicate VTEX blocks are collapsed** (a `product-summary` per product, repeated layout wrappers) into one representative with a `repeated` count, keeping distinct-content blocks — `blocks.json` went from 5242 to 883 on Electrolux without losing content. (#215)
20
+ * **`category-auto` no longer lands on an institutional page** (institutional keywords filtered from the PLP pick). (#214)
21
+
10
22
  ## [0.20.0] — 2026-08-17
11
23
 
12
24
  ### Added
package/dist/cli.js CHANGED
@@ -44445,7 +44445,9 @@ function pickPlpFromHomeHtml(html3, homeUrl) {
44445
44445
  continue;
44446
44446
  candidates.add(href.split("?")[0]);
44447
44447
  }
44448
- const sorted = Array.from(candidates).sort((a, b) => a.length - b.length);
44448
+ const INSTITUTIONAL = /(sobre|about|institucional|contato|contact|ajuda|help|faq|blog|trabalhe|careers|carreiras|politica|policy|privacidade|privacy|termos|terms|troca|devolu|garantia|warranty|lojas|stores|imprensa|press|sustentab|newsletter)/i;
44449
+ const filtered = Array.from(candidates).filter((c) => !INSTITUTIONAL.test(c));
44450
+ const sorted = (filtered.length ? filtered : Array.from(candidates)).sort((a, b) => a.length - b.length);
44449
44451
  const pick = sorted[0];
44450
44452
  if (!pick)
44451
44453
  return null;
@@ -59276,10 +59278,10 @@ var markdownExporter2 = {
59276
59278
  notes.push(`\`${dirName}\`: HTML truncated to fit the per-component token ceiling`);
59277
59279
  writeFileSync19(join20(componentDir, "README.md"), renderComponentReadme2(bundle.url, component, compact.html), "utf8");
59278
59280
  });
59279
- writeFileSync19(join20(outDir, "index.md"), renderIndex2(bundle, dirNames, notes), "utf8");
59281
+ writeFileSync19(join20(outDir, "index.md"), renderIndex2(bundle, notes), "utf8");
59280
59282
  }
59281
59283
  };
59282
- function renderIndex2(bundle, dirNames, notes) {
59284
+ function renderIndex2(bundle, notes) {
59283
59285
  const lines = [];
59284
59286
  const md = lines.push.bind(lines);
59285
59287
  md(`# Migration snapshot: ${bundle.url}`);
@@ -59318,17 +59320,37 @@ function renderIndex2(bundle, dirNames, notes) {
59318
59320
  }
59319
59321
  md("");
59320
59322
  }
59321
- md("## Components");
59322
- md("");
59323
- md("| Scope | Role | e2e keys | Folder |");
59324
- md("|---|---|---|---|");
59325
- bundle.components.forEach((c, i) => {
59326
- const keys = c.interactions.map((x) => x.e2eKey).filter((k) => Boolean(k));
59327
- const uniqueKeys = [...new Set(keys)];
59323
+ const compIndex = new Map;
59324
+ bundle.components.forEach((c, i) => compIndex.set(`${c.role}::${c.selector}`, i + 1));
59325
+ const rowFor = (c) => {
59326
+ const keys = [...new Set(c.interactions.map((x) => x.e2eKey).filter((k) => Boolean(k)))];
59327
+ const dir = componentDirName(c.role, compIndex.get(`${c.role}::${c.selector}`) ?? 1);
59328
59328
  const roleCell = c.repeated && c.repeated > 1 ? `\`${c.role}\` ×${c.repeated}` : `\`${c.role}\``;
59329
- md(`| ${c.scope} | ${roleCell} | ${uniqueKeys.length ? uniqueKeys.map((k) => `\`${k}\``).join(", ") : "—"} | [${dirNames[i]}](./components/${dirNames[i]}/README.md) |`);
59330
- });
59329
+ return `| ${roleCell} | ${keys.length ? keys.map((k) => `\`${k}\``).join(", ") : "—"} | [${dir}](./components/${dir}/README.md) |`;
59330
+ };
59331
+ const globalComps = bundle.components.filter((c) => c.scope === "global");
59332
+ md("## Components — by page");
59333
+ md("");
59334
+ md(`### Global (${globalComps.length}) — on every page`);
59335
+ md("");
59336
+ md("| Role | e2e keys | Folder |");
59337
+ md("|---|---|---|");
59338
+ for (const c of globalComps)
59339
+ md(rowFor(c));
59331
59340
  md("");
59341
+ for (const pg of bundle.pages) {
59342
+ md(`### Page: ${pg.kind} \`${pg.path}\``);
59343
+ md("");
59344
+ if (pg.components.length) {
59345
+ md("| Role | e2e keys | Folder |");
59346
+ md("|---|---|---|");
59347
+ for (const c of pg.components)
59348
+ md(rowFor(c));
59349
+ } else {
59350
+ md("_no page-specific components_");
59351
+ }
59352
+ md("");
59353
+ }
59332
59354
  if (notes.length) {
59333
59355
  md("## Compaction notes");
59334
59356
  md("");
@@ -59494,11 +59516,19 @@ function renderHtml(b, embed) {
59494
59516
  const src = embed(s.path);
59495
59517
  return src ? `<figure><figcaption>${esc(s.viewport)}</figcaption><img src="${esc(src)}" alt="${esc(s.viewport)}"></figure>` : "";
59496
59518
  }).join("");
59497
- const componentRows = b.components.map((c, i) => {
59519
+ const compIndex = new Map;
59520
+ b.components.forEach((c, i) => compIndex.set(`${c.role}::${c.selector}`, i + 1));
59521
+ const compHead = "<tr><th>role</th><th>tw</th><th>interactions</th><th>e2e keys</th><th>folder</th></tr>";
59522
+ const rowFor = (c) => {
59498
59523
  const keys = [...new Set(c.interactions.map((x) => x.e2eKey).filter(Boolean))];
59499
- const folder = componentDirName(c.role, i + 1);
59500
- return `<tr><td>${esc(c.scope)}</td><td><code>${esc(c.role)}</code>${c.repeated && c.repeated > 1 ? ` <span class="badge">×${c.repeated}</span>` : ""}</td><td>${c.tailwind.length}</td><td>${c.interactions.length}</td><td>${keys.length ? keys.map((k) => `<code>${esc(String(k))}</code>`).join(" ") : "—"}</td><td><a href="components/${esc(folder)}/README.md">${esc(folder)}</a></td></tr>`;
59501
- }).join("");
59524
+ const folder = componentDirName(c.role, compIndex.get(`${c.role}::${c.selector}`) ?? 1);
59525
+ return `<tr><td><code>${esc(c.role)}</code>${c.repeated && c.repeated > 1 ? ` <span class="badge">×${c.repeated}</span>` : ""}</td><td>${c.tailwind.length}</td><td>${c.interactions.length}</td><td>${keys.length ? keys.map((k) => `<code>${esc(String(k))}</code>`).join(" ") : "—"}</td><td><a href="components/${esc(folder)}/README.md">${esc(folder)}</a></td></tr>`;
59526
+ };
59527
+ const globalComps = b.components.filter((c) => c.scope === "global");
59528
+ const componentsByPage = [
59529
+ `<section class="card"><h2>Global components (${globalComps.length})</h2><p class="dim">Captured once — shown on every page (header, footer, minicart…).</p><table>${compHead}${globalComps.map(rowFor).join("")}</table></section>`,
59530
+ ...b.pages.map((pg) => `<section class="card"><h2>Page: ${esc(pg.kind)} <code>${esc(pg.path)}</code></h2>${pg.components.length ? `<table>${compHead}${pg.components.map(rowFor).join("")}</table>` : '<p class="dim">no page-specific components</p>'}</section>`)
59531
+ ].join("");
59502
59532
  const vtexRows = b.vtex ? b.vtex.map.slice(0, 80).map((m) => `<tr><td><code>${esc(m.vtex)}</code></td><td>${m.faststore ? `<code>${esc(m.faststore)}</code>` : "<em>custom-component</em>"}</td><td>${m.confidence || "—"}</td><td>${m.count}</td></tr>`).join("") : "";
59503
59533
  const iconRows = t && b.assets.icons.length ? b.assets.icons.slice(0, 40).map((ic) => `<tr><td>${esc(ic.kind)}</td><td><code>${esc(ic.id)}</code></td><td>${ic.count}</td></tr>`).join("") : "";
59504
59534
  return `<!doctype html>
@@ -59585,13 +59615,8 @@ function renderHtml(b, embed) {
59585
59615
 
59586
59616
  ${b.vtex ? `<section class="card"><h2>VTEX IO → FastStore blocks</h2><p class="dim">${b.vtex.blocks.length} block instances from the store runtime · ${b.vtex.blocks.filter((x) => x.props).length} carry CMS content (props), ${countContentImages(b.vtex.blocks)} content images downloaded to <code>assets/content/</code> (URLs rewritten in <code>blocks.json</code>). <b>confidence</b> = how sure the deterministic mapper is (0–1).</p><table><tr><th>VTEX block</th><th>→ FastStore</th><th>confidence</th><th>count</th></tr>${vtexRows}</table></section>` : ""}
59587
59617
 
59588
- <section class="card">
59589
- <h2>Components (${b.components.length})</h2>
59590
- <table>
59591
- <tr><th>scope</th><th>role</th><th>tw</th><th>interactions</th><th>e2e keys</th><th>folder</th></tr>
59592
- ${componentRows}
59593
- </table>
59594
- </section>
59618
+ <section class="card"><h2>Components (${b.components.length}) — by page</h2></section>
59619
+ ${componentsByPage}
59595
59620
 
59596
59621
  <section class="card links">
59597
59622
  <h2>Files</h2>
@@ -60034,7 +60059,7 @@ function lookup(blockName) {
60034
60059
  function mapVtexBlocksToFastStore(blocks) {
60035
60060
  const counts = new Map;
60036
60061
  for (const b of blocks)
60037
- counts.set(b.blockName, (counts.get(b.blockName) ?? 0) + 1);
60062
+ counts.set(b.blockName, (counts.get(b.blockName) ?? 0) + (b.repeated ?? 1));
60038
60063
  const out = [];
60039
60064
  for (const [vtex, count] of counts) {
60040
60065
  const entry = lookup(vtex);
@@ -60048,6 +60073,18 @@ function mapVtexBlocksToFastStore(blocks) {
60048
60073
  }
60049
60074
 
60050
60075
  // src/migrate/vtex/runtime.ts
60076
+ function dedupeVtexBlocks(blocks) {
60077
+ const groups = new Map;
60078
+ for (const b of blocks) {
60079
+ const key = `${b.blockName}\x00${JSON.stringify(b.props ?? null)}`;
60080
+ const existing = groups.get(key);
60081
+ if (existing)
60082
+ existing.repeated = (existing.repeated ?? 1) + 1;
60083
+ else
60084
+ groups.set(key, { ...b });
60085
+ }
60086
+ return [...groups.values()];
60087
+ }
60051
60088
  function blockNameFromTreePath(treePath) {
60052
60089
  const leaf = treePath.split("/").pop() ?? treePath;
60053
60090
  const noInstance = leaf.split("#")[0] ?? leaf;
@@ -60294,14 +60331,13 @@ async function migrateCommand(opts) {
60294
60331
  let assets;
60295
60332
  let screenshots;
60296
60333
  let vtexBlocks = null;
60334
+ let contentMap = {};
60297
60335
  if (!opts.refresh && existsSync11(themePath) && existsSync11(assetsPath)) {
60298
60336
  theme = readJson(themePath);
60299
60337
  const meta = readJson(assetsPath);
60300
60338
  platform = meta.platform;
60301
60339
  assets = meta.assets;
60302
60340
  screenshots = meta.screenshots ?? [];
60303
- if (existsSync11(blocksPath))
60304
- vtexBlocks = readJson(blocksPath);
60305
60341
  console.log(chalk16.dim(" phase 1 theme+assets: cached"));
60306
60342
  } else {
60307
60343
  console.log(chalk16.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
@@ -60348,19 +60384,6 @@ async function migrateCommand(opts) {
60348
60384
  assetsResolved.logoSource = assetsResolved.logoSource ?? "screenshot";
60349
60385
  }
60350
60386
  }
60351
- vtexBlocks = await readVtexBlockTree(page);
60352
- if (vtexBlocks) {
60353
- const refMap = collectImageRefs(vtexBlocks, opts.url);
60354
- vtexBlocks = rewriteBlockUrls(vtexBlocks, refMap);
60355
- const stateImages = await readVtexStateImages(page);
60356
- const absUrls = [...new Set([...Object.values(refMap), ...stateImages])];
60357
- const { map: map2, downloaded, skipped } = await downloadContentImages(absUrls, runDir, fetchBytes);
60358
- if (Object.keys(map2).length)
60359
- writeFileSync21(resolve3(runDir, "content-assets.json"), `${JSON.stringify(map2, null, 2)}
60360
- `, "utf8");
60361
- if (absUrls.length)
60362
- console.log(chalk16.dim(` vtex content: ${absUrls.length} image URLs (${Object.keys(refMap).length} CMS + ${stateImages.length} catalog) · ${downloaded} downloaded${skipped ? ` (${skipped} over cap skipped)` : ""}`));
60363
- }
60364
60387
  }
60365
60388
  } finally {
60366
60389
  await page.close().catch(() => {
@@ -60378,11 +60401,6 @@ async function migrateCommand(opts) {
60378
60401
  `, "utf8");
60379
60402
  writeFileSync21(assetsPath, `${JSON.stringify({ platform, assets, screenshots }, null, 2)}
60380
60403
  `, "utf8");
60381
- if (vtexBlocks) {
60382
- writeFileSync21(blocksPath, `${JSON.stringify(vtexBlocks, null, 2)}
60383
- `, "utf8");
60384
- console.log(chalk16.dim(` vtex io: ${vtexBlocks.length} blocks read from runtime`));
60385
- }
60386
60404
  }
60387
60405
  const sitemapPath = resolve3(runDir, "sitemap.json");
60388
60406
  let resolvedPages;
@@ -60411,6 +60429,15 @@ async function migrateCommand(opts) {
60411
60429
  });
60412
60430
  }
60413
60431
  const classified = sitemapUrls.slice(0, 500).map((u) => ({ url: u, kind: kindOf(u) }));
60432
+ const sampled = sampleFromSitemap(classified, parseSample(opts.sample), resolvedPages);
60433
+ resolvedPages = [...resolvedPages, ...sampled].slice(0, MAX_PAGES);
60434
+ if (sampled.length) {
60435
+ const byKind = sampled.reduce((a, p) => {
60436
+ a[p.kind] = (a[p.kind] ?? 0) + 1;
60437
+ return a;
60438
+ }, {});
60439
+ console.log(chalk16.dim(` phase 2 sitemap: +${sampled.length} sampled (${Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ")})`));
60440
+ }
60414
60441
  writeFileSync21(sitemapPath, `${JSON.stringify({ pages: resolvedPages, sitemapUrls: classified }, null, 2)}
60415
60442
  `, "utf8");
60416
60443
  }
@@ -60425,17 +60452,21 @@ async function migrateCommand(opts) {
60425
60452
  const cached = readJson(capturePath);
60426
60453
  pages = cached.pages;
60427
60454
  components = cached.components;
60455
+ vtexBlocks = cached.vtexBlocks ?? null;
60456
+ contentMap = cached.contentMap ?? {};
60428
60457
  console.log(chalk16.dim(` phase 3 components: cached (${components.length})`));
60429
60458
  } else {
60430
60459
  console.log(chalk16.dim(" phase 3 components: capturing…"));
60431
- ({ pages, components } = await capturePages(browser, primaryViewport, resolvedPages, theme, {
60432
- allowlist,
60433
- llm: !opts.noLlm,
60434
- runDir
60435
- }));
60436
- writeFileSync21(capturePath, `${JSON.stringify({ pages, components }, null, 2)}
60460
+ ({ pages, components, vtexBlocks, contentMap } = await capturePages(browser, primaryViewport, resolvedPages, theme, { allowlist, llm: !opts.noLlm, runDir, baseUrl: opts.url }));
60461
+ writeFileSync21(capturePath, `${JSON.stringify({ pages, components, vtexBlocks, contentMap }, null, 2)}
60437
60462
  `, "utf8");
60438
60463
  }
60464
+ if (vtexBlocks)
60465
+ writeFileSync21(blocksPath, `${JSON.stringify(vtexBlocks, null, 2)}
60466
+ `, "utf8");
60467
+ if (Object.keys(contentMap).length)
60468
+ writeFileSync21(resolve3(runDir, "content-assets.json"), `${JSON.stringify(contentMap, null, 2)}
60469
+ `, "utf8");
60439
60470
  const bundle = {
60440
60471
  url: opts.url,
60441
60472
  timestamp: new Date().toISOString(),
@@ -60481,10 +60512,13 @@ async function migrateCommand(opts) {
60481
60512
  });
60482
60513
  }
60483
60514
  }
60515
+ var CONTENT_IMAGE_BUDGET = 200;
60484
60516
  async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
60485
60517
  const pages = [];
60486
60518
  const components = [];
60487
60519
  const seenGlobalRoles = new Set;
60520
+ const blocksByPath = new Map;
60521
+ const contentMap = {};
60488
60522
  for (const target of resolvedPages) {
60489
60523
  const ctx = await newContext(browser, { viewport });
60490
60524
  const page = await ctx.newPage();
@@ -60535,6 +60569,22 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
60535
60569
  pageComponents.push(migrated);
60536
60570
  }
60537
60571
  pages.push({ url: target.url, path: target.path, kind: target.kind, components: pageComponents });
60572
+ const pageBlocks = await readVtexBlockTree(page);
60573
+ if (pageBlocks) {
60574
+ const refMap = collectImageRefs(pageBlocks, cfg.baseUrl);
60575
+ for (const b of rewriteBlockUrls(pageBlocks, refMap)) {
60576
+ if (!blocksByPath.has(b.treePath))
60577
+ blocksByPath.set(b.treePath, b);
60578
+ }
60579
+ if (Object.keys(contentMap).length < CONTENT_IMAGE_BUDGET) {
60580
+ const stateImages = await readVtexStateImages(page);
60581
+ const fetchBytes = async (url) => await browserFetchBytes(page, url) ?? await nodeFetchBytes(url);
60582
+ const remaining = CONTENT_IMAGE_BUDGET - Object.keys(contentMap).length;
60583
+ const absUrls = [...new Set([...Object.values(refMap), ...stateImages])].filter((u) => !(u in contentMap)).slice(0, remaining);
60584
+ const { map: map2 } = await downloadContentImages(absUrls, cfg.runDir, fetchBytes);
60585
+ Object.assign(contentMap, map2);
60586
+ }
60587
+ }
60538
60588
  } finally {
60539
60589
  await page.close().catch(() => {
60540
60590
  return;
@@ -60544,7 +60594,12 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
60544
60594
  });
60545
60595
  }
60546
60596
  }
60547
- return { pages, components };
60597
+ return {
60598
+ pages,
60599
+ components,
60600
+ vtexBlocks: blocksByPath.size ? dedupeVtexBlocks([...blocksByPath.values()]) : null,
60601
+ contentMap
60602
+ };
60548
60603
  }
60549
60604
  async function resolvePages2(page, baseUrl, pagesSpec, homeHtml, platform) {
60550
60605
  const tokens = (pagesSpec ?? "/,category-auto,pdp-auto").split(",").map((s) => s.trim()).filter(Boolean);
@@ -60629,6 +60684,60 @@ async function structuralSignatures(page, selectors) {
60629
60684
  return selectors.map(() => "");
60630
60685
  }
60631
60686
  }
60687
+ var DEFAULT_SAMPLE = "plp=2,pdp=2,other=3,search=1";
60688
+ var MAX_PAGES = 15;
60689
+ var INSTITUTIONAL_URL = /(sobre|about|institucional|quem-somos|contato|contact|ajuda|help|faq|blog|trabalhe|careers|carreiras|politica|policy|privacidade|privacy|termos|terms|troca|devolu|garantia|warranty|lojas|stores|imprensa|press|sustentab|acessibilidade|cookies)/i;
60690
+ function parseSample(spec) {
60691
+ const out = {};
60692
+ for (const part of (spec ?? DEFAULT_SAMPLE).split(",")) {
60693
+ const [k, n] = part.split("=").map((s) => s.trim());
60694
+ const count = Number.parseInt(n ?? "", 10);
60695
+ if (k && Number.isFinite(count) && count > 0)
60696
+ out[k] = count;
60697
+ }
60698
+ return out;
60699
+ }
60700
+ function pickSpread(items, count) {
60701
+ if (items.length <= count)
60702
+ return items;
60703
+ const step = items.length / count;
60704
+ const out = [];
60705
+ for (let i = 0;i < count; i++)
60706
+ out.push(items[Math.floor(i * step)]);
60707
+ return out;
60708
+ }
60709
+ function sampleFromSitemap(classified, spec, existing) {
60710
+ const seen = new Set(existing.map((p) => p.url));
60711
+ const byKind = new Map;
60712
+ for (const c of classified) {
60713
+ if (c.kind === "home" || seen.has(c.url))
60714
+ continue;
60715
+ const list = byKind.get(c.kind) ?? [];
60716
+ list.push(c.url);
60717
+ byKind.set(c.kind, list);
60718
+ }
60719
+ const other = byKind.get("other");
60720
+ if (other) {
60721
+ const inst = other.filter((u) => INSTITUTIONAL_URL.test(u));
60722
+ byKind.set("other", [...inst, ...other.filter((u) => !INSTITUTIONAL_URL.test(u))]);
60723
+ }
60724
+ const out = [];
60725
+ for (const [kind, count] of Object.entries(spec)) {
60726
+ const source = byKind.get(kind) ?? [];
60727
+ const chosen = kind === "other" ? source.slice(0, count) : pickSpread(source, count);
60728
+ for (const url of chosen) {
60729
+ if (seen.has(url))
60730
+ continue;
60731
+ seen.add(url);
60732
+ let path = url;
60733
+ try {
60734
+ path = new URL(url).pathname;
60735
+ } catch {}
60736
+ out.push({ path, url, kind });
60737
+ }
60738
+ }
60739
+ return out;
60740
+ }
60632
60741
  function kindOf(url) {
60633
60742
  try {
60634
60743
  return classifyPath2(new URL(url).pathname);
@@ -63322,7 +63431,7 @@ program.command("extract").description("Single-site AI-ready component extractio
63322
63431
  json: opts.json
63323
63432
  }));
63324
63433
  });
63325
- program.command("migrate").description("Single-site, phased migration capture (theme → sitemap → components). No prod×cand comparison — produces a target-agnostic, token-lean bundle + prompt for a migration agent: site theme (colors/typography/spacing as Tailwind tokens), classified pages, and per-component detail (suggested Tailwind classes, interaction hints, e2e selectors). Works whether or not the source code exists. Pass --target faststore to append a target playbook. Resumable: re-runs skip a completed phase unless --refresh.").requiredOption("--url <url>", "Site to migrate from").option("--pages <list>", 'Comma-separated pages: literal paths/URLs, and/or "category-auto"/"pdp-auto". Default: "/,category-auto,pdp-auto" (home + a PLP + a PDP).').option("--components <list>", "Comma-separated role allowlist, e.g. header,footer,nav,shelf,minicart. Default: all detected.").option("--target <name>", "Target playbook to append to the prompt (e.g. faststore)").option("--viewport <viewport>", "Primary viewport for component capture: mobile | desktop | tablet", "mobile").option("--viewports <list>", "Comma-separated viewports for theme + site screenshots (e.g. mobile,desktop). Default: --viewport only.").option("--format <fmt>", "md | json | both", "both").option("--out <dir>", "Output directory (stable per host, for resume)", "./parity-migrate").option("--refresh", "Re-run all phases even if cached artifacts exist", false).option("--open", "Open the generated index.html visual report in the browser", false).option("--no-llm", "Skip the optional LLM component-relabeling pass (heuristic detection always runs regardless).").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
63434
+ program.command("migrate").description("Single-site, phased migration capture (theme → sitemap → components). No prod×cand comparison — produces a target-agnostic, token-lean bundle + prompt for a migration agent: site theme (colors/typography/spacing as Tailwind tokens), classified pages, and per-component detail (suggested Tailwind classes, interaction hints, e2e selectors). Works whether or not the source code exists. Pass --target faststore to append a target playbook. Resumable: re-runs skip a completed phase unless --refresh.").requiredOption("--url <url>", "Site to migrate from").option("--pages <list>", 'Comma-separated pages: literal paths/URLs, and/or "category-auto"/"pdp-auto". Default: "/,category-auto,pdp-auto" (home + a PLP + a PDP).').option("--components <list>", "Comma-separated role allowlist, e.g. header,footer,nav,shelf,minicart. Default: all detected.").option("--target <name>", "Target playbook to append to the prompt (e.g. faststore)").option("--viewport <viewport>", "Primary viewport for component capture: mobile | desktop | tablet", "mobile").option("--viewports <list>", "Comma-separated viewports for theme + site screenshots (e.g. mobile,desktop). Default: --viewport only.").option("--sample <spec>", "Extra pages to sample from the sitemap by kind, e.g. 'plp=2,pdp=2,other=3,search=1' (other = institutional). Default samples a few of each incl. institutional pages.").option("--format <fmt>", "md | json | both", "both").option("--out <dir>", "Output directory (stable per host, for resume)", "./parity-migrate").option("--refresh", "Re-run all phases even if cached artifacts exist", false).option("--open", "Open the generated index.html visual report in the browser", false).option("--no-llm", "Skip the optional LLM component-relabeling pass (heuristic detection always runs regardless).").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
63326
63435
  process.exit(await migrateCommand({
63327
63436
  url: opts.url,
63328
63437
  pages: opts.pages,
@@ -63330,6 +63439,7 @@ program.command("migrate").description("Single-site, phased migration capture (t
63330
63439
  target: opts.target,
63331
63440
  viewport: opts.viewport,
63332
63441
  viewports: opts.viewports,
63442
+ sample: opts.sample,
63333
63443
  format: opts.format,
63334
63444
  outDir: opts.out,
63335
63445
  refresh: opts.refresh,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/parity",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
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",