directiva 0.1.0

A tiny, paste-friendly directive mini-language: ACTION:[<KIND>]NAME[@PATH][=NOTE]
Documentation
# directiva — common dev targets.
#
# Conventions:
#   - All targets are .PHONY.
#   - `make check` is the all-in-one gate: fmt-check + clippy (default + python) + tests.
#   - Python targets drive maturin through uv (`uv run`), building into a local `.venv`.

.DEFAULT_GOAL := help

.PHONY: help check test clippy fmt fmt-check lint build py-dev py-test clean

help:
	@echo "directiva targets:"
	@echo "  make check      fmt-check + clippy (default & python) + all tests   (the CI gate)"
	@echo "  make test       cargo test (core + source + lint + integration + doctest)"
	@echo "  make clippy      cargo clippy --all-targets + --features python, -D warnings"
	@echo "  make fmt        cargo fmt"
	@echo "  make lint       fmt + clippy"
	@echo "  make build      cargo build --release"
	@echo "  make py-dev     maturin develop --features python  (into .venv, via uv)"
	@echo "  make py-test    py-dev + a Python import/parse/match/lint smoke test"
	@echo "  make clean      cargo clean + remove .venv and built artefacts"

check: fmt-check clippy test

test:
	cargo test

clippy:
	cargo clippy --all-targets -- -D warnings
	cargo clippy --features python -- -D warnings

fmt:
	cargo fmt

fmt-check:
	cargo fmt --check

lint: fmt clippy

build:
	cargo build --release

# Build the extension into a uv-managed .venv. `uv run` provisions maturin + the venv on demand.
py-dev:
	uv venv --python 3.12
	uv pip install maturin
	uv run maturin develop --features python

py-test: py-dev
	uv run python -c "import directiva; from directiva import lint; \
d = directiva.parse('de-escalate:<method>get_*@*/tests/*=fixtures'); \
assert d.matches(['get_user'], qualifier='method', scopes=['src/tests/x.py']); \
assert directiva.glob_match('*/{test,tests}/*', 'pkg/tests/x.py'); \
o = lint.fold(lint.ERROR, [d], ['get_user'], qualifier='method', scopes=['src/tests/x.py']); \
assert o.severity == 'warning' and o.notes == ['fixtures']; \
print('py-test OK:', o)"

clean:
	cargo clean
	rm -rf .venv dist