.DEFAULT_GOAL := help

.PHONY: help
help: ## Show this help
	@egrep -h '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.PHONY: lint
lint: ## Run linter
	uv run ruff check .

.PHONY: test
test: ## Run tests
	uv run pytest tests/

.PHONY: test-integration
test-integration: ## Run integration test (requires AWS credentials + Resource Explorer)
	uv run --with boto3 tests/integration/test_resource_explorer.py

.PHONY: check
check: lint test ## Run lint and test

.PHONY: generate
generate: ## Generate ARN patterns
	$(MAKE) -C codegen

.PHONY: build
build: ## Build package
	cp codegen/build/arn_patterns.py src/arnmatch/arn_patterns.py
	uv build

.PHONY: publish
publish: build ## Publish package to PyPI
	uv publish

.PHONY: clean
clean: ## Clean build artifacts
	rm -rf dist/ __pycache__/ .pytest_cache/ .ruff_cache/ .cache/
