# Check branch name convention
branch_name=$(git symbolic-ref --short HEAD)
pattern="^[a-zA-Z-]+/.+$"

if [[ ! $branch_name =~ $pattern ]]; then
  echo "Branch name '$branch_name' does not follow the naming convention."
  echo "Branch names should follow the pattern: category/branch-name (e.g. feature/add-button)"
  exit 1
fi

echo "Running lint and typecheck before push..."

# Run lint
bun run lint

# Run typecheck  
bun run typecheck:ci

echo "✅ All checks passed!"