#!/bin/bash

# Setup Homebrew tap
set -e

VERSION=${1:-"0.1.0"}
GITHUB_USER=${2:-"josharsh"}

echo "🍺 Setting up Homebrew Tap"
echo "========================="
echo ""
echo "This script helps you create a Homebrew tap for claude-utils"
echo ""

# Check if formula exists
if [ ! -f "claude-utils.rb" ]; then
    echo "1️⃣ Generating formula..."
    ./scripts/create-homebrew-formula.sh "$VERSION"
fi

echo ""
echo "2️⃣ Next steps:"
echo ""
echo "   a) Create a new GitHub repository named: homebrew-claude-utils"
echo "      https://github.com/new"
echo ""
echo "   b) Clone it locally:"
echo "      git clone https://github.com/${GITHUB_USER}/homebrew-claude-utils"
echo "      cd homebrew-claude-utils"
echo ""
echo "   c) Create Formula directory:"
echo "      mkdir -p Formula"
echo "      cp ../claude-utils/claude-utils.rb Formula/"
echo ""
echo "   d) Commit and push:"
echo "      git add ."
echo "      git commit -m 'Add claude-utils formula'"
echo "      git push"
echo ""
echo "3️⃣ Users can then install with:"
echo "   brew tap ${GITHUB_USER}/claude-utils"
echo "   brew install claude-utils"
echo ""
echo "4️⃣ To update the formula after new releases:"
echo "   ./scripts/create-homebrew-formula.sh NEW_VERSION"
echo "   # Then update the formula in your tap"