#!/usr/bin/env bash set -euo pipefail # Bootstrap script for mm4b setup # Installs Bun if needed, then runs setup.ts SETUP_URL="https://setup-mm4b.publicker.dev/setup.ts" SETUP_FILE="/tmp/mm4b-setup.ts" info() { printf "\n%s\n" "$*"; } die() { printf "\nERROR: %s\n" "$*" >&2; exit 1; } # Install Bun if not present if ! command -v bun &> /dev/null; then info "Installing Bun..." curl -fsSL https://bun.sh/install | bash # Source the updated PATH export BUN_INSTALL="$HOME/.bun" export PATH="$BUN_INSTALL/bin:$PATH" if ! command -v bun &> /dev/null; then die "Bun installation failed. Please install manually: https://bun.sh" fi info "✓ Bun installed" else info "✓ Bun found" fi # Download and run setup.ts info "Downloading setup script..." curl -fsSL "$SETUP_URL" -o "$SETUP_FILE" info "Running setup..." bun run "$SETUP_FILE" # Cleanup rm -f "$SETUP_FILE"