# NVCurve — developer convenience targets.
#
# End users don't need make: run ./install.sh (see README "Installation").

UV  ?= uv
NPM ?= npm

.PHONY: help frontend frontend-dev install dev test clean

help: ## Show available targets
	@grep -E '^[a-zA-Z_-]+:.*?## ' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[36m%-15s\033[0m %s\n", $$1, $$2}'

frontend: ## Build the React frontend into frontend/dist
	cd frontend && $(NPM) ci && $(NPM) run build

frontend-dev: ## Run the Vite dev server (hot reload)
	cd frontend && $(NPM) run dev

install: ## Install nvcurve as a uv tool (builds frontend if missing/stale)
	$(UV) tool install --force .

dev: ## Create/refresh the dev environment (uv sync)
	$(UV) sync

test: ## Run the test suite
	$(UV) run python tests/test_security.py
	$(UV) run python tests/test_rm_power.py

clean: ## Remove build artifacts
	rm -rf frontend/dist frontend/node_modules