#!/bin/bash # Development build script that creates a proper .app bundle for easier permission management set -e PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" BUILD_DIR="$PROJECT_DIR/.build" DEV_APP_DIR="$BUILD_DIR/TellMe-Dev.app" echo "🔨 Building Tell me for development..." defaults delete com.fmartingr.tellme hasShownPermissionOnboarding 2>/dev/null || echo "Onboarding status reset for new domain" # Clean previous dev build rm -rf "$DEV_APP_DIR" # Build the executable swift build -c debug # Create app bundle structure mkdir -p "$DEV_APP_DIR/Contents/MacOS" mkdir -p "$DEV_APP_DIR/Contents/Resources" # Copy executable cp "$BUILD_DIR/arm64-apple-macosx/debug/TellMe" "$DEV_APP_DIR/Contents/MacOS/TellMe" # Create Info.plist cat > "$DEV_APP_DIR/Contents/Info.plist" << EOF CFBundleExecutable TellMe CFBundleIdentifier com.fmartingr.tellme CFBundleName TellMe Dev CFBundlePackageType APPL CFBundleVersion 1.0.0-dev CFBundleShortVersionString 1.0.0-dev NSHighResolutionCapable LSUIElement NSMicrophoneUsageDescription Tell me needs microphone access to capture speech for transcription. EOF # Copy resources if they exist if [ -d "$PROJECT_DIR/Sources/App/Resources" ]; then # Copy non-localization resources find "$PROJECT_DIR/Sources/App/Resources" -maxdepth 1 -type f -exec cp {} "$DEV_APP_DIR/Contents/Resources/" \; # Copy localization files to correct location (directly in Resources, not in Localizations subfolder) if [ -d "$PROJECT_DIR/Sources/App/Resources/Localizations" ]; then cp -r "$PROJECT_DIR/Sources/App/Resources/Localizations/"*.lproj "$DEV_APP_DIR/Contents/Resources/" 2>/dev/null || true fi fi echo "✅ Development app bundle created at: $DEV_APP_DIR" echo "" echo "To run with proper permissions:" echo "1. open '$DEV_APP_DIR'" echo "2. Grant permissions in System Settings" echo "3. Or run: '$DEV_APP_DIR/Contents/MacOS/TellMe'" echo "" echo "The app bundle makes it easier to grant permissions in System Settings."