Thank you for your interest in contributing to tool-orchestrator! This document provides guidelines and information for contributors.
Please be respectful and constructive in all interactions. We're building tools to help AI agents work more effectively, and we value collaboration.
- Rust (latest stable, 2024 edition)
- wasm-pack (for WASM builds)
- Node.js (for WASM testing)
# Clone the repository
git clone https://github.com/Brainwires/tool-orchestrator.git
cd tool-orchestrator
# Build native library
cargo build
# Run tests
cargo test
# Build WASM package
wasm-pack build --target web --features wasm --no-default-featurestool-orchestrator/
├── src/
│ ├── lib.rs # Public API and re-exports
│ ├── engine.rs # Core ToolOrchestrator implementation
│ ├── sandbox.rs # Sandbox configuration
│ ├── types.rs # Type definitions
│ └── wasm/
│ └── mod.rs # WASM bindings
├── examples/ # Runnable examples
├── benches/ # Benchmarks
└── tests/ # Integration tests
- Fork the repository and create a feature branch
- Write tests for any new functionality
- Run the full test suite before submitting:
# Native tests cargo test # WASM tests (requires wasm-pack) wasm-pack test --node --features wasm --no-default-features
- Update documentation if you've changed the public API
- Submit a pull request with a clear description
- Follow standard Rust conventions (rustfmt)
- Run
cargo fmtbefore committing - Run
cargo clippyand address any warnings - Use meaningful variable names
- Add comments for complex logic
# Format code
cargo fmt
# Run clippy
cargo clippy --all-featuresUse clear, descriptive commit messages:
feat: Add support for async tool execution
fix: Handle timeout edge case in WASM builds
docs: Update README with new examples
test: Add integration tests for multi-tool scripts
Prefixes:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changestest:- Test additions/changesrefactor:- Code refactoringperf:- Performance improvementschore:- Build/tooling changes
# Run all native tests
cargo test
# Run specific test
cargo test test_basic_execution
# Run with output
cargo test -- --nocapture
# Run WASM tests
wasm-pack test --node --features wasm --no-default-features- Place unit tests in the same file as the code they test
- Use
#[cfg(test)]module convention - Test both success and error cases
- Include edge cases (empty inputs, limits exceeded, etc.)
Example:
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_feature_success() {
// Test normal operation
}
#[test]
fn test_feature_error_case() {
// Test error handling
}
}When adding features, consider:
- Security: Does this maintain the sandbox guarantees?
- Both targets: Will this work in native AND WASM?
- Limits: Is this bounded by ExecutionLimits?
- Error handling: Are errors informative and recoverable?
The crate uses conditional compilation for thread safety:
- Native (
--features native): UsesArc<Mutex<T>>for thread safety - WASM (
--features wasm): UsesRc<RefCell<T>>(single-threaded)
When adding shared state, use the appropriate wrapper:
#[cfg(feature = "native")]
type SharedState<T> = Arc<Mutex<T>>;
#[cfg(feature = "wasm")]
type SharedState<T> = Rc<RefCell<T>>;- Use benchmarks to validate performance claims
- The
on_progresscallback is called frequently - keep it lightweight - Avoid allocations in hot paths
Run benchmarks:
cargo bench- Ensure all tests pass on both native and WASM targets
- Update CHANGELOG.md with your changes under
[Unreleased] - Update documentation for any API changes
- Request review from maintainers
- Address feedback promptly
- Tests added/updated
- Documentation updated
- CHANGELOG.md updated
-
cargo fmtrun -
cargo clippypasses - Native tests pass (
cargo test) - WASM tests pass (
wasm-pack test)
When reporting bugs, please include:
- Environment: Rust version, OS, native or WASM
- Minimal reproduction: Smallest code that shows the issue
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Error messages: Full error output if applicable
For feature requests:
- Check existing issues to avoid duplicates
- Describe the use case: Why is this needed?
- Propose a solution: How might this work?
- Consider alternatives: Other ways to solve this?
- Open a GitHub issue for questions
- Tag with
questionlabel - Check existing issues first
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to tool-orchestrator! 🚀