Developer guide
Contributing
Guidelines for contributing to the Ninja project.
Getting Started
Repository Structure
ninja/
├── core/ # Runtime and manager logic
├── CLI/ # shurikenctl command-line tool
├── HTTP/ # REST API server
├── GUI/ # Tauri desktop application
├── MCP/ # Model Context Protocol tools
├── FFI/ # Foreign function interface
└── tests/ # Integration testsDevelopment Setup
1. Clone the repository
git clone https://github.com/tunafysh/ninja.git
cd ninja2. Install dependencies
# Rust toolchain (required)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Node.js and pnpm (for GUI)
curl -fsSL https://get.pnpm.io/install.sh | sh
# GUI dependencies
cd GUI
pnpm install3. Build the project
# Build all crates
cargo build --workspace
# Build release
cargo build --release
# Build GUI
cd GUI
pnpm tauri buildDevelopment Workflow
1. Create a Branch
git checkout -b feature/your-feature-name2. Make Changes
Follow existing code patterns and conventions:
- Use Rust idioms and best practices
- Add tests for new features
- Update documentation as needed
- Keep commits focused and atomic
3. Test Your Changes
# Run unit tests
cargo test --workspace
# Run specific tests
cargo test -p core
# Build and test CLI
cargo build -p CLI --release
./target/release/shurikenctl --version
# Test GUI
cd GUI
pnpm tauri dev4. Lint and Format
# Format code
cargo fmt --all
# Run clippy
cargo clippy --workspace -- -D warnings5. Create Pull Request
- Write a clear PR title and description
- Reference related issues
- Explain what changed and why
- Include test results if applicable
Coding Standards
Rust Style
- Follow Rust API Guidelines
- Use
cargo fmtfor consistent formatting - Fix all
clippywarnings - Add documentation comments for public APIs
/// Starts a shuriken service by name.
///
/// # Arguments
/// * `name` - The shuriken identifier
///
/// # Returns
/// * `Ok(())` on success
/// * `Err(NinjaError)` on failure
pub async fn start(&self, name: &str) -> Result<(), NinjaError> {
// Implementation
}Commit Messages
Use conventional commits:
feat: add support for platform-specific configuration
fix: resolve race condition in process spawning
docs: update installation guide
test: add integration tests for shuriken manager
refactor: simplify configuration templatingDocumentation
- Update relevant
.mdxfiles for user-facing changes - Add inline comments for complex logic
- Include examples in API documentation
Testing Requirements
New Features
- Add unit tests for new functionality
- Include integration tests where appropriate
- Test both success and error cases
#[tokio::test]
async fn test_new_feature() {
// Test implementation
}
#[tokio::test]
async fn test_new_feature_error_case() {
// Test error handling
}Bug Fixes
- Add regression tests to prevent reoccurrence
- Verify the fix resolves the original issue
Pull Request Checklist
Before submitting:
- Code builds without warnings
- All tests pass
- New tests added for changes
- Documentation updated
- Code formatted with
cargo fmt - No
clippywarnings - Commit messages follow conventions
Getting Help
- Questions? Open a discussion
- Bug report? Create an issue
- Feature idea? Start a discussion first
Code Review Process
-
Maintainers review PR for:
- Code quality and style
- Test coverage
- Documentation
- Breaking changes
-
Address review feedback
-
Once approved, changes are merged
Areas to Contribute
Good First Issues
Look for issues labeled good-first-issue:
- Documentation improvements
- Bug fixes with reproduction steps
- Test coverage improvements
Advanced Contributions
- New shuriken management features
- Platform-specific improvements
- Performance optimizations
- API enhancements
License
By contributing, you agree that your contributions will be licensed under the project's license.
See also: Architecture, Testing