.PHONY: build help install release test clean fmt lint check setup pre-commit-hooks bump-patch bump-minor bump-major index
build:
@echo "Building debug version..."
cargo build
help:
@echo "Available targets:"
@echo " make (default) - Build debug version"
@echo " make build - Build debug version"
@echo " make install - Install the binary to ~/.cargo/bin"
@echo " make release - Build optimized release version"
@echo " make test - Run all tests"
@echo " make clean - Clean build artifacts"
@echo " make fmt - Format code with rustfmt"
@echo " make lint - Run clippy linter"
@echo " make check - Run fmt, lint, and test"
@echo " make index - Build Serena symbol index (.serena/cache)"
@echo " make setup - Setup development environment"
@echo " make pre-commit-hooks - Install git pre-commit hooks"
@echo " make bump-patch - Bump patch version (0.1.0 -> 0.1.1)"
@echo " make bump-minor - Bump minor version (0.1.0 -> 0.2.0)"
@echo " make bump-major - Bump major version (0.1.0 -> 1.0.0)"
install:
@echo "Installing slack-rs..."
cargo install --path .
@echo "Installation complete. Binary installed to ~/.cargo/bin/slack-rs"
release:
@echo "Building release version..."
cargo build --release
@echo "Release binary: target/release/slack-rs"
test:
@echo "Running tests..."
cargo test --verbose
clean:
@echo "Cleaning build artifacts..."
cargo clean
fmt:
@echo "Formatting code..."
cargo fmt
lint:
@echo "Running clippy..."
cargo clippy -- -D warnings
check: fmt lint test
@echo "All checks passed!"
index:
@echo "Indexing project for Serena..."
@command -v serena >/dev/null 2>&1 || (echo "serena CLI not found. Install it first (e.g. 'uv tool install serena')." && exit 1)
serena project index . --log-level INFO
@echo "Serena index complete."
setup: pre-commit-hooks
@echo "Setting up development environment..."
@command -v rustfmt >/dev/null 2>&1 || rustup component add rustfmt
@command -v clippy >/dev/null 2>&1 || rustup component add clippy
@command -v cargo-release >/dev/null 2>&1 || cargo install cargo-release
@echo "Development environment setup complete!"
pre-commit-hooks:
@echo "Installing pre-commit hooks..."
@mkdir -p .git/hooks
@printf '%s\n' \
'#!/bin/bash' \
'set -e' \
'' \
'echo "Running pre-commit checks..."' \
'' \
'# Check formatting' \
'echo "Checking code formatting..."' \
'if ! cargo fmt -- --check; then' \
' echo "❌ Code formatting check failed. Run '\''cargo fmt'\'' to fix."' \
' exit 1' \
'fi' \
'' \
'# Run clippy' \
'echo "Running clippy..."' \
'if ! cargo clippy -- -D warnings; then' \
' echo "❌ Clippy check failed. Fix the warnings above."' \
' exit 1' \
'fi' \
'' \
'# Run tests' \
'echo "Running tests..."' \
'if ! cargo test --quiet; then' \
' echo "❌ Tests failed. Fix the failing tests."' \
' exit 1' \
'fi' \
'' \
'echo "✅ All pre-commit checks passed!"' \
> .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "Pre-commit hooks installed successfully!"
bump-patch:
@echo "Bumping patch version..."
@cargo release patch --execute --no-confirm
@echo "Patch version bumped and tagged successfully"
bump-minor:
@echo "Bumping minor version..."
@cargo release minor --execute --no-confirm
@echo "Minor version bumped and tagged successfully"
bump-major:
@echo "Bumping major version..."
@cargo release major --execute --no-confirm
@echo "Major version bumped and tagged successfully"