#!/bin/bash
# DevOps CLI - Setup Script

set -e

echo "🚀 Setting up DevOps CLI..."

# Check for Go
if ! command -v go &> /dev/null; then
    echo "❌ Go is not installed. Please install Go 1.21 or later."
    exit 1
fi

echo "✅ Go found: $(go version)"

# Download dependencies
echo "📦 Downloading dependencies..."
cd "$(dirname "$0")/.."
go mod download

# Build the binary
echo "🔨 Building DevOps CLI..."
go build -o bin/devops ./cmd/devops

# Make executable
chmod +x bin/devops

echo ""
echo "✅ Setup complete!"
echo ""
echo "Add the CLI to your PATH:"
echo "  export PATH=\$(pwd)/bin:\$PATH"
echo ""
echo "Or run directly:"
echo "  ./bin/devops --help"
echo ""
echo "Next steps:"
echo "  1. Add the CLI to your PATH"
echo "  2. Run 'devops init' in your project"
echo "  3. Run 'devops doctor' to check dependencies"
