Skip to content

Run macOS previews headlessly with off-screen capture#31

Merged
obj-p merged 4 commits intomainfrom
devices
Mar 21, 2026
Merged

Run macOS previews headlessly with off-screen capture#31
obj-p merged 4 commits intomainfrom
devices

Conversation

@obj-p
Copy link
Owner

@obj-p obj-p commented Mar 21, 2026

Summary

  • Run MCP serve and snapshot modes headlessly — windows use borderless style positioned off-screen, app runs as .accessory (no Dock icon)
  • Replace CGWindowListCreateImage with cacheDisplay(in:to:) for snapshot capture, which renders directly from the view hierarchy and works regardless of window position
  • Conform SnapshotError to LocalizedError for proper MCP error reporting

Test plan

  • SPM macOS basic rendering — verified "My Items" title, 8 item rows, progress card "1/8"
  • SPM iOS tap interaction — toggled "Write code" to completed
  • SPM iOS toggle interaction — "Show Completed" off hid completed items
  • SPM iOS swipe interaction — swiped to orange "Next Up" card
  • SPM hot reload (literal) — "My Items" → "Tasks" reflected immediately
  • SPM hot reload (cross-file) — new item in Item.swift appeared
  • No reload failures in MCP server logs
  • Bazel macOS rendering — blocked by unimplemented BazelBuildSystem (separate issue)

🤖 Generated with Claude Code

obj-p and others added 4 commits March 20, 2026 21:35
Switch MCP serve and snapshot modes to headless: windows use borderless
style positioned off-screen, app runs as accessory (no Dock icon).
Replace CGWindowListCreateImage with cacheDisplay for snapshot capture,
which renders directly from the view hierarchy and works regardless of
window position. Conform SnapshotError to LocalizedError for better
MCP error reporting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace `nonisolated(unsafe) var headless` and `keepAliveWithoutWindows`
with a `Mode` enum (.interactive, .serve, .snapshot) passed at init.
Behavior is derived via computed properties, eliminating the set-once
mutable state pattern. App.host is now created after command parsing
with the correct mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@obj-p obj-p merged commit 424e61d into main Mar 21, 2026
2 checks passed
@obj-p obj-p deleted the devices branch March 21, 2026 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant