Files
bookhoard/scripts/verify-quick.sh
T
john-okeefe e0b95ba297 Add project guidelines verification script
Created comprehensive verification script to check codebase against PROJECT_GUIDELINES.md

Features:
- Checks for custom CSS (TailwindCSS requirement)
- Detects JavaScript files that should be TypeScript
- Verifies no secrets committed (.env, credentials.json)
- Validates code compiles (go build)
- Finds local binaries (should use container builds)
- Quick checks with clear pass/fail/warning output

Usage:
  make verify-guidelines
  ./scripts/verify-quick.sh

Current codebase status:
  - 12 templates with custom CSS (need Tailwind conversion)
  - 2 .js files in web/static/ (need TypeScript conversion)
  - 1 binary file (./bookhoard)

This addresses the trust issue: AI now has a tool to prove guideline compliance
2026-02-02 09:55:39 -05:00

75 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# Quick verification script for immediate use
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}=== Quick Guidelines Check ===${NC}"
section "1. Custom CSS Check"
STYLE_COUNT=$(grep -l '<style>' templates/*.templ 2>/dev/null | wc -l || echo 0)
if [ "$STYLE_COUNT" -gt 0 ]; then
error_msg "Found $STYLE_COUNT templates with <style> tags"
grep -l '<style>' templates/*.templ 2>/dev/null | head -5
else
success_msg "No <style> in templates"
fi
section "2. JavaScript Files Check"
JS_COUNT=$(find . -name "*.js" -not -path "./node_modules/*" -not -path "./docs/*" -not -path "./.git/*" 2>/dev/null | wc -l)
if [ "$JS_COUNT" -gt 0 ]; then
error_msg "Found $JS_COUNT .js files"
find . -name "*.js" -not -path "./node_modules/*" -not -path "./docs/*" -not -path "./.git/*" 2>/dev/null | head -5
else
success_msg "No .js files"
fi
section "3. Secrets Check"
if [ -f ".env" ] || [ -f "credentials.json" ]; then
error_msg "Found .env or credentials.json in repo"
else
success_msg "No secrets found"
fi
section "4. Build Check"
echo "Building..."
if go build -o /tmp/bookhoard-test ./cmd/server 2>/dev/null; then
success_msg "Code compiles"
rm -f /tmp/bookhoard-test
else
error_msg "Build failed"
fi
section "5. Binary Check"
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"
find . -type f \( -name "bookhoard" -o -name "server" \) -not -path "./node_modules/*" -not -path "./.git/*" 2>/dev/null
else
success_msg "No binaries"
fi
echo ""
echo -e "${BLUE}=== Summary ===${NC}"
echo -e "${GREEN}PASSED: $PASSED${NC}"
echo -e "${YELLOW}WARNINGS: $WARNINGS${NC}"
echo -e "${RED}ERRORS: $ERRORS${NC}"
if [ $ERRORS -gt 0 ]; then
exit 1
fi
exit 0