@design-parity/action 0.1.53 → 0.1.55

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.
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ interface Args {
3
+ dir?: string;
4
+ branch?: string;
5
+ message?: string;
6
+ /**
7
+ * Commit even when the staged tree matches the branch tip. Off by default:
8
+ * an identical board is not a data point, and an empty commit per run would
9
+ * bury the ones that mean something.
10
+ */
11
+ allowUnchanged: boolean;
12
+ }
13
+ export declare function parseArgs(args: string[]): Args;
14
+ export declare function main(rawArgs?: string[]): Promise<number>;
15
+ export {};
16
+ //# sourceMappingURL=publish-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-cli.d.ts","sourceRoot":"","sources":["../../src/cli/publish-cli.ts"],"names":[],"mappings":";AA4BA,UAAU,IAAI;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAyB9C;AAED,wBAAsB,IAAI,CAAC,OAAO,GAAE,MAAM,EAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwC7E"}
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `design-parity publish` — put a staged artifact directory on its branch.
4
+ *
5
+ * design-parity publish --dir out --branch design-parity/main \
6
+ * --message "design-parity artifacts for <sha>" [--allow-unchanged]
7
+ *
8
+ * A thin CLI over {@link publishBaseline}, which re-parents the staged tree on
9
+ * the branch tip (orphan only when the branch does not exist yet) and retries
10
+ * the push when a concurrent run moved it.
11
+ *
12
+ * This exists so the sharded workflow publishes the *same way* baseline mode
13
+ * already does. The reusable workflow used to inline its own `git init` +
14
+ * `push -f`, which replaced the branch with a fresh single-commit orphan on
15
+ * every run — and the board's own README links a per-component History
16
+ * (`commits/<branch>/<component>/report.html`), so it advertised a trend it
17
+ * destroyed each time. One publisher, one history.
18
+ *
19
+ * Reads `GITHUB_TOKEN`, `GITHUB_REPOSITORY` and (optionally) `GITHUB_SERVER_URL`
20
+ * from the environment rather than the command line, so a token never lands in
21
+ * a workflow log or a process listing.
22
+ */
23
+ import { argv, cwd, env, exit, stderr, stdout } from "node:process";
24
+ import { resolve as resolvePath } from "node:path";
25
+ import { pathToFileURL } from "node:url";
26
+ import { publishBaseline } from "../github/publish.js";
27
+ export function parseArgs(args) {
28
+ const out = { allowUnchanged: false };
29
+ for (let i = 0; i < args.length; i++) {
30
+ const a = args[i];
31
+ const next = () => args[(i += 1)];
32
+ switch (a) {
33
+ case "publish":
34
+ break;
35
+ case "--dir":
36
+ out.dir = next();
37
+ break;
38
+ case "--branch":
39
+ out.branch = next();
40
+ break;
41
+ case "--message":
42
+ out.message = next();
43
+ break;
44
+ case "--allow-unchanged":
45
+ out.allowUnchanged = true;
46
+ break;
47
+ default:
48
+ if (a?.startsWith("--"))
49
+ throw new Error(`unknown option: ${a}`);
50
+ }
51
+ }
52
+ return out;
53
+ }
54
+ export async function main(rawArgs = argv.slice(2)) {
55
+ let args;
56
+ try {
57
+ args = parseArgs(rawArgs);
58
+ }
59
+ catch (err) {
60
+ stderr.write(`design-parity publish: ${err.message}\n`);
61
+ return 2;
62
+ }
63
+ if (!args.dir || !args.branch) {
64
+ stderr.write("design-parity publish: --dir and --branch are required\n");
65
+ return 2;
66
+ }
67
+ const token = env["GITHUB_TOKEN"];
68
+ const repo = env["GITHUB_REPOSITORY"];
69
+ if (!token || !repo) {
70
+ stderr.write("design-parity publish: GITHUB_TOKEN and GITHUB_REPOSITORY are required\n");
71
+ return 2;
72
+ }
73
+ const serverUrl = env["GITHUB_SERVER_URL"];
74
+ const result = await publishBaseline({
75
+ sourceDir: resolvePath(cwd(), args.dir),
76
+ branch: args.branch,
77
+ repo,
78
+ token,
79
+ message: args.message ?? `design-parity artifacts${sourceSuffix()}`,
80
+ skipIfUnchanged: !args.allowUnchanged,
81
+ ...(serverUrl ? { serverUrl } : {}),
82
+ });
83
+ stdout.write(result.pushed
84
+ ? `design-parity: published to ${result.branch} (${result.sha?.slice(0, 12)})\n`
85
+ : `design-parity: board unchanged vs ${result.branch} — nothing to publish\n`);
86
+ return 0;
87
+ }
88
+ function sourceSuffix() {
89
+ const sha = env["GITHUB_SHA"];
90
+ return sha ? ` for ${sha}` : "";
91
+ }
92
+ if (import.meta.url === pathToFileURL(argv[1] ?? "").href) {
93
+ exit(await main());
94
+ }
95
+ //# sourceMappingURL=publish-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish-cli.js","sourceRoot":"","sources":["../../src/cli/publish-cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAcvD,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,GAAG,GAAS,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IAC5C,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,GAAuB,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACtD,QAAQ,CAAC,EAAE,CAAC;YACV,KAAK,SAAS;gBACZ,M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AED,MAAM,SAAS,GAAG,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC;QACnC,SAAS,EAAE,WAAW,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC;QACvC,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,IAAI;QACJ,KAAK;QACL,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,0BAA0B,YAAY,EAAE,EAAE;QACnE,eAAe,EAAE,CAAC,IAAI,CAAC,cAAc;QACrC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpC,CAAC,CAAC;IAEH,MAAM,CAAC,KAAK,CACV,MAAM,CAAC,MAAM;QACX,CAAC,CAAC,+BAA+B,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK;QAChF,CAAC,CAAC,qCAAqC,MAAM,CAAC,MAAM,yBAAyB,CAChF,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,YAAY;IACnB,MAAM,GAAG,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;IAC9B,OAAO,GAAG,CAAC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAClC,CAAC;AAED,IAAI,OAAO,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@design-parity/action",
3
- "version": "0.1.53",
3
+ "version": "0.1.55",
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",
@@ -14,7 +14,8 @@
14
14
  "./reverse": "./dist/cli/reverse.js",
