# Vibe Coding 质量门禁统一入口
# 用法: make help | make gate | make test

.PHONY: help lint test gate build fmt clean

PYTHON ?= python
PYTEST ?= pytest

help:
	@echo "Vibe Coding 质量门禁"
	@echo ""
	@echo "  make lint   - ruff 静态检查"
	@echo "  make fmt    - ruff 自动格式化"
	@echo "  make test   - 运行 pytest"
	@echo "  make gate   - lint + test（提交前必跑）"
	@echo "  make loop-tick - 外循环 tick（Loop Engineering 调度指引）"
	@echo "  make build  - 构建检查"
	@echo "  make clean  - 清理缓存"

lint:
	$(PYTHON) -m ruff check src tests scripts
	$(PYTHON) -m ruff format --check src tests scripts

fmt:
	$(PYTHON) -m ruff format src tests scripts
	$(PYTHON) -m ruff check --fix src tests scripts

test:
	$(PYTEST) tests/ -v --tb=short

gate: lint test
	@echo "✓ 质量门禁通过"

loop-tick:
	$(PYTHON) scripts/run-loop-tick.py

build:
	$(PYTHON) -m compileall -q src
	@echo "✓ 构建检查通过"

clean:
	rm -rf .pytest_cache .ruff_cache __pycache__ src/**/__pycache__ tests/**/__pycache__
	@echo "✓ 已清理缓存"
