#!/bin/sh
# 🐲 Pixiu Harness Hook: console-log-detector
# Detects console.log in staged files.

echo "🔍 Running Console Log Detector..."

# Exclude node_modules, dist, build, .git
if git diff --cached --name-only | grep -vE 'node_modules|dist|build|\.git' | xargs grep -n "console.log" > /dev/null 2>&1; then
    echo "❌ Error: console.log DETECTED in staged files."
    echo "   Please remove debug code before committing."
    exit 1
fi

echo "✅ No console.log found."
exit 0
