.PHONY: install dev stop test test-e2e build

install:
	pip install --break-system-packages fastapi "uvicorn[standard]" httpx pytest pytest-asyncio ftfy fuzzysearch
	cd frontend && npm install
	@echo "Optional: pip install sentence-transformers (Embedding-Kandidaten; ohne läuft lexikalischer Fallback)."
	@echo "Optional: poppler-utils für PDF-Quellen (pdftotext)."

dev:
	@echo "Backend: http://localhost:8000  Frontend: http://localhost:5173"
	@set -a; [ -f .env ] && . ./.env; set +a; \
		cd backend && uvicorn main:app --reload --port 8000 &
	@cd frontend && npx vite --port 5173

stop:
	-@pkill -f "uvicorn main:app" 2>/dev/null
	-@pkill -f "vite --port 5173" 2>/dev/null
	@echo "gestoppt."

test:
	cd backend && python -m pytest ../tests -x -q

test-e2e:
	cd backend && CREATOR_FAKE_AGENTS=1 python -m pytest ../tests/test_e2e.py -x -q

build:
	cd frontend && npm run build
