.PHONY: all build test test-nextest lint fmt check validate clean doc help
NEXTEST_AVAILABLE := $(shell cargo nextest --version >/dev/null 2>&1 && echo 1)
ifeq ($(NEXTEST_AVAILABLE),1)
TEST_CMD := cargo nextest run --all-features
else
TEST_CMD := cargo test --all-features
endif
all: validate build
build:
cargo build --all-features
release:
cargo build --release --all-features
test:
$(TEST_CMD)
test-nextest:
cargo nextest run --all-features
test-integration:
cargo test --all-features -- --ignored
coverage:
cargo llvm-cov --all-features --lcov --output-path lcov.info
cargo llvm-cov report
fmt:
cargo fmt --all
fmt-check:
cargo fmt --all --check
lint:
cargo clippy --all-targets --all-features -- -D warnings
check:
cargo check --all-features
doc:
cargo doc --no-deps --document-private-items
validate: fmt-check lint test doc
@echo "All validation checks passed!"
clean:
cargo clean
rm -f lcov.info
run:
cargo run --
install:
cargo install --path .
changelog-add:
python scripts/changelog_add.py --interactive
phase-start:
@if [ -z "$(N)" ] || [ -z "$(NAME)" ]; then \
echo "Usage: make phase-start N=<number> NAME=<short-name>"; \
exit 1; \
fi
git checkout main
git pull origin main
git checkout -b phase/$(N)-$(NAME)
@echo "Branch phase/$(N)-$(NAME) created. Ready to begin Phase $(N)."
phase-validate: validate
@echo ""
@echo "=== Phase Validation Complete ==="
@echo "Run 'make phase-pr' to create the pull request."
phase-pr:
@BRANCH=$$(git rev-parse --abbrev-ref HEAD); \
case "$$BRANCH" in phase/*) ;; *) \
echo "Error: Not on a phase branch (current: $$BRANCH)"; \
exit 1; \
esac; \
PHASE_NUM=$$(echo $$BRANCH | sed 's/phase\/\([0-9]*\)-.*/\1/'); \
PHASE_NAME=$$(echo $$BRANCH | sed 's/phase\/[0-9]*-//'); \
echo "Creating PR for Phase $$PHASE_NUM: $$PHASE_NAME"; \
echo "Remember: Phase report (ops/reports/phase-$$PHASE_NUM-report.md) must be committed before merge!"; \
gh pr create --title "Phase $$PHASE_NUM: $$PHASE_NAME" --base main --body "Phase report: ops/reports/phase-$$PHASE_NUM-report.md"
help:
@echo "Hivemind Makefile"
@echo ""
@echo "Build targets:"
@echo " build Build debug binary"
@echo " release Build release binary"
@echo " install Install to ~/.cargo/bin"
@echo ""
@echo "Test targets:"
@echo " test Run unit tests"
@echo " test-integration Run integration tests"
@echo " coverage Run tests with coverage"
@echo ""
@echo "Quality targets:"
@echo " fmt Format code"
@echo " fmt-check Check formatting"
@echo " lint Run clippy (strict)"
@echo " validate Full validation suite"
@echo ""
@echo "Documentation:"
@echo " doc Generate documentation"
@echo ""
@echo "Phase workflow:"
@echo " phase-start Start new phase (N=1 NAME=event-foundation)"
@echo " phase-validate Run pre-PR validation"
@echo " phase-pr Create PR for current phase"
@echo ""
@echo "Changelog:"
@echo " changelog-add Add entry interactively"
@echo ""
@echo "Other:"
@echo " clean Clean build artifacts"
@echo " help Show this help"