@decocms/parity 0.33.28 → 0.33.30
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/dist/cli.js +561 -63
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -63637,6 +63637,321 @@ function capDiff(diff, maxLines) {
|
|
|
63637
63637
|
`);
|
|
63638
63638
|
}
|
|
63639
63639
|
|
|
63640
|
+
// src/diff/box-tree.ts
|
|
63641
|
+
var STRUCTURAL_PROPS = new Set([
|
|
63642
|
+
"display",
|
|
63643
|
+
"position",
|
|
63644
|
+
"flex-direction",
|
|
63645
|
+
"justify-content",
|
|
63646
|
+
"align-items",
|
|
63647
|
+
"align-self",
|
|
63648
|
+
"justify-self",
|
|
63649
|
+
"text-align",
|
|
63650
|
+
"object-fit",
|
|
63651
|
+
"overflow",
|
|
63652
|
+
"white-space",
|
|
63653
|
+
"visibility",
|
|
63654
|
+
"grid-template-columns",
|
|
63655
|
+
"grid-template-rows"
|
|
63656
|
+
]);
|
|
63657
|
+
var VALUE_CHANGE_WEIGHT = 8;
|
|
63658
|
+
var STRUCTURAL_CHANGE_WEIGHT = 40;
|
|
63659
|
+
function parsePx(value) {
|
|
63660
|
+
const v = value.trim();
|
|
63661
|
+
if (!v)
|
|
63662
|
+
return null;
|
|
63663
|
+
const m = /^(-?\d+(?:\.\d+)?)px$/.exec(v);
|
|
63664
|
+
if (!m?.[1])
|
|
63665
|
+
return null;
|
|
63666
|
+
return Number.parseFloat(m[1]);
|
|
63667
|
+
}
|
|
63668
|
+
var r2 = (n) => Math.round(n * 100) / 100;
|
|
63669
|
+
function indexByKey(nodes) {
|
|
63670
|
+
const out = new Map;
|
|
63671
|
+
for (const n of nodes)
|
|
63672
|
+
if (!out.has(n.key))
|
|
63673
|
+
out.set(n.key, n);
|
|
63674
|
+
return out;
|
|
63675
|
+
}
|
|
63676
|
+
function uniqueLabelIndex(nodes) {
|
|
63677
|
+
const seen = new Map;
|
|
63678
|
+
for (const n of nodes) {
|
|
63679
|
+
if (!n.label)
|
|
63680
|
+
continue;
|
|
63681
|
+
seen.set(n.label, seen.has(n.label) ? null : n);
|
|
63682
|
+
}
|
|
63683
|
+
const out = new Map;
|
|
63684
|
+
for (const [k, v] of seen)
|
|
63685
|
+
if (v)
|
|
63686
|
+
out.set(k, v);
|
|
63687
|
+
return out;
|
|
63688
|
+
}
|
|
63689
|
+
function alignBoxTrees(prod, cand) {
|
|
63690
|
+
const candByKey = indexByKey(cand);
|
|
63691
|
+
const pairs = [];
|
|
63692
|
+
const usedCand = new Set;
|
|
63693
|
+
const leftoverProd = [];
|
|
63694
|
+
for (const p of prod) {
|
|
63695
|
+
const c = candByKey.get(p.key);
|
|
63696
|
+
if (c && !usedCand.has(c)) {
|
|
63697
|
+
pairs.push([p, c]);
|
|
63698
|
+
usedCand.add(c);
|
|
63699
|
+
} else {
|
|
63700
|
+
leftoverProd.push(p);
|
|
63701
|
+
}
|
|
63702
|
+
}
|
|
63703
|
+
const leftoverCand = cand.filter((c) => !usedCand.has(c));
|
|
63704
|
+
const candByLabel = uniqueLabelIndex(leftoverCand);
|
|
63705
|
+
const stillProd = [];
|
|
63706
|
+
for (const p of leftoverProd) {
|
|
63707
|
+
const c = p.label ? candByLabel.get(p.label) : undefined;
|
|
63708
|
+
if (c && !usedCand.has(c)) {
|
|
63709
|
+
pairs.push([p, c]);
|
|
63710
|
+
usedCand.add(c);
|
|
63711
|
+
} else {
|
|
63712
|
+
stillProd.push(p);
|
|
63713
|
+
}
|
|
63714
|
+
}
|
|
63715
|
+
return {
|
|
63716
|
+
pairs,
|
|
63717
|
+
onlyInProd: stillProd,
|
|
63718
|
+
onlyInCand: cand.filter((c) => !usedCand.has(c))
|
|
63719
|
+
};
|
|
63720
|
+
}
|
|
63721
|
+
function rectProps(n) {
|
|
63722
|
+
return {
|
|
63723
|
+
"rect.width": `${r2(n.rect.width)}px`,
|
|
63724
|
+
"rect.height": `${r2(n.rect.height)}px`,
|
|
63725
|
+
"rect.offsetX": `${r2(n.rect.x)}px`,
|
|
63726
|
+
"rect.offsetY": `${r2(n.rect.y)}px`
|
|
63727
|
+
};
|
|
63728
|
+
}
|
|
63729
|
+
function diffBoxTrees(prod, cand, opts = {}) {
|
|
63730
|
+
const tolerancePx = opts.tolerancePx ?? 1;
|
|
63731
|
+
const maxDeltas = opts.maxDeltas ?? 200;
|
|
63732
|
+
const { pairs, onlyInProd, onlyInCand } = alignBoxTrees(prod, cand);
|
|
63733
|
+
const deltas = [];
|
|
63734
|
+
for (const [p, c] of pairs) {
|
|
63735
|
+
const pAll = { ...p.styles, ...rectProps(p) };
|
|
63736
|
+
const cAll = { ...c.styles, ...rectProps(c) };
|
|
63737
|
+
for (const prop of Object.keys(pAll)) {
|
|
63738
|
+
const a = pAll[prop] ?? "";
|
|
63739
|
+
const b = cAll[prop] ?? "";
|
|
63740
|
+
if (a === b)
|
|
63741
|
+
continue;
|
|
63742
|
+
const pa = parsePx(a);
|
|
63743
|
+
const pb = parsePx(b);
|
|
63744
|
+
if (pa !== null && pb !== null) {
|
|
63745
|
+
const d = r2(pb - pa);
|
|
63746
|
+
if (Math.abs(d) <= tolerancePx)
|
|
63747
|
+
continue;
|
|
63748
|
+
deltas.push({
|
|
63749
|
+
key: p.key,
|
|
63750
|
+
label: p.label,
|
|
63751
|
+
prop,
|
|
63752
|
+
prod: a,
|
|
63753
|
+
cand: b,
|
|
63754
|
+
deltaPx: d,
|
|
63755
|
+
weight: Math.abs(d)
|
|
63756
|
+
});
|
|
63757
|
+
continue;
|
|
63758
|
+
}
|
|
63759
|
+
deltas.push({
|
|
63760
|
+
key: p.key,
|
|
63761
|
+
label: p.label,
|
|
63762
|
+
prop,
|
|
63763
|
+
prod: a || "(empty)",
|
|
63764
|
+
cand: b || "(empty)",
|
|
63765
|
+
deltaPx: null,
|
|
63766
|
+
weight: STRUCTURAL_PROPS.has(prop) ? STRUCTURAL_CHANGE_WEIGHT : VALUE_CHANGE_WEIGHT
|
|
63767
|
+
});
|
|
63768
|
+
}
|
|
63769
|
+
}
|
|
63770
|
+
deltas.sort((x, y) => y.weight - x.weight || x.key.localeCompare(y.key) || x.prop.localeCompare(y.prop));
|
|
63771
|
+
const brief = (n) => ({ key: n.key, label: n.label, tag: n.tag });
|
|
63772
|
+
return {
|
|
63773
|
+
matched: pairs.length,
|
|
63774
|
+
onlyInProd: onlyInProd.map(brief),
|
|
63775
|
+
onlyInCand: onlyInCand.map(brief),
|
|
63776
|
+
deltas: deltas.slice(0, maxDeltas),
|
|
63777
|
+
truncated: opts.truncated ?? false
|
|
63778
|
+
};
|
|
63779
|
+
}
|
|
63780
|
+
function isGeometryClean(diff) {
|
|
63781
|
+
return diff.deltas.length === 0 && diff.onlyInProd.length === 0 && diff.onlyInCand.length === 0;
|
|
63782
|
+
}
|
|
63783
|
+
function formatBoxTreeDiff(diff, opts = {}) {
|
|
63784
|
+
const limit = opts.limit ?? 40;
|
|
63785
|
+
if (isGeometryClean(diff)) {
|
|
63786
|
+
return `geometry: clean (${diff.matched} nodes matched)${diff.truncated ? " — TRUNCATED, absence is not proof" : ""}`;
|
|
63787
|
+
}
|
|
63788
|
+
const lines = [];
|
|
63789
|
+
const shown = diff.deltas.slice(0, limit);
|
|
63790
|
+
const keyW = Math.max(4, ...shown.map((d) => d.key.length));
|
|
63791
|
+
const propW = Math.max(4, ...shown.map((d) => d.prop.length));
|
|
63792
|
+
lines.push(`${"node".padEnd(keyW)} ${"property".padEnd(propW)} prod → cand`);
|
|
63793
|
+
for (const d of shown) {
|
|
63794
|
+
const change = d.deltaPx === null ? `${d.prod} → ${d.cand}` : `${d.prod} → ${d.cand} ${d.deltaPx > 0 ? "+" : ""}${d.deltaPx}`;
|
|
63795
|
+
lines.push(`${d.key.padEnd(keyW)} ${d.prop.padEnd(propW)} ${change}`);
|
|
63796
|
+
}
|
|
63797
|
+
if (diff.deltas.length > shown.length) {
|
|
63798
|
+
lines.push(`… ${diff.deltas.length - shown.length} more`);
|
|
63799
|
+
}
|
|
63800
|
+
for (const n of diff.onlyInProd) {
|
|
63801
|
+
lines.push(`${n.key.padEnd(keyW)} ${"—".padEnd(propW)} only in prod${n.label ? ` (${n.label})` : ""}`);
|
|
63802
|
+
}
|
|
63803
|
+
for (const n of diff.onlyInCand) {
|
|
63804
|
+
lines.push(`${n.key.padEnd(keyW)} ${"—".padEnd(propW)} only in cand${n.label ? ` (${n.label})` : ""}`);
|
|
63805
|
+
}
|
|
63806
|
+
if (diff.truncated)
|
|
63807
|
+
lines.push("TRUNCATED — node cap hit; absence of a delta is not proof");
|
|
63808
|
+
return lines.join(`
|
|
63809
|
+
`);
|
|
63810
|
+
}
|
|
63811
|
+
|
|
63812
|
+
// src/engine/box-tree.ts
|
|
63813
|
+
var BOX_TREE_KEYS = [
|
|
63814
|
+
"display",
|
|
63815
|
+
"position",
|
|
63816
|
+
"visibility",
|
|
63817
|
+
"box-sizing",
|
|
63818
|
+
"margin-top",
|
|
63819
|
+
"margin-right",
|
|
63820
|
+
"margin-bottom",
|
|
63821
|
+
"margin-left",
|
|
63822
|
+
"padding-top",
|
|
63823
|
+
"padding-right",
|
|
63824
|
+
"padding-bottom",
|
|
63825
|
+
"padding-left",
|
|
63826
|
+
"border-top-width",
|
|
63827
|
+
"border-right-width",
|
|
63828
|
+
"border-bottom-width",
|
|
63829
|
+
"border-left-width",
|
|
63830
|
+
"border-top-left-radius",
|
|
63831
|
+
"border-top-right-radius",
|
|
63832
|
+
"border-bottom-right-radius",
|
|
63833
|
+
"border-bottom-left-radius",
|
|
63834
|
+
"flex-direction",
|
|
63835
|
+
"flex-wrap",
|
|
63836
|
+
"justify-content",
|
|
63837
|
+
"align-items",
|
|
63838
|
+
"align-self",
|
|
63839
|
+
"gap",
|
|
63840
|
+
"row-gap",
|
|
63841
|
+
"column-gap",
|
|
63842
|
+
"grid-template-columns",
|
|
63843
|
+
"grid-template-rows",
|
|
63844
|
+
"font-size",
|
|
63845
|
+
"font-weight",
|
|
63846
|
+
"line-height",
|
|
63847
|
+
"letter-spacing",
|
|
63848
|
+
"text-align",
|
|
63849
|
+
"text-transform",
|
|
63850
|
+
"white-space",
|
|
63851
|
+
"color",
|
|
63852
|
+
"background-color",
|
|
63853
|
+
"object-fit",
|
|
63854
|
+
"object-position",
|
|
63855
|
+
"overflow",
|
|
63856
|
+
"opacity",
|
|
63857
|
+
"z-index",
|
|
63858
|
+
"transform"
|
|
63859
|
+
];
|
|
63860
|
+
var LABEL_ATTRS = ["data-section", "data-testid", "data-fs-section", "data-manifest-key", "id"];
|
|
63861
|
+
async function readBoxTree(page, selector, opts = {}) {
|
|
63862
|
+
const maxDepth = opts.maxDepth ?? 12;
|
|
63863
|
+
const maxNodes = opts.maxNodes ?? 400;
|
|
63864
|
+
const skipZeroArea = opts.skipZeroArea ?? false;
|
|
63865
|
+
const keys = BOX_TREE_KEYS;
|
|
63866
|
+
let exists = false;
|
|
63867
|
+
try {
|
|
63868
|
+
exists = await page.locator(selector).count() > 0;
|
|
63869
|
+
} catch (err) {
|
|
63870
|
+
return { found: false, error: `seletor inválido: ${err.message}` };
|
|
63871
|
+
}
|
|
63872
|
+
if (!exists) {
|
|
63873
|
+
return { found: false, error: `seletor '${selector}' não casou nenhum elemento` };
|
|
63874
|
+
}
|
|
63875
|
+
let got;
|
|
63876
|
+
try {
|
|
63877
|
+
got = await page.evaluate(({ sel, keys, maxDepth, maxNodes, skipZeroArea, labelAttrs }) => {
|
|
63878
|
+
try {
|
|
63879
|
+
const root = document.querySelector(sel);
|
|
63880
|
+
if (!root || !(root instanceof HTMLElement)) {
|
|
63881
|
+
return { ok: false, reason: "querySelector retornou null ou non-HTMLElement" };
|
|
63882
|
+
}
|
|
63883
|
+
const origin = root.getBoundingClientRect();
|
|
63884
|
+
const nodes = [];
|
|
63885
|
+
let truncated = false;
|
|
63886
|
+
const labelOf = (el) => {
|
|
63887
|
+
for (const a of labelAttrs) {
|
|
63888
|
+
const v = el.getAttribute(a);
|
|
63889
|
+
if (v)
|
|
63890
|
+
return v;
|
|
63891
|
+
}
|
|
63892
|
+
return null;
|
|
63893
|
+
};
|
|
63894
|
+
const walk = (el, path, depth) => {
|
|
63895
|
+
if (nodes.length >= maxNodes) {
|
|
63896
|
+
truncated = true;
|
|
63897
|
+
return;
|
|
63898
|
+
}
|
|
63899
|
+
const r = el.getBoundingClientRect();
|
|
63900
|
+
const zero = r.width === 0 && r.height === 0;
|
|
63901
|
+
if (!(skipZeroArea && zero)) {
|
|
63902
|
+
const cs = window.getComputedStyle(el);
|
|
63903
|
+
const styles = {};
|
|
63904
|
+
for (const k of keys)
|
|
63905
|
+
styles[k] = cs.getPropertyValue(k) || "";
|
|
63906
|
+
const raw = (el.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
63907
|
+
nodes.push({
|
|
63908
|
+
key: path,
|
|
63909
|
+
tag: el.tagName.toLowerCase(),
|
|
63910
|
+
depth,
|
|
63911
|
+
label: labelOf(el),
|
|
63912
|
+
rect: {
|
|
63913
|
+
x: Math.round((r.x - origin.x) * 100) / 100,
|
|
63914
|
+
y: Math.round((r.y - origin.y) * 100) / 100,
|
|
63915
|
+
width: Math.round(r.width * 100) / 100,
|
|
63916
|
+
height: Math.round(r.height * 100) / 100
|
|
63917
|
+
},
|
|
63918
|
+
styles,
|
|
63919
|
+
text: raw ? raw.slice(0, 40) : null
|
|
63920
|
+
});
|
|
63921
|
+
}
|
|
63922
|
+
if (depth >= maxDepth) {
|
|
63923
|
+
if (el.children.length > 0)
|
|
63924
|
+
truncated = true;
|
|
63925
|
+
return;
|
|
63926
|
+
}
|
|
63927
|
+
const perTag = {};
|
|
63928
|
+
for (const child of Array.from(el.children)) {
|
|
63929
|
+
const t = child.tagName.toLowerCase();
|
|
63930
|
+
const i = perTag[t] ?? 0;
|
|
63931
|
+
perTag[t] = i + 1;
|
|
63932
|
+
walk(child, `${path}>${t}[${i}]`, depth + 1);
|
|
63933
|
+
}
|
|
63934
|
+
};
|
|
63935
|
+
walk(root, root.tagName.toLowerCase(), 0);
|
|
63936
|
+
return { ok: true, nodes, truncated };
|
|
63937
|
+
} catch (err) {
|
|
63938
|
+
return {
|
|
63939
|
+
ok: false,
|
|
63940
|
+
reason: `walk falhou em '${sel}': ${err.message ?? "unknown"}`
|
|
63941
|
+
};
|
|
63942
|
+
}
|
|
63943
|
+
}, { sel: selector, keys, maxDepth, maxNodes, skipZeroArea, labelAttrs: LABEL_ATTRS });
|
|
63944
|
+
} catch (err) {
|
|
63945
|
+
return {
|
|
63946
|
+
found: false,
|
|
63947
|
+
error: `falha no page.evaluate de '${selector}': ${err.message ?? "unknown"}. Se o seletor usa sintaxe Playwright-only (text=..., :visible, xpath=...), use um seletor CSS puro.`
|
|
63948
|
+
};
|
|
63949
|
+
}
|
|
63950
|
+
if (!got.ok)
|
|
63951
|
+
return { found: false, error: got.reason };
|
|
63952
|
+
return { found: true, nodes: got.nodes, truncated: got.truncated };
|
|
63953
|
+
}
|
|
63954
|
+
|
|
63640
63955
|
// src/commands/section.ts
|
|
63641
63956
|
async function sectionCommand(opts) {
|
|
63642
63957
|
const viewport = parseViewport3(opts.viewport);
|
|
@@ -63664,6 +63979,7 @@ async function sectionCommand(opts) {
|
|
|
63664
63979
|
screenshot: facetsAsked ? Boolean(opts.screenshot) : true,
|
|
63665
63980
|
styles: facetsAsked ? Boolean(opts.computedStyles) : true,
|
|
63666
63981
|
heatmap: Boolean(opts.heatmap),
|
|
63982
|
+
boxTree: Boolean(opts.boxTree),
|
|
63667
63983
|
cssSource: Boolean(opts.cssSource),
|
|
63668
63984
|
prompt: Boolean(opts.prompt) || Boolean(opts.llmSummary),
|
|
63669
63985
|
llmSummary: Boolean(opts.llmSummary)
|
|
@@ -63690,6 +64006,7 @@ async function sectionCommand(opts) {
|
|
|
63690
64006
|
wantStyles: want.styles,
|
|
63691
64007
|
wantHtml: want.html,
|
|
63692
64008
|
wantCssSource: want.cssSource,
|
|
64009
|
+
wantBoxTree: want.boxTree,
|
|
63693
64010
|
screenshotPath: screenshotPaths.prod
|
|
63694
64011
|
}),
|
|
63695
64012
|
gatherSide(browser, {
|
|
@@ -63701,10 +64018,12 @@ async function sectionCommand(opts) {
|
|
|
63701
64018
|
wantStyles: want.styles,
|
|
63702
64019
|
wantHtml: want.html,
|
|
63703
64020
|
wantCssSource: want.cssSource,
|
|
64021
|
+
wantBoxTree: want.boxTree,
|
|
63704
64022
|
screenshotPath: screenshotPaths.cand
|
|
63705
64023
|
})
|
|
63706
64024
|
]);
|
|
63707
64025
|
const heatmap = want.heatmap ? computeHeatmap(prodSide, candSide, screenshotPaths, heatmapPath) : null;
|
|
64026
|
+
const boxTree = computeBoxTreeDiff(prodSide, candSide);
|
|
63708
64027
|
const bundlePaths = want.prompt ? await buildPromptBundle({
|
|
63709
64028
|
opts,
|
|
63710
64029
|
viewport,
|
|
@@ -63736,12 +64055,15 @@ async function sectionCommand(opts) {
|
|
|
63736
64055
|
screenshotPaths: want.screenshot ? screenshotPaths : null,
|
|
63737
64056
|
heatmap: heatmap?.analysis ?? null,
|
|
63738
64057
|
heatmapPath: heatmap?.wrote ? heatmapPath : null,
|
|
64058
|
+
boxTree: boxTree ?? null,
|
|
63739
64059
|
bundle: bundlePaths,
|
|
63740
64060
|
llmSummary
|
|
63741
64061
|
}));
|
|
63742
64062
|
return verdict(prodSide, candSide);
|
|
63743
64063
|
}
|
|
63744
64064
|
await printResults2({ opts, viewport, candSelector, prodSide, candSide, screenshotPaths, want });
|
|
64065
|
+
if (boxTree)
|
|
64066
|
+
printBoxTree(boxTree);
|
|
63745
64067
|
if (heatmap)
|
|
63746
64068
|
printHeatmap(heatmap, heatmapPath);
|
|
63747
64069
|
if (bundlePaths)
|
|
@@ -63755,6 +64077,29 @@ async function sectionCommand(opts) {
|
|
|
63755
64077
|
});
|
|
63756
64078
|
}
|
|
63757
64079
|
}
|
|
64080
|
+
function computeBoxTreeDiff(prodSide, candSide) {
|
|
64081
|
+
const p = prodSide.boxTree;
|
|
64082
|
+
const c = candSide.boxTree;
|
|
64083
|
+
if (!p || !c)
|
|
64084
|
+
return null;
|
|
64085
|
+
if (!p.found)
|
|
64086
|
+
return { error: `prod: ${p.error}` };
|
|
64087
|
+
if (!c.found)
|
|
64088
|
+
return { error: `cand: ${c.error}` };
|
|
64089
|
+
return diffBoxTrees(p.nodes, c.nodes, { truncated: p.truncated || c.truncated });
|
|
64090
|
+
}
|
|
64091
|
+
function printBoxTree(result) {
|
|
64092
|
+
console.log("");
|
|
64093
|
+
console.log(chalk14.bold(" Box tree"));
|
|
64094
|
+
if ("error" in result) {
|
|
64095
|
+
console.log(chalk14.yellow(` não foi possível comparar — ${result.error}`));
|
|
64096
|
+
return;
|
|
64097
|
+
}
|
|
64098
|
+
for (const line of formatBoxTreeDiff(result).split(`
|
|
64099
|
+
`)) {
|
|
64100
|
+
console.log(` ${line}`);
|
|
64101
|
+
}
|
|
64102
|
+
}
|
|
63758
64103
|
async function gatherSide(browser, opts) {
|
|
63759
64104
|
const ctx = await newContext(browser, { viewport: opts.viewport });
|
|
63760
64105
|
const page = await ctx.newPage();
|
|
@@ -63803,6 +64148,9 @@ async function gatherSide(browser, opts) {
|
|
|
63803
64148
|
result.styles = artifacts.styles;
|
|
63804
64149
|
result.cssSources = artifacts.cssSources;
|
|
63805
64150
|
result.cssSourceError = artifacts.cssSourceError;
|
|
64151
|
+
if (opts.wantBoxTree) {
|
|
64152
|
+
result.boxTree = await readBoxTree(page, opts.selector);
|
|
64153
|
+
}
|
|
63806
64154
|
if (opts.wantScreenshot) {
|
|
63807
64155
|
await captureSectionScreenshot(page, opts.selector, opts.screenshotPath).then((err) => {
|
|
63808
64156
|
if (err)
|
|
@@ -64366,6 +64714,7 @@ async function fixCommand(opts) {
|
|
|
64366
64714
|
outputHtml: true,
|
|
64367
64715
|
screenshot: true,
|
|
64368
64716
|
computedStyles: true,
|
|
64717
|
+
boxTree: true,
|
|
64369
64718
|
heatmap: true,
|
|
64370
64719
|
cssSource: true,
|
|
64371
64720
|
prompt: true,
|
|
@@ -65248,8 +65597,8 @@ function listCommand(output) {
|
|
|
65248
65597
|
}
|
|
65249
65598
|
|
|
65250
65599
|
// src/commands/migrate.ts
|
|
65251
|
-
import { existsSync as
|
|
65252
|
-
import { resolve as
|
|
65600
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync17, readFileSync as readFileSync25, writeFileSync as writeFileSync26 } from "node:fs";
|
|
65601
|
+
import { resolve as resolve6 } from "node:path";
|
|
65253
65602
|
import chalk20 from "chalk";
|
|
65254
65603
|
import open from "open";
|
|
65255
65604
|
|
|
@@ -66187,7 +66536,13 @@ function buildMigrationPlan(input) {
|
|
|
66187
66536
|
return {
|
|
66188
66537
|
url: bundle.url,
|
|
66189
66538
|
timestamp: bundle.timestamp,
|
|
66190
|
-
source: {
|
|
66539
|
+
source: {
|
|
66540
|
+
kind: source.kind,
|
|
66541
|
+
label: source.label,
|
|
66542
|
+
dir: source.dir,
|
|
66543
|
+
notes: inventory.notes,
|
|
66544
|
+
...input.searched ? { searched: input.searched } : {}
|
|
66545
|
+
},
|
|
66191
66546
|
target: { name: bundle.target ?? null },
|
|
66192
66547
|
pages: bundle.pages.map((p) => ({
|
|
66193
66548
|
path: p.path,
|
|
@@ -66673,6 +67028,129 @@ tree with real content, so use it to fill in props the static files leave as
|
|
|
66673
67028
|
CMS placeholders.`
|
|
66674
67029
|
};
|
|
66675
67030
|
|
|
67031
|
+
// src/migrate/sources/find.ts
|
|
67032
|
+
import { existsSync as existsSync19, readdirSync as readdirSync5, statSync } from "node:fs";
|
|
67033
|
+
import { basename as basename3, join as join33, resolve as resolve5 } from "node:path";
|
|
67034
|
+
var GENERIC_LABELS = new Set(["www", "m", "www2", "loja", "shop", "store", "secure", "web"]);
|
|
67035
|
+
var TARGET_SUFFIXES = ["-tanstack", "-faststore", "-next", "-cand", "-candidate", "-migration"];
|
|
67036
|
+
var IGNORED_DIRS = new Set(["node_modules", ".git", "dist", "build", ".next", "_archive"]);
|
|
67037
|
+
function slugFromUrl(url) {
|
|
67038
|
+
let host;
|
|
67039
|
+
try {
|
|
67040
|
+
host = new URL(url).hostname.toLowerCase();
|
|
67041
|
+
} catch {
|
|
67042
|
+
return null;
|
|
67043
|
+
}
|
|
67044
|
+
if (!host || /^[\d.]+$/.test(host) || host === "localhost")
|
|
67045
|
+
return null;
|
|
67046
|
+
const label = host.split(".").find((l) => l && !GENERIC_LABELS.has(l));
|
|
67047
|
+
return label ?? null;
|
|
67048
|
+
}
|
|
67049
|
+
function norm(name) {
|
|
67050
|
+
return name.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
67051
|
+
}
|
|
67052
|
+
function isDir(p) {
|
|
67053
|
+
try {
|
|
67054
|
+
return statSync(p).isDirectory();
|
|
67055
|
+
} catch {
|
|
67056
|
+
return false;
|
|
67057
|
+
}
|
|
67058
|
+
}
|
|
67059
|
+
function scoreCandidate(dir, slug) {
|
|
67060
|
+
const name = basename3(dir);
|
|
67061
|
+
const n = norm(name);
|
|
67062
|
+
const s = norm(slug);
|
|
67063
|
+
if (!n.startsWith(s))
|
|
67064
|
+
return null;
|
|
67065
|
+
const source = detectSource(dir);
|
|
67066
|
+
const reasons = [];
|
|
67067
|
+
let score = 0;
|
|
67068
|
+
if (n === s) {
|
|
67069
|
+
score += 3;
|
|
67070
|
+
reasons.push("exact name match");
|
|
67071
|
+
} else {
|
|
67072
|
+
score += 1;
|
|
67073
|
+
reasons.push(`name starts with "${slug}"`);
|
|
67074
|
+
}
|
|
67075
|
+
if (source.kind !== "live-only") {
|
|
67076
|
+
score += 5;
|
|
67077
|
+
reasons.push(`detected as ${source.kind}`);
|
|
67078
|
+
} else {
|
|
67079
|
+
reasons.push("no recognizable source markers");
|
|
67080
|
+
}
|
|
67081
|
+
const targetSuffix = TARGET_SUFFIXES.find((suffix) => name.toLowerCase().endsWith(suffix));
|
|
67082
|
+
if (targetSuffix) {
|
|
67083
|
+
score -= 10;
|
|
67084
|
+
reasons.push(`looks like a migration TARGET ("${targetSuffix}")`);
|
|
67085
|
+
}
|
|
67086
|
+
return { dir, kind: source.kind, label: source.label, score, why: reasons.join("; ") };
|
|
67087
|
+
}
|
|
67088
|
+
function findSourceCandidates(opts) {
|
|
67089
|
+
const slug = slugFromUrl(opts.url);
|
|
67090
|
+
const roots = opts.roots.map((r) => resolve5(r)).filter((r) => existsSync19(r) && isDir(r));
|
|
67091
|
+
if (!slug)
|
|
67092
|
+
return { roots, candidates: [] };
|
|
67093
|
+
const excluded = new Set((opts.exclude ?? []).map((p) => resolve5(p)));
|
|
67094
|
+
const seen = new Set;
|
|
67095
|
+
const candidates = [];
|
|
67096
|
+
for (const root of roots) {
|
|
67097
|
+
let entries;
|
|
67098
|
+
try {
|
|
67099
|
+
entries = readdirSync5(root);
|
|
67100
|
+
} catch {
|
|
67101
|
+
continue;
|
|
67102
|
+
}
|
|
67103
|
+
for (const entry of entries) {
|
|
67104
|
+
if (IGNORED_DIRS.has(entry) || entry.startsWith("."))
|
|
67105
|
+
continue;
|
|
67106
|
+
const dir = join33(root, entry);
|
|
67107
|
+
if (seen.has(dir) || excluded.has(dir) || !isDir(dir))
|
|
67108
|
+
continue;
|
|
67109
|
+
seen.add(dir);
|
|
67110
|
+
const c = scoreCandidate(dir, slug);
|
|
67111
|
+
if (c)
|
|
67112
|
+
candidates.push(c);
|
|
67113
|
+
}
|
|
67114
|
+
}
|
|
67115
|
+
candidates.sort((a, b) => b.score - a.score || a.dir.localeCompare(b.dir));
|
|
67116
|
+
return { roots, candidates: candidates.slice(0, opts.max ?? 5) };
|
|
67117
|
+
}
|
|
67118
|
+
function defaultSearchRoots(opts = {}) {
|
|
67119
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
67120
|
+
const roots = [join33(cwd, ".."), join33(cwd, "..", "..")];
|
|
67121
|
+
if (opts.targetDir)
|
|
67122
|
+
roots.push(join33(opts.targetDir, ".."), join33(opts.targetDir, "..", ".."));
|
|
67123
|
+
return [...new Set(roots.map((r) => resolve5(r)))];
|
|
67124
|
+
}
|
|
67125
|
+
function formatSourceHunt(result) {
|
|
67126
|
+
const searched = result.roots.length ? result.roots.map((r) => ` - ${r}`).join(`
|
|
67127
|
+
`) : " (no readable roots)";
|
|
67128
|
+
if (result.candidates.length === 0) {
|
|
67129
|
+
return [
|
|
67130
|
+
"No --source given, and no candidate repo found. Searched:",
|
|
67131
|
+
searched,
|
|
67132
|
+
"Continuing with live-only: every component will be reconstructed from the",
|
|
67133
|
+
"capture. If the original repo exists, pass --source <dir> and re-run —",
|
|
67134
|
+
"porting from code is not a small improvement over porting from pixels."
|
|
67135
|
+
].join(`
|
|
67136
|
+
`);
|
|
67137
|
+
}
|
|
67138
|
+
const lines = [
|
|
67139
|
+
"No --source given, but a candidate source repo was found. Searched:",
|
|
67140
|
+
searched,
|
|
67141
|
+
"",
|
|
67142
|
+
"Candidates, best first:"
|
|
67143
|
+
];
|
|
67144
|
+
for (const c of result.candidates) {
|
|
67145
|
+
lines.push(` - ${c.dir}`);
|
|
67146
|
+
lines.push(` ${c.kind} — ${c.why}`);
|
|
67147
|
+
}
|
|
67148
|
+
lines.push("");
|
|
67149
|
+
lines.push("Re-run with --source <dir> to build the plan from code instead of the capture.");
|
|
67150
|
+
return lines.join(`
|
|
67151
|
+
`);
|
|
67152
|
+
}
|
|
67153
|
+
|
|
66676
67154
|
// src/migrate/sources/index.ts
|
|
66677
67155
|
var SOURCES = [decoFresh, vtexIo];
|
|
66678
67156
|
var SOURCE_BY_KIND = Object.fromEntries([...SOURCES, liveOnly].map((s) => [s.kind, s]));
|
|
@@ -67206,8 +67684,9 @@ async function migrateCommand(opts) {
|
|
|
67206
67684
|
}
|
|
67207
67685
|
source = s;
|
|
67208
67686
|
}
|
|
67687
|
+
let sourceHunt = null;
|
|
67209
67688
|
if (opts.source) {
|
|
67210
|
-
if (!
|
|
67689
|
+
if (!existsSync20(opts.source)) {
|
|
67211
67690
|
console.error(chalk20.red(`--source não encontrado: ${opts.source}`));
|
|
67212
67691
|
return 2;
|
|
67213
67692
|
}
|
|
@@ -67215,15 +67694,22 @@ async function migrateCommand(opts) {
|
|
|
67215
67694
|
source = detectSource(opts.source);
|
|
67216
67695
|
sourceInventory = source.inventory(opts.source);
|
|
67217
67696
|
console.log(chalk20.dim(` source: ${source.label} — ${sourceInventory.components.length} component(s) from code`));
|
|
67697
|
+
} else if (!opts.noSourceHunt) {
|
|
67698
|
+
sourceHunt = findSourceCandidates({
|
|
67699
|
+
url: opts.url,
|
|
67700
|
+
roots: defaultSearchRoots()
|
|
67701
|
+
});
|
|
67702
|
+
const message = formatSourceHunt(sourceHunt);
|
|
67703
|
+
console.log(sourceHunt.candidates.length > 0 ? chalk20.yellow(message) : chalk20.dim(message));
|
|
67218
67704
|
}
|
|
67219
67705
|
const host = safeHost6(opts.url);
|
|
67220
|
-
const runDir =
|
|
67706
|
+
const runDir = resolve6(opts.outDir, host);
|
|
67221
67707
|
mkdirSync17(runDir, { recursive: true });
|
|
67222
67708
|
const browser = await launchBrowser({ headless: true });
|
|
67223
67709
|
try {
|
|
67224
|
-
const themePath =
|
|
67225
|
-
const assetsPath =
|
|
67226
|
-
const blocksPath =
|
|
67710
|
+
const themePath = resolve6(runDir, "theme.json");
|
|
67711
|
+
const assetsPath = resolve6(runDir, "assets.json");
|
|
67712
|
+
const blocksPath = resolve6(runDir, "blocks.json");
|
|
67227
67713
|
let theme;
|
|
67228
67714
|
let platform;
|
|
67229
67715
|
let stack = null;
|
|
@@ -67231,7 +67717,7 @@ async function migrateCommand(opts) {
|
|
|
67231
67717
|
let screenshots;
|
|
67232
67718
|
let vtexBlocks = null;
|
|
67233
67719
|
let contentMap = {};
|
|
67234
|
-
if (!opts.refresh &&
|
|
67720
|
+
if (!opts.refresh && existsSync20(themePath) && existsSync20(assetsPath)) {
|
|
67235
67721
|
theme = readJson(themePath);
|
|
67236
67722
|
const meta = readJson(assetsPath);
|
|
67237
67723
|
platform = meta.platform;
|
|
@@ -67241,7 +67727,7 @@ async function migrateCommand(opts) {
|
|
|
67241
67727
|
console.log(chalk20.dim(" phase 1 theme+assets: cached"));
|
|
67242
67728
|
} else {
|
|
67243
67729
|
console.log(chalk20.dim(` phase 1 theme+assets: scraping (${viewports.join(", ")})…`));
|
|
67244
|
-
mkdirSync17(
|
|
67730
|
+
mkdirSync17(resolve6(runDir, "screenshots"), { recursive: true });
|
|
67245
67731
|
const samples = [];
|
|
67246
67732
|
screenshots = [];
|
|
67247
67733
|
let platformSeen = null;
|
|
@@ -67267,7 +67753,7 @@ async function migrateCommand(opts) {
|
|
|
67267
67753
|
sleep3(5000)
|
|
67268
67754
|
]);
|
|
67269
67755
|
samples.push(await scrapeThemeSamples(page));
|
|
67270
|
-
const shot =
|
|
67756
|
+
const shot = resolve6(runDir, "screenshots", `${vp}.png`);
|
|
67271
67757
|
await page.screenshot({ path: shot, fullPage: true, animations: "disabled", timeout: 15000 }).then(() => screenshots.push({ viewport: vp, path: `screenshots/${vp}.png` })).catch(() => {
|
|
67272
67758
|
return;
|
|
67273
67759
|
});
|
|
@@ -67285,7 +67771,7 @@ async function migrateCommand(opts) {
|
|
|
67285
67771
|
const fetchBytes = async (url) => await browserFetchBytes(page, url) ?? await nodeFetchBytes(url);
|
|
67286
67772
|
assetsResolved = await downloadSiteAssets(rawAssets, runDir, fetchBytes);
|
|
67287
67773
|
if (rawAssets.logo?.type === "svg" || rawAssets.logo && !assetsResolved.logo) {
|
|
67288
|
-
const logoPng =
|
|
67774
|
+
const logoPng = resolve6(runDir, "assets", "logo.png");
|
|
67289
67775
|
const ok = await page.locator("[data-parity-logo]").first().screenshot({ path: logoPng, timeout: 8000 }).then(() => true).catch(() => false);
|
|
67290
67776
|
if (ok) {
|
|
67291
67777
|
assetsResolved.logo = "assets/logo.png";
|
|
@@ -67310,9 +67796,9 @@ async function migrateCommand(opts) {
|
|
|
67310
67796
|
writeFileSync26(assetsPath, `${JSON.stringify({ platform, stack, assets, screenshots }, null, 2)}
|
|
67311
67797
|
`, "utf8");
|
|
67312
67798
|
}
|
|
67313
|
-
const sitemapPath =
|
|
67799
|
+
const sitemapPath = resolve6(runDir, "sitemap.json");
|
|
67314
67800
|
let resolvedPages;
|
|
67315
|
-
if (!opts.refresh &&
|
|
67801
|
+
if (!opts.refresh && existsSync20(sitemapPath)) {
|
|
67316
67802
|
resolvedPages = readJson(sitemapPath).pages;
|
|
67317
67803
|
console.log(chalk20.dim(` phase 2 sitemap: cached (${resolvedPages.length} page(s))`));
|
|
67318
67804
|
} else {
|
|
@@ -67353,10 +67839,10 @@ async function migrateCommand(opts) {
|
|
|
67353
67839
|
console.error(chalk20.red("nenhuma página resolvida a partir de --pages"));
|
|
67354
67840
|
return 1;
|
|
67355
67841
|
}
|
|
67356
|
-
const capturePath =
|
|
67842
|
+
const capturePath = resolve6(runDir, "capture.json");
|
|
67357
67843
|
let pages;
|
|
67358
67844
|
let components;
|
|
67359
|
-
if (!opts.refresh &&
|
|
67845
|
+
if (!opts.refresh && existsSync20(capturePath)) {
|
|
67360
67846
|
const cached = readJson(capturePath);
|
|
67361
67847
|
pages = cached.pages;
|
|
67362
67848
|
components = cached.components;
|
|
@@ -67379,7 +67865,7 @@ async function migrateCommand(opts) {
|
|
|
67379
67865
|
writeFileSync26(blocksPath, `${JSON.stringify(vtexBlocks, null, 2)}
|
|
67380
67866
|
`, "utf8");
|
|
67381
67867
|
if (Object.keys(contentMap).length)
|
|
67382
|
-
writeFileSync26(
|
|
67868
|
+
writeFileSync26(resolve6(runDir, "content-assets.json"), `${JSON.stringify(contentMap, null, 2)}
|
|
67383
67869
|
`, "utf8");
|
|
67384
67870
|
const bundle = {
|
|
67385
67871
|
url: opts.url,
|
|
@@ -67400,7 +67886,17 @@ async function migrateCommand(opts) {
|
|
|
67400
67886
|
const merged = mergePlanDecisions(buildMigrationPlan({
|
|
67401
67887
|
bundle,
|
|
67402
67888
|
source: { kind: source.kind, label: source.label, dir: opts.source ?? null },
|
|
67403
|
-
inventory: sourceInventory
|
|
67889
|
+
inventory: sourceInventory,
|
|
67890
|
+
...sourceHunt ? {
|
|
67891
|
+
searched: {
|
|
67892
|
+
roots: sourceHunt.roots,
|
|
67893
|
+
candidates: sourceHunt.candidates.map((c) => ({
|
|
67894
|
+
dir: c.dir,
|
|
67895
|
+
kind: c.kind,
|
|
67896
|
+
why: c.why
|
|
67897
|
+
}))
|
|
67898
|
+
}
|
|
67899
|
+
} : {}
|
|
67404
67900
|
}), loadPlan(runDir));
|
|
67405
67901
|
const plan = merged.plan;
|
|
67406
67902
|
savePlan(runDir, plan);
|
|
@@ -67416,17 +67912,17 @@ async function migrateCommand(opts) {
|
|
|
67416
67912
|
if (format === "md" || format === "both") {
|
|
67417
67913
|
await markdownExporter2.export(bundle, runDir);
|
|
67418
67914
|
await htmlExporter.export(bundle, runDir);
|
|
67419
|
-
writeFileSync26(
|
|
67915
|
+
writeFileSync26(resolve6(runDir, "MIGRATION_PROMPT.md"), buildMigrationPrompt(bundle, playbook, {
|
|
67420
67916
|
playbook: source.playbook,
|
|
67421
67917
|
notes: sourceInventory.notes
|
|
67422
67918
|
}), "utf8");
|
|
67423
67919
|
}
|
|
67424
67920
|
const targetTheme = opts.target ? getTargetTheme(opts.target) : null;
|
|
67425
67921
|
if (targetTheme) {
|
|
67426
|
-
writeFileSync26(
|
|
67922
|
+
writeFileSync26(resolve6(runDir, targetTheme.filename), targetTheme.build(theme), "utf8");
|
|
67427
67923
|
}
|
|
67428
67924
|
if (bundle.vtex) {
|
|
67429
|
-
writeFileSync26(
|
|
67925
|
+
writeFileSync26(resolve6(runDir, "component-map.json"), `${JSON.stringify(bundle.vtex.map, null, 2)}
|
|
67430
67926
|
`, "utf8");
|
|
67431
67927
|
}
|
|
67432
67928
|
if (opts.json) {
|
|
@@ -67435,7 +67931,7 @@ async function migrateCommand(opts) {
|
|
|
67435
67931
|
}
|
|
67436
67932
|
printResults4(runDir, bundle);
|
|
67437
67933
|
if (opts.open && format !== "json") {
|
|
67438
|
-
await open(
|
|
67934
|
+
await open(resolve6(runDir, "report.html")).catch(() => {
|
|
67439
67935
|
return;
|
|
67440
67936
|
});
|
|
67441
67937
|
}
|
|
@@ -67490,7 +67986,7 @@ async function capturePages(browser, viewport, resolvedPages, theme, cfg) {
|
|
|
67490
67986
|
if (global)
|
|
67491
67987
|
seenGlobalRoles.add(component.role);
|
|
67492
67988
|
const idx = components.length + 1;
|
|
67493
|
-
const componentDir =
|
|
67989
|
+
const componentDir = resolve6(cfg.runDir, "components", componentDirName(component.role, idx));
|
|
67494
67990
|
const extracted = await extractComponent(page, component, {
|
|
67495
67991
|
outDir: componentDir,
|
|
67496
67992
|
index: idx,
|
|
@@ -68222,13 +68718,13 @@ Client notes (${notes.length})`));
|
|
|
68222
68718
|
}
|
|
68223
68719
|
|
|
68224
68720
|
// src/commands/pr.ts
|
|
68225
|
-
import { existsSync as
|
|
68226
|
-
import { join as
|
|
68721
|
+
import { existsSync as existsSync24, readFileSync as readFileSync29, writeFileSync as writeFileSync27 } from "node:fs";
|
|
68722
|
+
import { join as join36 } from "node:path";
|
|
68227
68723
|
import chalk24 from "chalk";
|
|
68228
68724
|
|
|
68229
68725
|
// src/commands/run.ts
|
|
68230
|
-
import { existsSync as
|
|
68231
|
-
import { join as
|
|
68726
|
+
import { existsSync as existsSync23, readFileSync as readFileSync28, unlinkSync as unlinkSync3 } from "node:fs";
|
|
68727
|
+
import { join as join35 } from "node:path";
|
|
68232
68728
|
import chalk23 from "chalk";
|
|
68233
68729
|
import ora8 from "ora";
|
|
68234
68730
|
|
|
@@ -68766,13 +69262,13 @@ function formatMs(ms) {
|
|
|
68766
69262
|
}
|
|
68767
69263
|
|
|
68768
69264
|
// src/commands/serve.ts
|
|
68769
|
-
import { existsSync as
|
|
69265
|
+
import { existsSync as existsSync22 } from "node:fs";
|
|
68770
69266
|
import chalk22 from "chalk";
|
|
68771
69267
|
|
|
68772
69268
|
// src/server/proxy-server.ts
|
|
68773
|
-
import { existsSync as
|
|
69269
|
+
import { existsSync as existsSync21, readFileSync as readFileSync27, statSync as statSync2 } from "node:fs";
|
|
68774
69270
|
import { createServer } from "node:http";
|
|
68775
|
-
import { extname, join as
|
|
69271
|
+
import { extname, join as join34, normalize as normalize3, resolve as resolve7, sep } from "node:path";
|
|
68776
69272
|
var MIME3 = {
|
|
68777
69273
|
".html": "text/html; charset=utf-8",
|
|
68778
69274
|
".css": "text/css; charset=utf-8",
|
|
@@ -68808,8 +69304,8 @@ var STRIPPED_REQUEST_HEADERS = new Set([
|
|
|
68808
69304
|
"origin"
|
|
68809
69305
|
]);
|
|
68810
69306
|
async function startProxyServer(runDir, opts = {}) {
|
|
68811
|
-
const absRunDir =
|
|
68812
|
-
if (!
|
|
69307
|
+
const absRunDir = resolve7(runDir);
|
|
69308
|
+
if (!existsSync21(absRunDir)) {
|
|
68813
69309
|
throw new Error(`Run directory not found: ${runDir}`);
|
|
68814
69310
|
}
|
|
68815
69311
|
const server = createServer((req, res) => {
|
|
@@ -68866,8 +69362,8 @@ async function handleRequest(req, res, runDir) {
|
|
|
68866
69362
|
return serveStatic(res, runDir, path);
|
|
68867
69363
|
}
|
|
68868
69364
|
function serveReportHtml(res, runDir) {
|
|
68869
|
-
const filePath =
|
|
68870
|
-
if (!
|
|
69365
|
+
const filePath = join34(runDir, "report.html");
|
|
69366
|
+
if (!existsSync21(filePath)) {
|
|
68871
69367
|
res.statusCode = 404;
|
|
68872
69368
|
res.end("report.html not found");
|
|
68873
69369
|
return;
|
|
@@ -68882,18 +69378,18 @@ function serveReportHtml(res, runDir) {
|
|
|
68882
69378
|
}
|
|
68883
69379
|
function serveStatic(res, runDir, path) {
|
|
68884
69380
|
const safePath = normalize3(path).replace(/^[/\\]+/, "");
|
|
68885
|
-
const filePath =
|
|
69381
|
+
const filePath = resolve7(runDir, safePath);
|
|
68886
69382
|
if (!filePath.startsWith(runDir + sep) && filePath !== runDir) {
|
|
68887
69383
|
res.statusCode = 403;
|
|
68888
69384
|
res.end("forbidden");
|
|
68889
69385
|
return;
|
|
68890
69386
|
}
|
|
68891
|
-
if (!
|
|
69387
|
+
if (!existsSync21(filePath)) {
|
|
68892
69388
|
res.statusCode = 404;
|
|
68893
69389
|
res.end("not found");
|
|
68894
69390
|
return;
|
|
68895
69391
|
}
|
|
68896
|
-
const st =
|
|
69392
|
+
const st = statSync2(filePath);
|
|
68897
69393
|
if (st.isDirectory()) {
|
|
68898
69394
|
res.statusCode = 403;
|
|
68899
69395
|
res.end("directory listing forbidden");
|
|
@@ -69042,11 +69538,11 @@ async function serveRunAndBlock(runDir, opts = {}) {
|
|
|
69042
69538
|
}
|
|
69043
69539
|
async function serveCommand(runId, opts) {
|
|
69044
69540
|
const paths = getRunPaths(opts.output, runId);
|
|
69045
|
-
if (!
|
|
69541
|
+
if (!existsSync22(paths.runDir)) {
|
|
69046
69542
|
console.error(chalk22.red(`✖ Run não encontrado: ${runId} (em ${opts.output})`));
|
|
69047
69543
|
return 1;
|
|
69048
69544
|
}
|
|
69049
|
-
if (!
|
|
69545
|
+
if (!existsSync22(paths.reportHtml)) {
|
|
69050
69546
|
console.error(chalk22.red(`✖ report.html não existe em ${paths.runDir}`));
|
|
69051
69547
|
return 1;
|
|
69052
69548
|
}
|
|
@@ -69312,8 +69808,8 @@ async function runCommand(rawOpts) {
|
|
|
69312
69808
|
}
|
|
69313
69809
|
const ignore = loadParityIgnore();
|
|
69314
69810
|
if (opts.clearCache) {
|
|
69315
|
-
const cacheFile =
|
|
69316
|
-
if (
|
|
69811
|
+
const cacheFile = join35(opts.output, "cache", "verdicts.json");
|
|
69812
|
+
if (existsSync23(cacheFile)) {
|
|
69317
69813
|
try {
|
|
69318
69814
|
unlinkSync3(cacheFile);
|
|
69319
69815
|
console.log(chalk23.dim(` cache wiped: ${cacheFile}`));
|
|
@@ -69509,8 +70005,8 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
69509
70005
|
const traceEnabled = process.env.PARITY_TRACE === "1";
|
|
69510
70006
|
const runOneSide = async (viewport, side) => {
|
|
69511
70007
|
const baseUrl = side === "prod" ? opts.prod : opts.cand;
|
|
69512
|
-
const harPath =
|
|
69513
|
-
const tracePath = traceEnabled ?
|
|
70008
|
+
const harPath = join35(paths.harDir, `${viewport}-${side}.har`);
|
|
70009
|
+
const tracePath = traceEnabled ? join35(paths.tracesDir, `${viewport}-${side}.zip`) : null;
|
|
69514
70010
|
const ctx = await newContext(browser, {
|
|
69515
70011
|
viewport,
|
|
69516
70012
|
harPath,
|
|
@@ -69832,7 +70328,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
69832
70328
|
setSpinnerLabel("Rodando checks…");
|
|
69833
70329
|
spinner.start();
|
|
69834
70330
|
const checksHb = attachSpinnerHeartbeat(spinner, { baseText: "Rodando checks…" });
|
|
69835
|
-
const cacheDir =
|
|
70331
|
+
const cacheDir = join35(opts.output, "cache");
|
|
69836
70332
|
const checkCtx = {
|
|
69837
70333
|
prodPages: allPageCaptures.filter((p) => p.side === "prod"),
|
|
69838
70334
|
candPages: allPageCaptures.filter((p) => p.side === "cand"),
|
|
@@ -70035,7 +70531,7 @@ function parsePagePair(entry) {
|
|
|
70035
70531
|
}
|
|
70036
70532
|
function resolveExplicitPages(pagesFile, pagesList) {
|
|
70037
70533
|
if (pagesFile) {
|
|
70038
|
-
if (!
|
|
70534
|
+
if (!existsSync23(pagesFile)) {
|
|
70039
70535
|
throw new Error(`--pages-file não encontrado: ${pagesFile}`);
|
|
70040
70536
|
}
|
|
70041
70537
|
const raw = readFileSync28(pagesFile, "utf-8");
|
|
@@ -70271,8 +70767,8 @@ async function prCommand(opts) {
|
|
|
70271
70767
|
return runCode || 1;
|
|
70272
70768
|
}
|
|
70273
70769
|
const latest = runs[0];
|
|
70274
|
-
const reportJsonPath =
|
|
70275
|
-
if (!
|
|
70770
|
+
const reportJsonPath = join36(opts.output, "runs", latest.id, "report.json");
|
|
70771
|
+
if (!existsSync24(reportJsonPath)) {
|
|
70276
70772
|
console.error(chalk24.red(`report.json not found at ${reportJsonPath}`));
|
|
70277
70773
|
return runCode || 1;
|
|
70278
70774
|
}
|
|
@@ -70350,7 +70846,7 @@ function buildPrComment(run, opts) {
|
|
|
70350
70846
|
}
|
|
70351
70847
|
|
|
70352
70848
|
// src/commands/prompt.ts
|
|
70353
|
-
import { existsSync as
|
|
70849
|
+
import { existsSync as existsSync25, writeFileSync as writeFileSync28 } from "node:fs";
|
|
70354
70850
|
import chalk25 from "chalk";
|
|
70355
70851
|
function promptCommand(runId, opts) {
|
|
70356
70852
|
let run;
|
|
@@ -70367,7 +70863,7 @@ function promptCommand(runId, opts) {
|
|
|
70367
70863
|
if (opts.out) {
|
|
70368
70864
|
writeFileSync28(opts.out, md, "utf8");
|
|
70369
70865
|
console.log(chalk25.green(`✔ prompt salvo em ${opts.out}`));
|
|
70370
|
-
if (
|
|
70866
|
+
if (existsSync25(opts.out)) {
|
|
70371
70867
|
const sizeKb = (md.length / 1024).toFixed(1);
|
|
70372
70868
|
console.log(chalk25.dim(` ${md.length} chars (${sizeKb} KB)`));
|
|
70373
70869
|
}
|
|
@@ -70378,8 +70874,8 @@ function promptCommand(runId, opts) {
|
|
|
70378
70874
|
}
|
|
70379
70875
|
|
|
70380
70876
|
// src/commands/report.ts
|
|
70381
|
-
import { existsSync as
|
|
70382
|
-
import { join as
|
|
70877
|
+
import { existsSync as existsSync26, readFileSync as readFileSync30, writeFileSync as writeFileSync29 } from "node:fs";
|
|
70878
|
+
import { join as join37 } from "node:path";
|
|
70383
70879
|
import chalk26 from "chalk";
|
|
70384
70880
|
import open2 from "open";
|
|
70385
70881
|
|
|
@@ -70976,7 +71472,7 @@ async function reportCommand(runId, opts) {
|
|
|
70976
71472
|
return 1;
|
|
70977
71473
|
}
|
|
70978
71474
|
const html = renderDeckHtml(buildDeckModel(run), opts.lang ?? "en");
|
|
70979
|
-
const dest = opts.out ??
|
|
71475
|
+
const dest = opts.out ?? join37(paths.runDir, "deck.html");
|
|
70980
71476
|
writeFileSync29(dest, html, "utf8");
|
|
70981
71477
|
console.log(`${chalk26.green("✓")} deck → ${dest}`);
|
|
70982
71478
|
if (opts.open) {
|
|
@@ -71008,7 +71504,7 @@ async function reportCommand(runId, opts) {
|
|
|
71008
71504
|
return 1;
|
|
71009
71505
|
}
|
|
71010
71506
|
}
|
|
71011
|
-
if (!
|
|
71507
|
+
if (!existsSync26(paths.reportHtml)) {
|
|
71012
71508
|
console.error(chalk26.red(`report.html not found at ${paths.reportHtml}`));
|
|
71013
71509
|
return 1;
|
|
71014
71510
|
}
|
|
@@ -71029,9 +71525,9 @@ async function reportCommand(runId, opts) {
|
|
|
71029
71525
|
}
|
|
71030
71526
|
|
|
71031
71527
|
// src/commands/vitals.ts
|
|
71032
|
-
import { existsSync as
|
|
71528
|
+
import { existsSync as existsSync27, readFileSync as readFileSync31, writeFileSync as writeFileSync30 } from "node:fs";
|
|
71033
71529
|
import { availableParallelism } from "node:os";
|
|
71034
|
-
import { join as
|
|
71530
|
+
import { join as join38 } from "node:path";
|
|
71035
71531
|
import chalk27 from "chalk";
|
|
71036
71532
|
import ora9 from "ora";
|
|
71037
71533
|
|
|
@@ -71370,7 +71866,7 @@ async function vitalsCommand(opts) {
|
|
|
71370
71866
|
});
|
|
71371
71867
|
progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
|
|
71372
71868
|
if (opts.lighthouse !== false) {
|
|
71373
|
-
const lhDir =
|
|
71869
|
+
const lhDir = join38(paths.runDir, "lighthouse");
|
|
71374
71870
|
const lhCap = opts.lighthouseConcurrency ?? Math.max(1, Math.min(2, Math.floor(availableParallelism() / 2)));
|
|
71375
71871
|
const done = tasks.filter((t) => !!t.capture);
|
|
71376
71872
|
const lhT0 = Date.now();
|
|
@@ -71459,7 +71955,7 @@ async function vitalsCommand(opts) {
|
|
|
71459
71955
|
writeRunReportJson(paths.runDir, run);
|
|
71460
71956
|
const html = renderHtmlReport(run, paths.runDir);
|
|
71461
71957
|
writeRunReportHtml(paths.runDir, html);
|
|
71462
|
-
writeFileSync30(
|
|
71958
|
+
writeFileSync30(join38(paths.runDir, "vitals.json"), `${JSON.stringify({
|
|
71463
71959
|
schemaVersion: "0.1",
|
|
71464
71960
|
prodUrl: opts.prod,
|
|
71465
71961
|
candUrl: opts.cand,
|
|
@@ -71563,7 +72059,7 @@ async function discoverPagePaths2(prodUrl, opts) {
|
|
|
71563
72059
|
function parseUrlList(input) {
|
|
71564
72060
|
if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
|
|
71565
72061
|
const path = input.replace(/^file:\/\//, "");
|
|
71566
|
-
if (
|
|
72062
|
+
if (existsSync27(path)) {
|
|
71567
72063
|
return readFileSync31(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
|
|
71568
72064
|
}
|
|
71569
72065
|
}
|
|
@@ -71584,14 +72080,14 @@ function printSummary8(vitals, cache, scores, opportunities, agentic) {
|
|
|
71584
72080
|
|
|
71585
72081
|
// src/util/version.ts
|
|
71586
72082
|
import { readFileSync as readFileSync32 } from "node:fs";
|
|
71587
|
-
import { dirname as dirname6, resolve as
|
|
72083
|
+
import { dirname as dirname6, resolve as resolve8 } from "node:path";
|
|
71588
72084
|
import { fileURLToPath } from "node:url";
|
|
71589
72085
|
function getPackageVersion() {
|
|
71590
72086
|
try {
|
|
71591
72087
|
const here = dirname6(fileURLToPath(import.meta.url));
|
|
71592
72088
|
for (const up of ["..", "../..", "../../.."]) {
|
|
71593
72089
|
try {
|
|
71594
|
-
const pkgPath =
|
|
72090
|
+
const pkgPath = resolve8(here, up, "package.json");
|
|
71595
72091
|
const raw = readFileSync32(pkgPath, "utf8");
|
|
71596
72092
|
const parsed = JSON.parse(raw);
|
|
71597
72093
|
if (parsed.name === "@decocms/parity" && typeof parsed.version === "string") {
|
|
@@ -71878,7 +72374,7 @@ program.command("check").argument("<name>", "check name (kebab-case, e.g. consol
|
|
|
71878
72374
|
json: opts.json
|
|
71879
72375
|
}));
|
|
71880
72376
|
});
|
|
71881
|
-
program.command("section").description("Focused prod×cand comparison of one section: HTML diff + screenshot + computed-styles diff. No flags = all 3 facets. Designed for the 'in DOM but invisible' debug loop (issue #31).").requiredOption("--prod <url>", "Production URL (base, e.g. https://www.example.com)").requiredOption("--cand <url>", "Candidate URL (base, e.g. https://example.deco-cx.workers.dev)").requiredOption("--selector <sel>", "CSS selector for the section to compare").option("--cand-selector <sel>", "CSS selector on the CANDIDATE side, when the ported component no longer matches --selector (VTEX IO class names → hashed CSS Modules, data-fs-* attributes, …). Defaults to --selector.").option("--output-html", "Include the HTML diff facet (default: on if no facet flag passed)", false).option("--screenshot", "Include the screenshot facet (locator screenshot per side)", false).option("--computed-styles", "Include the computed-styles diff facet", false).option("--heatmap", "Run pixelmatch on the two screenshots and analyze diff regions (bounding box + hotspots). Implies --screenshot.", false).option("--css-source", "For each divergent computed-style property, resolve which CSS rule (stylesheet + selector) produced it via CDP. Useful when the LLM needs to know which file to edit.", false).option("--prompt", "Emit an LLM-ready bundle: <prefix>-bundle.json (machine-readable) + <prefix>-prompt.md (opinionated Markdown with embedded images). Implies all signals.", false).option("--llm-summary", "After building the bundle, invoke Claude (needs ANTHROPIC_API_KEY) and print a 1-paragraph 'what I understood' summary. Does NOT generate a patch. Implies --prompt.", false).option("--all", "Turn on every diagnostic facet at once (html + screenshot + computed-styles + heatmap + css-source + prompt + llm-summary) — the pixel-perfect debug shortcut formerly known as `parity fix`. Issue #415.", false).option("--no-llm", "With --all, skip the LLM call (still writes the markdown bundle). Use when offline or to avoid API costs.").option("--viewport <viewport>", "mobile | desktop | tablet", "mobile").option("--wait <ms>", "Extra ms after networkidle so hydration settles", "2000").option("--out-dir <dir>", "Where to write the screenshots", "./parity-output/sections").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
|
|
72377
|
+
program.command("section").description("Focused prod×cand comparison of one section: HTML diff + screenshot + computed-styles diff, plus an opt-in numeric box-tree diff (--box-tree). No flags = all 3 facets. Designed for the 'in DOM but invisible' debug loop (issue #31).").requiredOption("--prod <url>", "Production URL (base, e.g. https://www.example.com)").requiredOption("--cand <url>", "Candidate URL (base, e.g. https://example.deco-cx.workers.dev)").requiredOption("--selector <sel>", "CSS selector for the section to compare").option("--cand-selector <sel>", "CSS selector on the CANDIDATE side, when the ported component no longer matches --selector (VTEX IO class names → hashed CSS Modules, data-fs-* attributes, …). Defaults to --selector.").option("--output-html", "Include the HTML diff facet (default: on if no facet flag passed)", false).option("--screenshot", "Include the screenshot facet (locator screenshot per side)", false).option("--computed-styles", "Include the computed-styles diff facet", false).option("--heatmap", "Run pixelmatch on the two screenshots and analyze diff regions (bounding box + hotspots). Implies --screenshot.", false).option("--box-tree", "Walk the selector's whole subtree on both sides and report numeric box deltas, biggest first (`margin-top: 32px → 24px -8`). Deterministic, no LLM — this is the answer to 'everything is a little off', which a pixelmatch percentage and a vision paragraph cannot give.", false).option("--css-source", "For each divergent computed-style property, resolve which CSS rule (stylesheet + selector) produced it via CDP. Useful when the LLM needs to know which file to edit.", false).option("--prompt", "Emit an LLM-ready bundle: <prefix>-bundle.json (machine-readable) + <prefix>-prompt.md (opinionated Markdown with embedded images). Implies all signals.", false).option("--llm-summary", "After building the bundle, invoke Claude (needs ANTHROPIC_API_KEY) and print a 1-paragraph 'what I understood' summary. Does NOT generate a patch. Implies --prompt.", false).option("--all", "Turn on every diagnostic facet at once (html + screenshot + computed-styles + heatmap + css-source + prompt + llm-summary) — the pixel-perfect debug shortcut formerly known as `parity fix`. Issue #415.", false).option("--no-llm", "With --all, skip the LLM call (still writes the markdown bundle). Use when offline or to avoid API costs.").option("--viewport <viewport>", "mobile | desktop | tablet", "mobile").option("--wait <ms>", "Extra ms after networkidle so hydration settles", "2000").option("--out-dir <dir>", "Where to write the screenshots", "./parity-output/sections").option("--json", "Emit one-line JSON instead of pretty text", false).action(async (opts) => {
|
|
71882
72378
|
process.exit(await sectionCommand({
|
|
71883
72379
|
prod: opts.prod,
|
|
71884
72380
|
cand: opts.cand,
|
|
@@ -71887,6 +72383,7 @@ program.command("section").description("Focused prod×cand comparison of one sec
|
|
|
71887
72383
|
outputHtml: opts.all ? true : opts.outputHtml,
|
|
71888
72384
|
screenshot: opts.all ? true : opts.screenshot,
|
|
71889
72385
|
computedStyles: opts.all ? true : opts.computedStyles,
|
|
72386
|
+
boxTree: opts.all ? true : opts.boxTree,
|
|
71890
72387
|
heatmap: opts.all ? true : opts.heatmap,
|
|
71891
72388
|
cssSource: opts.all ? true : opts.cssSource,
|
|
71892
72389
|
prompt: opts.all ? true : opts.prompt,
|
|
@@ -71897,7 +72394,7 @@ program.command("section").description("Focused prod×cand comparison of one sec
|
|
|
71897
72394
|
json: opts.json
|
|
71898
72395
|
}));
|
|
71899
72396
|
});
|
|
71900
|
-
program.command("fix").description("[deprecated: use `parity section --all`] Pixel-perfect debug shortcut: run `parity section` with ALL signals on (HTML + screenshot + computed-styles + heatmap + CSS source) and emit an LLM-ready Markdown bundle. When ANTHROPIC_API_KEY is set, also prints a 1-paragraph summary of what Claude understood from the signals — does NOT generate a patch (you ask for that in a follow-up turn).").requiredOption("--prod <url>", "Production URL (source of truth)").requiredOption("--cand <url>", "Candidate URL (migrated)").requiredOption("--selector <sel>", "CSS selector for the section to fix").option("--cand-selector <sel>", "CSS selector on the CANDIDATE side, when the ported component no longer matches --selector. Defaults to --selector.").option("--viewport <viewport>", "mobile | desktop | tablet", "mobile").option("--wait <ms>", "Extra ms after networkidle so hydration settles", "2000").option("--out-dir <dir>", "Where to write the bundle + screenshots", "./parity-output/sections").option("--json", "Emit one-line JSON instead of pretty text", false).option("--no-llm", "Skip the LLM call (still writes the markdown bundle). Use when offline or to avoid API costs.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Issue #67.").action(async (opts) => {
|
|
72397
|
+
program.command("fix").description("[deprecated: use `parity section --all`] Pixel-perfect debug shortcut: run `parity section` with ALL signals on (HTML + screenshot + computed-styles + box-tree + heatmap + CSS source) and emit an LLM-ready Markdown bundle. When ANTHROPIC_API_KEY is set, also prints a 1-paragraph summary of what Claude understood from the signals — does NOT generate a patch (you ask for that in a follow-up turn).").requiredOption("--prod <url>", "Production URL (source of truth)").requiredOption("--cand <url>", "Candidate URL (migrated)").requiredOption("--selector <sel>", "CSS selector for the section to fix").option("--cand-selector <sel>", "CSS selector on the CANDIDATE side, when the ported component no longer matches --selector. Defaults to --selector.").option("--viewport <viewport>", "mobile | desktop | tablet", "mobile").option("--wait <ms>", "Extra ms after networkidle so hydration settles", "2000").option("--out-dir <dir>", "Where to write the bundle + screenshots", "./parity-output/sections").option("--json", "Emit one-line JSON instead of pretty text", false).option("--no-llm", "Skip the LLM call (still writes the markdown bundle). Use when offline or to avoid API costs.").option("--pt", "Tell the LLM to respond in Brazilian Portuguese. Issue #67.").action(async (opts) => {
|
|
71901
72398
|
deprecatedNotice("fix", "section --all");
|
|
71902
72399
|
if (opts.pt) {
|
|
71903
72400
|
await Promise.resolve().then(() => init_client());
|
|
@@ -71928,7 +72425,7 @@ program.command("extract").description("Single-site AI-ready component extractio
|
|
|
71928
72425
|
}));
|
|
71929
72426
|
});
|
|
71930
72427
|
function buildCaptureCommand(name, deprecated) {
|
|
71931
|
-
return new Command(name).description(`${deprecated ? "[deprecated: use `parity capture`] " : ""}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 capture 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("--source <dir>", "Path to the source repo. When set, the component inventory is read from CODE (exhaustive, exact names) and the VTEX-IO runtime scrape is gated on the source actually being VTEX IO. Without it, everything comes from the live capture (original behaviour).").option("--source-kind <kind>", "Override source auto-detection: deco-fresh | vtex-io | live-only. Only needed when detection fails.").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) => {
|
|
72428
|
+
return new Command(name).description(`${deprecated ? "[deprecated: use `parity capture`] " : ""}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 capture 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("--source <dir>", "Path to the source repo. When set, the component inventory is read from CODE (exhaustive, exact names) and the VTEX-IO runtime scrape is gated on the source actually being VTEX IO. Without it, everything comes from the live capture (original behaviour).").option("--source-kind <kind>", "Override source auto-detection: deco-fresh | vtex-io | live-only. Only needed when detection fails.").option("--no-source-hunt", "Skip the on-disk search for a source repo when --source is omitted. Without --source the command sweeps sibling directories for one.").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) => {
|
|
71932
72429
|
if (deprecated)
|
|
71933
72430
|
deprecatedNotice("migrate", "capture");
|
|
71934
72431
|
process.exit(await migrateCommand({
|
|
@@ -71938,6 +72435,7 @@ function buildCaptureCommand(name, deprecated) {
|
|
|
71938
72435
|
target: opts.target,
|
|
71939
72436
|
source: opts.source,
|
|
71940
72437
|
sourceKind: opts.sourceKind,
|
|
72438
|
+
noSourceHunt: !opts.sourceHunt,
|
|
71941
72439
|
viewport: opts.viewport,
|
|
71942
72440
|
viewports: opts.viewports,
|
|
71943
72441
|
sample: opts.sample,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.30",
|
|
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",
|