Files
s41r4j-pixie/scripts/finalize-app.mjs
T
s41r4jandClaude Opus 5.5 9aa655980a Pixie 0.7.7: Windows and Linux, auto-update, canvas, memory, personalities
- Windows parity through an in-process native layer (capture, OCR, UI
  Automation, input, speech in and out); Linux preview builds; CI checks
  for both; CHECKLIST.md of what works where.
- Updates itself from GitHub Releases (signed latest.json), installs when
  idle; Settings > About and tray controls.
- Excalidraw canvas replaces the old board: opens in front, hides on an
  outside click, open/list/read/clear/delete, exports, Show Canvas in the
  menu, draws on its own when a picture helps (Settings > General > Drawing).
- Memory: one chat per day with a running summary, long-term notes in
  memory.json (remember/forget, learned from quiet chats), Settings > Memory.
- Pixie knows and controls itself (pixie tool): settings by voice, quit,
  stop all jobs, new chat; instant commands for the short ones.
- Four personalities (Pix, Inos, Xtrem with Spicy, Eon) with their own faces.
- Connectors moved off retired packages (GitHub, Slack, Brave), new Sentry
  and Context7, clearer status and errors, add your own server.
- Lower idle RAM (voice loads on demand, Settings and canvas freed on close),
  click-before-typing, no em dashes, docs and website updated, repo tidy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 02:28:45 +05:30

65 lines
3.6 KiB
JavaScript

#!/usr/bin/env node
// Re-sign the built app so its identity is stable across rebuilds, then make the DMG.
//
// Why: an ad-hoc signature's designated requirement defaults to `cdhash H"…"`, which changes on
// every build. macOS stores Screen Recording / Accessibility grants against that requirement, so
// a rebuilt app shows as "Not allowed" even though its switch is on. We pin the requirement to
// the bundle identifier instead (`identifier "com.openclicky.app"`), which every build satisfies.
// With a real certificate (APPLE_SIGNING_IDENTITY) the default requirement is already stable.
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
const repo = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const target = process.argv[2] ?? "target/release/bundle";
const bundleDir = path.join(repo, target);
const app = path.join(bundleDir, "macos/Pixie.app");
const entitlements = path.join(repo, "apps/desktop/src-tauri/entitlements.plist");
const identity = process.env.APPLE_SIGNING_IDENTITY || "-";
const version = JSON.parse(fs.readFileSync(path.join(repo, "apps/desktop/src-tauri/tauri.conf.json"), "utf8")).version;
const sign = (file, ident) => {
const args = ["--force", "--sign", identity, "--options", "runtime", "--entitlements", entitlements, "--identifier", ident];
if (identity === "-") args.push(`-r=designated => identifier "${ident}"`);
execFileSync("codesign", [...args, file], { stdio: "inherit" });
};
if (!fs.existsSync(app)) {
console.error(`no app at ${app}`);
process.exit(1);
}
// Inner executables first, then the bundle (which seals them). With a real Developer ID the
// Tauri bundler has already signed (and notarized) the app; re-signing would undo that.
if (identity === "-") {
sign(path.join(app, "Contents/MacOS/openclicky-helper"), "com.openclicky.helper");
sign(path.join(app, "Contents/MacOS/openclicky-voice"), "com.openclicky.voice");
sign(app, "com.openclicky.app");
}
execFileSync("codesign", ["--verify", "--deep", "--strict", app], { stdio: "inherit" });
const req = execFileSync("codesign", ["-d", "-r-", app], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] });
console.log(req.trim().split("\n").pop());
const dmgDir = path.join(bundleDir, "dmg");
fs.mkdirSync(dmgDir, { recursive: true });
const arch = target.includes("universal") ? "universal" : process.arch === "arm64" ? "aarch64" : "x64";
const dmg = path.join(dmgDir, `Pixie_${version}_${arch}.dmg`);
fs.rmSync(dmg, { force: true });
const stage = fs.mkdtempSync(path.join(dmgDir, "stage-"));
execFileSync("ditto", [app, path.join(stage, "Pixie.app")]);
fs.symlinkSync("/Applications", path.join(stage, "Applications"));
execFileSync("hdiutil", ["create", "-volname", "Pixie", "-srcfolder", stage, "-ov", "-format", "UDZO", dmg], { stdio: "ignore" });
fs.rmSync(stage, { recursive: true, force: true });
console.log(`app: ${app}\ndmg: ${dmg}`);
// Auto-update package: the finished (re-signed) app as .app.tar.gz plus its updater signature.
// Only when the signing key is around (CI with TAURI_SIGNING_PRIVATE_KEY); local builds skip it.
if (process.env.TAURI_SIGNING_PRIVATE_KEY) {
const tgz = path.join(bundleDir, "macos/Pixie.app.tar.gz");
fs.rmSync(tgz, { force: true });
fs.rmSync(`${tgz}.sig`, { force: true });
execFileSync("tar", ["-czf", tgz, "-C", path.join(bundleDir, "macos"), "Pixie.app"], { stdio: "inherit" });
execFileSync("npx", ["--no-install", "tauri", "signer", "sign", tgz], { cwd: path.join(repo, "apps/desktop"), stdio: "inherit" });
console.log(`update: ${tgz}`);
}