Skip to content

feat: add personal contribution language stats#255

Open
andrecollar wants to merge 1 commit into
stats-organization:masterfrom
andrecollar:feat/personal-contribution-languages
Open

feat: add personal contribution language stats#255
andrecollar wants to merge 1 commit into
stats-organization:masterfrom
andrecollar:feat/personal-contribution-languages

Conversation

@andrecollar

@andrecollar andrecollar commented May 31, 2026

Copy link
Copy Markdown

Summary

  • Adds a personal_contributions=true query parameter to the top-langs card that switches from repository-ownership-based stats to commit-history-based stats, using the GitHub Search and Commits REST APIs.
  • Introduces a new fetcher (personal-contribution-languages.js) that searches authored commits, filters generated/binary files, and aggregates language additions per commit.
  • Adds three companion parameters: orgs (narrow search to specific orgs), personal_pages (Search API pages, max 10), and personal_limit (max commits to inspect, max 200).

Motivation

The default top-langs card counts bytes across repositories the user owns. Contributors who work mainly inside organisations they do not own end up with misleading stats. This mode fixes that by looking at what languages actually appear in the user's commits.

Files changed

File Change
packages/core/src/fetchers/personal-contribution-languages.js New fetcher
packages/core/src/api/top-langs.js Wires new params + conditional fetch
packages/core/tests/fetchPersonalContributionLanguages.test.js New test file (5 tests)

Test plan

  • 5 new unit tests covering detectLanguage, shouldIgnoreFile, normalizePages, normalizeLimit, and the full fetch + aggregation flow
  • Full test suite passes (281/281 tests across all packages)
  • ESLint and TypeScript build pass

Resumo (PT/BR)

  • Adiciona o parâmetro personal_contributions=true ao card de top-langs, que troca as estatísticas baseadas em posse de repositórios por estatísticas baseadas no histórico real de commits do usuário, usando as APIs REST de busca de commits do GitHub.
  • Introduz um novo fetcher (personal-contribution-languages.js) que busca commits do usuário, filtra arquivos gerados/binários e agrega adições por linguagem.
  • Adiciona três parâmetros complementares: orgs (restringe a busca a organizações específicas), personal_pages (páginas da Search API, máx. 10) e personal_limit (commits máximos a inspecionar, máx. 200).

Motivação

O card padrão de top-langs conta bytes nos repositórios que o usuário possui. Contribuidores que trabalham principalmente em organizações que não são suas ficam com estatísticas enganosas. Este modo resolve isso olhando quais linguagens aparecem nos commits do usuário.

Plano de testes

  • 5 novos testes unitários cobrindo detectLanguage, shouldIgnoreFile, normalizePages, normalizeLimit e o fluxo completo de fetch + agregação
  • Suite completa de testes passando (281/281 testes em todos os pacotes)
  • ESLint e build TypeScript passando

Add a new `personal_contributions` query parameter to the top-langs
card. When enabled, language stats are computed from the user''s actual
commit history (via the GitHub Search + Commits REST APIs) instead of
repository ownership, making it useful for contributors who work mainly
in organisations they do not own.

New query parameters:
- `personal_contributions=true` — enable the mode
- `orgs` — comma-separated list of org logins to narrow the search
- `personal_pages` — number of Search API pages to scan (max 10)
- `personal_limit` — max commits to inspect (max 200)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented May 31, 2026

Copy link
Copy Markdown

@andrecollar is attempting to deploy a commit to the martin-mfg's projects Team on Vercel.

A member of the Team first needs to authorize it.

@martin-mfg

martin-mfg commented Jun 1, 2026

Copy link
Copy Markdown
Member

As mentioned in my previous comment, please use this file from GitHub for the language detection logic. This will ensure consistency with GitHub's language detection and is a comprehensive list of possible languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants