Skip to content

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

Python

fix: clarify drag-to-Applications installer layout

Rach Pradhan38ac7648ebde
diff --git a/apps/native/electron/create-dmg.sh b/apps/native/electron/create-dmg.sh
new file mode 100644
index 00000000..62b8a6ed
--- /dev/null
+++ b/apps/native/electron/create-dmg.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+# Assemble Finder's drag-to-Applications installer without altering the app.
+set -euo pipefail
+here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+source_app="${1:?Usage: create-dmg.sh signed-app output.dmg}"
+dmg="${2:?Provide an output DMG path}"
+[[ ! -e "$dmg" ]] || { echo 'Output exists; choose a new DMG path.' >&2; exit 1; }
+work="$(mktemp -d "${TMPDIR:-/tmp}/graff-installer.XXXXXX")"
+mounted=0
+cleanup() { if [[ "$mounted" == 1 ]]; then hdiutil detach "$work/mount" -quiet || true; fi; rm -rf "$work"; }
+trap cleanup EXIT
+mkdir -p "$work/staging/.background" "$work/mount"
+ditto "$source_app" "$work/staging/Codegraff.app"
+ln -s /Applications "$work/staging/Applications"
+if [[ -f "$source_app/Contents/Resources/electron.icns" ]]; then
+ cp "$source_app/Contents/Resources/electron.icns" "$work/staging/.VolumeIcon.icns"
+fi
+xcrun swift "$here/installer-artwork.swift" "$work/staging/.background/install.tiff"
+hdiutil create -quiet -volname Codegraff -fs HFS+ -srcfolder "$work/staging" -format UDRW "$work/writable.dmg"
+hdiutil attach -quiet -readwrite -noautoopen -mountpoint "$work/mount" "$work/writable.dmg"
+mounted=1
+osascript - "$work/mount" <<'APPLESCRIPT'
+on run argv
+ tell application "Finder"
+ set folderPath to POSIX file (item 1 of argv) as alias
+ open folderPath
+ set installerWindow to container window of folderPath
+ set current view of installerWindow to icon view
+ set toolbar visible of installerWindow to false
+ set statusbar visible of installerWindow to false
+ set sidebar width of installerWindow to 0
+ set bounds of installerWindow to {200, 160, 920, 628}
+ set options to icon view options of installerWindow
+ set arrangement of options to not arranged
+ set icon size of options to 112
+ set text size of options to 13
+ set label position of options to bottom
+ set background picture of options to POSIX file ((item 1 of argv) & "/.background/install.tiff")
+ set position of item "Codegraff.app" of folderPath to {184, 210}
+ set position of item "Applications" of folderPath to {536, 210}
+ update folderPath without registering applications
+ delay 2
+ close installerWindow
+ open folderPath
+ delay 1
+ close container window of folderPath
+ end tell
+end run
+APPLESCRIPT
+# Persist the custom layout. Apple Silicon does not support bless --openfolder.
+[[ ! -f "$work/mount/.VolumeIcon.icns" ]] || SetFile -a C "$work/mount"
+if [[ "$(uname -m)" != arm64 ]]; then
+ bless --folder "$work/mount" --openfolder "$work/mount"
+fi
+sync
+hdiutil detach -quiet "$work/mount"
+mounted=0
+hdiutil convert -quiet "$work/writable.dmg" -format UDZO -o "$dmg"
+echo "$dmg"
diff --git a/apps/native/electron/distribute.sh b/apps/native/electron/distribute.sh
index 9959cdf6..b4dbaa06 100755
--- a/apps/native/electron/distribute.sh
+++ b/apps/native/electron/distribute.sh
@@ -2,7 +2,6 @@
# Sign a built app and create a notarized drag-to-Applications disk image.
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-root="$(cd "$here/../../.." && pwd)"
: "${GRAFF_SIGN_IDENTITY:?Set a Developer ID Application identity}"
: "${GRAFF_NOTARY_PROFILE:?Set a notarytool keychain profile}"
source_app="${1:?Usage: distribute.sh /path/Codegraff.app /path/output}"
@@ -13,8 +12,7 @@ app="$out/Codegraff.app"
dmg="$out/Codegraff-macos-arm64.dmg"
[[ ! -e "$app" && ! -e "$dmg" ]] || { echo 'Output already exists; choose a new directory.' >&2; exit 1; }
work="$(mktemp -d "${TMPDIR:-/tmp}/graff-distribute.XXXXXX")"
-mounted=0
-cleanup() { if [[ "$mounted" == 1 ]]; then hdiutil detach "$work/mount" -quiet || true; fi; rm -rf "$work"; }
+cleanup() { rm -rf "$work"; }
trap cleanup EXIT
ditto "$source_app" "$app"
version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$app/Contents/Info.plist")"
@@ -33,37 +31,7 @@ spctl --assess --type execute --verbose=2 "$app"
archive="$out/Codegraff-$version-macos-arm64.zip"
ditto -c -k --keepParent "$app" "$archive"
bun "$here/update-artifacts.cjs" "$version" "$archive" "$out/latest-mac.yml"
-mkdir "$work/staging"
-ditto "$app" "$work/staging/Codegraff.app"
-ln -s /Applications "$work/staging/Applications"
-hdiutil create -quiet -volname CodeGraff -srcfolder "$work/staging" -format UDRW "$work/writable.dmg"
-mkdir "$work/mount"
-hdiutil attach -quiet -readwrite -noautoopen -mountpoint "$work/mount" "$work/writable.dmg"
-mounted=1
-# Finder stores the layout in the image, so opening it presents the two targets.
-osascript - "$work/mount" <<'APPLESCRIPT'
-on run argv
- tell application "Finder"
- set folderPath to POSIX file (item 1 of argv) as alias
- open folderPath
- set installerWindow to container window of folderPath
- set current view of installerWindow to icon view
- set toolbar visible of installerWindow to false
- set statusbar visible of installerWindow to false
- set bounds of installerWindow to {200, 160, 800, 500}
- set arrangement of icon view options of installerWindow to not arranged
- set icon size of icon view options of installerWindow to 100
- set position of item "Codegraff.app" of folderPath to {150, 140}
- set position of item "Applications" of folderPath to {450, 140}
- update folderPath without registering applications
- close installerWindow
- end tell
-end run
-APPLESCRIPT
-sync
-hdiutil detach -quiet "$work/mount"
-mounted=0
-hdiutil convert -quiet "$work/writable.dmg" -format UDZO -o "$dmg"
+bash "$here/create-dmg.sh" "$app" "$dmg"
codesign --sign "$GRAFF_SIGN_IDENTITY" --timestamp "$dmg"
xcrun notarytool submit "$dmg" --keychain-profile "$GRAFF_NOTARY_PROFILE" --wait --output-format json > "$out/dmg-notary.json"
bun -e 'if(JSON.parse(require("fs").readFileSync(process.argv[1])).status!=="Accepted")process.exit(1)' "$out/dmg-notary.json"
diff --git a/apps/native/electron/installer-artwork.swift b/apps/native/electron/installer-artwork.swift
new file mode 100644
index 00000000..6543c82a
--- /dev/null
+++ b/apps/native/electron/installer-artwork.swift
@@ -0,0 +1,58 @@
+import AppKit
+
+// Finder uses the logical size for its background and the 2x representation on
+// Retina displays. The two empty circles sit behind real, draggable file icons.
+let canvas = NSSize(width: 720, height: 440)
+func color(_ hex: UInt32) -> NSColor {
+ NSColor(srgbRed: CGFloat((hex >> 16) & 255) / 255,
+ green: CGFloat((hex >> 8) & 255) / 255,
+ blue: CGFloat(hex & 255) / 255, alpha: 1)
+}
+func text(_ value: String, _ rect: NSRect, size: CGFloat, weight: NSFont.Weight, ink: NSColor) {
+ let style = NSMutableParagraphStyle()
+ style.alignment = .center
+ (value as NSString).draw(in: rect, withAttributes: [
+ .font: NSFont.systemFont(ofSize: size, weight: weight),
+ .foregroundColor: ink, .paragraphStyle: style,
+ ])
+}
+func render(scale: Int) -> NSBitmapImageRep {
+ let rep = NSBitmapImageRep(bitmapDataPlanes: nil, pixelsWide: 720 * scale,
+ pixelsHigh: 440 * scale, bitsPerSample: 8,
+ samplesPerPixel: 4, hasAlpha: true, isPlanar: false,
+ colorSpaceName: .deviceRGB, bytesPerRow: 0, bitsPerPixel: 0)!
+ rep.size = canvas
+ NSGraphicsContext.saveGraphicsState()
+ NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: rep)
+ color(0xF5EFE3).setFill()
+ NSRect(origin: .zero, size: canvas).fill()
+ color(0xDCD3C2).setStroke()
+ let line = NSBezierPath()
+ line.move(to: NSPoint(x: 48, y: 76)); line.line(to: NSPoint(x: 672, y: 76))
+ line.lineWidth = 1; line.stroke()
+ text("Install Codegraff", NSRect(x: 40, y: 350, width: 640, height: 40),
+ size: 28, weight: .semibold, ink: color(0x203653))
+ text("Drag Codegraff into Applications", NSRect(x: 40, y: 317, width: 640, height: 27),
+ size: 16, weight: .regular, ink: color(0x726B5E))
+ for x: CGFloat in [184, 536] {
+ color(0xEAE2D3).setFill()
+ NSBezierPath(ovalIn: NSRect(x: x - 72, y: 158, width: 144, height: 144)).fill()
+ }
+ color(0x203653).setStroke()
+ let arrow = NSBezierPath()
+ arrow.move(to: NSPoint(x: 314, y: 229)); arrow.line(to: NSPoint(x: 406, y: 229))
+ arrow.move(to: NSPoint(x: 390, y: 243)); arrow.line(to: NSPoint(x: 406, y: 229))
+ arrow.line(to: NSPoint(x: 390, y: 215))
+ arrow.lineWidth = 3; arrow.lineCapStyle = .round; arrow.lineJoinStyle = .round
+ arrow.stroke()
+ text("Then open Codegraff from Applications.", NSRect(x: 40, y: 35, width: 640, height: 23),
+ size: 13, weight: .regular, ink: color(0x726B5E))
+ NSGraphicsContext.restoreGraphicsState()
+ return rep
+}
+guard CommandLine.arguments.count == 2 else { fatalError("Provide an output TIFF path") }
+let reps = [render(scale: 1), render(scale: 2)]
+let image = NSImage(size: canvas)
+reps.forEach { image.addRepresentation($0) }
+let data = image.tiffRepresentation!
+try data.write(to: URL(fileURLWithPath: CommandLine.arguments[1]))