@rightkit/release 0.6.39 → 0.6.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.
Files changed (86) 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 +177 -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 +167 -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 -7
  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 +568 -491
  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 +58 -0
  76. package/snapshot-request.mjs +25 -2
  77. package/stage-commands.mjs +33 -4
  78. package/stage-ledger.mjs +6 -1
  79. package/stage-receipt.mjs +115 -0
  80. package/stage-sidecar.mjs +188 -17
  81. package/stage-xcframework.mjs +118 -0
  82. package/suite-api.generated.mjs +16 -1
  83. package/unit-gate.mjs +14 -2
  84. package/upload-large.mjs +4 -4
  85. package/upload-release.mjs +6 -0
  86. package/win-package-recipe.mjs +26 -4
package/app-check.mjs CHANGED
@@ -27,6 +27,13 @@
27
27
  // the LinkProbes control fixture is the one sanctioned import)
28
28
  // e2e-under-cargo-test G22 `cargo test|run|nextest` (also as `rustright cargo`, or the retired `rightkit`) that runs an end-to-end
29
29
  // crate (rightkit-qa driver modules) in the broker without --no-run: it holds the compile slot for the whole run
30
+ // scratch-checkout G23 (compile tier) a script under scripts/, packages/release/ or ci/ that runs `git clone`, `git worktree add`, a checkout
31
+ // outside the repository, or `git archive` beside a build command, unless named in ci/gate.config.json
32
+ // scratchCheckoutAllowlist with an issue link and a reason (rightkit#1221)
33
+ // trust-policy-exclude G24 (release tier) a pnpm trustPolicyExclude entry for @rightkit/* other than the one generated selector "@rightkit/*"
34
+ // (a per-version or hand-written entry; rightkit#1476)
35
+ // commit-citations G28 (release tier) a commit this push adds that cites no issue, or changes code without a `Contract: <file>#<section>`
36
+ // line (rightkit#1268); no baseline excuses it
30
37
  //
31
38
  // Suite trust roots (lane C3; logic in suite-trust-roots.mjs). The licence and updater public keys have one owner,
32
39
  // contracts/right-suite-api.v1.json (generated into suite-api.generated.mjs):
@@ -84,7 +91,9 @@
84
91
  // tracks it and is not empty; `added` and `sunset` are real dates, YYYY-MM-DD, UTC; `added` is not later than today; `sunset`
85
92
  // is not before `added` and at most 90 days (APP_BASELINE_MAX_DAYS) after it. So an entry silences its finding for at most 90
86
93
  // days, the date it counts from cannot be pushed into the future, and renewing one means editing it in a commit. An entry past
87
- // its sunset date is no longer tolerated and fails as EXPIRED, with its finding; else
94
+ // its sunset date is no longer tolerated and fails as EXPIRED, with its finding. An entry that grew the baseline (absent at the
95
+ // merge-base with origin/main) needs `approvedBy`, a person and never an agent, and an issue link, else it fails as UNAPPROVED
96
+ // (rightkit#1251; with no origin/main to anchor to the run prints a NOTE and cannot judge growth); else
88
97
  // 3. RightKit's central ci/app-check-baseline.json ({ known: { "<repo>": ["<identity>", ...] } }), only when this module is loaded
89
98
  // from a RightKit checkout; an installed package has none (its entries keep their own contract: identities only, no dates).
90
99
  // --print-baseline prints the current identities for a person to paste; the check never writes any baseline.
@@ -380,6 +389,30 @@ function braceBlock(text, open) {
380
389
  return "";
381
390
  }
382
391
 
