# Deeplife toolkit — local quality targets (repo root = package root).

UV ?= uv
ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
UV_RUN = cd $(ROOT) && $(UV) run

.PHONY: help
help:
	@echo "deeplife-toolkit"
	@echo "  make configure     - uv sync --group dev"
	@echo "  make fmt / fmt-check / lint / type-check / run-tests / check-all"
	@echo "  (fmt + lint include ./notebooks — Ruff native Jupyter support)"

.PHONY: configure
configure:
	cd $(ROOT) && $(UV) sync --group dev

.PHONY: fmt
fmt:
	$(UV_RUN) ruff format ./src ./tests ./notebooks

.PHONY: fmt-check
fmt-check:
	$(UV_RUN) ruff format ./src ./tests ./notebooks --check

.PHONY: lint
lint:
	$(UV_RUN) ruff check ./src ./tests ./notebooks

.PHONY: type-check
type-check:
	$(UV_RUN) mypy ./src/deeplife_toolkit

.PHONY: run-tests
run-tests:
	$(UV_RUN) pytest ./tests -q \
		--cov=./src/deeplife_toolkit \
		--cov-report=term-missing

.PHONY: clean
clean:
	rm -rf $(ROOT)/.pytest_cache $(ROOT)/.mypy_cache $(ROOT)/.ruff_cache
	rm -f $(ROOT)/.coverage
	find $(ROOT) -type d -name __pycache__ -prune -exec rm -rf {} + 2>/dev/null || true

.PHONY: check-all
check-all: configure fmt-check lint type-check run-tests
	@echo "✅ check-all completed."

.PHONY: check-all-fast
check-all-fast: fmt-check lint type-check run-tests
	@echo "✅ check-all-fast completed (skipped uv sync)."
