Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

feat: mac installer window

ogsamrat4a37bae8b512
diff --git a/.github/workflows/build-electron-desktop.yml b/.github/workflows/build-electron-desktop.yml
index 48255dea..eb09de20 100644
--- a/.github/workflows/build-electron-desktop.yml
+++ b/.github/workflows/build-electron-desktop.yml
@@ -145,6 +145,17 @@ jobs:
echo "bundled engine: $version"
test "$version" = "$(node -p "require('./apps/desktop/scripts/engine-release.json').version")"
+ - name: Check installer window, app name and in-place update
+ run: scripts/release/check-macos-installer.sh apps/desktop/dist-electron "$RUNNER_TEMP/installer-check"
+
+ - name: Upload installer screenshots
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: omnirush-macos-installer-window
+ path: ${{ runner.temp }}/installer-check
+ if-no-files-found: ignore
+
- name: Upload signed macOS build
uses: actions/upload-artifact@v4
with:
diff --git a/apps/desktop/build/dmg-background.png b/apps/desktop/build/dmg-background.png
new file mode 100644
index 00000000..800176c5
Binary files /dev/null and b/apps/desktop/build/dmg-background.png differ
diff --git a/apps/desktop/build/[email protected] b/apps/desktop/build/[email protected]
new file mode 100644
index 00000000..1899eb8f
Binary files /dev/null and b/apps/desktop/build/[email protected] differ
diff --git a/apps/desktop/scripts/dmg-background.swift b/apps/desktop/scripts/dmg-background.swift
new file mode 100644
index 00000000..261323a1
--- /dev/null
+++ b/apps/desktop/scripts/dmg-background.swift
@@ -0,0 +1,131 @@
+// Renders the macOS installer window background in the desktop app's own
+// style (slate surfaces, the omnirush mark, system-font type) at 1x and @2x:
+//
+// swift apps/desktop/scripts/dmg-background.swift [output-dir]
+//
+// Run it on a Mac (the type is SF Pro, the app's UI font) and commit the two
+// PNGs it writes to apps/desktop/build/. The layout must match `dmg` in
+// apps/desktop/electron-builder.yml: a 660x400 window, the app icon centred
+// at (170, 190) and the Applications link at (490, 190).
+import AppKit
+
+let width: CGFloat = 660
+let height: CGFloat = 400
+let appIcon = CGPoint(x: 170, y: 190)
+let applicationsIcon = CGPoint(x: 490, y: 190)
+
+func hex(_ value: UInt32) -> NSColor {
+ NSColor(
+ srgbRed: CGFloat((value >> 16) & 0xff) / 255,
+ green: CGFloat((value >> 8) & 0xff) / 255,
+ blue: CGFloat(value & 0xff) / 255,
+ alpha: 1)
+}
+
+// The app's light theme (Radix slate, apps/app/src/styles/colors.css). Finder
+// draws the icon labels black on a picture background in Light and Dark Mode
+// alike, so a dark background would hide them.
+let surfaceTop = hex(0xfcfcfd) // slate-1
+let surfaceBottom = hex(0xf0f0f3) // slate-3
+let ink = hex(0x1c2024) // slate-12
+let muted = hex(0x60646c) // slate-11
+let arrowColour = hex(0x8b8d98) // slate-9
+
+let scriptURL = URL(fileURLWithPath: CommandLine.arguments[0]).standardizedFileURL
+let desktopDir = scriptURL.deletingLastPathComponent().deletingLastPathComponent()
+let outputDir =
+ CommandLine.arguments.count > 1
+ ? URL(fileURLWithPath: CommandLine.arguments[1])
+ : desktopDir.appendingPathComponent("build")
+let markURL = desktopDir.appendingPathComponent("../app/public/omnirush-mark.png").standardizedFileURL
+guard let mark = NSImage(contentsOf: markURL) else { fatalError("missing \(markURL.path)") }
+
+func tinted(_ image: NSImage, _ colour: NSColor) -> NSImage {
+ let out = NSImage(size: image.size)
+ out.lockFocus()
+ let rect = NSRect(origin: .zero, size: image.size)
+ image.draw(in: rect)
+ colour.set()
+ rect.fill(using: .sourceAtop)
+ out.unlockFocus()
+ return out
+}
+
+func render(scale: CGFloat) -> Data {
+ let pixelsWide = Int(width * scale)
+ let pixelsHigh = Int(height * scale)
+ guard
+ let rep = NSBitmapImageRep(
+ bitmapDataPlanes: nil, pixelsWide: pixelsWide, pixelsHigh: pixelsHigh, bitsPerSample: 8,
+ samplesPerPixel: 4, hasAlpha: true, isPlanar: false, colorSpaceName: .deviceRGB,
+ bytesPerRow: 0, bitsPerPixel: 0)
+ else { fatalError("bitmap") }
+ rep.size = NSSize(width: width, height: height)
+ NSGraphicsContext.saveGraphicsState()
+ NSGraphicsContext.current = NSGraphicsContext(bitmapImageRep: rep)
+ NSGraphicsContext.current?.imageInterpolation = .high
+
+ // AppKit's origin is bottom-left; layout below is in top-left points.
+ func y(_ top: CGFloat) -> CGFloat { height - top }
+
+ NSGradient(starting: surfaceTop, ending: surfaceBottom)?
+ .draw(in: NSRect(x: 0, y: 0, width: width, height: height), angle: -90)
+
+ // Header: the mark beside the product name, as on the app's welcome card.
+ let markSize: CGFloat = 22
+ let header = NSAttributedString(
+ string: "omnirush.ai",
+ attributes: [
+ .font: NSFont.systemFont(ofSize: 15, weight: .semibold),
+ .foregroundColor: ink,
+ .kern: -0.2,
+ ])
+ let gap: CGFloat = 9
+ let headerWidth = markSize + gap + header.size().width
+ let headerLeft = (width - headerWidth) / 2
+ let headerMid: CGFloat = 54
+ tinted(mark, ink).draw(
+ in: NSRect(x: headerLeft, y: y(headerMid + markSize / 2), width: markSize, height: markSize))
+ header.draw(
+ at: NSPoint(
+ x: headerLeft + markSize + gap,
+ y: y(headerMid) - header.size().height / 2 + 1))
+
+ // Arrow between the two icons, in the app's line-icon style.
+ let arrow = NSBezierPath()
+ let arrowFrom = appIcon.x + 108
+ let arrowTo = applicationsIcon.x - 108
+ let head: CGFloat = 11
+ arrow.move(to: NSPoint(x: arrowFrom, y: y(appIcon.y)))
+ arrow.line(to: NSPoint(x: arrowTo, y: y(appIcon.y)))
+ arrow.move(to: NSPoint(x: arrowTo - head, y: y(appIcon.y - head)))
+ arrow.line(to: NSPoint(x: arrowTo, y: y(appIcon.y)))
+ arrow.line(to: NSPoint(x: arrowTo - head, y: y(appIcon.y + head)))
+ arrow.lineWidth = 2.5
+ arrow.lineCapStyle = .round
+ arrow.lineJoinStyle = .round
+ arrowColour.setStroke()
+ arrow.stroke()
+
+ // Hint under the icon labels.
+ let hint = NSAttributedString(
+ string: "Drag omnirush.ai to Applications to install",
+ attributes: [
+ .font: NSFont.systemFont(ofSize: 12.5, weight: .regular),
+ .foregroundColor: muted,
+ ])
+ hint.draw(at: NSPoint(x: (width - hint.size().width) / 2, y: y(352) - hint.size().height / 2))
+
+ NSGraphicsContext.restoreGraphicsState()
+ // 72 dpi at 1x and 144 dpi at @2x, so tiffutil -cathidpicheck pairs them.
+ rep.size = NSSize(width: width, height: height)
+ guard let png = rep.representation(using: .png, properties: [:]) else { fatalError("png") }
+ return png
+}
+
+try FileManager.default.createDirectory(at: outputDir, withIntermediateDirectories: true)
+for (scale, name) in [(CGFloat(1), "dmg-background.png"), (CGFloat(2), "[email protected]")] {
+ let url = outputDir.appendingPathComponent(name)
+ try render(scale: scale).write(to: url)
+ print("wrote \(url.path)")
+}
diff --git a/scripts/release/check-macos-installer.sh b/scripts/release/check-macos-installer.sh
new file mode 100755
index 00000000..ad8d2dd6
--- /dev/null
+++ b/scripts/release/check-macos-installer.sh
@@ -0,0 +1,105 @@
+#!/usr/bin/env bash
+# Checks a built macOS disk image on a Mac runner:
+# - prints the app's name keys, designated requirement and the names macOS shows;
+# - opens the installer window in Finder, prints its layout and saves a
+# screenshot of it in Light and Dark Mode to <out-dir>;
+# - installs the latest published release, then lets that release's own
+# Squirrel ShipIt install this build over it (the in-app update path), and
+# checks the result is one app, updated in place and still valid.
+# Usage: scripts/release/check-macos-installer.sh <dist-dir> <out-dir>
+set -euo pipefail
+
+dist=$1
+out=$2
+mkdir -p "$out"
+dmg=$(ls "$dist"/*.dmg | head -n 1)
+app=$(find "$dist" -maxdepth 2 -name '*.app' -type d | head -n 1)
+# ShipIt only accepts canonical paths, and the temp dir sits under the /var symlink.
+work=$(cd "$(mktemp -d)" && pwd -P)
+
+plist() { /usr/libexec/PlistBuddy -c "Print :$2" "$1/Contents/Info.plist" 2>/dev/null || echo "(unset)"; }
+finder_name() { osascript -e "tell application \"Finder\" to get displayed name of (POSIX file \"$1\" as alias)"; }
+
+echo "== app bundle: $(basename "$app")"
+for key in CFBundleName CFBundleDisplayName CFBundleExecutable CFBundleIdentifier CFBundleShortVersionString; do
+ echo "$key=$(plist "$app" "$key")"
+done
+codesign -d -r- "$app" 2>&1 | sed -n 's/^designated => /designated requirement: /p'
+
+echo "== installer window"
+mount=$(hdiutil attach -nobrowse -noverify -noautoopen "$dmg" | grep -o '/Volumes/.*$' | tail -n 1)
+volume=$(basename "$mount")
+echo "volume: $volume"
+ls -la "$mount"
+mounted_app="$mount/$(basename "$app")"
+mdimport "$mounted_app" >/dev/null 2>&1 || true
+echo "mdls: $(mdls -name kMDItemDisplayName -raw "$mounted_app" 2>&1)"
+echo "Finder shows: $(finder_name "$mounted_app")"
+
+cat > "$work/window.swift" <<'SWIFT'
+import CoreGraphics
+let list = CGWindowListCopyWindowInfo([.optionOnScreenOnly], kCGNullWindowID) as? [[String: Any]] ?? []
+for window in list where window[kCGWindowOwnerName as String] as? String == "Finder"
+ && window[kCGWindowName as String] as? String == CommandLine.arguments[1] {
+ print(window[kCGWindowNumber as String] ?? "")
+ break
+}
+SWIFT
+swiftc -O -o "$work/window" "$work/window.swift"
+
+shoot() {
+ osascript -e "tell application \"System Events\" to tell appearance preferences to set dark mode to $1"
+ osascript -e "tell application \"Finder\" to open (POSIX file \"$mount\" as alias)" -e 'tell application "Finder" to activate' >/dev/null
+ sleep 4
+ local id
+ id=$("$work/window" "$volume")
+ if [ -n "$id" ]; then screencapture -x -o -l "$id" "$out/$2"; else screencapture -x "$out/$2"; fi
+ echo "saved $out/$2"
+}
+shoot false installer-light.png
+osascript <<APPLESCRIPT
+tell application "Finder"
+ set w to container window of disk "$volume"
+ set o to icon view options of w
+ log "bounds: " & ((bounds of w) as string)
+ log "toolbar visible: " & (toolbar visible of w) & ", statusbar visible: " & (statusbar visible of w)
+ log "icon size: " & (icon size of o)
+ try
+ log "background: " & (name of (background picture of o as alias))
+ end try
+ repeat with i in (items of w)
+ log (name of i) & " at " & ((position of i) as string)
+ end repeat
+end tell
+APPLESCRIPT
+shoot true installer-dark.png
+osascript -e 'tell application "System Events" to tell appearance preferences to set dark mode to false'
+osascript -e "tell application \"Finder\" to close every window" >/dev/null 2>&1 || true
+hdiutil detach -quiet "$mount" || hdiutil detach -force "$mount"
+
+echo "== in-place update from the latest release"
+latest=$(curl -fsSL https://github.com/omnirush-ai/omnirush-gui/releases/latest/download/latest-mac.yml | awk '/^version:/ { print $2 }')
+curl -fsSL -o "$work/latest.zip" "https://github.com/omnirush-ai/omnirush-gui/releases/download/v$latest/omnirush-mac-arm64-$latest.zip"
+applications="$work/Applications"
+mkdir -p "$applications" "$work/update" "$work/shipit"
+ditto -x -k "$work/latest.zip" "$applications"
+installed=$(ls -d "$applications"/*.app)
+echo "installed v$latest as $(basename "$installed") (executable $(plist "$installed" CFBundleExecutable))"
+ditto "$app" "$work/update/$(basename "$app")"
+# What Squirrel.Mac decides before it writes the request (SQRLUpdater.m).
+rename=false
+[ "$(plist "$installed" CFBundleExecutable)" = "$(basename "$installed" .app)" ] && rename=true
+cat > "$work/shipit/ShipItState.plist" <<JSON
+{"updateBundleURL":"file://$work/update/$(basename "$app")/","targetBundleURL":"file://$installed/","bundleIdentifier":"$(plist "$app" CFBundleIdentifier)","launchAfterInstallation":false,"useUpdateBundleName":$rename}
+JSON
+perl -e 'alarm shift; exec @ARGV' 600 \
+ "$installed/Contents/Frameworks/Squirrel.framework/Resources/ShipIt" "$(plist "$app" CFBundleIdentifier).ShipIt" "$work/shipit/ShipItState.plist"
+apps=("$applications"/*.app)
+echo "after update: ${apps[*]##*/}"
+[ "${#apps[@]}" -eq 1 ] || { echo "expected one app after the update" >&2; exit 1; }
+updated=${apps[0]}
+[ "$(plist "$updated" CFBundleShortVersionString)" = "$(plist "$app" CFBundleShortVersionString)" ] || { echo "the update did not install" >&2; exit 1; }
+codesign --verify --deep --strict "$updated"
+echo "updated: $(basename "$updated") v$(plist "$updated" CFBundleShortVersionString), CFBundleName=$(plist "$updated" CFBundleName)"
+echo "Finder shows: $(finder_name "$updated")"
+rm -rf "$work"