Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

update: Windows update works when graff runs inside PowerShell 7

justrach935adea072c9
diff --git a/install.ps1 b/install.ps1
index 4d5914cc..783e1566 100644
--- a/install.ps1
+++ b/install.ps1
@@ -50,7 +50,12 @@ try {
$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()
+ # .NET directly, not Get-FileHash: that cmdlet's module may not load
+ # (Windows PowerShell started from PowerShell 7 inherits its module path).
+ $sha = [System.Security.Cryptography.SHA256]::Create()
+ $stream = [System.IO.File]::OpenRead((Join-Path $tmp $asset))
+ try { $actual = -join ($sha.ComputeHash($stream) | ForEach-Object { $_.ToString('x2') }) }
+ finally { $stream.Dispose(); $sha.Dispose() }
if ($expected -ne $actual) { Fail "checksum mismatch for $asset (expected $expected, got $actual)" }
Write-Host ' verify sha256 ok'
diff --git a/src/update_windows.zig b/src/update_windows.zig
index 4c1f0da7..091bef69 100644
--- a/src/update_windows.zig
+++ b/src/update_windows.zig
@@ -43,6 +43,10 @@ pub fn run(io: Io, gpa: Allocator, environ: *const std.process.Environ.Map, out:
try env.put("GRAFF_INSTALL_DIR", dir);
// Updating keeps the install where it is; PATH already finds it.
try env.put("GRAFF_NO_PATH", "1");
+ // Started from PowerShell 7, graff carries its PSModulePath, and Windows
+ // PowerShell then cannot load its own modules (Get-FileHash is "not
+ // recognized"). Without it powershell.exe uses its defaults.
+ _ = env.swapRemove("PSModulePath");
var child = std.process.spawn(io, .{
.argv = &.{ "powershell.exe", "-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-Command", script },