#!/usr/bin/env sh

echo "🧹 Running pre-commit checks..."

# Run lint-staged if configured, otherwise run basic checks
if command -v lint-staged >/dev/null 2>&1; then
  pnpm exec lint-staged
else
  echo "⚡ Running ESLint..."
  pnpm run lint
  echo "✅ ESLint passed"

  echo "🔍 Running TypeScript check..."
  pnpm run type-check
  echo "✅ TypeScript check passed"

  echo "🧪 Running tests..."
  pnpm run test:unit
  echo "✅ Tests passed"
fi

echo "🎉 All pre-commit checks passed!"
