Files
mac_without_borders/Sources/mwb/main.swift
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

36 lines
1.2 KiB
Swift

// 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)
}