|
| 1 | +# Contributing to LLMAgent |
| 2 | + |
| 3 | +Thank you for your interest in contributing to LLMAgent! This document provides guidelines and instructions for contributing to this project. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +Please read and follow our [Code of Conduct](CODE_OF_CONDUCT.md). We expect all contributors to adhere to these guidelines to ensure a welcoming and productive environment. |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +1. **Fork the repository** on GitHub. |
| 12 | +2. **Clone your fork** locally: |
| 13 | + ```bash |
| 14 | + git clone https://github.com/YOUR-USERNAME/llm_agent.git |
| 15 | + cd llm_agent |
| 16 | + ``` |
| 17 | +3. **Install dependencies**: |
| 18 | + ```bash |
| 19 | + mix deps.get |
| 20 | + ``` |
| 21 | +4. **Create a branch** for your changes: |
| 22 | + ```bash |
| 23 | + git checkout -b feature/your-feature-name |
| 24 | + ``` |
| 25 | + |
| 26 | +## Development Workflow |
| 27 | + |
| 28 | +### Code Style & Standards |
| 29 | + |
| 30 | +LLMAgent follows the standard Elixir style guidelines: |
| 31 | + |
| 32 | +1. Use `mix format` to format your code before submitting |
| 33 | +2. Follow the naming conventions: |
| 34 | + - **Modules**: CamelCase, descriptive of purpose |
| 35 | + - **Functions**: snake_case, verb-based, descriptive |
| 36 | + - **Variables**: snake_case, clear purpose |
| 37 | + - **Signals**: Atom types, descriptive of state |
| 38 | + - **Constants**: ALL_CAPS for true constants, CamelCase for configuration |
| 39 | + |
| 40 | +3. Write clear and expressive code, preferring readability over cleverness |
| 41 | + |
| 42 | +### Documentation |
| 43 | + |
| 44 | +All code contributions should be properly documented: |
| 45 | + |
| 46 | +1. **Module Documentation**: |
| 47 | + - Every module must have a `@moduledoc` |
| 48 | + - Explain the module's purpose and responsibilities |
| 49 | + - Document how it fits in the overall architecture |
| 50 | + |
| 51 | +2. **Function Documentation**: |
| 52 | + - All public functions must have a `@doc` comment |
| 53 | + - Include `@spec` type specifications |
| 54 | + - Document parameters and return values |
| 55 | + - Provide examples for non-trivial functions |
| 56 | + |
| 57 | +### Testing |
| 58 | + |
| 59 | +1. All new features or bug fixes should include tests: |
| 60 | + ```bash |
| 61 | + mix test |
| 62 | + ``` |
| 63 | + |
| 64 | +2. Ensure your changes don't break existing functionality. |
| 65 | + |
| 66 | +3. Test coverage should be maintained or improved: |
| 67 | + ```bash |
| 68 | + mix test --cover |
| 69 | + ``` |
| 70 | + |
| 71 | +4. For LLM-related components, include appropriate mocks to avoid API calls during tests. |
| 72 | + |
| 73 | +### Linting & Static Analysis |
| 74 | + |
| 75 | +Before submitting changes, run: |
| 76 | + |
| 77 | +```bash |
| 78 | +mix lint # Alias for format and credo |
| 79 | +``` |
| 80 | + |
| 81 | +This checks code formatting and runs Credo for static analysis. |
| 82 | + |
| 83 | +## Submitting Changes |
| 84 | + |
| 85 | +1. **Commit your changes** with clear, descriptive commit messages: |
| 86 | + ```bash |
| 87 | + git commit -m "Add feature X that solves problem Y" |
| 88 | + ``` |
| 89 | + |
| 90 | +2. **Push to your fork**: |
| 91 | + ```bash |
| 92 | + git push origin feature/your-feature-name |
| 93 | + ``` |
| 94 | + |
| 95 | +3. **Create a Pull Request** against the `develop` branch of the original repository. |
| 96 | + |
| 97 | +4. **Describe your changes** in the PR description, including: |
| 98 | + - What problem your PR solves |
| 99 | + - How your implementation works |
| 100 | + - Any potential side effects or considerations |
| 101 | + - Links to related issues |
| 102 | + |
| 103 | +5. **Wait for review**. Maintainers will review your PR and might request changes. |
| 104 | + |
| 105 | +## Types of Contributions |
| 106 | + |
| 107 | +### Bug Fixes |
| 108 | + |
| 109 | +If you're fixing a bug: |
| 110 | + |
| 111 | +1. Ensure the bug is documented in an issue |
| 112 | +2. Reference the issue in your PR |
| 113 | +3. Add a test that reproduces the bug |
| 114 | +4. Explain your approach to fixing it |
| 115 | + |
| 116 | +### Features |
| 117 | + |
| 118 | +For new features: |
| 119 | + |
| 120 | +1. Open an issue discussing the feature before implementing |
| 121 | +2. Explain how the feature aligns with project goals |
| 122 | +3. Consider edge cases and performance implications |
| 123 | +4. Include comprehensive tests and documentation |
| 124 | + |
| 125 | +### Documentation |
| 126 | + |
| 127 | +Documentation improvements are always welcome: |
| 128 | + |
| 129 | +1. Correct inaccuracies in existing docs |
| 130 | +2. Expand explanations for clarity |
| 131 | +3. Add examples where useful |
| 132 | +4. Ensure formatting is consistent |
| 133 | + |
| 134 | +## Architectural Guidelines |
| 135 | + |
| 136 | +When contributing to LLMAgent, follow these architectural principles: |
| 137 | + |
| 138 | +1. **Signal-Driven Architecture**: Maintain the separation between signals, handlers, and state. |
| 139 | +2. **Immutability**: State should be immutable and transformations explicit. |
| 140 | +3. **Composability**: Components should be composable and reusable. |
| 141 | +4. **Separation of Concerns**: Clearly delineate responsibilities between modules. |
| 142 | +5. **Testability**: Design for testability, avoid hidden dependencies. |
| 143 | + |
| 144 | +## Release Process |
| 145 | + |
| 146 | +Only maintainers can release new versions. The process involves: |
| 147 | + |
| 148 | +1. Updating the CHANGELOG.md |
| 149 | +2. Bumping version in mix.exs |
| 150 | +3. Tagging the release |
| 151 | +4. Publishing to Hex.pm |
| 152 | + |
| 153 | +## Getting Help |
| 154 | + |
| 155 | +If you need help with the contribution process: |
| 156 | + |
| 157 | +1. Check existing documentation |
| 158 | +2. Open a discussion on GitHub |
| 159 | +3. Reach out to maintainers |
| 160 | + |
| 161 | +Thank you for contributing to LLMAgent! |
0 commit comments