.DEFAULT_GOAL := help

.PHONY: help install build test lint secure docs

help: ## Show available commands
	@echo "Usage: make [target]"
	@echo ""
	@echo "Targets:"
	@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "  %-12s %s\n", $$1, $$2}'

install: ## Install dev dependencies with uv
	uv sync --group dev

build: ## Build wheel and source distribution
	uv build

test: ## Run pytest suite
	uv run pytest -v

lint: ## Run ruff linter and black format check
	uv run ruff check . --fix
	uv run black .

secure: ## Run bandit and pysentry-rs security scans
	uv run bandit -r fastapi_mongo_admin example/ecommerce -ll
	uv run pysentry-rs .

docs: ## Build Sphinx HTML documentation
	uv run --extra docs sphinx-build -b html docs docs/_build/html
