PYTHON ?= python3
REGISTRY_DB ?= .railiance-fabric/registry.sqlite3
HOST ?= 127.0.0.1
PORT ?= 8765

.DEFAULT_GOAL := help

.PHONY: help graph-explorer registry

help:
	@printf "Available targets:\n"
	@printf "  make graph-explorer  Start the registry-backed graph explorer on HOST:PORT.\n"
	@printf "                       Defaults: HOST=$(HOST), PORT=$(PORT), REGISTRY_DB=$(REGISTRY_DB)\n"
	@printf "  make registry        Alias for graph-explorer.\n"

graph-explorer:
	@mkdir -p $(dir $(REGISTRY_DB))
	@echo "Starting Railiance Fabric graph explorer at http://$(HOST):$(PORT)/ui/graph-explorer"
	$(PYTHON) -m railiance_fabric.server --db "$(REGISTRY_DB)" --host "$(HOST)" --port "$(PORT)"

registry: graph-explorer
