|
| 1 | +# Contributing to gh-game |
| 2 | + |
| 3 | +Thank you for your interest in contributing to gh-game! We love your input and welcome contributions from everyone, whether it's: |
| 4 | + |
| 5 | +- Reporting a bug |
| 6 | +- Discussing the current state of the code |
| 7 | +- Submitting a fix |
| 8 | +- Proposing new features |
| 9 | +- Implementing a new game |
| 10 | +- Improving documentation |
| 11 | + |
| 12 | +## Table of Contents |
| 13 | + |
| 14 | +- [Getting Started](#getting-started) |
| 15 | + - [Fork the Repository](#fork-the-repository) |
| 16 | + - [Clone Your Fork](#clone-your-fork) |
| 17 | + - [Set Up GitHub Codespaces](#set-up-github-codespaces) |
| 18 | + - [Local Development Setup](#local-development-setup) |
| 19 | +- [Development Workflow](#development-workflow) |
| 20 | + - [Creating a Branch](#creating-a-branch) |
| 21 | + - [Make Your Changes](#make-your-changes) |
| 22 | + - [Development Commands](#development-commands) |
| 23 | + - [Adding a New Game](#adding-a-new-game) |
| 24 | +- [Pull Request Process](#pull-request-process) |
| 25 | + - [Create a Pull Request](#create-a-pull-request) |
| 26 | + - [Code Review Process](#code-review-process) |
| 27 | +- [Contribution Standards](#contribution-standards) |
| 28 | + - [Code Style](#code-style) |
| 29 | + - [Documentation](#documentation) |
| 30 | + - [Testing](#testing) |
| 31 | +- [Non-Code Contributions](#non-code-contributions) |
| 32 | +- [Community](#community) |
| 33 | +- [License](#license) |
| 34 | + |
| 35 | +## Getting Started |
| 36 | + |
| 37 | +### Fork the Repository |
| 38 | + |
| 39 | +Start by forking the repository on GitHub by clicking the "Fork" button at the top-right of the repository page. This creates a copy of the repository in your own GitHub account. |
| 40 | + |
| 41 | +### Clone Your Fork |
| 42 | + |
| 43 | +Clone your fork to your local machine or continue with GitHub Codespaces: |
| 44 | + |
| 45 | +```bash |
| 46 | +git clone https://github.com/YOUR-USERNAME/gh-game.git |
| 47 | +cd gh-game |
| 48 | +git remote add upstream https://github.com/ORIGINAL-OWNER/gh-game.git |
| 49 | +``` |
| 50 | + |
| 51 | +### Set Up GitHub Codespaces |
| 52 | + |
| 53 | +The easiest way to start contributing is by using GitHub Codespaces, which comes pre-configured with all the dependencies needed for gh-game: |
| 54 | + |
| 55 | +1. Navigate to your fork on GitHub |
| 56 | +2. Click the "Code" button |
| 57 | +3. Select "Open with Codespaces" |
| 58 | +4. Click "New codespace" |
| 59 | + |
| 60 | +This will create a development environment in the cloud with all the necessary tools installed, including the GitHub CLI (`gh`). |
| 61 | + |
| 62 | +### Local Development Setup |
| 63 | + |
| 64 | +If you prefer to develop locally, make sure you have: |
| 65 | + |
| 66 | +1. Go 1.23 or later installed |
| 67 | +2. GitHub CLI (`gh`) installed |
| 68 | +3. All project dependencies: |
| 69 | + ```bash |
| 70 | + go mod download |
| 71 | + ``` |
| 72 | +4. Any other tools: |
| 73 | + ```bash |
| 74 | + go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest |
| 75 | + ``` |
| 76 | + |
| 77 | +## Development Workflow |
| 78 | + |
| 79 | +### Creating a Branch |
| 80 | + |
| 81 | +Create a branch for your contributions: |
| 82 | + |
| 83 | +```bash |
| 84 | +git checkout -b feature/your-feature-name |
| 85 | +# or |
| 86 | +git checkout -b fix/your-bugfix-name |
| 87 | +``` |
| 88 | + |
| 89 | +### Make Your Changes |
| 90 | + |
| 91 | +Now you're ready to make your changes to the codebase. |
| 92 | + |
| 93 | +### Development Commands |
| 94 | + |
| 95 | +Here are the important commands to use during development: |
| 96 | + |
| 97 | +- **Build the project**: |
| 98 | + ```bash |
| 99 | + go build |
| 100 | + ``` |
| 101 | + |
| 102 | +- **Run the CLI extension**: |
| 103 | + ```bash |
| 104 | + ./gh-game <subcommand> |
| 105 | + # For example: |
| 106 | + ./gh-game cointoss |
| 107 | + ./gh-game tictactoe |
| 108 | + ``` |
| 109 | + |
| 110 | +- **Run tests**: |
| 111 | + ```bash |
| 112 | + go test ./... |
| 113 | + ``` |
| 114 | + |
| 115 | +- **Format code** (required before commit): |
| 116 | + ```bash |
| 117 | + go fmt ./... |
| 118 | + ``` |
| 119 | + |
| 120 | +- **Run linter** (required before commit): |
| 121 | + ```bash |
| 122 | + golangci-lint run |
| 123 | + ``` |
| 124 | + |
| 125 | +### Adding a New Game |
| 126 | + |
| 127 | +If you're adding a new game: |
| 128 | + |
| 129 | +1. Create game logic in `/internal/<gamename>/` |
| 130 | +2. Add command implementation in `/cmd/<gamename>.go` |
| 131 | +3. Follow the patterns established in existing games |
| 132 | +4. Update documentation to include the new game |
| 133 | +5. Add comprehensive tests |
| 134 | + |
| 135 | +## Pull Request Process |
| 136 | + |
| 137 | +### Create a Pull Request |
| 138 | + |
| 139 | +1. Push your branch to your fork: |
| 140 | + ```bash |
| 141 | + git push origin feature/your-feature-name |
| 142 | + ``` |
| 143 | + |
| 144 | +2. Go to the original repository and create a pull request: |
| 145 | + - Click "New Pull Request" |
| 146 | + - Select your branch from your fork |
| 147 | + - Fill out the PR template with details about your changes |
| 148 | + |
| 149 | +### Code Review Process |
| 150 | + |
| 151 | +1. Maintainers will review your PR |
| 152 | +2. Address any feedback or requested changes |
| 153 | +3. Make sure all CI checks pass |
| 154 | +4. Once approved, a maintainer will merge your PR |
| 155 | + |
| 156 | +## Contribution Standards |
| 157 | + |
| 158 | +### Code Style |
| 159 | + |
| 160 | +- Follow standard Go idioms and best practices |
| 161 | +- Use meaningful variable and function names |
| 162 | +- Keep functions small and focused |
| 163 | +- Write GoDoc comments for all exported functions, types, and packages |
| 164 | + |
| 165 | +### Documentation |
| 166 | + |
| 167 | +- Update README.md when adding new features |
| 168 | +- Document new commands and options |
| 169 | +- Include usage examples |
| 170 | +- Document complex algorithms or design decisions |
| 171 | + |
| 172 | +### Testing |
| 173 | + |
| 174 | +- Write unit tests for game logic |
| 175 | +- Include integration tests for command behavior |
| 176 | +- Mock external dependencies when testing |
| 177 | +- All tests must pass before submitting a PR |
| 178 | + |
| 179 | +## Non-Code Contributions |
| 180 | + |
| 181 | +Your contributions don't have to be code! We also welcome: |
| 182 | + |
| 183 | +- **Bug reports**: Create a detailed GitHub issue explaining the bug |
| 184 | +- **Feature requests**: Submit ideas through GitHub issues |
| 185 | +- **Documentation improvements**: Corrections or additions to docs |
| 186 | +- **UI/UX suggestions**: Ideas to improve game interactions |
| 187 | +- **User testing**: Provide feedback on game usability |
| 188 | + |
| 189 | +When submitting issues, please use the provided issue templates and include as much detail as possible. |
| 190 | + |
| 191 | +## Community |
| 192 | + |
| 193 | +Our community is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. |
| 194 | + |
| 195 | +Thank you for taking the time to contribute to gh-game! We look forward to your contributions! |
0 commit comments