#!/bin/bash
set -e

echo "Running quality checks for {{PROJECT_NAME}}..."
echo ""

# Run golangci-lint for Go code
if command -v golangci-lint &> /dev/null; then
  echo "Running golangci-lint..."
  golangci-lint run ./services/... ./workers/... ./cli/... ./pkg/... 2>/dev/null || true
fi

# Run tests
echo "Running Go tests..."
go test ./... 2>/dev/null || true

# Run ESLint for apps
for dir in apps/*/; do
  if [ -f "${dir}package.json" ]; then
    echo "Running lint for $(basename $dir)..."
    (cd "$dir" && npm run lint 2>/dev/null) || true
  fi
done

echo ""
echo "Quality checks complete!"
