@rightkit/release 0.6.40 → 0.6.43

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.
Files changed (88) hide show
  1. package/README.md +110 -11
  2. package/admission-files.mjs +40 -0
  3. package/admission-host.mjs +2 -1
  4. package/app-check.mjs +303 -16
  5. package/app-closure.mjs +6 -4
  6. package/bin/rightkit-gate.mjs +180 -32
  7. package/cargo-contract.mjs +17 -31
  8. package/cargo-license-notices.mjs +129 -19
  9. package/cargo-target-shim.mjs +14 -0
  10. package/carried-cargo.mjs +2 -4
  11. package/cli/right-release.mjs +24 -2
  12. package/cross-targets.mjs +24 -0
  13. package/deterministic-scans.mjs +150 -58
  14. package/development-signing.mjs +25 -2
  15. package/development.mjs +34 -1
  16. package/direct-release-command.mjs +154 -0
  17. package/disk-policy.mjs +16 -0
  18. package/feature-coverage.mjs +134 -0
  19. package/gate-coverage.mjs +38 -0
  20. package/gate-stages.mjs +1 -0
  21. package/ghsa-audit.mjs +95 -0
  22. package/install-app.mjs +33 -5
  23. package/install-channels.mjs +301 -0
  24. package/interactive-session-run.mjs +105 -0
  25. package/legal-contract.mjs +10 -1
  26. package/legion-freeze-consumer.mjs +241 -0
  27. package/linux-publish.mjs +136 -0
  28. package/local-publish.mjs +31 -8
  29. package/nsis-pack.mjs +95 -0
  30. package/nsis-upgrade-template.mjs +93 -0
  31. package/outdated-command.mjs +19 -0
  32. package/ownership-class-rules.mjs +32 -10
  33. package/ownership-mandatory-set.json +23 -0
  34. package/ownership-mandatory-set.mjs +66 -8
  35. package/package-recipe-targets.mjs +54 -19
  36. package/package.json +1 -1
  37. package/payload-root-install.mjs +123 -0
  38. package/plugin-delivery.mjs +141 -0
  39. package/prebuild-gates.mjs +8 -4
  40. package/preflight.mjs +6 -1
  41. package/provision-model-bundle.mjs +172 -0
  42. package/pub-upload.mjs +1 -1
  43. package/publish-local-npm.mjs +34 -9
  44. package/publish-retention.mjs +106 -0
  45. package/publish-update.mjs +15 -8
  46. package/qa-build-features.mjs +24 -15
  47. package/qa-contract.mjs +5 -6
  48. package/qa-control-scan.mjs +14 -0
  49. package/qa-web-pairing.mjs +76 -0
  50. package/r2-s3-multipart.mjs +190 -0
  51. package/r2-verified-upload.mjs +28 -16
  52. package/recipe-build.mjs +53 -3
  53. package/release-checks.mjs +53 -2
  54. package/release-config.mjs +8 -3
  55. package/release-invocation.mjs +12 -2
  56. package/release-pin-floor.mjs +44 -0
  57. package/release-qa-audit.mjs +18 -2
  58. package/release-qa-command.mjs +17 -1
  59. package/release-qa-policy.mjs +30 -3
  60. package/release-switch-cfg.mjs +271 -0
  61. package/release-switch-registry.json +60 -1
  62. package/release-switch-scan.mjs +398 -23
  63. package/release.mjs +97 -6
  64. package/render-views.mjs +141 -0
  65. package/rightkit-registry-resolver.mjs +1 -1
  66. package/rightkit-versions.json +140 -103
  67. package/runtime-artifact-manifest.mjs +9 -0
  68. package/runtime-manifest-refresh.mjs +88 -0
  69. package/rustright-stage.mjs +197 -0
  70. package/scan-digest.mjs +15 -9
  71. package/scan-tool-enrolment.mjs +1 -1
  72. package/security-policy.mjs +196 -0
  73. package/shell-contract.mjs +32 -0
  74. package/snapshot-broker.mjs +8 -1
  75. package/snapshot-check.mjs +59 -1
  76. package/snapshot-identity.mjs +48 -0
  77. package/snapshot-request.mjs +25 -2
  78. package/snapshot.mjs +69 -9
  79. package/stage-commands.mjs +33 -4
  80. package/stage-ledger.mjs +5 -0
  81. package/stage-receipt.mjs +115 -0
  82. package/stage-sidecar.mjs +188 -17
  83. package/stage-xcframework.mjs +118 -0
  84. package/suite-api.generated.mjs +16 -1
  85. package/unit-gate.mjs +14 -2
  86. package/upload-large.mjs +4 -4
  87. package/upload-release.mjs +6 -0
  88. package/win-package-recipe.mjs +26 -4
