#!/bin/bash

# Script to publish prism-cli placeholder to reserve the name
# Run this when you're ready to reserve the package name

echo "========================================"
echo "Prism CLI - Package Name Reservation"
echo "========================================"
echo ""
echo "This will publish prism-cli v0.0.1 to crates.io to reserve the package name."
echo ""
echo "Package details:"
echo "  Name: prism-cli"
echo "  Version: 0.0.1"
echo "  Description: Placeholder to reserve the name for Prismworks AI"
echo ""
read -p "Do you want to proceed with publishing? (y/N): " confirm

if [[ $confirm == [yY] || $confirm == [yY][eE][sS] ]]; then
    echo ""
    echo "Publishing to crates.io..."
    cargo publish
    
    if [ $? -eq 0 ]; then
        echo ""
        echo "✅ Success! prism-cli has been reserved on crates.io"
        echo "You can now update the real package in your workspace when ready."
    else
        echo ""
        echo "❌ Publishing failed. You may need to:"
        echo "   1. Run 'cargo login' with your crates.io API token"
        echo "   2. Check if the name is still available"
    fi
else
    echo "Publishing cancelled."
fi
