@design-parity/action 0.1.37 → 0.1.39
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/README.md +17 -0
- package/dist/cli/merge.d.ts +21 -0
- package/dist/cli/merge.d.ts.map +1 -0
- package/dist/cli/merge.js +158 -0
- package/dist/cli/merge.js.map +1 -0
- package/dist/cli/run.d.ts +11 -1
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +81 -3
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/shard-cli.d.ts +25 -0
- package/dist/cli/shard-cli.d.ts.map +1 -0
- package/dist/cli/shard-cli.js +104 -0
- package/dist/cli/shard-cli.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/orchestrate.d.ts +10 -0
- package/dist/orchestrate.d.ts.map +1 -1
- package/dist/orchestrate.js +10 -1
- package/dist/orchestrate.js.map +1 -1
- package/dist/shard.d.ts +130 -0
- package/dist/shard.d.ts.map +1 -0
- package/dist/shard.js +165 -0
- package/dist/shard.js.map +1 -0
- package/package.json +14 -12
package/README.md
CHANGED
|
@@ -123,3 +123,20 @@ const report = await orchestrate({
|
|
|
123
123
|
});
|
|
124
124
|
console.log(renderReport(report));
|
|
125
125
|
```
|
|
126
|
+
|
|
127
|
+
## Sharding
|
|
128
|
+
|
|
129
|
+
`src/shard.ts` splits one run across N jobs and puts the pieces back: a
|
|
130
|
+
sort-then-round-robin partition every shard derives independently
|
|
131
|
+
(`partitionComponents`), a `shard.json` per shard, and `verifyShardReports` +
|
|
132
|
+
`mergeShards` to union them into what a serial run would have produced. It is
|
|
133
|
+
what lets an *exhaustive* comparison fit inside a job timeout instead of being
|
|
134
|
+
narrowed to a hand-picked subset.
|
|
135
|
+
|
|
136
|
+
The CLIs over it are `design-parity shard` (`cli/shard-cli.ts`, read by the
|
|
137
|
+
render step), `design-parity run --shard i/N` (`cli/run.ts`), and
|
|
138
|
+
`design-parity merge` (`cli/merge.ts`). Both sides of a shard read the *same*
|
|
139
|
+
partition implementation — see
|
|
140
|
+
[`docs/PARALLEL_PARITY.md`](https://github.com/yschimke/design-parity/blob/main/docs/PARALLEL_PARITY.md)
|
|
141
|
+
for the invariant and the two orderings (verify-before-merge,
|
|
142
|
+
publish-before-verdict) that it turns on.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { type ShardReport } from "../shard.js";
|
|
3
|
+
interface Args {
|
|
4
|
+
shardDirs: string[];
|
|
5
|
+
outDir?: string;
|
|
6
|
+
repoSlug?: string;
|
|
7
|
+
branch?: string;
|
|
8
|
+
sourceCommit?: string;
|
|
9
|
+
bundleImage?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseArgs(args: string[]): Args;
|
|
12
|
+
/** Read one shard's declaration, failing with the path when it isn't one. */
|
|
13
|
+
export declare function readShardReport(dir: string): Promise<ShardReport>;
|
|
14
|
+
/**
|
|
15
|
+
* `rawArgs` defaults to the process argv; passing it explicitly is how tests
|
|
16
|
+
* drive the command without mutating `process` (the `node:process` named imports
|
|
17
|
+
* are bound at module load, so stubbing `process.argv` would not reach them).
|
|
18
|
+
*/
|
|
19
|
+
export declare function main(rawArgs?: string[]): Promise<number>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/cli/merge.ts"],"names":[],"mappings":";AA0BA,OAAO,EAAmC,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEhF,UAAU,IAAI;IACZ,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA6B9C;AAYD,6EAA6E;AAC7E,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAgBvE;AAuBD;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,OAAO,GAAE,MAAM,EAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwD7E"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `design-parity merge` — put a sharded run back together.
|
|
4
|
+
*
|
|
5
|
+
* design-parity merge shards/parity-shard-* --out .design-parity/out \
|
|
6
|
+
* --repo-slug owner/repo --branch design-parity/main --source-commit "$SHA"
|
|
7
|
+
*
|
|
8
|
+
* Each argument is one shard's `--out` directory (or its `shard.json` directly).
|
|
9
|
+
* The merge verifies the shards cover the run exactly once, copies every
|
|
10
|
+
* component's report subdir into `--out`, and regenerates the landing page from
|
|
11
|
+
* the unioned rows — producing the artifact set a single serial run would have
|
|
12
|
+
* written, so nothing downstream (publish, the branch layout, a consumer reading
|
|
13
|
+
* `index.html`) has to know the run was sharded at all.
|
|
14
|
+
*
|
|
15
|
+
* Exit code carries the run's verdict: 1 when any shard blocked, 0 otherwise.
|
|
16
|
+
* That is deliberately the LAST thing this does — the artifacts are on disk
|
|
17
|
+
* before the process fails, so a blocking run still publishes the reports that
|
|
18
|
+
* explain it.
|
|
19
|
+
*/
|
|
20
|
+
import { argv, cwd, exit, stderr, stdout } from "node:process";
|
|
21
|
+
import { cp, mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
22
|
+
import { basename, dirname, join, resolve as resolvePath } from "node:path";
|
|
23
|
+
import { pathToFileURL } from "node:url";
|
|
24
|
+
import { renderIndex } from "@design-parity/report-html";
|
|
25
|
+
import { mergeShards, verifyShardReports } from "../shard.js";
|
|
26
|
+
export function parseArgs(args) {
|
|
27
|
+
const out = { shardDirs: [] };
|
|
28
|
+
for (let i = 0; i < args.length; i++) {
|
|
29
|
+
const a = args[i];
|
|
30
|
+
const next = () => args[(i += 1)];
|
|
31
|
+
switch (a) {
|
|
32
|
+
case "merge":
|
|
33
|
+
break;
|
|
34
|
+
case "--out":
|
|
35
|
+
case "-o":
|
|
36
|
+
out.outDir = next();
|
|
37
|
+
break;
|
|
38
|
+
case "--repo-slug":
|
|
39
|
+
out.repoSlug = next();
|
|
40
|
+
break;
|
|
41
|
+
case "--branch":
|
|
42
|
+
out.branch = next();
|
|
43
|
+
break;
|
|
44
|
+
case "--source-commit":
|
|
45
|
+
out.sourceCommit = next();
|
|
46
|
+
break;
|
|
47
|
+
case "--bundle-image":
|
|
48
|
+
out.bundleImage = next();
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
if (a && !a.startsWith("-"))
|
|
52
|
+
out.shardDirs.push(a);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The directory holding a shard's artifacts, given whatever the caller pointed
|
|
59
|
+
* at. Accepts the out dir itself or the `shard.json` inside it, because CI globs
|
|
60
|
+
* land on either (`find … -name shard.json` is the reliable way to enumerate
|
|
61
|
+
* downloaded artifacts, and passing the file is then one less `dirname`).
|
|
62
|
+
*/
|
|
63
|
+
function shardDirOf(path) {
|
|
64
|
+
return basename(path) === "shard.json" ? dirname(path) : path;
|
|
65
|
+
}
|
|
66
|
+
/** Read one shard's declaration, failing with the path when it isn't one. */
|
|
67
|
+
export async function readShardReport(dir) {
|
|
68
|
+
const path = join(dir, "shard.json");
|
|
69
|
+
let raw;
|
|
70
|
+
try {
|
|
71
|
+
raw = await readFile(path, "utf8");
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
throw new Error(`${path}: no shard.json — a shard's --out dir must come from a ` +
|
|
75
|
+
`\`design-parity run --shard <i>/<n>\``);
|
|
76
|
+
}
|
|
77
|
+
const doc = JSON.parse(raw);
|
|
78
|
+
if (typeof doc.index !== "number" || typeof doc.total !== "number") {
|
|
79
|
+
throw new Error(`${path}: not a shard report (missing index/total)`);
|
|
80
|
+
}
|
|
81
|
+
return doc;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Copy a shard's per-component report subdirs into the merged out dir.
|
|
85
|
+
*
|
|
86
|
+
* Only directories are copied: the shard's own `index.html` / `README.md` /
|
|
87
|
+
* `shard.json` are per-shard views that the merged ones replace, and copying
|
|
88
|
+
* them would have the last shard's partial index win over the merged one.
|
|
89
|
+
* Component dirs are disjoint across shards by construction (the partition is
|
|
90
|
+
* disjoint and a dir is named for its component), so there is nothing to
|
|
91
|
+
* reconcile — `verifyShardReports` has already established that.
|
|
92
|
+
*/
|
|
93
|
+
async function copyComponentDirs(from, to) {
|
|
94
|
+
let copied = 0;
|
|
95
|
+
const entries = await readdir(from, { withFileTypes: true });
|
|
96
|
+
for (const e of entries) {
|
|
97
|
+
if (!e.isDirectory())
|
|
98
|
+
continue;
|
|
99
|
+
await cp(join(from, e.name), join(to, e.name), { recursive: true });
|
|
100
|
+
copied += 1;
|
|
101
|
+
}
|
|
102
|
+
return copied;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* `rawArgs` defaults to the process argv; passing it explicitly is how tests
|
|
106
|
+
* drive the command without mutating `process` (the `node:process` named imports
|
|
107
|
+
* are bound at module load, so stubbing `process.argv` would not reach them).
|
|
108
|
+
*/
|
|
109
|
+
export async function main(rawArgs = argv.slice(2)) {
|
|
110
|
+
const args = parseArgs(rawArgs);
|
|
111
|
+
if (args.shardDirs.length === 0 || !args.outDir) {
|
|
112
|
+
stdout.write("design-parity merge <shard-out-dir|shard.json>... --out <dir> " +
|
|
113
|
+
"[--repo-slug owner/repo --branch <branch> --source-commit <sha> " +
|
|
114
|
+
"--bundle-image <file>]\n");
|
|
115
|
+
return 2;
|
|
116
|
+
}
|
|
117
|
+
const dirs = args.shardDirs.map((p) => resolvePath(cwd(), shardDirOf(p)));
|
|
118
|
+
const reports = [];
|
|
119
|
+
for (const dir of dirs)
|
|
120
|
+
reports.push(await readShardReport(dir));
|
|
121
|
+
const problems = verifyShardReports(reports);
|
|
122
|
+
if (problems.length > 0) {
|
|
123
|
+
// Loud and specific: this runs after every shard has spent its full budget,
|
|
124
|
+
// so a merged index quietly missing a slice is the expensive failure.
|
|
125
|
+
stderr.write("Shard verification failed — refusing to publish a partial run:\n" +
|
|
126
|
+
problems.map((p) => ` - ${p}`).join("\n") +
|
|
127
|
+
"\n");
|
|
128
|
+
return 1;
|
|
129
|
+
}
|
|
130
|
+
const merged = mergeShards(reports);
|
|
131
|
+
const outDir = resolvePath(cwd(), args.outDir);
|
|
132
|
+
await mkdir(outDir, { recursive: true });
|
|
133
|
+
let components = 0;
|
|
134
|
+
for (const dir of dirs)
|
|
135
|
+
components += await copyComponentDirs(dir, outDir);
|
|
136
|
+
const { readme, html } = renderIndex({
|
|
137
|
+
entries: merged.entries,
|
|
138
|
+
...(args.repoSlug ? { repoSlug: args.repoSlug } : {}),
|
|
139
|
+
...(args.branch ? { branch: args.branch } : {}),
|
|
140
|
+
...(args.sourceCommit ? { sourceCommit: args.sourceCommit } : {}),
|
|
141
|
+
...(args.bundleImage ? { bundleImage: args.bundleImage } : {}),
|
|
142
|
+
});
|
|
143
|
+
await writeFile(join(outDir, "README.md"), readme);
|
|
144
|
+
await writeFile(join(outDir, "index.html"), html);
|
|
145
|
+
stdout.write(`Merged ${reports.length}/${merged.total} shard(s): ` +
|
|
146
|
+
`${merged.entries.length} component(s), ${components} report dir(s), ` +
|
|
147
|
+
`${merged.warnings.length} warning(s) → ${outDir}\n` +
|
|
148
|
+
`Parity ${merged.status} (${merged.direction})${merged.blocked ? " — blocking" : ""}\n`);
|
|
149
|
+
if (merged.warnings.length > 0) {
|
|
150
|
+
stdout.write(merged.warnings.map((w) => ` ! ${w}`).join("\n") + "\n");
|
|
151
|
+
}
|
|
152
|
+
// Verdict last, artifacts first — see the module header.
|
|
153
|
+
return merged.blocked ? 1 : 0;
|
|
154
|
+
}
|
|
155
|
+
if (import.meta.url === pathToFileURL(argv[1] ?? "").href) {
|
|
156
|
+
exit(await main());
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=merge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.js","sourceRoot":"","sources":["../../src/cli/merge.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAoB,MAAM,aAAa,CAAC;AAWhF,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,GAAG,GAAS,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClC,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,OAAO;gBACV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C,GAAG,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/cli/run.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { orchestrate } from "../orchestrate.js";
|
|
2
|
+
import { orchestrate, type ParityReport } from "../orchestrate.js";
|
|
3
|
+
import { type ShardSelector } from "../shard.js";
|
|
3
4
|
interface Args {
|
|
4
5
|
repoRoot: string;
|
|
5
6
|
components: string[];
|
|
@@ -12,8 +13,17 @@ interface Args {
|
|
|
12
13
|
branch?: string;
|
|
13
14
|
sourceCommit?: string;
|
|
14
15
|
bundleImage?: string;
|
|
16
|
+
shard?: ShardSelector;
|
|
15
17
|
}
|
|
16
18
|
export declare function parseArgs(args: string[]): Args;
|
|
19
|
+
/**
|
|
20
|
+
* Write this shard's `shard.json` — the declaration `design-parity merge` reads:
|
|
21
|
+
* what the shard was responsible for, and the landing-page rows it produced.
|
|
22
|
+
*
|
|
23
|
+
* Written even for an empty slice (see the caller), because the merge treats a
|
|
24
|
+
* shard that never reported as a hard error rather than an absence.
|
|
25
|
+
*/
|
|
26
|
+
export declare function writeShardReport(outDir: string, shard: ShardSelector, components: string[], report: Pick<ParityReport, "direction" | "status" | "blocked" | "warnings" | "indexEntries">): Promise<string>;
|
|
17
27
|
/** Landing-page link context from the CLI flags, or `undefined` when none set. */
|
|
18
28
|
export declare function indexOptions(args: Args): NonNullable<Parameters<typeof orchestrate>[0]["index"]> | undefined;
|
|
19
29
|
export declare function main(): Promise<number>;
|
package/dist/cli/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","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undles <png|dir,...>` (compose-ai-tools preview-bundle
|
|
16
16
|
* polyglots, read statically by `@design-parity/candidate`; issue #38 Phase 1).
|
|
17
17
|
* When both are given, bundles win and the JSON is the fallback.
|
|
18
|
+
*
|
|
19
|
+
* `--shard <i>/<n>` runs one slice of the component list in this job and writes
|
|
20
|
+
* a `shard.json` next to the reports; `design-parity merge` unions the slices
|
|
21
|
+
* back into the artifact set a serial run would have produced. That is how an
|
|
22
|
+
* *exhaustive* comparison (every component, not just the ones a hand-tuned
|
|
23
|
+
* workflow could afford) fits inside a job timeout — see `../shard.ts` and
|
|
24
|
+
* `docs/PARALLEL_PARITY.md`.
|
|
18
25
|
*/
|
|
19
26
|
import { argv, cwd, env, exit, stdout } from "node:process";
|
|
20
|
-
import {
|
|
27
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
28
|
+
import { join, resolve as resolvePath } from "node:path";
|
|
21
29
|
import { pathToFileURL } from "node:url";
|
|
22
30
|
import { resolve as resolveCorrespondences } from "@design-parity/resolver";
|
|
23
31
|
import { FigmaCanvasWriter } from "@design-parity/adapter-figma";
|
|
@@ -28,6 +36,7 @@ import { orchestrate } from "../orchestrate.js";
|
|
|
28
36
|
import { loadSpecTokens } from "../specTokens.js";
|
|
29
37
|
import { pushBack } from "../pushback.js";
|
|
30
38
|
import { renderReport } from "../report.js";
|
|
39
|
+
import { parseShard, partitionComponents, SHARD_FORMAT_VERSION, } from "../shard.js";
|
|
31
40
|
export function parseArgs(args) {
|
|
32
41
|
const out = { repoRoot: cwd(), components: [], bundlePaths: [], pushBack: false };
|
|
33
42
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -73,6 +82,12 @@ export function parseArgs(args) {
|
|
|
73
82
|
case "--bundle-image":
|
|
74
83
|
out.bundleImage = next();
|
|
75
84
|
break;
|
|
85
|
+
// One slice of the run (`--shard 2/6`). Throws on a malformed or
|
|
86
|
+
// out-of-range selector: a typo that silently compared everything (or
|
|
87
|
+
// nothing) would land as a merged index that looks complete.
|
|
88
|
+
case "--shard":
|
|
89
|
+
out.shard = parseShard(next());
|
|
90
|
+
break;
|
|
76
91
|
default:
|
|
77
92
|
if (a && !a.startsWith("--"))
|
|
78
93
|
out.components.push(a);
|
|
@@ -80,6 +95,30 @@ export function parseArgs(args) {
|
|
|
80
95
|
}
|
|
81
96
|
return out;
|
|
82
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* Write this shard's `shard.json` — the declaration `design-parity merge` reads:
|
|
100
|
+
* what the shard was responsible for, and the landing-page rows it produced.
|
|
101
|
+
*
|
|
102
|
+
* Written even for an empty slice (see the caller), because the merge treats a
|
|
103
|
+
* shard that never reported as a hard error rather than an absence.
|
|
104
|
+
*/
|
|
105
|
+
export async function writeShardReport(outDir, shard, components, report) {
|
|
106
|
+
const doc = {
|
|
107
|
+
formatVersion: SHARD_FORMAT_VERSION,
|
|
108
|
+
index: shard.index,
|
|
109
|
+
total: shard.total,
|
|
110
|
+
components,
|
|
111
|
+
direction: report.direction,
|
|
112
|
+
status: report.status,
|
|
113
|
+
blocked: report.blocked,
|
|
114
|
+
warnings: report.warnings,
|
|
115
|
+
entries: report.indexEntries ?? [],
|
|
116
|
+
};
|
|
117
|
+
await mkdir(outDir, { recursive: true });
|
|
118
|
+
const path = join(outDir, "shard.json");
|
|
119
|
+
await writeFile(path, JSON.stringify(doc, null, 2) + "\n");
|
|
120
|
+
return path;
|
|
121
|
+
}
|
|
83
122
|
/** Landing-page link context from the CLI flags, or `undefined` when none set. */
|
|
84
123
|
export function indexOptions(args) {
|
|
85
124
|
const index = {};
|
|
@@ -99,11 +138,36 @@ export async function main() {
|
|
|
99
138
|
stdout.write("design-parity run --components <code#Member,...> [--repo .] " +
|
|
100
139
|
"[--candidates file.json] [--candidate-bundles <png|dir,...>] [--out dir] " +
|
|
101
140
|
"[--repo-slug owner/repo --branch <branch> --source-commit <sha> --bundle-image <file>] " +
|
|
102
|
-
"[--push-back [--canvas-endpoint <url>]]\n");
|
|
141
|
+
"[--shard <index>/<total>] [--push-back [--canvas-endpoint <url>]]\n");
|
|
103
142
|
return 2;
|
|
104
143
|
}
|
|
144
|
+
// This shard's slice, derived from the full list every shard is given — so the
|
|
145
|
+
// caller passes the same `--components` to all of them and no job has to know
|
|
146
|
+
// what its siblings took.
|
|
147
|
+
const components = args.shard
|
|
148
|
+
? partitionComponents(args.components, args.shard)
|
|
149
|
+
: args.components;
|
|
150
|
+
if (args.shard) {
|
|
151
|
+
stdout.write(`Shard ${args.shard.index}/${args.shard.total}: ${components.length} of ` +
|
|
152
|
+
`${new Set(args.components).size} component(s)\n`);
|
|
153
|
+
}
|
|
105
154
|
const { designMap, direction, cmpCapable, warnings } = await resolveRunConfig(args.repoRoot);
|
|
106
|
-
|
|
155
|
+
// More shards than components leaves the tail shards empty. That is a no-op,
|
|
156
|
+
// not a failure — but it still has to write its `shard.json`, or the merge
|
|
157
|
+
// reports the shard as missing and refuses the whole run.
|
|
158
|
+
if (args.shard && components.length === 0) {
|
|
159
|
+
if (args.outDir) {
|
|
160
|
+
await writeShardReport(args.outDir, args.shard, components, {
|
|
161
|
+
status: "pass",
|
|
162
|
+
blocked: false,
|
|
163
|
+
direction,
|
|
164
|
+
warnings: [],
|
|
165
|
+
indexEntries: [],
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return 0;
|
|
169
|
+
}
|
|
170
|
+
const resolved = resolveCorrespondences(components, { designMap });
|
|
107
171
|
// Spec tokens a component declares via a committed DTCG file (design-map
|
|
108
172
|
// `tokensFile`, issue #89), loaded once up front so a bad file warns (#1).
|
|
109
173
|
const spec = await loadSpecTokens(designMap, args.repoRoot);
|
|
@@ -136,6 +200,12 @@ export async function main() {
|
|
|
136
200
|
if (typeof cmpCapable === "boolean")
|
|
137
201
|
report.cmpCapable = cmpCapable;
|
|
138
202
|
stdout.write(renderReport(report) + "\n");
|
|
203
|
+
// Emitted before push-back and the page listing so a shard that dies in either
|
|
204
|
+
// still leaves the merge a complete declaration of what it did.
|
|
205
|
+
if (args.shard && args.outDir) {
|
|
206
|
+
const path = await writeShardReport(args.outDir, args.shard, components, report);
|
|
207
|
+
stdout.write(`\nWrote ${path}\n`);
|
|
208
|
+
}
|
|
139
209
|
// Optional Code-to-Canvas push-back (#9): no-op (with a log) unless the
|
|
140
210
|
// `--push-back` flag is set, the direction is `code-led`, and a figma bridge
|
|
141
211
|
// endpoint is configured. A side effect only — it never affects the exit code.
|
|
@@ -156,6 +226,14 @@ export async function main() {
|
|
|
156
226
|
pages.map((p) => ` ${p}`).join("\n") +
|
|
157
227
|
"\n");
|
|
158
228
|
}
|
|
229
|
+
// A blocking verdict is the RUN's verdict, not a shard's, so a sharded run
|
|
230
|
+
// reports it in `shard.json` and exits 0 here; `design-parity merge` applies it
|
|
231
|
+
// once, after the merged artifacts exist. Exiting non-zero per shard would take
|
|
232
|
+
// the fan-out down (fail-fast) and strand the reports that diagnose the very
|
|
233
|
+
// failure being reported — the same "publish, then apply the verdict" ordering
|
|
234
|
+
// a hand-written workflow has to get right by hand.
|
|
235
|
+
if (args.shard)
|
|
236
|
+
return 0;
|
|
159
237
|
return report.blocked ? 1 : 0;
|
|
160
238
|
}
|
|
161
239
|
// Self-execute when invoked directly (`node dist/cli/run.js …`), guarded so
|
package/dist/cli/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,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AC,CAAC;AAChC,CAAC;AAED,4EAA4E;AAC5E,yEAAyE;AACzE,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { findAllByCode } from "@design-parity/core";
|
|
3
|
+
import { type ShardSelector } from "../shard.js";
|
|
4
|
+
/** What to print for each component in the slice. */
|
|
5
|
+
export type ShardField = "code" | "previewId";
|
|
6
|
+
interface Args {
|
|
7
|
+
repoRoot: string;
|
|
8
|
+
components: string[];
|
|
9
|
+
field: ShardField;
|
|
10
|
+
shard?: ShardSelector;
|
|
11
|
+
/** Print the components/previews NOT in this shard (render exclusion lists). */
|
|
12
|
+
complement: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseArgs(args: string[]): Args;
|
|
15
|
+
/**
|
|
16
|
+
* The preview ids a component renders as, from the design map.
|
|
17
|
+
*
|
|
18
|
+
* A component can declare several (one per variant — light/dark, issue #111),
|
|
19
|
+
* and every one of them belongs to whichever shard owns the component: splitting
|
|
20
|
+
* a component's variants across shards would give each shard half a triptych.
|
|
21
|
+
*/
|
|
22
|
+
export declare function previewIdsFor(map: Parameters<typeof findAllByCode>[0], code: string): string[];
|
|
23
|
+
export declare function main(rawArgs?: string[]): Promise<number>;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=shard-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shard-cli.d.ts","sourceRoot":"","sources":["../../src/cli/shard-cli.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAmB,aAAa,EAAiB,MAAM,qBAAqB,CAAC;AAEpF,OAAO,EAAmC,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAElF,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW,CAAC;AAE9C,UAAU,IAAI;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,gFAAgF;IAChF,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAiC9C;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,EACxC,IAAI,EAAE,MAAM,GACX,MAAM,EAAE,CAIV;AAED,wBAAsB,IAAI,CAAC,OAAO,GAAE,MAAM,EAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC7E"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `design-parity shard` — print one shard's slice of the run.
|
|
4
|
+
*
|
|
5
|
+
* design-parity shard --shard 2/6 --repo . # component handles
|
|
6
|
+
* design-parity shard --shard 2/6 --repo . --field previewId # render ids
|
|
7
|
+
*
|
|
8
|
+
* A sharded run has two sides that MUST agree on the partition: the render step
|
|
9
|
+
* (which previews this job draws) and `design-parity run --shard` (which
|
|
10
|
+
* components this job compares). If they disagree, the shard renders previews it
|
|
11
|
+
* never diffs and diffs components it never rendered — which surfaces only as
|
|
12
|
+
* "no candidate render available" warnings on a green run.
|
|
13
|
+
*
|
|
14
|
+
* So the partition has exactly one implementation ({@link partitionComponents}),
|
|
15
|
+
* and this command is how a workflow's *render* step reads it. No re-derivation
|
|
16
|
+
* in shell, no second sort order to keep in step.
|
|
17
|
+
*
|
|
18
|
+
* Output is one item per line (empty for an empty slice, which is a legitimate
|
|
19
|
+
* no-op when there are more shards than components), so it drops straight into
|
|
20
|
+
* `mapfile` / `xargs` / a `--id` loop.
|
|
21
|
+
*/
|
|
22
|
+
import { argv, cwd, exit, stderr, stdout } from "node:process";
|
|
23
|
+
import { join, resolve as resolvePath } from "node:path";
|
|
24
|
+
import { pathToFileURL } from "node:url";
|
|
25
|
+
import { entryPreviewIds, findAllByCode, loadDesignMap } from "@design-parity/core";
|
|
26
|
+
import { parseShard, partitionComponents } from "../shard.js";
|
|
27
|
+
export function parseArgs(args) {
|
|
28
|
+
const out = {
|
|
29
|
+
repoRoot: cwd(),
|
|
30
|
+
components: [],
|
|
31
|
+
field: "code",
|
|
32
|
+
complement: false,
|
|
33
|
+
};
|
|
34
|
+
for (let i = 0; i < args.length; i++) {
|
|
35
|
+
const a = args[i];
|
|
36
|
+
const next = () => args[(i += 1)];
|
|
37
|
+
switch (a) {
|
|
38
|
+
case "shard":
|
|
39
|
+
break;
|
|
40
|
+
case "--repo":
|
|
41
|
+
out.repoRoot = resolvePath(next() ?? ".");
|
|
42
|
+
break;
|
|
43
|
+
case "--components":
|
|
44
|
+
out.components.push(...(next() ?? "").split(",").filter(Boolean));
|
|
45
|
+
break;
|
|
46
|
+
case "--shard":
|
|
47
|
+
out.shard = parseShard(next());
|
|
48
|
+
break;
|
|
49
|
+
case "--field":
|
|
50
|
+
out.field = next() === "previewId" ? "previewId" : "code";
|
|
51
|
+
break;
|
|
52
|
+
case "--complement":
|
|
53
|
+
out.complement = true;
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
if (a && !a.startsWith("--"))
|
|
57
|
+
out.components.push(a);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The preview ids a component renders as, from the design map.
|
|
64
|
+
*
|
|
65
|
+
* A component can declare several (one per variant — light/dark, issue #111),
|
|
66
|
+
* and every one of them belongs to whichever shard owns the component: splitting
|
|
67
|
+
* a component's variants across shards would give each shard half a triptych.
|
|
68
|
+
*/
|
|
69
|
+
export function previewIdsFor(map, code) {
|
|
70
|
+
return findAllByCode(map, code).flatMap((entry) => entryPreviewIds(entry).map((v) => v.previewId));
|
|
71
|
+
}
|
|
72
|
+
export async function main(rawArgs = argv.slice(2)) {
|
|
73
|
+
const args = parseArgs(rawArgs);
|
|
74
|
+
if (!args.shard) {
|
|
75
|
+
stdout.write("design-parity shard --shard <index>/<total> [--repo .] " +
|
|
76
|
+
"[--components <code,...>] [--field code|previewId] [--complement]\n");
|
|
77
|
+
return 2;
|
|
78
|
+
}
|
|
79
|
+
// The component universe: whatever was passed, else every component in the
|
|
80
|
+
// committed design map — which is what makes an *exhaustive* run the default
|
|
81
|
+
// rather than something a workflow has to enumerate by hand.
|
|
82
|
+
const map = args.components.length === 0 || args.field === "previewId"
|
|
83
|
+
? await loadDesignMap(join(args.repoRoot, "design-map.json"))
|
|
84
|
+
: undefined;
|
|
85
|
+
const components = args.components.length > 0 ? args.components : (map?.components ?? []).map((c) => c.code);
|
|
86
|
+
if (components.length === 0) {
|
|
87
|
+
stderr.write("no components: pass --components, or commit a design-map.json with entries\n");
|
|
88
|
+
return 1;
|
|
89
|
+
}
|
|
90
|
+
const mine = partitionComponents(components, args.shard);
|
|
91
|
+
const selected = args.complement
|
|
92
|
+
? [...new Set(components)].sort().filter((c) => !mine.includes(c))
|
|
93
|
+
: mine;
|
|
94
|
+
const lines = args.field === "previewId"
|
|
95
|
+
? selected.flatMap((code) => previewIdsFor(map, code))
|
|
96
|
+
: selected;
|
|
97
|
+
if (lines.length > 0)
|
|
98
|
+
stdout.write(lines.join("\n") + "\n");
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
if (import.meta.url === pathToFileURL(argv[1] ?? "").href) {
|
|
102
|
+
exit(await main());
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=shard-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AC,GAAG,KAAK,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export type { RunConfig } from "./config.js";
|
|
|
17
17
|
export { loadSpecTokens, specTokenKey } from "./specTokens.js";
|
|
18
18
|
export type { SpecTokens } from "./specTokens.js";
|
|
19
19
|
export { renderReport, renderBootstrapNotice, REPORT_MARKER, CMP_PROMOTION, } from "./report.js";
|
|
20
|
+
export { mergeShards, parseShard, partitionComponents, verifyShardReports, SHARD_FORMAT_VERSION, } from "./shard.js";
|
|
21
|
+
export type { MergedShards, ShardReport, ShardSelector } from "./shard.js";
|
|
20
22
|
export { selectMode } from "./mode.js";
|
|
21
23
|
export type { ActionMode, ModeInputs } from "./mode.js";
|
|
22
24
|
export { runReverse } from "./reverse.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,YAAY,GACb,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YA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|
@@ -12,6 +12,7 @@ export { buildCandidateProvider, loadPrecomputed, precomputedSource, providerFro
|
|
|
12
12
|
export { resolveRunConfig } from "./config.js";
|
|
13
13
|
export { loadSpecTokens, specTokenKey } from "./specTokens.js";
|
|
14
14
|
export { renderReport, renderBootstrapNotice, REPORT_MARKER, CMP_PROMOTION, } from "./report.js";
|
|
15
|
+
export { mergeShards, parseShard, partitionComponents, verifyShardReports, SHARD_FORMAT_VERSION, } from "./shard.js";
|
|
15
16
|
export { selectMode } from "./mode.js";
|
|
16
17
|
export { runReverse } from "./reverse.js";
|
|
17
18
|
export { pushBack, decidePushBack } from "./pushback.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAS/C,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACb,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAWzD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,sBAAsB,GACvB,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e,CAAC;AASvB,iBAAiB;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACL,yBAAyB,EACzB,UAAU,GACX,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/orchestrate.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { AdapterContext, CandidateRender, Correspondence, DesignReference, DesignSource, DesignTokens, Finding, ResolvedDirection, TokenAliasMap, Verdict, VerdictStatus } from "@design-parity/core";
|
|
12
12
|
import { type DiffConfig, type Triptych } from "@design-parity/diff";
|
|
13
|
+
import { type IndexEntry } from "@design-parity/report-html";
|
|
13
14
|
import type { AdapterRegistry } from "./registry.js";
|
|
14
15
|
/** Supplies the candidate render for a component (compose-preview, or precomputed). */
|
|
15
16
|
export type CandidateProvider = (componentId: string, ctx: AdapterContext) => Promise<CandidateRender | undefined> | CandidateRender | undefined;
|
|
@@ -104,6 +105,15 @@ export interface ParityReport {
|
|
|
104
105
|
* advisory only.
|
|
105
106
|
*/
|
|
106
107
|
cmpCapable?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* The landing-page rows written alongside the per-component reports, present
|
|
110
|
+
* only when `outDir` was set. Retained (rather than being a private detail of
|
|
111
|
+
* the index write) so a **sharded** run can hand them to `design-parity merge`,
|
|
112
|
+
* which unions the shards' rows into one index instead of re-deriving them —
|
|
113
|
+
* re-derivation would need every shard's candidate renders in the merge job,
|
|
114
|
+
* which is the whole cost the fan-out just paid to avoid. See `shard.ts`.
|
|
115
|
+
*/
|
|
116
|
+
indexEntries?: IndexEntry[];
|
|
107
117
|
}
|
|
108
118
|
/** Run the full parity pipeline over the resolved components. */
|
|
109
119
|
export declare function orchestrate(options: OrchestrateOptions): Promise<ParityReport>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrate.d.ts","sourceRoot":"","sources":["../src/orchestrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,aAAa,EACd,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"orchestrate.d.ts","sourceRoot":"","sources":["../src/orchestrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,cAAc,EACd,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,aAAa,EACb,OAAO,EACP,aAAa,EACd,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,QAAQ,EACd,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAIrD,uFAAuF;AACvF,MAAM,MAAM,iBAAiB,GAAG,CAC9B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,cAAc,KAChB,OAAO,CAAC,eAAe,GAAG,SAAS,CAAC,GAAG,eAAe,GAAG,SAAS,CAAC;AAExE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,QAAQ,EAAE,eAAe,CAAC;IAC1B,sFAAsF;IACtF,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pB,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,YAAY;IAC3B,4EAA4E;IAC5E,MAAM,EAAE,aAAa,CAAC;IACtB,+EAA+E;IAC/E,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,+EAA+E;IAC/E,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC;CAC7B;AAOD,iEAAiE;AACjE,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CA4JvB"}
|
package/dist/orchestrate.js
CHANGED
|
@@ -197,6 +197,7 @@ export async function orchestrate(options) {
|
|
|
197
197
|
}
|
|
198
198
|
// Stitch the per-component reports into a branch landing page so the published
|
|
199
199
|
// branch has an entry point instead of a wall of machine-named directories.
|
|
200
|
+
let indexEntries;
|
|
200
201
|
if (options.outDir) {
|
|
201
202
|
const entries = results.map((r) => {
|
|
202
203
|
const thumbnail = r.candidate
|
|
@@ -215,8 +216,16 @@ export async function orchestrate(options) {
|
|
|
215
216
|
await mkdir(options.outDir, { recursive: true });
|
|
216
217
|
await writeFile(join(options.outDir, "README.md"), readme);
|
|
217
218
|
await writeFile(join(options.outDir, "index.html"), html);
|
|
219
|
+
indexEntries = entries;
|
|
218
220
|
}
|
|
219
221
|
const blocked = directionPolicy(options.direction).blocksPr && status === "fail";
|
|
220
|
-
return {
|
|
222
|
+
return {
|
|
223
|
+
status,
|
|
224
|
+
blocked,
|
|
225
|
+
direction: options.direction,
|
|
226
|
+
results,
|
|
227
|
+
warnings,
|
|
228
|
+
...(indexEntries ? { indexEntries } : {}),
|
|
229
|
+
};
|
|
221
230
|
}
|
|
222
231
|
//# sourceMapp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O,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAC;QAC3D,MAAM,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;QAC1D,YAAY,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,IAAI,MAAM,KAAK,MAAM,CAAC;IACjF,OAAO;QACL,MAAM;QACN,OAAO;QACP,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,OAAO;QACP,QAAQ;QACR,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,CAAC;AACJ,CAAC"}
|
package/dist/shard.d.ts
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sharding: splitting one parity run across N parallel jobs, and putting the
|
|
3
|
+
* pieces back together.
|
|
4
|
+
*
|
|
5
|
+
* The problem this exists for. A parity run costs roughly
|
|
6
|
+
* `fixed + per_component × components` — the fixed part is the candidate render's
|
|
7
|
+
* Gradle configure + compile plus the Node install, and the marginal part is one
|
|
8
|
+
* reference fetch + diff per component. Past a few hundred components the
|
|
9
|
+
* marginal part dominates and a single job walks into its own timeout. The
|
|
10
|
+
* observed workaround has been to shrink the *input* — compare only the mapped
|
|
11
|
+
* components, exclude the rest from the render (yschimke/m3-catalog#11) — which
|
|
12
|
+
* buys time by giving up coverage, and has to be re-tuned by hand in the
|
|
13
|
+
* consumer's workflow every time the catalog grows.
|
|
14
|
+
*
|
|
15
|
+
* Sharding buys the same time without giving up coverage: every shard compares a
|
|
16
|
+
* disjoint slice of the SAME exhaustive component list, and {@link mergeShards}
|
|
17
|
+
* unions the per-shard outputs into the artifact set one serial run would have
|
|
18
|
+
* produced. Only the marginal cost divides — each shard pays the fixed cost in
|
|
19
|
+
* full — so a handful of shards is the useful range and a large fleet is buying
|
|
20
|
+
* setup time, not throughput. See `docs/PARALLEL_PARITY.md`.
|
|
21
|
+
*
|
|
22
|
+
* Everything here is pure: partitioning is arithmetic over a sorted list, and
|
|
23
|
+
* merging is object/array algebra. Only the CLI touches disk.
|
|
24
|
+
*/
|
|
25
|
+
import type { IndexEntry } from "@design-parity/report-html";
|
|
26
|
+
import type { ResolvedDirection, VerdictStatus } from "@design-parity/core";
|
|
27
|
+
/**
|
|
28
|
+
* The `shard.json` layout version, written by a sharded `run` and checked by
|
|
29
|
+
* `merge`. Bumped only on an incompatible change; a reader ignores unknown
|
|
30
|
+
* fields. The merge runs LAST — after every shard has spent its full budget —
|
|
31
|
+
* so it validates loudly rather than silently producing a partial index.
|
|
32
|
+
*/
|
|
33
|
+
export declare const SHARD_FORMAT_VERSION = 1;
|
|
34
|
+
/** One shard's declaration of what it was responsible for and what it produced. */
|
|
35
|
+
export interface ShardReport {
|
|
36
|
+
formatVersion: number;
|
|
37
|
+
/** 1-based shard index. */
|
|
38
|
+
index: number;
|
|
39
|
+
/** Total shards in the run — identical across every shard of one run. */
|
|
40
|
+
total: number;
|
|
41
|
+
/**
|
|
42
|
+
* The component handles this shard was assigned, in the order it ran them.
|
|
43
|
+
* Cross-checked against its siblings by {@link verifyShardReports}: the union
|
|
44
|
+
* must cover the whole list exactly once.
|
|
45
|
+
*/
|
|
46
|
+
components: string[];
|
|
47
|
+
direction: ResolvedDirection;
|
|
48
|
+
status: VerdictStatus;
|
|
49
|
+
blocked: boolean;
|
|
50
|
+
warnings: string[];
|
|
51
|
+
/**
|
|
52
|
+
* The landing-page rows this shard's components produced, carrying their
|
|
53
|
+
* `reportPath` (relative to the shard's out dir, which merge preserves) and
|
|
54
|
+
* inlined thumbnail. Merge unions these rather than re-deriving them, so the
|
|
55
|
+
* merged index is byte-identical to the serial one for the same inputs.
|
|
56
|
+
*/
|
|
57
|
+
entries: IndexEntry[];
|
|
58
|
+
}
|
|
59
|
+
/** A shard selection, as parsed from `--shard <index>/<total>`. */
|
|
60
|
+
export interface ShardSelector {
|
|
61
|
+
index: number;
|
|
62
|
+
total: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Parse `--shard 2/6` (also accepts `2:6`). Returns `undefined` for input that
|
|
66
|
+
* isn't a shard selector at all; throws for a selector that is malformed or out
|
|
67
|
+
* of range, because a typo'd shard silently comparing everything (or nothing) is
|
|
68
|
+
* worse than a failed run.
|
|
69
|
+
*/
|
|
70
|
+
export declare function parseShard(value: string | undefined): ShardSelector | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* This shard's slice of `components`.
|
|
73
|
+
*
|
|
74
|
+
* Sort, then round-robin: shard `i` of `n` takes every element at position
|
|
75
|
+
* `p` where `p % n === i - 1`. Deterministic from the component list alone, so
|
|
76
|
+
* every shard derives the same partition independently — there is no serial
|
|
77
|
+
* "plan once, then fan out" prefix, which would cost a full setup before any
|
|
78
|
+
* shard began.
|
|
79
|
+
*
|
|
80
|
+
* Round-robin, not contiguous blocks, because component ids sort by path and a
|
|
81
|
+
* contiguous block is therefore one directory: the slowest components (a screen
|
|
82
|
+
* with many variants) cluster, and the block holding them becomes the straggler
|
|
83
|
+
* every run. Interleaving spreads them.
|
|
84
|
+
*
|
|
85
|
+
* With more shards than components the tail shards get an empty slice. That is a
|
|
86
|
+
* legitimate no-op, not an error — the caller skips the run rather than failing.
|
|
87
|
+
*/
|
|
88
|
+
export declare function partitionComponents(components: readonly string[], { index, total }: ShardSelector): string[];
|
|
89
|
+
/**
|
|
90
|
+
* Cross-check the shard reports BEFORE trusting them.
|
|
91
|
+
*
|
|
92
|
+
* Each shard derived its partition independently from the same list, so they
|
|
93
|
+
* agree by construction. If they ever don't — a shard checked out a different
|
|
94
|
+
* commit, a `--shard` typo, a lost upload — the symptom downstream is a merged
|
|
95
|
+
* index quietly missing components, with nothing pointing at the shards. So the
|
|
96
|
+
* disagreement is caught here, where it can name itself.
|
|
97
|
+
*
|
|
98
|
+
* Returns the problems found (empty when sound) rather than throwing, so a
|
|
99
|
+
* caller can report all of them at once.
|
|
100
|
+
*/
|
|
101
|
+
export declare function verifyShardReports(reports: readonly ShardReport[]): string[];
|
|
102
|
+
/** The union of a run's shards: what a single serial run would have produced. */
|
|
103
|
+
export interface MergedShards {
|
|
104
|
+
direction: ResolvedDirection;
|
|
105
|
+
status: VerdictStatus;
|
|
106
|
+
blocked: boolean;
|
|
107
|
+
warnings: string[];
|
|
108
|
+
/** Landing-page rows across every shard, in component order. */
|
|
109
|
+
entries: IndexEntry[];
|
|
110
|
+
/** Total shards declared, for the merge log. */
|
|
111
|
+
total: number;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Union the shard reports into one.
|
|
115
|
+
*
|
|
116
|
+
* Status is the worst across shards and `blocked` is the OR — a failure in any
|
|
117
|
+
* slice is a failure of the run, exactly as it would be serially. Entries are
|
|
118
|
+
* re-sorted by component handle so the merged index has one stable order
|
|
119
|
+
* regardless of which shard finished first (shards run concurrently; artifact
|
|
120
|
+
* download order is not a contract). Warnings are concatenated in shard order
|
|
121
|
+
* and de-duplicated: a warning about a shared input (a bad `tokensFile`, a
|
|
122
|
+
* design-map issue) is emitted by every shard that loaded it, and a landing page
|
|
123
|
+
* listing it six times is noise, not information.
|
|
124
|
+
*
|
|
125
|
+
* Direction comes from the shards, which must agree — they read the same
|
|
126
|
+
* committed `.design-parity.json`, so a disagreement means they ran against
|
|
127
|
+
* different commits and the merged verdict would be meaningless.
|
|
128
|
+
*/
|
|
129
|
+
export declare function mergeShards(reports: readonly ShardReport[]): MergedShards;
|
|
130
|
+
//# sourceMappingURL=shard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shard.d.ts","sourceRoot":"","sources":["../src/shard.ts"],"names":[],"mappings":"AAA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AQ,EAAE,MAAM,EAAE,CAAC;IACnB,gEAAgE;IAChE,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAC;CACf;AAOD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,YAAY,CAuCzE"}
|
package/dist/shard.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `shard.json` layout version, written by a sharded `run` and checked by
|
|
3
|
+
* `merge`. Bumped only on an incompatible change; a reader ignores unknown
|
|
4
|
+
* fields. The merge runs LAST — after every shard has spent its full budget —
|
|
5
|
+
* so it validates loudly rather than silently producing a partial index.
|
|
6
|
+
*/
|
|
7
|
+
export const SHARD_FORMAT_VERSION = 1;
|
|
8
|
+
/**
|
|
9
|
+
* Parse `--shard 2/6` (also accepts `2:6`). Returns `undefined` for input that
|
|
10
|
+
* isn't a shard selector at all; throws for a selector that is malformed or out
|
|
11
|
+
* of range, because a typo'd shard silently comparing everything (or nothing) is
|
|
12
|
+
* worse than a failed run.
|
|
13
|
+
*/
|
|
14
|
+
export function parseShard(value) {
|
|
15
|
+
if (!value)
|
|
16
|
+
return undefined;
|
|
17
|
+
const m = /^(\d+)\s*[/:]\s*(\d+)$/.exec(value.trim());
|
|
18
|
+
if (!m)
|
|
19
|
+
throw new Error(`--shard expects <index>/<total>, got '${value}'`);
|
|
20
|
+
const index = Number(m[1]);
|
|
21
|
+
const total = Number(m[2]);
|
|
22
|
+
if (total < 1)
|
|
23
|
+
throw new Error(`--shard total must be >= 1, got ${total}`);
|
|
24
|
+
if (index < 1 || index > total) {
|
|
25
|
+
throw new Error(`--shard index ${index} is outside 1..${total}`);
|
|
26
|
+
}
|
|
27
|
+
return { index, total };
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* This shard's slice of `components`.
|
|
31
|
+
*
|
|
32
|
+
* Sort, then round-robin: shard `i` of `n` takes every element at position
|
|
33
|
+
* `p` where `p % n === i - 1`. Deterministic from the component list alone, so
|
|
34
|
+
* every shard derives the same partition independently — there is no serial
|
|
35
|
+
* "plan once, then fan out" prefix, which would cost a full setup before any
|
|
36
|
+
* shard began.
|
|
37
|
+
*
|
|
38
|
+
* Round-robin, not contiguous blocks, because component ids sort by path and a
|
|
39
|
+
* contiguous block is therefore one directory: the slowest components (a screen
|
|
40
|
+
* with many variants) cluster, and the block holding them becomes the straggler
|
|
41
|
+
* every run. Interleaving spreads them.
|
|
42
|
+
*
|
|
43
|
+
* With more shards than components the tail shards get an empty slice. That is a
|
|
44
|
+
* legitimate no-op, not an error — the caller skips the run rather than failing.
|
|
45
|
+
*/
|
|
46
|
+
export function partitionComponents(components, { index, total }) {
|
|
47
|
+
const sorted = [...new Set(components)].sort();
|
|
48
|
+
return sorted.filter((_, position) => position % total === index - 1);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Cross-check the shard reports BEFORE trusting them.
|
|
52
|
+
*
|
|
53
|
+
* Each shard derived its partition independently from the same list, so they
|
|
54
|
+
* agree by construction. If they ever don't — a shard checked out a different
|
|
55
|
+
* commit, a `--shard` typo, a lost upload — the symptom downstream is a merged
|
|
56
|
+
* index quietly missing components, with nothing pointing at the shards. So the
|
|
57
|
+
* disagreement is caught here, where it can name itself.
|
|
58
|
+
*
|
|
59
|
+
* Returns the problems found (empty when sound) rather than throwing, so a
|
|
60
|
+
* caller can report all of them at once.
|
|
61
|
+
*/
|
|
62
|
+
export function verifyShardReports(reports) {
|
|
63
|
+
const problems = [];
|
|
64
|
+
if (reports.length === 0)
|
|
65
|
+
return ["no shard reports were supplied"];
|
|
66
|
+
for (const r of reports) {
|
|
67
|
+
if (r.formatVersion !== SHARD_FORMAT_VERSION) {
|
|
68
|
+
problems.push(`shard ${r.index}: shard.json formatVersion ${r.formatVersion} is not the ` +
|
|
69
|
+
`${SHARD_FORMAT_VERSION} this merge understands — align the design-parity ` +
|
|
70
|
+
`version used by the shard and merge steps`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const totals = new Set(reports.map((r) => r.total));
|
|
74
|
+
if (totals.size > 1) {
|
|
75
|
+
problems.push(`shards disagree on the run size: saw totals ${[...totals].sort((a, b) => a - b).join(", ")}`);
|
|
76
|
+
}
|
|
77
|
+
const seen = new Map();
|
|
78
|
+
for (const r of reports)
|
|
79
|
+
seen.set(r.index, (seen.get(r.index) ?? 0) + 1);
|
|
80
|
+
for (const [index, count] of seen) {
|
|
81
|
+
if (count > 1)
|
|
82
|
+
problems.push(`shard ${index} was supplied ${count} times`);
|
|
83
|
+
}
|
|
84
|
+
// A missing shard is the failure mode that matters most: its components would
|
|
85
|
+
// simply be absent from the merged index, which reads as "clean" rather than
|
|
86
|
+
// "not checked".
|
|
87
|
+
const total = reports[0]?.total ?? 0;
|
|
88
|
+
if (totals.size === 1) {
|
|
89
|
+
const missing = [];
|
|
90
|
+
for (let i = 1; i <= total; i++)
|
|
91
|
+
if (!seen.has(i))
|
|
92
|
+
missing.push(i);
|
|
93
|
+
if (missing.length > 0) {
|
|
94
|
+
problems.push(`shard(s) ${missing.join(", ")} of ${total} did not report`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const owner = new Map();
|
|
98
|
+
for (const r of reports) {
|
|
99
|
+
for (const code of r.components) {
|
|
100
|
+
const prior = owner.get(code);
|
|
101
|
+
if (prior !== undefined) {
|
|
102
|
+
problems.push(`component '${code}' was claimed by shards ${prior} and ${r.index}`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
owner.set(code, r.index);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return problems;
|
|
109
|
+
}
|
|
110
|
+
function worst(a, b) {
|
|
111
|
+
const rank = { pass: 0, warn: 1, fail: 2 };
|
|
112
|
+
return rank[a] >= rank[b] ? a : b;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Union the shard reports into one.
|
|
116
|
+
*
|
|
117
|
+
* Status is the worst across shards and `blocked` is the OR — a failure in any
|
|
118
|
+
* slice is a failure of the run, exactly as it would be serially. Entries are
|
|
119
|
+
* re-sorted by component handle so the merged index has one stable order
|
|
120
|
+
* regardless of which shard finished first (shards run concurrently; artifact
|
|
121
|
+
* download order is not a contract). Warnings are concatenated in shard order
|
|
122
|
+
* and de-duplicated: a warning about a shared input (a bad `tokensFile`, a
|
|
123
|
+
* design-map issue) is emitted by every shard that loaded it, and a landing page
|
|
124
|
+
* listing it six times is noise, not information.
|
|
125
|
+
*
|
|
126
|
+
* Direction comes from the shards, which must agree — they read the same
|
|
127
|
+
* committed `.design-parity.json`, so a disagreement means they ran against
|
|
128
|
+
* different commits and the merged verdict would be meaningless.
|
|
129
|
+
*/
|
|
130
|
+
export function mergeShards(reports) {
|
|
131
|
+
if (reports.length === 0)
|
|
132
|
+
throw new Error("nothing to merge: no shard reports");
|
|
133
|
+
const directions = new Set(reports.map((r) => r.direction));
|
|
134
|
+
if (directions.size > 1) {
|
|
135
|
+
throw new Error(`shards disagree on the parity direction (${[...directions].join(", ")}) — ` +
|
|
136
|
+
`they did not run against the same commit`);
|
|
137
|
+
}
|
|
138
|
+
const ordered = [...reports].sort((a, b) => a.index - b.index);
|
|
139
|
+
const warnings = [];
|
|
140
|
+
const seenWarning = new Set();
|
|
141
|
+
let status = "pass";
|
|
142
|
+
let blocked = false;
|
|
143
|
+
const entries = [];
|
|
144
|
+
for (const r of ordered) {
|
|
145
|
+
status = worst(status, r.status);
|
|
146
|
+
blocked ||= r.blocked;
|
|
147
|
+
entries.push(...r.entries);
|
|
148
|
+
for (const w of r.warnings) {
|
|
149
|
+
if (seenWarning.has(w))
|
|
150
|
+
continue;
|
|
151
|
+
seenWarning.add(w);
|
|
152
|
+
warnings.push(w);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
entries.sort((a, b) => a.code.localeCompare(b.code));
|
|
156
|
+
return {
|
|
157
|
+
direction: ordered[0].direction,
|
|
158
|
+
status,
|
|
159
|
+
blocked,
|
|
160
|
+
warnings,
|
|
161
|
+
entries,
|
|
162
|
+
total: ordered[0].total,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=shard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shard.js","sourceRoot":"","sources":["../src/shard.ts"],"names":[],"mappings":"AA2BA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAkCtC;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,KAAyB;IAClD,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,CAAC,GAAG,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACtD,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,GAAG,CAAC,CAAC;IAC3E,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,KAAK,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,KAAK,EAAE,CAAC,CAAC;IAC3E,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,KAAK,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,iBAAiB,KAAK,kBAAkB,KAAK,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAA6B,EAC7B,EAAE,KAAK,EAAE,KAAK,EAAiB;IAE/B,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAA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,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;QACjC,OAAO,KAAK,CAAC,CAAC,OAAO,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;QAC3B,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;YAC3B,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;gBAAE,SAAS;YACjC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACnB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAErD,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,CAAC,CAAE,CAAC,SAAS;QAChC,MAAM;QACN,OAAO;QACP,QAAQ;QACR,OAAO;QACP,KAAK,EAAE,OAAO,CAAC,CAAC,CAAE,CAAC,KAAK;KACzB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@design-parity/action",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.39",
|
|
4
4
|
"description": "Integration layer: wires resolver, adapters, candidate, checks, diff, and policy into a parity run, and surfaces the verdict (CLI now; GitHub Action surface to follow).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": "./dist/index.js",
|
|
11
11
|
"./run": "./dist/cli/run.js",
|
|
12
|
+
"./merge": "./dist/cli/merge.js",
|
|
13
|
+
"./shard": "./dist/cli/shard-cli.js",
|
|
12
14
|
"./reverse": "./dist/cli/reverse.js",
|
|
13
15
|
"./schema/verdict.schema.json": "./schema/verdict.schema.json"
|
|
14
16
|
},
|
|
@@ -22,17 +24,17 @@
|
|
|
22
24
|
},
|
|
23
25
|
"dependencies": {
|
|
24
26
|
"ajv": "^8.17.1",
|
|
25
|
-
"@design-parity/core": "^0.1.
|
|
26
|
-
"@design-parity/resolver": "^0.1.
|
|
27
|
-
"@design-parity/policy": "^0.1.
|
|
28
|
-
"@design-parity/diff": "^0.1.
|
|
29
|
-
"@design-parity/report-html": "^0.1.
|
|
30
|
-
"@design-parity/checks": "^0.1.
|
|
31
|
-
"@design-parity/candidate": "^0.1.
|
|
32
|
-
"@design-parity/adapter-figma": "^0.1.
|
|
33
|
-
"@design-parity/adapter-stitch": "^0.1.
|
|
34
|
-
"@design-parity/adapter-claude-design": "^0.1.
|
|
35
|
-
"@design-parity/adapter-bundle": "^0.1.
|
|
27
|
+
"@design-parity/core": "^0.1.39",
|
|
28
|
+
"@design-parity/resolver": "^0.1.39",
|
|
29
|
+
"@design-parity/policy": "^0.1.39",
|
|
30
|
+
"@design-parity/diff": "^0.1.39",
|
|
31
|
+
"@design-parity/report-html": "^0.1.39",
|
|
32
|
+
"@design-parity/checks": "^0.1.39",
|
|
33
|
+
"@design-parity/candidate": "^0.1.39",
|
|
34
|
+
"@design-parity/adapter-figma": "^0.1.39",
|
|
35
|
+
"@design-parity/adapter-stitch": "^0.1.39",
|
|
36
|
+
"@design-parity/adapter-claude-design": "^0.1.39",
|
|
37
|
+
"@design-parity/adapter-bundle": "^0.1.39"
|
|
36
38
|
},
|
|
37
39
|
"repository": {
|
|
38
40
|
"type": "git",
|