Fix assembly control: helper failed to build on current macOS SDK#272
Open
alexkroman wants to merge 1 commit into
Open
Fix assembly control: helper failed to build on current macOS SDK#272alexkroman wants to merge 1 commit into
alexkroman wants to merge 1 commit into
Conversation
The bundled macOS UI-control helper (macos_ui_control.swift, added in #271) called CGDisplayCreateImage, which is unavailable in current macOS SDKs (removed in favor of ScreenCaptureKit). Since helper.py compiles the helper with swiftc on first use, `assembly control` died with "Could not build the macOS UI-control helper" on any modern Mac. The file was also never wired into the gate, so neither the build break nor its swiftlint violations were caught. - screenshot() now shells out to /usr/sbin/screencapture (stable across SDKs, same {ok, path} contract) instead of CGDisplayCreateImage/NSBitmapImageRep. - Fix swiftlint --strict violations: scope the CFGetTypeID-guarded force casts with a documented disable, collapse handle()'s per-action guards into a generic withArg helper (complexity 12 -> under 10), fix brace placement and trailing commas. - Add .swiftlint.yml allowing the conventional short names x/y/ok/up/id (x/y are the JSON keys shared with helper.py and can't be renamed). - Wire both swift helpers into check.sh's swiftlint + compile gates so an SDK-unavailable API can't slip in unbuilt again. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The bundled macOS UI-control helper (
aai_cli/control/macos_ui_control.swift, added in #271) calledCGDisplayCreateImage, which is unavailable in current macOS SDKs (removed in favor of ScreenCaptureKit). Becausehelper.pycompiles the helper withswiftcon first use,assembly controldied with "Could not build the macOS UI-control helper" on any modern Mac (confirmed failing to compile on the macOS 26.5 SDK).The file was also never wired into the gate —
scripts/check.shonly lint/compiledmacos_system_audio.swift— so neither the build break nor 10 seriousswiftlint --strictviolations were caught.Changes
screenshot()now shells out to/usr/sbin/screencapture -x -m(stable across SDK versions, identical{ok, path}PNG contract) instead of the removedCGDisplayCreateImage/NSBitmapImageReppath. Smoke-tested: captures a real PNG.swiftlint --strictviolations: scope theCFGetTypeID-guarded force casts with a documenteddisable(a conditionalas?to a CF type is a no-op the compiler rejects — the type-id check is the real guard); collapsehandle()'s per-actionguardboilerplate into a genericwithArghelper (cyclomatic complexity 12 → under 10, behavior identical); fix brace placement and trailing commas..swiftlint.ymlallowing the conventional short namesx/y/ok/up/id(x/yare the JSON keys shared withhelper.pyand can't be renamed).check.sh's swiftlint + compile gates so an SDK-unavailable API can't slip in unbuilt again.Verification
./scripts/check.sh: All checks passed. (3725 tests, 99.50% coverage; swiftlint 0 violations; swift compile 0 errors)tests/test_control.py+tests/test_control_exec.py: 51 passed🤖 Generated with Claude Code