.PHONY: install install-dev run test test-cov lint lint-fix format clean

# mofix-new 后端完整保留在 server/,以 server/ 作为 Python 项目根目录。
SERVER := server

install:
	$(MAKE) -C $(SERVER) install 2>/dev/null || pip install -r $(SERVER)/requirements.txt

install-dev:
	pip install -e "$(SERVER)[dev]"

run:
	cd $(SERVER) && python run.py

test:
	cd $(SERVER) && python -m pytest -v

test-cov:
	cd $(SERVER) && python -m pytest --cov=app --cov-report=term-missing

lint:
	cd $(SERVER) && ruff check app/ commands/ agents/ scripts/

lint-fix:
	cd $(SERVER) && ruff check --fix app/ commands/ agents/ scripts/

format:
	cd $(SERVER) && ruff format app/ commands/ agents/ scripts/

clean:
	find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
	find . -type f -name "*.pyc" -delete 2>/dev/null || true
	rm -rf .pytest_cache/ .ruff_cache/ build/ dist/ *.egg-info/