.PHONY: help up down logs backend-shell migrate test lint typecheck codegen

help:
	@echo "make up           - start all services (Postgres, Redis, backend, frontend)"
	@echo "make down         - stop all services"
	@echo "make logs         - tail logs from all services"
	@echo "make backend-shell - shell into backend container"
	@echo "make migrate      - run alembic upgrade head"
	@echo "make test         - run backend pytest"
	@echo "make lint         - ruff check"
	@echo "make typecheck    - mypy on core modules"
	@echo "make codegen      - regenerate frontend TS types from backend OpenAPI"

up:
	docker compose up -d --build

down:
	docker compose down

logs:
	docker compose logs -f --tail=100

backend-shell:
	docker compose exec backend bash

migrate:
	docker compose exec backend alembic upgrade head

test:
	cd backend && uv run pytest -q

lint:
	cd backend && uv run ruff check .

typecheck:
	cd backend && uv run mypy app/services/generative app/services/site_finder/scorer.py

codegen:
	cd frontend && npm run codegen
