#!/usr/bin/env bash # Full verification gate. Must be green before a task is marked done (AGENTS.md). set -euo pipefail cd "$(dirname "$0")/.." PKG=Packages/SprachmittlerKit step() { printf '\n\033[1m▶ %s\033[0m\n' "$*"; } step "Format check" if command -v swiftformat >/dev/null; then swiftformat App "$PKG" --lint; else echo "skip: swiftformat not installed"; fi step "Lint" if command -v swiftlint >/dev/null; then swiftlint lint --strict --quiet App "$PKG/Sources" "$PKG/Tests"; else echo "skip: swiftlint not installed"; fi step "Shell syntax" for f in scripts/*.sh; do bash -n "$f"; done echo "✓ scripts parse" step "JSON and plist syntax" for f in opencode.json evaluation/corpus.schema.json evaluation/corpus.example.json; do jq -e . "$f" >/dev/null done plutil -lint App/Info.plist App/Sprachmittler.entitlements >/dev/null for f in App/Resources/*.lproj/Localizable.strings; do plutil -lint "$f" >/dev/null; done echo "✓ JSON and plists parse" step "Privacy checks" scripts/privacy-check.sh scripts/privacy-self-test.sh step "Package build" swift build --package-path "$PKG" step "Package tests" swift test --package-path "$PKG" --skip SprachmittlerLiveTests step "App build" if command -v xcodegen >/dev/null && command -v xcodebuild >/dev/null; then xcodegen generate --spec project.yml --quiet xcodebuild -project Sprachmittler.xcodeproj -scheme Sprachmittler -configuration Debug \ -derivedDataPath .build/xcode -destination 'platform=macOS,arch=arm64' -quiet build scripts/check-signature.sh .build/xcode/Build/Products/Debug/Sprachmittler.app debug else echo "skip: xcodegen/xcodebuild not available (make bootstrap)" fi step "Release build and signature" if command -v xcodegen >/dev/null && command -v xcodebuild >/dev/null; then xcodebuild -project Sprachmittler.xcodeproj -scheme Sprachmittler -configuration Release \ -derivedDataPath .build/xcode-release -destination 'platform=macOS,arch=arm64' -quiet build scripts/check-signature.sh .build/xcode-release/Build/Products/Release/Sprachmittler.app release else echo "skip: xcodegen/xcodebuild not available (make bootstrap)" fi printf '\n\033[32m✔ verify passed\033[0m\n'