# 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 - [x] 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`, empty targets with one placeholder type each, `Tests/MWBCoreTests/LayeringTests.swift`. - [ ] `tools/gates.sh`, `.swift-format`. - [ ] `tools/bundle.sh` + `Resources/Info.plist`. - [ ] `mwb --version`, `mwb --check-permissions`. - [ ] `tools/gates.sh` green; record Swift/Xcode versions in the work log. ## 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. ## QA log ## Review