#!/bin/bash # Package the CocotteAI macOS cockpit into a double-clickable .app bundle. # Builds release, assembles Contents/{MacOS,Resources,Info.plist}, generates the # ✦ rose icon. Run on plum (macOS, Swift). Output: ./build/CocotteAI.app # # ./scripts/package-app.sh [output-dir] # # Live data: the app reads ~/Library/Application Support/CocotteAI/config.json # (apiBase/userId/token/orgId). No config → mock dataset. See main.swift. set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" OUT="${1:-$HERE/build}" APP="$OUT/CocotteAI.app" BUNDLE_ID="tech.cocotte.cockpit.macos" EXEC="CocotteCockpit" cd "$HERE" echo "→ swift build -c release" swift build -c release BIN="$(swift build -c release --show-bin-path)/$EXEC" [ -x "$BIN" ] || { echo "build produced no $EXEC at $BIN" >&2; exit 1; } echo "→ assembling $APP" rm -rf "$APP" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" cp "$BIN" "$APP/Contents/MacOS/$EXEC" echo "→ generating icon" ICONSET="$OUT/AppIcon.iconset" rm -rf "$ICONSET" swift "$HERE/scripts/make-icon.swift" "$ICONSET" iconutil -c icns "$ICONSET" -o "$APP/Contents/Resources/AppIcon.icns" rm -rf "$ICONSET" cat > "$APP/Contents/Info.plist" < CFBundleNameCocotteAI CFBundleDisplayNameCocotteAI CFBundleExecutable$EXEC CFBundleIdentifier$BUNDLE_ID CFBundleIconFileAppIcon CFBundlePackageTypeAPPL CFBundleShortVersionString0.1.0 CFBundleVersion1 LSMinimumSystemVersion14.0 NSHighResolutionCapable NSAppTransportSecurity NSExceptionDomains black.lan NSExceptionAllowsInsecureHTTPLoads NSIncludesSubdomains NSHumanReadableCopyrightcocotte.tech PLIST # Ad-hoc codesign so Gatekeeper/launchd accept the local bundle. codesign --force --deep --sign - "$APP" >/dev/null 2>&1 || echo " (codesign skipped)" echo "✓ built $APP"