.PHONY: help install dev test lint format type migrate clean

help:
	@echo "artifact-store — make targets"
	@echo "  install  install / sync dependencies via uv"
	@echo "  dev      run the FastAPI app with reload (uvicorn)"
	@echo "  test     run the pytest suite"
	@echo "  lint     ruff check + ruff format --check"
	@echo "  format   ruff format (write changes)"
	@echo "  type     mypy --strict over src and tests"
	@echo "  migrate  alembic upgrade head (configured by WP-0001-T002)"
	@echo "  clean    remove caches and build artefacts"

install:
	uv sync --all-extras

dev:
	uv run uvicorn artifactstore.api.http:app --reload --host 127.0.0.1 --port 8000

test:
	uv run pytest

lint:
	uv run ruff check .
	uv run ruff format --check .

format:
	uv run ruff format .
	uv run ruff check --fix .

type:
	uv run mypy

migrate:
	@if [ -f alembic.ini ]; then \
	  uv run alembic upgrade head; \
	else \
	  echo "alembic.ini not present yet — see ARTIFACT-STORE-WP-0001-T002"; \
	fi

clean:
	rm -rf .pytest_cache .mypy_cache .ruff_cache build dist *.egg-info
	find . -type d -name __pycache__ -prune -exec rm -rf {} +
