@decocms/parity 0.33.56 → 0.33.58
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 +118 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -63037,6 +63037,14 @@ function joinUrl(base, path) {
|
|
|
63037
63037
|
function shellQuote(value) {
|
|
63038
63038
|
return /^[\w./:=-]+$/.test(value) ? value : `'${value.replace(/'/g, "'\\''")}'`;
|
|
63039
63039
|
}
|
|
63040
|
+
function sourcePath(plan, c) {
|
|
63041
|
+
if (!c.file)
|
|
63042
|
+
return null;
|
|
63043
|
+
const dir = plan.source.dir;
|
|
63044
|
+
if (!dir)
|
|
63045
|
+
return c.file;
|
|
63046
|
+
return `${dir.replace(/\/+$/, "")}/${c.file.replace(/^\/+/, "")}`;
|
|
63047
|
+
}
|
|
63040
63048
|
function disposition(c) {
|
|
63041
63049
|
if (c.status === "pending" || c.status === "partial")
|
|
63042
63050
|
return "build";
|
|
@@ -63081,6 +63089,7 @@ function pagePlan(plan, path, candUrl) {
|
|
|
63081
63089
|
scope: c.scope ?? "page",
|
|
63082
63090
|
origin: c.origin,
|
|
63083
63091
|
selector,
|
|
63092
|
+
source: sourcePath(plan, c),
|
|
63084
63093
|
against: d === "validate" ? { url: refUrl, kind } : null,
|
|
63085
63094
|
command: checkable && candUrl && selector ? `parity section --prod ${shellQuote(joinUrl(refUrl, page.path))} --cand ${shellQuote(joinUrl(candUrl, page.path))} --selector ${shellQuote(selector)}` : null,
|
|
63086
63095
|
note: c.reference?.note ?? null
|
|
@@ -68172,6 +68181,8 @@ ${DISPOSITION_STYLE[d](chalk22.bold(d))} (${rows.length})`);
|
|
|
68172
68181
|
if (t.against?.kind === "reference") {
|
|
68173
68182
|
console.log(chalk22.cyan(` reference: ${t.against.url}`));
|
|
68174
68183
|
}
|
|
68184
|
+
if (t.source)
|
|
68185
|
+
console.log(chalk22.green(` source: ${t.source}`));
|
|
68175
68186
|
if (t.command)
|
|
68176
68187
|
console.log(chalk22.gray(` $ ${t.command}`));
|
|
68177
68188
|
}
|
|
@@ -70958,6 +70969,46 @@ function findingsTable(findings, omitted, lang) {
|
|
|
70958
70969
|
const tail = omitted > 0 ? `<p class="annotation">${L2(`+${omitted} achado(s) além dos mostrados — veja report.json.`, `+${omitted} more finding(s) beyond those shown — see report.json.`, lang)}</p>` : "";
|
|
70959
70970
|
return `<table class="grid compact"><thead><tr><th>${L2("Sev", "Sev", lang)}</th><th>${L2("Categoria", "Category", lang)}</th><th>${L2("Achado", "Finding", lang)}</th></tr></thead><tbody>${rows}</tbody></table>${tail}`;
|
|
70960
70971
|
}
|
|
70972
|
+
var CELL_CLASS = {
|
|
70973
|
+
ok: "cell-ok",
|
|
70974
|
+
new: "cell-new",
|
|
70975
|
+
warn: "cell-warn",
|
|
70976
|
+
gap: "cell-gap"
|
|
70977
|
+
};
|
|
70978
|
+
var PILL_CLASS = {
|
|
70979
|
+
ok: "pill-good",
|
|
70980
|
+
new: "pill-lime",
|
|
70981
|
+
warn: "pill-warn",
|
|
70982
|
+
gap: "pill-bad"
|
|
70983
|
+
};
|
|
70984
|
+
function blockPages(blocks, lang) {
|
|
70985
|
+
const eyebrow = L2("Blocos", "Blocks", lang);
|
|
70986
|
+
if (blocks.rows.length === 0) {
|
|
70987
|
+
return [
|
|
70988
|
+
page(eyebrow, L2("Mapa de calor dos componentes", "Component heat map", lang), `<p class="annotation">${L2("O migration-plan.json foi lido, mas não lista nenhum componente — não há o que mostrar aqui.", "migration-plan.json was read but lists no components — there is nothing to show here.", lang)}</p>`)
|
|
70989
|
+
];
|
|
70990
|
+
}
|
|
70991
|
+
const byName = new Map(blocks.rows.map((r) => [r.component, r]));
|
|
70992
|
+
const legend = `<div class="legend">${[
|
|
70993
|
+
["ok", "feito", "done"],
|
|
70994
|
+
["new", "upgrade", "upgrade"],
|
|
70995
|
+
["warn", "parcial / as-is / skipped", "partial / as-is / skipped"],
|
|
70996
|
+
["gap", "pendente", "pending"]
|
|
70997
|
+
].map(([tone, pt, en]) => `<span class="lg"><i class="cell ${CELL_CLASS[tone]}"></i>${L2(pt, en, lang)}</span>`).join("")}</div>`;
|
|
70998
|
+
const zones = blocks.zones.map((z) => {
|
|
70999
|
+
const label = z.zone === "global" ? L2("Global (header, footer, nav)", "Global (header, footer, nav)", lang) : z.zone === "unassigned" ? L2("Sem página", "Unassigned", lang) : esc3(z.zone);
|
|
71000
|
+
const cells = z.components.map((name) => {
|
|
71001
|
+
const tone = byName.get(name)?.tone ?? "gap";
|
|
71002
|
+
return `<div class="cell ${CELL_CLASS[tone]}">${esc3(name)}</div>`;
|
|
71003
|
+
}).join("");
|
|
71004
|
+
return `<div class="zone"><div class="zone-head"><b>${label}</b><span class="zone-score num">${z.settled}/${z.components.length}</span></div><div class="cells">${cells}</div></div>`;
|
|
71005
|
+
}).join("");
|
|
71006
|
+
const rows = blocks.rows.map((r) => `<tr><td>${esc3(r.component)}</td><td>${esc3(r.role)}</td><td><span class="pill ${PILL_CLASS[r.tone]}">${esc3(r.status)}</span></td><td>${r.verified ? esc3(r.verified) : "—"}</td><td>${esc3(r.note)}</td></tr>`).join("");
|
|
71007
|
+
return [
|
|
71008
|
+
page(eyebrow, L2("Mapa de calor dos componentes", "Component heat map", lang), legend + zones, L2(`${blocks.rows.length} componentes do migration-plan.json, agrupados pela página em que a captura os viu. O placar de cada zona conta done e upgrade.`, `${blocks.rows.length} components from migration-plan.json, grouped by the page the capture saw them on. Each zone's score counts done and upgrade.`, lang)),
|
|
71009
|
+
page(eyebrow, L2("Bloco a bloco", "Block by block", lang), `<table class="grid compact"><thead><tr><th>${L2("Componente", "Component", lang)}</th><th>${L2("Papel", "Role", lang)}</th><th>${L2("Status", "Status", lang)}</th><th>${L2("Verificado", "Verified", lang)}</th><th>${L2("Nota", "Note", lang)}</th></tr></thead><tbody>${rows}</tbody></table>`, L2("Status como o plano registra. Verificado vazio (—) quer dizer que ninguém mediu, não que passou.", "Status as the plan records it. An empty verified (—) means nobody measured it, not that it passed.", lang))
|
|
71010
|
+
];
|
|
71011
|
+
}
|
|
70961
71012
|
function renderDeckHtml(model, lang = "en") {
|
|
70962
71013
|
const pages = [];
|
|
70963
71014
|
pages.push(`<section class="page cover"><div class="page-inner">
|
|
@@ -70976,6 +71027,8 @@ function renderDeckHtml(model, lang = "en") {
|
|
|
70976
71027
|
}
|
|
70977
71028
|
const moduleRows = model.modules.map((m) => `<tr><td>${esc3(m.module)}</td><td><b class="num">${m.score}</b></td><td><span class="pill pill-${m.tone === "good" ? "good" : m.tone === "warn" ? "warn" : m.tone === "neutral" ? "neutral" : "bad"}">${esc3(m.status)}</span></td></tr>`).join("");
|
|
70978
71029
|
pages.push(page(L2("Sumário executivo", "Executive summary", lang), L2("Onde a migração está", "Where the migration stands", lang), tiles(model.headline, lang) + (moduleRows ? `<h3 class="sub">${L2("Score por módulo", "Score per module", lang)}</h3>` + `<table class="grid"><tbody>${moduleRows}</tbody></table>` : "")));
|
|
71030
|
+
if (model.blocks)
|
|
71031
|
+
pages.push(...blockPages(model.blocks, lang));
|
|
70979
71032
|
pages.push(page(L2("Achados", "Findings", lang), L2("O que a validação encontrou", "What the validation found", lang), findingsTable(model.findings, model.findingsOmitted, lang)));
|
|
70980
71033
|
if (model.visual) {
|
|
70981
71034
|
pages.push(page(L2("Visual", "Visual", lang), L2("Paridade visual", "Visual parity", lang), tiles([
|
|
@@ -71039,7 +71092,52 @@ function toneForStatus(status) {
|
|
|
71039
71092
|
return "neutral";
|
|
71040
71093
|
return "bad";
|
|
71041
71094
|
}
|
|
71042
|
-
|
|
71095
|
+
var TONE_BY_STATUS = {
|
|
71096
|
+
done: "ok",
|
|
71097
|
+
upgrade: "new",
|
|
71098
|
+
partial: "warn",
|
|
71099
|
+
"as-is": "warn",
|
|
71100
|
+
skipped: "warn",
|
|
71101
|
+
pending: "gap"
|
|
71102
|
+
};
|
|
71103
|
+
function buildDeckBlocks(plan) {
|
|
71104
|
+
const rows = plan.components.map((c) => ({
|
|
71105
|
+
component: c.name,
|
|
71106
|
+
role: c.role,
|
|
71107
|
+
status: c.status,
|
|
71108
|
+
tone: TONE_BY_STATUS[c.status] ?? "gap",
|
|
71109
|
+
verified: c.verified?.verdict ?? null,
|
|
71110
|
+
note: c.reference?.note ?? ""
|
|
71111
|
+
}));
|
|
71112
|
+
const byKey = new Map(rows.map((r) => [key(r.component), r]));
|
|
71113
|
+
const isGlobal = new Set(rows.filter((_, i) => plan.components[i]?.scope === "global"));
|
|
71114
|
+
const zones = [];
|
|
71115
|
+
const push = (zone, members) => {
|
|
71116
|
+
if (members.length === 0)
|
|
71117
|
+
return;
|
|
71118
|
+
zones.push({
|
|
71119
|
+
zone,
|
|
71120
|
+
components: members.map((m) => m.component),
|
|
71121
|
+
settled: members.filter((m) => m.tone === "ok" || m.tone === "new").length
|
|
71122
|
+
});
|
|
71123
|
+
};
|
|
71124
|
+
push("global", [...isGlobal]);
|
|
71125
|
+
const placed = new Set;
|
|
71126
|
+
for (const page of plan.pages) {
|
|
71127
|
+
const members = new Set;
|
|
71128
|
+
for (const name of page.components ?? []) {
|
|
71129
|
+
const row = byKey.get(key(name));
|
|
71130
|
+
if (row && !isGlobal.has(row))
|
|
71131
|
+
members.add(row);
|
|
71132
|
+
}
|
|
71133
|
+
for (const m of members)
|
|
71134
|
+
placed.add(m);
|
|
71135
|
+
push(page.path, [...members]);
|
|
71136
|
+
}
|
|
71137
|
+
push("unassigned", rows.filter((r) => !isGlobal.has(r) && !placed.has(r)));
|
|
71138
|
+
return { rows, zones };
|
|
71139
|
+
}
|
|
71140
|
+
function buildDeckModel(run, plan = null) {
|
|
71043
71141
|
const v = run.verdict;
|
|
71044
71142
|
const source = run.topIssues.length > 0 ? run.topIssues : run.issues;
|
|
71045
71143
|
const ranked = [...source].sort(bySeverity);
|
|
@@ -71098,7 +71196,8 @@ function buildDeckModel(run) {
|
|
|
71098
71196
|
pagesChecked: run.visualDiff.pagesChecked,
|
|
71099
71197
|
pagesPassed: run.visualDiff.pagesPassed,
|
|
71100
71198
|
pagesWithDiffs: run.visualDiff.pagesWithDiffs
|
|
71101
|
-
} : null
|
|
71199
|
+
} : null,
|
|
71200
|
+
blocks: plan ? buildDeckBlocks(plan) : null
|
|
71102
71201
|
};
|
|
71103
71202
|
}
|
|
71104
71203
|
var SEVERITY_ORDER4 = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
@@ -71272,7 +71371,20 @@ async function reportCommand(runId, opts) {
|
|
|
71272
71371
|
console.error(chalk27.red(`failed to load run: ${err.message}`));
|
|
71273
71372
|
return 1;
|
|
71274
71373
|
}
|
|
71275
|
-
|
|
71374
|
+
let plan = null;
|
|
71375
|
+
if (opts.planDir) {
|
|
71376
|
+
try {
|
|
71377
|
+
plan = loadPlan(opts.planDir);
|
|
71378
|
+
} catch (err) {
|
|
71379
|
+
console.error(chalk27.red(`failed to read migration-plan.json: ${err.message}`));
|
|
71380
|
+
return 1;
|
|
71381
|
+
}
|
|
71382
|
+
if (!plan) {
|
|
71383
|
+
console.error(chalk27.red(`no migration-plan.json in ${opts.planDir}`));
|
|
71384
|
+
return 1;
|
|
71385
|
+
}
|
|
71386
|
+
}
|
|
71387
|
+
const html = renderDeckHtml(buildDeckModel(run, plan), opts.lang ?? "en");
|
|
71276
71388
|
const dest = opts.out ?? join36(paths.runDir, "deck.html");
|
|
71277
71389
|
writeFileSync28(dest, html, "utf8");
|
|
71278
71390
|
console.log(`${chalk27.green("✓")} deck → ${dest}`);
|
|
@@ -77546,7 +77658,7 @@ program.command("serve").argument("<runId>", "Run ID to serve").description("Spa
|
|
|
77546
77658
|
program.command("event").argument("<type>", "Event type: phase-change | dispatch | bench | score | note | …").description("Record a migration event into <dir>/events.jsonl — the sanctioned emission path for hooks and the orchestrator. The cockpit daemon tails this file into its live activity feed.").option("--dir <dir>", "Directory holding events.jsonl (the target's .parity/)", ".parity").option("--data <json>", `JSON object of event fields, e.g. '{"agent":"porter","component":"hero"}'`).action((type, opts) => {
|
|
77547
77659
|
process.exit(eventCommand(type, opts));
|
|
77548
77660
|
});
|
|
77549
|
-
program.command("report").argument("<runId>", "Run ID to open").description("Open the HTML report for a run in the default browser. With --section, extract a single tab to stdout instead — useful for agents that need just the SEO/Network/Vitals slice without parsing the whole report. Issue #74.").option("--output <dir>", "Output directory", "./parity-output").option("--section <name>", "Extract one tab to stdout instead of opening the report. Valid names: summary, visualdiff, seo, sidebyside, issues, vitals, cache, checks, prompt, pages, console, network, diff.").option("--json", "Pair with --section to emit a normalized JSON projection of the section (from report.json) instead of the raw HTML slice.").option("--deck", "Render the presentation deck instead: one topic per full-viewport page, advanced sideways, in a single self-contained HTML file. For showing the result to someone rather than debugging it. Issue #290.", false).option("--out <path>", "Where to write the deck (default: deck.html in the run dir)").option("--lang <pt|en>", "Initial deck language; the in-page toggle still switches live", "en").option("--open", "Open the rendered deck in the browser", false).action(async (runId, opts) => {
|
|
77661
|
+
program.command("report").argument("<runId>", "Run ID to open").description("Open the HTML report for a run in the default browser. With --section, extract a single tab to stdout instead — useful for agents that need just the SEO/Network/Vitals slice without parsing the whole report. Issue #74.").option("--output <dir>", "Output directory", "./parity-output").option("--section <name>", "Extract one tab to stdout instead of opening the report. Valid names: summary, visualdiff, seo, sidebyside, issues, vitals, cache, checks, prompt, pages, console, network, diff.").option("--json", "Pair with --section to emit a normalized JSON projection of the section (from report.json) instead of the raw HTML slice.").option("--deck", "Render the presentation deck instead: one topic per full-viewport page, advanced sideways, in a single self-contained HTML file. For showing the result to someone rather than debugging it. Issue #290.", false).option("--out <path>", "Where to write the deck (default: deck.html in the run dir)").option("--lang <pt|en>", "Initial deck language; the in-page toggle still switches live", "en").option("--open", "Open the rendered deck in the browser", false).option("--plan-dir <dir>", "With --deck: dir holding migration-plan.json. Adds the component heat map (grouped by page, plus global) and the block-by-block table. Without it those pages are omitted, not drawn empty. Issue #291.").action(async (runId, opts) => {
|
|
77550
77662
|
process.exit(await reportCommand(runId, {
|
|
77551
77663
|
output: opts.output,
|
|
77552
77664
|
section: opts.section,
|
|
@@ -77554,7 +77666,8 @@ program.command("report").argument("<runId>", "Run ID to open").description("Ope
|
|
|
77554
77666
|
deck: Boolean(opts.deck),
|
|
77555
77667
|
out: opts.out,
|
|
77556
77668
|
lang: opts.lang === "pt" ? "pt" : "en",
|
|
77557
|
-
open: Boolean(opts.open)
|
|
77669
|
+
open: Boolean(opts.open),
|
|
77670
|
+
planDir: opts.planDir
|
|
77558
77671
|
}));
|
|
77559
77672
|
});
|
|
77560
77673
|
function buildCompareCommand(name, deprecated) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.58",
|
|
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",
|