.PHONY: help install dev-install setup-hooks format lint type-check security test test-cov build ci ci-fast clean

help:
	@echo "Available targets:"
	@echo "  make install       Install runtime dependencies"
	@echo "  make dev-install   Install development dependencies and Git hooks"
	@echo "  make format        Format the codebase"
	@echo "  make lint          Check linting and formatting"
	@echo "  make type-check    Run static type checks"
	@echo "  make security      Run security checks"
	@echo "  make test          Run tests"
	@echo "  make test-cov      Run tests with coverage"
	@echo "  make build         Build source and wheel distributions"
	@echo "  make ci            Run the full local CI suite"

install:
	uv sync --no-dev --all-extras

dev-install:
	uv sync --group dev --all-extras
	$(MAKE) setup-hooks

setup-hooks:
	uv run pre-commit install
	uv run pre-commit install --hook-type commit-msg

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

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

type-check:
	uv run ty check .

security:
	uv run bandit -c pyproject.toml -r src

test:
	uv run pytest

test-cov:
	uv run pytest --cov=agents_builder --cov-branch --cov-report=term-missing:skip-covered --cov-report=xml --cov-fail-under=95

build:
	uv run python -m build

ci: lint type-check security test-cov build

ci-fast: lint type-check test

clean:
	rm -rf .coverage coverage.xml htmlcov .pytest_cache .ruff_cache .ty_cache build dist
	find . -type d -name __pycache__ -prune -exec rm -rf {} +
