garden: port content, rebuild public/, add new scripts and features

- Ported Ludo profile from vault to garden
- Added auto-rebuild watcher scripts
- Updated static data snapshots
- Added garden-features.js and api-garden.json
- Added GARDEN-CONTENT-GAPS.md for tracking
- Rebuilt Hugo public/ output
This commit is contained in:
Vigilio Desto 2026-06-08 02:11:24 +02:00
parent 8c06ab2836
commit 5703e606d0
Signed by: Vigo
GPG key ID: 159D6AD58C8E55E9
222 changed files with 1728 additions and 594 deletions

52
scripts/auto-rebuild-watcher.sh Executable file
View file

@ -0,0 +1,52 @@
#!/bin/bash
# auto-rebuild-watcher.sh — inotifywait daemon for garden content/ changes
#
# Runs as a systemd service (garden-content-watcher.service).
# Watches ~/projects/garden/content/ recursively and triggers garden-build.sh
# on file create/modify/delete/move events.
#
# Debounce: waits 3 seconds after the last event before triggering rebuild,
# so rapid batch edits (e.g. `git pull`, bulk copy) cause one rebuild, not N.
set -euo pipefail
CONTENT_DIR="$HOME/projects/garden/content"
BUILD_SCRIPT="$HOME/pulse/garden-build.sh"
if [ ! -d "$CONTENT_DIR" ]; then
echo "✗ Content dir not found: $CONTENT_DIR"
exit 1
fi
if [ ! -x "$BUILD_SCRIPT" ]; then
echo "✗ Build script not found/executable: $BUILD_SCRIPT"
exit 1
fi
echo "=== Garden content watcher starting at $(date -u) ==="
echo " Watching: $CONTENT_DIR"
echo " Rebuild: $BUILD_SCRIPT"
# Initial rebuild on startup (content may have changed while watcher was down)
bash "$BUILD_SCRIPT"
# Monitor with inotifywait — recursive, all file events in content/
inotifywait -m -r -e modify -e create -e delete -e move \
--format '%e %w%f' \
"$CONTENT_DIR" 2>/dev/null |
while IFS= read -r line; do
EVENT_TYPE="${line%% *}"
FILE_PATH="${line#* }"
# Debounce flag: touch a temp flag, sleep 3 seconds, then rebuild if
# the flag is still there (no newer event removed it)
FLAG="${HOME}/projects/garden/.rebuild-pending"
touch "$FLAG"
sleep 3
if [ -f "$FLAG" ]; then
rm -f "$FLAG"
echo "→ Content change detected: $EVENT_TYPE ${FILE_PATH##$HOME/projects/garden/content/}"
bash "$BUILD_SCRIPT"
fi
done

52
scripts/auto-rebuild.sh Executable file
View file

@ -0,0 +1,52 @@
#!/bin/bash
# auto-rebuild.sh — Auto-rebuild garden: fetch API data → hugo → checkpoint
#
# Called by auto-rebuild-watcher.sh when content/ changes.
# Also callable manually: bash scripts/auto-rebuild.sh
set -euo pipefail
DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$DIR"
echo "=== Garden auto-rebuild: $(date -u +%Y-%m-%dT%H:%M:%SZ) ==="
# 1. Fetch Estate API snapshots
echo ""
bash scripts/prebuild-fetch.sh || echo "⚠️ prebuild-fetch.sh failed, continuing..."
# 2. Build Hugo site
echo ""
echo "→ Running hugo..."
hugo 2>&1
HUGO_EXIT=$?
if [ $HUGO_EXIT -ne 0 ]; then
echo "✗ Hugo build failed (exit $HUGO_EXIT)"
# Still write checkpoint so next agent knows state
fi
# 3. Gather stats for checkpoint
PUBLISHED_COUNT=$(find content/ -name '*.md' -not -path '*/_index.md' -not -name '_index.md' | wc -l)
PUBLIC_PAGE_COUNT=$(find public/ -name '*.html' | wc -l)
NEXT_ACTION="check garden estate dashboard health at next patrol"
# 4. Write checkpoint
CHECKPOINT="$DIR/.garden_checkpoint"
cat > "$CHECKPOINT" <<EOF
# Garden Checkpoint
# Auto-generated by auto-rebuild.sh — do not edit manually
last_build: $(date -u +%Y-%m-%dT%H:%M:%SZ)
last_api_sync: $(date -u +%Y-%m-%dT%H:%M:%SZ)
published_pages: $PUBLISHED_COUNT
public_html_files: $PUBLIC_PAGE_COUNT
hugo_exit_code: $HUGO_EXIT
next_action: $NEXT_ACTION
EOF
echo ""
echo "✓ Garden rebuilt at $(date -u)"
echo " Content pages: $PUBLISHED_COUNT"
echo " Public HTML: $PUBLIC_PAGE_COUNT"
echo " Hugo exit: $HUGO_EXIT"
echo " Checkpoint: $CHECKPOINT"

View file

@ -25,6 +25,7 @@ ENDPOINTS=(
"builds"
"trends?limit=5"
"state"
"api/garden"
)
echo "→ Fetching Estate API data for garden build…"