This document outlines the development workflow and best practices for contributing to the Aliasman project.
# Format code
cargo fmt
# Build the project
cargo build
# Run all tests
cargo test
# Run linter
cargo clippy
# Full check (run all of the above)
cargo fmt && cargo build && cargo test && cargo clippyAliasman is organized as a Cargo workspace with two main crates:
aliasman/
├── Cargo.toml # Workspace root
├── crates/
│ ├── aliasman-core/ # Core library
│ │ └── src/
│ │ ├── lib.rs # Public API
│ │ ├── model.rs # Data models
│ │ ├── error.rs # Error types
│ │ ├── config.rs # Configuration
│ │ ├── storage/ # Storage providers
│ │ │ ├── mod.rs
│ │ │ ├── sqlite.rs
│ │ │ └── s3.rs
│ │ └── email/ # Email providers
│ │ ├── mod.rs
│ │ └── rackspace.rs
│ └── aliasman-cli/ # CLI binary
│ └── src/
│ ├── main.rs
│ ├── commands/
│ │ ├── alias.rs
│ │ ├── config.rs
│ │ └── storage.rs
│ └── output.rs
Always run cargo fmt before committing to ensure consistent code style:
# Format all code in the workspace
cargo fmt
# Check formatting without making changes
cargo fmt -- --checkBuild the entire workspace:
# Debug build (faster compilation, slower runtime)
cargo build
# Release build (slower compilation, optimized runtime)
cargo build --release
# Build specific crate
cargo build -p aliasman-core
cargo build -p aliasman-cliRun the test suite:
# Run all tests
cargo test
# Run tests for specific crate
cargo test -p aliasman-core
cargo test -p aliasman-cli
# Run tests with output visible
cargo test -- --nocapture
# Run specific test
cargo test test_s3_alias_roundtrip
# Run ignored tests (e.g., integration tests requiring external services)
cargo test -- --ignoredRun Clippy to catch common mistakes and improve code quality:
# Run clippy on all crates
cargo clippy
# Run clippy with all features enabled
cargo clippy --all-features
# Treat warnings as errors (useful in CI)
cargo clippy -- -D warnings
# Fix automatically applicable suggestions
cargo clippy --fix# Run the CLI from the workspace
cargo run -- --help
# Run with specific command
cargo run -- alias list
cargo run -- alias create -d example.com -D "test" -r
# Run with custom config directory
cargo run -- --config-dir /path/to/config alias list# Create default config (uses SQLite)
cargo run -- config
# The database will be at:
# - macOS: ~/Library/Application Support/aliasman/aliasman.db
# - Linux: ~/.config/aliasman/aliasman.db# Start MinIO locally
docker run -p 9000:9000 -p 9001:9001 \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
minio/minio server /data --console-address ":9001"
# Configure aliasman to use local MinIO
# See config examples in README.md# Convert between storage systems
cargo run -- storage convert --source home --destination s3-production
# Convert from legacy Go S3 format
cargo run -- storage convert --source legacy --destination new --legacy-sourceAlways run the full verification suite:
#!/bin/bash
# verify.sh - Run this before submitting PRs
set -e
echo "=== Formatting code ==="
cargo fmt
echo "=== Building project ==="
cargo build --all-features
echo "=== Running tests ==="
cargo test --all-features
echo "=== Running clippy ==="
cargo clippy --all-features -- -D warnings
echo "=== All checks passed! ==="- Error Handling: Use
thiserrorfor library errors,anyhowfor CLI - Async: All I/O operations should be async using tokio
- Documentation: Document public APIs with rustdoc comments
- Testing: Write tests for new functionality
- Clippy: Address all clippy warnings before submitting
When adding a new storage provider:
- Implement the
StorageProvidertrait incrates/aliasman-core/src/storage/ - Add variant to
StorageConfiginconfig.rs - Update factory function in
lib.rs - Add tests following existing patterns
- Update README.md with configuration examples
When adding a new email provider:
- Implement the
EmailProvidertrait incrates/aliasman-core/src/email/ - Add variant to
EmailConfiginconfig.rs - Update factory function in
lib.rs - Add tests with mock implementations
The CI pipeline typically runs:
cargo fmt -- --check
cargo build --all-features
cargo test --all-features
cargo clippy --all-features -- -D warningsEnsure all commands pass locally before pushing.
# Clean build artifacts
cargo clean
# Update dependencies
cargo update
# Check for outdated dependencies
cargo outdated # requires cargo-outdated# Run tests single-threaded (for debugging)
cargo test -- --test-threads=1
# Run with backtrace on failure
RUST_BACKTRACE=1 cargo test# SQLite database is locked - check for zombie processes
lsof ~/.config/aliasman/*.db
# Reset database (WARNING: deletes all data)
rm ~/.config/aliasman/*.db# Check code without building
cargo check
# Generate documentation
cargo doc --open
# Show dependency tree
cargo tree
# Run benchmarks (if any)
cargo bench
# Check for security vulnerabilities
cargo audit # requires cargo-auditFor VS Code, recommended extensions:
- rust-analyzer
- Even Better TOML
- CodeLLDB (for debugging)