Skip to content

A personal assistant that lives on your desktop, remembers what matters, and can use your Mac for you.

TypeScript

feat(package): build a self-contained macOS DMG

Alan Buscaglia546aa92bf02c
diff --git a/apps/desktop/src-tauri/tauri.macos.conf.json b/apps/desktop/src-tauri/tauri.macos.conf.json
new file mode 100644
index 0000000..f64de8d
--- /dev/null
+++ b/apps/desktop/src-tauri/tauri.macos.conf.json
@@ -0,0 +1,15 @@
+{
+ "$schema": "https://schema.tauri.app/config/2",
+ "bundle": {
+ "targets": ["app", "dmg"],
+ "macOS": {
+ "minimumSystemVersion": "12.3",
+ "hardenedRuntime": false,
+ "dmg": {
+ "windowSize": { "width": 660, "height": 400 },
+ "appPosition": { "x": 180, "y": 170 },
+ "applicationFolderPosition": { "x": 480, "y": 170 }
+ }
+ }
+ }
+}
diff --git a/biome.json b/biome.json
index 6dc5b67..7d486d7 100644
--- a/biome.json
+++ b/biome.json
@@ -8,6 +8,8 @@
"!apps/desktop/src-tauri/target",
"!apps/desktop/src-tauri/gen",
"!odd",
+ "!build",
+ "!.cache",
"!docs",
"!test-results",
"!playwright-report"
diff --git a/docs/install.md b/docs/install.md
new file mode 100644
index 0000000..257675f
--- /dev/null
+++ b/docs/install.md
@@ -0,0 +1,83 @@
+# Installing Gentle Dot
+
+Gentle Dot ships as a self-contained app: it carries its own Node runtime, the assistant engine, and a fallback Engram. Nothing else needs to be installed first.
+
+## macOS
+
+Requirements: a Mac with Apple Silicon (M1 or later) and macOS 12.3 or later.
+
+### Install
+
+1. Open `Gentle Dot_<version>_aarch64.dmg`.
+2. Drag **Gentle Dot** onto the **Applications** folder in the window that opens.
+3. Eject the disk image.
+
+### First open
+
+The app is not notarized by Apple, so macOS blocks the first open. Approve it once:
+
+- **macOS 15 (Sequoia) and later:**
+ 1. Open Gentle Dot from Applications. macOS says it cannot verify the app; click **Done**.
+ 2. Open **System Settings → Privacy & Security**, scroll to **Security**, and click **Open Anyway** next to the Gentle Dot message.
+ 3. Confirm with **Open Anyway** and your password.
+- **macOS 12 to 14:** Control-click Gentle Dot in Applications, choose **Open**, then **Open** again.
+
+Alternative from Terminal (any version), which removes the download quarantine from the app:
+
+```sh
+xattr -dr com.apple.quarantine "/Applications/Gentle Dot.app"
+```
+
+Only do this for a copy you got from someone you trust.
+
+### Permissions for computer control
+
+Computer control needs two macOS permissions. Open **Connectors → Computer** in Gentle Dot and click **Grant** for each, or add Gentle Dot by hand:
+
+- **System Settings → Privacy & Security → Accessibility**: lets the assistant click and type.
+- **System Settings → Privacy & Security → Screen Recording** (named **Screen & System Audio Recording** on macOS 15): lets the assistant take screenshots.
+
+Restart Gentle Dot after granting Screen Recording.
+
+macOS ties these grants to the app's signature. A build signed ad hoc (the default) gets a new signature on every build, so after an update the old entries stop working: remove Gentle Dot from both lists with the minus button and grant again.
+
+### Where data lives
+
+| What | Where |
+|---|---|
+| Settings, conversations, logs (`daemon.log`), the engine's own files | `~/.gentle-dot/` |
+| Memory (Engram, project `gentle-dot`) | `~/.engram/`, shared with any other Engram user on this Mac |
+| Launch at login (when turned on) | a LaunchAgent in `~/Library/LaunchAgents/` |
+
+The app itself never changes after install; everything it writes goes to the folders above.
+
+### Uninstall
+
+1. In the menu bar item, turn off **Launch at login**, then quit Gentle Dot.
+2. Drag `/Applications/Gentle Dot.app` to the Trash.
+3. Optional: remove `~/.gentle-dot/` to delete settings and conversations.
+4. Optional: reset the permissions:
+
+ ```sh
+ tccutil reset Accessibility dev.gentleman.gentle-dot
+ tccutil reset ScreenCapture dev.gentleman.gentle-dot
+ ```
+
+Leave `~/.engram/` in place unless you want to delete every Engram memory on this Mac, not only Gentle Dot's.
+
+### Build the DMG from source
+
+On an Apple Silicon Mac with Node 24, pnpm, Rust (`rustc` on `PATH`), and Xcode command line tools:
+
+```sh
+pnpm install
+pnpm package:mac # signs ad hoc
+pnpm package:mac --sign "<identity>" # or GENTLE_DOT_SIGN_IDENTITY="<identity>"
+pnpm package:mac --check # also mounts the DMG and smoke-tests the copied app's daemon
+```
+
+The command stages the runtime (`build/runtime/darwin-arm64`), signs the runtime's binaries, builds the release app, and writes the DMG to `apps/desktop/src-tauri/target/release/bundle/dmg/`. `--skip-stage` reuses a runtime staged earlier; `--check-dmg <dmg>` checks an existing DMG without building.
+
+## Linux
+
+To be written (T28g).
diff --git a/package.json b/package.json
index d529de9..7267a2b 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,8 @@
"typecheck": "tsc -b",
"lint": "biome check .",
"format": "biome format --write .",
- "test:real": "GENTLE_DOT_REAL_AGENT=1 vitest run packages/daemon/test/real-agent.test.ts"
+ "test:real": "GENTLE_DOT_REAL_AGENT=1 vitest run packages/daemon/test/real-agent.test.ts",
+ "package:mac": "node scripts/package/package-mac.mjs"
},
"devDependencies": {
"@biomejs/biome": "^2.5.15",
diff --git a/scripts/package/lib.mjs b/scripts/package/lib.mjs
index ac6609f..973d99a 100644
--- a/scripts/package/lib.mjs
+++ b/scripts/package/lib.mjs
@@ -173,3 +173,103 @@ bin=$(CDPATH= cd -- "$(dirname -- "$self")" && pwd -P) || exit 1
exec "$bin/node" "$bin/../lib/node_modules/npm/bin/${cli}" "$@"
`;
}
+
+// macOS installer (`package-mac.mjs`).
+
+export const MAC_USAGE =
+ "usage: package-mac [--sign <identity>] [--skip-stage] [--check] [--check-dmg <dmg>] [--finder-layout]";
+
+/** The ad hoc signing identity: no certificate, and no identity that survives a rebuild. */
+export const AD_HOC = "-";
+
+/**
+ * Parses package-mac's command line. The signing identity is `--sign`, else
+ * `GENTLE_DOT_SIGN_IDENTITY`, else ad hoc.
+ */
+export function parseMacArgs(argv, env = process.env) {
+ const args = argv.filter((arg) => arg !== "--");
+ const options = { skipStage: false, check: false, finderLayout: false };
+ const switches = { "--skip-stage": "skipStage", "--check": "check", "--finder-layout": "finderLayout" };
+ const values = { "--sign": "sign", "--check-dmg": "checkDmg" };
+ for (let i = 0; i < args.length; i++) {
+ if (switches[args[i]]) {
+ options[switches[args[i]]] = true;
+ continue;
+ }
+ const name = values[args[i]];
+ const value = args[i + 1];
+ if (!name || value === undefined || value === "" || value.startsWith("--"))
+ throw new Error(`Unexpected argument ${args[i]}.\n${MAC_USAGE}`);
+ options[name] = value;
+ i++;
+ }
+ const identity = options.sign ?? (env.GENTLE_DOT_SIGN_IDENTITY || AD_HOC);
+ delete options.sign;
+ return { ...options, identity };
+}
+
+/**
+ * Whether a file's first bytes are a Mach-O header: thin 32/64-bit, or universal.
+ * A universal header shares Java's class-file magic; it counts its architectures,
+ * a small number, where a class file has its version, 45 or more.
+ */
+export function isMachO(bytes) {
+ if (bytes.length < 8) return false;
+ const magic = bytes.readUInt32BE(0);
+ if ([0xcffaedfe, 0xcefaedfe, 0xfeedfacf, 0xfeedface].includes(magic)) return true;
+ if (magic !== 0xcafebabe && magic !== 0xcafebabf) return false;
+ const architectures = bytes.readUInt32BE(4);
+ return architectures > 0 && architectures < 20;
+}
+
+/**
+ * Runtime binaries that must keep their own signature: re-signing changes their
+ * bytes, and gentle-pi refuses a Gentle AI binary whose SHA-256 is not its pinned release's.
+ */
+export function keepsOwnSignature(relative) {
+ return /(^|\/)node_modules\/gentle-pi\/\.gentle-ai\//.test(relative);
+}
+
+/** Signing order for nested code: the deepest paths first, so nothing is signed before what it holds. */
+export function insideOut(paths) {
+ const depth = (path) => path.split("/").length;
+ return [...paths].sort((a, b) => depth(b) - depth(a) || a.localeCompare(b));
+}
+
+/**
+ * The configuration `tauri build --config` merges for a release: the staged runtime
+ * as the app's `runtime` resource, and the signing identity. They stay out of
+ * `tauri.macos.conf.json` because tauri-build copies resources on every build, so a
+ * source build (`cargo test`, `tauri dev`) would need a staged runtime.
+ */
+export function tauriReleaseConfig({ runtime, identity }) {
+ return {
+ bundle: {
+ resources: { [runtime]: "runtime" },
+ macOS: { signingIdentity: identity },
+ },
+ };
+}
+
+/** The DMG name Tauri's bundler gives a product, version, and Node-style arch. */
+export function dmgFileName(productName, version, arch) {
+ const names = { arm64: "aarch64", x64: "x64" };
+ if (!names[arch]) throw new Error(`No DMG for arch ${arch}.`);
+ return `${productName}_${version}_${names[arch]}.dmg`;
+}
+
+/**
+ * Files whose permission bits differ between the staged runtime and the app's copy,
+ * or that the copy lacks. Both maps are relative path → mode.
+ */
+export function modeDifferences(staged, bundled) {
+ const differences = [];
+ for (const [path, mode] of staged) {
+ if (!bundled.has(path)) differences.push(`${path} (missing)`);
+ else if ((bundled.get(path) & 0o777) !== (mode & 0o777))
+ differences.push(
+ `${path} (${(mode & 0o777).toString(8)} → ${(bundled.get(path) & 0o777).toString(8)})`,
+ );
+ }
+ return differences;
+}
diff --git a/scripts/package/package-mac.mjs b/scripts/package/package-mac.mjs
new file mode 100644
index 0000000..dab6168
--- /dev/null
+++ b/scripts/package/package-mac.mjs
@@ -0,0 +1,240 @@
+#!/usr/bin/env node
+// Builds the macOS installer (S29.2): stages the runtime, signs its nested code,
+// builds the release app and DMG with Tauri, and verifies the result:
+// `node scripts/package/package-mac.mjs [--sign <identity>] [--skip-stage] [--check]`.
+// `--check-dmg <dmg>` only checks a built DMG: it mounts it read-only, copies the
+// app to a temporary folder, and starts the copy's daemon on a clean HOME.
+import { spawnSync } from "node:child_process";
+import {
+ closeSync,
+ existsSync,
+ lstatSync,
+ mkdirSync,
+ mkdtempSync,
+ openSync,
+ readdirSync,
+ readFileSync,
+ readlinkSync,
+ readSync,
+ rmdirSync,
+ rmSync,
+ statSync,
+} from "node:fs";
+import { tmpdir } from "node:os";
+import { join, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+import {
+ AD_HOC,
+ assertHostTarget,
+ dmgFileName,
+ formatSize,
+ insideOut,
+ isMachO,
+ keepsOwnSignature,
+ modeDifferences,
+ parseMacArgs,
+ sha256File,
+ tauriReleaseConfig,
+} from "./lib.mjs";
+
+const REPO = fileURLToPath(new URL("../..", import.meta.url));
+const TARGET = "darwin-arm64";
+const TAURI = join(REPO, "apps", "desktop", "src-tauri");
+const HERE = join(REPO, "scripts", "package");
+
+const say = (line) => process.stdout.write(`${line}\n`);
+
+function run(command, args, options = {}) {
+ const result = spawnSync(command, args, { stdio: "inherit", ...options });
+ if (result.status !== 0)
+ throw new Error(
+ `${command} ${args.join(" ")} failed (${result.error?.message ?? `exit ${result.status}`}).`,
+ );
+ return result;
+}
+
+/** Runs a command, prints what it wrote (codesign reports on stderr), and fails on a non-zero exit. */
+function report(command, args) {
+ const result = spawnSync(command, args, { encoding: "utf8" });
+ say(`$ ${command} ${args.map((arg) => (/\s/.test(arg) ? `"${arg}"` : arg)).join(" ")}`);
+ const output = `${result.stdout ?? ""}${result.stderr ?? ""}`.trimEnd();
+ if (output) say(output.replace(/^/gm, " "));
+ if (result.status !== 0) throw new Error(`${command} ${args[0]} failed (exit ${result.status}).`);
+ return output;
+}
+
+/** Regular files under `dir`, relative to it; links are neither followed nor listed. */
+function filesIn(dir, prefix = "") {
+ const found = [];
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
+ const relative = prefix ? `${prefix}/${entry.name}` : entry.name;
+ if (entry.isDirectory()) found.push(...filesIn(join(dir, entry.name), relative));
+ else if (entry.isFile()) found.push(relative);
+ }
+ return found;
+}
+
+function modes(dir) {
+ return new Map(filesIn(dir).map((relative) => [relative, lstatSync(join(dir, relative)).mode]));
+}
+
+function machOFiles(dir) {
+ const header = Buffer.alloc(8);
+ return filesIn(dir).filter((relative) => {
+ const fd = openSync(join(dir, relative), "r");
+ try {
+ const read = readSync(fd, header, 0, 8, 0);
+ return isMachO(header.subarray(0, read));
+ } finally {
+ closeSync(fd);
+ }
+ });
+}
+
+const identityName = (identity) => (identity === AD_HOC ? "ad hoc" : `"${identity}"`);
+
+/**
+ * Signs the runtime's Mach-O files with `identity`, deepest first, before Tauri copies
+ * them into the app and signs the app around them. Hardened runtime stays off: Node
+ * needs JIT, and the N-API addons are signed by others (library validation).
+ */
+function signRuntime(runtime, identity) {
+ const binaries = machOFiles(runtime);
+ const kept = binaries.filter(keepsOwnSignature);
+ const signed = insideOut(binaries.filter((relative) => !keepsOwnSignature(relative)));
+ say(`Signing ${signed.length} nested Mach-O files ${identityName(identity)}`);
+ for (const relative of signed) {
+ run("codesign", ["--force", "--sign", identity, "--timestamp=none", join(runtime, relative)]);
+ say(` signed ${relative}`);
+ }
+ for (const relative of kept) {
+ run("codesign", ["--verify", "--strict", join(runtime, relative)]);
+ say(` kept its own signature (pinned digest): ${relative}`);
+ }
+ return { signed, kept };
+}
+
+/** Checks the built app: its signature, its nested code, and that the runtime kept every file and mode. */
+async function verifyApp(app, runtime, nested) {
+ say(`Verifying ${app}`);
+ report("codesign", ["--verify", "--deep", "--strict", "--verbose=2", app]);
+ report("codesign", ["-dv", "--verbose=2", app]);
+ const bundled = join(app, "Contents", "Resources", "runtime");
+ const differences = modeDifferences(modes(runtime), modes(bundled));
+ if (differences.length > 0)
+ throw new Error(`The app's runtime differs from the staged one: ${differences.slice(0, 10).join(", ")}`);
+ say(` runtime: every staged file present with its mode (${filesIn(bundled).length} files)`);
+ for (const relative of nested.signed) run("codesign", ["--verify", "--strict", join(bundled, relative)]);
+ say(` nested signatures valid in the app: ${nested.signed.length}`);
+ for (const relative of nested.kept) {
+ const [staged, copied] = await Promise.all([
+ sha256File(join(runtime, relative)),
+ sha256File(join(bundled, relative)),
+ ]);
+ if (staged !== copied) throw new Error(`${relative} changed on its way into the app.`);
+ say(` unchanged bytes (sha256 ${copied.slice(0, 12)}…): ${relative}`);
+ }
+}
+
+/**
+ * Mounts the DMG read-only, copies the app out, and runs the copy's daemon on a
+ * clean HOME, then from a read-only copy (`smoke-runtime.mjs`). The GUI is not launched.
+ */
+function checkDmg(dmg) {
+ const scratch = mkdtempSync(join(tmpdir(), "gentle-dot-dmg-check-"));
+ const mount = join(scratch, "mount");
+ const copy = join(scratch, "copy");
+ mkdirSync(mount);
+ mkdirSync(copy);
+ say(`Checking ${dmg} (scratch ${scratch})`);
+ run("hdiutil", ["attach", "-nobrowse", "-readonly", "-noautoopen", "-mountpoint", mount, dmg]);
+ let app;
+ try {
+ for (const entry of readdirSync(mount, { withFileTypes: true })) {
+ const path = join(mount, entry.name);
+ const kind = entry.isSymbolicLink() ? `link → ${readlinkSync(path)}` : "folder or file";
+ say(` DMG: ${entry.name} (${kind})`);
+ }
+ const name = readdirSync(mount).find((entry) => entry.endsWith(".app"));
+ if (!name) throw new Error("The DMG holds no app.");
+ app = join(copy, name);
+ run("ditto", [join(mount, name), app]);
+ } finally {
+ run("hdiutil", ["detach", mount]);
+ rmdirSync(mount);
+ }
+ say(`Copied the app to ${app}`);
+ report("codesign", ["--verify", "--deep", "--strict", "--verbose=2", app]);
+ report("codesign", ["-dv", "--verbose=2", app]);
+ report("codesign", ["-d", "-r-", app]);
+ const runtime = join(app, "Contents", "Resources", "runtime");
+ const smoke = join(HERE, "smoke-runtime.mjs");
+ run(process.execPath, [smoke, "--runtime", runtime]);
+ run(process.execPath, [smoke, "--runtime", runtime, "--read-only"]);
+ rmSync(copy, { recursive: true });
+ say(`DMG check: ok (the app copy was removed; smoke scratch folders are kept under ${tmpdir()})`);
+}
+
+async function main() {
+ const options = parseMacArgs(process.argv.slice(2));
+ assertHostTarget(TARGET);
+ if (options.checkDmg) {
+ checkDmg(resolve(process.env.INIT_CWD ?? process.cwd(), options.checkDmg));
+ return;
+ }
+
+ // The Tauri CLI asks rustc for its version itself; a cargo wrapper that finds rustc on its own is not enough.
+ if (spawnSync("rustc", ["--version"]).status !== 0)
+ throw new Error(
+ "rustc is not on PATH; the Tauri CLI needs it (install Rust with rustup, or add it to PATH).",
+ );
+
+ const runtime = join(REPO, "build", "runtime", TARGET);
+ if (options.skipStage) {
+ if (!existsSync(join(runtime, "MANIFEST.json")))
+ throw new Error(`--skip-stage needs a staged runtime in ${runtime}; run without it once.`);
+ say(`Using the staged runtime in ${runtime}`);
+ } else run(process.execPath, [join(HERE, "stage-runtime.mjs"), "--target", TARGET, "--out", runtime]);
+
+ const nested = signRuntime(runtime, options.identity);
+
+ // Tauri copies the signed runtime into the app, signs the app, and builds the DMG from it.
+ // Unless asked, the DMG's Finder window is not scripted (CI): that needs Finder automation.
+ const config = tauriReleaseConfig({ runtime, identity: options.identity });
+ say(`tauri build --bundles app,dmg (release, signing ${identityName(options.identity)})`);
+ const env = { ...process.env, APPLE_SIGNING_IDENTITY: options.identity };
+ if (options.finderLayout) delete env.CI;
+ else env.CI = "true";
+ run(
+ "pnpm",
+ [
+ "--filter",
+ "@gentle-dot/desktop",
+ "exec",
+ "tauri",
+ "build",
+ "--bundles",
+ "app,dmg",
+ "--config",
+ JSON.stringify(config),
+ ],
+ { cwd: REPO, env },
+ );
+
+ const { productName, version } = JSON.parse(readFileSync(join(TAURI, "tauri.conf.json"), "utf8"));
+ const bundle = join(TAURI, "target", "release", "bundle");
+ const app = join(bundle, "macos", `${productName}.app`);
+ const dmg = join(bundle, "dmg", dmgFileName(productName, version, "arm64"));
+ if (!existsSync(dmg)) throw new Error(`Tauri left no ${dmg}.`);
+ await verifyApp(app, runtime, nested);
+ report("hdiutil", ["verify", dmg]);
+ const size = statSync(dmg).size;
+ say(`App: ${app}`);
+ say(`DMG: ${dmg}: ${formatSize(size)} (${size} bytes), signed ${identityName(options.identity)}`);
+ if (options.check) checkDmg(dmg);
+}
+
+main().catch((error) => {
+ process.stderr.write(`package-mac: ${error.message}\n`);
+ process.exit(1);
+});
diff --git a/scripts/package/test/package-mac.test.ts b/scripts/package/test/package-mac.test.ts
new file mode 100644
index 0000000..da6d7a8
--- /dev/null
+++ b/scripts/package/test/package-mac.test.ts
@@ -0,0 +1,116 @@
+import { describe, expect, it } from "vitest";
+import {
+ AD_HOC,
+ dmgFileName,
+ insideOut,
+ isMachO,
+ keepsOwnSignature,
+ modeDifferences,
+ parseMacArgs,
+ tauriReleaseConfig,
+} from "../lib.mjs";
+
+describe("parseMacArgs", () => {
+ it("signs ad hoc unless an identity is given, and the flag wins over the environment", () => {
+ expect(parseMacArgs([], {})).toEqual({
+ skipStage: false,
+ check: false,
+ finderLayout: false,
+ identity: AD_HOC,
+ });
+ expect(parseMacArgs([], { GENTLE_DOT_SIGN_IDENTITY: "Gentle Dot Local" }).identity).toBe(
+ "Gentle Dot Local",
+ );
+ expect(parseMacArgs([], { GENTLE_DOT_SIGN_IDENTITY: "" }).identity).toBe(AD_HOC);
+ expect(
+ parseMacArgs(["--", "--sign", "Gentle Dot Local"], { GENTLE_DOT_SIGN_IDENTITY: "Other" }).identity,
+ ).toBe("Gentle Dot Local");
+ });
+
+ it("reads the switches and the DMG to check", () => {
+ expect(
+ parseMacArgs(["--skip-stage", "--check", "--finder-layout", "--check-dmg", "/tmp/a.dmg"], {}),
+ ).toEqual({
+ skipStage: true,
+ check: true,
+ finderLayout: true,
+ checkDmg: "/tmp/a.dmg",
+ identity: AD_HOC,
+ });
+ });
+
+ it("refuses unknown flags and a value-taking flag without its value", () => {
+ expect(() => parseMacArgs(["--notarize"], {})).toThrow(/Unexpected argument --notarize/);
+ expect(() => parseMacArgs(["--sign"], {})).toThrow(/Unexpected argument --sign/);
+ expect(() => parseMacArgs(["--sign", "--check"], {})).toThrow(/Unexpected argument --sign/);
+ expect(() => parseMacArgs(["--sign", ""], {})).toThrow(/Unexpected argument --sign/);
+ });
+});
+
+describe("isMachO", () => {
+ const header = (...words: number[]) => {
+ const bytes = Buffer.alloc(words.length * 4);
+ words.forEach((word, i) => {
+ bytes.writeUInt32BE(word, i * 4);
+ });
+ return bytes;
+ };
+
+ it("recognizes thin 64- and 32-bit headers and universal binaries", () => {
+ expect(isMachO(header(0xcffaedfe, 0x0c000001))).toBe(true);
+ expect(isMachO(header(0xcefaedfe, 0x07000000))).toBe(true);
+ expect(isMachO(header(0xcafebabe, 2))).toBe(true);
+ });
+
+ it("rejects scripts, Java class files, and short files", () => {
+ expect(isMachO(Buffer.from("#!/bin/sh\nexec node\n"))).toBe(false);
+ expect(isMachO(header(0xcafebabe, 52))).toBe(false);
+ expect(isMachO(Buffer.from([0xcf, 0xfa, 0xed]))).toBe(false);
+ });
+});
+
+describe("signing plan", () => {
+ it("keeps the pinned Gentle AI binary's own signature and only that", () => {
+ expect(keepsOwnSignature("daemon/node_modules/gentle-pi/.gentle-ai/v4.0.0/gentle-ai")).toBe(true);
+ expect(keepsOwnSignature("node/bin/node")).toBe(false);
+ expect(keepsOwnSignature("bin/engram")).toBe(false);
+ expect(keepsOwnSignature("daemon/node_modules/esbuild/bin/esbuild")).toBe(false);
+ });
+
+ it("signs the deepest paths first", () => {
+ expect(insideOut(["node/bin/node", "bin/engram", "daemon/node_modules/a/b/c.node"])).toEqual([
+ "daemon/node_modules/a/b/c.node",
+ "node/bin/node",
+ "bin/engram",
+ ]);
+ });
+
+ it("maps the staged runtime to the app's runtime resource with the identity", () => {
+ expect(tauriReleaseConfig({ runtime: "/repo/build/runtime/darwin-arm64", identity: "-" })).toEqual({
+ bundle: {
+ resources: { "/repo/build/runtime/darwin-arm64": "runtime" },
+ macOS: { signingIdentity: "-" },
+ },
+ });
+ });
+
+ it("names the DMG the way Tauri does", () => {
+ expect(dmgFileName("Gentle Dot", "0.1.0", "arm64")).toBe("Gentle Dot_0.1.0_aarch64.dmg");
+ expect(() => dmgFileName("Gentle Dot", "0.1.0", "ia32")).toThrow(/ia32/);
+ });
+});
+
+describe("modeDifferences", () => {
+ it("reports changed permission bits and missing files, ignoring the file type bits", () => {
+ const staged = new Map([
+ ["node/bin/node", 0o100755],
+ ["daemon/cli.mjs", 0o100644],
+ ["bin/engram", 0o100755],
+ ]);
+ const bundled = new Map([
+ ["node/bin/node", 0o755],
+ ["daemon/cli.mjs", 0o100755],
+ ]);
+ expect(modeDifferences(staged, bundled)).toEqual(["daemon/cli.mjs (644 → 755)", "bin/engram (missing)"]);
+ });
+});