.PHONY: clean build install test test-deps help

# Default target
help:
	@echo "Available targets:"
	@echo "  clean     - Remove build artifacts and cache files"
	@echo "  build     - Build the wheel package"
	@echo "  install   - Install the package in development mode"
	@echo "  test      - Run the test suite"
	@echo "  test-deps - Install test dependencies"
	@echo "  help      - Show this help message"

# Clean build artifacts
clean:
	@echo "Cleaning build artifacts..."
	rm -rf build/ dist/ src/kumacli.egg-info/
	find . -name "*.pyc" -o -name "*.pyo" -delete
	find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
	@echo "Clean complete."

# Build the wheel package
build: clean
	@echo "Building wheel package..."
	python3 -m build
	@echo "Build complete. Artifacts in dist/"

# Install package in development mode
install:
	@echo "Installing package in development mode..."
	pip install -e .

# Install test dependencies
test-deps:
	@echo "Installing test dependencies..."
	pip install -e ".[test]"

# Test the package
test:
	@echo "Running tests..."
	python3 -m pytest tests/ -v --tb=short

# Rebuild and reinstall (useful during development)
dev: clean build
	@echo "Installing newly built package..."
	pip uninstall kumacli -y 2>/dev/null || true
	pip install dist/kumacli-*.whl
	@echo "Development installation complete."
