@@ -728,6 +728,33 @@ export function buildCommitClock(allDays: ContributionDay[]) {
728728 return dayNames . map ( ( name , i ) => ( { day : name , commits : dayTotals [ i ] } ) ) ;
729729}
730730
731+ export interface DeveloperScoreInput {
732+ repos : number ;
733+ followers : number ;
734+ stars : number ;
735+ contributions : number ;
736+ longestStreak : number ;
737+ }
738+
739+ export function computeDeveloperScore ( {
740+ repos,
741+ followers,
742+ stars,
743+ contributions,
744+ longestStreak,
745+ } : DeveloperScoreInput ) : number {
746+ return Math . min (
747+ Math . round (
748+ Math . min ( repos * 0.5 , 25 ) +
749+ Math . min ( followers * 0.5 , 25 ) +
750+ Math . min ( stars * 0.2 , 20 ) +
751+ Math . min ( contributions / 20 , 20 ) +
752+ Math . min ( longestStreak * 0.2 , 10 )
753+ ) ,
754+ 100
755+ ) ;
756+ }
757+
731758export async function getFullDashboardData ( username : string , options : FetchOptions = { } ) {
732759 const [ profileResult , reposResult , calendarResult ] = await Promise . allSettled ( [
733760 fetchUserProfile ( username , options ) ,
@@ -751,16 +778,19 @@ export async function getFullDashboardData(username: string, options: FetchOptio
751778 const streakStats = calculateStreak ( calendarData ) ;
752779 const totalStars = reposData . reduce ( ( acc , repo ) => acc + repo . stargazers_count , 0 ) ;
753780
754- const developerScore = Math . min (
755- Math . round (
756- Math . min ( profileData . public_repos * 0.5 , 25 ) +
757- Math . min ( profileData . followers * 0.5 , 25 ) +
758- Math . min ( totalStars * 0.2 , 20 ) +
759- Math . min ( streakStats . totalContributions / 20 , 20 ) +
760- Math . min ( streakStats . longestStreak * 0.2 , 10 )
761- ) ,
762- 100
763- ) ;
781+ // Developer Score — 5-factor weighted formula (max 100 pts)
782+ // Repos: up to 25 pts (saturates at 50 public repos)
783+ // Followers: up to 25 pts (saturates at 50 followers)
784+ // Stars: up to 20 pts (saturates at 100 total stars)
785+ // Contributions: up to 20 pts (saturates at 400 yearly contributions)
786+ // Streak: up to 10 pts (saturates at a 50-day longest streak)
787+ const developerScore = computeDeveloperScore ( {
788+ repos : profileData . public_repos ,
789+ followers : profileData . followers ,
790+ stars : totalStars ,
791+ contributions : streakStats . totalContributions ,
792+ longestStreak : streakStats . longestStreak ,
793+ } ) ;
764794
765795 const profile = {
766796 username : profileData . login ,
0 commit comments