graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
install: a native Windows installer (install.ps1)
justrachfd25c91d9487
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 7f5b7a1e..9a54ab5c 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -257,7 +257,7 @@ jobs:printf '%s\n' "$section" > changelog-notes.mdnotes=(--notes-file changelog-notes.md)fi- assets=(graff-*.tar.gz SHA256SUMS install.sh)+ assets=(graff-*.tar.gz SHA256SUMS install.sh install.ps1)if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then# A maintainer may publish the notes while cross-compilation is still# running. Attach to that release instead of creating an untagged draft.diff --git a/README.md b/README.mdindex e5c558ef..9e831e4e 100644--- a/README.md+++ b/README.md@@ -37,9 +37,15 @@ On macOS or Linux:curl -fsSL https://github.com/justrach/codegraff/releases/latest/download/install.sh | sh```-On Windows, unpack `graff-x86_64-windows.tar.gz` (or `aarch64`) from the-[latest release](https://github.com/justrach/codegraff/releases/latest) and put-`graff.exe` on your `PATH`. The desktop app, [Harness](https://github.com/justrach/harness), installs+On Windows, in PowerShell (no WSL needed):++```powershell+irm https://github.com/justrach/codegraff/releases/latest/download/install.ps1 | iex+```++It verifies the download against the release's `SHA256SUMS`, installs+`graff.exe` under `%LOCALAPPDATA%\Programs\graff\bin` and adds that to your user+`PATH`. The desktop app, [Harness](https://github.com/justrach/harness), installs`graff` for you.```shdiff --git a/install.ps1 b/install.ps1new file mode 100644index 00000000..4d5914cc--- /dev/null+++ b/install.ps1@@ -0,0 +1,98 @@+# Install graff on Windows from the latest GitHub release.+#+# irm https://github.com/justrach/codegraff/releases/latest/download/install.ps1 | iex+#+# Environment overrides:+# GRAFF_INSTALL_DIR where graff.exe goes (default %LOCALAPPDATA%\Programs\graff\bin)+# GRAFF_VERSION a release tag such as v0.0.302.20 (default: the latest release)+# GRAFF_NO_PATH=1 do not add the install directory to the user PATH+#+# Unlike install.sh this runs no `graff mcp install`: that sets up a+# launchd/systemd service and is macOS/Linux only.++$ErrorActionPreference = 'Stop'+$ProgressPreference = 'SilentlyContinue' # Invoke-WebRequest is far slower with the progress bar++function Fail([string]$Message) {+ Write-Host " error: $Message" -ForegroundColor Red+ throw $Message+}++$repo = 'https://github.com/justrach/codegraff'+$arch = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }+$target = switch ($arch) {+ 'AMD64' { 'x86_64-windows' }+ 'ARM64' { 'aarch64-windows' }+ default { Fail "unsupported processor architecture '$arch' (graff ships x86_64 and ARM64 builds)" }+}+$dir = if ($env:GRAFF_INSTALL_DIR) { $env:GRAFF_INSTALL_DIR } else { Join-Path $env:LOCALAPPDATA 'Programs\graff\bin' }+$base = if ($env:GRAFF_VERSION) { "$repo/releases/download/$($env:GRAFF_VERSION)" } else { "$repo/releases/latest/download" }+$asset = "graff-$target.tar.gz"++Write-Host ''+Write-Host ' graff installer' -ForegroundColor White+Write-Host " platform $target"+Write-Host " install $dir"+Write-Host ''++if (-not (Get-Command tar.exe -ErrorAction SilentlyContinue)) {+ Fail 'tar.exe was not found (it ships with Windows 10 1803 and later)'+}++$tmp = Join-Path ([System.IO.Path]::GetTempPath()) ("graff-install-" + [guid]::NewGuid().ToString('N'))+New-Item -ItemType Directory -Path $tmp | Out-Null+try {+ Write-Host " download $asset"+ Invoke-WebRequest -UseBasicParsing -Uri "$base/$asset" -OutFile (Join-Path $tmp $asset)+ Invoke-WebRequest -UseBasicParsing -Uri "$base/SHA256SUMS" -OutFile (Join-Path $tmp 'SHA256SUMS')++ # Verify against the release's SHA256SUMS before anything runs.+ $line = Get-Content (Join-Path $tmp 'SHA256SUMS') | Where-Object { $_ -match "\s\*?$([regex]::Escape($asset))$" } | Select-Object -First 1+ if (-not $line) { Fail "SHA256SUMS has no entry for $asset" }+ $expected = ($line -split '\s+')[0].ToLowerInvariant()+ $actual = (Get-FileHash -Algorithm SHA256 (Join-Path $tmp $asset)).Hash.ToLowerInvariant()+ if ($expected -ne $actual) { Fail "checksum mismatch for $asset (expected $expected, got $actual)" }+ Write-Host ' verify sha256 ok'++ & tar.exe -xzf (Join-Path $tmp $asset) -C $tmp+ if ($LASTEXITCODE -ne 0) { Fail "could not unpack $asset" }+ $exe = Join-Path $tmp "graff-$target\graff.exe"+ if (-not (Test-Path $exe)) {+ $found = Get-ChildItem -Path $tmp -Recurse -Filter graff.exe | Select-Object -First 1+ if (-not $found) { Fail "$asset contains no graff.exe" }+ $exe = $found.FullName+ }++ New-Item -ItemType Directory -Force -Path $dir | Out-Null+ $dest = Join-Path $dir 'graff.exe'+ # A running graff.exe cannot be overwritten, but it can be renamed aside.+ if (Test-Path $dest) {+ $old = "$dest.old"+ Remove-Item -Force $old -ErrorAction SilentlyContinue+ try { Remove-Item -Force $dest } catch { Rename-Item -Path $dest -NewName 'graff.exe.old' }+ }+ Copy-Item -Path $exe -Destination $dest+ Write-Host " installed $dest" -ForegroundColor Green+} finally {+ Remove-Item -Recurse -Force $tmp -ErrorAction SilentlyContinue+}++if ($env:GRAFF_NO_PATH -ne '1') {+ $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')+ $entries = @($userPath -split ';' | Where-Object { $_ })+ if ($entries -notcontains $dir) {+ [Environment]::SetEnvironmentVariable('Path', (($entries + $dir) -join ';'), 'User')+ Write-Host " PATH added $dir (new terminals pick it up)"+ } else {+ Write-Host ' PATH already set'+ }+ if (($env:Path -split ';') -notcontains $dir) { $env:Path = "$env:Path;$dir" }+}++$version = & (Join-Path $dir 'graff.exe') --version 2>&1 | Select-Object -First 1+if ($LASTEXITCODE -ne 0) { Fail "graff.exe did not start: $version" }+Write-Host " version $version"++Write-Host ''+Write-Host ' done! open a new terminal and run graff, or graff --help' -ForegroundColor White+Write-Host ''diff --git a/install.sh b/install.shindex 7cfd3e9e..7dcce127 100644--- a/install.sh+++ b/install.sh@@ -29,7 +29,8 @@ detect_platform() {Linux) os="linux" ;;MINGW*|MSYS*|CYGWIN*)printf "\n ${W}harness installer${N}\n\n"- printf " ${Y}Windows detected${N} — run this inside ${G}WSL2${N} instead.\n\n"+ printf " ${Y}Windows detected${N} — graff runs natively; install it from PowerShell:\n\n"+ printf " ${C}irm https://github.com/justrach/codegraff/releases/latest/download/install.ps1 | iex${N}\n\n"exit 0 ;;*) printf " ${R}unsupported OS: $os${N}\n" >&2; exit 1 ;;esacdiff --git a/src/mcp_cli.zig b/src/mcp_cli.zigindex c9e44dc7..dd8c6d94 100644--- a/src/mcp_cli.zig+++ b/src/mcp_cli.zig@@ -277,6 +277,15 @@ fn addInferred(io: Io, gpa: Allocator, arena: Allocator, home: []const u8, envirpub fn mcpCommand(io: Io, gpa: Allocator, arena: Allocator, home: []const u8, environ_map: anytype, args: []const []const u8) !void {if (args.len > 0 and std.mem.eql(u8, args[0], "install")) {+ // The installer sets up a launchd/systemd service; spawning it on+ // Windows failed with a bare FileNotFound.+ if (@import("builtin").os.tag == .windows) {+ var ebuf: [512]u8 = undefined;+ var ew = Io.File.stderr().writer(io, &ebuf);+ try ew.interface.writeAll("graff mcp install sets up a background service on macOS and Linux only.\nOn Windows, add graff to an MCP client with the command `graff mcp serve`.\n");+ try ew.interface.flush();+ std.process.exit(1);+ }const exe = try std.process.executablePathAlloc(io, arena);var argv: std.ArrayList([]const u8) = .empty;try argv.appendSlice(arena, &.{ "python3", "-c", @embedFile("mcp_installer"), "--binary", exe });