Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

Add the macOS release build (Kokon.app + .dmg)

Gabriele Lozuponee9584d8c186c
diff --git a/mcp/scripts/build-exe.mjs b/mcp/scripts/build-exe.mjs
index 1bbc062..35c2b6a 100644
--- a/mcp/scripts/build-exe.mjs
+++ b/mcp/scripts/build-exe.mjs
@@ -1,4 +1,4 @@
-// Builds build/kokon-mcp.exe: the bundled server injected into a copy of node.exe
+// Builds build/kokon-mcp(.exe): the bundled server injected into a copy of the Node binary
// (Node "single executable application"). No separate Node install is needed to run it.
import { execFileSync } from "node:child_process";
import fs from "node:fs";
@@ -16,10 +16,21 @@ fs.writeFileSync(
JSON.stringify({ main: "build/kokon-mcp.cjs", output: "build/sea-prep.blob", disableExperimentalSEAWarning: true, useSnapshot: false, useCodeCache: true }),
);
run(process.execPath, ["--experimental-sea-config", "build/sea-config.json"]);
-const exe = path.join(build, "kokon-mcp.exe");
+const mac = process.platform === "darwin";
+const exe = path.join(build, mac ? "kokon-mcp" : "kokon-mcp.exe");
fs.copyFileSync(process.execPath, exe);
-run("npx", ["postject", exe, "NODE_SEA_BLOB", path.join(build, "sea-prep.blob"), "--sentinel-fuse", "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2"]);
+fs.chmodSync(exe, 0o755);
+const fuse = ["--sentinel-fuse", "NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2"];
+if (mac) {
+ // macOS (Node SEA docs): drop Node's signature, inject into the NODE_SEA segment, re-sign ad hoc.
+ run("codesign", ["--remove-signature", exe]);
+ run("npx", ["postject", exe, "NODE_SEA_BLOB", path.join(build, "sea-prep.blob"), ...fuse, "--macho-segment-name", "NODE_SEA"]);
+ run("codesign", ["--sign", "-", exe]);
+} else {
+ run("npx", ["postject", exe, "NODE_SEA_BLOB", path.join(build, "sea-prep.blob"), ...fuse]);
+}
-const sidecar = path.resolve(root, "..", "src-tauri", "binaries", "kokon-mcp-x86_64-pc-windows-msvc.exe");
+const triple = mac ? "aarch64-apple-darwin" : "x86_64-pc-windows-msvc";
+const sidecar = path.resolve(root, "..", "src-tauri", "binaries", `kokon-mcp-${triple}${mac ? "" : ".exe"}`);
fs.copyFileSync(exe, sidecar);
console.log(`built ${exe} (${(fs.statSync(exe).size / 1e6).toFixed(1)} MB) -> ${sidecar}`);
diff --git a/scripts/build-release-mac.sh b/scripts/build-release-mac.sh
new file mode 100755
index 0000000..dc38d4d
--- /dev/null
+++ b/scripts/build-release-mac.sh
@@ -0,0 +1,41 @@
+#!/usr/bin/env bash
+# Builds the macOS release on an Apple Silicon Mac: kokon-service, kokon-mcp, Kokon.app and
+# the disk image ("Kokon_<version>_aarch64.dmg"), copied to dist-release/.
+#
+# bash scripts/build-release-mac.sh
+#
+# Same prerequisites as scripts/dev/mac-dev.sh (run it with --check). Takes ~5-15 minutes on
+# the first run (optimized Rust build). Signed ad hoc (no Apple Developer ID): users open it
+# the first time through System Settings → Privacy & Security → Open Anyway.
+set -euo pipefail
+cd "$(dirname "$0")/.."
+TRIPLE=aarch64-apple-darwin
+
+bash scripts/dev/mac-dev.sh --check
+
+echo "1/5 Packages"
+npm ci --no-audit --no-fund
+(cd mcp && npm ci --no-audit --no-fund)
+
+echo "2/5 Tests (Rust core + frontend + MCP)"
+cargo test -p qls-core --release --quiet
+npx vitest run
+(cd mcp && npx vitest run)
+
+echo "3/5 kokon-service (release)"
+cargo build -p qls-service --release
+mkdir -p src-tauri/binaries
+cp target/release/kokon-service "src-tauri/binaries/kokon-service-$TRIPLE"
+
+echo "4/5 kokon-mcp"
+(cd mcp && npm run build:exe)
+
+echo "5/5 Kokon.app + disk image"
+npx tauri build --target "$TRIPLE"
+
+DMG="$(ls -t target/$TRIPLE/release/bundle/dmg/*.dmg | head -1)"
+mkdir -p dist-release
+cp "$DMG" dist-release/
+codesign --verify --deep --strict "target/$TRIPLE/release/bundle/macos/Kokon.app" && echo "✓ signature (ad hoc) valid"
+ls -lh dist-release/*.dmg
+echo "Disk image: $(pwd)/dist-release/$(basename "$DMG")"