Skip to content

Commit 31d940c

Browse files
langtindclaude
andcommitted
Initial commit: gitgame CLI
Gamify your GitHub productivity - compete with yourself or others! Features: - Personal stats (gitgame me) - Streak tracking (gitgame streak) - Period comparison (gitgame compare --period week/month/year) - Repository leaderboard (gitgame leaderboard owner/repo) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 parents  commit 31d940c

17 files changed

Lines changed: 1194 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- uses: actions/setup-go@v5
15+
with:
16+
go-version-file: go.mod
17+
cache: true
18+
19+
- name: Build
20+
run: go build -v ./...
21+
22+
- name: Test
23+
run: go test -v ./...
24+
25+
lint:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: actions/setup-go@v5
31+
with:
32+
go-version: "1.23"
33+
cache: true
34+
35+
- uses: golangci/golangci-lint-action@v6
36+
with:
37+
version: latest
38+
args: --timeout=3m

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.23"
22+
23+
- uses: goreleaser/goreleaser-action@v6
24+
with:
25+
version: latest
26+
args: release --clean
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}

.gitignore

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Binary
2+
gitgame
3+
gitgame.exe
4+
5+
# Go
6+
vendor/
7+
*.exe
8+
*.exe~
9+
*.dll
10+
*.so
11+
*.dylib
12+
*.test
13+
*.out
14+
15+
# IDE
16+
.idea/
17+
.vscode/
18+
*.swp
19+
*.swo
20+
21+
# OS
22+
.DS_Store
23+
24+
# Claude
25+
.claude/
26+
27+
# Build
28+
dist/

.golangci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
run:
2+
timeout: 3m
3+
tests: true
4+
5+
linters:
6+
disable-all: true
7+
enable:
8+
- govet
9+
- ineffassign
10+
- staticcheck
11+
- unused
12+
13+
issues:
14+
max-issues-per-linter: 0
15+
max-same-issues: 0

.goreleaser.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
version: 2
2+
3+
project_name: gitgame
4+
5+
before:
6+
hooks:
7+
- go mod tidy
8+
9+
builds:
10+
- id: gitgame
11+
main: .
12+
binary: gitgame
13+
env:
14+
- CGO_ENABLED=0
15+
ldflags:
16+
- -s -w
17+
- -X main.version={{.Version}}
18+
- -X main.commit={{.ShortCommit}}
19+
- -X main.date={{.Date}}
20+
targets:
21+
- darwin_amd64
22+
- darwin_arm64
23+
- linux_amd64
24+
- linux_arm64
25+
- windows_amd64
26+
- windows_arm64
27+
28+
archives:
29+
- builds:
30+
- gitgame
31+
format: tar.gz
32+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
33+
format_overrides:
34+
- goos: windows
35+
format: zip
36+
37+
checksum:
38+
name_template: "checksums.txt"
39+
40+
changelog:
41+
sort: asc
42+
filters:
43+
exclude:
44+
- "^docs:"
45+
- "^test:"
46+
47+
brews:
48+
- repository:
49+
owner: langtind
50+
name: homebrew-tap
51+
token: "{{ .Env.HOMEBREW_TAP_TOKEN }}"
52+
directory: Formula
53+
homepage: "https://github.com/langtind/gitgame"
54+
description: "Gamify your GitHub productivity - compete with yourself or others"
55+
install: |
56+
bin.install "gitgame"
57+
test: |
58+
system "#{bin}/gitgame", "version"

