#!/usr/bin/env bash set -euo pipefail ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$ROOT" OUT="interrogation/frontend" mkdir -p "$OUT" echo "[1/12] Project..." pwd > "$OUT/project.txt" echo "[2/12] Next.js..." npm ls next --depth=0 > "$OUT/next.txt" 2>&1 || true echo "[3/12] Routes..." find app -type f 2>/dev/null | sort > "$OUT/routes.txt" || true find src/app -type f 2>/dev/null | sort >> "$OUT/routes.txt" || true echo "[4/12] Components..." find components -type f 2>/dev/null | sort > "$OUT/components.txt" || true echo "[5/12] Hooks..." find hooks -type f 2>/dev/null | sort > "$OUT/hooks.txt" || true echo "[6/12] Services..." find services -type f 2>/dev/null | sort > "$OUT/services.txt" || true echo "[7/12] API..." grep -R "NEXT_PUBLIC_API_URL" . > "$OUT/api.txt" 2>/dev/null || true echo "[8/12] GrapesJS..." grep -R "grapesjs" . > "$OUT/grapesjs.txt" 2>/dev/null || true echo "[9/12] Build..." npm run build > "$OUT/build.log" 2>&1 || true echo "[10/12] Dependencies..." npm ls > "$OUT/dependencies.txt" 2>&1 || true echo "[11/12] Summary..." { echo "Routes: $(wc -l < "$OUT/routes.txt" 2>/dev/null || echo 0)" echo "Components: $(wc -l < "$OUT/components.txt" 2>/dev/null || echo 0)" echo "Hooks: $(wc -l < "$OUT/hooks.txt" 2>/dev/null || echo 0)" echo "Services: $(wc -l < "$OUT/services.txt" 2>/dev/null || echo 0)" } > "$OUT/summary.txt" echo "[12/12] Complete." echo "$OUT"