set dotenv-load := false
set positional-arguments := false

default:
	@just --list

# Tidy and download module dependencies (stdlib only — there are none)
install:
	@echo "→ Tidying Go module…"
	go mod tidy

# Run the example program against a sample document
run:
	@echo "→ Running example…"
	go run ./examples/basic

# Vet, format-check, and compile the whole module (must be clean)
build:
	@echo "→ Vetting…"
	go vet ./...
	@echo "→ Checking formatting…"
	@test -z "$(gofmt -l .)" || { echo "gofmt needed:"; gofmt -l .; exit 1; }
	@echo "→ Compiling…"
	go build ./...

# Run the test suite
test:
	@echo "→ Running tests…"
	go test ./...

# Run tests with coverage and write an HTML report
coverage:
	go test -coverprofile=coverage.out ./...
	go tool cover -html=coverage.out -o coverage.html

# Remove build and coverage artifacts
uninstall:
	@echo "→ Removing build artifacts…"
	rm -rf bin coverage.out coverage.html
