Skip to content

[scanner] Split scripts/generate-leaderboard.mjs (658 lines) — extract GitHub REST client and scoring lib #6864

Description

@kubestellar-hive

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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/scannerAgent scanner labelenhancementNew feature or requesthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.hive/hosted-kubestellar-console-4vktApproved by a Hive merger/owner for auto-merge on green CI

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions