Files
mac_without_borders/docs/features/bootstrap/README.md
T
lucioandClaude Fable 5.1 671b3dfa61 bootstrap: SwiftPM skeleton, gates, bundler, and the lane procedure
Four targets (MWBCore, MWBNet, MWBMac, mwb) with a layering test that
keeps MWBCore free of AppKit/CoreGraphics/Network; tools/gates.sh as the
definition of done; tools/bundle.sh producing a signed dist/mwb.app;
tools/lane.sh for lane worktrees; smoke binary with --version and
--check-permissions. docs/loop.md records the Dev -> QA -> lead loop with
the literal dispatch prompts, the wave schedule and escalations.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-15 23:46:24 -07:00

4.9 KiB

bootstrap

Goal

Turn the empty repository into a building, testing SwiftPM package with the three-target layering from README D2, the done gate script and the .app bundler — and, first of all, establish whether swift build works on this machine at all. Nothing in later lanes can start until tools/gates.sh passes on an empty skeleton.

Assumptions

  • The SwiftPM breakage is the toolchain, not the manifest. Measured 2026-09-15: Command Line Tools only (/Library/Developer/CommandLineTools, Swift 6.4, macOS 27.0, no Xcode.app). A trivial manifest fails to link with swift-tools-version 5.9 and 6.0 alike; libPackageDescription.dylib exports Package.init(… swiftLanguageVersions: [SwiftLanguageMode]? …) while the compiled manifest references [SwiftVersion]?. Purging ~/Library/Caches/org.swift.swiftpm did not help. swiftc compiles and links an AppKit + CryptoKit program fine. The CLT ships Swift Testing but no XCTest.framework.
  • Installing Xcode.app fixes both. It carries its own SwiftPM and XCTest. If the user prefers not to, the fallback is a Makefile driving swiftc per target plus Swift Testing (import Testing) run via swift-testing's console runner — recorded here only if needed.
  • Minimum macOS 14. CGPreflightListenEventAccess and friends exist since 10.15; 14 is chosen for Swift 6 concurrency and NWListener maturity, not for a specific API.
  • Bundle id com.luciochen.mwb-mac; LSUIElement = true (menu-bar app, no Dock icon). A self-signed "mwb-mac dev" code-signing certificate is created once by the user via Keychain Access; tools/bundle.sh reads its name from MWB_SIGN_IDENTITY and refuses to sign ad-hoc unless MWB_ADHOC=1 is set explicitly (D5).

Handshakes

Promised

  • Package.swift target names MWBCore, MWBNet, MWBMac, mwb, MWBCoreTests, MWBNetTests are frozen; later lanes add files, not targets, without a handshake here.
  • tools/gates.sh exit status is the definition of "done" for every lane: 0 means format-clean, warning-free, tests green under the guard.
  • MWBCoreTests/LayeringTests.swift greps Sources/MWBCore for import (AppKit|CoreGraphics|Network|Cocoa) and fails on any hit (topo.md §1 standing promise).

Consumed

  • tools/guard.sh (already present; copied from lucisv, header adapted).

Status / TODO

  • Report the toolchain state to the user and wait for Xcode. Xcode 27.0 (27A266a) installed 2026-09-15; xcode-select -p is /Applications/Xcode.app/Contents/Developer.
  • Package.swift, four targets + two test targets, one placeholder type each; Tests/MWBCoreTests/LayeringTests.swift enforces D2.
  • tools/gates.sh (via xcrun swift-format), .swift-format.
  • tools/bundle.sh + Resources/Info.plist; ad-hoc build verified, identity-signed build awaits the user's certificate (D5).
  • mwb --version, mwb --check-permissions (exit 3 when a grant is missing) backed by MWBMac/Permissions.swift (preflight only).
  • tools/lane.sh worktree helper; docs/loop.md procedure; docs/features/TEMPLATE.md.
  • tools/gates.sh green: 3 XCTest cases, 0 warnings, lint clean.
  • Not done, deliberately: no CI workflow. The lucisv Gitea runner exists on this Mac (verilogrustformatter/tools/RELEASING.md), but a CI that runs swift test for a project that will soon post input events needs invariant 5 thought through first — TODO §8.

Work log

  • 2026-09-15 (lead, planning): toolchain probed; findings in Assumptions. No code written.
  • 2026-09-15 (lead): after the user installed Xcode 27.0, the same smoke package (executable importing AppKit + CryptoKit + CommonCrypto, one XCTest case, swift-tools-version:6.0) built in 8 s and the test passed under swift test. The Assumptions above stay as the record of why Xcode is a requirement; the fallback Makefile is not needed.
  • 2026-09-15 (lead, solo at the user's request): skeleton landed. Decisions: (1) Permissions.swift ships now with preflight only so the smoke binary can report grants; the event-tap lane owns requesting and extends this file — recorded in docs/topo.md §1.1. (2) swift-format config: 110 columns, 4-space indent, NeverForceUnwrap and NeverUseForceTry as lint errors (CLAUDE.md Swift standards); tests are not exempted, so tests use XCTUnwrap. (3) gates.sh runs the guarded swift test once under pipefail; a guard kill fails the gate. (4) bundle.sh refuses to sign ad-hoc unless MWB_ADHOC=1, so nobody burns a TCC grant by accident. Deviation from plan: none. Versions: Xcode 27.0 (27A266a), Swift 6.4, macOS 27.0.

QA log

Review

  • 2026-09-15 (lead): self-inspected per docs/loop.md §5 — gates green, layering test exercises real files, no force-unwraps in Sources/. Merged directly to main (solo lane, no worktree). Carry forward: the wave-1 briefs already exist; dispatch per docs/loop.md §1.