graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
gui: release 0.0.11 — bundle codegraff CLI + first-run PATH symlink (#23)
Rach8fdc743f1ce7
diff --git a/gui/package.json b/gui/package.jsonindex 258872d9..768d36f2 100644--- a/gui/package.json+++ b/gui/package.json@@ -1,7 +1,7 @@{"name": "codegraff-gui","private": true,- "version": "0.2.16",+ "version": "0.0.11","license": "Apache-2.0","packageManager": "[email protected]","type": "module",diff --git a/gui/src-tauri/.gitignore b/gui/src-tauri/.gitignoreindex 502406b4..f4557218 100644--- a/gui/src-tauri/.gitignore+++ b/gui/src-tauri/.gitignore@@ -2,3 +2,6 @@# will have compiled files and executables/target//gen/schemas++# Staged CLI binary bundled into the app at build time (local artifact)+binaries/diff --git a/gui/src-tauri/Cargo.lock b/gui/src-tauri/Cargo.lockindex 30045043..011757d8 100644--- a/gui/src-tauri/Cargo.lock+++ b/gui/src-tauri/Cargo.lock@@ -501,7 +501,7 @@ dependencies = [[[package]]name = "codegraff-gui"-version = "0.2.16"+version = "0.0.11"dependencies = ["anyhow","async-trait",diff --git a/gui/src-tauri/Cargo.toml b/gui/src-tauri/Cargo.tomlindex 55eba63f..1558f0c5 100644--- a/gui/src-tauri/Cargo.toml+++ b/gui/src-tauri/Cargo.toml@@ -6,7 +6,7 @@[package]name = "codegraff-gui"-version = "0.2.16"+version = "0.0.11"description = "Desktop coding agent interface powered by Codegraff"authors = ["Codegraff contributors"]license = "Apache-2.0"diff --git a/gui/src-tauri/src/cli_install.rs b/gui/src-tauri/src/cli_install.rsnew file mode 100644index 00000000..2da04c0e--- /dev/null+++ b/gui/src-tauri/src/cli_install.rs@@ -0,0 +1,66 @@+//! First-run install of the bundled `codegraff` CLI onto the user's PATH.+//!+//! The app bundles the Zig-native harness binary at+//! `Codegraff.app/Contents/Resources/codegraff`. On macOS we expose it as a+//! `codegraff` terminal command by symlinking it into a PATH directory the+//! first time the app launches (VS Code `code`-style).+//!+//! Best-effort by design: it never fails app startup. In dev the bundled+//! resource does not exist, so this is a natural no-op. When `/usr/local/bin`+//! is not writable (common on stock macOS without Homebrew) it falls back to+//! `~/.local/bin`.++#[cfg(target_os = "macos")]+pub fn ensure_cli_symlink(app: &tauri::App) {+ use std::os::unix::fs::symlink;+ use std::path::PathBuf;+ use tauri::Manager;++ let resource = match app.path().resource_dir() {+ Ok(dir) => dir.join("codegraff"),+ Err(_) => return,+ };+ // Only present in a bundled .app — absent in dev, so this returns quietly.+ if !resource.exists() {+ return;+ }++ // Preferred PATH dirs, in order. /usr/local/bin matches the VS Code `code`+ // convention; ~/.local/bin is the no-admin fallback.+ let mut targets: Vec<PathBuf> = vec![PathBuf::from("/usr/local/bin")];+ if let Ok(home) = app.path().home_dir() {+ targets.push(home.join(".local").join("bin"));+ }++ for dir in targets {+ let link = dir.join("codegraff");+ // Already linked to this exact build -> nothing to do.+ if let Ok(existing) = std::fs::read_link(&link) {+ if existing == resource {+ log::info!("codegraff CLI already linked at {}", link.display());+ return;+ }+ }+ if std::fs::create_dir_all(&dir).is_err() {+ continue;+ }+ // Clear any stale link/file we own before relinking.+ let _ = std::fs::remove_file(&link);+ match symlink(&resource, &link) {+ Ok(()) => {+ log::info!(+ "codegraff CLI linked: {} -> {}",+ link.display(),+ resource.display()+ );+ return;+ }+ Err(err) => {+ log::warn!("could not link codegraff into {}: {err}", dir.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 5d171067..d86a21aa 100644--- a/gui/src-tauri/src/lib.rs+++ b/gui/src-tauri/src/lib.rs@@ -1,4 +1,5 @@mod commands;+mod cli_install;mod desktop_open;pub mod dto;mod forge_config_home;@@ -69,6 +70,8 @@ pub fn run() {app_dir.join("managed-chats"),)?);app.manage(DesktopState::new(emitter, projects));+ // First run: expose the bundled `codegraff` CLI on PATH (macOS).+ cli_install::ensure_cli_symlink(app);Ok(())}).on_window_event(|window, event| {diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.jsonindex 9878404d..3da80490 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.2.16",+ "version": "0.0.11","identifier": "dev.codegraff.gui","build": {"frontendDist": "../dist",@@ -41,6 +41,13 @@"icons/[email protected]","icons/icon.icns","icons/icon.ico"- ]+ ],+ "resources": {+ "binaries/codegraff": "codegraff"+ },+ "macOS": {+ "signingIdentity": "Developer ID Application: Rachit Pradhan (WWP9DLJ27P)",+ "hardenedRuntime": true+ }}}