Commit 6ea6815
authored
mcp: bundle pyobjc ScriptingBridge binding on Darwin (#1294)
## What
Bundle the **pyobjc `ScriptingBridge`** framework binding into the
kernel interpreter on Darwin, so a session can drive any scriptable
macOS app (Things, Music, Finder, Safari, ...) via native
`SBApplication` objects — no AppleScript strings, no install step.
Before this, the kernel had pyobjc-core (`objc`, `Foundation`, `AppKit`)
but `import ScriptingBridge` failed (`find_spec` → None); you had to
fall back to `objc.loadBundle(...)` by hand each session.
## How
nixpkgs ships only a curated subset of pyobjc framework bindings and
omits ScriptingBridge. Every binding lives as a sibling subdir in the
pyobjc monorepo `src`, so this derives the wrapper from
`pyobjc-framework-Quartz` by retargeting only `sourceRoot` +
`pythonImportsCheck` — exactly the existing `coreLocationModule`
pattern. Tracks nixpkgs Quartz build fixes automatically.
- New `scriptingBridgeModule`, added to `darwinExtraPackages`.
- New `scriptingBridgeBundled` import smoke test, wired into the Darwin
`passthru.tests`.
## Verification
```
nix build .#mcp.tests.scriptingBridgeBundled # builds + import check passes
nix run .#lint # 7/7 succeeded
```
Confirmed live: listed 5 Things3 to-dos through
`SBApplication.applicationWithBundleIdentifier_("com.culturedcode.ThingsMac")`.
🤖 Authored by Claude (Opus 4.8) via Claude Code.
<!-- Macroscope's pull request summary starts here -->
<!-- Macroscope will only edit the content between these invisible
markers, and the markers themselves will not be visible in the GitHub
rendered markdown. -->
<!-- If you delete either of the start / end markers from your PR's
description, Macroscope will append its summary at the bottom of the
description. -->
> [!NOTE]
> ### Bundle pyobjc ScriptingBridge binding in the MCP package on Darwin
> - Adds a new `pyobjc-framework-ScriptingBridge` derivation in
[default.nix](https://github.com/indexable-inc/index/pull/1294/files#diff-1620bd0b79c426472be159dd458dcedbb31de6b35b9507d98c31d4aed67e08db)
by overriding the pyobjc-framework-Quartz package attributes to point at
the ScriptingBridge subdirectory.
> - Includes the binding in `darwinExtraPackages` so `import
ScriptingBridge` is available at runtime on macOS.
> - Adds a build-time import test that checks
`SBApplication.applicationWithBundleIdentifier_` is callable, wired into
the package's test phase.
>
> <!-- Macroscope's review summary starts here -->
>
> <sup><a href="https://app.macroscope.com">Macroscope</a> summarized
7dfd73d.</sup>
> <!-- Macroscope's review summary ends here -->
>
<!-- macroscope-ui-refresh -->
<!-- Macroscope's pull request summary ends here -->1 parent ab2edf7 commit 6ea6815
1 file changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
712 | 727 | | |
713 | 728 | | |
714 | 729 | | |
715 | 730 | | |
716 | | - | |
| 731 | + | |
| 732 | + | |
717 | 733 | | |
718 | 734 | | |
719 | 735 | | |
720 | 736 | | |
721 | 737 | | |
| 738 | + | |
722 | 739 | | |
723 | 740 | | |
724 | 741 | | |
| |||
4537 | 4554 | | |
4538 | 4555 | | |
4539 | 4556 | | |
| 4557 | + | |
4540 | 4558 | | |
4541 | 4559 | | |
4542 | 4560 | | |
| |||
4728 | 4746 | | |
4729 | 4747 | | |
4730 | 4748 | | |
| 4749 | + | |
4731 | 4750 | | |
4732 | 4751 | | |
4733 | 4752 | | |
| |||
0 commit comments