#!/bin/bash # Project-specific initialization for the agent loop. # Copy this to .loop/init.sh and customize for your project. # # This script runs at the start of each loop.sh invocation to ensure # the development environment is ready. Keep it idempotent (safe to run multiple times). set -euo pipefail echo "[init] Setting up development environment..." # --- Dependencies --- # Uncomment and adapt for your project: # Node.js # if [ -f package.json ]; then # npm install --silent # fi # Python # if [ -f requirements.txt ]; then # pip install -q -r requirements.txt # fi # Go # if [ -f go.mod ]; then # go mod download # fi # Rust # if [ -f Cargo.toml ]; then # cargo build --quiet # fi # --- Dev Server --- # Start if not already running: # if ! lsof -i :3000 &>/dev/null; then # npm run dev & # sleep 3 # fi # --- Database --- # Run migrations if needed: # npm run migrate # python manage.py migrate # alembic upgrade head # --- Verify --- # Quick smoke test: # npm run typecheck # npm run test -- --run --silent echo "[init] Environment ready."