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]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-15 23:46:24 -07:00
1 parent 69c0f7ab53
commit 671b3dfa61
20 files changed
+615 -20

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
/// The build's version string, printed by `mwb --version` and sent nowhere.
///
/// Kept in `MWBCore` so every layer can report the same value. Bumped by the
/// lead at release time; not derived from git so a build is reproducible.
public enum MWBVersion {
/// Semantic version of this build.
public static let string = "0.1.0-dev"
}
+28
View File
@@ -0,0 +1,28 @@
import CoreGraphics
/// Which macOS TCC permissions the current process holds.
///
/// `listen` is Input Monitoring (needed to observe key events), `post` is
/// Accessibility (needed to inject events and to run a swallowing tap).
public struct PermissionState: Equatable, Sendable {
/// Input Monitoring granted.
public let listen: Bool
/// Accessibility granted.
public let post: Bool
/// True when both permissions are granted.
public var isComplete: Bool { listen && post }
}
/// The one wrapper around the `CGPreflight*EventAccess` C API (CLAUDE.md,
/// Swift standards: C APIs are wrapped once). Only *preflight* lives here;
/// requesting is the `event-tap` lane's job, and never happens on an agent's
/// own initiative (CLAUDE.md, Workflow).
public enum Permissions {
/// Reads the current grants without prompting the user.
public static func preflight() -> PermissionState {
PermissionState(
listen: CGPreflightListenEventAccess(),
post: CGPreflightPostEventAccess())
}
}
+9
View File
@@ -0,0 +1,9 @@
import Network
/// Placeholder so the `MWBNet` target compiles before the `control-channel`
/// lane lands. That lane deletes this file (docs/topo.md §1.1).
public enum MWBNetPlaceholder {
/// The framework this target is allowed to import, named so the layering
/// rule (README D2) is visible in the placeholder itself.
public static let framework = "Network"
}
+35
View File
@@ -0,0 +1,35 @@
// mwb — the executable. Wires MWBCore, MWBNet and MWBMac together.
// Until the menubar-app lane lands this is a smoke binary: it proves the
// three targets link, and reports the two TCC permissions the app needs.
import Foundation
import MWBCore
import MWBMac
import MWBNet
let usage = """
usage: mwb --version | --check-permissions
--version print the build version and exit 0
--check-permissions print Input Monitoring / Accessibility state; exit 0 if both granted, 3 otherwise
"""
func checkPermissions() -> Int32 {
let state = Permissions.preflight()
print("input-monitoring (listen): \(state.listen ? "granted" : "missing")")
print("accessibility (post): \(state.post ? "granted" : "missing")")
if !state.isComplete {
print("grant the missing permission(s) in System Settings > Privacy & Security")
}
return state.isComplete ? 0 : 3
}
let arguments = Array(CommandLine.arguments.dropFirst())
switch arguments {
case ["--version"]:
print("mwb \(MWBVersion.string)")
exit(0)
case ["--check-permissions"]:
exit(checkPermissions())
default:
FileHandle.standardError.write(Data((usage + "\n").utf8))
exit(2)
}