#!/usr/bin/env bash # Start the Astro dev server and optionally the edit sidecar. # Usage: scripts/dev.sh [--edit] set -e cd "$(dirname "$0")/.." ROOT="$(pwd)" # Symlink wiki pages and stories into the site's content collections mkdir -p pages stories mkdir -p site/src/content/entries LINK="$ROOT/site/src/content/entries/_wiki" if [ ! -L "$LINK" ]; then ln -sf "$ROOT/pages" "$LINK" echo "Linked pages/ → site/src/content/entries/_wiki" fi BLOG_LINK="$ROOT/site/src/content/blog" if [ ! -L "$BLOG_LINK" ]; then ln -sf "$ROOT/stories" "$BLOG_LINK" echo "Linked stories/ → site/src/content/blog" fi # Start edit sidecar if requested if [[ "$*" == *"--edit"* ]]; then echo "Starting edit sidecar on :8001..." uv sync -q uv run uvicorn edit.server:app --reload --port 8001 & SIDECAR_PID=$! trap "kill $SIDECAR_PID 2>/dev/null" EXIT fi # Start Astro dev server export PUBLIC_EDIT_URL="${WIKI_EDIT_URL:-}" cd site && npm run dev