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

+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Release build → dist/mwb.app, signed.
#
# Usage: MWB_SIGN_IDENTITY="mwb-mac dev" tools/bundle.sh
# MWB_ADHOC=1 tools/bundle.sh # ad-hoc signature, for a throwaway build only
#
# A stable signing identity matters: macOS TCC ties the Accessibility and
# Input Monitoring grants to the code signature, and an ad-hoc signature
# changes with every build, so the user would be re-prompted each time
# (README D5). Create a self-signed identity once with Keychain Access
# (Certificate Assistant > Create a Certificate, type "Code Signing") and
# pass its name via MWB_SIGN_IDENTITY.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
cd "$root"
app="dist/mwb.app"
identity="${MWB_SIGN_IDENTITY:-}"
if [ -z "$identity" ]; then
if [ "${MWB_ADHOC:-0}" = 1 ]; then
identity="-"
echo "bundle.sh: ad-hoc signing (MWB_ADHOC=1); TCC grants will not persist across builds" >&2
else
echo "bundle.sh: set MWB_SIGN_IDENTITY to a code-signing identity, or MWB_ADHOC=1 for a throwaway build" >&2
exit 2
fi
fi
swift build -c release 2>&1 | grep -v '^\[' || true
swift build -c release >/dev/null
bin=$(swift build -c release --show-bin-path)/mwb
rm -rf "$app"
mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
cp "$bin" "$app/Contents/MacOS/mwb"
cp Resources/Info.plist "$app/Contents/Info.plist"
codesign --force --sign "$identity" --options runtime --timestamp=none "$app"
codesign --verify --verbose=2 "$app"
echo "built $app"
Executable
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# The definition of "done" for every lane (CLAUDE.md, Swift standards):
# 1. swift-format lint --strict is clean
# 2. swift build with warnings as errors is clean
# 3. swift test is green, under the runaway guard
# Exit 0 only if all three pass. Run from anywhere; operates on the repo
# that contains this script (so it works inside a lane worktree).
#
# Usage: tools/gates.sh [--no-test]
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
cd "$root"
run_tests=1
[ "${1:-}" = "--no-test" ] && run_tests=0
echo "== gate 1/3: swift-format lint --strict"
xcrun swift-format lint --strict --recursive Sources Tests Package.swift
echo "== gate 2/3: swift build -Xswiftc -warnings-as-errors"
swift build -Xswiftc -warnings-as-errors 2>&1 | grep -v '^\[' || true
# grep swallows the exit status; re-check with a cheap incremental build.
swift build -Xswiftc -warnings-as-errors >/dev/null
if [ "$run_tests" = 1 ]; then
echo "== gate 3/3: swift test (guarded: 8 GB / 15 min)"
# pipefail is set, so a guard kill or a failing test fails this line.
tools/guard.sh -m 8 -t 900 -- swift test 2>&1 | grep -E "Executed|error:|failed|passed after" | tail -20
else
echo "== gate 3/3: skipped (--no-test)"
fi
echo "== gates: all green"
Executable
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env bash
# Lane worktrees for the Dev → QA → lead loop (docs/loop.md).
#
# tools/lane.sh new <feature> create ../mwb-lanes/<feature> on branch lane/<feature> from main
# tools/lane.sh list show live lanes
# tools/lane.sh done <feature> remove the worktree (branch is kept until the lead deletes it)
#
# One worktree per lane, never two agents in one tree (CLAUDE.md,
# Parallel lanes). The lead merges lane/<feature> into main with --no-ff
# after QA verdict and review, then runs `done`.
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
lanes="$(dirname "$root")/mwb-lanes"
cmd="${1:-}"; name="${2:-}"
case "$cmd" in
new)
[ -n "$name" ] || { echo "usage: $0 new <feature>" >&2; exit 2; }
[ -d "$root/docs/features/$name" ] || { echo "no docs/features/$name — write the brief first (docs/loop.md §2)" >&2; exit 2; }
mkdir -p "$lanes"
git -C "$root" worktree add -b "lane/$name" "$lanes/$name" main
echo "lane ready: $lanes/$name (branch lane/$name)"
;;
list)
git -C "$root" worktree list
;;
done)
[ -n "$name" ] || { echo "usage: $0 done <feature>" >&2; exit 2; }
git -C "$root" worktree remove "$lanes/$name"
echo "removed $lanes/$name; branch lane/$name kept"
;;
*)
echo "usage: $0 new <feature> | list | done <feature>" >&2; exit 2 ;;
esac