# Makefile for Bolorey

.PHONY: test coverage lint format clean tdd live-small live-medium live-large file-small file-medium file-large file-medium-stream

# Run all tests
test:
	pytest -v

# Run tests with coverage
coverage:
	pytest --cov=bolorey --cov-report=term-missing

# Lint check (no modifications)
lint:
	black --check bolorey tests
	isort --check-only bolorey tests
	flake8 bolorey tests

# Auto-format code
format:
	black bolorey tests
	isort bolorey tests

# Clean caches and build artifacts
clean:
	find . -type d -name "__pycache__" -exec rm -rf {} +
	rm -rf .pytest_cache
	rm -rf htmlcov

# Run tests in watch mode (rerun on file changes)
tdd:
	ptw --runner "pytest -v --maxfail=1 --disable-warnings"

# === Whisper model targets (asr_whisper.py) ===
PYTHON = python
SCRIPT = bolorey/asr/asr_whisper.py
TEST_FILE = afdr314.mp3

live-small:
	$(PYTHON) $(SCRIPT) --mode live --model small

live-medium:
	$(PYTHON) $(SCRIPT) --mode live --model medium

live-large:
	$(PYTHON) $(SCRIPT) --mode live --model large

file-small-stream:
	$(PYTHON) $(SCRIPT) --file $(FILE) --model small

file-medium-stream:
	$(PYTHON) $(SCRIPT) --file $(FILE) --model medium

file-large-stream:
	$(PYTHON) $(SCRIPT) --file $(FILE) --model large

# === Whisper stream simulation (asr_git_working.py) ===
WORKING_SCRIPT = bolorey/asr/asr_git_working.py

file-medium-stream:
	$(PYTHON) $(WORKING_SCRIPT) --file $(TEST_FILE) --model medium