15
15
  "./schema/verdict.schema.json": "./schema/verdict.schema.json",
16
16
  "./cache": "./dist/cli/cache-cli.js",
17
- "./import": "./dist/cli/import-cli.js"
17
+ "./import": "./dist/cli/import-cli.js",
18
+ "./publish": "./dist/cli/publish-cli.js"
18
19
  },
19
20
  "files": [
20
21
  "dist",
@@ -26,17 +27,17 @@
26
27
  },
27
28
  "dependencies": {
28
29
  "ajv": "8.20.0",
29
- "@design-parity/core": "^0.1.53",
30
- "@design-parity/resolver": "^0.1.53",
31
- "@design-parity/policy": "^0.1.53",
32
- "@design-parity/diff": "^0.1.53",
33
- "@design-parity/report-html": "^0.1.53",
34
- "@design-parity/checks": "^0.1.53",
35
- "@design-parity/candidate": "^0.1.53",
36
- "@design-parity/adapter-figma": "^0.1.53",
37
- "@design-parity/adapter-stitch": "^0.1.53",
38
- "@design-parity/adapter-claude-design": "^0.1.53",
39
- "@design-parity/adapter-bundle": "^0.1.53"
30
+ "@design-parity/core": "^0.1.55",
31
+ "@design-parity/resolver": "^0.1.55",
32
+ "@design-parity/policy": "^0.1.55",
33
+ "@design-parity/diff": "^0.1.55",
34
+ "@design-parity/report-html": "^0.1.55",
35
+ "@design-parity/checks": "^0.1.55",
36
+ "@design-parity/candidate": "^0.1.55",
37
+ "@design-parity/adapter-figma": "^0.1.55",
38
+ "@design-parity/adapter-stitch": "^0.1.55",
39
+ "@design-parity/adapter-claude-design": "^0.1.55",
40
+ "@design-parity/adapter-bundle": "^0.1.55"
40
41
  },
41
42
  "repository": {
42
43
  "type": "git",