Consult ./agent/ARCHITECTURE.md before implementing any changes! It includes the current architecture and implementation status.
# Build the project
cargo build
# Build with optimizations
cargo build --release
# Run all tests
cargo test
# Run a single test (example)
cargo test test_link_folder_creates_symlink
# Run tests with output
cargo test -- --nocapture
# Check code without building
cargo check
# Format code
cargo fmt
# Run clippy lints
cargo clippy
# Run clippy with all targets and features
cargo clippy --all-targets --all-features- Use
camino::Utf8PathBuffor all path operations (UTF-8 guaranteed paths) - Use
anyhow::{Context, Result}for error handling with context - Group imports: std libs first, then external crates, then local modules
- Import specific items rather than using
*where possible
- Use
cargo fmtfor formatting (rustfmt standard) - Prefer
Utf8PathBufoverPathBuffor user-facing paths - Use
vfs::VfsPathfor filesystem operations (enables testing with MemoryFS) - Define enums with
#[derive(Debug, Clone, Copy, PartialEq, Eq)]where appropriate - Use
#[derive(Debug, Clone, PartialEq)]for structs that need cloning
- Use
snake_casefor functions and variables - Use
PascalCasefor types and structs - Use
SCREAMING_SNAKE_CASEfor constants - Module names should be
snake_case - Function names should be descriptive (e.g.,
link_folder,parse_package)
- Use
anyhow::Result<T>as the return type for fallible functions - Use
.with_context()to add context to errors - Use
anyhow::bail!()for early returns with errors - Handle VFS operations with proper error context
- Write unit tests in
#[cfg(test)]modules within each file - Use
vfs::MemoryFSfor filesystem testing (no real I/O) - Test both success and error cases
- Use descriptive test names that explain what they test
- Include integration tests for complex workflows
- Keep modules focused:
configfor parsing,statefor persistence,linkerfor operations - Use VFS abstraction for all filesystem operations
- Separate parsing logic from business logic
- Use KDL format for configuration and state files
- Implement
Displaytrait for user-facing enums