.PHONY: install lock fmt lint typecheck test check docs docs-build

# Every tool runs from the uv-managed .venv, pinned by uv.lock.
RUN := uv run --locked

install:  ## Create .venv from uv.lock (package in editable mode + dev tools)
	uv sync --locked

lock:  ## Re-resolve uv.lock after changing dependencies in pyproject.toml
	uv lock

# benchmark/{malicious,benign} are fixtures; lint only the top-level scripts.
fmt:  ## Format the code
	$(RUN) ruff format src tests benchmark/*.py

lint:  ## Lint (and verify formatting)
	$(RUN) ruff format --check src tests benchmark/*.py
	$(RUN) ruff check src tests benchmark/*.py

typecheck:  ## Static type checking
	$(RUN) mypy

test:  ## Run the test suite
	$(RUN) pytest -q

check: lint typecheck test  ## Run all gates (format check, lint, types, tests)

docs:  ## Serve the documentation site locally (http://localhost:5173/malware-detector/)
	npm --prefix docs install && npm --prefix docs run dev

docs-build:  ## Build the documentation site into docs/.vitepress/dist
	npm --prefix docs ci && npm --prefix docs run build
