@decocms/parity 0.35.19 → 0.35.21
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 +302 -20
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -75779,7 +75779,7 @@ import {
|
|
|
75779
75779
|
registerCommands as registerCatalogCommands
|
|
75780
75780
|
} from "@decocms/catalog";
|
|
75781
75781
|
import { DESCRIPTION, registerCommands } from "@decocms/vtex-cms";
|
|
75782
|
-
import
|
|
75782
|
+
import chalk48 from "chalk";
|
|
75783
75783
|
import { Command, InvalidArgumentError as InvalidArgumentError2 } from "commander";
|
|
75784
75784
|
|
|
75785
75785
|
// src/commands/ab-detect.ts
|
|
@@ -81013,6 +81013,18 @@ function redirectsParity(ctx) {
|
|
|
81013
81013
|
});
|
|
81014
81014
|
continue;
|
|
81015
81015
|
}
|
|
81016
|
+
const dropped = droppedQueryParams(pair.prod, pair.cand);
|
|
81017
|
+
if (dropped.length > 0) {
|
|
81018
|
+
issues.push({
|
|
81019
|
+
id: `redirect:query-dropped:${pair.key}`,
|
|
81020
|
+
severity: "medium",
|
|
81021
|
+
category: "seo",
|
|
81022
|
+
page: pair.key,
|
|
81023
|
+
check: "redirects-parity",
|
|
81024
|
+
summary: `Redirect de ${pair.key} perde a query no candidato: ${dropped.join(", ")} (prod mantém no destino)`,
|
|
81025
|
+
suggestedFix: "Repasse a query string da URL pedida ao destino do redirect (filtros e atribuição de campanha dependem dela)."
|
|
81026
|
+
});
|
|
81027
|
+
}
|
|
81016
81028
|
const prodDest = pathOf3(pair.prod.finalUrl);
|
|
81017
81029
|
const candDest = pathOf3(pair.cand.finalUrl);
|
|
81018
81030
|
if (prodDest !== candDest) {
|
|
@@ -81027,15 +81039,40 @@ function redirectsParity(ctx) {
|
|
|
81027
81039
|
});
|
|
81028
81040
|
}
|
|
81029
81041
|
}
|
|
81042
|
+
if (redirectsChecked === 0) {
|
|
81043
|
+
return skip3(start, "prod não redirecionou nenhuma das páginas capturadas — nada a validar");
|
|
81044
|
+
}
|
|
81030
81045
|
return {
|
|
81031
81046
|
name: "redirects-parity",
|
|
81032
81047
|
status: issues.some((i) => i.severity === "high") ? "fail" : issues.length > 0 ? "warn" : "pass",
|
|
81033
81048
|
severity: "high",
|
|
81034
81049
|
durationMs: Date.now() - start,
|
|
81035
|
-
summary:
|
|
81050
|
+
summary: `${redirectsChecked} redirect(s) de prod verificado(s), ${issues.length} divergência(s)`,
|
|
81036
81051
|
issues
|
|
81037
81052
|
};
|
|
81038
81053
|
}
|
|
81054
|
+
function droppedQueryParams(prod, cand) {
|
|
81055
|
+
const requested = paramsOf(prod.url);
|
|
81056
|
+
const prodKept = paramsOf(prod.finalUrl);
|
|
81057
|
+
const candKept = paramsOf(cand.finalUrl);
|
|
81058
|
+
const dropped = [];
|
|
81059
|
+
for (const [key, value] of requested) {
|
|
81060
|
+
if (!prodKept.getAll(key).includes(value))
|
|
81061
|
+
continue;
|
|
81062
|
+
if (candKept.getAll(key).includes(value))
|
|
81063
|
+
continue;
|
|
81064
|
+
if (!dropped.includes(key))
|
|
81065
|
+
dropped.push(key);
|
|
81066
|
+
}
|
|
81067
|
+
return dropped;
|
|
81068
|
+
}
|
|
81069
|
+
function paramsOf(url) {
|
|
81070
|
+
try {
|
|
81071
|
+
return new URL(url).searchParams;
|
|
81072
|
+
} catch {
|
|
81073
|
+
return new URLSearchParams;
|
|
81074
|
+
}
|
|
81075
|
+
}
|
|
81039
81076
|
function didRedirect(requested, final) {
|
|
81040
81077
|
if (!requested || !final)
|
|
81041
81078
|
return false;
|
|
@@ -121553,8 +121590,243 @@ async function studioCommentCommand(opts, call = callTool2) {
|
|
|
121553
121590
|
}
|
|
121554
121591
|
}
|
|
121555
121592
|
|
|
121556
|
-
// src/commands/
|
|
121593
|
+
// src/commands/drift.ts
|
|
121594
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
121595
|
+
import { existsSync as existsSync38, readFileSync as readFileSync44 } from "node:fs";
|
|
121596
|
+
import { resolve as resolve22 } from "node:path";
|
|
121557
121597
|
import chalk45 from "chalk";
|
|
121598
|
+
var DRIFT_EXCLUDES = [":!.deco"];
|
|
121599
|
+
var SHA_RE = /^[0-9a-f]{7,64}$/i;
|
|
121600
|
+
function resolveDriftInputs(state, flags) {
|
|
121601
|
+
const src = state?.source;
|
|
121602
|
+
let source = flags.source;
|
|
121603
|
+
if (!source) {
|
|
121604
|
+
if (!state) {
|
|
121605
|
+
return {
|
|
121606
|
+
error: {
|
|
121607
|
+
code: "no_state",
|
|
121608
|
+
message: "no state file and no --source/--base given, so there is nothing to compare"
|
|
121609
|
+
}
|
|
121610
|
+
};
|
|
121611
|
+
}
|
|
121612
|
+
if (src?.kind === "live-only") {
|
|
121613
|
+
return {
|
|
121614
|
+
error: {
|
|
121615
|
+
code: "live_only",
|
|
121616
|
+
message: "source.kind is live-only: there is no source repo, so there are no source commits to count. Re-run `parity run` against prod instead (the weaker check)"
|
|
121617
|
+
}
|
|
121618
|
+
};
|
|
121619
|
+
}
|
|
121620
|
+
if (!src?.repo) {
|
|
121621
|
+
return { error: { code: "no_source", message: "source.repo is not set in the state file" } };
|
|
121622
|
+
}
|
|
121623
|
+
source = src.repo;
|
|
121624
|
+
}
|
|
121625
|
+
let base = flags.base;
|
|
121626
|
+
let baseFrom = "flag";
|
|
121627
|
+
if (!base) {
|
|
121628
|
+
if (src?.reconciledTo?.sha) {
|
|
121629
|
+
base = src.reconciledTo.sha;
|
|
121630
|
+
baseFrom = "reconciledTo";
|
|
121631
|
+
} else if (src?.snapshot?.sha) {
|
|
121632
|
+
base = src.snapshot.sha;
|
|
121633
|
+
baseFrom = "snapshot";
|
|
121634
|
+
}
|
|
121635
|
+
}
|
|
121636
|
+
if (!base) {
|
|
121637
|
+
return {
|
|
121638
|
+
error: {
|
|
121639
|
+
code: "no_base",
|
|
121640
|
+
message: "no base commit: pass --base, or the state file has neither source.reconciledTo.sha nor source.snapshot.sha (the cut was never recorded)"
|
|
121641
|
+
}
|
|
121642
|
+
};
|
|
121643
|
+
}
|
|
121644
|
+
if (!SHA_RE.test(base)) {
|
|
121645
|
+
return { error: { code: "bad_base", message: `base "${base}" is not a commit SHA` } };
|
|
121646
|
+
}
|
|
121647
|
+
return { source, base, baseFrom };
|
|
121648
|
+
}
|
|
121649
|
+
function parseCommitLog(stdout) {
|
|
121650
|
+
const out = [];
|
|
121651
|
+
for (const rec of stdout.split("\x1E")) {
|
|
121652
|
+
const r = rec.replace(/^\n+/, "");
|
|
121653
|
+
if (!r.trim())
|
|
121654
|
+
continue;
|
|
121655
|
+
const [sha = "", author = "", date = "", ...subject] = r.split("\x1F");
|
|
121656
|
+
if (sha)
|
|
121657
|
+
out.push({ sha, author, date, subject: subject.join("\x1F").trim() });
|
|
121658
|
+
}
|
|
121659
|
+
return out;
|
|
121660
|
+
}
|
|
121661
|
+
var WRAPPER_DIRS = new Set(["src", "packages", "apps"]);
|
|
121662
|
+
function groupOf(path) {
|
|
121663
|
+
const seg = path.split("/");
|
|
121664
|
+
if (seg.length === 1)
|
|
121665
|
+
return "(root)";
|
|
121666
|
+
if (WRAPPER_DIRS.has(seg[0]) && seg.length > 2)
|
|
121667
|
+
return `${seg[0]}/${seg[1]}`;
|
|
121668
|
+
return seg[0];
|
|
121669
|
+
}
|
|
121670
|
+
function parseNameStatus(stdout) {
|
|
121671
|
+
const out = [];
|
|
121672
|
+
for (const line of stdout.split(`
|
|
121673
|
+
`)) {
|
|
121674
|
+
if (!line.trim())
|
|
121675
|
+
continue;
|
|
121676
|
+
const parts = line.split("\t");
|
|
121677
|
+
const status = (parts[0] ?? "").charAt(0);
|
|
121678
|
+
if (!status)
|
|
121679
|
+
continue;
|
|
121680
|
+
if ((status === "R" || status === "C") && parts.length >= 3) {
|
|
121681
|
+
out.push({
|
|
121682
|
+
path: parts[2],
|
|
121683
|
+
status,
|
|
121684
|
+
oldPath: parts[1],
|
|
121685
|
+
group: groupOf(parts[2])
|
|
121686
|
+
});
|
|
121687
|
+
} else if (parts[1]) {
|
|
121688
|
+
out.push({ path: parts[1], status, group: groupOf(parts[1]) });
|
|
121689
|
+
}
|
|
121690
|
+
}
|
|
121691
|
+
return out;
|
|
121692
|
+
}
|
|
121693
|
+
function groupFiles(files) {
|
|
121694
|
+
const m = new Map;
|
|
121695
|
+
for (const f of files)
|
|
121696
|
+
m.set(f.group, (m.get(f.group) ?? 0) + 1);
|
|
121697
|
+
return [...m.entries()].map(([group, files]) => ({ group, files })).sort((a, b) => b.files - a.files || a.group.localeCompare(b.group));
|
|
121698
|
+
}
|
|
121699
|
+
function git(source, args) {
|
|
121700
|
+
const r = spawnSync3("git", ["-C", source, "-c", "core.quotepath=false", ...args], {
|
|
121701
|
+
encoding: "utf8",
|
|
121702
|
+
maxBuffer: 256 * 1024 * 1024
|
|
121703
|
+
});
|
|
121704
|
+
if (r.error || r.status !== 0) {
|
|
121705
|
+
return { ok: false, stderr: (r.error?.message ?? r.stderr ?? "").trim() };
|
|
121706
|
+
}
|
|
121707
|
+
return { ok: true, stdout: r.stdout };
|
|
121708
|
+
}
|
|
121709
|
+
function computeDrift(inputs, opts) {
|
|
121710
|
+
const { source, base, baseFrom } = inputs;
|
|
121711
|
+
const headRef = opts.head ?? "@{upstream}";
|
|
121712
|
+
const fail = (code, message) => ({ error: { code, message } });
|
|
121713
|
+
if (headRef.startsWith("-"))
|
|
121714
|
+
return fail("bad_head", `head "${headRef}" looks like a flag`);
|
|
121715
|
+
if (!existsSync38(source))
|
|
121716
|
+
return fail("not_a_repo", `${source} does not exist`);
|
|
121717
|
+
const inside = git(source, ["rev-parse", "--is-inside-work-tree"]);
|
|
121718
|
+
if (!inside.ok || inside.stdout.trim() !== "true") {
|
|
121719
|
+
return fail("not_a_repo", `${source} is not a git work tree`);
|
|
121720
|
+
}
|
|
121721
|
+
const doFetch = opts.fetch !== false;
|
|
121722
|
+
if (doFetch) {
|
|
121723
|
+
const f = git(source, ["fetch", "--quiet"]);
|
|
121724
|
+
if (!f.ok) {
|
|
121725
|
+
return fail("fetch_failed", `git fetch failed (${f.stderr || "no output"}); pass --no-fetch to measure against what is already local`);
|
|
121726
|
+
}
|
|
121727
|
+
}
|
|
121728
|
+
const head = git(source, ["rev-parse", "--verify", "--end-of-options", `${headRef}^{commit}`]);
|
|
121729
|
+
if (!head.ok) {
|
|
121730
|
+
return headRef === "@{upstream}" ? fail("no_upstream", `the current branch of ${source} has no upstream to compare against`) : fail("head_not_found", `${headRef} does not resolve to a commit in ${source}`);
|
|
121731
|
+
}
|
|
121732
|
+
const headSha = head.stdout.trim();
|
|
121733
|
+
const b = git(source, ["rev-parse", "--verify", "--end-of-options", `${base}^{commit}`]);
|
|
121734
|
+
if (!b.ok) {
|
|
121735
|
+
return fail("base_not_found", `base ${base} is not a commit in ${source}; the clone may be shallow or a different repo`);
|
|
121736
|
+
}
|
|
121737
|
+
const baseSha = b.stdout.trim();
|
|
121738
|
+
const anc = spawnSync3("git", ["-C", source, "merge-base", "--is-ancestor", baseSha, headSha]);
|
|
121739
|
+
if (anc.status === 1) {
|
|
121740
|
+
return fail("base_not_ancestor", `base ${base} is not an ancestor of ${headRef} (history rewritten?)`);
|
|
121741
|
+
}
|
|
121742
|
+
if (anc.status !== 0)
|
|
121743
|
+
return fail("git_failed", `git merge-base failed: ${anc.stderr?.toString().trim()}`);
|
|
121744
|
+
const range = `${baseSha}..${headSha}`;
|
|
121745
|
+
const log = git(source, [
|
|
121746
|
+
"log",
|
|
121747
|
+
"--format=%H%x1f%an%x1f%aI%x1f%s%x1e",
|
|
121748
|
+
range,
|
|
121749
|
+
"--",
|
|
121750
|
+
".",
|
|
121751
|
+
...DRIFT_EXCLUDES
|
|
121752
|
+
]);
|
|
121753
|
+
if (!log.ok)
|
|
121754
|
+
return fail("git_failed", `git log failed: ${log.stderr}`);
|
|
121755
|
+
const diff = git(source, [
|
|
121756
|
+
"diff",
|
|
121757
|
+
"--name-status",
|
|
121758
|
+
"-M",
|
|
121759
|
+
baseSha,
|
|
121760
|
+
headSha,
|
|
121761
|
+
"--",
|
|
121762
|
+
".",
|
|
121763
|
+
...DRIFT_EXCLUDES
|
|
121764
|
+
]);
|
|
121765
|
+
if (!diff.ok)
|
|
121766
|
+
return fail("git_failed", `git diff failed: ${diff.stderr}`);
|
|
121767
|
+
const commitList = parseCommitLog(log.stdout);
|
|
121768
|
+
const files = parseNameStatus(diff.stdout);
|
|
121769
|
+
return {
|
|
121770
|
+
source,
|
|
121771
|
+
base,
|
|
121772
|
+
baseFrom,
|
|
121773
|
+
head: { ref: headRef, sha: headSha },
|
|
121774
|
+
commits: commitList.length,
|
|
121775
|
+
commitList,
|
|
121776
|
+
files,
|
|
121777
|
+
groups: groupFiles(files),
|
|
121778
|
+
excluded: [...DRIFT_EXCLUDES],
|
|
121779
|
+
fetched: doFetch
|
|
121780
|
+
};
|
|
121781
|
+
}
|
|
121782
|
+
function loadState(path) {
|
|
121783
|
+
if (!existsSync38(path))
|
|
121784
|
+
return null;
|
|
121785
|
+
try {
|
|
121786
|
+
return JSON.parse(readFileSync44(path, "utf8"));
|
|
121787
|
+
} catch (err) {
|
|
121788
|
+
return { error: { code: "state_unreadable", message: `${path}: ${err.message}` } };
|
|
121789
|
+
}
|
|
121790
|
+
}
|
|
121791
|
+
function runDrift(flags) {
|
|
121792
|
+
let state = null;
|
|
121793
|
+
if (!(flags.source && flags.base)) {
|
|
121794
|
+
const loaded = loadState(resolve22(flags.state ?? ".parity/migration.json"));
|
|
121795
|
+
if (loaded && "error" in loaded)
|
|
121796
|
+
return loaded;
|
|
121797
|
+
state = loaded;
|
|
121798
|
+
}
|
|
121799
|
+
const inputs = resolveDriftInputs(state, flags);
|
|
121800
|
+
if ("error" in inputs)
|
|
121801
|
+
return inputs;
|
|
121802
|
+
return computeDrift(inputs, { head: flags.head, fetch: flags.fetch });
|
|
121803
|
+
}
|
|
121804
|
+
function driftCommand(flags) {
|
|
121805
|
+
const r = runDrift(flags);
|
|
121806
|
+
if ("error" in r) {
|
|
121807
|
+
if (flags.json)
|
|
121808
|
+
console.log(JSON.stringify({ error: r.error }));
|
|
121809
|
+
else
|
|
121810
|
+
console.error(chalk45.red(` could not measure drift [${r.error.code}]: ${r.error.message}`));
|
|
121811
|
+
return 2;
|
|
121812
|
+
}
|
|
121813
|
+
if (flags.json) {
|
|
121814
|
+
console.log(JSON.stringify(r));
|
|
121815
|
+
} else {
|
|
121816
|
+
const base = `${r.base.slice(0, 7)} (${r.baseFrom})`;
|
|
121817
|
+
console.log(` source ${r.source}`);
|
|
121818
|
+
console.log(` range ${base} .. ${r.head.sha.slice(0, 7)} (${r.head.ref})`);
|
|
121819
|
+
console.log(` drift ${r.commits} commit(s), ${r.files.length} file(s)${r.fetched ? "" : " [not fetched]"}`);
|
|
121820
|
+
for (const g of r.groups)
|
|
121821
|
+
console.log(` ${String(g.files).padStart(4)} ${g.group}`);
|
|
121822
|
+
for (const c of r.commitList)
|
|
121823
|
+
console.log(` ${c.sha.slice(0, 7)} ${c.subject}`);
|
|
121824
|
+
}
|
|
121825
|
+
return r.commits > 0 ? 1 : 0;
|
|
121826
|
+
}
|
|
121827
|
+
|
|
121828
|
+
// src/commands/variance.ts
|
|
121829
|
+
import chalk46 from "chalk";
|
|
121558
121830
|
|
|
121559
121831
|
// src/diff/variance.ts
|
|
121560
121832
|
var uniq2 = (xs) => [...new Set(xs)];
|
|
@@ -121658,7 +121930,7 @@ function formatVariance(report, opts = {}) {
|
|
|
121658
121930
|
// src/commands/variance.ts
|
|
121659
121931
|
function varianceCommand(opts) {
|
|
121660
121932
|
if (opts.runIds.length < 2) {
|
|
121661
|
-
console.error(
|
|
121933
|
+
console.error(chalk46.red(" informe pelo menos 2 runs: parity variance <runIdA> <runIdB> [...]"));
|
|
121662
121934
|
return 2;
|
|
121663
121935
|
}
|
|
121664
121936
|
const budget = Number.parseFloat(opts.scoreBudget ?? "1");
|
|
@@ -121667,7 +121939,7 @@ function varianceCommand(opts) {
|
|
|
121667
121939
|
try {
|
|
121668
121940
|
runs.push(loadRun(opts.output, id));
|
|
121669
121941
|
} catch (err) {
|
|
121670
|
-
console.error(
|
|
121942
|
+
console.error(chalk46.red(` ✖ ${err.message}`));
|
|
121671
121943
|
return 2;
|
|
121672
121944
|
}
|
|
121673
121945
|
}
|
|
@@ -121676,7 +121948,7 @@ function varianceCommand(opts) {
|
|
|
121676
121948
|
console.log(JSON.stringify({ ...report, stable: isStable(report, budget), scoreBudget: budget }));
|
|
121677
121949
|
} else {
|
|
121678
121950
|
console.log("");
|
|
121679
|
-
console.log(
|
|
121951
|
+
console.log(chalk46.bold(" Score variance"));
|
|
121680
121952
|
for (const line of formatVariance(report, { scoreBudget: budget }).split(`
|
|
121681
121953
|
`)) {
|
|
121682
121954
|
console.log(` ${line}`);
|
|
@@ -121688,10 +121960,10 @@ function varianceCommand(opts) {
|
|
|
121688
121960
|
}
|
|
121689
121961
|
|
|
121690
121962
|
// src/commands/vitals.ts
|
|
121691
|
-
import { existsSync as
|
|
121963
|
+
import { existsSync as existsSync39, readFileSync as readFileSync45, writeFileSync as writeFileSync37 } from "node:fs";
|
|
121692
121964
|
import { availableParallelism } from "node:os";
|
|
121693
121965
|
import { join as join51 } from "node:path";
|
|
121694
|
-
import
|
|
121966
|
+
import chalk47 from "chalk";
|
|
121695
121967
|
import ora9 from "ora";
|
|
121696
121968
|
|
|
121697
121969
|
// src/checks/agentic-nav.ts
|
|
@@ -121989,10 +122261,10 @@ async function vitalsCommand(opts) {
|
|
|
121989
122261
|
const runId = newRunId();
|
|
121990
122262
|
const paths = createRunDir(opts.output, runId);
|
|
121991
122263
|
const t0 = Date.now();
|
|
121992
|
-
console.log(
|
|
122264
|
+
console.log(chalk47.bold(`
|
|
121993
122265
|
parity vitals ${runId}`));
|
|
121994
|
-
console.log(
|
|
121995
|
-
console.log(
|
|
122266
|
+
console.log(chalk47.dim(` prod: ${opts.prod}`));
|
|
122267
|
+
console.log(chalk47.dim(` cand: ${opts.cand}`));
|
|
121996
122268
|
const discoverSpinner = ora9("Descobrindo páginas…").start();
|
|
121997
122269
|
const pagePaths = await discoverPagePaths2(opts.prod, opts);
|
|
121998
122270
|
if (pagePaths.length === 0) {
|
|
@@ -122024,7 +122296,7 @@ async function vitalsCommand(opts) {
|
|
|
122024
122296
|
completed++;
|
|
122025
122297
|
const elapsed = ((Date.now() - t0) / 1000).toFixed(0);
|
|
122026
122298
|
const etaSec = completed > 0 ? Math.round((Date.now() - t0) / completed * (total - completed) / 1000) : 0;
|
|
122027
|
-
progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ?
|
|
122299
|
+
progress.text = `${completed}/${total} · ${elapsed}s · ETA ${etaSec}s · ${task.side === "prod" ? chalk47.cyan("prod") : chalk47.magenta("cand")} ${task.path} (${task.viewport})`;
|
|
122028
122300
|
}
|
|
122029
122301
|
});
|
|
122030
122302
|
progress.succeed(`${total} capture(s) em ${((Date.now() - t0) / 1000).toFixed(1)}s`);
|
|
@@ -122053,7 +122325,7 @@ async function vitalsCommand(opts) {
|
|
|
122053
122325
|
}
|
|
122054
122326
|
lhCompleted++;
|
|
122055
122327
|
const elapsed = ((Date.now() - lhT0) / 1000).toFixed(0);
|
|
122056
|
-
lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ?
|
|
122328
|
+
lhProgress.text = `Lighthouse ${lhCompleted}/${done.length} · ${elapsed}s · ${task.side === "prod" ? chalk47.cyan("prod") : chalk47.magenta("cand")} ${task.path} (${task.viewport})`;
|
|
122057
122329
|
});
|
|
122058
122330
|
lhProgress.succeed(`Lighthouse ${done.length} página(s) em ${((Date.now() - lhT0) / 1000).toFixed(1)}s`);
|
|
122059
122331
|
}
|
|
@@ -122131,8 +122403,8 @@ async function vitalsCommand(opts) {
|
|
|
122131
122403
|
`, "utf8");
|
|
122132
122404
|
printSummary9(vitalsResult, cacheResult, scoresResult, oppsResult, agenticResult);
|
|
122133
122405
|
console.log("");
|
|
122134
|
-
console.log(
|
|
122135
|
-
console.log(
|
|
122406
|
+
console.log(chalk47.dim(` → ${paths.reportHtml}`));
|
|
122407
|
+
console.log(chalk47.dim(` \uD83D\uDCA1 use 'parity serve ${runId}' pra preview iframe`));
|
|
122136
122408
|
console.log("");
|
|
122137
122409
|
if (opts.open) {
|
|
122138
122410
|
const { default: open } = await import("open");
|
|
@@ -122224,15 +122496,15 @@ async function discoverPagePaths2(prodUrl, opts) {
|
|
|
122224
122496
|
function parseUrlList(input) {
|
|
122225
122497
|
if (input.startsWith("file:") || input.endsWith(".txt") || input.endsWith(".list")) {
|
|
122226
122498
|
const path = input.replace(/^file:\/\//, "");
|
|
122227
|
-
if (
|
|
122228
|
-
return
|
|
122499
|
+
if (existsSync39(path)) {
|
|
122500
|
+
return readFileSync45(path, "utf8").split(/\r?\n/).map((s) => s.trim()).filter((s) => s && !s.startsWith("#")).map((s) => s.startsWith("/") ? s : `/${s}`);
|
|
122229
122501
|
}
|
|
122230
122502
|
}
|
|
122231
122503
|
return input.split(",").map((s) => s.trim()).filter(Boolean).map((s) => s.startsWith("/") || s.startsWith("http") ? s : `/${s}`);
|
|
122232
122504
|
}
|
|
122233
122505
|
function printSummary9(vitals, cache, scores, opportunities, agentic) {
|
|
122234
122506
|
console.log("");
|
|
122235
|
-
console.log(
|
|
122507
|
+
console.log(chalk47.bold(" Summary:"));
|
|
122236
122508
|
console.log(` ${vitals.summary}`);
|
|
122237
122509
|
console.log(` ${cache.summary}`);
|
|
122238
122510
|
if (scores.status !== "skipped")
|
|
@@ -122296,10 +122568,10 @@ sweep.addCommand(new Command("regress").description("Run only the store's tests/
|
|
|
122296
122568
|
if (opts.json)
|
|
122297
122569
|
console.log(JSON.stringify({ url: opts.url, issues }));
|
|
122298
122570
|
else if (!issues.length)
|
|
122299
|
-
console.log(
|
|
122571
|
+
console.log(chalk48.green(" regression suite: all passed"));
|
|
122300
122572
|
else
|
|
122301
122573
|
for (const i of issues)
|
|
122302
|
-
console.log((i.inconclusive ?
|
|
122574
|
+
console.log((i.inconclusive ? chalk48.yellow : chalk48.red)(` ${i.summary}`));
|
|
122303
122575
|
process.exit(regressed ? 1 : unverified ? 2 : 0);
|
|
122304
122576
|
}));
|
|
122305
122577
|
sweep.addCommand(new Command("file").description("File an existing sweep run's findings on the Studio board (default: the newest sweep run). Merges <run>/sweeper-issues.json written by the `sweeper` agent. Dry run unless --yes.").option("--run <runId>", "Sweep run id (default: newest sweep in --output)").option("--output <dir>", "Output directory", "./parity-output").option("--board <name>", "Board: studio", "studio").option("--yes", "Actually create/update cards", false).option("--allow-automation", "File even if the board's triage column starts an agent", false).option("--min-severity <sev>", "critical|high|medium|low", "medium").option("--repo <owner/name>", "Repository to put on the cards").option("--artifacts-url <url>", "Public base URL for this run's artifacts").option("--json", "Emit JSON", false).action(async (opts) => {
|
|
@@ -122640,6 +122912,16 @@ program.command("mcp").description("Expose the migration over MCP on stdio: stat
|
|
|
122640
122912
|
allowWrites: opts.allowWrites
|
|
122641
122913
|
}));
|
|
122642
122914
|
});
|
|
122915
|
+
program.command("drift").description("How far has the SOURCE repo moved since the migration was cut (or last reconciled)? Reads source.repo and reconciledTo.sha ?? snapshot.sha from .parity/migration.json (flags override), fetches, and reports the commits and changed files since, grouped by path, with `.deco/` excluded. Read-only: never writes the state file. Exits 0 no drift, 1 drift, 2 could not tell (no base, not a git repo, unknown base, no upstream, fetch failed) -- never 0 on a git failure.").option("--source <path>", "Local clone of the source repo (default: source.repo from the state file)").option("--base <sha>", "Commit to measure from (default: reconciledTo.sha, else snapshot.sha)").option("--state <path>", "Migration state file", ".parity/migration.json").option("--head <ref>", "Ref to measure to", "@{upstream}").option("--no-fetch", "Skip `git fetch`; measure against what is already local").option("--json", "Emit one-line JSON instead of text", false).action((opts) => {
|
|
122916
|
+
process.exit(driftCommand({
|
|
122917
|
+
source: opts.source,
|
|
122918
|
+
base: opts.base,
|
|
122919
|
+
state: opts.state,
|
|
122920
|
+
head: opts.head,
|
|
122921
|
+
fetch: opts.fetch,
|
|
122922
|
+
json: opts.json
|
|
122923
|
+
}));
|
|
122924
|
+
});
|
|
122643
122925
|
program.command("variance").description("Measure whether a score change is attributable to the code. Run `parity run` twice against UNCHANGED code, then pass both run ids: this reports the score spread and, more usefully, WHICH checks reported differently. A check whose status flips between two runs of the same code is not measuring the code, and every score it contributes to is unfalsifiable until it is named. Exits 1 when unstable, 2 when the runs are not comparable.").argument("<runIds...>", "Two or more saved run ids of the same host pair").option("--score-budget <points>", "Score spread tolerated before calling it unstable", "1").option("--output <dir>", "Output directory holding the runs", "./parity-output").option("--json", "Emit one-line JSON instead of pretty text", false).action((runIds, opts) => {
|
|
122644
122926
|
process.exit(varianceCommand({
|
|
122645
122927
|
runIds,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/parity",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.21",
|
|
4
4
|
"description": "E2E parity validator for site migrations. Compares prod vs cand and reports UI, functional, SEO, visual, and Web Vitals deltas with a ranked HTML report.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|