#!/usr/bin/env bash
# Regenerate the /docs/catalog tree from the current
# /opt/dashcaddy/dashcaddy-api/src/docker/app-templates.js.
#
# Run this whenever templates are added/changed. Outputs 78 static pages
# under src/app/docs/catalog/ (1 index + 77 per-template).
#
# Idempotent — overwrites in place.
set -euo pipefail
cd "$(dirname "$0")/.."
node /tmp/generate-template-docs.js
echo "Verifying build..."
npx --no-install next build 2>&1 | tail -3
echo "Done. Review with: git diff --stat src/app/docs/catalog/"