@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.
- package/README.md +110 -11
- package/admission-files.mjs +40 -0
- package/admission-host.mjs +2 -1
- package/app-check.mjs +303 -16
- package/app-closure.mjs +6 -4
- package/bin/rightkit-gate.mjs +177 -32
- package/cargo-contract.mjs +17 -31
- package/cargo-license-notices.mjs +129 -19
- package/cargo-target-shim.mjs +14 -0
- package/carried-cargo.mjs +2 -4
- package/cli/right-release.mjs +24 -2
- package/cross-targets.mjs +24 -0
- package/deterministic-scans.mjs +167 -58
- package/development-signing.mjs +25 -2
- package/development.mjs +34 -1
- package/direct-release-command.mjs +154 -0
- package/disk-policy.mjs +16 -0
- package/feature-coverage.mjs +134 -0
- package/gate-coverage.mjs +38 -0
- package/gate-stages.mjs +1 -0
- package/ghsa-audit.mjs +95 -0
- package/install-app.mjs +33 -5
- package/install-channels.mjs +301 -0
- package/interactive-session-run.mjs +105 -0
- package/legal-contract.mjs +10 -1
- package/legion-freeze-consumer.mjs +241 -0
- package/linux-publish.mjs +136 -0
- package/local-publish.mjs +31 -7
- package/nsis-pack.mjs +95 -0
- package/nsis-upgrade-template.mjs +93 -0
- package/outdated-command.mjs +19 -0
- package/ownership-class-rules.mjs +32 -10
- package/ownership-mandatory-set.json +23 -0
- package/ownership-mandatory-set.mjs +66 -8
- package/package-recipe-targets.mjs +54 -19
- package/package.json +1 -1
- package/payload-root-install.mjs +123 -0
- package/plugin-delivery.mjs +141 -0
- package/prebuild-gates.mjs +8 -4
- package/preflight.mjs +6 -1
- package/provision-model-bundle.mjs +172 -0
- package/pub-upload.mjs +1 -1
- package/publish-local-npm.mjs +34 -9
- package/publish-retention.mjs +106 -0
- package/publish-update.mjs +15 -8
- package/qa-build-features.mjs +24 -15
- package/qa-contract.mjs +5 -6
- package/qa-control-scan.mjs +14 -0
- package/qa-web-pairing.mjs +76 -0
- package/r2-s3-multipart.mjs +190 -0
- package/r2-verified-upload.mjs +28 -16
- package/recipe-build.mjs +53 -3
- package/release-checks.mjs +53 -2
- package/release-config.mjs +8 -3
- package/release-invocation.mjs +12 -2
- package/release-pin-floor.mjs +44 -0
- package/release-qa-audit.mjs +18 -2
- package/release-qa-command.mjs +17 -1
- package/release-qa-policy.mjs +30 -3
- package/release-switch-cfg.mjs +271 -0
- package/release-switch-registry.json +60 -1
- package/release-switch-scan.mjs +398 -23
- package/release.mjs +97 -6
- package/render-views.mjs +141 -0
- package/rightkit-registry-resolver.mjs +1 -1
- package/rightkit-versions.json +568 -491
- package/runtime-artifact-manifest.mjs +9 -0
- package/runtime-manifest-refresh.mjs +88 -0
- package/rustright-stage.mjs +197 -0
- package/scan-digest.mjs +15 -9
- package/scan-tool-enrolment.mjs +1 -1
- package/security-policy.mjs +196 -0
- package/shell-contract.mjs +32 -0
- package/snapshot-broker.mjs +8 -1
- package/snapshot-check.mjs +58 -0
- package/snapshot-request.mjs +25 -2
- package/stage-commands.mjs +33 -4
- package/stage-ledger.mjs +6 -1
- package/stage-receipt.mjs +115 -0
- package/stage-sidecar.mjs +188 -17
- package/stage-xcframework.mjs +118 -0
- package/suite-api.generated.mjs +16 -1
- package/unit-gate.mjs +14 -2
- package/upload-large.mjs +4 -4
- package/upload-release.mjs +6 -0
- package/win-package-recipe.mjs +26 -4
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The default NSIS in-place-upgrade template (rightkit#753): `right-release nsis-template --from <Tauri stock installer.nsi> --out <file>`.
|
|
3
|
+
//
|
|
4
|
+
// nsis-upgrade-contract.mjs refuses a Windows release whose NSIS template has no automatic in-place upgrade. Every app used to copy the
|
|
5
|
+
// same two edits into its own copy of Tauri's stock `installer.nsi`. This derives that template from the stock file instead, with
|
|
6
|
+
// exactly those two edits, and fails closed (writes nothing) when the stock file no longer has the text the edits anchor on:
|
|
7
|
+
// 1. `!define RIGHTKIT_AUTOMATIC_IN_PLACE_UPGRADE` ahead of the first `!include MUI2.nsh`;
|
|
8
|
+
// 2. in `Function PageReinstall`, right after `nsis_tauri_utils::SemverCompare "${VERSION}" $R0` / `Pop $R0`, the skip block that aborts the
|
|
9
|
+
// reinstall page for a same-version repair and an in-place upgrade (the `$WixMode = 0` and `$R0 >= 0` shape the contract accepts).
|
|
10
|
+
// The derived text is then judged by the contract's own regular expressions (`templateContractShape`, the same two the contract uses), so a
|
|
11
|
+
// template that does not satisfy it is never written.
|
|
12
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
import { pathToFileURL } from "node:url";
|
|
15
|
+
|
|
16
|
+
export const IN_PLACE_DEFINE = "!define RIGHTKIT_AUTOMATIC_IN_PLACE_UPGRADE";
|
|
17
|
+
const SKIP_BLOCK = [
|
|
18
|
+
" ; RightKit policy: repairs and upgrades replace in place without uninstall/reinstall UI.",
|
|
19
|
+
" ${If} $WixMode = 0",
|
|
20
|
+
" ${AndIf} $R0 >= 0",
|
|
21
|
+
" Abort",
|
|
22
|
+
" ${EndIf}",
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
export class NsisTemplateError extends Error {
|
|
26
|
+
constructor(message) { super(message); this.name = "NsisTemplateError"; this.code = "RK_NSIS_TEMPLATE"; }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** `legacy-skip-page`, `no-maintenance-page`, or null when the template does not satisfy the in-place upgrade contract. */
|
|
30
|
+
export function templateContractShape(source) {
|
|
31
|
+
if (!/!define\s+RIGHTKIT_AUTOMATIC_IN_PLACE_UPGRADE\b/.test(source)) return null;
|
|
32
|
+
const legacySkipLogic = /\$\{If\}\s+\$WixMode\s*=\s*0[\s\S]{0,160}\$\{AndIf\}\s+\$R0\s*>=\s*0[\s\S]{0,80}\bAbort\b/.test(source);
|
|
33
|
+
const maintenanceSurface = /\bPageReinstall\b|MUI_PAGE_COMPONENTS|^\s*Page\s+custom\b/m.test(source);
|
|
34
|
+
if (!legacySkipLogic && maintenanceSurface) return null;
|
|
35
|
+
return legacySkipLogic ? "legacy-skip-page" : "no-maintenance-page";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Derive the in-place-upgrade template from a stock Tauri `installer.nsi`. Throws NsisTemplateError (and returns nothing) on any anchor that is not found exactly once. */
|
|
39
|
+
export function deriveInPlaceUpgradeTemplate(stock) {
|
|
40
|
+
if (typeof stock !== "string" || !stock.trim()) throw new NsisTemplateError("the stock installer.nsi is empty");
|
|
41
|
+
if (templateContractShape(stock)) throw new NsisTemplateError("the template already satisfies the in-place upgrade contract; nothing to derive");
|
|
42
|
+
const eol = stock.includes("\r\n") ? "\r\n" : "\n";
|
|
43
|
+
const lines = stock.split(/\r?\n/);
|
|
44
|
+
const include = lines.flatMap((line, index) => (/^\s*!include\s+MUI2\.nsh\s*$/.test(line) ? [index] : []));
|
|
45
|
+
if (include.length !== 1) throw new NsisTemplateError(`expected exactly one \`!include MUI2.nsh\` line to anchor the define, found ${include.length}`);
|
|
46
|
+
const pageStart = lines.flatMap((line, index) => (/^\s*Function\s+PageReinstall\s*$/.test(line) ? [index] : []));
|
|
47
|
+
if (pageStart.length !== 1) throw new NsisTemplateError(`expected exactly one \`Function PageReinstall\`, found ${pageStart.length}`);
|
|
48
|
+
const compare = lines.flatMap((line, index) => (index > pageStart[0] && /^\s*nsis_tauri_utils::SemverCompare\s+"\$\{VERSION\}"\s+\$R0\s*$/.test(line) ? [index] : []));
|
|
49
|
+
if (!compare.length || !/^\s*Pop\s+\$R0\s*$/.test(lines[compare[0] + 1] ?? "")) throw new NsisTemplateError("PageReinstall has no `SemverCompare \"${VERSION}\" $R0` followed by `Pop $R0` to anchor the skip block");
|
|
50
|
+
const pageEnd = lines.findIndex((line, index) => index > pageStart[0] && /^\s*FunctionEnd\s*$/.test(line));
|
|
51
|
+
if (pageEnd < 0 || compare[0] > pageEnd) throw new NsisTemplateError("the SemverCompare anchor is not inside Function PageReinstall");
|
|
52
|
+
const out = [...lines];
|
|
53
|
+
out.splice(compare[0] + 2, 0, ...SKIP_BLOCK); // after Pop $R0 (the later index first, so the define's index stays valid)
|
|
54
|
+
out.splice(include[0], 0, IN_PLACE_DEFINE, "");
|
|
55
|
+
const derived = out.join(eol);
|
|
56
|
+
if (templateContractShape(derived) !== "legacy-skip-page") throw new NsisTemplateError("the derived template does not satisfy the in-place upgrade contract; nothing written");
|
|
57
|
+
return derived;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Read `from`, derive, and write `out` (atomically, never over the stock file). Returns { out, shape }. */
|
|
61
|
+
export function writeInPlaceUpgradeTemplate({ from, out, fs = {} }) {
|
|
62
|
+
const exists = fs.existsSync ?? existsSync;
|
|
63
|
+
const read = fs.readFileSync ?? readFileSync;
|
|
64
|
+
const write = fs.writeFileSync ?? writeFileSync;
|
|
65
|
+
const rename = fs.renameSync ?? renameSync;
|
|
66
|
+
const makeDir = fs.mkdirSync ?? mkdirSync;
|
|
67
|
+
if (!exists(from)) throw new NsisTemplateError(`stock template not found: ${from}`);
|
|
68
|
+
if (path.resolve(from) === path.resolve(out)) throw new NsisTemplateError("--out must not be the stock template");
|
|
69
|
+
const derived = deriveInPlaceUpgradeTemplate(String(read(from, "utf8")));
|
|
70
|
+
makeDir(path.dirname(path.resolve(out)), { recursive: true });
|
|
71
|
+
const temporary = `${out}.tmp-${process.pid}`;
|
|
72
|
+
write(temporary, derived);
|
|
73
|
+
rename(temporary, out);
|
|
74
|
+
return { out, shape: templateContractShape(derived) };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function main(argv = process.argv.slice(2)) {
|
|
78
|
+
let from; let out;
|
|
79
|
+
const usage = "usage: right-release nsis-template --from <Tauri stock installer.nsi> --out <template.nsi>";
|
|
80
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
81
|
+
if (argv[i] === "--from" && argv[i + 1]) { from = argv[i + 1]; i += 1; }
|
|
82
|
+
else if (argv[i] === "--out" && argv[i + 1]) { out = argv[i + 1]; i += 1; }
|
|
83
|
+
else { console.error(`right-release nsis-template: unknown or incomplete argument ${argv[i]}\n${usage}`); return 2; }
|
|
84
|
+
}
|
|
85
|
+
if (!from || !out) { console.error(usage); return 2; }
|
|
86
|
+
try {
|
|
87
|
+
const result = writeInPlaceUpgradeTemplate({ from: path.resolve(from), out: path.resolve(out) });
|
|
88
|
+
console.log(`right-release nsis-template: wrote ${result.out} (${result.shape}); declare it as bundle.windows.nsis.template`);
|
|
89
|
+
return 0;
|
|
90
|
+
} catch (error) { console.error(`right-release nsis-template: ${error.message}`); return 1; }
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) process.exitCode = main();
|
package/outdated-command.mjs
CHANGED
|
@@ -78,7 +78,26 @@ export function runOutdated(argv, { fromDir = here(), cwd = process.cwd(), env =
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
const MANIFEST_COMMANDS = new Set(["check", "apply", "gate", "land", "discard", "run"]);
|
|
82
|
+
|
|
83
|
+
/** The explanation `update <command>` gives when the repository has no .rightkit/update.json, or null when it has one (or the command reads none). */
|
|
84
|
+
export function missingManifestMessage(argv, { cwd = process.cwd(), fromDir = here() } = {}) {
|
|
85
|
+
if (!MANIFEST_COMMANDS.has(argv[0])) return null;
|
|
86
|
+
const repoFlag = argv.findIndex((arg) => arg === "--repo" || arg.startsWith("--repo="));
|
|
87
|
+
const repo = path.resolve(cwd, repoFlag < 0 ? "." : argv[repoFlag] === "--repo" ? (argv[repoFlag + 1] ?? ".") : argv[repoFlag].slice("--repo=".length));
|
|
88
|
+
if (existsSync(path.join(repo, ".rightkit", "update.json"))) return null;
|
|
89
|
+
const outdated = findOutdatedPackage(fromDir);
|
|
90
|
+
const schema = outdated === null ? "the schema shipped as update.schema.json in @rightkit/outdated" : path.join(outdated, "update.schema.json");
|
|
91
|
+
return `${repo} has no .rightkit/update.json, which \`update ${argv[0]}\` reads. Create it first (the "Manifest" section of the @rightkit/outdated README; schema: ${schema}), or move the pins by hand: set each @rightkit/* pin in package.json and each rightkit-* crate in the crate manifest to the exact latest version the refusal lists, then refresh pnpm-lock.yaml and the crate lock.`;
|
|
92
|
+
}
|
|
93
|
+
|
|
81
94
|
export async function main(argv = process.argv.slice(2)) {
|
|
95
|
+
const missing = missingManifestMessage(argv);
|
|
96
|
+
if (missing !== null) {
|
|
97
|
+
console.error(`right-release update: ${missing}`);
|
|
98
|
+
process.exitCode = 2;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
82
101
|
try {
|
|
83
102
|
process.exitCode = await runOutdated(argv);
|
|
84
103
|
} catch (error) {
|
|
@@ -124,12 +124,28 @@ export function rulingFor(entry, rulings) {
|
|
|
124
124
|
&& isRealDate(r.expires) && isRealDate(entry.expires) && entry.expires <= r.expires) ?? null;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
/** One declared not-applicable value: the bare reason, or `{ reason, issue, expires }` (the same reading as ownership-mandatory-set.mjs notApplicableEntry). */
|
|
128
|
+
function notApplicableEntry(id, value) {
|
|
129
|
+
const reason = typeof value === "string" ? value : value && typeof value === "object" && !Array.isArray(value) ? value.reason : undefined;
|
|
130
|
+
if (typeof reason !== "string" || reason.trim().length < 10) return { problem: `${id}: reason too short` };
|
|
131
|
+
if (typeof value === "string") return { reason: reason.trim(), issue: null, expires: null };
|
|
132
|
+
if (Object.keys(value).some((key) => key !== "reason" && key !== "issue" && key !== "expires")) return { problem: `${id}: unknown key` };
|
|
133
|
+
if (value.issue !== undefined && (typeof value.issue !== "string" || !value.issue.trim())) return { problem: `${id}: bad issue` };
|
|
134
|
+
if (value.expires !== undefined && !isRealDate(value.expires)) return { problem: `${id}: bad expires` };
|
|
135
|
+
return { reason: reason.trim(), issue: value.issue?.trim() ?? null, expires: value.expires ?? null };
|
|
136
|
+
}
|
|
137
|
+
|
|
127
138
|
/** The declaration as ownership-mandatory-set.mjs reads it (profile and not-applicable rows of 10+ characters), without its TOML parser. */
|
|
128
139
|
function declarationOf(appRoot, data) {
|
|
129
140
|
const doc = readJson(appRoot, data.appDeclarationFile) ?? {};
|
|
130
|
-
const notApplicable = {};
|
|
131
|
-
for (const [id,
|
|
132
|
-
|
|
141
|
+
const notApplicable = {}, notApplicableDetail = {};
|
|
142
|
+
for (const [id, value] of Object.entries(doc.notApplicable ?? {})) {
|
|
143
|
+
const entry = notApplicableEntry(id, value);
|
|
144
|
+
if (entry.problem) continue;
|
|
145
|
+
notApplicable[id] = entry.reason;
|
|
146
|
+
notApplicableDetail[id] = { issue: entry.issue, expires: entry.expires };
|
|
147
|
+
}
|
|
148
|
+
return { app: declaredApp(appRoot), profile: doc.profile ?? data.defaultProfile, notApplicable, notApplicableDetail, records: {}, problems: [] };
|
|
133
149
|
}
|
|
134
150
|
|
|
135
151
|
/** The `app` a root declaration names, or null. */
|
|
@@ -188,16 +204,22 @@ export function releaseAppMarkers(files) {
|
|
|
188
204
|
}).sort();
|
|
189
205
|
}
|
|
190
206
|
|
|
191
|
-
/**
|
|
192
|
-
|
|
207
|
+
/**
|
|
208
|
+
* Split declared not-applicable rows into those a ratified ruling covers and those it does not. An amendment marked
|
|
209
|
+
* `"status": "proposed"` is a draft and ratifies nothing; a declared `expires` (object form) that has passed un-ratifies the row.
|
|
210
|
+
*/
|
|
211
|
+
export function ratifiedNotApplicable(declared, { app, profile, data, details = {}, now }) {
|
|
193
212
|
const amendment = app && data?.appAmendments ? data.appAmendments[app] : undefined;
|
|
194
|
-
const
|
|
213
|
+
const proposed = amendment?.status === "proposed";
|
|
214
|
+
const today = todayOf(now);
|
|
215
|
+
const rulings = amendment && !proposed && amendment.profile === profile && amendment.notApplicable && typeof amendment.notApplicable === "object" ? amendment.notApplicable : {};
|
|
195
216
|
const ratified = {}, unratified = {};
|
|
196
217
|
for (const [id, reason] of Object.entries(declared ?? {})) {
|
|
197
|
-
|
|
218
|
+
const expires = details[id]?.expires ?? null;
|
|
219
|
+
if (typeof rulings[id] === "string" && rulings[id].trim() === reason.trim() && !(expires && expires < today)) ratified[id] = reason;
|
|
198
220
|
else unratified[id] = reason;
|
|
199
221
|
}
|
|
200
|
-
return { ratified, unratified, ruled: Boolean(amendment) };
|
|
222
|
+
return { ratified, unratified, ruled: Boolean(amendment), proposed };
|
|
201
223
|
}
|
|
202
224
|
|
|
203
225
|
/**
|
|
@@ -216,10 +238,10 @@ function checkAppRoot({ root, dir, evaluator, data, owners = true }) {
|
|
|
216
238
|
}
|
|
217
239
|
const declaration = (evaluator ?? { loadAppDeclaration: declarationOf }).loadAppDeclaration(appRoot, data);
|
|
218
240
|
const app = declaredApp(appRoot);
|
|
219
|
-
const { ratified, unratified, ruled } = ratifiedNotApplicable(declaration.notApplicable, { app, profile: declaration.profile, data });
|
|
241
|
+
const { ratified, unratified, ruled, proposed } = ratifiedNotApplicable(declaration.notApplicable, { app, profile: declaration.profile, data, details: declaration.notApplicableDetail });
|
|
220
242
|
for (const [row, reason] of Object.entries(unratified)) out.push({
|
|
221
243
|
file, subject: `notApplicable:${row}`,
|
|
222
|
-
problem: `notApplicable.${row} ("${reason.slice(0, 80)}${reason.length > 80 ? "..." : ""}") is not a ratified ruling: ${!app ? `${file} names no "app"` : !ruled ? `appAmendments has no entry for "${app}"` : `appAmendments.${app} (profile ${data.appAmendments[app].profile}) has no ruling for ${row} with this reason verbatim for profile ${declaration.profile}`}; the row still applies`,
|
|
244
|
+
problem: `notApplicable.${row} ("${reason.slice(0, 80)}${reason.length > 80 ? "..." : ""}") is not a ratified ruling: ${!app ? `${file} names no "app"` : !ruled ? `appAmendments has no entry for "${app}"` : proposed ? `appAmendments.${app} is a proposal (status "proposed") awaiting Adrian's ratification` : `appAmendments.${app} (profile ${data.appAmendments[app].profile}) has no ruling for ${row} with this reason verbatim for profile ${declaration.profile}`}; the row still applies`,
|
|
223
245
|
fix: `ratify the ruling in RightKit (appAmendments.${app ?? "<app>"}.notApplicable.${row}, rightkit#1140) and copy its reason verbatim, or adopt the row's owner`,
|
|
224
246
|
});
|
|
225
247
|
if (!owners) return out;
|
|
@@ -507,6 +507,29 @@
|
|
|
507
507
|
"M14": "@rightkit/legal needs six proprietary roles and imports node:crypto, so it cannot run in a webview; @rightkit/onboarding mandates a legal step first. Ember ships @rightkit/legal-ui for its licences and notices and holds its first-run notice until its text is approved. OSS profile; the legal and onboarding owners need an OSS mode and a mode without a legal step.",
|
|
508
508
|
"M22": "rightkit-agent-tools needs a daemon-backed app control service. Ember's agent surface is its own MCP server over engine command ids, being ported to rightkit-mcp. Applies to non-daemon apps."
|
|
509
509
|
}
|
|
510
|
+
},
|
|
511
|
+
"cutright": {
|
|
512
|
+
"status": "proposed",
|
|
513
|
+
"issue": "bogusyogi/rightkit#1006",
|
|
514
|
+
"source": "bogusyogi/CutRight RightKit wave-2 port (branch claude/rk-port)",
|
|
515
|
+
"profile": "desktop",
|
|
516
|
+
"note": "DRAFT, not ratified: only Adrian's own words ratify a ruling. The checker ignores an amendment marked status proposed and the key proposedNotApplicable; on ratification Adrian's decision moves the rows to notApplicable and removes status. CutRight keeps both N/A strings, each carrying the issue and the expiry 2026-11-30.",
|
|
517
|
+
"proposedNotApplicable": {
|
|
518
|
+
"M9": "No SQLite app state. Project state is canonical JSON through rightkit-fs and settings are JSON through rightkit-app-settings; rightkit-db arrives only transitively through rightkit-job-queue and no JobStore is used.",
|
|
519
|
+
"M17": "No first-party HTTP client. LLM calls go through rightkit-llm, speech through rightkit-speech-client, model packs through rightkit-models and licence through @rightkit/license; rightkit-http is transitive only."
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
"viewright": {
|
|
523
|
+
"status": "proposed",
|
|
524
|
+
"issue": "bogusyogi/rightkit#1140",
|
|
525
|
+
"source": "bogusyogi/viewright RightKit port (branch claude/rk-port), independent verification",
|
|
526
|
+
"profile": "desktop",
|
|
527
|
+
"note": "DRAFT, not ratified: only Adrian's own words ratify a ruling. The checker ignores an amendment marked status proposed and the key proposedNotApplicable. ViewRight keeps its N/A strings, each carrying the issue and the expiry 2026-11-30. M1 (#1067) and M22 (#994) are separate decisions and are not proposed here.",
|
|
528
|
+
"proposedNotApplicable": {
|
|
529
|
+
"M3": "No engine child process and no restart-surviving jobs: document open, save, export and OCR run in-process; the only child processes are reveal and open-with (rightkit-child-process) and the OCR worker (rightkit-ocr).",
|
|
530
|
+
"M4": "No engine child process and no restart-surviving jobs: document open, save, export and OCR run in-process.",
|
|
531
|
+
"M7": "No local service: rightkit-daemon is used for AppRoot and mode::roots only (M6 adopted), with no socket, pipe, discovery or claim file. The QA control server is rightkit-qa behind qa-native and dev-control."
|
|
532
|
+
}
|
|
510
533
|
}
|
|
511
534
|
},
|
|
512
535
|
"amendments": {
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
// [--amendment v2.1] [--enforce] [--json]
|
|
13
13
|
//
|
|
14
14
|
// App-side declaration (optional): <app>/rightkit-mandatory.json
|
|
15
|
-
// { "profile": "desktop", "notApplicable": { "M16": "reason text" },
|
|
15
|
+
// { "app": "<name>", "profile": "desktop", "notApplicable": { "M16": "reason text" | { "reason": "...", "issue": "owner/rightkit#n", "expires": "YYYY-MM-DD" } },
|
|
16
|
+
// (a not-applicable row holds only when appAmendments.<app>.notApplicable.<row> in ownership-mandatory-set.json carries the same reason, the
|
|
17
|
+
// amendment is not status "proposed", and a declared `expires` has not passed; otherwise it is a problem and the row still applies)
|
|
16
18
|
// "M22": { "role": "client|host|both|absent", "entrypoints": ["src-tauri/src/agent.rs#register_tools"] } }
|
|
17
19
|
//
|
|
18
20
|
// PK17.scanner (report only, never enforcement): rows M21, M23, M24 and M25 stay `ownerPending` and never fail, but each lists its
|
|
@@ -280,20 +282,70 @@ export function validateApplicabilityRecord(id, raw, { spec, root }) {
|
|
|
280
282
|
return result;
|
|
281
283
|
}
|
|
282
284
|
|
|
285
|
+
const REAL_DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
286
|
+
const isRealDate = (text) => typeof text === "string" && REAL_DATE.test(text) && new Date(`${text}T00:00:00Z`).toISOString().slice(0, 10) === text;
|
|
287
|
+
const todayOf = (now) => (now instanceof Date ? now : new Date()).toISOString().slice(0, 10);
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* One declared not-applicable value. The string form is the bare reason; the object form is `{ reason, issue, expires }`
|
|
291
|
+
* (the issue that tracks the declaration, and the last UTC day it holds, YYYY-MM-DD). Returns `{ reason, issue, expires }`
|
|
292
|
+
* with null for an absent issue or expiry, or `{ problem }` when the value cannot be read.
|
|
293
|
+
*/
|
|
294
|
+
export function notApplicableEntry(id, value) {
|
|
295
|
+
const reason = typeof value === "string" ? value : value && typeof value === "object" && !Array.isArray(value) ? value.reason : undefined;
|
|
296
|
+
if (typeof reason !== "string" || reason.trim().length < 10) return { problem: `${id}: N/A declaration needs a reason (>= 10 chars); ignored` };
|
|
297
|
+
if (typeof value === "string") return { reason: reason.trim(), issue: null, expires: null };
|
|
298
|
+
const extra = Object.keys(value).filter((key) => key !== "reason" && key !== "issue" && key !== "expires");
|
|
299
|
+
if (extra.length) return { problem: `${id}: N/A declaration has unknown key(s) ${extra.join(", ")}; ignored` };
|
|
300
|
+
if (value.issue !== undefined && (typeof value.issue !== "string" || !value.issue.trim())) return { problem: `${id}: N/A declaration issue must be a non-empty string; ignored` };
|
|
301
|
+
if (value.expires !== undefined && !isRealDate(value.expires)) return { problem: `${id}: N/A declaration expires must be a real YYYY-MM-DD date; ignored` };
|
|
302
|
+
return { reason: reason.trim(), issue: value.issue?.trim() ?? null, expires: value.expires ?? null };
|
|
303
|
+
}
|
|
304
|
+
|
|
283
305
|
export function loadAppDeclaration(root, data) {
|
|
284
306
|
const file = path.join(root, data.appDeclarationFile);
|
|
285
|
-
if (!existsSync(file)) return { profile: data.defaultProfile, notApplicable: {}, records: {}, problems: [] };
|
|
307
|
+
if (!existsSync(file)) return { app: null, profile: data.defaultProfile, notApplicable: {}, notApplicableDetail: {}, records: {}, problems: [] };
|
|
286
308
|
const problems = [];
|
|
287
309
|
let doc = {};
|
|
288
310
|
try { doc = JSON.parse(readFileSync(file, "utf8")); } catch (error) { problems.push(`${data.appDeclarationFile} unparseable: ${error.message}`); }
|
|
289
311
|
const notApplicable = {};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
312
|
+
const notApplicableDetail = {};
|
|
313
|
+
for (const [id, value] of Object.entries(doc.notApplicable ?? {})) {
|
|
314
|
+
const entry = notApplicableEntry(id, value);
|
|
315
|
+
if (entry.problem) { problems.push(entry.problem); continue; }
|
|
316
|
+
notApplicable[id] = entry.reason;
|
|
317
|
+
notApplicableDetail[id] = { issue: entry.issue, expires: entry.expires };
|
|
293
318
|
}
|
|
294
319
|
const records = {};
|
|
295
320
|
for (const id of Object.keys(data.applicabilityRecords ?? {})) if (doc && typeof doc === "object" && Object.hasOwn(doc, id)) records[id] = doc[id];
|
|
296
|
-
|
|
321
|
+
const app = typeof doc?.app === "string" && doc.app.trim() ? doc.app.trim() : null;
|
|
322
|
+
return { app, profile: doc.profile ?? data.defaultProfile, notApplicable, notApplicableDetail, records, problems };
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Split a declaration's not-applicable rows into those a ratified ruling covers and those it does not. A ruling is
|
|
327
|
+
* `appAmendments.<app>.notApplicable.<row>` for the app the declaration names, in the declared profile, with the reason copied
|
|
328
|
+
* verbatim. An amendment marked `"status": "proposed"` is a draft and ratifies nothing. A declared `expires` that has passed
|
|
329
|
+
* un-ratifies the row. Each unratified row is returned with the reason it is not covered.
|
|
330
|
+
*/
|
|
331
|
+
export function ratifyNotApplicable(declaration, { data, now } = {}) {
|
|
332
|
+
const today = todayOf(now);
|
|
333
|
+
const amendment = declaration.app && data?.appAmendments ? data.appAmendments[declaration.app] : undefined;
|
|
334
|
+
const proposed = amendment?.status === "proposed";
|
|
335
|
+
const live = amendment && !proposed && amendment.profile === declaration.profile && amendment.notApplicable && typeof amendment.notApplicable === "object" ? amendment.notApplicable : {};
|
|
336
|
+
const ratified = {}, unratified = {};
|
|
337
|
+
for (const [id, reason] of Object.entries(declaration.notApplicable)) {
|
|
338
|
+
const expires = declaration.notApplicableDetail?.[id]?.expires ?? null;
|
|
339
|
+
const ruling = live[id];
|
|
340
|
+
const why = !declaration.app ? `${data.appDeclarationFile} names no "app"`
|
|
341
|
+
: !amendment ? `appAmendments has no entry for "${declaration.app}"`
|
|
342
|
+
: proposed ? `appAmendments.${declaration.app} is a proposal (status "proposed"), not a ratified ruling`
|
|
343
|
+
: typeof ruling !== "string" || ruling.trim() !== reason.trim() ? `appAmendments.${declaration.app} (profile ${amendment.profile}) has no ruling for ${id} with this reason verbatim for profile ${declaration.profile}`
|
|
344
|
+
: expires && expires < today ? `the declaration expired on ${expires} (today ${today}, UTC)`
|
|
345
|
+
: null;
|
|
346
|
+
if (why) unratified[id] = why; else ratified[id] = reason;
|
|
347
|
+
}
|
|
348
|
+
return { ratified, unratified };
|
|
297
349
|
}
|
|
298
350
|
|
|
299
351
|
// A pending row's `profile` is one profile name, a list of profile names, or "all" (repository-wide: every profile, including future ones).
|
|
@@ -302,12 +354,18 @@ export function pendingAppliesTo(row, active) {
|
|
|
302
354
|
}
|
|
303
355
|
|
|
304
356
|
// `declaration` replaces the one read from root (the app check passes the declaration with its unratified not-applicable rows removed).
|
|
305
|
-
export function checkApp(root, { data = loadData(), profile, amendments = [], declaration: override = null } = {}) {
|
|
357
|
+
export function checkApp(root, { data = loadData(), profile, amendments = [], declaration: override = null, now } = {}) {
|
|
306
358
|
const name = path.basename(root);
|
|
307
359
|
if (!existsSync(root) || !statSync(root).isDirectory()) return { app: name, root, scanned: false, profile: profile ?? data.defaultProfile, owners: [], pending: [], notApplicable: [], problems: ["app root missing"], violations: 0 };
|
|
308
|
-
|
|
360
|
+
let declaration = override ?? loadAppDeclaration(root, data);
|
|
309
361
|
const active = profile ?? declaration.profile;
|
|
310
362
|
const problems = [...declaration.problems];
|
|
363
|
+
// A caller that passes its own declaration has already ratified it; otherwise a not-applicable row holds only with a ratified ruling.
|
|
364
|
+
if (!override) {
|
|
365
|
+
const { ratified, unratified } = ratifyNotApplicable(declaration, { data, now });
|
|
366
|
+
for (const [id, why] of Object.entries(unratified)) problems.push(`${id}: notApplicable.${id} is not a ratified ruling (${why}); the row still applies`);
|
|
367
|
+
declaration = { ...declaration, notApplicable: ratified };
|
|
368
|
+
}
|
|
311
369
|
if (!data.profiles[active]) problems.push(`unknown profile "${active}"`);
|
|
312
370
|
const rows = data.rows.filter((r) => r.profile === active).map((r) => ({ ...r, owners: [...r.owners] }));
|
|
313
371
|
for (const key of amendments) {
|
|
@@ -69,11 +69,12 @@ function buildExtras(spec, label, { postBuild }) {
|
|
|
69
69
|
|
|
70
70
|
/** Tauri v2 passes Cargo flags after `--`; the profile also decides where Tauri looks for the built binary. */
|
|
71
71
|
const profileArgs = (extras) => (extras.profile ? ["--", "--profile", extras.profile] : []);
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
/**
|
|
73
|
+
* The build command also takes `--jobs N` (Cargo parallelism), after the same `--`. A generated Tauri build always forwards
|
|
74
|
+
* `--locked` to Cargo, so a release can never resolve dependencies differently from the reviewed lockfile (rightkit#725).
|
|
75
|
+
* (The bundle command runs no Cargo, so it carries no Cargo flags.)
|
|
76
|
+
*/
|
|
77
|
+
const buildCargoArgs = (extras, jobs) => ["--", ...(extras.profile ? ["--profile", extras.profile] : []), ...(jobs ? ["--jobs", String(jobs)] : []), "--locked"];
|
|
77
78
|
const configArgs = (extras, appRoot, cwd) => (extras.tauriConfig ? ["--config", path.relative(path.resolve(appRoot, cwd), path.resolve(appRoot, extras.tauriConfig)).split(path.sep).join("/")] : []);
|
|
78
79
|
|
|
79
80
|
/**
|
|
@@ -181,14 +182,16 @@ export function expandWinPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
181
182
|
if (target.prePackage !== undefined) fail("targets.win.winPackage replaces prePackage; remove the prePackage script");
|
|
182
183
|
if (target.winPackage.sidecars !== undefined) fail("targets.win.winPackage.sidecars is not supported in a right-release target: declare sidecars through externalBin or mediaSidecar, which release.mjs signs with the raw EXE");
|
|
183
184
|
if (!isObject(target.winPackage)) fail("targets.win.winPackage must be an object");
|
|
184
|
-
const { profile: _p, tauriConfig: _t, prepare: _pr, postBuild, jobs, timeoutMs, cleanStale, cargoTargetRoot: _c, ...coreSpec } = target.winPackage;
|
|
185
|
+
const { profile: _p, tauriConfig: _t, prepare: _pr, postBuild, jobs, timeoutMs, cleanStale, killProcesses, cargoTargetRoot: _c, ...coreSpec } = target.winPackage;
|
|
185
186
|
if (postBuild !== undefined) fail("targets.win.winPackage.postBuild is not supported: release.mjs signs the raw EXE between the build and the bundle; use prepare");
|
|
186
187
|
if (jobs !== undefined && !positiveInt(jobs)) fail("targets.win.winPackage.jobs must be a positive integer (Cargo --jobs)");
|
|
187
188
|
if (timeoutMs !== undefined && !positiveInt(timeoutMs)) fail("targets.win.winPackage.timeoutMs must be a positive integer (milliseconds)");
|
|
188
189
|
if (cleanStale !== undefined && typeof cleanStale !== "boolean") fail("targets.win.winPackage.cleanStale must be a boolean");
|
|
190
|
+
if (killProcesses !== undefined && (!Array.isArray(killProcesses) || !killProcesses.length)) fail("targets.win.winPackage.killProcesses must be a non-empty list of app-relative directories");
|
|
191
|
+
const killDirs = killProcesses === undefined ? undefined : killProcesses.map((dir, index) => relativeInside(dir, `targets.win.winPackage.killProcesses[${index}]`));
|
|
189
192
|
const extras = buildExtras(target.winPackage, "targets.win.winPackage", { postBuild: false });
|
|
190
193
|
let plan;
|
|
191
|
-
try { plan = validateWinPackage({ appRoot, config, target: { ...target, winPackage: coreSpec } }); } catch (error) {
|
|
194
|
+
try { plan = validateWinPackage({ appRoot, config, env, ...(managedRoots ? { managedRoots } : {}), target: { ...target, winPackage: coreSpec } }); } catch (error) {
|
|
192
195
|
if (error instanceof WinPackageConfigError) fail(`targets.win.winPackage: ${(error.issues ?? [error.message]).join("; ")}`);
|
|
193
196
|
throw error;
|
|
194
197
|
}
|
|
@@ -196,11 +199,19 @@ export function expandWinPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
196
199
|
const cwd = rel(plan.appRoot, plan.tauriCwd) || ".";
|
|
197
200
|
const override = { bundle: { createUpdaterArtifacts: false, windows: { nsis: { installMode: plan.perMachine ? "perMachine" : "currentUser" } } } };
|
|
198
201
|
const mapPath = targetRootMapper({ spec: target.winPackage, appRoot: plan.appRoot, cwd, env, resolveTargetRoot, label: "targets.win.winPackage", ...(managedRoots ? { managedRoots } : {}) });
|
|
199
|
-
|
|
200
|
-
|
|
202
|
+
// An absolute artifact path under a managed root (rightkit#717) is staged to a fixed app-relative copy: release.mjs signs and seals app-relative
|
|
203
|
+
// paths, and the same copy-out / copy-back plan as a mapped managed target applies (managed-target-stage.mjs).
|
|
204
|
+
const managedCopy = (absolute) => {
|
|
205
|
+
if (isSplitArtifactEnv(env)) return absolute; // a door split reads and signs the bound target in place: nothing is copied
|
|
206
|
+
const to = path.posix.join(cwd === "." ? "" : cwd, "src-tauri", "target", "rightkit-managed", path.basename(absolute));
|
|
207
|
+
mapPath.staged.set(to, { from: absolute, to });
|
|
208
|
+
return to;
|
|
209
|
+
};
|
|
210
|
+
const rawExe = plan.managed.rawExe ? managedCopy(plan.rawExe) : mapPath(rel(plan.appRoot, plan.rawExe));
|
|
211
|
+
const installerFile = plan.managed.installerFile ? managedCopy(plan.installerFile) : mapPath(rel(plan.appRoot, plan.installerFile));
|
|
201
212
|
// Stale outputs are removed before the build, and the raw EXE is polled until it stops changing after it (in a managed
|
|
202
213
|
// target directory the poll covers the real EXE before it is copied; the in-app copy is polled again after the copy).
|
|
203
|
-
const cleanup = cleanStale === false ? undefined : { remove: [rawExe, installerFile] };
|
|
214
|
+
const cleanup = cleanStale === false && !killDirs ? undefined : { ...(cleanStale === false ? {} : { remove: [rawExe, installerFile] }), ...(killDirs ? { killProcesses: killDirs } : {}) };
|
|
204
215
|
const timeout = timeoutMs ?? DEFAULT_WIN_TIMEOUT_MS;
|
|
205
216
|
// Broker-managed target directory: the real raw EXE is deleted before the build (it holds the previous signed copy) and
|
|
206
217
|
// the fresh one is copied out once stable; after signing, the signed copy goes back
|
|
@@ -229,18 +240,27 @@ export function expandWinPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
229
240
|
};
|
|
230
241
|
}
|
|
231
242
|
|
|
232
|
-
const MAC_KEYS = new Set(["universal", "triple", "tauriCwd", "features", "profile", "tauriConfig", "prepare", "postBuild", "cleanup", "cargoTargetRoot", "updater", "stageSidecars", "nativeHelpers"]);
|
|
243
|
+
const MAC_KEYS = new Set(["universal", "triple", "tauriCwd", "features", "profile", "tauriConfig", "prepare", "postBuild", "cleanup", "cargoTargetRoot", "updater", "stageSidecars", "nativeHelpers", "prebuilt"]);
|
|
244
|
+
/** The Tauri-only macPackage keys: an app that supplies its own .app (`prebuilt: true`) has no Tauri build to configure. */
|
|
245
|
+
const MAC_TAURI_ONLY_KEYS = ["features", "profile", "tauriConfig", "tauriCwd", "stageSidecars", "cargoTargetRoot", "universal", "triple"];
|
|
233
246
|
const STAGE_SIDECARS_KEYS = new Set(["config", "receipt"]);
|
|
247
|
+
/** A prebuilt app's arch is whatever its own command produced: no slice is assumed, and nothing derived from the triple (helper arch, sidecar lipo) applies. */
|
|
248
|
+
const UNIVERSAL_PREBUILT = "prebuilt";
|
|
234
249
|
const DEFAULT_SIDECAR_RECEIPT = "src-tauri/binaries/stage-sidecar.json";
|
|
235
250
|
const MAC_TRIPLES = ["aarch64-apple-darwin", "x86_64-apple-darwin"];
|
|
236
|
-
const MAC_CLEANUP_KEYS = new Set(["staleApps", "staleDmgVolumes", "lsclean"]);
|
|
251
|
+
const MAC_CLEANUP_KEYS = new Set(["staleApps", "staleDmgVolumes", "lsclean", "killProcesses"]);
|
|
237
252
|
|
|
238
253
|
function macCleanupSpec(value) {
|
|
239
254
|
if (value === undefined) return {};
|
|
240
255
|
if (!isObject(value)) fail("targets.mac.macPackage.cleanup must be an object");
|
|
241
256
|
const unknown = Object.keys(value).filter((key) => !MAC_CLEANUP_KEYS.has(key));
|
|
242
257
|
if (unknown.length) fail(`targets.mac.macPackage.cleanup has unknown key(s): ${unknown.join(", ")} (allowed: ${[...MAC_CLEANUP_KEYS].join(", ")})`);
|
|
243
|
-
for (const key of MAC_CLEANUP_KEYS) if (value[key] !== undefined && typeof value[key] !== "boolean") fail(`targets.mac.macPackage.cleanup.${key} must be a boolean`);
|
|
258
|
+
for (const key of MAC_CLEANUP_KEYS) if (key !== "killProcesses" && value[key] !== undefined && typeof value[key] !== "boolean") fail(`targets.mac.macPackage.cleanup.${key} must be a boolean`);
|
|
259
|
+
// killProcesses: app-relative directories whose running executables are stopped before the build (recipe-build cleanup.killProcesses, rightkit#753).
|
|
260
|
+
if (value.killProcesses !== undefined) {
|
|
261
|
+
if (!Array.isArray(value.killProcesses) || !value.killProcesses.length) fail("targets.mac.macPackage.cleanup.killProcesses must be a non-empty list of app-relative directories");
|
|
262
|
+
return { ...value, killProcesses: value.killProcesses.map((dir, index) => relativeInside(dir, `targets.mac.macPackage.cleanup.killProcesses[${index}]`)) };
|
|
263
|
+
}
|
|
244
264
|
return value;
|
|
245
265
|
}
|
|
246
266
|
|
|
@@ -249,6 +269,10 @@ function macCleanupSpec(value) {
|
|
|
249
269
|
* Developer ID signing set, app notarization before packing, and right-release's own signed DMG from the stapled app.
|
|
250
270
|
* The app path and DMG path are `notarize.app` and `notarize.file`; DMG branding is `targets.mac.dmg`.
|
|
251
271
|
* Architecture: `triple` (an explicit arch triple) beats `universal`; `universal: false` means this host's arch.
|
|
272
|
+
* `prebuilt: true` (rightkit#871): the app supplies its own .app (an xcodebuild notch, a hand-assembled bundle). The target then declares its own
|
|
273
|
+
* `prePackage` command (the app's assembly step); the recipe runs it instead of `tauri build` and still applies every later step unchanged: the .app as
|
|
274
|
+
* the Developer ID signing set, nested code, app notarization, the signed DMG and its notarization, the updater tarball. The Tauri-only keys
|
|
275
|
+
* (features, profile, tauriConfig, tauriCwd, stageSidecars, cargoTargetRoot, universal, triple) are refused with it; a `package` script stays refused.
|
|
252
276
|
* `cleanup` runs built-in steps in recipe-build before the build (stale DMG volumes, stale .app bundles, lsregister).
|
|
253
277
|
* `updater: true | "<app-relative .tar.gz>"` emits the Tauri updater tarball and its signature from the signed, stapled .app:
|
|
254
278
|
* it prepends a `create-mac-updater` command to `postSign` (default output `<App>.app.tar.gz` beside the app's working root).
|
|
@@ -288,7 +312,14 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
288
312
|
if (!isObject(spec)) fail("targets.mac.macPackage must be an object");
|
|
289
313
|
const unknown = Object.keys(spec).filter((key) => !MAC_KEYS.has(key));
|
|
290
314
|
if (unknown.length) fail(`targets.mac.macPackage has unknown key(s): ${unknown.join(", ")} (allowed: ${[...MAC_KEYS].join(", ")})`);
|
|
291
|
-
|
|
315
|
+
const prebuilt = spec.prebuilt === true;
|
|
316
|
+
if (spec.prebuilt !== undefined && typeof spec.prebuilt !== "boolean") fail("targets.mac.macPackage.prebuilt must be a boolean");
|
|
317
|
+
if (prebuilt) {
|
|
318
|
+
if (target.package !== undefined) fail("targets.mac.macPackage replaces package; remove the package script");
|
|
319
|
+
if (!isObject(target.prePackage) || typeof target.prePackage.cmd !== "string" || !target.prePackage.cmd.trim()) fail("targets.mac.macPackage.prebuilt needs targets.mac.prePackage: the app's own command that produces notarize.app");
|
|
320
|
+
const tauriOnly = MAC_TAURI_ONLY_KEYS.filter((key) => spec[key] !== undefined);
|
|
321
|
+
if (tauriOnly.length) fail(`targets.mac.macPackage.prebuilt: ${tauriOnly.join(", ")} configure the Tauri build, which a prebuilt app does not run; remove them`);
|
|
322
|
+
} else if (target.prePackage !== undefined || target.package !== undefined) fail("targets.mac.macPackage replaces prePackage and package; remove both scripts");
|
|
292
323
|
if (typeof target.notarize?.app !== "string" || !target.notarize.app.endsWith(".app")) fail("targets.mac.macPackage needs notarize.app: the built .app path");
|
|
293
324
|
if (typeof target.notarize?.file !== "string" || !target.notarize.file.endsWith(".dmg")) fail("targets.mac.macPackage needs notarize.file: the .dmg path right-release builds");
|
|
294
325
|
if (target.dmg === false) fail("targets.mac.macPackage always builds a DMG; remove dmg: false");
|
|
@@ -301,7 +332,7 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
301
332
|
if (spec.updater !== undefined && spec.updater !== true && spec.updater !== false && typeof spec.updater !== "string") fail("targets.mac.macPackage.updater must be true or an app-relative .tar.gz path");
|
|
302
333
|
if (typeof spec.updater === "string" && !/\.tar\.gz$/i.test(relativeInside(spec.updater, "targets.mac.macPackage.updater"))) fail("targets.mac.macPackage.updater must end in .tar.gz");
|
|
303
334
|
// Tauri's universal-apple-darwin target builds both slices and lipos them itself.
|
|
304
|
-
const triple = macPackageTriple(spec);
|
|
335
|
+
const triple = prebuilt ? UNIVERSAL_PREBUILT : macPackageTriple(spec);
|
|
305
336
|
if (spec.triple !== undefined) {
|
|
306
337
|
const wrong = [...MAC_TRIPLES, "universal-apple-darwin"].find((other) => other !== triple && target.notarize.app.replaceAll("\\", "/").split("/").includes(other));
|
|
307
338
|
if (wrong) fail(`targets.mac.macPackage.triple is ${triple} but notarize.app is under ${wrong}; the built .app lives in the ${triple} directory`);
|
|
@@ -321,6 +352,7 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
321
352
|
}
|
|
322
353
|
// A universal app may not carry a thin helper: it would compile, sign and notarize and then fail on half the Macs.
|
|
323
354
|
const thin = triple === "universal-apple-darwin" ? helpers.filter((helper) => !helper.universal) : [];
|
|
355
|
+
if (prebuilt) fail("targets.mac.macPackage.prebuilt: nativeHelpers are embedded by the Tauri build recipe; a prebuilt app embeds its own helpers in its prePackage command (declare their signing in sign.nestedCode)");
|
|
324
356
|
if (thin.length) fail(`targets.mac.macPackage.nativeHelpers: ${thin.map((helper) => helper.name).join(", ")} must declare universal: true (this build's triple is universal-apple-darwin)`);
|
|
325
357
|
if (helpers.some((helper) => helper.kind === "app") && (typeof config?.version !== "string" || !/^\d+(\.\d+){0,2}$/.test(config.version))) fail("targets.mac.macPackage.nativeHelpers: a kind \"app\" helper needs the release config version (1-3 numeric parts) for its Info.plist");
|
|
326
358
|
const collisions = Object.keys(nativeHelperNestedCode(helpers)).filter((key) => isObject(target.sign?.nestedCode) && Object.hasOwn(target.sign.nestedCode, key));
|
|
@@ -329,7 +361,7 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
329
361
|
}
|
|
330
362
|
const args = ["exec", "tauri", "build", "--target", triple, "--bundles", "app", "--no-sign", ...configArgs(extras, appRoot, cwd), "--config", JSON.stringify(override)];
|
|
331
363
|
if (spec.features?.length) args.push("--features", spec.features.join(","));
|
|
332
|
-
args.push(...
|
|
364
|
+
args.push(...buildCargoArgs(extras)); // forwards --profile and --locked to Cargo (rightkit#725)
|
|
333
365
|
const mapPath = targetRootMapper({ spec, appRoot, cwd, env, resolveTargetRoot, label: "targets.mac.macPackage", ...(managedRoots ? { managedRoots } : {}) });
|
|
334
366
|
const app = mapPath(target.notarize.app);
|
|
335
367
|
const entryFile = (entry) => (typeof entry === "string" ? entry : entry?.file);
|
|
@@ -340,8 +372,9 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
340
372
|
const appPosix = app.replaceAll("\\", "/");
|
|
341
373
|
const productName = path.posix.basename(appPosix, ".app");
|
|
342
374
|
const volumes = [...new Set([productName, ...(isObject(target.dmg) && typeof target.dmg.volname === "string" ? [target.dmg.volname] : [])])];
|
|
343
|
-
const cleanup = cleanupSpec.staleApps || cleanupSpec.staleDmgVolumes || cleanupSpec.lsclean
|
|
375
|
+
const cleanup = cleanupSpec.staleApps || cleanupSpec.staleDmgVolumes || cleanupSpec.lsclean || cleanupSpec.killProcesses
|
|
344
376
|
? {
|
|
377
|
+
...(cleanupSpec.killProcesses ? { killProcesses: cleanupSpec.killProcesses } : {}),
|
|
345
378
|
...(cleanupSpec.staleDmgVolumes ? { dmgVolumes: volumes } : {}),
|
|
346
379
|
...(cleanupSpec.staleApps || cleanupSpec.lsclean ? { apps: { dir: path.posix.dirname(appPosix), remove: cleanupSpec.staleApps === true, unregister: cleanupSpec.lsclean === true } } : {}),
|
|
347
380
|
}
|
|
@@ -366,12 +399,14 @@ export function expandMacPackageTarget(target, { appRoot, config = {}, env = pro
|
|
|
366
399
|
return {
|
|
367
400
|
...rest,
|
|
368
401
|
...postSign,
|
|
369
|
-
prePackage:
|
|
402
|
+
prePackage: prebuilt
|
|
403
|
+
? (wrapped ? recipeBuildCommand({ extras, build: { cmd: target.prePackage.cmd, args: target.prePackage.args ?? [], ...(target.prePackage.cwd === undefined ? {} : { cwd: target.prePackage.cwd }) }, env: target.prePackage.env ?? {}, cleanup, stage: macStage, boundTargets: mapPath.bound }) : target.prePackage)
|
|
404
|
+
: wrapped ? recipeBuildCommand({ extras, build: { cmd: "pnpm", args, cwd }, env: QUIET_TAURI_ENV, cleanup, stage: macStage, verifySidecars, nativeHelpers: nativeHelpersPlan, boundTargets: mapPath.bound }) : { cmd: "pnpm", args, cwd, env: QUIET_TAURI_ENV },
|
|
370
405
|
// Helpers are signed by release.mjs inside-out through sign.nestedCode (deepest path first, hardened runtime, each helper's own entitlements), then the app.
|
|
371
406
|
sign: { ...(target.sign ?? {}), ...(helpers ? { nestedCode: { ...nativeHelperNestedCode(helpers), ...(target.sign?.nestedCode ?? {}) } } : {}), prePackageFiles },
|
|
372
407
|
notarize: { ...target.notarize, app, appBeforePackage: true },
|
|
373
408
|
dmg: isObject(target.dmg) ? target.dmg : {},
|
|
374
|
-
recipe: { kind: "macPackage", universal: triple === "universal-apple-darwin" },
|
|
409
|
+
recipe: { kind: "macPackage", universal: triple === "universal-apple-darwin", ...(prebuilt ? { prebuilt: true } : {}) },
|
|
375
410
|
};
|
|
376
411
|
}
|
|
377
412
|
|
package/package.json
CHANGED