@design-parity/action 0.1.40 → 0.1.42
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/cache.d.ts +40 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +74 -0
- package/dist/cache.js.map +1 -0
- package/dist/cli/cache-cli.d.ts +10 -0
- package/dist/cli/cache-cli.d.ts.map +1 -0
- package/dist/cli/cache-cli.js +80 -0
- package/dist/cli/cache-cli.js.map +1 -0
- package/dist/cli/merge.d.ts +2 -0
- package/dist/cli/merge.d.ts.map +1 -1
- package/dist/cli/merge.js +49 -4
- package/dist/cli/merge.js.map +1 -1
- package/dist/orchestrate.d.ts.map +1 -1
- package/dist/orchestrate.js +24 -0
- package/dist/orchestrate.js.map +1 -1
- package/dist/run-manifest.d.ts +41 -0
- package/dist/run-manifest.d.ts.map +1 -0
- package/dist/run-manifest.js +67 -0
- package/dist/run-manifest.js.map +1 -0
- package/package.json +14 -13
package/dist/cache.d.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RunManifest } from "./run-manifest.js";
|
|
2
|
+
/**
|
|
3
|
+
* A stable digest of the named inputs.
|
|
4
|
+
*
|
|
5
|
+
* Order-independent (the parts are sorted) and self-delimiting (lengths are
|
|
6
|
+
* encoded), so `{a: "b:c"}` and `{"a:b": "c"}` cannot collide into the same
|
|
7
|
+
* key and a caller reordering its parts does not invalidate every cache.
|
|
8
|
+
*/
|
|
9
|
+
export declare function computeCacheKey(parts: Readonly<Record<string, string>>): string;
|
|
10
|
+
export interface SkipDecision {
|
|
11
|
+
skip: boolean;
|
|
12
|
+
/** Why, in one clause — printed by the CLI and surfaced in the job log. */
|
|
13
|
+
reason: string;
|
|
14
|
+
/** The stored verdict, when skipping: a run that skips still applies it. */
|
|
15
|
+
blocked?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SkipInputs {
|
|
18
|
+
previous: RunManifest | undefined;
|
|
19
|
+
key: string;
|
|
20
|
+
/** Refresh regardless — a scheduled sweep, or a human overriding. */
|
|
21
|
+
force?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Whether this run can stand on the published board instead of rebuilding it.
|
|
25
|
+
*
|
|
26
|
+
* Every "no" is deliberate:
|
|
27
|
+
*
|
|
28
|
+
* - **No previous board, or no key stored on it.** Nothing to stand on.
|
|
29
|
+
* - **A different key.** Something in the inputs moved.
|
|
30
|
+
* - **`force`.** Inputs that are not in the key — the runner image, fonts, a
|
|
31
|
+
* renderer's own transitive deps — can still drift, so a caller must always
|
|
32
|
+
* be able to say "ignore all this and look again". A scheduled unconditional
|
|
33
|
+
* run is the intended companion to caching, not an optional extra.
|
|
34
|
+
* - **A partial previous board.** If any row was carried forward rather than
|
|
35
|
+
* refreshed, it is stale BY CONSTRUCTION, and skipping would preserve it
|
|
36
|
+
* untouched for as long as the inputs hold still. A partial board is exactly
|
|
37
|
+
* the state that most needs another attempt.
|
|
38
|
+
*/
|
|
39
|
+
export declare function decideSkip({ previous, key, force }: SkipInputs): SkipDecision;
|
|
40
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAO/E;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,2EAA2E;IAC3E,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,WAAW,GAAG,SAAS,CAAC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,UAAU,GAAG,YAAY,CAqB7E"}
|
package/dist/cache.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deciding that a run would produce the board that is already published.
|
|
3
|
+
*
|
|
4
|
+
* A parity run is a pure function of a handful of inputs: the code being
|
|
5
|
+
* rendered, the renderer, the references, the map joining them, the policy, and
|
|
6
|
+
* the tool itself. When none of those moved, the comparison cannot have moved
|
|
7
|
+
* either — and re-deriving it costs a full render plus a reference fetch to
|
|
8
|
+
* arrive back where the branch already is.
|
|
9
|
+
*
|
|
10
|
+
* This module is only the arithmetic: hash the ingredients, compare against
|
|
11
|
+
* what the last run recorded. WHICH ingredients belong in the hash is the
|
|
12
|
+
* caller's business, because they are environment-shaped (a git tree hash, a
|
|
13
|
+
* pinned renderer version, a Figma file version, the runner image). Keeping
|
|
14
|
+
* that out here is deliberate: this stays testable, and a caller that forgets
|
|
15
|
+
* an ingredient gets a stale skip rather than a mysterious one — which is why
|
|
16
|
+
* {@link decideSkip} refuses in every case it is not certain about.
|
|
17
|
+
*/
|
|
18
|
+
import { createHash } from "node:crypto";
|
|
19
|
+
/**
|
|
20
|
+
* A stable digest of the named inputs.
|
|
21
|
+
*
|
|
22
|
+
* Order-independent (the parts are sorted) and self-delimiting (lengths are
|
|
23
|
+
* encoded), so `{a: "b:c"}` and `{"a:b": "c"}` cannot collide into the same
|
|
24
|
+
* key and a caller reordering its parts does not invalidate every cache.
|
|
25
|
+
*/
|
|
26
|
+
export function computeCacheKey(parts) {
|
|
27
|
+
const h = createHash("sha256");
|
|
28
|
+
for (const name of Object.keys(parts).sort()) {
|
|
29
|
+
const value = parts[name] ?? "";
|
|
30
|
+
h.update(`${name.length}:${name}=${value.length}:${value}\n`);
|
|
31
|
+
}
|
|
32
|
+
return h.digest("hex");
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Whether this run can stand on the published board instead of rebuilding it.
|
|
36
|
+
*
|
|
37
|
+
* Every "no" is deliberate:
|
|
38
|
+
*
|
|
39
|
+
* - **No previous board, or no key stored on it.** Nothing to stand on.
|
|
40
|
+
* - **A different key.** Something in the inputs moved.
|
|
41
|
+
* - **`force`.** Inputs that are not in the key — the runner image, fonts, a
|
|
42
|
+
* renderer's own transitive deps — can still drift, so a caller must always
|
|
43
|
+
* be able to say "ignore all this and look again". A scheduled unconditional
|
|
44
|
+
* run is the intended companion to caching, not an optional extra.
|
|
45
|
+
* - **A partial previous board.** If any row was carried forward rather than
|
|
46
|
+
* refreshed, it is stale BY CONSTRUCTION, and skipping would preserve it
|
|
47
|
+
* untouched for as long as the inputs hold still. A partial board is exactly
|
|
48
|
+
* the state that most needs another attempt.
|
|
49
|
+
*/
|
|
50
|
+
export function decideSkip({ previous, key, force }) {
|
|
51
|
+
if (force)
|
|
52
|
+
return { skip: false, reason: "forced" };
|
|
53
|
+
if (!previous)
|
|
54
|
+
return { skip: false, reason: "no previous run to build on" };
|
|
55
|
+
if (!previous.cacheKey) {
|
|
56
|
+
return { skip: false, reason: "the previous run recorded no cache key" };
|
|
57
|
+
}
|
|
58
|
+
if (previous.cacheKey !== key) {
|
|
59
|
+
return { skip: false, reason: "inputs changed since the previous run" };
|
|
60
|
+
}
|
|
61
|
+
const carried = previous.entries.filter((e) => e.carriedFrom).length;
|
|
62
|
+
if (carried > 0) {
|
|
63
|
+
return {
|
|
64
|
+
skip: false,
|
|
65
|
+
reason: `the previous board is partial (${carried} row(s) carried forward)`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
skip: true,
|
|
70
|
+
reason: "inputs unchanged since the previous run",
|
|
71
|
+
blocked: previous.blocked,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
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CAAC;IAC1E,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;IACrE,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO;YACL,IAAI,EAAE,KAAK;YACX,MAAM,EAAE,kCAAkC,OAAO,0BAA0B;SAC5E,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,yCAAyC;QACjD,OAAO,EAAE,QAAQ,CAAC,OAAO;KAC1B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface Args {
|
|
3
|
+
parts: Record<string, string>;
|
|
4
|
+
previousDir?: string;
|
|
5
|
+
force: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseArgs(args: string[]): Args;
|
|
8
|
+
export declare function main(rawArgs?: string[]): Promise<number>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cache-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-cli.d.ts","sourceRoot":"","sources":["../../src/cli/cache-cli.ts"],"names":[],"mappings":";AA2BA,UAAU,IAAI;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CA8B9C;AAED,wBAAsB,IAAI,CAAC,OAAO,GAAE,MAAM,EAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoB7E"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `design-parity cache` — would this run reproduce the published board?
|
|
4
|
+
*
|
|
5
|
+
* design-parity cache --previous previous \
|
|
6
|
+
* --part repo=<tree-sha> --part figma=<file-version> \
|
|
7
|
+
* --part renderer=0.19.45 --part tool=0.1.41 [--force]
|
|
8
|
+
*
|
|
9
|
+
* Prints `key=`, `skip=`, `reason=` and, when skipping, `blocked=` — one
|
|
10
|
+
* `name=value` per line, which is both readable in a log and appendable to
|
|
11
|
+
* `$GITHUB_OUTPUT` verbatim.
|
|
12
|
+
*
|
|
13
|
+
* The caller supplies the ingredients. What identifies "the same run" is
|
|
14
|
+
* environment-shaped — a git tree hash here, a pinned renderer there, the
|
|
15
|
+
* runner image on top — and a CLI guessing at it would either miss one (a
|
|
16
|
+
* stale skip) or hash the world (never skipping). See `../cache.ts`.
|
|
17
|
+
*
|
|
18
|
+
* Exit code is 0 whether or not the run can be skipped: the answer is on
|
|
19
|
+
* stdout, and a non-zero code would read as "the check failed".
|
|
20
|
+
*/
|
|
21
|
+
import { argv, cwd, exit, stdout } from "node:process";
|
|
22
|
+
import { resolve as resolvePath } from "node:path";
|
|
23
|
+
import { pathToFileURL } from "node:url";
|
|
24
|
+
import { computeCacheKey, decideSkip } from "../cache.js";
|
|
25
|
+
import { readRunManifest } from "../run-manifest.js";
|
|
26
|
+
export function parseArgs(args) {
|
|
27
|
+
const out = { parts: {}, force: false };
|
|
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 "cache":
|
|
33
|
+
break;
|
|
34
|
+
case "--previous":
|
|
35
|
+
out.previousDir = next();
|
|
36
|
+
break;
|
|
37
|
+
case "--force":
|
|
38
|
+
out.force = true;
|
|
39
|
+
break;
|
|
40
|
+
case "--part": {
|
|
41
|
+
const raw = next() ?? "";
|
|
42
|
+
const eq = raw.indexOf("=");
|
|
43
|
+
// No `=` means a name with an empty value, not a parse error: an
|
|
44
|
+
// ingredient a caller could not resolve (an unset version, a missing
|
|
45
|
+
// file) still has to be IN the key, or its absence is invisible and two
|
|
46
|
+
// materially different runs hash the same.
|
|
47
|
+
if (eq < 0)
|
|
48
|
+
out.parts[raw] = "";
|
|
49
|
+
else
|
|
50
|
+
out.parts[raw.slice(0, eq)] = raw.slice(eq + 1);
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
default:
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
export async function main(rawArgs = argv.slice(2)) {
|
|
60
|
+
const args = parseArgs(rawArgs);
|
|
61
|
+
if (Object.keys(args.parts).length === 0) {
|
|
62
|
+
stdout.write("design-parity cache --part <name>=<value>... [--previous <dir>] [--force]\n");
|
|
63
|
+
return 2;
|
|
64
|
+
}
|
|
65
|
+
const key = computeCacheKey(args.parts);
|
|
66
|
+
const previous = args.previousDir
|
|
67
|
+
? await readRunManifest(resolvePath(cwd(), args.previousDir))
|
|
68
|
+
: undefined;
|
|
69
|
+
const decision = decideSkip({ previous, key, force: args.force });
|
|
70
|
+
stdout.write(`key=${key}\n`);
|
|
71
|
+
stdout.write(`skip=${decision.skip}\n`);
|
|
72
|
+
stdout.write(`reason=${decision.reason}\n`);
|
|
73
|
+
if (decision.skip)
|
|
74
|
+
stdout.write(`blocked=${decision.blocked === true}\n`);
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
if (import.meta.url === pathToFileURL(argv[1] ?? "").href) {
|
|
78
|
+
exit(await main());
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=cache-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-cli.js","sourceRoot":"","sources":["../../src/cli/cache-cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACvD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CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC1D,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/cli/merge.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ interface Args {
|
|
|
7
7
|
branch?: string;
|
|
8
8
|
sourceCommit?: string;
|
|
9
9
|
bundleImage?: string;
|
|
10
|
+
previousDir?: string;
|
|
11
|
+
cacheKey?: string;
|
|
10
12
|
}
|
|
11
13
|
export declare function parseArgs(args: string[]): Args;
|
|
12
14
|
/** Read one shard's declaration, failing with the path when it isn't one. */
|
package/dist/cli/merge.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../src/cli/merge.ts"],"names":[],"mappings":";AA0BA,OAAO,EAAmC,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAQhF,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;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAmC9C;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,CAqG7E"}
|
package/dist/cli/merge.js
CHANGED
|
@@ -23,6 +23,7 @@ import { basename, dirname, join, resolve as resolvePath } from "node:path";
|
|
|
23
23
|
import { pathToFileURL } from "node:url";
|
|
24
24
|
import { renderIndex } from "@design-parity/report-html";
|
|
25
25
|
import { mergeShards, verifyShardReports } from "../shard.js";
|
|
26
|
+
import { RUN_MANIFEST_VERSION, carryForward, readRunManifest, writeRunManifest, } from "../run-manifest.js";
|
|
26
27
|
export function parseArgs(args) {
|
|
27
28
|
const out = { shardDirs: [] };
|
|
28
29
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -47,6 +48,12 @@ export function parseArgs(args) {
|
|
|
47
48
|
case "--bundle-image":
|
|
48
49
|
out.bundleImage = next();
|
|
49
50
|
break;
|
|
51
|
+
case "--previous":
|
|
52
|
+
out.previousDir = next();
|
|
53
|
+
break;
|
|
54
|
+
case "--cache-key":
|
|
55
|
+
out.cacheKey = next();
|
|
56
|
+
break;
|
|
50
57
|
default:
|
|
51
58
|
if (a && !a.startsWith("-"))
|
|
52
59
|
out.shardDirs.push(a);
|
|
@@ -111,7 +118,7 @@ export async function main(rawArgs = argv.slice(2)) {
|
|
|
111
118
|
if (args.shardDirs.length === 0 || !args.outDir) {
|
|
112
119
|
stdout.write("design-parity merge <shard-out-dir|shard.json>... --out <dir> " +
|
|
113
120
|
"[--repo-slug owner/repo --branch <branch> --source-commit <sha> " +
|
|
114
|
-
"--bundle-image <file>]\n");
|
|
121
|
+
"--bundle-image <file> --previous <dir> --cache-key <key>]\n");
|
|
115
122
|
return 2;
|
|
116
123
|
}
|
|
117
124
|
const dirs = args.shardDirs.map((p) => resolvePath(cwd(), shardDirOf(p)));
|
|
@@ -133,8 +140,33 @@ export async function main(rawArgs = argv.slice(2)) {
|
|
|
133
140
|
let components = 0;
|
|
134
141
|
for (const dir of dirs)
|
|
135
142
|
components += await copyComponentDirs(dir, outDir);
|
|
143
|
+
// Carry forward what this run did not produce. A reference the run could not
|
|
144
|
+
// read — rate limited, a source briefly unreachable — would otherwise vanish
|
|
145
|
+
// from the branch entirely, because publishing replaces it wholesale: the run
|
|
146
|
+
// would not merely lack a verdict for that component, it would delete the last
|
|
147
|
+
// one anybody had. Rolling the previous rows in makes the board complete and
|
|
148
|
+
// its rows individually dated, which is the honest description of a partial
|
|
149
|
+
// refresh (design-parity#289).
|
|
150
|
+
const previous = args.previousDir
|
|
151
|
+
? await readRunManifest(resolvePath(cwd(), args.previousDir))
|
|
152
|
+
: undefined;
|
|
153
|
+
const carried = carryForward(merged.entries, previous);
|
|
154
|
+
for (const entry of carried) {
|
|
155
|
+
const dir = entry.reportPath?.split("/")[0];
|
|
156
|
+
if (!dir)
|
|
157
|
+
continue;
|
|
158
|
+
await cp(join(resolvePath(cwd(), args.previousDir), dir), join(outDir, dir), { recursive: true }).catch(() => {
|
|
159
|
+
// The row survives without its report dir: a link to a missing page is a
|
|
160
|
+
// smaller loss than dropping the component off the board silently.
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
const entries = [...merged.entries, ...carried].sort((a, b) => a.code.localeCompare(b.code));
|
|
164
|
+
// The verdict covers the union. A blocking finding does not stop being one
|
|
165
|
+
// because this run could not re-measure it, and a run that went green by
|
|
166
|
+
// losing sight of the failure is the exact outcome this is guarding against.
|
|
167
|
+
const blocked = merged.blocked || carried.some((e) => e.status === "fail");
|
|
136
168
|
const { readme, html } = renderIndex({
|
|
137
|
-
entries
|
|
169
|
+
entries,
|
|
138
170
|
...(args.repoSlug ? { repoSlug: args.repoSlug } : {}),
|
|
139
171
|
...(args.branch ? { branch: args.branch } : {}),
|
|
140
172
|
...(args.sourceCommit ? { sourceCommit: args.sourceCommit } : {}),
|
|
@@ -142,15 +174,28 @@ export async function main(rawArgs = argv.slice(2)) {
|
|
|
142
174
|
});
|
|
143
175
|
await writeFile(join(outDir, "README.md"), readme);
|
|
144
176
|
await writeFile(join(outDir, "index.html"), html);
|
|
177
|
+
await writeRunManifest(outDir, {
|
|
178
|
+
formatVersion: RUN_MANIFEST_VERSION,
|
|
179
|
+
...(args.sourceCommit ? { sourceCommit: args.sourceCommit } : {}),
|
|
180
|
+
direction: merged.direction,
|
|
181
|
+
status: merged.status,
|
|
182
|
+
blocked,
|
|
183
|
+
...(args.cacheKey ? { cacheKey: args.cacheKey } : {}),
|
|
184
|
+
entries,
|
|
185
|
+
});
|
|
145
186
|
stdout.write(`Merged ${reports.length}/${merged.total} shard(s): ` +
|
|
146
187
|
`${merged.entries.length} component(s), ${components} report dir(s), ` +
|
|
147
188
|
`${merged.warnings.length} warning(s) → ${outDir}\n` +
|
|
148
|
-
|
|
189
|
+
(carried.length > 0
|
|
190
|
+
? `Carried ${carried.length} component(s) forward from the previous run ` +
|
|
191
|
+
`(not refreshed here) — ${entries.length} on the board.\n`
|
|
192
|
+
: "") +
|
|
193
|
+
`Parity ${merged.status} (${merged.direction})${blocked ? " — blocking" : ""}\n`);
|
|
149
194
|
if (merged.warnings.length > 0) {
|
|
150
195
|
stdout.write(merged.warnings.map((w) => ` ! ${w}`).join("\n") + "\n");
|
|
151
196
|
}
|
|
152
197
|
// Verdict last, artifacts first — see the module header.
|
|
153
|
-
return
|
|
198
|
+
return blocked ? 1 : 0;
|
|
154
199
|
}
|
|
155
200
|
if (import.meta.url === pathToFileURL(argv[1] ?? "").href) {
|
|
156
201
|
exit(await main());
|
package/dist/cli/merge.js.map
CHANGED
|
@@ -1 +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,M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C/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAqLvB"}
|
package/dist/orchestrate.js
CHANGED
|
@@ -103,6 +103,30 @@ export async function orchestrate(options) {
|
|
|
103
103
|
// The output slug chosen for each result, reused when building the index so a
|
|
104
104
|
// row's report link matches the dir the report was written to.
|
|
105
105
|
const slugByResult = new Map();
|
|
106
|
+
// Give each adapter the whole list before resolving any of it. Correspondences
|
|
107
|
+
// are resolved one after another, so an adapter has no other moment at which
|
|
108
|
+
// it can see more than one ref — and for a source with a rate limiter, asking
|
|
109
|
+
// once for fifty nodes rather than fifty times for one is the difference
|
|
110
|
+
// between a complete run and a truncated one. Best-effort: a warm that fails
|
|
111
|
+
// leaves `resolve` to fetch alone.
|
|
112
|
+
const refsByAdapter = new Map();
|
|
113
|
+
for (const corr of options.correspondences) {
|
|
114
|
+
const adapter = options.registry[corr.source];
|
|
115
|
+
if (!adapter?.prefetch)
|
|
116
|
+
continue;
|
|
117
|
+
const refs = refsByAdapter.get(adapter) ?? [];
|
|
118
|
+
refs.push(...(corr.refs ? corr.refs.map((v) => v.ref) : [corr.ref]));
|
|
119
|
+
refsByAdapter.set(adapter, refs);
|
|
120
|
+
}
|
|
121
|
+
for (const [adapter, refs] of refsByAdapter) {
|
|
122
|
+
try {
|
|
123
|
+
await adapter.prefetch?.(refs, ctx);
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
warnings.push(`${adapter.source}: prefetch failed (${err instanceof Error ? err.message : String(err)}) — ` +
|
|
127
|
+
`references will be fetched one at a time`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
106
130
|
for (const corr of options.correspondences) {
|
|
107
131
|
const result = {
|
|
108
132
|
code: corr.code,
|
package/dist/orchestrate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrate.js","sourceRoot":"","sources":["../src/orchestrate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"orchestrate.js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pE,MAAM,KAAK,CAAC,OAAO,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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { IndexEntry } from "@design-parity/report-html";
|
|
2
|
+
import type { ResolvedDirection, VerdictStatus } from "@design-parity/core";
|
|
3
|
+
/** Bumped when a field's meaning changes; an unknown version is ignored, not guessed at. */
|
|
4
|
+
export declare const RUN_MANIFEST_VERSION = 1;
|
|
5
|
+
export declare const RUN_MANIFEST_FILE = "run.json";
|
|
6
|
+
export interface RunManifest {
|
|
7
|
+
formatVersion: number;
|
|
8
|
+
/** The commit the run was made from. Identifies the age of a carried row. */
|
|
9
|
+
sourceCommit?: string;
|
|
10
|
+
direction: ResolvedDirection;
|
|
11
|
+
status: VerdictStatus;
|
|
12
|
+
blocked: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Digest of the inputs this run was derived from, when the caller supplied
|
|
15
|
+
* one. A later run computing the same digest can stand on this board instead
|
|
16
|
+
* of rebuilding it — see `cache.ts`.
|
|
17
|
+
*/
|
|
18
|
+
cacheKey?: string;
|
|
19
|
+
entries: IndexEntry[];
|
|
20
|
+
}
|
|
21
|
+
export declare function writeRunManifest(outDir: string, manifest: RunManifest): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Read a previous run's manifest, or `undefined` when there isn't a usable one.
|
|
24
|
+
*
|
|
25
|
+
* Deliberately forgiving: a missing, unreadable, malformed or
|
|
26
|
+
* newer-than-understood manifest means "no previous run" — carry-forward is an
|
|
27
|
+
* improvement on starting empty, never a reason to fail a run that otherwise
|
|
28
|
+
* has everything it needs.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readRunManifest(dir: string): Promise<RunManifest | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* The rows to carry into this run's board: everything the previous run had that
|
|
33
|
+
* this one did not produce.
|
|
34
|
+
*
|
|
35
|
+
* `carriedFrom` records the commit the row was actually measured at, and is
|
|
36
|
+
* preserved rather than overwritten when a row is carried more than once — so a
|
|
37
|
+
* row that has gone unrefreshed for ten runs still says so, instead of looking
|
|
38
|
+
* one run old forever.
|
|
39
|
+
*/
|
|
40
|
+
export declare function carryForward(fresh: readonly IndexEntry[], previous: RunManifest | undefined): IndexEntry[];
|
|
41
|
+
//# sourceMappingURL=run-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-manifest.d.ts","sourceRoot":"","sources":["../src/run-manifest.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE5E,4FAA4F;AAC5F,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC,CAKf;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAelC;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,QAAQ,EAAE,WAAW,GAAG,SAAS,GAChC,UAAU,EAAE,CAUd"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `run.json` — the machine-readable summary a published run leaves behind, so
|
|
3
|
+
* the next run can build on it instead of starting from nothing.
|
|
4
|
+
*
|
|
5
|
+
* The branch already carries `index.html` and `README.md`, but both are for
|
|
6
|
+
* people: recovering the rows from them means parsing rendered HTML. This is
|
|
7
|
+
* the same information in the form the next merge needs (design-parity#289).
|
|
8
|
+
*/
|
|
9
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
/** Bumped when a field's meaning changes; an unknown version is ignored, not guessed at. */
|
|
12
|
+
export const RUN_MANIFEST_VERSION = 1;
|
|
13
|
+
export const RUN_MANIFEST_FILE = "run.json";
|
|
14
|
+
export async function writeRunManifest(outDir, manifest) {
|
|
15
|
+
await writeFile(join(outDir, RUN_MANIFEST_FILE), `${JSON.stringify(manifest, null, 2)}\n`);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read a previous run's manifest, or `undefined` when there isn't a usable one.
|
|
19
|
+
*
|
|
20
|
+
* Deliberately forgiving: a missing, unreadable, malformed or
|
|
21
|
+
* newer-than-understood manifest means "no previous run" — carry-forward is an
|
|
22
|
+
* improvement on starting empty, never a reason to fail a run that otherwise
|
|
23
|
+
* has everything it needs.
|
|
24
|
+
*/
|
|
25
|
+
export async function readRunManifest(dir) {
|
|
26
|
+
let raw;
|
|
27
|
+
try {
|
|
28
|
+
raw = await readFile(join(dir, RUN_MANIFEST_FILE), "utf8");
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const doc = JSON.parse(raw);
|
|
35
|
+
if (doc.formatVersion !== RUN_MANIFEST_VERSION)
|
|
36
|
+
return undefined;
|
|
37
|
+
if (!Array.isArray(doc.entries))
|
|
38
|
+
return undefined;
|
|
39
|
+
return doc;
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The rows to carry into this run's board: everything the previous run had that
|
|
47
|
+
* this one did not produce.
|
|
48
|
+
*
|
|
49
|
+
* `carriedFrom` records the commit the row was actually measured at, and is
|
|
50
|
+
* preserved rather than overwritten when a row is carried more than once — so a
|
|
51
|
+
* row that has gone unrefreshed for ten runs still says so, instead of looking
|
|
52
|
+
* one run old forever.
|
|
53
|
+
*/
|
|
54
|
+
export function carryForward(fresh, previous) {
|
|
55
|
+
if (!previous)
|
|
56
|
+
return [];
|
|
57
|
+
const have = new Set(fresh.map((e) => e.code));
|
|
58
|
+
const carried = [];
|
|
59
|
+
for (const entry of previous.entries) {
|
|
60
|
+
if (have.has(entry.code))
|
|
61
|
+
continue;
|
|
62
|
+
const from = entry.carriedFrom ?? previous.sourceCommit;
|
|
63
|
+
carried.push({ ...entry, ...(from ? { carriedFrom: from } : {}) });
|
|
64
|
+
}
|
|
65
|
+
return carried;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=run-manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1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AiC;IAEjC,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;YAAE,SAAS;QACnC,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC,YAAY,CAAC;QACxD,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,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.42",
|
|
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",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"./merge": "./dist/cli/merge.js",
|
|
13
13
|
"./shard": "./dist/cli/shard-cli.js",
|
|
14
14
|
"./reverse": "./dist/cli/reverse.js",
|
|
15
|
-
"./schema/verdict.schema.json": "./schema/verdict.schema.json"
|
|
15
|
+
"./schema/verdict.schema.json": "./schema/verdict.schema.json",
|
|
16
|
+
"./cache": "./dist/cli/cache-cli.js"
|
|
16
17
|
},
|
|
17
18
|
"files": [
|
|
18
19
|
"dist",
|
|
@@ -24,17 +25,17 @@
|
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"ajv": "^8.17.1",
|
|
27
|
-
"@design-parity/core": "^0.1.
|
|
28
|
-
"@design-parity/resolver": "^0.1.
|
|
29
|
-
"@design-parity/policy": "^0.1.
|
|
30
|
-
"@design-parity/diff": "^0.1.
|
|
31
|
-
"@design-parity/report-html": "^0.1.
|
|
32
|
-
"@design-parity/checks": "^0.1.
|
|
33
|
-
"@design-parity/candidate": "^0.1.
|
|
34
|
-
"@design-parity/adapter-figma": "^0.1.
|
|
35
|
-
"@design-parity/adapter-stitch": "^0.1.
|
|
36
|
-
"@design-parity/adapter-claude-design": "^0.1.
|
|
37
|
-
"@design-parity/adapter-bundle": "^0.1.
|
|
28
|
+
"@design-parity/core": "^0.1.42",
|
|
29
|
+
"@design-parity/resolver": "^0.1.42",
|
|
30
|
+
"@design-parity/policy": "^0.1.42",
|
|
31
|
+
"@design-parity/diff": "^0.1.42",
|
|
32
|
+
"@design-parity/report-html": "^0.1.42",
|
|
33
|
+
"@design-parity/checks": "^0.1.42",
|
|
34
|
+
"@design-parity/candidate": "^0.1.42",
|
|
35
|
+
"@design-parity/adapter-figma": "^0.1.42",
|
|
36
|
+
"@design-parity/adapter-stitch": "^0.1.42",
|
|
37
|
+
"@design-parity/adapter-claude-design": "^0.1.42",
|
|
38
|
+
"@design-parity/adapter-bundle": "^0.1.42"
|
|
38
39
|
},
|
|
39
40
|
"repository": {
|
|
40
41
|
"type": "git",
|