Development Setup
Prerequisites
Section titled “Prerequisites”- Rust 1.90+ (nightly recommended)
- Git
- Make (optional but recommended)
Getting Started
Section titled “Getting Started”-
Clone the repository
Terminal window git clone https://github.com/WalshyDev/orb.gitcd orb -
Build the project
Terminal window make build# orcargo build -
Run the tests
Terminal window make test# orcargo test -
Run orb locally
Terminal window ./target/debug/orb --help
Project Structure
Section titled “Project Structure”orb/├── packages/│ ├── orb-cli/ # CLI application│ │ ├── src/│ │ └── tests/│ ├── orb-client/ # HTTP client library│ │ └── src/│ └── orb-mockhttp/ # Mock HTTP server│ ├── src/│ └── tests/├── Cargo.toml # Workspace config├── Makefile # Build automation└── README.mdBuild Commands
Section titled “Build Commands”# Debug buildmake build
# Release buildmake release
# Run testsmake test
# Generate coverage reportmake coverage
# Lint checkmake lint
# Auto-fix lint issuesmake fix
# Clean build artifactsmake clean
# Show binary sizemake sizeRunning Tests
Section titled “Running Tests”# All testscargo test
# Specific packagecargo test -p orb-clicargo test -p orb-clientcargo test -p orb-mockhttp
# Specific testcargo test test_name
# With outputcargo test -- --nocaptureCode Coverage
Section titled “Code Coverage”make coverageOpens an HTML coverage report in your browser.
Development Workflow
Section titled “Development Workflow”Making Changes
Section titled “Making Changes”-
Create a feature branch
Terminal window git checkout -b feature/my-feature -
Make your changes
-
Run tests
Terminal window make test -
Run lints
Terminal window make lint -
Commit your changes
Terminal window git commit -m "Add my feature"
Adding a New CLI Option
Section titled “Adding a New CLI Option”- Add the option to
packages/orb-cli/src/cli.rs - Add validation (if needed) in
cli.rs - Call validation from
main.rs - Implement the feature in appropriate module
- Add tests to
packages/orb-cli/tests/options.rs
Adding Tests
Section titled “Adding Tests”Use test_case for parameterized tests:
use test_case::test_case;
#[test_case("input1", "expected1"; "test name 1")]#[test_case("input2", "expected2"; "test name 2")]fn test_feature(input: &str, expected: &str) { // Test implementation}For HTTP tests, use orb-mockhttp:
use orb_mockhttp::TestServerBuilder;
#[tokio::test]async fn test_http_feature() { let server = TestServerBuilder::new().build();
server.on_request("/test") .respond_with(200, "OK");
// Test against server.url("/test")}Code Style
Section titled “Code Style”- Use
rustfmtfor formatting (make fix) - Follow existing patterns in the codebase
- Write helpful error messages
- Use the
fatal!macro only in CLI layer - Document public APIs with doc comments
Testing Guidelines
Section titled “Testing Guidelines”- Use
test_casefor variations of the same test - Use
orb-mockhttpfor HTTP integration tests - Test error cases as well as success cases
- Test edge cases (empty inputs, special characters, etc.)
Debugging
Section titled “Debugging”Verbose Output
Section titled “Verbose Output”# See request/response details./target/debug/orb -v https://example.comTest Output
Section titled “Test Output”# Show stdout during testscargo test -- --nocaptureDebug Build
Section titled “Debug Build”# Full debug symbolsRUST_BACKTRACE=1 ./target/debug/orb https://example.comCross-Platform Building
Section titled “Cross-Platform Building”# macOS Universal Binarymake build-macos
# Linuxmake build-linux
# Windowsmake build-windows
# All platformsmake build-binaries