CLAUDE.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# gitgame
2+
3+
CLI tool for gamifying GitHub productivity. Compete with yourself or others!
4+
5+
## Build Commands
6+
7+
```bash
8+
make build # Build binary to ./gitgame
9+
make test # Run tests
10+
make fmt # Format with gofumpt
11+
make lint # Run golangci-lint
12+
make tools # Install dev tools (gofumpt, golangci-lint)
13+
```
14+
15+
## Architecture
16+
17+
```
18+
gitgame/
19+
├── cmd/ # Cobra commands
20+
│ ├── root.go # Root command + gh CLI check
21+
│ ├── me.go # Personal stats
22+
│ ├── streak.go # Streak tracking
23+
│ ├── compare.go # Period comparison
24+
│ └── leaderboard.go # Repo contributor leaderboard
25+
├── internal/
26+
│ └── github/
27+
│ └── client.go # GitHub API client (wraps gh CLI)
28+
└── main.go # Entry point
29+
```
30+
31+
## Adding New Commands
32+
33+
1. Create `cmd/<name>.go`
34+
2. Define command with `&cobra.Command{}`
35+
3. Register in `cmd/root.go` init()
36+
37+
## GitHub API Access
38+
39+
Uses `gh` CLI for authentication. All API calls go through `internal/github/client.go`:
40+
- `GetMyStats()` - Personal contribution stats
41+
- `GetStatsForPeriod(from, to)` - Stats for date range
42+
- `GetRepoContributors(owner, repo, limit)` - Repo leaderboard
43+
44+
## Commit Guidelines
45+
46+
Use conventional commits. End with:
47+
```
48+
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
49+
```

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
.PHONY: build test fmt lint tools
2+
3+
build:
4+
go build -o gitgame .
5+
6+
test:
7+
go test ./...
8+
9+
tools:
10+
go install mvdan.cc/gofumpt@latest
11+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
12+
13+
fmt:
14+
gofumpt -w .
15+
16+
lint:
17+
golangci-lint run

README.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# gitgame
2+
3+
Gamify your GitHub productivity. Compete with yourself or others!
4+
5+
## Installation
6+
7+
```bash
8+
# macOS
9+
brew install langtind/tap/gitgame
10+
11+
# From source
12+
go install github.com/langtind/gitgame@latest
13+
```
14+
15+
**Requires:** [GitHub CLI](https://cli.github.com/) (`gh`) installed and authenticated.
16+
17+
## Usage
18+
19+
### Your Stats
20+
21+
```bash
22+
$ gitgame me
23+
24+
langtind's GitHub Stats
25+
─────────────────────────────
26+
Total Contributions 4182
27+
Commits 214
28+
Pull Requests 8
29+
Issues 4
30+
Repositories 8
31+
32+
Current Streak 16 days
33+
Longest Streak 39 days
34+
35+
Last 7 Days
36+
─────────────────────────────
37+
Mon Tue Wed Thu Fri Sat Sun
38+
52 55 14 24 45 43 13
39+
```
40+
41+
### Streak Tracking
42+
43+
```bash
44+
$ gitgame streak
45+
46+
Current Streak: 16 days (Nice!)
47+
Longest Streak: 39 days
48+
49+
Progress to record: [======== ] 16/39 days
50+
24 days to beat your record!
51+
```
52+
53+
### Compare Periods
54+
55+
```bash
56+
$ gitgame compare --period week
57+
58+
Week Comparison
59+
═══════════════════════════════════════════════
60+
This Week Last Week Change
61+
──────── ──────── ──────
62+
Contributions 13 284 -271
63+
Commits 12 3 +9
64+
PRs 0 0 =
65+
Issues 0 0 =
66+
67+
You're down 271 contributions (-95%). Time to catch up!
68+
```
69+
70+
Options: `--period week`, `--period month`, `--period year`
71+
72+
### Repository Leaderboard
73+
74+
```bash
75+
$ gitgame leaderboard facebook/react
76+
77+
Leaderboard: facebook/react
78+
═══════════════════════════════════════════════════════
79+
# User Commits Additions Deletions
80+
─ ──── ─────── ───────── ─────────
81+
1 acdlite [1st] 33 +96348 -76017
82+
2 gnoff [2nd] 28 +80 -80
83+
3 eps1lon [3rd] 27 +1159 -192
84+
```
85+
86+
## Commands
87+
88+
| Command | Description |
89+
|---------|-------------|
90+
| `gitgame me` | Show your GitHub stats |
91+
| `gitgame streak` | Show contribution streak |
92+
| `gitgame compare` | Compare periods (week/month/year) |
93+
| `gitgame leaderboard <repo>` | Show repo contributors |
94+
| `gitgame version` | Print version info |
95+
96+
## License
97+
98+
MIT

0 commit comments

Comments
 (0)