diff --git a/scripts/verify-guidelines.sh b/scripts/verify-guidelines.sh index bccaeea..c751aa2 100755 --- a/scripts/verify-guidelines.sh +++ b/scripts/verify-guidelines.sh @@ -1,7 +1,7 @@ #!/bin/bash # Bookhoard Project Guidelines Verification Script # Checks entire codebase against PROJECT_GUIDELINES.md -# Usage: make verify-guidelines or ./scripts/verify-guidelines.sh +# Usage: make verify-quick or ./scripts/verify-quick.sh ############################################################################### # AI BEHAVIOR PROTOCOL - MANDATORY INSTRUCTIONS - NO EXCEPTIONS @@ -25,262 +25,274 @@ set -e -# Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' -NC='\033[0m' # No Color +NC='\033[0m' -# Counters ERRORS=0 WARNINGS=0 PASSED=0 +error_msg() { echo -e "${RED}✗ ERROR: $1${NC}"; echo -e "${RED} AI INSTRUCTION: Ask user before fixing this issue${NC}"; ERRORS=$((ERRORS + 1)); } +warning_msg() { echo -e "${YELLOW}⚠ WARNING: $1${NC}"; echo -e "${YELLOW} AI INSTRUCTION: Ask user before fixing this issue${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 "" -# Function to print error -error_msg() { - echo -e "${RED}✗ ERROR: $1${NC}" - echo -e "${RED} AI INSTRUCTION: Ask user before fixing this issue${NC}" - ((ERRORS++)) -} +############################################################################### +## 🚨 CRITICAL PROHIBITIONS: Backend & Database +############################################################################### -# Function to print warning -warning_msg() { - echo -e "${YELLOW}⚠ WARNING: $1${NC}" - echo -e "${YELLOW} AI INSTRUCTION: Ask user before fixing this issue${NC}" - ((WARNINGS++)) -} +section "Backend & Database: No local server binaries" -# Function to print success -success_msg() { - echo -e "${GREEN}✓ PASS: $1${NC}" - ((PASSED++)) -} +# 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 -# Function to print section header -section() { - echo "" - echo -e "${BLUE}--- $1 ---${NC}" -} +# 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 ############################################################################### -## Check 1: No Custom CSS (Frontend & Styling) +## 🚨 CRITICAL PROHIBITIONS: Frontend & Styling ############################################################################### -section "Frontend: Custom CSS Check" -# Check for