Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ npx gh-wrapped-2025
### Privacy & Performance
- **100% Local Processing** - No data sent to external servers
- **Optimized API Calls** - Efficient GraphQL queries with caching
- **Optional Authentication** - Works without a token for most users
- **Optional Authentication** - Works without a token for public data
- **Private Repository Support** - Include private commits with `repo` scope token

## Installation

Expand Down Expand Up @@ -122,7 +123,7 @@ node dist/index.js

## How It Works

1. Fetches your public GitHub data via GitHub API
1. Fetches your GitHub data via GitHub API (public and private with token)
2. Analyzes commits, repositories, languages, and contribution patterns
3. Calculates streaks, peak hours, and determines your developer archetype
4. Displays results in a beautiful terminal interface
Expand Down Expand Up @@ -211,9 +212,10 @@ const languages = await client.getLanguages();

## Rate Limits & Authentication

GitHub API has rate limits:
- **Without token**: 60 requests/hour (you'll likely hit this)
- **With token**: 5,000 requests/hour
GitHub API has rate limits and access levels:
- **Without token**: 60 requests/hour, public repositories only
- **With token (no scopes)**: 5,000 requests/hour, public repositories only
- **With token (read:user + repo)**: 5,000 requests/hour, includes private repositories

### How Token Authentication Works

Expand All @@ -238,12 +240,17 @@ Paste your GitHub token (or press Ctrl+C to exit): _
1. Visit: **https://github.com/settings/tokens**
2. Click **"Generate new token (classic)"**
3. Give it a name (e.g., "GitHub Wrapped")
4. **Leave all scopes unchecked** - No permissions needed for public data
4. **Select the required scopes:**
- For **public repositories only**: Leave all scopes unchecked
- For **private repositories**: Check `repo` and `read:user`
5. Click "Generate token" at the bottom
6. Copy the token
7. Paste it when the app asks

**Security Note:** A token with no scopes can only read public data - it's completely safe and cannot modify anything.
**Security Note:**
- A token with no scopes can only read public data - it's completely safe and cannot modify anything.
- The `repo` scope allows reading private repositories (required for private commits).
- The `read:user` scope allows reading user contribution data.

### Advanced: Skip the Prompt (Optional)

Expand Down
15 changes: 9 additions & 6 deletions src/github-graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class GitHubGraphQLClient {
company
location
createdAt
repositories(privacy: PUBLIC) {
repositories {
totalCount
}
followers {
Expand Down Expand Up @@ -199,7 +199,7 @@ export class GitHubGraphQLClient {
}
}

repositories_data: repositories(first: 10, orderBy: {field: STARGAZERS, direction: DESC}, privacy: PUBLIC) {
repositories_data: repositories(first: 10, orderBy: {field: STARGAZERS, direction: DESC}) {
totalCount
nodes {
name
Expand Down Expand Up @@ -243,14 +243,17 @@ GitHub's API requires authentication to access contribution data.

What you need:
1. Create a Personal Access Token at: https://github.com/settings/tokens
2. Minimum scope: read:user (for contribution data)
2. Required scopes:
- read:user (for contribution data)
- repo (to include private repository commits)
3. Run this app again and provide the token when prompted

Why this is needed:
- Without a token: Only public repository data is visible
- With a token: Full contribution calendar and statistics
- With a token (read:user): Public contributions and statistics
- With a token (read:user + repo): All contributions including private repositories

Get your token now: https://github.com/settings/tokens/new?description=GitHub%20Wrapped&scopes=read:user`);
Get your token now: https://github.com/settings/tokens/new?description=GitHub%20Wrapped&scopes=read:user,repo`);
}

// Normalize the response
Expand Down Expand Up @@ -281,7 +284,7 @@ Get your token now: https://github.com/settings/tokens/new?description=GitHub%20
throw new Error(`Invalid GitHub token. Please check your token and try again.

Get a new token at: https://github.com/settings/tokens
Required scope: read:user`);
Required scopes: read:user, repo (for private repositories)`);
}

if (errorStatus === 403 || errorMessage.includes('rate limit')) {
Expand Down