trueno-rag 0.1.12

Pure-Rust Retrieval-Augmented Generation pipeline built on Trueno
Documentation
# Trueno-RAG Makefile
# Certeza Methodology - Tiered Quality Gates

SHELL := /bin/bash
.SUFFIXES:
.DELETE_ON_ERROR:

.PHONY: all build test test-fast lint fmt fmt-check coverage coverage-open bench clean doc check ci examples book

# Default target
all: test-fast lint

# Build
build:
	cargo build

# ============================================================================
# TEST TARGETS
# ============================================================================

# Fast tests (<30s): Uses nextest for parallelism if available
test-fast: ## Fast unit tests (<30s target)
	@echo "โšก Running fast tests (target: <30s)..."
	@if command -v cargo-nextest >/dev/null 2>&1; then \
		time cargo nextest run --lib \
			--status-level skip \
			--failure-output immediate; \
	else \
		echo "๐Ÿ’ก Install cargo-nextest for faster tests: cargo install cargo-nextest"; \
		time cargo test --lib; \
	fi
	@echo "โœ… Fast tests passed"

# Standard tests
test: ## Standard tests
	@echo "๐Ÿงช Running standard tests..."
	@if command -v cargo-nextest >/dev/null 2>&1; then \
		time cargo nextest run \
			--status-level skip \
			--failure-output immediate; \
	else \
		time cargo test; \
	fi
	@echo "โœ… Standard tests passed"

# Linting
lint: ## Run clippy linter
	cargo clippy -- -D warnings

# Format
fmt: ## Format code
	cargo fmt

fmt-check: ## Check formatting
	cargo fmt --check

# ============================================================================
# COVERAGE TARGETS (Two-Phase Pattern from aprender/bashrs)
# ============================================================================
# CRITICAL: mold linker breaks LLVM coverage instrumentation
# Solution: Temporarily move ~/.cargo/config.toml during coverage runs

coverage: ## Generate HTML coverage report (target: <5 min)
	@echo "๐Ÿ“Š Running coverage analysis (target: <5 min)..."
	@echo "๐Ÿ” Checking for cargo-llvm-cov and cargo-nextest..."
	@which cargo-llvm-cov > /dev/null 2>&1 || (echo "๐Ÿ“ฆ Installing cargo-llvm-cov..." && cargo install cargo-llvm-cov --locked)
	@which cargo-nextest > /dev/null 2>&1 || (echo "๐Ÿ“ฆ Installing cargo-nextest..." && cargo install cargo-nextest --locked)
	@echo "๐Ÿงน Cleaning old coverage data..."
	@mkdir -p target/coverage
	@echo "๐Ÿงช Phase 1: Running tests with instrumentation (no report)..."
	@cargo llvm-cov --no-report nextest --no-tests=warn --workspace --no-fail-fast --all-features
	@echo "๐Ÿ“Š Phase 2: Generating coverage reports..."
	@cargo llvm-cov report --html --output-dir target/coverage/html
	@cargo llvm-cov report --lcov --output-path target/coverage/lcov.info
	@echo ""
	@echo "๐Ÿ“Š Coverage Summary:"
	@echo "=================="
	@cargo llvm-cov report --summary-only
	@echo ""
	@echo "๐Ÿ’ก Reports:"
	@echo "- HTML: target/coverage/html/index.html"
	@echo "- LCOV: target/coverage/lcov.info"

coverage-open: ## Open HTML coverage report
	@if [ -f target/coverage/html/index.html ]; then \
		xdg-open target/coverage/html/index.html 2>/dev/null || \
		open target/coverage/html/index.html 2>/dev/null || \
		echo "Open: target/coverage/html/index.html"; \
	else \
		echo "โŒ Run 'make coverage' first"; \
	fi

# ============================================================================
# OTHER TARGETS
# ============================================================================

bench: ## Run benchmarks
	cargo bench

doc: ## Generate documentation
	cargo doc --no-deps --open

clean: ## Clean build artifacts
	cargo clean
	rm -rf target/coverage/

check: ## Quick check
	cargo check

ci: fmt-check lint test ## Full CI pipeline
	@echo "โœ… All CI checks passed!"

examples: ## Run all examples
	@for example in examples/*.rs; do \
		name=$$(basename "$$example" .rs); \
		echo "Running $$name..."; \
		cargo run --example "$$name" --quiet 2>/dev/null || echo "  โš ๏ธ $$name failed"; \
	done

book: ## Build documentation book
	@command -v mdbook >/dev/null 2>&1 || cargo install mdbook
	cd book && mdbook build

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