#!/usr/bin/env bash # The definition of "done" for a lane's final commit (CLAUDE.md, Swift # standards). No test suites by the user's instruction — the user tests. # 1. swift-format lint --strict is clean # 2. MWBCore imports only Foundation / CommonCrypto / CryptoKit (README D2) # 3. swift build with warnings as errors is clean # Exit 0 only if all pass. Operates on the repo containing this script, # so it works inside a lane worktree. set -euo pipefail root=$(cd "$(dirname "$0")/.." && pwd) cd "$root" echo "== gate 1/3: swift-format lint --strict" xcrun swift-format lint --strict --recursive Sources Package.swift echo "== gate 2/3: MWBCore layering" if grep -rnE '^\s*import (AppKit|Cocoa|CoreGraphics|Carbon|SwiftUI|Network|IOKit|ApplicationServices)\b' Sources/MWBCore; then echo "gates: MWBCore may import only Foundation, CommonCrypto and CryptoKit (README D2)" >&2 exit 1 fi echo "== gate 3/3: swift build -Xswiftc -warnings-as-errors" swift build -Xswiftc -warnings-as-errors 2>&1 | grep -v '^\[' || true swift build -Xswiftc -warnings-as-errors >/dev/null echo "== gates: all green"