graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
feat(gui): desktop auto-update + install graff CLI on first launch
Rach Pradhan4ec451077621
diff --git a/README.md b/README.mdindex b7837a5e..6eb3ad4b 100644--- a/README.md+++ b/README.md@@ -47,10 +47,12 @@ context when the conversation gets long.### Desktop app — macOS (Apple Silicon)-Prefer a window over a terminal? Download the latest signed, notarized build, drag it to Applications, and open it. On first launch it installs a `codegraff` launcher on your PATH, so `codegraff <path>` opens that folder in the app (`code`-style). For the `graff` agent CLI itself, use the command-line install below — the desktop app runs whatever `graff` is on your PATH.+Prefer a window over a terminal? Download the latest signed, notarized build, drag it to Applications, and open it. The desktop app is **fully self-contained** — it bundles the `graff` agent, so there's nothing else to install to start coding, and it keeps itself up to date automatically. On first launch it drops two commands on your PATH: `codegraff <path>` (opens that folder in the app, `code`-style) and `graff` itself (the agent CLI, in your terminal) — so the one install covers both the window and the command line. The terminal `graff` is symlinked into the app, so it auto-updates along with it. Not on Apple Silicon, or want a standalone CLI? Use the command-line install below.<p align="center">- <a href="https://github.com/justrach/codegraff/releases/latest"><img alt="Download Codegraff for macOS" src="https://img.shields.io/badge/Download%20for%20macOS-Apple%20Silicon-000000?style=for-the-badge&logo=apple&logoColor=white"></a>+ <a href="https://github.com/justrach/codegraff/releases/latest/download/Codegraff.dmg"><img alt="Download Codegraff for macOS" src="https://img.shields.io/badge/Download%20for%20macOS-Apple%20Silicon-000000?style=for-the-badge&logo=apple&logoColor=white"></a>+ <br/>+ <sub><a href="https://github.com/justrach/codegraff/releases/latest">or browse all releases</a></sub></p>### Command line — macOS · Linuxdiff --git a/bun.lock b/bun.lockindex 57776952..9e903ba8 100644--- a/bun.lock+++ b/bun.lock@@ -15,6 +15,8 @@"@legendapp/list": "^3.0.0-beta.44","@tauri-apps/api": "^2.10.1","@tauri-apps/plugin-dialog": "^2.7.0",+ "@tauri-apps/plugin-process": "^2.3.0",+ "@tauri-apps/plugin-updater": "^2.9.0","@wterm/dom": "^0.1.9","border-beam": "^1.0.1","class-variance-authority": "^0.7.1",@@ -323,6 +325,10 @@"@tauri-apps/plugin-dialog": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.11.0" } }, "sha512-OK1UBXYt+ojcmxMktzzuyonYIFta8CmAASpX+CA+DTGK24KlHjhYI6x2iOJ/TjZF4N7/ACK1oFmEOjIY9IhzOQ=="],+ "@tauri-apps/plugin-process": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-nCa4fGVaDL/B9ai03VyPOjfAHRHSBz5v6F/ObsB73r/dA3MHHhZtldaDMIc0V/pnUw9ehzr2iEG+XkSEyC0JJA=="],++ "@tauri-apps/plugin-updater": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.10.1" } }, "sha512-NFYMg+tWOZPJdzE/PpFj2qfqwAWwNS3kXrb1tm1gnBJ9mYzZ4WDRrwy8udzWoAnfGCHLuePNLY1WVCNHnh3eRA=="],+"@ts-morph/common": ["@ts-morph/[email protected]", "", { "dependencies": { "fast-glob": "^3.3.3", "minimatch": "^10.0.1", "path-browserify": "^1.0.1" } }, "sha512-Wf29UqxWDpc+i61k3oIOzcUfQt79PIT9y/MWfAGlrkjg6lBC1hwDECLXPVJAhWjiGbfBCxZd65F/LIZF3+jeJQ=="],"@tybys/wasm-util": ["@tybys/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-RoBvJ2X0wuKlWFIjrwffGw1IqZHKQqzIchKaadZZfnNpsAYp2mM0h36JtPCjNDAHGgYez/15uMBpfGwchhiMgg=="],diff --git a/gui/package.json b/gui/package.jsonindex ec003c91..03dddbeb 100644--- a/gui/package.json+++ b/gui/package.json@@ -1,7 +1,7 @@{"name": "codegraff-gui","private": true,- "version": "0.0.13",+ "version": "0.0.162","license": "Apache-2.0","packageManager": "[email protected]","type": "module",@@ -22,6 +22,8 @@"@legendapp/list": "^3.0.0-beta.44","@tauri-apps/api": "^2.10.1","@tauri-apps/plugin-dialog": "^2.7.0",+ "@tauri-apps/plugin-process": "^2.3.0",+ "@tauri-apps/plugin-updater": "^2.9.0","@wterm/dom": "^0.1.9","border-beam": "^1.0.1","class-variance-authority": "^0.7.1",diff --git a/gui/src-tauri/Cargo.lock b/gui/src-tauri/Cargo.lockindex 26dcf967..6c99c135 100644--- a/gui/src-tauri/Cargo.lock+++ b/gui/src-tauri/Cargo.lock@@ -75,6 +75,15 @@ version = "1.0.102"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"+[[package]]+name = "arbitrary"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"+dependencies = [+ "derive_arbitrary",+]+[[package]]name = "arrayvec"version = "0.7.6"@@ -646,7 +655,7 @@ checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901"[[package]]name = "codegraff-gui"-version = "0.0.13"+version = "0.0.162"dependencies = ["anyhow","async-trait",@@ -669,7 +678,9 @@ dependencies = ["tauri-build","tauri-plugin-dialog","tauri-plugin-log",+ "tauri-plugin-process","tauri-plugin-single-instance",+ "tauri-plugin-updater","tiny_http","tokio","tonic",@@ -953,6 +964,17 @@ dependencies = ["serde_core",]+[[package]]+name = "derive_arbitrary"+version = "1.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.117",+]+[[package]]name = "derive_more"version = "0.99.20"@@ -1350,6 +1372,16 @@ dependencies = ["winapi",]+[[package]]+name = "filetime"+version = "0.2.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759"+dependencies = [+ "cfg-if",+ "libc",+]+[[package]]name = "find-msvc-tools"version = "0.1.9"@@ -2677,6 +2709,12 @@ version = "0.3.17"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"+[[package]]+name = "minisign-verify"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22f9645cb765ea72b8111f36c522475d2daa0d22c957a9826437e97534bc4e9e"+[[package]]name = "miniz_oxide"version = "0.8.9"@@ -2932,6 +2970,18 @@ dependencies = ["objc2-core-foundation",]+[[package]]+name = "objc2-osa-kit"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0"+dependencies = [+ "bitflags 2.11.1",+ "objc2",+ "objc2-app-kit",+ "objc2-foundation",+]+[[package]]name = "objc2-quartz-core"version = "0.3.2"@@ -2980,6 +3030,12 @@ dependencies = ["portable-atomic",]+[[package]]+name = "openssl-probe"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe"+[[package]]name = "option-ext"version = "0.2.0"@@ -2996,6 +3052,20 @@ dependencies = ["pin-project-lite",]+[[package]]+name = "osakit"+version = "0.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b"+dependencies = [+ "objc2",+ "objc2-foundation",+ "objc2-osa-kit",+ "serde",+ "serde_json",+ "thiserror 2.0.18",+]+[[package]]name = "pango"version = "0.18.3"@@ -3856,15 +3926,20 @@ dependencies = ["http-body","http-body-util","hyper",+ "hyper-rustls","hyper-util","js-sys","log","percent-encoding","pin-project-lite",+ "rustls",+ "rustls-pki-types",+ "rustls-platform-verifier","serde","serde_json","sync_wrapper","tokio",+ "tokio-rustls","tokio-util","tower","tower-http",@@ -4025,6 +4100,18 @@ dependencies = ["zeroize",]+[[package]]+name = "rustls-native-certs"+version = "0.8.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dab5152771c58876a2146916e53e35057e1a4dfa2b9df0f0305b07f611fdea4d"+dependencies = [+ "openssl-probe",+ "rustls-pki-types",+ "schannel",+ "security-framework",+]+[[package]]name = "rustls-pki-types"version = "1.14.0"@@ -4035,6 +4122,33 @@ dependencies = ["zeroize",]+[[package]]+name = "rustls-platform-verifier"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784"+dependencies = [+ "core-foundation",+ "core-foundation-sys",+ "jni",+ "log",+ "once_cell",+ "rustls",+ "rustls-native-certs",+ "rustls-platform-verifier-android",+ "rustls-webpki",+ "security-framework",+ "security-framework-sys",+ "webpki-root-certs",+ "windows-sys 0.61.2",+]++[[package]]+name = "rustls-platform-verifier-android"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"+[[package]]name = "rustls-webpki"version = "0.103.12"@@ -4067,6 +4181,15 @@ dependencies = ["winapi-util",]+[[package]]+name = "schannel"+version = "0.1.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "91c1b7e4904c873ef0710c1f407dde2e6287de2bebc1bbbf7d430bb7cbffd939"+dependencies = [+ "windows-sys 0.61.2",+]+[[package]]name = "schemars"version = "0.8.22"@@ -4130,6 +4253,29 @@ version = "4.1.0"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"+[[package]]+name = "security-framework"+version = "3.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"+dependencies = [+ "bitflags 2.11.1",+ "core-foundation",+ "core-foundation-sys",+ "libc",+ "security-framework-sys",+]++[[package]]+name = "security-framework-sys"+version = "2.17.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3"+dependencies = [+ "core-foundation-sys",+ "libc",+]+[[package]]name = "selectors"version = "0.24.0"@@ -4719,6 +4865,17 @@ version = "1.0.1"source = "registry+https://github.com/rust-lang/crates.io-index"checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"+[[package]]+name = "tar"+version = "0.4.46"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840"+dependencies = [+ "filetime",+ "libc",+ "xattr",+]+[[package]]name = "target-lexicon"version = "0.12.16"@@ -4920,6 +5077,16 @@ dependencies = ["time",]+[[package]]+name = "tauri-plugin-process"+version = "2.3.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d55511a7bf6cd70c8767b02c97bf8134fa434daf3926cfc1be0a0f94132d165a"+dependencies = [+ "tauri",+ "tauri-plugin",+]+[[package]]name = "tauri-plugin-single-instance"version = "2.4.2"@@ -4935,6 +5102,39 @@ dependencies = ["zbus",]+[[package]]+name = "tauri-plugin-updater"+version = "2.10.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "806d9dac662c2e4594ff03c647a552f2c9bd544e7d0f683ec58f872f952ce4af"+dependencies = [+ "base64 0.22.1",+ "dirs",+ "flate2",+ "futures-util",+ "http",+ "infer",+ "log",+ "minisign-verify",+ "osakit",+ "percent-encoding",+ "reqwest 0.13.2",+ "rustls",+ "semver",+ "serde",+ "serde_json",+ "tar",+ "tauri",+ "tauri-plugin",+ "tempfile",+ "thiserror 2.0.18",+ "time",+ "tokio",+ "url",+ "windows-sys 0.60.2",+ "zip",+]+[[package]]name = "tauri-runtime"version = "2.10.1"@@ -5935,6 +6135,15 @@ dependencies = ["system-deps",]+[[package]]+name = "webpki-root-certs"+version = "1.0.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0d46a5a140e6f7afeccd8eae97eff335163939eac8b929834875168b29b3d267"+dependencies = [+ "rustls-pki-types",+]+[[package]]name = "webpki-roots"version = "1.0.6"@@ -6648,6 +6857,16 @@ dependencies = ["pkg-config",]+[[package]]+name = "xattr"+version = "1.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"+dependencies = [+ "libc",+ "rustix",+]+[[package]]name = "yansi"version = "1.0.1"@@ -6818,6 +7037,18 @@ dependencies = ["syn 2.0.117",]+[[package]]+name = "zip"+version = "4.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "caa8cd6af31c3b31c6631b8f483848b91589021b28fffe50adada48d4f4d2ed1"+dependencies = [+ "arbitrary",+ "crc32fast",+ "indexmap 2.14.0",+ "memchr",+]+[[package]]name = "zmij"version = "1.0.21"diff --git a/gui/src-tauri/Cargo.toml b/gui/src-tauri/Cargo.tomlindex c2a87eea..3a359508 100644--- a/gui/src-tauri/Cargo.toml+++ b/gui/src-tauri/Cargo.toml@@ -6,7 +6,7 @@[package]name = "codegraff-gui"-version = "0.0.13"+version = "0.0.162"description = "Desktop coding agent interface powered by Codegraff"authors = ["Codegraff contributors"]license = "Apache-2.0"@@ -40,6 +40,8 @@ tauri = { version = "2.10.3", features = ["macos-private-api"] }tauri-plugin-dialog = "2"tauri-plugin-single-instance = "2"tauri-plugin-log = "2"+tauri-plugin-updater = "2"+tauri-plugin-process = "2"tokio = { version = "1.51.0", features = ["io-util", "macros", "net", "process", "rt-multi-thread", "sync", "time"] }tonic = { version = "0.14.5", features = ["tls-webpki-roots"] }ts-rs = "12.0.1"diff --git a/gui/src-tauri/capabilities/default.json b/gui/src-tauri/capabilities/default.jsonindex b20e21a6..586c463b 100644--- a/gui/src-tauri/capabilities/default.json+++ b/gui/src-tauri/capabilities/default.json@@ -8,6 +8,8 @@"permissions": ["core:default","core:window:allow-start-dragging",- "dialog:default"+ "dialog:default",+ "updater:default",+ "process:default"]}diff --git a/gui/src-tauri/src/cli_install.rs b/gui/src-tauri/src/cli_install.rsindex b7b38363..665b44b9 100644--- a/gui/src-tauri/src/cli_install.rs+++ b/gui/src-tauri/src/cli_install.rs@@ -50,12 +50,20 @@ pub fn ensure_cli_symlink(app: &tauri::App) {targets.push(home.join(".local").join("bin"));}+ // The bundled agent CLI ships beside the app binary (externalBin →+ // Contents/MacOS/graff). We link it onto PATH so installing the app also+ // installs the `graff` terminal command.+ let bundled_graff = exe.parent().map(|d| d.join("graff"));+for dir in targets {let link = dir.join("codegraff");// Already current (handles app moves and the prior symlink form)?if let Ok(existing) = std::fs::read_to_string(&link) {if existing == script {log::info!("codegraff launcher already current at {}", link.display());+ if let Some(ref g) = bundled_graff {+ ensure_graff_on_path(&dir, g);+ }return;}}@@ -73,6 +81,9 @@ pub fn ensure_cli_symlink(app: &tauri::App) {match written {Ok(()) => {log::info!("codegraff launcher installed at {}", link.display());+ if let Some(ref g) = bundled_graff {+ ensure_graff_on_path(&dir, g);+ }return;}Err(err) => {@@ -82,5 +93,42 @@ pub fn ensure_cli_symlink(app: &tauri::App) {}}+/// Put the bundled `graff` agent CLI on PATH (next to the `codegraff` launcher),+/// so installing the desktop app also gives you the terminal command. It's a+/// symlink into the app bundle, so `graff` tracks the app's auto-updates.+///+/// Never clobbers a real `graff` — e.g. one installed by `install.sh` into ~/bin+/// or a Homebrew copy. Only creates the link when nothing is there, or refreshes+/// a symlink we previously made (one pointing into a .app bundle, e.g. after the+/// app was moved or updated).+#[cfg(target_os = "macos")]+fn ensure_graff_on_path(dir: &std::path::Path, bundled_graff: &std::path::Path) {+ use std::os::unix::fs::symlink;+ if !bundled_graff.is_file() {+ return;+ }+ let link = dir.join("graff");+ match std::fs::symlink_metadata(&link) {+ Ok(meta) => {+ if !meta.file_type().is_symlink() {+ // A regular file is a real install — never overwrite it.+ return;+ }+ let current = std::fs::read_link(&link).unwrap_or_default();+ if current == bundled_graff {+ return; // already correct+ }+ if !current.to_string_lossy().contains(".app/Contents/MacOS/") {+ return; // a symlink to something that isn't ours — leave it+ }+ let _ = std::fs::remove_file(&link);+ }+ Err(_) => {} // absent — fall through and create it+ }+ if symlink(bundled_graff, &link).is_ok() {+ log::info!("graff CLI linked at {}", link.display());+ }+}+#[cfg(not(target_os = "macos"))]pub fn ensure_cli_symlink(_app: &tauri::App) {}diff --git a/gui/src-tauri/src/lib.rs b/gui/src-tauri/src/lib.rsindex 109c341e..9e315557 100644--- a/gui/src-tauri/src/lib.rs+++ b/gui/src-tauri/src/lib.rs@@ -61,7 +61,9 @@ pub fn run() {let _ = window.set_focus();}}))- .plugin(tauri_plugin_dialog::init());+ .plugin(tauri_plugin_dialog::init())+ .plugin(tauri_plugin_updater::Builder::new().build())+ .plugin(tauri_plugin_process::init());#[cfg(debug_assertions)]let builder = builder.plugin(tauri_plugin_log::Builder::default()diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.jsonindex e7447ae0..6aa88e79 100644--- a/gui/src-tauri/tauri.conf.json+++ b/gui/src-tauri/tauri.conf.json@@ -1,7 +1,7 @@{"$schema": "../node_modules/@tauri-apps/cli/config.schema.json","productName": "Codegraff",- "version": "0.0.13",+ "version": "0.0.162","identifier": "dev.codegraff.gui","build": {"frontendDist": "../dist",@@ -34,6 +34,7 @@},"bundle": {"active": true,+ "createUpdaterArtifacts": true,"externalBin": ["binaries/graff"],"targets": "all","icon": [@@ -47,5 +48,13 @@"signingIdentity": "Developer ID Application: Rachit Pradhan (WWP9DLJ27P)","hardenedRuntime": true}+ },+ "plugins": {+ "updater": {+ "endpoints": [+ "https://github.com/justrach/codegraff/releases/latest/download/latest.json"+ ],+ "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEM1RjYxOTJEOEJGQzgzNDUKUldSRmcveUxMUm4yeGJ3aDBQQTdkYU9aa2ppN2Z4dUlCcWxvbFhBbkNyeUFEaGRyNVB0K3c4dVQK"+ }}}diff --git a/gui/src/main.tsx b/gui/src/main.tsxindex 258380bc..cd18ffac 100644--- a/gui/src/main.tsx+++ b/gui/src/main.tsx@@ -5,9 +5,14 @@ import '@codegraff/diffs/style.css'import './styles/index.css'import './styles/diffs.css'import App from './app/App'+import { checkForUpdates } from './services/updater'createRoot(document.getElementById('root')!).render(<StrictMode><App /></StrictMode>,)++// Auto-check for a newer desktop build on launch (non-blocking; prompts only+// when an update is available). Manual checks call checkForUpdates({silent:false}).+void checkForUpdates()diff --git a/gui/src/services/updater.ts b/gui/src/services/updater.tsnew file mode 100644index 00000000..c82e8f72--- /dev/null+++ b/gui/src/services/updater.ts@@ -0,0 +1,60 @@+import { ask, message } from "@tauri-apps/plugin-dialog";+import { relaunch } from "@tauri-apps/plugin-process";+import { check } from "@tauri-apps/plugin-updater";++let inFlight = false;++/**+ * Check GitHub for a newer desktop build and, if one exists, offer to install+ * it. Downloads the signed updater artifact (verified against the bundled+ * minisign public key), applies it, and relaunches.+ *+ * The updater endpoint and pubkey live in `src-tauri/tauri.conf.json`. This+ * complements the CLI's `graff update`: that updates only the bundled `graff`+ * binary, while this swaps the whole desktop app.+ *+ * @param silent When true (the on-launch path) stay quiet if already current or+ * if the check fails. The manual "Check for Updates" path passes false so the+ * user always gets feedback.+ */+export async function checkForUpdates({ silent = true }: { silent?: boolean } = {}): Promise<void> {+ if (inFlight) return;+ inFlight = true;+ try {+ const update = await check();+ if (!update) {+ if (!silent) {+ await message("You're on the latest version of Codegraff.", {+ title: "Codegraff",+ kind: "info",+ });+ }+ return;+ }++ const accepted = await ask(+ `Codegraff ${update.version} is available (you have ${update.currentVersion}).\n\nInstall it now and relaunch?`,+ {+ title: "Update available",+ kind: "info",+ okLabel: "Install & Relaunch",+ cancelLabel: "Later",+ },+ );+ if (!accepted) return;++ await update.downloadAndInstall();+ await relaunch();+ } catch (err) {+ if (silent) {+ console.error("[updater] check failed", err);+ } else {+ await message(`Update check failed: ${String(err)}`, {+ title: "Codegraff",+ kind: "error",+ });+ }+ } finally {+ inFlight = false;+ }+}diff --git a/install.sh b/install.shindex 9ad823ec..f1b91312 100644--- a/install.sh+++ b/install.sh@@ -1,7 +1,7 @@#!/usr/bin/env bashset -euo pipefail-# simple-harness installer. Prefers a prebuilt binary from the latest GitHub+# graff-harness installer. Prefers a prebuilt binary from the latest GitHub# release; falls back to building from source with Zig. Styled after the# codedb/codegraff installers.#@@ -164,7 +164,7 @@ main() {local platformplatform="$(detect_platform)"- printf "\n ${W}simple-harness${N} ${D}installer${N}\n\n"+ printf "\n ${W}graff-harness${N} ${D}installer${N}\n\n"printf " ${D}platform${N} $platform\n"printf " ${D}install${N} $INSTALL_DIR\n\n"diff --git a/scripts/release-gui-update.sh b/scripts/release-gui-update.shnew file mode 100644index 00000000..8c64c645--- /dev/null+++ b/scripts/release-gui-update.sh@@ -0,0 +1,104 @@+#!/usr/bin/env bash+# Build, sign, and notarize the Codegraff desktop app together with the+# auto-updater payload, then assemble latest.json for the GitHub release.+#+# The desktop app (the .dmg) auto-updates via Tauri's updater plugin: on launch+# it fetches+# https://github.com/justrach/codegraff/releases/latest/download/latest.json+# and, if a newer version is listed, downloads + verifies + installs the+# Codegraff.app.tar.gz payload referenced there. (This is separate from the CLI's+# `graff update`, which only swaps the bundled graff binary.)+#+# Two signatures are involved and BOTH are required:+# 1. Apple Developer ID + notarization -> Gatekeeper lets the app run.+# 2. Tauri minisign keypair -> the updater trusts the payload.+# The minisign public key is baked into src-tauri/tauri.conf.json; the private+# key lives at ~/.tauri/codegraff_updater.key (override with+# TAURI_SIGNING_PRIVATE_KEY_PATH). Lose it and you can never ship an update that+# existing installs will accept.+#+# Prerequisites: a notarytool keychain profile (default: notary-local).+#+# Usage: scripts/release-gui-update.sh # build + notarize + assemble+# DRY_NOTARY=1 scripts/release-gui-update.sh # skip the notarize/staple steps+set -euo pipefail++ROOT="$(cd "$(dirname "$0")/.." && pwd)"+GUI="$ROOT/gui"+KEY="${TAURI_SIGNING_PRIVATE_KEY_PATH:-$HOME/.tauri/codegraff_updater.key}"+NOTARY_PROFILE="${NOTARY_PROFILE:-notary-local}"++[ -f "$KEY" ] || { echo "missing updater private key: $KEY" >&2; exit 1; }++export TAURI_SIGNING_PRIVATE_KEY="$(cat "$KEY")"+export TAURI_SIGNING_PRIVATE_KEY_PASSWORD="${TAURI_SIGNING_PRIVATE_KEY_PASSWORD:-}"++cd "$GUI"+VER="$(grep -m1 '"version"' src-tauri/tauri.conf.json | sed -E 's/.*"version" *: *"([^"]+)".*/\1/')"+echo ">> building Codegraff $VER (this signs the app with Developer ID + the updater payload with minisign)"+bun tauri build++# Cargo here uses a shared target dir (~/.cargo/shared-target), not src-tauri/target,+# so resolve it from cargo metadata instead of assuming the default location.+TARGET_DIR="$(cargo metadata --no-deps --format-version 1 --manifest-path src-tauri/Cargo.toml 2>/dev/null | sed -n 's/.*"target_directory":"\([^"]*\)".*/\1/p')"+TARGET_DIR="${TARGET_DIR:-src-tauri/target}"+BUNDLE="$TARGET_DIR/release/bundle"+APP="$BUNDLE/macos/Codegraff.app"+TARBALL="$BUNDLE/macos/Codegraff.app.tar.gz"+DMG="$(ls "$BUNDLE"/dmg/Codegraff_*.dmg | head -1)"++[ -d "$APP" ] || { echo "no .app at $APP" >&2; exit 1; }+[ -f "$DMG" ] || { echo "no .dmg under $BUNDLE/dmg" >&2; exit 1; }+[ -f "$TARBALL" ] || { echo "no updater tarball — is bundle.createUpdaterArtifacts set?" >&2; exit 1; }++if [ -z "${DRY_NOTARY:-}" ]; then+ echo ">> notarizing dmg"+ xcrun notarytool submit "$DMG" --keychain-profile "$NOTARY_PROFILE" --wait+ xcrun stapler staple "$DMG"++ # The updater tarball Tauri just produced wraps the NOT-yet-notarized .app, so+ # notarize + staple the .app, then rebuild + re-sign the tarball from it.+ echo ">> notarizing app (for the updater payload)"+ ZIP="$(mktemp -d)/Codegraff.app.zip"+ ditto -c -k --keepParent "$APP" "$ZIP"+ xcrun notarytool submit "$ZIP" --keychain-profile "$NOTARY_PROFILE" --wait+ xcrun stapler staple "$APP"++ echo ">> rebuilding + re-signing updater tarball from the stapled app"+ tar -C "$BUNDLE/macos" -czf "$TARBALL" "Codegraff.app"+ rm -f "$TARBALL.sig"+ # Use the exported env vars (an empty `-p ""` gets swallowed by the shell).+ bun tauri signer sign "$TARBALL"+fi++SIG="$(cat "$TARBALL.sig")"+PUB_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"+LATEST="$BUNDLE/latest.json"+cat > "$LATEST" <<EOF+{+ "version": "$VER",+ "pub_date": "$PUB_DATE",+ "platforms": {+ "darwin-aarch64": {+ "signature": "$SIG",+ "url": "https://github.com/justrach/codegraff/releases/download/v$VER/Codegraff.app.tar.gz"+ }+ }+}+EOF++# Stable-named copy so the README's direct link+# (releases/latest/download/Codegraff.dmg) always resolves regardless of version.+STABLE_DMG="$BUNDLE/dmg/Codegraff.dmg"+cp "$DMG" "$STABLE_DMG"++echo+echo ">> done. Artifacts:"+echo " dmg: $DMG"+echo " dmg (latest): $STABLE_DMG"+echo " updater: $TARBALL (+ .sig)"+echo " manifest: $LATEST"+echo+echo ">> upload to the v$VER release (the tarball name must match latest.json's url):"+echo " gh release upload v$VER -R justrach/codegraff \\"+echo " \"$DMG\" \"$STABLE_DMG\" \"$TARBALL\" \"$LATEST\" --clobber"