@@ -6,23 +6,54 @@
6
6
  // legal: { cargoNotices: { output: "legal/THIRD_PARTY_CARGO_LICENSES.html", template: "legal/about.hbs",
7
7
  // config?: "legal/about.toml", manifestPath?: "src-tauri/Cargo.toml", features?: ["a"], allFeatures?: true } }
8
8
  //
9
- // `output`, `template`, `config` and `manifestPath` are app-relative and may not leave the app. The run is `cargo about generate --frozen
9
+ // `output` and `template` are app-relative and may not leave the app. `manifestPath` and `config` (also per entry) are app-relative but may
10
+ // climb out of the app (`../../engine/Cargo.toml`) while they stay inside the repository root. Several workspaces merge into one appendix with
11
+ // `manifests: [{ label, manifestPath, config? }]` (instead of `manifestPath`): one `cargo about generate` per entry, each body in a section
12
+ // named by its label. After a successful run a `Build provenance: <product> <version>; inputs: <Cargo.lock path> sha256=<hex>; generated-by=right-release
13
+ // license-notices cargo` line is written before `</body>`; `productName` and `version` default to the config app name and package.json version. The run is `cargo about generate --frozen
10
14
  // --fail [--config <config>] [--manifest-path <path>] [--all-features | --features a,b] <template>`; cargo-about writes the rendered
11
15
  // appendix to stdout, which is normalised to LF and one trailing newline so the same lockfile always produces the same bytes. `--fail`
12
16
  // makes an unaccepted license or an unresolved clarification an error instead of a warning. `--check` writes nothing and exits 1 when
13
17
  // the file on disk differs.
18
+ import { createHash } from "node:crypto";
14
19
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
15
20
  import path from "node:path";
16
21
  import { pathToFileURL } from "node:url";
17
22
  import { CommandSpecError, loadAppConfig, relativeInside } from "./command-spec.mjs";
18
23
  import { defaultReleaseConfigFile } from "./release-config.mjs";
19
24
  import { runCargoSync } from "./managed-cargo.mjs";
25
+ import { escapeHtml } from "./npm-license-notices.mjs";
20
26
 
21
27
  const fail = (message) => { throw new CommandSpecError(message); };
22
- const KEYS = ["output", "template", "config", "manifestPath", "features", "allFeatures"];
28
+ const KEYS = ["output", "template", "config", "manifestPath", "manifests", "features", "allFeatures", "productName", "version"];
29
+ const ENTRY_KEYS = ["label", "manifestPath", "config"];
23
30
 
