Skip to content

Latest commit

 

History

History
300 lines (236 loc) · 6.78 KB

File metadata and controls

300 lines (236 loc) · 6.78 KB

Contributing to DevFlow

Thank you for your interest in contributing to DevFlow! This document provides guidelines and information for contributors.

Code of Conduct

By participating in this project, you agree to abide by our Code of Conduct. Please read it before contributing.

How to Contribute

Reporting Issues

Before creating an issue:

  1. Search existing issues to avoid duplicates
  2. Use a clear, descriptive title
  3. Provide detailed steps to reproduce
  4. Include system information (OS, Rust version, etc.)
  5. Add relevant labels

Suggesting Features

We welcome feature suggestions! Please:

  1. Check if the feature already exists or is planned
  2. Open an issue with the "enhancement" label
  3. Describe the problem you're trying to solve
  4. Explain your proposed solution
  5. Consider implementation complexity

Contributing Code

Prerequisites

  • Rust 1.70 or later
  • Git
  • Basic understanding of async Rust
  • Familiarity with CLI development

Development Setup

  1. Fork the repository
  2. Clone your fork:
    git clone https://github.com/yourusername/devflow.git
    cd devflow
  3. Create a new branch:
    git checkout -b feature/your-feature-name
  4. Install dependencies and build:
    cargo build

Code Style

  • Follow Rust conventions and idioms
  • Use cargo fmt to format code
  • Run cargo clippy and fix warnings
  • Add documentation for public APIs
  • Write tests for new functionality

Testing

# Run all tests
cargo test

# Run with coverage
cargo tarpaulin --out Html

# Test specific module
cargo test ai::tests

Commit Guidelines

Follow conventional commits format:

  • feat: new features
  • fix: bug fixes
  • docs: documentation changes
  • style: code style changes
  • refactor: code refactoring
  • test: test additions/changes
  • chore: maintenance tasks

Example:

feat(ai): add support for Claude API provider

- Implement ClaudeProvider struct
- Add async trait implementation
- Update configuration to support Claude
- Add tests for Claude integration

Closes #123

Pull Request Process

  1. Ensure all tests pass
  2. Update documentation if needed
  3. Add/update tests for your changes
  4. Ensure code follows style guidelines
  5. Create a clear PR description
  6. Link related issues
  7. Request review from maintainers

Project Structure

devflow/
├── src/
│   ├── main.rs              # Entry point
│   ├── cli/                 # CLI interface
│   │   ├── mod.rs
│   │   └── commands/        # Command implementations
│   ├── ai/                  # AI provider integrations
│   │   ├── mod.rs
│   │   ├── openai.rs
│   │   ├── claude.rs
│   │   └── ollama.rs
│   ├── templates/           # Template system
│   ├── generators/          # Code generators
│   ├── config/             # Configuration management
│   └── utils/              # Utility functions
├── templates/              # Built-in templates
├── tests/                 # Integration tests
├── docs/                  # Documentation
└── examples/              # Usage examples

Areas for Contribution

High Priority

  • 🐛 Bug fixes
  • 📚 Documentation improvements
  • 🧪 Test coverage improvements
  • 🔧 Performance optimizations

Medium Priority

  • 🎨 New project templates
  • 🌐 Additional language support
  • 🔌 New AI provider integrations
  • ⚙️ Configuration enhancements

Low Priority

  • 🎯 Feature enhancements
  • 🖥️ UI improvements
  • 📦 Package management
  • 🚀 Performance monitoring

Adding New Templates

To add a new project template:

  1. Create template directory:

    mkdir templates/my-template
  2. Create template.toml:

    [metadata]
    name = "my-template"
    description = "My awesome template"
    version = "1.0.0"
    author = "Your Name"
    tech_stack = ["React", "Node.js"]
    
    [dependencies]
    runtime = { react = "^18.0.0" }
    development = { "@types/react" = "^18.0.0" }
    system = ["nodejs", "npm"]
    
    [scripts]
    dev = "npm run dev"
    build = "npm run build"
    test = "npm test"
  3. Add template files in files/ directory

  4. Use variables like {{ project_name }} for customization

  5. Add tests in tests/templates/

  6. Update documentation

Adding AI Providers

To add a new AI provider:

  1. Create provider module:

    // src/ai/myprovider.rs
    use super::{AIProvider, AIResponse};
    
    pub struct MyProvider {
        // provider fields
    }
    
    #[async_trait::async_trait]
    impl AIProvider for MyProvider {
        async fn generate_project_config(&self, config: &ProjectConfig) -> Result<AIResponse> {
            // implementation
        }
        // ... other methods
    }
  2. Update src/ai/mod.rs:

    pub mod myprovider;
    
    pub enum AIProviderEnum {
        // ... existing providers
        MyProvider(myprovider::MyProvider),
    }
  3. Add configuration support

  4. Add tests

  5. Update documentation

Testing Guidelines

Unit Tests

  • Test individual functions and modules
  • Mock external dependencies
  • Use descriptive test names
  • Follow AAA pattern (Arrange, Act, Assert)

Integration Tests

  • Test complete workflows
  • Use temporary directories for file operations
  • Clean up resources after tests
  • Test error conditions

Example Test

#[cfg(test)]
mod tests {
    use super::*;
    use tempfile::TempDir;

    #[tokio::test]
    async fn test_project_generation() {
        // Arrange
        let temp_dir = TempDir::new().unwrap();
        let config = ProjectConfig {
            name: "test-project".to_string(),
            // ... other fields
        };

        // Act
        let result = generate_project(&config, temp_dir.path()).await;

        // Assert
        assert!(result.is_ok());
        assert!(temp_dir.path().join("package.json").exists());
    }
}

Documentation

Code Documentation

  • Document all public APIs
  • Use rustdoc conventions
  • Include examples in doc comments
  • Keep documentation up-to-date

User Documentation

  • Update README.md for new features
  • Add examples to examples/ directory
  • Update CLI help text
  • Create tutorials for complex features

Release Process

  1. Update version in Cargo.toml
  2. Update CHANGELOG.md
  3. Create release branch
  4. Test thoroughly
  5. Create GitHub release
  6. Publish to crates.io (maintainers only)

Getting Help

  • 💬 Join our Discord
  • 📧 Email: dev@devflow.dev
  • 🐛 Open an issue for bugs
  • 💡 Start a discussion for questions

Recognition

Contributors will be:

  • Listed in CONTRIBUTORS.md
  • Mentioned in release notes
  • Invited to maintainer team (for significant contributions)

Thank you for making DevFlow better! 🚀