A GitHub CLI extension that allows you to play games through the GitHub CLI.
- Multiple Games: Play coin toss, higher or lower, rock paper scissors, tic tac toe, and word guess games
- Terminal-Based: Fully playable through your terminal using GitHub CLI
- Interactive UI: User-friendly terminal interfaces for all games
- Score Tracking: Keep track of your scores and streaks in supported games
The gh-game extension serves as both a fun diversion and a showcase of GitHub CLI extension capabilities.
- Additional games to be added in the future
gh extension install github-samples/gh-game
- Go 1.23 or newer
- GitHub CLI installed
- Terminal with Unicode support for optimal experience
- Clone the repository
- Run
go build
to build the extension - Run
go test ./...
to run the tests
This project includes a development container configuration for VS Code, which provides a consistent development environment with:
- Go 1.23
- GitHub CLI
- Several VS Code extensions for GitHub
Play a coin toss game where you try to guess whether the coin will land on heads or tails. Keep your streak going by guessing correctly!
gh game cointoss heads # or tails
The game will continue as long as you keep guessing correctly, allowing you to build up a streak. You can quit at any time by selecting "Quit" when prompted for your next guess.
Play a number guessing game where you predict if the next random number will be higher or lower than the current one. See how long you can maintain your streak of correct guesses!
gh game higherlower
Optional flags:
--min
or-m
: Set the minimum possible number (default: 1)--max
or-M
: Set the maximum possible number (default: 100)
Example with custom range:
gh game higherlower --min 1 --max 1000
Play Rock Paper Scissors against the computer. Best of 3, 5, 7, or 9 rounds.
gh game rockpaperscissors
Choose your move (rock, paper, or scissors) in each round, and the computer will randomly select its move. The game follows standard Rock Paper Scissors rules:
- Rock crushes Scissors
- Scissors cuts Paper
- Paper covers Rock
Play the classic game of Tic Tac Toe against another player. Players take turns placing X's and O's on a 3x3 grid, trying to get three in a row horizontally, vertically, or diagonally.
gh game tictactoe
The game provides an interactive interface where you can select positions on the board using numbers 1-9, corresponding to the grid positions from left to right, top to bottom.
Play a word guessing game where you guess a GitHub-related term one letter at a time. Try to reveal the word before running out of guesses!
gh game wordguess
The game selects a random GitHub-related term, and you need to guess it by suggesting one letter at a time. Each correct letter is revealed in its position. Each incorrect guess reduces your remaining guesses. You win by guessing the complete word before making 6 incorrect guesses.
Contributions are welcome! Please feel free to submit a Pull Request. Check out our contributing guidelines for more details on how to get involved.
This project is maintained by the GitHub Developer Relations team. See CODEOWNERS file for specific maintainers.
This project is available as open source under the terms of the MIT License.