#!/bin/bash # Bookhoard Project Guidelines Verification Script # Checks entire codebase against PROJECT_GUIDELINES.md # Usage: make verify-guidelines or ./scripts/verify-quick.sh set -e RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' ERRORS=0 WARNINGS=0 PASSED=0 error_msg() { echo -e "${RED}✗ ERROR: $1${NC}"; ERRORS=$((ERRORS + 1)); } warning_msg() { echo -e "${YELLOW}⚠ WARNING: $1${NC}"; WARNINGS=$((WARNINGS + 1)); } success_msg() { echo -e "${GREEN}✓ PASS: $1${NC}"; PASSED=$((PASSED + 1)); } section() { echo ""; echo -e "${BLUE}--- $1 ---${NC}"; } echo -e "${BLUE}=== Bookhoard Project Guidelines Verification ===${NC}" echo "" ############################################################################### ## 🚨 CRITICAL PROHIBITIONS: Backend & Database ############################################################################### section "Backend & Database: No local server binaries" # GUIDELINE: NEVER build server binaries locally - all builds through Dockerfile/docker-compose echo "Checking for server binaries (should build through containers)..." BINARIES=$(find . -type f \( -name "bookhoard" -o -name "server" \) -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null | wc -l) if [ "$BINARIES" -gt 0 ]; then error_msg "Found $BINARIES binary files (should build through containers)" find . -type f \( -name "bookhoard" -o -name "server" \) -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null else success_msg "No server binaries (builds through containers)" fi # GUIDELINE: NEVER create new migration files - merge changes into current one until release echo "Checking for multiple migration files..." if [ -d "migrations" ]; then MIGRATION_COUNT=$(find migrations/ -name "*.sql" 2>/dev/null | wc -l) if [ "$MIGRATION_COUNT" -gt 1 ]; then error_msg "Found $MIGRATION_COUNT migration files (should merge into current one)" else success_msg "Migration files OK (single file or none)" fi else success_msg "No migrations directory (not implemented yet)" fi ############################################################################### ## 🚨 CRITICAL PROHIBITIONS: Frontend & Styling ############################################################################### section "Frontend & Styling: No custom CSS (use TailwindCSS)" # GUIDELINE: NEVER use custom CSS - TailwindCSS classes only echo "Checking for custom CSS in templates (should use TailwindCSS)..." STYLE_COUNT=$(grep -l '