24
- /** Resolve and validate `legal.cargoNotices` plus flags. */
25
- export function resolveCargoNoticeOptions(config, flags = {}) {
31
+ /** The repository root above `start`: the nearest directory holding `.git`, else `start` itself. */
32
+ export function findRepositoryRoot(start, exists = existsSync) {
33
+ const original = path.resolve(start);
34
+ let current = original;
35
+ while (true) {
36
+ if (exists(path.join(current, ".git"))) return current;
37
+ const parent = path.dirname(current);
38
+ if (parent === current) return original;
39
+ current = parent;
40
+ }
41
+ }
42
+
43
+ /**
44
+ * A manifest or about-config path: app-relative, but it may climb out of the app (`../../engine/Cargo.toml`) as long as it stays inside the
45
+ * repository root (#1135). Returns the forward-slash path to hand to cargo, which runs in the app root.
46
+ */
47
+ function repoBoundPath(value, label, appRoot, repoRoot) {
48
+ if (typeof value !== "string" || !value.trim()) fail(`${label} must be a non-empty relative path`);
49
+ if (path.isAbsolute(value) || /^[A-Za-z]:/.test(value)) fail(`${label} must be relative to the app root and stay inside the repository: ${value}`);
50
+ const relative = path.relative(repoRoot, path.resolve(appRoot, value));
51
+ if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) fail(`${label} must stay inside the repository root ${repoRoot}: ${value}`);
52
+ return value.replaceAll("\\", "/");
53
+ }
54
+
55
+ /** Resolve and validate `legal.cargoNotices` plus flags. `appRoot` and `repoRoot` bound manifest and about-config paths (default: the app root for both). */
56
+ export function resolveCargoNoticeOptions(config, flags = {}, { appRoot = ".", repoRoot = appRoot } = {}) {
26
57
  const declared = config?.legal?.cargoNotices ?? {};
27
58
  if (typeof declared !== "object" || declared === null || Array.isArray(declared)) fail("legal.cargoNotices must be an object");
28
59
  const unknown = Object.keys(declared).filter((key) => !KEYS.includes(key));
@@ -32,20 +63,42 @@ export function resolveCargoNoticeOptions(config, flags = {}) {
32
63
  relativeInside(output, "legal.cargoNotices.output");
33
64
  if (declared.template === undefined) fail("legal.cargoNotices.template (the cargo-about handlebars template) is required");
34
65
  relativeInside(declared.template, "legal.cargoNotices.template");
35
- for (const key of ["config", "manifestPath"]) if (declared[key] !== undefined) relativeInside(declared[key], `legal.cargoNotices.${key}`);
66
+ const bound = (value, label) => repoBoundPath(value, label, appRoot, repoRoot);
67
+ if (declared.config !== undefined) bound(declared.config, "legal.cargoNotices.config");
68
+ if (declared.manifestPath !== undefined) bound(declared.manifestPath, "legal.cargoNotices.manifestPath");
69
+ if (declared.manifests !== undefined) {
70
+ if (declared.manifestPath !== undefined) fail("legal.cargoNotices: give manifestPath or manifests, not both");
71
+ if (!Array.isArray(declared.manifests) || declared.manifests.length === 0) fail("legal.cargoNotices.manifests must be a non-empty list of { label, manifestPath, config? }");
72
+ }
73
+ const labels = new Set();
74
+ const manifests = (declared.manifests ?? [{ label: undefined, manifestPath: declared.manifestPath, config: declared.config }]).map((entry, index) => {
75
+ const where = `legal.cargoNotices.manifests[${index}]`;
76
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) fail(`${where} must be an object`);
77
+ const entryUnknown = Object.keys(entry).filter((key) => !ENTRY_KEYS.includes(key));
78
+ if (entryUnknown.length) fail(`${where} has unknown key(s): ${entryUnknown.join(", ")} (allowed: ${ENTRY_KEYS.join(", ")})`);
79
+ if (declared.manifests !== undefined) {
80
+ if (typeof entry.label !== "string" || !entry.label.trim()) fail(`${where}.label must be a non-empty string`);
81
+ if (labels.has(entry.label)) fail(`${where}.label ${entry.label} is used twice`);
82
+ labels.add(entry.label);
83
+ bound(entry.manifestPath, `${where}.manifestPath`);
84
+ if (entry.config !== undefined) bound(entry.config, `${where}.config`);
85
+ }
86
+ return { label: entry.label, manifestPath: entry.manifestPath, config: entry.config ?? declared.config };
87
+ });
36
88
  const features = declared.features ?? [];
37
89
  if (!Array.isArray(features) || features.some((feature) => typeof feature !== "string" || !/^[A-Za-z0-9_/-]+$/.test(feature))) fail("legal.cargoNotices.features must be a list of feature names");
38
90
  if (declared.allFeatures !== undefined && typeof declared.allFeatures !== "boolean") fail("legal.cargoNotices.allFeatures must be a boolean");
39
91
  if (declared.allFeatures === true && features.length) fail("legal.cargoNotices: give allFeatures or features, not both");
40
- return { output, template: declared.template, config: declared.config, manifestPath: declared.manifestPath, features, allFeatures: declared.allFeatures === true };
92
+ for (const key of ["productName", "version"]) if (declared[key] !== undefined && (typeof declared[key] !== "string" || !declared[key].trim())) fail(`legal.cargoNotices.${key} must be a non-empty string`);
93
+ return { output, template: declared.template, config: declared.config, manifestPath: declared.manifestPath, manifests, features, allFeatures: declared.allFeatures === true, productName: declared.productName, version: declared.version };
41
94
  }
42
95
 