392
+ /** `block` ("{ ... }") with every nested {...} blanked, so a regular expression over it sees the block's own keys only. */
393
+ function ownKeys(block) {
394
+ let depth = 0;
395
+ let out = "";
396
+ for (const ch of block) {
397
+ if (ch === "{") { depth += 1; out += depth === 1 ? ch : " "; }
398
+ else if (ch === "}") { depth -= 1; out += depth === 0 ? ch : " "; }
399
+ else out += depth === 1 || ch === "\n" ? ch : " ";
400
+ }
401
+ return out;
402
+ }
403
+
404
+ /** Whether the array literal that encloses `offset` holds a standalone "--" argument before it (a command line's program separator). */
405
+ function afterProgramSeparator(text, offset) {
406
+ let depth = 0;
407
+ let start = -1;
408
+ for (let i = offset - 1; i >= 0; i--) {
409
+ const ch = text[i];
410
+ if (ch === "]") depth += 1;
411
+ else if (ch === "[") { if (depth === 0) { start = i; break; } depth -= 1; }
412
+ }
413
+ return start >= 0 && /(["'])--\1\s*[,\]]/.test(text.slice(start, offset));
414
+ }
415
+
383
416
  /** Profile names a Cargo manifest defines ([profile.<name>] and [profile.<name>.package...]). */
384
417
  const cargoProfiles = (text) => new Set([...String(text ?? "").matchAll(/^\s*\[profile\.("[^"]+"|[A-Za-z0-9_-]+)/gm)].map((m) => m[1].replaceAll('"', "")));
385
418
  const BUILTIN_PROFILES = new Set(["dev", "release", "test", "bench"]);
@@ -423,15 +456,23 @@ function releaseConfig({ root, files }) {
423
456
  if (key === "profile" && (parent === "winPackage" || parent === "macPackage") && typeof value === "string") profiles.push([value, text.indexOf(JSON.stringify(value))]);
424
457
  }
425
458
  } else {
426
- for (const m of text.matchAll(/\bprovider\s*:\s*(["'`])([^"'`]+)\1/g)) if (!RELEASE_PROVIDERS.has(m[2])) badProvider(m[2], m.index);
459
+ // Only a `distribution` block's own provider is a publish-update provider; a nested object (windows.bootstrap.provider, the
460
+ // bootstrap-installer channel) and a provider outside the block are not (rightkit#1290), exactly as the JSON branch reads it.
461
+ for (const d of text.matchAll(/\bdistribution\s*[:=]\s*\{/g)) {
462
+ const open = d.index + d[0].length - 1;
463
+ const own = ownKeys(braceBlock(text, open));
464
+ for (const m of own.matchAll(/\bprovider\s*:\s*(["'`])([^"'`]+)\1/g)) if (!RELEASE_PROVIDERS.has(m[2])) badProvider(m[2], open + m.index);
465
+ }
427
466
  for (const m of text.matchAll(/\bupdater\s*:\s*\{/g)) {
428
467
  const block = braceBlock(text, m.index + m[0].length - 1);
429
468
  const key = /\bkeyFile\s*:\s*([^,\n}]+)/.exec(block);
430
469
  if (key) keyFile(key[1].trim(), m.index + key.index);
431
470
  }
432
471
  }
433
- profiles.push(...[...text.matchAll(/(["'])--profile\1\s*,\s*(["'])([^"']+)\2/g)].map((m) => [m[3], m.index])
434
- .concat([...text.matchAll(/(["'])--profile=([^"']+)\1/g)].map((m) => [m[2], m.index]))
472
+ // `--profile` after a standalone "--" argument belongs to the program cargo runs (xtask), not to cargo (rightkit#1290).
473
+ const cargoArgument = (offset) => !afterProgramSeparator(text, offset);
474
+ profiles.push(...[...text.matchAll(/(["'])--profile\1\s*,\s*(["'])([^"']+)\2/g)].filter((m) => cargoArgument(m.index)).map((m) => [m[3], m.index])
475
+ .concat([...text.matchAll(/(["'])--profile=([^"']+)\1/g)].filter((m) => cargoArgument(m.index)).map((m) => [m[2], m.index]))
435
476
  .concat([...text.matchAll(/\bPROFILE\s*(?:\?\?|\|\|)\s*(["'])([^"']+)\1/g)].map((m) => [m[2], m.index])));
436
477
  if (profiles.length) {
437
478
  const defined = profilesFor(root, files, dirOf(file));
@@ -1098,6 +1139,170 @@ function e2eUnderCargoTest({ root, files }) {
1098
1139
  return out;
1099
1140
  }
1100
1141
 
1142
+ // G28 (rightkit#1268, GATE-CONTRACT [GC-T19]): every pushed commit cites its issue and, for a code or behaviour change, its contract section.
1143
+ // Adrian, 2026-10-29: "No changes happen without a contract and issues on GitHub." The commits judged are the ones this push adds: those in
1144
+ // RK_PUSH_BEFORE..<commit> when CI names the push's previous tip (the plan job's preflight does), else those between the merge-base with
1145
+ // origin/main and <commit> (what a local run is about to push). A commit already on origin/main, a tree (--worktree), or a repository with no
1146
+ // origin/main and no named push range has nothing pending, so nothing is judged. The message must cite an issue (`#N`, `owner/repo#N` or a
1147
+ // GitHub issue URL); with RK_VERIFY_ISSUES=1 and a readable `gh`, each cited issue must exist. A commit that changes code or behaviour (any
1148
+ // non-documentation file) must also carry a `Contract: <file>#<section>` line naming a file of that commit whose text holds the section
1149
+ // (a bracketed clause id such as GC-A07, or a heading). The finding has no identity: a baseline cannot excuse a missing citation.
1150
+ const CITES_ISSUE = /#\d+\b|github\.com\/[\w.-]+\/[\w.-]+\/issues\/\d+/;
1151
+ const CONTRACT_LINE = /^Contract:[ \t]*(\S+?)#(\S.*?)[ \t]*$/m;
1152
+ /** `#N`, `repo#N` or `owner/repo#N` in a message (the Contract line's `file#section` is not read: its section is not a number). */
1153
+ const ISSUE_REFS = /((?:[\w.-]+\/)?[\w.-]*)#(\d+)\b/g;
1154
+ /** Files whose change is documentation, a lock or a data record, never code or behaviour: a commit of only these needs no contract line. */
1155
+ const NOT_CODE = /(?:\.(?:md|mdx|txt|lock|svg|png|jpe?g|gif|ico|webp|pdf)$|(?:^|\/)(?:docs|\.github\/ISSUE_TEMPLATE)\/|(?:^|\/)(?:CHANGELOG|README|LICENSE[^/]*|NOTICE|CODEOWNERS|INDEX)(?:\.[a-z]+)?$|(?:^|\/)(?:pnpm-lock\.yaml|package-lock\.json|Cargo\.lock|Package\.resolved)$)/i;
1156
+
1157
+ /** The non-merge commits this push adds (oldest first), or [] when none are pending or there is no anchor. */
1158
+ function pendingCommits(repo, commit, env = process.env) {
1159
+ try {
1160
+ if (git(["cat-file", "-t", commit], { cwd: repo }).trim() !== "commit") return [];
1161
+ const named = String(env.RK_PUSH_BEFORE ?? "").trim();
1162
+ let base = null;
1163
+ if (/^[0-9a-f]{40,64}$/.test(named) && !/^0+$/.test(named)) { try { git(["cat-file", "-e", `${named}^{commit}`], { cwd: repo }); base = named; } catch { base = null; } }
1164
+ base ??= git(["merge-base", commit, "origin/main"], { cwd: repo }).trim();
1165
+ if (!base) return [];
1166
+ return git(["rev-list", "--no-merges", "--reverse", `${base}..${commit}`], { cwd: repo }).split("\n").filter(Boolean);
1167
+ } catch { return []; }
1168
+ }
1169
+
1170
+ /** The `gh` reading of one cited issue: null when it exists, else why not. Only asked when RK_VERIFY_ISSUES=1. */
1171
+ function issueMissing(ref, repoFallback, env) {
1172
+ // `owner/repo#N` names its repository; `repo#N` borrows the owner of GITHUB_REPOSITORY; `#N` is that repository.
1173
+ const owner = String(repoFallback ?? "").split("/")[0];
1174
+ const slug = ref.repo.includes("/") ? ref.repo : ref.repo && owner ? `${owner}/${ref.repo}` : ref.repo ? "" : String(repoFallback ?? "");
1175
+ if (!slug) return `${ref.repo}#${ref.number}: no repository to look it up in (set GITHUB_REPOSITORY)`;
1176
+ const r = spawnSync("gh", ["api", `repos/${slug}/issues/${ref.number}`, "--jq", ".number"], { encoding: "utf8", env: gitEnv(env.GH_TOKEN ? { GH_TOKEN: env.GH_TOKEN } : {}), timeout: 30_000 });
1177
+ return !r.error && r.status === 0 && String(r.stdout).trim() === String(ref.number) ? null : `${slug}#${ref.number} could not be read on GitHub (it must exist)`;
1178
+ }
1179
+
1180
+ function commitCitations({ repo, commit, env = process.env }) {
1181
+ const out = [];
1182
+ const verify = env.RK_VERIFY_ISSUES === "1";
1183
+ for (const sha of pendingCommits(repo, commit, env)) {
1184
+ const message = git(["log", "-1", "--format=%B", sha], { cwd: repo });
1185
+ const subject = message.split("\n", 1)[0].slice(0, 90);
1186
+ const add = (problem, fix) => out.push({ problem: `commit ${sha.slice(0, 12)} (${subject}) ${problem}`, fix });
1187
+ const issues = [...message.matchAll(ISSUE_REFS)].map((m) => ({ repo: m[1], number: m[2] }));
1188
+ if (!CITES_ISSUE.test(message)) { add("cites no issue", "add the issue it serves to the message: `#N` (this repository) or `owner/repo#N`; file the issue first if none exists"); continue; }
1189
+ if (verify) for (const ref of issues) { const why = issueMissing(ref, env.GITHUB_REPOSITORY, env); if (why) add(`cites an issue that does not resolve: ${why}`, "cite an existing issue of the owning repository"); }
1190
+ const files = git(["diff-tree", "-r", "--root", "--no-commit-id", "--name-only", "-z", sha], { cwd: repo }).split("\0").filter(Boolean);
1191
+ if (!files.some((f) => !NOT_CODE.test(f))) continue;
1192
+ const cite = CONTRACT_LINE.exec(message);
1193
+ if (!cite) { add("changes code or behaviour but has no `Contract: <file>#<section>` line", "add a line `Contract: docs/<CONTRACT>.md#<clause id or heading>` naming the contract section the change serves"); continue; }
1194
+ let text = null;
1195
+ try { text = git(["cat-file", "-p", `${sha}:${cite[1]}`], { cwd: repo }); } catch { text = null; }
1196
+ const section = cite[2];
1197
+ const slug = (h) => h.toLowerCase().replace(/[^\p{L}\p{N}\s_-]/gu, "").trim().replace(/\s+/g, "-");
1198
+ const found = text !== null && (text.includes(`[${section}]`) || text.split("\n").some((l) => /^#{1,6}\s/.test(l) && (slug(l.replace(/^#{1,6}\s+/, "")) === section.toLowerCase() || l.replace(/^#{1,6}\s+/, "").trim() === section)));
1199
+ if (text === null) add(`cites the contract file ${cite[1]}, which that commit does not hold`, "name a contract file of the repository");
1200
+ else if (!found) add(`cites ${cite[1]}#${section}, but that file has no clause [${section}] or heading of that name`, "name an existing clause id (as written in brackets, e.g. GC-A07) or heading of the contract file");
1201
+ }
1202
+ return out;
1203
+ }
1204
+
1205
+ // G23 (rightkit#1221): no scratch checkout. Adrian's standing rule: no worktree, clone or branch for a build; the primary checkout, warm cache,
1206
+ // one build per host. The release canary cloned every app twice per run and ran cold, and nobody caught it because the rule was prose. A script
1207
+ // under scripts/ (any directory of that name, so an app's too), packages/release/ or ci/ must not invoke `git clone`, `git worktree add`, a
1208
+ // checkout into a path outside the repository (`checkout-index --prefix=<dir>`, `--work-tree=<dir> checkout`), or `git archive` in a file that
1209
+ // also runs a build, test, install, check, clippy, run or pack command (the extracted tree is built). A file may be named in the repository's own
1210
+ // ci/gate.config.json `scratchCheckoutAllowlist`: [{ "file", "issue", "reason" }], each with an issue link and a reason. Test fixtures under
1211
+ // ci/consumers are exempt as fixtures. A call is read from its literal argument list on one line (`"git", [..., "clone"`, `git(repo, "clone"`,
1212
+ // `git clone` in a shell script); comments are not read.
1213
+ const SCRATCH_SCOPE = /(^|\/)scripts\/|^packages\/release\/|^ci\//;
1214
+ const SCRATCH_FIXTURES = /^ci\/consumers\//;
1215
+ const SCRATCH_SCRIPT = /\.(?:sh|bash|zsh|ps1|psm1|bat|cmd|mjs|cjs|js|py)$/i;
1216
+ const gitVerb = (verb) => new RegExp(`(?:["']git["']\\s*,\\s*\\[[^\\]\\n]*["']${verb}["']|\\bgit\\s*\\([^\\n]*?["']${verb}["']|(?:^|[\\s;&|(])git\\s+(?:-\\S+\\s+)*${verb}\\b)`);
1217
+ const SCRATCH_CLONE = gitVerb("clone");
1218
+ const SCRATCH_ARCHIVE = gitVerb("archive");
1219
+ const SCRATCH_WORKTREE = /(?:["']git["']\s*,\s*\[[^\]\n]*["']worktree["']\s*,\s*["']add["']|\bgit\s*\([^\n]*?["']worktree["']\s*,\s*["']add["']|(?:^|[\s;&|(])git\s+(?:-\S+\s+)*worktree\s+add\b)/;
1220
+ const SCRATCH_OUTSIDE = new RegExp(`checkout-${"index"}\\b[^\\n]*--${"prefix"}|--work-tree[^\\n]*["'\\s]checkout["'\\s]|["']checkout["'][^\\n]*--work-tree`);
1221
+ const SCRATCH_BUILD = /["'](?:cargo|pnpm|npm|xcodebuild|swift|tauri)["']\s*,\s*\[[^\]\n]*["'](?:build|test|install|check|clippy|run|pack)["']|\b(?:cargo|pnpm|npm)\s+(?:build|test|install|check|clippy|run)\b/;
1222
+ /** A script line without its comment: a whole-line `//`, `#`, `*` or `/*` comment is blank, and so is a trailing ` // ...`. */
1223
+ const codeLine = (line) => (/^\s*(?:\/\/|#|\*|\/\*)/.test(line) ? "" : line.replace(/\s\/\/\s.*$/, ""));
1224
+ const SCRATCH_FIX = "build in the primary checkout through the gate (one warm build per app per host); if the file is the gate's own export, add it to scratchCheckoutAllowlist in ci/gate.config.json with its issue link and reason";
1225
+
1226
+ function scratchCheckout({ root, files }) {
1227
+ const out = [];
1228
+ const allowed = new Set();
1229
+ const list = readJson(root, "ci/gate.config.json")?.scratchCheckoutAllowlist;
1230
+ if (list !== undefined) {
1231
+ if (!Array.isArray(list)) out.push({ file: "ci/gate.config.json", subject: "allowlist", problem: "ci/gate.config.json scratchCheckoutAllowlist must be a list of { file, issue, reason }", fix: 'write [{ "file": "<path>", "issue": "<owner/repo#N>", "reason": "<why>" }]' });
1232
+ else list.forEach((entry, i) => {
1233
+ const ok = entry && typeof entry === "object" && typeof entry.file === "string" && entry.file && typeof entry.issue === "string" && ISSUE_LINK.test(entry.issue) && typeof entry.reason === "string" && entry.reason.trim();
1234
+ if (ok) allowed.add(entry.file);
1235
+ else out.push({ file: "ci/gate.config.json", subject: `allowlist[${i}]`, problem: `ci/gate.config.json scratchCheckoutAllowlist[${i}] needs a file, an issue link (#N, owner/repo#N or a GitHub issue URL) and a non-empty reason`, fix: "give the entry its issue link and reason, or remove it" });
1236
+ });
1237
+ }
1238
+ for (const file of files) {
1239
+ if (!scanned(file) || !SCRATCH_SCOPE.test(file) || SCRATCH_FIXTURES.test(file) || !SCRATCH_SCRIPT.test(file) || allowed.has(file)) continue;
1240
+ const text = readText(root, file);
1241
+ if (text === null) continue;
1242
+ const lines = text.split("\n").map(codeLine);
1243
+ const hit = (re) => lines.findIndex((l) => re.test(l)) + 1;
1244
+ const report = (kind, line, what) => out.push({ file, subject: kind, problem: `${file}:${line} ${what}`, fix: SCRATCH_FIX });
1245
+ let at;
1246
+ if ((at = hit(SCRATCH_CLONE))) report("git-clone", at, "runs `git clone`: a clone is a cold, separate checkout (Adrian: no clone, worktree or branch for a build; primary checkout, warm cache)");
1247
+ if ((at = hit(SCRATCH_WORKTREE))) report("git-worktree", at, "runs `git worktree add`: a worktree is a second checkout (Adrian: no clone, worktree or branch for a build)");
1248
+ if ((at = hit(SCRATCH_OUTSIDE))) report("git-checkout-outside", at, "checks files out into a path outside the repository (an index checkout with a prefix directory, or a separate --work-tree)");
1249
+ if ((at = hit(SCRATCH_ARCHIVE)) && hit(SCRATCH_BUILD)) report("git-archive-then-build", at, `runs \`git archive\` and, in the same file (line ${hit(SCRATCH_BUILD)}), a build, test, install, check, clippy, run or pack command: the extracted tree is built cold`);
1250
+ }
1251
+ return out;
1252
+ }
1253
+
1254
+ // G24 (rightkit#1476, decided in #1472): RightKit's own packages are published from the local route without provenance, and an owned package
1255
+ // is exempt from the provenance requirement exactly as it is from the 24-hour age wait. Where an app turns on pnpm `trustPolicy: no-downgrade`,
1256
+ // the one sanctioned exemption is the name selector `@rightkit/*` in `trustPolicyExclude` (pnpm 11.12 parses trustPolicyExclude with the same
1257
+ // createPackageVersionPolicy as minimumReleaseAgeExclude, which already takes `@rightkit/*`), written by the consumer generator
1258
+ // (scripts/ci/npm-recipe-consumer.mjs). A per-version entry (`@rightkit/release@0.6.27 || 0.6.28 || 0.6.28`, hand-written, and already garbled
1259
+ // in apps), a single exact version, a bare package name or a repeated selector is refused. Read from pnpm-workspace.yaml and package.json `pnpm`.
1260
+ export const FIRST_PARTY_TRUST_POLICY_EXCLUDE = "@rightkit/*";
1261
+
1262
+ /** The scalar items of a top-level YAML list `key` (block or flow form), with their 1-based lines, or null when the key is absent. */
1263
+ function yamlTopList(text, key) {
1264
+ const lines = String(text ?? "").split(/\r?\n/);
1265
+ const keyed = new RegExp(`^${key}\\s*:`);
1266
+ const at = lines.findIndex((l) => keyed.test(l));
1267
+ if (at < 0) return null;
1268
+ const unquote = (s) => { const t = s.trim().replace(/\s+#.*$/, ""); const m = /^(["'])(.*)\1$/.exec(t); return m ? m[2] : t; };
1269
+ const rest = lines[at].slice(lines[at].indexOf(":") + 1).replace(/\s+#.*$/, "").trim();
1270
+ const items = [];
1271
+ if (rest.startsWith("[")) {
1272
+ let flow = rest;
1273
+ for (let i = at + 1; !flow.includes("]") && i < lines.length; i++) flow += ` ${lines[i].trim()}`;
1274
+ const end = flow.indexOf("]");
1275
+ for (const item of flow.slice(1, end < 0 ? undefined : end).split(",")) if (unquote(item)) items.push({ value: unquote(item), line: at + 1 });
1276
+ return items;
1277
+ }
1278
+ for (let i = at + 1; i < lines.length; i++) {
1279
+ if (!lines[i].trim() || /^\s*#/.test(lines[i])) continue;
1280
+ const m = /^\s*-\s+(.*)$/.exec(lines[i]);
1281
+ if (!m) break;
1282
+ if (unquote(m[1])) items.push({ value: unquote(m[1]), line: i + 1 });
1283
+ }
1284
+ return items;
1285
+ }
1286
+
1287
+ function trustPolicyExclude({ root, files }) {
1288
+ const out = [];
1289
+ for (const file of files) {
1290
+ if (!scanned(file)) continue;
1291
+ let items = null;
1292
+ if (/(^|\/)pnpm-workspace\.ya?ml$/.test(file)) items = yamlTopList(readText(root, file), "trustPolicyExclude");
1293
+ else if (/(^|\/)package\.json$/.test(file)) { const v = readJson(root, file)?.pnpm?.trustPolicyExclude; items = Array.isArray(v) ? v.filter((x) => typeof x === "string").map((value) => ({ value, line: 1 })) : null; }
1294
+ if (!items) continue;
1295
+ let sanctioned = 0;
1296
+ for (const { value, line } of items) {
1297
+ if (!/^\s*@rightkit/.test(value)) continue;
1298
+ if (value.trim() === FIRST_PARTY_TRUST_POLICY_EXCLUDE && ++sanctioned === 1) continue;
1299
+ const again = value.trim() === FIRST_PARTY_TRUST_POLICY_EXCLUDE;
1300
+ out.push({ file, subject: `${again ? "repeat:" : ""}${value.trim().slice(0, 100)}`, problem: `${file}:${line} trustPolicyExclude entry ${JSON.stringify(value)} ${again ? "repeats the sanctioned selector" : `is not the sanctioned form "${FIRST_PARTY_TRUST_POLICY_EXCLUDE}"`}: a per-version or per-name entry for an owned package is refused (rightkit#1476; owned packages carry no provenance requirement, rightkit#1472)`, fix: `replace every @rightkit entry of trustPolicyExclude with the single generated selector ${JSON.stringify(FIRST_PARTY_TRUST_POLICY_EXCLUDE)} (scripts/ci/npm-recipe-consumer.mjs writes it)` });
1301
+ }
1302
+ }
1303
+ return out;
1304
+ }
1305
+
1101
1306
  export const RULES = Object.freeze([
1102
1307
  { id: "eol-policy", gap: "G04", run: eolPolicy },
1103
1308
  { id: "file-url", gap: "G12", run: fileUrls },
@@ -1112,6 +1317,9 @@ export const RULES = Object.freeze([
1112
1317
  { id: "switches-inventory", gap: "G20", run: switchesInventory },
1113
1318
  { id: "speech-link", gap: "G21", run: speechLink },
1114
1319
  { id: "e2e-under-cargo-test", gap: "G22", run: e2eUnderCargoTest },
1320
+ { id: "scratch-checkout", gap: "G23", run: scratchCheckout },
1321
+ { id: "trust-policy-exclude", gap: "G24", run: trustPolicyExclude },
1322
+ { id: "commit-citations", gap: "G28", run: ({ repo, commit }) => commitCitations({ repo, commit }) },
1115
1323
  { id: "suite-key-literal", gap: "C3-04", run: ({ root, files }) => suiteKeyLiteral(root, files) },
1116
1324
  { id: "suite-updater-key", gap: "C3-14", run: ({ root, files }) => suiteUpdaterKey(root, files) },
1117
1325
  { id: "engine-record-store", gap: "C3-05", run: ({ root, files }) => engineRecordStore(root, files) },
@@ -1137,6 +1345,8 @@ export const TIERS = Object.freeze(["compile", "release"]);
1137
1345
  export const COMPILE_TIER_IDS = Object.freeze(new Set([
1138
1346
  "eol-policy", "file-url", "retired-alias", "qa-platform", "test-harness", "scenario-skip", "release-config", "skip-checks",
1139
1347
  "qa-dev-server", "ffmpeg-release-escape", "switches-inventory", "speech-link", "e2e-under-cargo-test",
1348
+ // rightkit#1221 asks for a compile-tier rule: the primary-checkout rule is Adrian's standing one, and a script that clones is refused before any compile.
1349
+ "scratch-checkout",
1140
1350
  ]));
1141
1351
  /** The tier a rule runs from: compile for the 0.6.6 set, release for everything added since. */
1142
1352
  export const tierOf = (rule) => (COMPILE_TIER_IDS.has(rule.id) ? "compile" : "release");
@@ -1269,12 +1479,69 @@ export function runRules({ root, commit, files, repo = process.cwd(), only = nul
1269
1479
  export const APP_BASELINE_FILE = ".rightkit/app-check-baseline.json";
1270
1480
  export const CENTRAL_BASELINE_FILE = "ci/app-check-baseline.json";
1271
1481
 
1272
- /** The identities RightKit's central baseline lists for `repoKey`; throws on a file that is not { known: { <key>: [string] } }. */
1273
- export function baselineKnown(text, repoKey) {
1482
+ /**
1483
+ * The entries RightKit's central baseline lists for `repoKey`, as [{ id, issue?, approvedBy? }]; throws on a file that is not
1484
+ * { known: { <key>: [entry] } }. An entry is an identity string (the original form: it carries no approver) or { id, issue, approvedBy }
1485
+ * (the form an entry added since the merge-base with origin/main must take: see baselineGrowth, rightkit#1251).
1486
+ */
1487
+ export function baselineKnownEntries(text, repoKey) {
1274
1488
  if (text === null) return [];
1275
1489
  const known = JSON.parse(text)?.known;
1276
- if (!known || typeof known !== "object" || Array.isArray(known) || !Object.values(known).every((v) => Array.isArray(v) && v.every((id) => typeof id === "string"))) throw new Error('expected { "known": { "<repo>": ["<identity>", ...] } }');
1277
- return known[repoKey] ?? [];
1490
+ const entryOk = (e) => typeof e === "string" || (e && typeof e === "object" && !Array.isArray(e) && typeof e.id === "string" && (e.issue === undefined || typeof e.issue === "string") && (e.approvedBy === undefined || typeof e.approvedBy === "string"));
1491
+ if (!known || typeof known !== "object" || Array.isArray(known) || !Object.values(known).every((v) => Array.isArray(v) && v.every(entryOk))) throw new Error('expected { "known": { "<repo>": ["<identity>" | { "id": "<identity>", "issue": "<repo#number>", "approvedBy": "<person>" }, ...] } }');
1492
+ return (known[repoKey] ?? []).map((e) => (typeof e === "string" ? { id: e } : { id: e.id, issue: e.issue, approvedBy: e.approvedBy }));
1493
+ }
1494
+
1495
+ /** The identities RightKit's central baseline lists for `repoKey`; throws on a file that is not { known: { <key>: [entry] } }. */
1496
+ export const baselineKnown = (text, repoKey) => baselineKnownEntries(text, repoKey).map((e) => e.id);
1497
+
1498
+ // Baseline growth (rightkit#1251): an entry added since the merge-base with origin/main is a new silence, and a silence needs an
1499
+ // anchor that is not the finding's own author: the person who approved it and the issue that tracks it.
1500
+ /** An issue reference an added entry may cite: #N, repo#N, owner/repo#N, or a GitHub issue URL. */
1501
+ const ISSUE_LINK = /#\d+\b|github\.com\/[\w.-]+\/[\w.-]+\/(?:issues|pull)\/\d+/;
1502
+ /** Names that are agents, not a person: an agent cannot approve its own baseline entry. */
1503
+ const AGENT_APPROVER = /^\s*(?:claude|codex|legion|agent|ai|bot|orchestrator|oracle|sage|alchemist|gpt|assistant|copilot)\b/i;
1504
+ export const BASELINE_GROWTH_RULE = "a baseline entry added since the merge-base with origin/main needs approvedBy (the person who approved the silence, never an agent) and an issue link (#N, owner/repo#N or a GitHub issue URL)";
1505
+
1506
+ /**
1507
+ * The baseline file as it stood at the merge-base of `rev` and origin/main, read from the git repository at `dir`:
1508
+ * { anchor: <sha>, text: <string | null: the file did not exist there> }, or { anchor: null, why } when there is no such anchor
1509
+ * (no origin/main ref, or no common history). A tree (a captured worktree) is anchored through HEAD.
1510
+ */
1511
+ export function baselineAtMergeBase(dir, rev, file) {
1512
+ try {
1513
+ const tip = git(["cat-file", "-t", rev], { cwd: dir }).trim() === "commit" ? rev : "HEAD";
1514
+ const anchor = git(["merge-base", tip, "origin/main"], { cwd: dir }).trim();
1515
+ if (!anchor) return { anchor: null, why: "git merge-base printed nothing" };
1516
+ let text = null;
1517
+ try { text = git(["cat-file", "blob", `${anchor}:${file}`], { cwd: dir }); } catch { text = null; }
1518
+ return { anchor, text };
1519
+ } catch (error) { return { anchor: null, why: error.message.split("\n")[0] }; }
1520
+ }
1521
+
1522
+ /** The identities a baseline text lists at the merge-base: an app file's known[].id, or the central file's known[repoKey]. */
1523
+ function baselineIdsOf(text, { repoKey, app }) {
1524
+ if (text === null) return new Set();
1525
+ try {
1526
+ const known = JSON.parse(text)?.known;
1527
+ if (app) return new Set(Array.isArray(known) ? known.map((e) => e?.id).filter((id) => typeof id === "string") : []);
1528
+ return new Set(baselineKnownEntries(text, repoKey).map((e) => e.id));
1529
+ } catch { return new Set(); }
1530
+ }
1531
+
1532
+ /** The entries that grew the baseline without an approver and an issue link: [{ id, problem }]. `before` is baselineAtMergeBase's text. */
1533
+ export function baselineGrowth(entries, beforeText, { repoKey, app }) {
1534
+ const before = baselineIdsOf(beforeText, { repoKey, app });
1535
+ const out = [];
1536
+ for (const entry of entries) {
1537
+ if (before.has(entry.id)) continue;
1538
+ const missing = [];
1539
+ if (typeof entry.approvedBy !== "string" || !entry.approvedBy.trim()) missing.push("approvedBy");
1540
+ else if (AGENT_APPROVER.test(entry.approvedBy)) missing.push(`approvedBy (${JSON.stringify(entry.approvedBy)} is an agent, not a person)`);
1541
+ if (typeof entry.issue !== "string" || !ISSUE_LINK.test(entry.issue)) missing.push("an issue link");
1542
+ if (missing.length) out.push({ id: entry.id, problem: `needs ${missing.join(" and ")}` });
1543
+ }
1544
+ return out;
1278
1545
  }
1279
1546
 
1280
1547
  /** The longest an app baseline entry may stay tolerated: its sunset is at most this many days after its own `added` date. */
@@ -1315,9 +1582,10 @@ export function appBaselineEntries(text, { today = new Date().toISOString().slic
1315
1582
  if (sunset < added) throw new Error(`${at}.sunset ${sunset} is before added ${added}; ${APP_BASELINE_RULE}`);
1316
1583
  const latest = addDays(added, APP_BASELINE_MAX_DAYS);
1317
1584
  if (sunset > latest) throw new Error(`${at}.sunset ${sunset} is more than ${APP_BASELINE_MAX_DAYS} days after added ${added} (the latest is ${latest}); ${APP_BASELINE_RULE}`);
1585
+ if (entry.approvedBy !== undefined && typeof entry.approvedBy !== "string") throw new Error(`${at}.approvedBy must be the name of the person who approved ${entry.id}`);
1318
1586
  if (seen.has(entry.id)) throw new Error(`${at} repeats ${entry.id}`);
1319
1587
  seen.add(entry.id);
1320
- return { id: entry.id, issue: entry.issue, added, sunset };
1588
+ return { id: entry.id, issue: entry.issue, added, sunset, ...(entry.approvedBy !== undefined ? { approvedBy: entry.approvedBy } : {}) };
1321
1589
  });
1322
1590
  }
1323
1591
 
@@ -1358,7 +1626,7 @@ function loadBaseline({ explicit, root, central, repoKey, today }) {
1358
1626
  // any other shape): sniffing its shape would let an app write the central { known: { "<repo>": [...] } } form, which carries
1359
1627
  // no dates, and silence a finding for good.
1360
1628
  if (fromApp || (text !== null && Array.isArray(JSON.parse(text)?.known))) return { entries: appBaselineEntries(text, { today }), listedIn: `${APP_BASELINE_FILE} known`, listedFile: APP_BASELINE_FILE };
1361
- return { entries: baselineKnown(text, repoKey).map((id) => ({ id })), listedIn: `${CENTRAL_BASELINE_FILE} known["${repoKey}"]`, listedFile: CENTRAL_BASELINE_FILE };
1629
+ return { entries: baselineKnownEntries(text, repoKey), listedIn: `${CENTRAL_BASELINE_FILE} known["${repoKey}"]`, listedFile: CENTRAL_BASELINE_FILE };
1362
1630
  } catch (error) { throw Object.assign(new Error(error.message), { file }); }
1363
1631
  }
1364
1632
 
@@ -1376,8 +1644,10 @@ function loadBaseline({ explicit, root, central, repoKey, today }) {
1376
1644
  export function runAppCheck({ repo, mode = "commit", commit, only = null, baseline, printBaseline = false, rules = RULES, tier = null, label = "check", repoKey, central = rightkitCheckout(), now = new Date(), refuse = [], snapshot = null } = {}) {
1377
1645
  const lines = [];
1378
1646
  const errLines = [];
1647
+ // An ownership finding is excused only by a ratified ruling (appAmendments, with approvedBy), never by a baseline (rightkit#1299).
1648
+ refuse = [...new Set([...refuse, ...RATIFICATION_ONLY])];
1379
1649
  if (tier !== null && !TIERS.includes(tier)) { errLines.push(`${label}: --rule-tier must be compile or release, not ${JSON.stringify(tier)}`); return { findings: [], known: [], stale: [], expired: [], found: [], exitCode: 2, lines, text: "", errLines, errText: errLines.join("\n") }; }
1380
- const finish = (exitCode, extra = {}) => ({ findings: [], known: [], stale: [], expired: [], found: [], ...extra, exitCode, lines, text: lines.join("\n"), errLines, errText: errLines.join("\n") });
1650
+ const finish = (exitCode, extra = {}) => ({ findings: [], known: [], stale: [], expired: [], unapproved: [], found: [], ...extra, exitCode, lines, text: lines.join("\n"), errLines, errText: errLines.join("\n") });
1381
1651
  const unknown = only?.filter((id) => !rules.some((r) => r.id === id)) ?? [];
1382
1652
  if (unknown.length) { errLines.push(`${label}: unknown rule(s): ${unknown.join(", ")} (see --list)`); return finish(2); }
1383
1653
  // --only is a view over the whole set. Otherwise the tier decides which rules run: the compile tier by default over the registry, or
@@ -1436,17 +1706,29 @@ export function runAppCheck({ repo, mode = "commit", commit, only = null, baseli
1436
1706
  const fresh = [...applied.fresh.map((f) => (f.identity && lapsed.has(f.identity) ? { ...f, problem: `${f.problem} (its baseline entry expired: sunset ${lapsed.get(f.identity).sunset}; ${APP_BASELINE_EXPIRY_RULE})` } : f)), ...refused];
1437
1707
  const known = applied.known.filter((f) => !refuse.includes(f.rule));
1438
1708
  const { stale } = applied;
1709
+ // Growth (rightkit#1251): an entry added since the merge-base with origin/main needs approvedBy and an issue link. An explicit
1710
+ // --baseline file is a caller's own and has no anchor; the app's file is anchored in the checked repository, the central file in
1711
+ // the RightKit checkout. With no origin/main to anchor to, the run says so rather than pass silently.
1712
+ let unapproved = [];
1713
+ if (!baseline && listed.entries.length) {
1714
+ const app = listed.listedFile === APP_BASELINE_FILE;
1715
+ const dir = app ? repo : central;
1716
+ const anchored = dir ? baselineAtMergeBase(dir, app ? checked : "HEAD", listed.listedFile) : { anchor: null, why: "no RightKit checkout holds the central baseline" };
1717
+ if (anchored.anchor === null) lines.push(`NOTE baseline growth was not checked: no merge-base with origin/main (${anchored.why}); ${BASELINE_GROWTH_RULE}`);
1718
+ else unapproved = baselineGrowth(listed.entries, anchored.text, { repoKey: key, app }).map((g) => ({ ...g, anchor: anchored.anchor }));
1719
+ }
1439
1720
  for (const f of fresh) {
1440
1721
  lines.push(`FAIL ${f.rule} (${f.gap}): ${f.problem}`);
1441
1722
  if (f.fix) lines.push(` fix: ${f.fix}`);
1442
1723
  }
1443
1724
  for (const f of known) lines.push(`KNOWN ${f.rule}: ${f.problem}`);
1444
1725
  for (const id of stale) lines.push(`STALE baseline entry ${id}: no longer found in ${key}; remove it from ${listed.listedIn}`);
1726
+ for (const g of unapproved) lines.push(`UNAPPROVED baseline entry ${g.id}: added since the merge-base with origin/main (${g.anchor.slice(0, 12)}) and ${g.problem}; ${BASELINE_GROWTH_RULE}; or fix the finding and drop the entry from ${listed.listedIn}`);
1445
1727
  for (const e of expired) lines.push(`EXPIRED baseline entry ${e.id}: sunset ${e.sunset} has passed (${e.issue}); ${APP_BASELINE_EXPIRY_RULE}${e.added ? ` (${e.added})` : ""}; fix the finding and remove the entry from ${listed.listedIn}`);
1446
1728
  const ruleCount = only ? only.length : rules.length;
1447
1729
  const seconds = ((Date.now() - started) / 1000).toFixed(1);
1448
- const problems = fresh.length + stale.length + expired.length;
1449
- const result = { findings: fresh, known, stale, expired, found };
1730
+ const problems = fresh.length + stale.length + expired.length + unapproved.length;
1731
+ const result = { findings: fresh, known, stale, expired, unapproved, found };
1450
1732
  if (problems) {
1451
1733
  lines.push(`${label}: ${problems} problem(s) in ${checked.slice(0, 12)} (${ruleCount} rules, ${tierLabel}, ${seconds}s${known.length ? `, ${known.length} known` : ""}). Each would refuse later in CI or publication; fix and commit, then push.`);
1452
1734
  return finish(1, result);
@@ -1475,8 +1757,8 @@ export const CHECKED_COMMANDS = new Map([
1475
1757
  ["release", "commit"], ["build", "commit"], ["package", "commit"], ["dev", "worktree"], ["qa", "commit"], ["upload", "commit"],
1476
1758
  ["publish", "commit"], ["publish-update", "commit"], ["github", "commit"], ["doctor", "worktree"],
1477
1759
  ["sign-windows", "commit"], ["sign-updater", "commit"], ["create-mac-updater", "commit"],
1478
- ["test", "worktree"], ["web-build", "commit"], ["swift-package", "commit"], ["recipe-build", "commit"], ["assemble-app", "commit"], ["stage-sidecar", "worktree"], ["sign-candidate", "commit"],
1479
- ["addon build", "commit"], ["sign-dev-artifact", "worktree"],
1760
+ ["test", "worktree"], ["web-build", "commit"], ["swift-package", "commit"], ["recipe-build", "commit"], ["assemble-app", "commit"], ["stage-sidecar", "worktree"], ["stage-xcframework", "worktree"], ["sign-candidate", "commit"],
1761
+ ["addon build", "commit"], ["sign-dev-artifact", "worktree"], ["direct-release finalize", "commit"],
1480
1762
  ]);
1481
1763
 
1482
1764
  /** The key of CHECKED_COMMANDS an invocation matches, or null: `<command> <subcommand>` when that pair is listed, else the command. */
@@ -1491,9 +1773,13 @@ export function checkedCommandOf(args) {
1491
1773
  * says (no switches inventory: the release-switches scan has nothing to prove against), so tolerating one only moves the failure
1492
1774
  * minutes into the build. */
1493
1775
  export const BUILD_REFUSES = Object.freeze(["switches-inventory"]);
1776
+ /** Rules no baseline excuses at any door (rightkit#1299, GATE-CONTRACT [GC-T19]): an ownership finding (OW-05, OW-06) is excused only by a
1777
+ * ratified ruling in RightKit (appAmendments.<app> in ownership-mandatory-set.json, each entry with approvedBy), the only path to an app's
1778
+ * exception ledger being accepted. Both are release-tier rules: the dev and test doors do not run them, qualify and release do. */
1779
+ export const RATIFICATION_ONLY = Object.freeze(["mandatory-foundation", "ownership-exceptions"]);
1494
1780
 
1495
1781
  /** The checked commands that qualify, sign, ship or upload: they owe the release tier (every rule). The rest owe the compile tier. */
1496
- export const RELEASE_TIER_COMMANDS = Object.freeze(new Set(["release", "upload", "publish", "publish-update", "github", "sign-windows", "sign-updater", "create-mac-updater", "sign-candidate"]));
1782
+ export const RELEASE_TIER_COMMANDS = Object.freeze(new Set(["release", "upload", "publish", "publish-update", "github", "sign-windows", "sign-updater", "create-mac-updater", "sign-candidate", "direct-release finalize"]));
1497
1783
  /** `qa --stage installed` qualifies the sealed build and owes the release tier; any other `qa` stage owes the compile tier (`qa --stage source` is refused, GATE-CONTRACT GC-A07). */
1498
1784
  export const tierForCommand = (name, args = []) => (name === "qa" ? (args.includes("installed") ? "release" : "compile") : RELEASE_TIER_COMMANDS.has(name) ? "release" : "compile");
1499
1785
 
@@ -1536,6 +1822,7 @@ export const UNCHECKED_COMMANDS = new Map([
1536
1822
  ["qualify", "qualifies RightKit crates; preflight and the hosted scans check RightKit"],
1537
1823
  ["inventory", "reports registry drift"],
1538
1824
  ["model", "promotes a runtime model artifact"],
1825
+ ["provision-model", "fetches the pinned model bytes a config declares into its resource directory and verifies each against its pin; reads no app source and compiles nothing"],
1539
1826
  ["addon", "every form but `addon build` (which is checked) compiles nothing: doctor validates the config, upload ships only what `addon build` sealed at HEAD, adopt verifies a downloaded add-on against a lock"],
1540
1827
  ["lsclean", "host LaunchServices cleanup"],
1541
1828
  ["generate-dmg-background", "generates an image"],
package/app-closure.mjs CHANGED
@@ -179,11 +179,11 @@ export function scopeScans(scans, closure, { rustUnits = [], npmUnits = [] } = {
179
179
  const closureWorkspaces = new Set(rustUnits.filter((u) => closure.rust.has(u.name)).map((u) => cleanWorkspace(u.cargoDir)));
180
180
  const kept = []; const dropped = [];
181
181
  for (const s of scans) {
182
- const npm = /^(?:tsc|eslint|biome|test:npm):(.+)$/.exec(s.id);
182
+ const npm = /^(?:tsc|eslint|biome|oxlint|test:npm):(.+)$/.exec(s.id);
183
183
  // A cross-target scan id ends in `@<target triple>` (clippy:<crate>@aarch64-apple-darwin, cross-targets.mjs); a crate name never contains `@`.
184
184
  const rust = /^(?:clippy|check|check-features|check-dependent|doc|test:rust|test:rust-serial):(.+)$/.exec(s.id);
185
185
  const cargoList = CARGO_PACKAGE_LIST.exec(s.id);
186
- let include = true;
186
+ let include = true; let narrowed = null;
187
187
  if (s.internal === "refuse" && s.unit?.npm) include = closure.npm.has(s.unit.npm);
188
188
  else if (npm) include = closure.npm.has(npm[1]);
189
189
  else if (cargoList) {
@@ -192,6 +192,8 @@ export function scopeScans(scans, closure, { rustUnits = [], npmUnits = [] } = {
192
192
  }
193
193
  else if (CARGO_WORKSPACE_SCAN.test(s.id)) include = closureWorkspaces.has(cleanWorkspace(s.cwd));
194
194
  else if (/^pnpm-(?:lockfile|audit)(?::.+)?$/.test(s.id)) include = closureNpmRoots.has(cleanWorkspace(s.cwd));
195
+ else if (s.id === "feature-coverage") { const crates = (s.crates ?? []).filter((c) => closure.rust.has(c.name)); include = crates.length > 0; narrowed = { ...s, crates }; }
196
+ else if (/^ghsa-audit(?::.+)?$/.test(s.id)) include = closureWorkspaces.has(cleanWorkspace(s.cwd));
195
197
  else if (/^cargo-/.test(s.id)) throw problem(`executing scan ${s.id} has no exact scope owner`);
196
198
  else if (Array.isArray(s.batch?.units)) {
197
199
  const selected = s.batch.units.filter((n) => closure.rust.has(n));
@@ -201,13 +203,13 @@ export function scopeScans(scans, closure, { rustUnits = [], npmUnits = [] } = {
201
203
  include = selected.length === s.batch.units.length;
202
204
  }
203
205
  else if (rust) { const owner = rust[1].replace(/@[^@:]+$/, ""); const name = names.find((n) => owner === n || owner.startsWith(`${n}:`)); if (!name) throw problem(`scan ${s.id} has no known Rust owner`); include = closure.rust.has(name); }
204
- else if (s.class === "B" || ["suite-api", "generated-docs", "test:scripts-ci"].includes(s.id)) include = closure.dirs.includes(".");
206
+ else if (s.class === "B" || /^swift-typecheck(?::.+)?$/.test(s.id) || ["suite-api", "generated-docs"].includes(s.id)) include = closure.dirs.includes(".");
205
207
  else if (s.executes === true || s.kind === "test") {
206
208
  if (closure.dirs.includes(".")) include = true;
207
209
  else if (typeof s.cwd === "string") include = closure.dependencyDirs.includes(s.cwd);
208
210
  else throw problem(`executing scan ${s.id} has no exact scope owner`);
209
211
  }
210
- const row = include && Array.isArray(s.tscWorkspace) ? { ...s, tscWorkspace: s.tscWorkspace.filter((d) => closure.dependencyDirs.includes(d)) } : s;
212
+ const row = include && narrowed ? narrowed : include && Array.isArray(s.tscWorkspace) ? { ...s, tscWorkspace: s.tscWorkspace.filter((d) => closure.dependencyDirs.includes(d)) } : s;
211
213
  (include ? kept : dropped).push(row);
212
214
  }
213
215
  return { scans: kept, dropped };