#!/bin/bash
# ============================================================
# AWOOOI Git Hooks Setup Script
# Version: 1.0
# Created: 2026-03-26 12:30 (台北時區)
# Created by: Claude Code
# Description: 安裝 Git Hooks 到本地環境
# ============================================================

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"

echo "🔧 安裝 AWOOOI Git Hooks..."

# 安裝 pre-commit hook
if [ -f "$SCRIPT_DIR/hooks/pre-commit" ]; then
    cp "$SCRIPT_DIR/hooks/pre-commit" "$PROJECT_ROOT/.git/hooks/pre-commit"
    chmod +x "$PROJECT_ROOT/.git/hooks/pre-commit"
    echo "✅ pre-commit hook 安裝完成"
else
    echo "❌ 找不到 pre-commit hook"
    exit 1
fi

echo ""
echo "🎉 Git Hooks 安裝完成！"
echo ""
echo "紅區保護已啟用:"
echo "  - Tier 3 (核心大腦): 8 個檔案"
echo "  - Tier 2 (基礎設施): 15+ 個檔案"
echo ""
echo "更多資訊請參閱: docs/RED_ZONES.md"
