# bootstrap.sh — the non-destructive half of project lifecycle: restore .env from
# .env.example when missing, install dependencies for the detected stack, and
# build once so the tree is runnable. Idempotent: safe to run repeatedly.
# Wired to `task setup` (first-time, on its own) and `task reset` (run right
# after reset.sh has cleaned the tree). Detects Go / Node and degrades quietly
# when neither is present.
log() { printf '\033[36m▸ %s\033[0m\n' "$*"; }
if [ ! -f .env ] && [ -f .env.example ]; then
log "Creating .env from .env.example"
log "Tidying Go module dependencies"
elif [ -f package.json ]; then
if [ -f package-lock.json ]; then
log "Installing Node dependencies (npm ci)"
log "Installing Node dependencies (npm install)"
log "No go.mod or package.json found — skipping dependency install"