Problem
scripts/generate-leaderboard.mjs is 658 lines mixing four concerns:
- GitHub REST plumbing:
ghFetch, pagination, delay, rate-limit headers (REST_PER_PAGE, REST_PAGE_DELAY_MS, API_BASE)
- Scoring config:
POINTS_* constants, CONTRIBUTOR_LEVELS, ACTIVITY_WEEKS, RECENCY_HALF_LIFE, EXCLUDED_LOGINS
- Date utilities:
startOfDayUTC, addDays
- Snapshot/incremental logic (
SNAPSHOT_PATH, LIVE_WINDOW_DAYS, FORCE_FULL) + main pipeline
Related: #6709 (generate-contributor-profiles.mjs, 897 lines) and scripts/generate-acmm-history.mjs (520 lines) likely duplicate the GitHub fetch plumbing — a shared scripts/lib/github-rest.mjs would serve all three.
Proposed split
scripts/
generate-leaderboard.mjs # main pipeline only (~250 lines)
lib/github-rest.mjs # ghFetch, pagination, delay, headers
lib/scoring.mjs # POINTS_*, CONTRIBUTOR_LEVELS, recency weighting
lib/dates.mjs # startOfDayUTC, addDays
Acceptance criteria
- Generated
public/data/leaderboard*.json output byte-identical for the same inputs
- Each file < 300 lines
- Existing script tests (if any) pass
— hive: agent=scanner
🐝 Hive Agent: scanner | Instance: hosted-kubestellar-console-4vkt | SHA: b1c845201f
Problem
scripts/generate-leaderboard.mjsis 658 lines mixing four concerns:ghFetch, pagination,delay, rate-limit headers (REST_PER_PAGE,REST_PAGE_DELAY_MS,API_BASE)POINTS_*constants,CONTRIBUTOR_LEVELS,ACTIVITY_WEEKS,RECENCY_HALF_LIFE,EXCLUDED_LOGINSstartOfDayUTC,addDaysSNAPSHOT_PATH,LIVE_WINDOW_DAYS,FORCE_FULL) + main pipelineRelated: #6709 (generate-contributor-profiles.mjs, 897 lines) and
scripts/generate-acmm-history.mjs(520 lines) likely duplicate the GitHub fetch plumbing — a sharedscripts/lib/github-rest.mjswould serve all three.Proposed split
Acceptance criteria
public/data/leaderboard*.jsonoutput byte-identical for the same inputs— hive: agent=scanner
🐝 Hive Agent:
scanner| Instance:hosted-kubestellar-console-4vkt| SHA:b1c845201f