1.2 KiB
1.2 KiB
AGENTS.md
Build Commands
- Build all crates:
cargo build
- Build specific crate:
cargo build -p <crate-name>
(e.g.,cargo build -p offline-web-storage
) - Build with optimizations:
cargo build --release
Test Commands
- Run all tests:
cargo test
- Run specific test:
cargo test <test_name>
(e.g.,cargo test test_dependencies_updated_when_nodes_added
) - Run tests in specific crate:
cargo test -p <crate-name>
- Run tests with output:
cargo test -- --nocapture
Code Style Guidelines
Formatting & Imports
- Group imports by std, external crates, and internal modules
- Sort imports alphabetically within groups
- Use block imports with curly braces for multi-imports
Types & Naming
- Use snake_case for functions, variables, and modules
- Use PascalCase for types and structs
- Prefix trait implementations with the trait name
- Use Option for nullable values, not unwrap()
Error Handling
- Use Result<T, E> with custom error types
- Implement thiserror::Error for error enums
- Propagate errors with ? operator
- Use descriptive error messages
Documentation
- Document public APIs with /// comments
- Include examples in documentation for complex functions
- Explain parameter and return types in function docs