.PHONY: install install-all test test-quick lint clean build publish docker-up docker-web docker-mcp doctor fix-lint format

# ── Installation ────────────────────────────────────────────────────

install:
	pip install -e .

install-all:
	pip install -e ".[all]"

install-dev:
	pip install -e ".[dev,all]"

# ── Testing ─────────────────────────────────────────────────────────

test:
	python -m pytest tests/ -v --tb=short

test-quick:
	python -m pytest tests/ -x --tb=short -q

test-coverage:
	pip install pytest-cov
	python -m pytest tests/ --cov=src/argis --cov-report=term-missing

# ── Code Quality ────────────────────────────────────────────────────

lint:
	python -m pip install ruff
	python -m ruff check src/argis/ tests/

fix-lint:
	python -m ruff check --fix src/argis/ tests/

format:
	python -m ruff format src/argis/ tests/

# ── Cleanup ─────────────────────────────────────────────────────────

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

# ── Build ───────────────────────────────────────────────────────────

build:
	python -m build

publish:
	python -m twine upload dist/*

# ── Docker ──────────────────────────────────────────────────────────

docker-up:
	docker compose up --build

docker-web:
	docker compose --profile web up --build

docker-mcp:
	docker compose --profile mcp up --build

# ── Argis Commands ──────────────────────────────────────────────────

doctor:
	argis doctor

export-history:
	python scripts/export_all_history.py

batch-report:
	python scripts/batch_report.py

# ── Deduplicate Sites ───────────────────────────────────────────────

dedupe:
	python scripts/dedupe_sites.py src/argis/sites.json

dedupe-dry:
	python scripts/dedupe_sites.py src/argis/sites.json --dry-run
