.DEFAULT_GOAL := help
.PHONY: help check test demo sync install-timer

help: ## List available targets
	@awk 'BEGIN { print "Available targets:" } /^[a-zA-Z0-9_-]+:.*## / { split($$0, parts, "## "); sub(/:.*/, "", parts[1]); printf "  %-16s %s\n", parts[1], parts[2] }' $(MAKEFILE_LIST)

check: test ## Run tests, validate registries and rehash retained items
	python3 -m inbound_library check

test: ## Run the test suite
	python3 -m unittest discover -s tests -v

demo: ## Run intake, matching and digests on isolated synthetic mail
	python3 tools/demo.py

sync: ## Push committed work and synchronize Statehub
	uv run --project /home/worsch/repo-manager rmgr sync --path . --push

install-timer: ## Install and enable the local user timer
	install -D -m 644 ops/systemd/inbound-library.service $(HOME)/.config/systemd/user/inbound-library.service
	install -D -m 644 ops/systemd/inbound-library.timer $(HOME)/.config/systemd/user/inbound-library.timer
	systemctl --user daemon-reload
	systemctl --user enable --now inbound-library.timer
