@decocms/parity 0.33.21 → 0.33.23
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 +206 -47
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -39527,6 +39527,9 @@ var REPORT_CSS = `
|
|
|
39527
39527
|
.dash-hero-info .verdict-text.pass { color: var(--state-good); }
|
|
39528
39528
|
.dash-hero-info .verdict-text.warn { color: var(--state-warn); }
|
|
39529
39529
|
.dash-hero-info .verdict-text.fail { color: var(--state-bad); }
|
|
39530
|
+
/* Muted on purpose: an inconclusive run has no result, so it should not compete for attention
|
|
39531
|
+
with a real pass/fail the way a red or green headline would. */
|
|
39532
|
+
.dash-hero-info .verdict-text.inconclusive { color: var(--text-muted); }
|
|
39530
39533
|
.dash-hero-info .verdict-sub { color: var(--text-secondary); font-size: 14px; }
|
|
39531
39534
|
.dash-hero-info .verdict-meta { color: var(--text-muted); font-size: 12px; margin-top: 8px; display: flex; gap: 16px; flex-wrap: wrap; }
|
|
39532
39535
|
.dash-hero-info .verdict-meta span strong { color: var(--text-primary); font-weight: 600; }
|
|
@@ -39621,6 +39624,7 @@ var REPORT_CSS = `
|
|
|
39621
39624
|
.status-warn { background: rgba(245, 166, 35, 0.15); color: var(--state-warn); }
|
|
39622
39625
|
.status-fail { background: rgba(229, 72, 77, 0.15); color: var(--state-bad); }
|
|
39623
39626
|
.status-skipped { background: rgba(138, 147, 166, 0.15); color: var(--text-muted); }
|
|
39627
|
+
.status-inconclusive { background: rgba(138, 147, 166, 0.15); color: var(--text-muted); }
|
|
39624
39628
|
|
|
39625
39629
|
/* Issue card v2 */
|
|
39626
39630
|
.issue {
|
|
@@ -41515,7 +41519,7 @@ var SeoSummary = z.object({
|
|
|
41515
41519
|
pagesWithIssues: z.number()
|
|
41516
41520
|
});
|
|
41517
41521
|
var Verdict = z.object({
|
|
41518
|
-
status: z.enum(["pass", "warn", "fail"]),
|
|
41522
|
+
status: z.enum(["pass", "warn", "fail", "inconclusive"]),
|
|
41519
41523
|
score: z.number().min(0).max(100),
|
|
41520
41524
|
scoreVersion: z.number().optional(),
|
|
41521
41525
|
pagesAnalyzed: z.number().optional(),
|
|
@@ -41670,12 +41674,10 @@ var ExpectedDivergence = z.object({
|
|
|
41670
41674
|
note: z.string()
|
|
41671
41675
|
});
|
|
41672
41676
|
var ParityIgnore = z.object({
|
|
41673
|
-
ignoreSelectorsVisual: z.array(z.string()).default([]),
|
|
41674
41677
|
expectedDivergences: z.array(ExpectedDivergence).optional(),
|
|
41675
41678
|
ignoreRequestPatterns: z.array(z.string()).default([]),
|
|
41676
41679
|
ignoreConsolePatterns: z.array(z.string()).default([]),
|
|
41677
|
-
ignoreMetaKeys: z.array(z.string()).default([])
|
|
41678
|
-
toleratedDomDrift: z.record(z.string(), z.number()).default({})
|
|
41680
|
+
ignoreMetaKeys: z.array(z.string()).default([])
|
|
41679
41681
|
});
|
|
41680
41682
|
|
|
41681
41683
|
// src/storage/fs.ts
|
|
@@ -54316,6 +54318,9 @@ function derivePagesAnalyzed(checks, issues) {
|
|
|
54316
54318
|
const distinctPages = new Set(issues.filter((i) => i.page).map((i) => i.page));
|
|
54317
54319
|
return Math.max(1, distinctPages.size);
|
|
54318
54320
|
}
|
|
54321
|
+
function measuredNothing(checks) {
|
|
54322
|
+
return checks.length === 0;
|
|
54323
|
+
}
|
|
54319
54324
|
function computeVerdict(checks, issues, opts) {
|
|
54320
54325
|
const counts = { critical: 0, high: 0, medium: 0, low: 0 };
|
|
54321
54326
|
for (const i of issues)
|
|
@@ -54326,9 +54331,11 @@ function computeVerdict(checks, issues, opts) {
|
|
|
54326
54331
|
const checksWarn = checks.filter((c) => c.status === "warn").length;
|
|
54327
54332
|
const pagesAnalyzed = opts?.pagesAnalyzed ?? derivePagesAnalyzed(checks, issues);
|
|
54328
54333
|
let { score } = computeScore(issues, { pagesAnalyzed });
|
|
54329
|
-
const status = counts.critical > 0 || checksFailed > 0 ? "fail" : counts.high > 0 || checksWarn > 0 ? "warn" : "pass";
|
|
54334
|
+
const status = measuredNothing(checks) ? "inconclusive" : counts.critical > 0 || checksFailed > 0 ? "fail" : counts.high > 0 || checksWarn > 0 ? "warn" : "pass";
|
|
54330
54335
|
if (status === "fail")
|
|
54331
54336
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
54337
|
+
if (status === "inconclusive")
|
|
54338
|
+
score = 0;
|
|
54332
54339
|
return {
|
|
54333
54340
|
status,
|
|
54334
54341
|
score,
|
|
@@ -54408,8 +54415,9 @@ function computeCompositeVerdict(moduleVerdicts, checks, issues) {
|
|
|
54408
54415
|
weightSum += weight;
|
|
54409
54416
|
totalPagesAnalyzed = Math.max(totalPagesAnalyzed, mv.pagesAnalyzed);
|
|
54410
54417
|
}
|
|
54411
|
-
|
|
54412
|
-
|
|
54418
|
+
const nothingMeasured = weightSum === 0 || measuredNothing(checks);
|
|
54419
|
+
let score = nothingMeasured ? 0 : Math.round(weightedScoreSum / weightSum);
|
|
54420
|
+
const status = nothingMeasured ? "inconclusive" : counts.critical > 0 || checksFailed > 0 || moduleVerdicts.some((mv) => mv.status === "fail") ? "fail" : counts.high > 0 || checksWarn > 0 || moduleVerdicts.some((mv) => mv.status === "warn") ? "warn" : "pass";
|
|
54413
54421
|
if (status === "fail")
|
|
54414
54422
|
score = Math.min(score, FAIL_SCORE_CAP);
|
|
54415
54423
|
return {
|
|
@@ -54824,9 +54832,10 @@ function tabHelp(text) {
|
|
|
54824
54832
|
}
|
|
54825
54833
|
function renderDashboard2(run) {
|
|
54826
54834
|
const v = run.verdict;
|
|
54827
|
-
const
|
|
54828
|
-
const
|
|
54829
|
-
const
|
|
54835
|
+
const inconclusive = v.status === "inconclusive";
|
|
54836
|
+
const statusLabel = inconclusive ? "Inconclusive" : v.status === "pass" ? "Excellent" : v.status === "warn" ? "Warnings" : "Critical";
|
|
54837
|
+
const ringColor = inconclusive ? "var(--text-dim, #888)" : v.status === "pass" ? "var(--state-good)" : v.status === "warn" ? "var(--state-warn)" : "var(--state-bad)";
|
|
54838
|
+
const ringDeg = inconclusive ? "0deg" : `${Math.round(v.score / 100 * 360)}deg`;
|
|
54830
54839
|
const prev = run.previousRun;
|
|
54831
54840
|
const deltaChip = prev ? (() => {
|
|
54832
54841
|
const up = prev.scoreDelta > 0;
|
|
@@ -54839,13 +54848,13 @@ function renderDashboard2(run) {
|
|
|
54839
54848
|
return `
|
|
54840
54849
|
<div class="dash-hero">
|
|
54841
54850
|
<div class="health-score" style="--ring-color:${ringColor};--ring-deg:${ringDeg}">
|
|
54842
|
-
<div class="score-num">${v.score}<small>/100</small
|
|
54851
|
+
<div class="score-num">${inconclusive ? "—" : `${v.score}<small>/100</small>`}</div>
|
|
54843
54852
|
<div class="score-label">Health</div>
|
|
54844
54853
|
</div>
|
|
54845
54854
|
<div class="dash-hero-info">
|
|
54846
54855
|
<div class="verdict-text ${v.status}">${statusLabel}</div>
|
|
54847
|
-
${deltaChip}
|
|
54848
|
-
<div class="verdict-sub">${v.critical + v.high} blocking issue${v.critical + v.high !== 1 ? "s" : ""} ${v.critical > 0 ? `(${v.critical} critical)` : ""}</div>
|
|
54856
|
+
${inconclusive ? "" : deltaChip}
|
|
54857
|
+
<div class="verdict-sub">${inconclusive ? "Nothing was measured — 0 checks ran, so this run says nothing about parity." : `${v.critical + v.high} blocking issue${v.critical + v.high !== 1 ? "s" : ""} ${v.critical > 0 ? `(${v.critical} critical)` : ""}`}</div>
|
|
54849
54858
|
<div class="verdict-meta">
|
|
54850
54859
|
<span><strong>${v.checksPassed}</strong> checks pass</span>
|
|
54851
54860
|
<span><strong>${v.checksFailed}</strong> fail</span>
|
|
@@ -56326,11 +56335,9 @@ async function cacheCommand(opts) {
|
|
|
56326
56335
|
}
|
|
56327
56336
|
const rc = { cep: "01310-100", selectors: {}, skipSteps: [] };
|
|
56328
56337
|
const ignore = {
|
|
56329
|
-
ignoreSelectorsVisual: [],
|
|
56330
56338
|
ignoreRequestPatterns: [],
|
|
56331
56339
|
ignoreConsolePatterns: [],
|
|
56332
|
-
ignoreMetaKeys: []
|
|
56333
|
-
toleratedDomDrift: {}
|
|
56340
|
+
ignoreMetaKeys: []
|
|
56334
56341
|
};
|
|
56335
56342
|
const checkCtx = {
|
|
56336
56343
|
prodPages: allPageCaptures.filter((p) => p.side === "prod"),
|
|
@@ -57483,6 +57490,7 @@ import { join as join16 } from "node:path";
|
|
|
57483
57490
|
import { readFileSync as readFileSync14 } from "node:fs";
|
|
57484
57491
|
var MANAGE = "api/content-platform/manage";
|
|
57485
57492
|
var SCHEMAS = "api/content-platform/schemas";
|
|
57493
|
+
var DATA = "api/content-platform/data";
|
|
57486
57494
|
function tokenFromVtexSession(home = homedir2()) {
|
|
57487
57495
|
try {
|
|
57488
57496
|
const raw = readFileSync14(join16(home, ".config", "configstore", "vtex.json"), "utf8");
|
|
@@ -57637,6 +57645,20 @@ async function publishSchema(cfg, schema, call = callRegistry) {
|
|
|
57637
57645
|
}
|
|
57638
57646
|
await call(cfg, id, { method: "PUT", body: schema });
|
|
57639
57647
|
}
|
|
57648
|
+
var callDelivery = async (cfg, path) => {
|
|
57649
|
+
const res = await fetch(`https://${cfg.account}.vtexcommercestable.com.br/${path}`, {
|
|
57650
|
+
headers: { accept: "application/json" }
|
|
57651
|
+
});
|
|
57652
|
+
const text = await res.text().catch(() => "");
|
|
57653
|
+
if (!res.ok) {
|
|
57654
|
+
throw new Error(`GET ${path}: HTTP ${res.status} ${text.slice(0, 300)}`);
|
|
57655
|
+
}
|
|
57656
|
+
return text ? JSON.parse(text) : {};
|
|
57657
|
+
};
|
|
57658
|
+
async function getDeliveryEntry(cfg, args, call = callDelivery) {
|
|
57659
|
+
const slug = args.slug.replace(/^\//, "");
|
|
57660
|
+
return call(cfg, `${DATA}/${cfg.account}/${cfg.store}/${args.contentType}/entries/slug/${slug}`);
|
|
57661
|
+
}
|
|
57640
57662
|
|
|
57641
57663
|
// src/cms/authoring.ts
|
|
57642
57664
|
function unwrapValue(node) {
|
|
@@ -57859,9 +57881,46 @@ function unrenderableSections(usedKeys, contentType) {
|
|
|
57859
57881
|
return [...new Set(usedKeys.filter((k) => !allowed.includes(k)))];
|
|
57860
57882
|
}
|
|
57861
57883
|
function parseJsonc(raw) {
|
|
57862
|
-
|
|
57863
|
-
|
|
57864
|
-
|
|
57884
|
+
let out = "";
|
|
57885
|
+
let inString = false;
|
|
57886
|
+
let escaped = false;
|
|
57887
|
+
for (let i = 0;i < raw.length; i++) {
|
|
57888
|
+
const ch = raw[i];
|
|
57889
|
+
if (inString) {
|
|
57890
|
+
out += ch;
|
|
57891
|
+
if (escaped)
|
|
57892
|
+
escaped = false;
|
|
57893
|
+
else if (ch === "\\")
|
|
57894
|
+
escaped = true;
|
|
57895
|
+
else if (ch === '"')
|
|
57896
|
+
inString = false;
|
|
57897
|
+
continue;
|
|
57898
|
+
}
|
|
57899
|
+
if (ch === '"') {
|
|
57900
|
+
inString = true;
|
|
57901
|
+
out += ch;
|
|
57902
|
+
continue;
|
|
57903
|
+
}
|
|
57904
|
+
if (ch === "/" && raw[i + 1] === "/") {
|
|
57905
|
+
while (i < raw.length && raw[i] !== `
|
|
57906
|
+
`)
|
|
57907
|
+
i++;
|
|
57908
|
+
out += `
|
|
57909
|
+
`;
|
|
57910
|
+
continue;
|
|
57911
|
+
}
|
|
57912
|
+
if (ch === "/" && raw[i + 1] === "*") {
|
|
57913
|
+
i += 2;
|
|
57914
|
+
while (i < raw.length && !(raw[i] === "*" && raw[i + 1] === "/"))
|
|
57915
|
+
i++;
|
|
57916
|
+
i++;
|
|
57917
|
+
continue;
|
|
57918
|
+
}
|
|
57919
|
+
if (ch === "}" || ch === "]")
|
|
57920
|
+
out = out.replace(/,\s*$/, "");
|
|
57921
|
+
out += ch;
|
|
57922
|
+
}
|
|
57923
|
+
return JSON.parse(out);
|
|
57865
57924
|
}
|
|
57866
57925
|
function localComponentSchemas(repoDir) {
|
|
57867
57926
|
const dir = join18(repoDir, "cms", "faststore", "components");
|
|
@@ -57879,7 +57938,9 @@ function localComponentSchemas(repoDir) {
|
|
|
57879
57938
|
properties: Object.keys(parsed.properties ?? {}),
|
|
57880
57939
|
required: parsed.required ?? []
|
|
57881
57940
|
};
|
|
57882
|
-
} catch {
|
|
57941
|
+
} catch (err) {
|
|
57942
|
+
console.warn(` ! could not read ${file}: ${err instanceof Error ? err.message : err} — its properties are NOT being checked`);
|
|
57943
|
+
}
|
|
57883
57944
|
}
|
|
57884
57945
|
return out;
|
|
57885
57946
|
}
|
|
@@ -57963,6 +58024,33 @@ function fail(err) {
|
|
|
57963
58024
|
console.error(chalk7.red(err instanceof Error ? err.message : String(err)));
|
|
57964
58025
|
return 1;
|
|
57965
58026
|
}
|
|
58027
|
+
function leafLike(existing, value) {
|
|
58028
|
+
const isSwitch = existing !== null && typeof existing === "object" && !Array.isArray(existing) && existing.$fnType === "switch";
|
|
58029
|
+
return isSwitch ? localeSwitch(value) : value;
|
|
58030
|
+
}
|
|
58031
|
+
function newPageData(template, page) {
|
|
58032
|
+
const base = template ? { ...template } : {};
|
|
58033
|
+
const seoSource = base.seo ?? {};
|
|
58034
|
+
const sections = base.sections;
|
|
58035
|
+
const emptySections = sections && typeof sections === "object" && !Array.isArray(sections) ? { ...sections, values: {} } : { $fnType: "array", values: {} };
|
|
58036
|
+
return {
|
|
58037
|
+
...base,
|
|
58038
|
+
slug: leafLike(base.slug, page.slug),
|
|
58039
|
+
seo: {
|
|
58040
|
+
...seoSource,
|
|
58041
|
+
slug: leafLike(seoSource.slug, page.slug),
|
|
58042
|
+
title: leafLike(seoSource.title, page.name)
|
|
58043
|
+
},
|
|
58044
|
+
sections: emptySections
|
|
58045
|
+
};
|
|
58046
|
+
}
|
|
58047
|
+
function writeRejectedPayload(entryId, body) {
|
|
58048
|
+
const out = join19("parity-output", "cms-backups", `${entryId}-rejected.json`);
|
|
58049
|
+
mkdirSync9(dirname4(out), { recursive: true });
|
|
58050
|
+
writeFileSync13(out, `${JSON.stringify(body, null, 2)}
|
|
58051
|
+
`);
|
|
58052
|
+
return out;
|
|
58053
|
+
}
|
|
57966
58054
|
function writeBackup(version) {
|
|
57967
58055
|
const backup = join19("parity-output", "cms-backups", `${version.entryId}-${version.baseHash.slice(0, 12)}.json`);
|
|
57968
58056
|
mkdirSync9(dirname4(backup), { recursive: true });
|
|
@@ -57976,6 +58064,41 @@ function richTextCombinationRisk(usedKeys) {
|
|
|
57976
58064
|
}
|
|
57977
58065
|
return null;
|
|
57978
58066
|
}
|
|
58067
|
+
async function verifyRendered(cfg, args, call = callDelivery) {
|
|
58068
|
+
const pushedSections = sectionsOf(args.data).length;
|
|
58069
|
+
if (pushedSections === 0) {
|
|
58070
|
+
return { ok: null, reason: "nothing to verify — the pushed entry has no sections" };
|
|
58071
|
+
}
|
|
58072
|
+
if (args.branch !== "main") {
|
|
58073
|
+
return { ok: null, reason: `branch ${args.branch} is not published, so the data plane cannot see it yet` };
|
|
58074
|
+
}
|
|
58075
|
+
const slug = unwrapValue(args.data.slug);
|
|
58076
|
+
if (typeof slug !== "string" || !slug) {
|
|
58077
|
+
return { ok: null, reason: "the entry has no slug to resolve by" };
|
|
58078
|
+
}
|
|
58079
|
+
let entry;
|
|
58080
|
+
try {
|
|
58081
|
+
entry = await getDeliveryEntry(cfg, { contentType: args.contentType, slug }, call);
|
|
58082
|
+
} catch (err) {
|
|
58083
|
+
return {
|
|
58084
|
+
ok: null,
|
|
58085
|
+
reason: `could not read ${slug} back from the data plane (${err instanceof Error ? err.message : err})`
|
|
58086
|
+
};
|
|
58087
|
+
}
|
|
58088
|
+
if (!Array.isArray(entry.sections)) {
|
|
58089
|
+
return {
|
|
58090
|
+
ok: false,
|
|
58091
|
+
reason: `${slug} came back from the data plane with sections as ${entry.sections === undefined ? "undefined" : typeof entry.sections}, not an array — the storefront will render it as zero sections (#349)`
|
|
58092
|
+
};
|
|
58093
|
+
}
|
|
58094
|
+
if (entry.sections.length === 0) {
|
|
58095
|
+
return {
|
|
58096
|
+
ok: false,
|
|
58097
|
+
reason: `${slug} came back from the data plane with an empty sections array, but ${pushedSections} section(s) were pushed (#349)`
|
|
58098
|
+
};
|
|
58099
|
+
}
|
|
58100
|
+
return { ok: true, reason: "", sections: entry.sections.length };
|
|
58101
|
+
}
|
|
57979
58102
|
function explainCommitError(err, usedKeys) {
|
|
57980
58103
|
if (!(err instanceof Error) || !err.message.includes("VALIDATION_ERROR"))
|
|
57981
58104
|
return err;
|
|
@@ -58074,7 +58197,7 @@ async function cmsSchemaPushCommand(opts, call = callCms, registryCall = callReg
|
|
|
58074
58197
|
}
|
|
58075
58198
|
let schema;
|
|
58076
58199
|
try {
|
|
58077
|
-
schema =
|
|
58200
|
+
schema = JSON.parse(readFileSync17(schemaPath, "utf8"));
|
|
58078
58201
|
} catch (err) {
|
|
58079
58202
|
return fail(new Error(`${schemaPath} is not valid JSON: ${err instanceof Error ? err.message : err}`));
|
|
58080
58203
|
}
|
|
@@ -58224,7 +58347,7 @@ async function cmsDiffCommand(opts, call = callCms) {
|
|
|
58224
58347
|
return fail(err);
|
|
58225
58348
|
}
|
|
58226
58349
|
}
|
|
58227
|
-
async function cmsPushCommand(opts, call = callCms) {
|
|
58350
|
+
async function cmsPushCommand(opts, call = callCms, deliveryCall = callDelivery) {
|
|
58228
58351
|
const cfg = config();
|
|
58229
58352
|
if (!cfg)
|
|
58230
58353
|
return 1;
|
|
@@ -58273,13 +58396,24 @@ async function cmsPushCommand(opts, call = callCms) {
|
|
|
58273
58396
|
}, call).catch((err) => {
|
|
58274
58397
|
throw explainCommitError(err, used);
|
|
58275
58398
|
});
|
|
58399
|
+
const rendered = await verifyRendered(cfg, { contentType: local.contentType, data: local.data, branch }, deliveryCall);
|
|
58276
58400
|
if (opts.json) {
|
|
58277
|
-
console.log(JSON.stringify({ commit, backup }, null, 2));
|
|
58278
|
-
return 0;
|
|
58401
|
+
console.log(JSON.stringify({ commit, backup, rendered }, null, 2));
|
|
58402
|
+
return rendered.ok === false ? 1 : 0;
|
|
58279
58403
|
}
|
|
58280
58404
|
console.log(`${chalk7.green("✓")} commit ${commit.id} on ${branch}`);
|
|
58281
58405
|
console.log(chalk7.dim(` rollback: parity cms restore --file ${backup} --branch ${branch}${branch === "main" ? " --allow-main" : ""} --yes`));
|
|
58282
58406
|
console.log(chalk7.dim(` backup: ${backup}`));
|
|
58407
|
+
if (rendered.ok === false) {
|
|
58408
|
+
return fail(new Error(`${rendered.reason}
|
|
58409
|
+
The commit succeeded — this content is live and renders as nothing. Restore with:
|
|
58410
|
+
parity cms restore --file ${backup} --branch ${branch}${branch === "main" ? " --allow-main" : ""} --yes`));
|
|
58411
|
+
}
|
|
58412
|
+
if (rendered.ok === true) {
|
|
58413
|
+
console.log(chalk7.dim(` verified: ${rendered.sections} section(s) live on the data plane`));
|
|
58414
|
+
} else {
|
|
58415
|
+
console.log(chalk7.dim(` not verified: ${rendered.reason}`));
|
|
58416
|
+
}
|
|
58283
58417
|
return 0;
|
|
58284
58418
|
} catch (err) {
|
|
58285
58419
|
return fail(err);
|
|
@@ -58423,23 +58557,24 @@ async function cmsCreateCommand(opts, call = callCms) {
|
|
|
58423
58557
|
const entryId = created[0].id;
|
|
58424
58558
|
try {
|
|
58425
58559
|
await renameEntry(cfg, { entryId, name }, call);
|
|
58426
|
-
const
|
|
58427
|
-
const
|
|
58560
|
+
const copyHead = await getLastVersion(cfg, { contentType: opts.contentType, entryId, branchId: branch }, call).catch(() => null);
|
|
58561
|
+
const head = copyHead?.baseHash ?? null;
|
|
58562
|
+
const commitInput = {
|
|
58428
58563
|
branchId: branch,
|
|
58429
58564
|
contentTypeId: opts.contentType,
|
|
58430
58565
|
entryId,
|
|
58431
58566
|
entryName: name,
|
|
58432
58567
|
baseHash: head,
|
|
58433
|
-
data:
|
|
58434
|
-
slug: localeSwitch(opts.slug),
|
|
58435
|
-
seo: { slug: localeSwitch(opts.slug), title: localeSwitch(name), description: localeSwitch("") },
|
|
58436
|
-
sections: { $fnType: "array", values: {} }
|
|
58437
|
-
}),
|
|
58568
|
+
data: newPageData(copyHead?.data, { slug: opts.slug, name }),
|
|
58438
58569
|
message: opts.message ?? `parity cms create ${opts.slug}`,
|
|
58439
58570
|
author,
|
|
58440
58571
|
identifierKeys: null,
|
|
58441
58572
|
searchKeywords: null
|
|
58442
|
-
}
|
|
58573
|
+
};
|
|
58574
|
+
const commit = await commitEntry(cfg, commitInput, call).catch((err) => {
|
|
58575
|
+
throw new Error(`${err instanceof Error ? err.message : err}
|
|
58576
|
+
rejected payload: ${writeRejectedPayload(entryId, commitInput)}`);
|
|
58577
|
+
});
|
|
58443
58578
|
if (opts.json) {
|
|
58444
58579
|
console.log(JSON.stringify({ entryId, slug: opts.slug, branch, commit }, null, 2));
|
|
58445
58580
|
return 0;
|
|
@@ -64067,8 +64202,9 @@ function listCommand(output) {
|
|
|
64067
64202
|
try {
|
|
64068
64203
|
const run = loadRun(output, r.id);
|
|
64069
64204
|
const v = run.verdict;
|
|
64070
|
-
const status = v.status === "pass" ? chalk18.green(v.status) : v.status === "warn" ? chalk18.yellow(v.status) : chalk18.red(v.status);
|
|
64071
|
-
|
|
64205
|
+
const status = v.status === "inconclusive" ? chalk18.dim(v.status) : v.status === "pass" ? chalk18.green(v.status) : v.status === "warn" ? chalk18.yellow(v.status) : chalk18.red(v.status);
|
|
64206
|
+
const score = v.status === "inconclusive" ? "—" : v.score;
|
|
64207
|
+
console.log(` ${chalk18.bold(r.id)} ${status} score=${score} critical=${v.critical} high=${v.high} ${chalk18.dim(r.timestamp)}`);
|
|
64072
64208
|
} catch {
|
|
64073
64209
|
console.log(` ${chalk18.bold(r.id)} ${chalk18.dim("(report.json ausente)")}`);
|
|
64074
64210
|
}
|
|
@@ -68398,6 +68534,12 @@ var PRESETS = {
|
|
|
68398
68534
|
only: "e2e,html,console"
|
|
68399
68535
|
}
|
|
68400
68536
|
};
|
|
68537
|
+
function resolveScopedFlows(args) {
|
|
68538
|
+
const needed = Array.from(args.selectionFlows);
|
|
68539
|
+
const flows = args.explicitFlows.length > 0 ? Array.from(new Set(args.explicitFlows)) : Array.from(new Set(needed));
|
|
68540
|
+
const starved = needed.filter((f) => !flows.includes(f));
|
|
68541
|
+
return { flows, starved };
|
|
68542
|
+
}
|
|
68401
68543
|
function pagesFlowsScopeWarning(opts, flows) {
|
|
68402
68544
|
if (!opts.pages && !opts.pagesFile)
|
|
68403
68545
|
return null;
|
|
@@ -68488,7 +68630,14 @@ function applyLlmOptions(opts) {
|
|
|
68488
68630
|
}
|
|
68489
68631
|
return null;
|
|
68490
68632
|
}
|
|
68491
|
-
function evaluateFailOnGate(allIssues, failOn) {
|
|
68633
|
+
function evaluateFailOnGate(allIssues, failOn, verdictStatus) {
|
|
68634
|
+
if (verdictStatus === "inconclusive") {
|
|
68635
|
+
return {
|
|
68636
|
+
exitCode: 1,
|
|
68637
|
+
message: `
|
|
68638
|
+
✖ run inconclusivo — nenhum check executou, não há resultado para aprovar — exit 1`
|
|
68639
|
+
};
|
|
68640
|
+
}
|
|
68492
68641
|
const blocking = allIssues.filter((i) => failOn.includes(i.severity));
|
|
68493
68642
|
if (blocking.length === 0)
|
|
68494
68643
|
return { exitCode: 0 };
|
|
@@ -68564,8 +68713,12 @@ async function runCommand(rawOpts) {
|
|
|
68564
68713
|
let flows;
|
|
68565
68714
|
if (hasSelection) {
|
|
68566
68715
|
const explicitFlows = userSetFlows ? opts.flows.split(",").map((s) => s.trim()).filter(Boolean) : [];
|
|
68567
|
-
|
|
68568
|
-
|
|
68716
|
+
const scoped = resolveScopedFlows({ explicitFlows, selectionFlows: selection.flows });
|
|
68717
|
+
flows = scoped.flows;
|
|
68718
|
+
console.log(chalk22.dim(` modules: ${selection.modules.join(", ") || "(none)"} → flows: ${flows.join(",")}${explicitFlows.length > 0 ? " (scoped by --flows)" : ""}`));
|
|
68719
|
+
if (scoped.starved.length > 0) {
|
|
68720
|
+
console.log(chalk22.yellow(` ! --flows leaves out ${scoped.starved.join(",")}, which the selected modules capture from — those checks may have nothing to analyze`));
|
|
68721
|
+
}
|
|
68569
68722
|
} else {
|
|
68570
68723
|
flows = opts.flows.split(",").map((s) => s.trim());
|
|
68571
68724
|
if (!interactivePromptShown) {
|
|
@@ -69258,7 +69411,7 @@ ${formatTimingsSummary(partialTimings, buildFlowBreakdown(allFlowCaptures))}
|
|
|
69258
69411
|
printSummary7(run, paths.reportHtml, { promotedCount, deprecatedCount, platform });
|
|
69259
69412
|
console.log(`
|
|
69260
69413
|
${formatTimingsSummary(runTimings, buildFlowBreakdown(allFlowCaptures))}`);
|
|
69261
|
-
const failOnGate = evaluateFailOnGate(allIssues, failOn);
|
|
69414
|
+
const failOnGate = evaluateFailOnGate(allIssues, failOn, verdict.status);
|
|
69262
69415
|
if (failOnGate.exitCode === 1) {
|
|
69263
69416
|
console.log(chalk22.red(failOnGate.message));
|
|
69264
69417
|
return 1;
|
|
@@ -69484,12 +69637,17 @@ function hostOf3(url) {
|
|
|
69484
69637
|
}
|
|
69485
69638
|
function printSummary7(run, htmlPath, meta) {
|
|
69486
69639
|
const { verdict } = run;
|
|
69487
|
-
const
|
|
69488
|
-
const
|
|
69640
|
+
const inconclusive = verdict.status === "inconclusive";
|
|
69641
|
+
const emoji = inconclusive ? chalk22.dim("○") : verdict.status === "pass" ? chalk22.green("✔") : verdict.status === "warn" ? chalk22.yellow("⚠") : chalk22.red("✖");
|
|
69642
|
+
const score = inconclusive ? chalk22.dim("—") : verdict.status === "pass" ? chalk22.green(verdict.score) : verdict.status === "warn" ? chalk22.yellow(verdict.score) : chalk22.red(verdict.score);
|
|
69489
69643
|
const prev = run.previousRun;
|
|
69490
69644
|
const scoreDelta = !prev ? chalk22.dim(" (sem run anterior comparável)") : prev.scoreDelta > 0 ? chalk22.green(` (+${prev.scoreDelta} vs run anterior: ${prev.score})`) : prev.scoreDelta < 0 ? chalk22.red(` (${prev.scoreDelta} vs run anterior: ${prev.score})`) : chalk22.dim(` (= run anterior: ${prev.score})`);
|
|
69491
69645
|
console.log("");
|
|
69492
|
-
|
|
69646
|
+
if (inconclusive) {
|
|
69647
|
+
console.log(` ${emoji} parity INCONCLUSIVE · nothing was measured (0 checks ran)`);
|
|
69648
|
+
} else {
|
|
69649
|
+
console.log(` ${emoji} parity ${verdict.status.toUpperCase()} · score ${score}/100${scoreDelta}`);
|
|
69650
|
+
}
|
|
69493
69651
|
console.log(` checks: ${chalk22.green(verdict.checksPassed)} pass · ${chalk22.red(verdict.checksFailed)} fail · ${chalk22.dim(`${verdict.checksSkipped} skipped`)}`);
|
|
69494
69652
|
console.log(` issues: ${chalk22.red(verdict.critical)} critical · ${chalk22.yellow(verdict.high)} high · ${verdict.medium} medium · ${chalk22.dim(`${verdict.low} low`)}`);
|
|
69495
69653
|
for (const c of run.caveats ?? []) {
|
|
@@ -69586,10 +69744,11 @@ ${markdown}
|
|
|
69586
69744
|
function buildPrComment(run, opts) {
|
|
69587
69745
|
const lines = [];
|
|
69588
69746
|
const v = run.verdict;
|
|
69589
|
-
const
|
|
69747
|
+
const inconclusive = v.status === "inconclusive";
|
|
69748
|
+
const status = inconclusive ? "◻ **INCONCLUSIVE**" : v.status === "pass" ? "✅ **PASS**" : v.status === "warn" ? "⚠ **WARN**" : "❌ **FAIL**";
|
|
69590
69749
|
const prev = run.previousRun;
|
|
69591
69750
|
const delta = prev ? prev.scoreDelta > 0 ? ` (\uD83D\uDCC8 +${prev.scoreDelta} vs previous run)` : prev.scoreDelta < 0 ? ` (\uD83D\uDCC9 ${prev.scoreDelta} vs previous run)` : " (= previous run)" : "";
|
|
69592
|
-
lines.push(`## Parity report — ${status} · score ${v.score}/100${delta}`);
|
|
69751
|
+
lines.push(inconclusive ? `## Parity report — ${status} · nothing was measured (0 checks ran)` : `## Parity report — ${status} · score ${v.score}/100${delta}`);
|
|
69593
69752
|
lines.push("");
|
|
69594
69753
|
lines.push(`- **prod:** ${opts.prod}`);
|
|
69595
69754
|
lines.push(`- **preview:** ${opts.preview}`);
|
|
@@ -69964,7 +70123,7 @@ function renderDeckHtml(model, lang = "en") {
|
|
|
69964
70123
|
const rows = model.caveats.map((c) => `<tr><td><span class="pill ${c.level === "warn" ? "pill-warn" : "pill-good"}">${esc3(c.level)}</span></td><td><b>${esc3(c.summary)}</b></td><td>${esc3(c.detail)}</td></tr>`).join("");
|
|
69965
70124
|
pages.push(page(L2("Contexto", "Context", lang), L2("Como ler este run", "How to read this run", lang), `<table class="grid"><tbody>${rows}</tbody></table>`, L2("O que o número <b>não</b> mede. Vem de <code>report.json.caveats</code>.", "What the number does <b>not</b> measure. From <code>report.json.caveats</code>.", lang)));
|
|
69966
70125
|
}
|
|
69967
|
-
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" : "bad"}">${esc3(m.status)}</span></td></tr>`).join("");
|
|
70126
|
+
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("");
|
|
69968
70127
|
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>` : "")));
|
|
69969
70128
|
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)));
|
|
69970
70129
|
if (model.visual) {
|
|
@@ -70025,6 +70184,8 @@ function toneForStatus(status) {
|
|
|
70025
70184
|
return "good";
|
|
70026
70185
|
if (status === "warn")
|
|
70027
70186
|
return "warn";
|
|
70187
|
+
if (status === "inconclusive")
|
|
70188
|
+
return "neutral";
|
|
70028
70189
|
return "bad";
|
|
70029
70190
|
}
|
|
70030
70191
|
function buildDeckModel(run) {
|
|
@@ -70701,11 +70862,9 @@ async function vitalsCommand(opts) {
|
|
|
70701
70862
|
}
|
|
70702
70863
|
const rc = { cep: "01310-100", selectors: {}, skipSteps: [] };
|
|
70703
70864
|
const ignore = {
|
|
70704
|
-
ignoreSelectorsVisual: [],
|
|
70705
70865
|
ignoreRequestPatterns: [],
|
|
70706
70866
|
ignoreConsolePatterns: [],
|
|
70707
|
-
ignoreMetaKeys: []
|
|
70708
|
-
toleratedDomDrift: {}
|
|
70867
|
+
ignoreMetaKeys: []
|
|
70709
70868
|
};
|
|
70710
70869
|
const checkCtx = {
|
|
70711
70870
|
prodPages: allPageCaptures.filter((p) => p.side === "prod"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.23",
|
|
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",
|