.PHONY: help up down logs build api worker init smoke test fmt lint

help:
	@echo "make up        - start all services"
	@echo "make down      - stop all services"
	@echo "make build     - rebuild api/worker image"
	@echo "make init      - run db migrations + bootstrap opensearch + qdrant"
	@echo "make smoke     - run the smoke test inside the api container"
	@echo "make test      - pytest"
	@echo "make logs      - tail api+worker logs"

up:
	docker compose up -d --build

down:
	docker compose down

build:
	docker compose build api worker

logs:
	docker compose logs -f api worker

init:
	docker compose exec api python scripts/init_db.py
	docker compose exec api python scripts/init_opensearch.py
	docker compose exec api python scripts/init_qdrant.py

smoke:
	docker compose exec api python scripts/smoke_test.py

test:
	pytest -q

fmt:
	ruff format app scripts tests

lint:
	ruff check app scripts tests