43
- /** The `cargo about` argument list (after the managed client adds `cargo`). */
44
- export function cargoAboutArgs(options) {
96
+ /** The `cargo about` argument list (after the managed client adds `cargo`) for one manifest entry. */
97
+ export function cargoAboutArgs(options, entry = options.manifests?.[0] ?? { config: options.config, manifestPath: options.manifestPath }) {
45
98
  return [
46
99
  "about", "generate", "--frozen", "--fail",
47
- ...(options.config ? ["--config", options.config] : []),
48
- ...(options.manifestPath ? ["--manifest-path", options.manifestPath] : []),
100
+ ...(entry.config ? ["--config", entry.config] : []),
101
+ ...(entry.manifestPath ? ["--manifest-path", entry.manifestPath] : []),
49
102
  ...(options.allFeatures ? ["--all-features"] : options.features.length ? ["--features", options.features.join(",")] : []),
50
103
  options.template,
51
104
  ];
@@ -53,17 +106,74 @@ export function cargoAboutArgs(options) {
53
106
 
54
107
  const normalise = (text) => `${String(text).replace(/\r\n/g, "\n").replace(/\s+$/, "")}\n`;
55
108
 
109
+ const BODY = /^([\s\S]*?<body\b[^>]*>)([\s\S]*?)(<\/body>[\s\S]*)$/i;
110
+
111
+ /** One output, or several merged under their labels: the first output's head and tail, each body in a labelled section. */
112
+ export function mergeCargoAboutOutputs(outputs) {
113
+ if (outputs.length === 1 && outputs[0].label === undefined) return outputs[0].text;
114
+ const parts = outputs.map(({ label, text }) => {
115
+ const match = BODY.exec(text);
116
+ return { label, head: match?.[1] ?? "", body: match ? match[2] : text, tail: match?.[3] ?? "" };
117
+ });
118
+ const sections = parts.map(({ label, body }) => `<section data-cargo-manifest="${escapeHtml(label ?? "")}">\n<h2>${escapeHtml(label ?? "")}</h2>\n${body.trim()}\n</section>`);
119
+ return `${parts[0].head}\n${sections.join("\n")}\n${parts[0].tail}`;
120
+ }
121
+
122
+ /** The lock a manifest resolves against: the nearest Cargo.lock at or above the manifest's directory, within the repository. */
123
+ function lockFor({ appRoot, repoRoot, manifestPath, exists }) {
124
+ let current = path.dirname(path.resolve(appRoot, manifestPath ?? "Cargo.toml"));
125
+ while (true) {
126
+ const candidate = path.join(current, "Cargo.lock");
127
+ if (exists(candidate)) return candidate;
128
+ if (current === repoRoot || path.dirname(current) === current) return null;
129
+ current = path.dirname(current);
130
+ }
131
+ }
132
+
133
+ /** Insert the Build provenance line before `</body>` (the end when there is none): the lock(s) the appendix was generated from, as CA-14 reads them. */
134
+ export function withCargoProvenance(html, { productName, version, locks }) {
135
+ const inputs = locks.map(({ ref, sha256 }) => `${ref} sha256=${sha256}`).join(", ");
136
+ const line = `<p>Build provenance: ${escapeHtml(productName)} ${escapeHtml(version)}; inputs: ${escapeHtml(inputs)}; generated-by=right-release license-notices cargo</p>\n`;
137
+ const close = html.search(/<\/body>/i);
138
+ return normalise(close === -1 ? `${html.replace(/\s+$/, "")}\n${line}` : `${html.slice(0, close)}${line}${html.slice(close)}`);
139
+ }
140
+
56
141
  /** Generate (or check) the Cargo appendix for the app at `appRoot`. `run` is the managed cargo runner (injectable). */
57
- export function generateCargoNotices({ appRoot, config, flags = {}, check = false, run = runCargoSync, env = process.env, exists = existsSync, readText = (file) => readFileSync(file, "utf8"), writeText = (file, text) => { mkdirSync(path.dirname(file), { recursive: true }); writeFileSync(file, text); } }) {
58
- const options = resolveCargoNoticeOptions(config, flags);
59
- for (const key of ["template", "config", "manifestPath"]) {
60
- if (options[key] !== undefined && !exists(path.join(appRoot, options[key]))) fail(`legal.cargoNotices.${key} ${options[key]} does not exist`);
142
+ export function generateCargoNotices({ appRoot, config, flags = {}, check = false, run = runCargoSync, env = process.env, exists = existsSync, readText = (file) => readFileSync(file, "utf8"), readBytes = (file) => readFileSync(file), writeText = (file, text) => { mkdirSync(path.dirname(file), { recursive: true }); writeFileSync(file, text); } }) {
143
+ const repoRoot = findRepositoryRoot(appRoot, exists);
144
+ const options = resolveCargoNoticeOptions(config, flags, { appRoot: path.resolve(appRoot), repoRoot });
145
+ if (!exists(path.join(appRoot, options.template))) fail(`legal.cargoNotices.template ${options.template} does not exist`);
146
+ for (const entry of options.manifests) {
147
+ const where = entry.label ? ` (${entry.label})` : "";
148
+ if (entry.config !== undefined && !exists(path.resolve(appRoot, entry.config))) fail(`legal.cargoNotices.config ${entry.config}${where} does not exist`);
149
+ if (entry.manifestPath !== undefined && !exists(path.resolve(appRoot, entry.manifestPath))) fail(`legal.cargoNotices.manifestPath ${entry.manifestPath}${where} does not exist`);
150
+ }
151
+ const outputs = options.manifests.map((entry) => {
152
+ const result = run(cargoAboutArgs(options, entry), { cwd: appRoot, env, encoding: "utf8", maxBuffer: 256 * 1024 * 1024 });
153
+ const where = entry.label ? ` for ${entry.label}` : "";
154
+ if (result?.error) fail(`cargo about could not start${where} (${result.error.message}); install cargo-about on the build host`);
155
+ if (result?.status !== 0) fail(`cargo about${where} exited ${result?.status ?? "without status"}${result?.stderr ? `:\n${String(result.stderr).trim()}` : ""}`);
156
+ const text = normalise(result.stdout ?? "");
157
+ if (text.trim() === "") fail(`cargo about produced no output${where}`);
158
+ return { label: entry.label, text };
159
+ });
160
+ // The lock each manifest resolves against, hashed as bytes, recorded repository-root-relative: a stale appendix no longer matches its lock (CA-14, #1445).
161
+ const locks = [];
162
+ for (const entry of options.manifests) {
163
+ const lockFile = lockFor({ appRoot, repoRoot, manifestPath: entry.manifestPath, exists });
164
+ if (!lockFile) fail(`no Cargo.lock at or above ${entry.manifestPath ?? "the app root"}${entry.label ? ` (${entry.label})` : ""}: the appendix is generated with --frozen from a committed lock`);
165
+ const ref = path.relative(repoRoot, lockFile).replaceAll("\\", "/");
166
+ if (!locks.some((lock) => lock.ref === ref)) locks.push({ ref, sha256: createHash("sha256").update(readBytes(lockFile)).digest("hex") });
167
+ }
168
+ const productName = options.productName ?? config?.productName ?? config?.app;
169
+ let version = options.version;
170
+ if (version === undefined) {
171
+ const packageJson = path.join(appRoot, "package.json");
172
+ if (exists(packageJson)) version = JSON.parse(readText(packageJson)).version;
61
173
  }
62
- const result = run(cargoAboutArgs(options), { cwd: appRoot, env, encoding: "utf8", maxBuffer: 256 * 1024 * 1024 });
63
- if (result?.error) fail(`cargo about could not start (${result.error.message}); install cargo-about on the build host`);
64
- if (result?.status !== 0) fail(`cargo about exited ${result?.status ?? "without status"}${result?.stderr ? `:\n${String(result.stderr).trim()}` : ""}`);
65
- const text = normalise(result.stdout ?? "");
66
- if (text.trim() === "") fail("cargo about produced no output");
174
+ if (typeof productName !== "string" || !productName.trim()) fail("no product name: set legal.cargoNotices.productName or the config app name");
175
+ if (typeof version !== "string" || !version.trim()) fail("no product version: set legal.cargoNotices.version or give the app a package.json version");
176
+ const text = withCargoProvenance(mergeCargoAboutOutputs(outputs), { productName, version, locks });
67
177
  const target = path.join(appRoot, options.output);
68
178
  if (check) {
69
179
  const current = exists(target) ? normalise(readText(target)) : null;
@@ -62,12 +62,26 @@ const VERSION_PROBES = Object.freeze([["-V"], ["--version"], ["-vV"], ["-Vv"], [
62
62
  const CARRIED_SHAPE = new Set(["metadata", "deny", "audit", "fmt"]);
63
63
  // GATE-CONTRACT GC-A11 (Adrian, 2026-11-02): a cargo call that compiles nothing never goes to the broker; in broker mode these run directly
64
64
  // with the host's real toolchain cargo (map.realCargo), each into its own scratch target, never carried (rustright a2972f0 refuses them).
65
+ // The oldest @rightkit/release an app may pin and still run a compile stage on a broker host: the direct route for these calls arrived in
66
+ // 0.6.34 (rightkit#1491); an older app-side right-release child carries its `metadata` and `fmt --check` calls to the broker, which refuses
67
+ // them. It moves with the GC-A11 contract text above, and release-pin-floor.mjs reads it before any compile.
68
+ export const DIRECT_ROUTE_RELEASE_FLOOR = "0.6.34";
65
69
  export const READ_ONLY_DIRECT = Object.freeze(new Set(["metadata", "fetch", "tree", "pkgid", "verify-project", "read-manifest", "locate-project", "deny", "audit", "fmt"]));
66
70
  /** Whether an argv compiles nothing: a READ_ONLY_DIRECT subcommand, or `cargo package --list` (lists files, builds nothing). */
67
71
  export function readOnlyCargo(args) {
68
72
  const sub = cargoSubcommandOf(args);
69
73
  return READ_ONLY_DIRECT.has(sub) || (sub === "package" && args.includes("--list"));
70
74
  }
75
+ /**
76
+ * Whether a cargo call of a snapshot stage runs directly (GC-A11) instead of being carried to the broker: the first word is the subcommand
77
+ * itself (no `+toolchain` or global option in front), it compiles nothing, it is one of carriedScanRefusal's exact non-writing shapes, and a
78
+ * `package` call is `--list` with `--locked` or `--frozen`. The ONE definition of that shape: carried-cargo.mjs runs a call by it and
79
+ * stage-commands.mjs (via it) tells the receipt collection and the hosted admission to expect no broker receipt for such a command.
80
+ */
81
+ export function directCargoShape(words) {
82
+ return /^[a-z]/.test(words?.[0] ?? "") && readOnlyCargo(words) && carriedScanRefusal(words) === null
83
+ && (words[0] !== "package" || (words.includes("--list") && (words.includes("--locked") || words.includes("--frozen"))));
84
+ }
71
85
  /** The cargo subcommand of an argv (after a +toolchain and global options), or null. */
72
86
  export function cargoSubcommandOf(args) {
73
87
  for (let i = args[0]?.startsWith("+") ? 1 : 0; i < args.length; i += 1) {
package/carried-cargo.mjs CHANGED
@@ -21,9 +21,8 @@ import os from "node:os";
21
21
  import path from "node:path";
22
22
  import { spawnSync } from "./background-process.mjs";
23
23
  import { appendLedger, readLedger, SCAN_TOKEN_ENV, UNSCOPED } from "./cargo-ledger.mjs";
24
- import { SHIM_MAP_SCHEMA, locateWorkspaceByWalk, readOnlyCargo } from "./cargo-target-shim.mjs";
24
+ import { SHIM_MAP_SCHEMA, directCargoShape, locateWorkspaceByWalk } from "./cargo-target-shim.mjs";
25
25
  import { directCargoPath } from "./managed-cargo.mjs";
26
- import { carriedScanRefusal } from "./snapshot-metadata.mjs";
27
26
  import { BROKER_REFUSAL_STATUS, carryBrokerAdapter, carryBrokerCargo, verifyBrokerLedger } from "./snapshot-broker.mjs";
28
27
  import { splitCarriedArgs } from "./snapshot-request.mjs";
29
28
 
@@ -93,8 +92,7 @@ export function runCarriedCargo(args, options = {}, { map, spawn = spawnSync, er
93
92
  // --locked/--frozen, `deny ... check`, `audit --db <dir> --no-fetch`), and only when the first word is the subcommand itself (no
94
93
  // `+toolchain` or global option in front). Anything else still carries, and the broker refuses it: a direct call never writes the
95
94
  // snapshot (no `fmt` without --check, no lock rewrite, no `deny init`, no `audit fix`).
96
- const directShape = /^[a-z]/.test(words[0] ?? "") && readOnlyCargo(words) && carriedScanRefusal(words) === null
97
- && (words[0] !== "package" || (words.includes("--list") && (words.includes("--locked") || words.includes("--frozen"))));
95
+ const directShape = directCargoShape(words);
98
96
  if (directShape) {
99
97
  const realCargo = directCargoBin(env);
100
98
  if (!realCargo) return refuse("RK_CARGO_DIRECT_MISSING", `\`cargo ${words.join(" ")}\` compiles nothing and runs directly (GC-A11), but no cargo was found on the broker's toolchain or PATH`);
@@ -24,6 +24,14 @@ const commands = new Map([
24
24
  ["sign-candidate", "sign-candidate.mjs"],
25
25
  ["engine-locate", "engine-locator.mjs"],
26
26
  ["stage-sidecar", "stage-sidecar-command.mjs"],
27
+ ["nsis-template", "nsis-upgrade-template.mjs"],
28
+ ["nsis-pack", "nsis-pack.mjs"],
29
+ ["rustright-stage", "rustright-stage.mjs"],
30
+ ["plugin-install", "plugin-delivery.mjs"],
31
+ ["linux-publish", "linux-publish.mjs"],
32
+ ["install-channels", "install-channels.mjs"],
33
+ ["stage-xcframework", "stage-xcframework.mjs"],
34
+ ["session-run", "interactive-session-run.mjs"],
27
35
  ["assemble-app", "assemble-app-command.mjs"],
28
36
  ["init", "init-command.mjs"],
29
37
  ["pe", "pe-content.mjs"],
@@ -36,6 +44,7 @@ const commands = new Map([
36
44
  ["web-build", "web-build.mjs"],
37
45
  ["build-helpers", "build-helpers-command.mjs"],
38
46
  ["license-notices", "npm-license-notices.mjs"],
47
+ ["provision-model", "provision-model-bundle.mjs"],
39
48
  ["toolchain", "toolchain-swift.mjs"],
40
49
  ["github", "github-release.mjs"],
41
50
  ["cargo-target", "cargo-target.mjs"],
@@ -58,13 +67,13 @@ const args = process.argv.slice(2);
58
67
  const first = args[0];
59
68
  // The commands that compile, package, sign, ship or inspect a release run the app check (../app-check.mjs, CHECKED_COMMANDS) in this
60
69
  // process before they start a child. A red check prints its findings and exits 1; there is no flag that skips it.
61
- const WORKTREE_COMPILES = new Set(["dev", "test", "stage-sidecar"]);
70
+ const WORKTREE_COMPILES = new Set(["dev", "test", "stage-sidecar", "stage-xcframework"]);
62
71
  // The commands that run inside a source split (source-split.mjs): the door's snapshot of a commit, with the checkout kept for the git
63
72
  // context and every output. build, package, release and qa take their identity from release-source-identity.mjs (row 7.04): the selected
64
73
  // commit's objects plus the door's verified snapshot, never the checkout's HEAD, status or branch (each re-proves it through
65
74
  // assertReleaseSource). `upload` does so for the mobile platforms (the host's store upload); a desktop upload, publish and the signing
66
75
  // commands still read the checkout's HEAD and refuse under a split rather than run on the wrong bytes.
67
- const SPLIT_COMMANDS = new Set(["dev", "test", "stage-sidecar", "web-build", "build", "package", "release", "qa"]);
76
+ const SPLIT_COMMANDS = new Set(["dev", "test", "stage-sidecar", "stage-xcframework", "web-build", "build", "package", "release", "qa"]);
68
77
  const MOBILE_UPLOAD = (argv) => argv.some((a, i) => (a === "--platform" && ["ios", "android"].includes(argv[i + 1])) || a === "--platform=ios" || a === "--platform=android");
69
78
  async function requireGreenCheck() {
70
79
  const { guardCommand, checkedCommandOf, checkModeFor, appDirectory } = await import("../app-check.mjs");
@@ -120,6 +129,7 @@ try {
120
129
  if (githubBuildCommands.has(first)
121
130
  || first?.startsWith("-")
122
131
  || (first === "addon" && args[1] === "build")
132
+ || (first === "direct-release" && args[1] === "finalize")
123
133
  || (first === "dmg" && args[1] === "build")
124
134
  || first === "qualify"
125
135
  || (first === "publish" && ["cargo", "swift"].includes(args[1]))) {
@@ -226,6 +236,8 @@ if (first === "--version" || first === "-v") {
226
236
  run("model-promote.mjs", rest.slice(1));
227
237
  } else if (first === "addon") {
228
238
  run("addon-command.mjs", args.slice(1));
239
+ } else if (first === "direct-release") {
240
+ run("direct-release-command.mjs", args.slice(1));
229
241
  } else if (first === "lsclean") {
230
242
  runBinary("bash", [path.join(packageRoot, "lsclean.sh"), ...args.slice(1)]);
231
243
  } else if (first === "generate-dmg-background") {
@@ -297,6 +309,14 @@ Commands:
297
309
  pe digest <file> [--algorithm sha256|sha384|sha512] [--json] | pe imports <file> [--allow dll,...] [--allow-file <path>] Signature-independent PE content digest; import-closure check
298
310
  icons ico|icns --out <file> --frame <PNG>... [--dir <folder>] Pack hand-tuned per-size PNG frames into an ICO or ICNS
299
311
  init --name <Product Name> --id <reverse.dns.bundle.id> [--slug <lowercase>] [--dir <root>] [--dry-run] Rename the desktop app template into a real app, in place
312
+ stage-xcframework --crate <dir> --targets <triple,...> --headers <dir> --out <Name.xcframework> Build a Rust staticlib crate through the broker and assemble an iOS xcframework
313
+ install-channels --facts <facts.json> --out <dir> [--check] Generate install.sh, install.ps1, the Homebrew cask and the winget manifests from the verified release facts
314
+ linux-publish publish --app <slug> --out-dir <dir> --approve <manifest sha256> [--dry-run] | presign --app <slug> --version <v> --arch <x86_64|aarch64> [--expires <s>] Private Linux R2 publication and one-artifact presigned URLs
315
+ plugin-install --app <slug> --plugin-dir <installed plugin folder> [--version <v>] [--claude-root <dir>]... Register the installed app's Claude plugin in every Claude config root and read the version back
316
+ rustright-stage [--repo <rustright checkout>] [--scratch <dir>] [--cutover [--apply] [--config-next <file>]] Stage the gate-compiled RustRight broker build (sign, stage, approve, write the cutover); rustright-install cutover only for the swap
317
+ session-run [--state-dir <dir>] [--timeout-ms <n>] -- <command> [args...] Windows: run one command in the signing user's interactive logon session (one-shot task, hidden)
318
+ nsis-pack --script <installer.nsi> --payload <dir> --output <Setup.exe> [--define NAME=VALUE]... Pack a signed multi-exe payload with makensis (signingContract windows-payload-authenticode-before-nsis-v1)
319
+ nsis-template --from <Tauri stock installer.nsi> --out <template.nsi> Derive the in-place-upgrade NSIS template the Windows release contract requires
300
320
  stage-sidecar [--config <file>] [--target <triple>] [--json] Stage declarative sidecars into src-tauri/binaries (Tauri externalBin naming)
301
321
  assemble-app --platform mac|win [--profile release|dev] [--build] [--out <dir>] | --verify-staged [--signed] | --package Assemble the declared composite app (assembly.<platform>) for production packaging; the same definition installs through dev
302
322
  recipe-build --plan <json> | --plan-file <path> [--app-root <dir>] Run a package recipe: prepare steps, the Tauri build, postBuild steps (argv, no shell, fail closed)
@@ -390,6 +410,8 @@ Commands:
390
410
  model promote --authority <app-key> --config <file> [--dry-run]
391
411
  Sign and promote one runtime/model artifact
392
412
  addon doctor|build|upload|adopt <options> Manage a signed headless add-on
413
+ provision-model [--config <file>] [--id <bundle>] [--dry-run] Fetch each modelBundles entry's pinned files into its dest, verifying size and sha256 (resumable; nothing unpinned)
414
+ direct-release finalize [--config <file>] [--output-dir <dir>] [--dry-run] Zip, signed release manifest, install.ps1 bootstrap, publication plan for a direct (non-store) release, from the config's directRelease block (checked; uploads nothing)
393
415
  apple profile renew [--config <file>] [--profile <file>] [--dry-run]
394
416
  Renew macOS profile for current Keychain signer
395
417
  signing-agent install|uninstall|status Manage invisible Aqua-session signing service
package/cross-targets.mjs CHANGED
@@ -33,6 +33,30 @@ export function crossTargetsFor(entry = {}, platform = "darwin") {
33
33
  return Object.values(CROSS_TARGETS).filter((target) => target !== native);
34
34
  }
35
35
 
36
+ /**
37
+ * Per-crate platform scope (rightkit#1248): `platforms` in a crate's ci/gate.config.json entry names the hosts (`process.platform` words:
38
+ * darwin, win32, linux) whose gate plans the crate's compile and test rows. A crate whose dependencies exist only on Windows
39
+ * (pulse-windows: windows-future) cannot compile on the Mac, so its rows run on the Windows host only; the other hosts plan none of them
40
+ * and say so in the plan notes. Absent means every host (the default, and the only scope for a crate that builds everywhere). A bad value
41
+ * throws, like `crossTargets`: a scope that quietly matched nothing would drop a crate's checks.
42
+ */
43
+ export function crateRunsOn(entry = {}, platform = "darwin") {
44
+ const scope = entry?.platforms;
45
+ if (scope === undefined) return true;
46
+ if (!Array.isArray(scope) || scope.length === 0 || scope.some((p) => !Object.hasOwn(CROSS_TARGETS, p)) || new Set(scope).size !== scope.length) {
47
+ throw new Error(`ci/gate.config.json platforms must be a non-empty list of distinct hosts from ${Object.keys(CROSS_TARGETS).join(", ")}, not ${JSON.stringify(scope)}`);
48
+ }
49
+ // A scope is the one narrowing of "every crate on every host" (GC-A14), so it says why: its dependencies exist for those OSes only.
50
+ if (typeof entry.platformsReason !== "string" || !entry.platformsReason.trim()) throw new Error("ci/gate.config.json platforms needs a non-empty platformsReason (why the crate builds on those hosts only)");
51
+ return scope.includes(platform);
52
+ }
53
+
54
+ /** The cross targets a crate is checked for on `platform`: crossTargetsFor, narrowed to the OSes a platform scope names (all of them when it names none). */
55
+ export function scopedCrossTargets(entry = {}, platform = "darwin") {
56
+ const targets = crossTargetsFor(entry, platform);
57
+ return Array.isArray(entry?.platforms) ? targets.filter((target) => entry.platforms.some((p) => CROSS_TARGETS[p] === target)) : targets;
58
+ }
59
+
36
60
  /**
37
61
  * The provisioned zig wrapper directory: RIGHTKIT_CROSS_CC_DIR, else `<managed data root>/zig/cross-cc` (where scripts/ci/provision-zig.mjs
38
62
  * writes on a Mac or Dell), else null.