Contributing Guide

Thank you for your interest in contributing to Azu CLI! This guide will help you get started with contributing to the project.

Getting Started

Prerequisites

Before contributing, ensure you have:

  • Crystal 1.16.0 or later

  • Git for version control

  • A GitHub account for submitting pull requests

  • Basic knowledge of Crystal programming language

Development Setup

  1. Fork the repository

    # Fork on GitHub, then clone your fork
    git clone https://github.com/your-username/azu_cli.git
    cd azu_cli
  2. Install dependencies

    shards install
  3. Set up development environment

    # Create development configuration
    cp config/application.yml.example config/development.yml
    
    # Set up database (if needed)
    azu db:create
    azu db:migrate
  4. Run tests

    crystal spec

Development Workflow

1. Create a Feature Branch

2. Make Your Changes

Follow these guidelines when making changes:

  • Write tests for new functionality

  • Update documentation for any new features

  • Follow coding standards (see below)

  • Keep commits atomic and well-described

3. Test Your Changes

4. Submit a Pull Request

  1. Push your branch

  2. Create a pull request on GitHub

    • Use the provided PR template

    • Describe your changes clearly

    • Link any related issues

  3. Wait for review and address feedback

Coding Standards

Crystal Code Style

Follow Crystal's official style guide:

File Organization

Documentation

Document all public APIs:

Testing

Write comprehensive tests:

Testing CLI Commands and Generators

When testing CLI commands, especially those that generate projects or files, follow these conventions:

Use Temporary Directories

Always create test projects in temporary directories, not in the main repository:

Manual Testing Cleanup

If you manually test CLI commands during development:

  1. Always use /tmp or a dedicated test directory:

  2. Clean up immediately after testing:

  3. Never commit test projects - The .gitignore file is configured to ignore:

    • /test_*/ - Test projects starting with "test_"

    • /tmp_*/ - Temporary test projects

    • /playground_*/ - Playground projects

    • *_test_project/ - Projects ending with "_test_project"

    • /tmp/ - Temporary directory

    • test_*.cr - Test script files (except in spec/)

    • /123*/ and /*invalid*/ - Invalid project names

Integration Testing Best Practices

Checklist Before Committing

Adding New Commands

1. Create Command File

2. Add Command to Registry

3. Write Tests

4. Update Documentation

Examples

2. Create Templates

3. Add Generator to Command

4. Write Tests

Adding New Templates

1. Create Template Directory

2. Write Template Files

3. Test Templates

Bug Reports

Before Reporting

  1. Check existing issues - Search for similar issues

  2. Reproduce the bug - Create a minimal reproduction

  3. Check documentation - Ensure it's not a configuration issue

Bug Report Template

Feature Requests

Before Requesting

  1. Check roadmap - Feature might already be planned

  2. Search issues - Similar feature might be requested

  3. Consider scope - Ensure it fits the project's goals

Feature Request Template

Pull Request Guidelines

PR Template

Review Process

  1. Automated checks must pass

  2. Code review by maintainers

  3. Documentation review if needed

  4. Final approval before merge

Release Process

Versioning

We follow Semantic Versioning:

  • Major (X.0.0): Breaking changes

  • Minor (0.X.0): New features, backward compatible

  • Patch (0.0.X): Bug fixes, backward compatible

Release Steps

  1. Update version in shard.yml

  2. Update changelog in CHANGELOG.md

  3. Create release branch from main

  4. Run full test suite

  5. Create GitHub release

  6. Tag release with version number

Community Guidelines

Code of Conduct

  • Be respectful to all contributors

  • Be inclusive and welcoming

  • Be constructive in feedback

  • Be patient with newcomers

Communication

  • GitHub Issues for bug reports and feature requests

  • GitHub Discussions for questions and ideas

  • Discord for real-time chat and support

  • Email for security issues

Getting Help

Resources

Mentorship

New contributors can:

  1. Start with good first issues - Look for good first issue label

  2. Ask for help - Don't hesitate to ask questions

  3. Join discussions - Participate in community conversations

  4. Review others' PRs - Learn by reviewing code

Recognition

Contributors

All contributors are recognized in:

  • GitHub contributors page

  • CHANGELOG.md for significant contributions

  • README.md for maintainers

  • Release notes for each release

Hall of Fame

Special recognition for:

  • Major contributors - Significant code contributions

  • Documentation heroes - Documentation improvements

  • Community leaders - Community building efforts

  • Bug hunters - Critical bug reports and fixes

Last updated