|
| 1 | +# Contributing to Syncable CLI |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Syncable Infrastructure-as-Code CLI! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## 🤝 Code of Conduct |
| 6 | + |
| 7 | +We are committed to providing a welcoming and inclusive environment. Please be respectful and constructive in all interactions. |
| 8 | + |
| 9 | +## 🚀 Getting Started |
| 10 | + |
| 11 | +### Prerequisites |
| 12 | + |
| 13 | +- Rust 1.70.0 or later |
| 14 | +- Git |
| 15 | +- A code editor (we recommend VS Code with rust-analyzer) |
| 16 | + |
| 17 | +### Setting Up Development Environment |
| 18 | + |
| 19 | +1. Fork the repository on GitHub |
| 20 | +2. Clone your fork: |
| 21 | + ```bash |
| 22 | + git clone https://github.com/YOUR-USERNAME/syncable-cli.git |
| 23 | + cd syncable-cli |
| 24 | + ``` |
| 25 | +3. Add the upstream repository: |
| 26 | + ```bash |
| 27 | + git remote add upstream https://github.com/syncable/syncable-cli.git |
| 28 | + ``` |
| 29 | +4. Install development tools: |
| 30 | + ```bash |
| 31 | + rustup component add rustfmt clippy |
| 32 | + ``` |
| 33 | + |
| 34 | +## 📝 Development Workflow |
| 35 | + |
| 36 | +### 1. Create a Feature Branch |
| 37 | + |
| 38 | +```bash |
| 39 | +git checkout -b feature/your-feature-name |
| 40 | +``` |
| 41 | + |
| 42 | +### 2. Make Your Changes |
| 43 | + |
| 44 | +- Follow the existing code style and patterns |
| 45 | +- Add tests for new functionality |
| 46 | +- Update documentation as needed |
| 47 | + |
| 48 | +### 3. Run Tests |
| 49 | + |
| 50 | +```bash |
| 51 | +# Run all tests |
| 52 | +cargo test |
| 53 | + |
| 54 | +# Run specific test |
| 55 | +cargo test test_name |
| 56 | + |
| 57 | +# Run tests with output |
| 58 | +cargo test -- --nocapture |
| 59 | +``` |
| 60 | + |
| 61 | +### 4. Check Code Quality |
| 62 | + |
| 63 | +```bash |
| 64 | +# Format code |
| 65 | +cargo fmt |
| 66 | + |
| 67 | +# Run linter |
| 68 | +cargo clippy -- -D warnings |
| 69 | + |
| 70 | +# Check for security issues |
| 71 | +cargo audit |
| 72 | +``` |
| 73 | + |
| 74 | +### 5. Commit Your Changes |
| 75 | + |
| 76 | +We follow conventional commit messages: |
| 77 | + |
| 78 | +- `feat:` New feature |
| 79 | +- `fix:` Bug fix |
| 80 | +- `docs:` Documentation changes |
| 81 | +- `test:` Test additions or modifications |
| 82 | +- `refactor:` Code refactoring |
| 83 | +- `perf:` Performance improvements |
| 84 | +- `chore:` Maintenance tasks |
| 85 | + |
| 86 | +Example: |
| 87 | +```bash |
| 88 | +git commit -m "feat: add support for Ruby language detection" |
| 89 | +``` |
| 90 | + |
| 91 | +## 🔍 Areas for Contribution |
| 92 | + |
| 93 | +### High Priority |
| 94 | + |
| 95 | +1. **Language Support**: Add detection for new languages (Ruby, PHP, C#) |
| 96 | +2. **Framework Detection**: Expand framework detection patterns |
| 97 | +3. **Security Scanning**: Integrate additional vulnerability databases |
| 98 | +4. **Documentation**: Improve user guides and API documentation |
| 99 | +5. **Test Coverage**: Add more unit and integration tests |
| 100 | + |
| 101 | +### Feature Ideas |
| 102 | + |
| 103 | +- Cloud provider integrations (AWS, GCP, Azure) |
| 104 | +- Kubernetes manifest generation |
| 105 | +- Interactive configuration wizard |
| 106 | +- Performance optimizations |
| 107 | +- New IaC output formats |
| 108 | + |
| 109 | +## 📋 Pull Request Process |
| 110 | + |
| 111 | +1. **Update Your Branch**: |
| 112 | + ```bash |
| 113 | + git fetch upstream |
| 114 | + git rebase upstream/main |
| 115 | + ``` |
| 116 | + |
| 117 | +2. **Push to Your Fork**: |
| 118 | + ```bash |
| 119 | + git push origin feature/your-feature-name |
| 120 | + ``` |
| 121 | + |
| 122 | +3. **Create Pull Request**: |
| 123 | + - Go to the original repository on GitHub |
| 124 | + - Click "New Pull Request" |
| 125 | + - Select your branch |
| 126 | + - Fill out the PR template |
| 127 | + |
| 128 | +4. **PR Requirements**: |
| 129 | + - Clear description of changes |
| 130 | + - Tests pass (`cargo test`) |
| 131 | + - Code is formatted (`cargo fmt`) |
| 132 | + - No clippy warnings (`cargo clippy`) |
| 133 | + - Documentation updated if needed |
| 134 | + |
| 135 | +## 🧪 Testing Guidelines |
| 136 | + |
| 137 | +### Unit Tests |
| 138 | + |
| 139 | +Place unit tests in the same file as the code: |
| 140 | + |
| 141 | +```rust |
| 142 | +#[cfg(test)] |
| 143 | +mod tests { |
| 144 | + use super::*; |
| 145 | + |
| 146 | + #[test] |
| 147 | + fn test_function_name() { |
| 148 | + // Test implementation |
| 149 | + } |
| 150 | +} |
| 151 | +``` |
| 152 | + |
| 153 | +### Integration Tests |
| 154 | + |
| 155 | +Add integration tests in `tests/integration/`: |
| 156 | + |
| 157 | +```rust |
| 158 | +use assert_cmd::Command; |
| 159 | + |
| 160 | +#[test] |
| 161 | +fn test_cli_analyze() { |
| 162 | + let mut cmd = Command::cargo_bin("iac-gen").unwrap(); |
| 163 | + cmd.arg("analyze") |
| 164 | + .arg("tests/fixtures/sample_project") |
| 165 | + .assert() |
| 166 | + .success(); |
| 167 | +} |
| 168 | +``` |
| 169 | + |
| 170 | +### Test Fixtures |
| 171 | + |
| 172 | +Add test projects in `tests/fixtures/` with appropriate structure for testing. |
| 173 | + |
| 174 | +## 📁 Project Structure |
| 175 | + |
| 176 | +Key directories: |
| 177 | + |
| 178 | +- `src/analyzer/`: Language and framework detection |
| 179 | +- `src/generator/`: IaC file generation (Phase 2) |
| 180 | +- `src/common/`: Shared utilities |
| 181 | +- `templates/`: IaC templates |
| 182 | +- `tests/`: Test suite |
| 183 | +- `docs/`: Documentation |
| 184 | + |
| 185 | +## 🐛 Reporting Issues |
| 186 | + |
| 187 | +### Bug Reports |
| 188 | + |
| 189 | +Include: |
| 190 | +- Rust version (`rustc --version`) |
| 191 | +- OS and version |
| 192 | +- Steps to reproduce |
| 193 | +- Expected vs actual behavior |
| 194 | +- Error messages |
| 195 | + |
| 196 | +### Feature Requests |
| 197 | + |
| 198 | +Include: |
| 199 | +- Use case description |
| 200 | +- Expected behavior |
| 201 | +- Example scenarios |
| 202 | +- Alternative solutions considered |
| 203 | + |
| 204 | +## 💡 Tips for Contributors |
| 205 | + |
| 206 | +### Understanding the Codebase |
| 207 | + |
| 208 | +1. Start with `src/main.rs` to understand the CLI structure |
| 209 | +2. Review `src/analyzer/mod.rs` for the analysis pipeline |
| 210 | +3. Check existing tests for usage examples |
| 211 | + |
| 212 | +### Common Patterns |
| 213 | + |
| 214 | +- Use `Result<T, E>` for error handling |
| 215 | +- Implement traits for extensibility |
| 216 | +- Use `log` crate for debugging |
| 217 | +- Follow the builder pattern for complex structs |
| 218 | + |
| 219 | +### Performance Considerations |
| 220 | + |
| 221 | +- Use `rayon` for parallel processing |
| 222 | +- Cache expensive computations |
| 223 | +- Avoid unnecessary allocations |
| 224 | +- Profile before optimizing |
| 225 | + |
| 226 | +## 📞 Getting Help |
| 227 | + |
| 228 | +- **Discord**: Join our community server |
| 229 | +- **GitHub Discussions**: Ask questions |
| 230 | +- **Issues**: Report bugs or request features |
| 231 | + |
| 232 | +## 🎉 Recognition |
| 233 | + |
| 234 | +Contributors will be: |
| 235 | +- Listed in CONTRIBUTORS.md |
| 236 | +- Mentioned in release notes |
| 237 | +- Given credit in relevant documentation |
| 238 | + |
| 239 | +## 📄 License |
| 240 | + |
| 241 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
| 242 | + |
| 243 | +--- |
| 244 | + |
| 245 | +Thank you for contributing to Syncable CLI! 🚀 |
0 commit comments