version: "3" vars: COMPOSE: docker compose DEV_FLAGS: -f docker-compose.yml -f docker-compose.dev.yml DEV_SERVICES: db redis api web audio-worker nc-watcher # ── Production ──────────────────────────────────────────────────────────────── tasks: help: desc: Show available tasks cmds: - echo "Available tasks:" - echo " dev:up - Start complete development server (recommended)" - echo " dev:build - Build development containers" - echo " dev:clean - Safe cleanup (preserves network)" - echo " dev:nuke - Full cleanup (removes everything)" - echo " dev:restart - Restart development services" - echo " dev:down - Stop development environment" - echo " dev:logs - Follow logs from all services" - echo " api:logs - Follow API service logs" - echo " web:logs - Follow Web service logs" - echo " db:migrate - Run database migrations" - echo " db:seed - Seed database with test data" - echo " test:e2e - Run end-to-end tests" - echo " test:unit - Run unit tests" up: desc: Start all services (production) cmds: - "{{.COMPOSE}} up -d" down: desc: Stop all services cmds: - "{{.COMPOSE}} down" build: desc: Build all images deps: [check] cmds: - "{{.COMPOSE}} build" logs: desc: Follow logs for all services (pass SERVICE= to filter) cmds: - "{{.COMPOSE}} logs -f {{.SERVICE}}" restart: desc: Restart a service without rebuilding (e.g. task restart SERVICE=api) cmds: - "{{.COMPOSE}} restart {{.SERVICE}}" # ── Dev / Debug ─────────────────────────────────────────────────────────────── dev: desc: Start backend in dev mode (hot reload, source mounts) cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} up {{.DEV_SERVICES}}" dev:detach: desc: Start backend in dev mode, detached cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} up -d {{.DEV_SERVICES}}" dev:web: desc: Start Vite dev server (proxies /api to localhost:8000) dir: web cmds: - npm run dev dev:up: desc: Start complete development server (recommended) cmds: - echo "Starting development environment..." - "{{.COMPOSE}} {{.DEV_FLAGS}} up -d {{.DEV_SERVICES}}" - echo "Following logs... (Ctrl+C to stop)" - "{{.COMPOSE}} {{.DEV_FLAGS}} logs -f api web audio-worker nc-watcher" dev:build: desc: Build development containers (only when dependencies change) cmds: - echo "Building development containers..." - "{{.COMPOSE}} {{.DEV_FLAGS}} build --pull api web" - echo "Containers built successfully" dev:logs: desc: Follow logs in dev mode cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} logs -f {{.SERVICE}}" dev:restart: desc: Restart a service in dev mode (e.g. task dev:restart SERVICE=audio-worker) cmds: - "{{.COMPOSE}} {{.DEV_FLAGS}} restart {{.SERVICE}}" dev:clean: desc: Safe cleanup (preserves network/proxy, removes containers/volumes) cmds: - echo "Stopping development services..." - "{{.COMPOSE}} {{.DEV_FLAGS}} down" - echo "Removing development volumes..." - docker volume rm -f $(docker volume ls -q | grep rehearsalhub) || true - echo "Development environment cleaned (network preserved)" dev:nuke: desc: Full cleanup (removes everything including network - use when network is corrupted) cmds: - echo "WARNING: This will remove ALL rehearsalhub containers, networks, and volumes" - echo "Press Enter to continue or Ctrl+C to cancel" - read dummy - "{{.COMPOSE}} {{.DEV_FLAGS}} down -v" - docker system prune -f --volumes - echo "Complete cleanup performed" dev:restart: desc: Restart development services (preserves build cache) cmds: - echo "Restarting development services..." - "{{.COMPOSE}} {{.DEV_FLAGS}} restart {{.DEV_SERVICES}}" - echo "Services restarted" # ── Database ────────────────────────────────────────────────────────────────── migrate: desc: Run Alembic migrations cmds: - "{{.COMPOSE}} exec api alembic upgrade head" migrate:auto: desc: Autogenerate a migration (e.g. task migrate:auto M="add users table") cmds: - "{{.COMPOSE}} exec api alembic revision --autogenerate -m '{{.M}}'" # ── Setup ───────────────────────────────────────────────────────────────────── setup: desc: First-time setup — start services, configure Nextcloud, seed data cmds: - task: up - echo "Waiting for Nextcloud to initialize (~60s)..." - sleep 60 - bash scripts/nc-setup.sh - bash scripts/seed.sh # ── Testing ─────────────────────────────────────────────────────────────────── # Run this after every feature branch — fast, no external services required. test:feature: desc: "Post-feature pipeline: typecheck + frontend tests + backend unit tests (no services needed)" cmds: - task: typecheck:web - task: test:web - task: test:api:unit - task: test:worker - task: test:watcher # Full CI pipeline — runs everything including integration tests. # Requires: services up (task dev:detach), DB migrated. ci: desc: "Full CI pipeline: lint + typecheck + all tests (requires services running)" cmds: - task: lint - task: typecheck:web - task: test:web - task: test:api - task: test:worker - task: test:watcher test: desc: Run all backend tests (unit + integration) deps: [test:api, test:worker, test:watcher] test:web: desc: Run frontend unit tests (via podman — no local Node required) dir: web cmds: - podman run --rm -v "$(pwd)":/app:Z -w /app node:20-alpine sh -c "npm install --legacy-peer-deps --silent && npm run test" test:api: desc: Run all API tests with coverage (unit + integration) dir: api cmds: - uv run pytest tests/ -v --cov=src/rehearsalhub --cov-report=term-missing test:api:unit: desc: Run API unit tests only (no database or external services required) dir: api cmds: - uv run pytest tests/unit/ -v -m "not integration" test:worker: desc: Run worker tests with coverage dir: worker cmds: - uv run pytest tests/ -v --cov=src/worker --cov-report=term-missing test:watcher: desc: Run watcher tests with coverage dir: watcher cmds: - uv run pytest tests/ -v --cov=src/watcher --cov-report=term-missing test:integration: desc: Run integration tests (requires services running) dir: api cmds: - uv run pytest tests/integration/ -v -m integration # ── Linting & type checking ─────────────────────────────────────────────────── check: desc: Run all linters and type checkers deps: [lint, typecheck:web] lint: desc: Lint all services cmds: - cd api && uv run ruff check src/ tests/ && uv run mypy src/ - cd worker && uv run ruff check src/ tests/ - cd watcher && uv run ruff check src/ tests/ - cd web && npm run lint typecheck:web: desc: TypeScript type check dir: web cmds: - npm run typecheck format: desc: Auto-format Python source cmds: - cd api && uv run ruff format src/ tests/ - cd worker && uv run ruff format src/ tests/ - cd watcher && uv run ruff format src/ tests/ # ── Shells ──────────────────────────────────────────────────────────────────── shell:api: desc: Shell into the API container interactive: true cmds: - "{{.COMPOSE}} exec api bash" shell:db: desc: psql shell interactive: true cmds: - "{{.COMPOSE}} exec db psql -U $POSTGRES_USER -d $POSTGRES_DB" shell:redis: desc: redis-cli shell interactive: true cmds: - "{{.COMPOSE}} exec redis redis-cli"