# AutoCode-Gen Makefile

.PHONY: help install install-dev test lint format clean build publish

help:
	@echo "AutoCode-Gen 开发命令"
	@echo ""
	@echo "  make install      - 安装依赖"
	@echo "  make install-dev  - 安装开发依赖"
	@echo "  make test         - 运行测试"
	@echo "  make lint         - 代码检查"
	@echo "  make format       - 代码格式化"
	@echo "  make clean        - 清理构建文件"
	@echo "  make build        - 构建包"
	@echo "  make publish      - 发布到PyPI"
	@echo ""

install:
	pip install -r requirements.txt

install-dev:
	pip install -r requirements.txt
	pip install -r requirements-dev.txt
	pip install -e .

test:
	pytest --cov=autocode --cov-report=html --cov-report=term

lint:
	flake8 autocode tests
	mypy autocode
	isort --check-only autocode tests

format:
	black autocode tests
	isort autocode tests

clean:
	rm -rf build/
	rm -rf dist/
	rm -rf *.egg-info/
	rm -rf .pytest_cache/
	rm -rf .mypy_cache/
	rm -rf htmlcov/
	find . -type d -name __pycache__ -exec rm -rf {} +
	find . -type f -name "*.pyc" -delete

build: clean
	python -m build
	@echo "✅ 构建完成，检查 dist/ 目录"

publish-test: build
	python -m twine upload --repository testpypi dist/*

publish: build
	python -m twine upload dist/*

run:
	python -m autocode.cli --help
