#!/usr/bin/env bash set -euo pipefail # Build and bundle Clawdis into a minimal .app we can open. # Outputs to dist/Clawdis.app ROOT_DIR="$(cd "$(dirname "$0")/.." && pwd)" APP_ROOT="$ROOT_DIR/dist/Clawdis.app" BUILD_PATH="$ROOT_DIR/apps/macos/.build" PRODUCT="Clawdis" BUNDLE_ID="com.steipete.clawdis.debug" cd "$ROOT_DIR/apps/macos" echo "๐Ÿ”จ Building $PRODUCT (debug)" swift build -c debug --product "$PRODUCT" --product "${PRODUCT}CLI" --build-path "$BUILD_PATH" BIN="$BUILD_PATH/debug/$PRODUCT" CLI_BIN="$BUILD_PATH/debug/ClawdisCLI" echo "๐Ÿงน Cleaning old app bundle" rm -rf "$APP_ROOT" mkdir -p "$APP_ROOT/Contents/MacOS" mkdir -p "$APP_ROOT/Contents/Resources" echo "๐Ÿ“„ Writing Info.plist" cat > "$APP_ROOT/Contents/Info.plist" < CFBundleIdentifier ${BUNDLE_ID} CFBundleName Clawdis CFBundleExecutable Clawdis CFBundleIconFile Clawdis CFBundlePackageType APPL LSMinimumSystemVersion 15.0 LSUIElement NSUserNotificationUsageDescription Clawdis needs notification permission to show alerts for agent actions. NSScreenCaptureDescription Clawdis captures the screen when the agent needs screenshots for context. NSMicrophoneUsageDescription Clawdis needs the mic for Voice Wake tests and agent audio capture. NSSpeechRecognitionUsageDescription Clawdis uses speech recognition to detect your Voice Wake trigger phrase. PLIST echo "๐Ÿšš Copying binary" cp "$BIN" "$APP_ROOT/Contents/MacOS/Clawdis" chmod +x "$APP_ROOT/Contents/MacOS/Clawdis" echo "๐Ÿ–ผ Copying app icon" cp "$ROOT_DIR/apps/macos/Sources/Clawdis/Resources/Clawdis.icns" "$APP_ROOT/Contents/Resources/Clawdis.icns" if [ -f "$CLI_BIN" ]; then echo "๐Ÿ”ง Copying CLI helper" cp "$CLI_BIN" "$APP_ROOT/Contents/MacOS/ClawdisCLI" chmod +x "$APP_ROOT/Contents/MacOS/ClawdisCLI" fi echo "โน Stopping any running Clawdis" killall -q Clawdis 2>/dev/null || true echo "๐Ÿ” Ad-hoc signing binaries for stable TCC permissions" codesign --force --options runtime --timestamp=none --sign - "$APP_ROOT/Contents/MacOS/Clawdis" if [ -f "$APP_ROOT/Contents/MacOS/ClawdisCLI" ]; then codesign --force --options runtime --timestamp=none --sign - "$APP_ROOT/Contents/MacOS/ClawdisCLI" fi codesign --force --options runtime --timestamp=none --sign - "$APP_ROOT" echo "โœ… Bundle ready at $APP_ROOT" echo "๐Ÿš€ Launching app" open "$APP_ROOT"