feat: count org repos and fix contribution-window truncation

Split each contribution year into quarterly windows.
commitContributionsByRepository caps at 100 repos per query and drops
the remainder without signalling it, which a prolific year hits: 2026
returned exactly 100 where the quarterly union returns 108. Warn when a
window still comes back at the ceiling instead of reporting a complete
list.

Add -include-org-repos / include_org_repos so org-owned repos the user
administers count toward stars, repo count, repos-per-language and
top-starred. Off by default, since enabling it moves those totals for
every existing caller. Commit-driven cards already covered org repos
through the seed list. Org repos carrying only read or write access are
dropped via viewerPermission.

Rename Profile.PublicRepos to RepoCount and drop "public" from the card
label: the count tracks the fetch filters and includes private repos
whenever the token can see them.
This commit is contained in:
2026-08-13 13:20:41 +07:00
parent 4d7de90656
commit 30ba70d8ea
12 changed files with 294 additions and 79 deletions
+15 -9
View File
@@ -14,9 +14,12 @@ type Profile struct {
Website string
CreatedAt time.Time
Followers int
Following int
PublicRepos int
Followers int
Following int
// RepoCount is how many repos survived the fetch filters, so it tracks
// -include-forks / -include-private / -include-org-repos rather than
// GitHub's public-only publicRepos count.
RepoCount int
// Totals for the stats card.
TotalStars int
@@ -132,12 +135,15 @@ type LangEdge struct {
// repoNode is the GraphQL shape of one repository node; kept here because
// it's shared by the profile fetcher and the productive-time fetcher.
type repoNode struct {
Name string `json:"name"`
IsPrivate bool `json:"isPrivate"`
IsFork bool `json:"isFork"`
StargazerCount int `json:"stargazerCount"`
ForkCount int `json:"forkCount"`
Owner *struct {
Name string `json:"name"`
IsPrivate bool `json:"isPrivate"`
IsFork bool `json:"isFork"`
StargazerCount int `json:"stargazerCount"`
ForkCount int `json:"forkCount"`
// ViewerPermission is only requested by profileQuery, where it separates
// org repos the user administers from ones they merely have access to.
ViewerPermission string `json:"viewerPermission"`
Owner *struct {
Login string `json:"login"`
} `json:"owner"`
PrimaryLanguage *struct {