Pre-GSoC TasksTask 2: Analyzer Tool

Task 2: GitHub Repository Intelligence Analyzer

Objective

Build a tool that analyzes multiple GitHub repositories and generates structured intelligence reports covering activity, complexity, and learning difficulty.

Overview

The analyzer accepts one or more GitHub repository URLs as input and produces per-repository scores, metric breakdowns, structured exports, and a portfolio-level summary. It is deployed as a live web application.

Input Handling

Accepts one or more GitHub repository URLs. Each URL is validated and sanitized through Zod before processing. Repositories are analyzed independently so a single failure does not block the rest of the batch.

GitHub API Integration

Uses Octokit with the throttling plugin to collect stars, forks, contributors, recent commits, languages, file trees, and dependency manifests. Authenticated requests via a GitHub token raise the rate limit to 5,000 requests/hour.

Activity Scoring

A weighted formula combining recent commits (40%), stars (25%), forks (15%), contributors (10%), and open issues (10%). Logarithmic normalization prevents mega-repositories from dominating the scale.

Complexity Estimation

Estimates maintenance cost using file count (30 pts), language diversity (30 pts), dependency file presence (20 pts), and dependency count (20 pts). All metrics are normalized and capped to produce a 0-100 score.

Difficulty Classification

The combined score (average of activity and complexity) maps to three levels: Beginner (under 35), Intermediate (35 to 65), and Advanced (above 65). Each level includes a plain-language description.

Edge Cases and Rate Limits

Repositories with missing data receive safe defaults instead of failing. The Octokit throttling plugin enforces rate-limit compliance automatically. Proactive limit checks abort the batch early when remaining quota is insufficient.

Scoring Formulas

Activity Score

activityScore=0.40c+0.25s+0.15f+0.10u+0.10i\mathrm{activityScore} = 0.40c + 0.25s + 0.15f + 0.10u + 0.10i
MetricWeightNormalizationCap
Recent commits (30 days)40%Linear500
Stars25%Logarithmic200,000
Forks15%Logarithmic50,000
Contributors10%Logarithmic1,000
Open issues10%Logarithmic10,000

Complexity Score

complexityScore=30F+30L+20D+20P\mathrm{complexityScore} = 30F + 30L + 20D + 20P
ComponentMax pointsMethod
File count30Log scale, cap 50,000
Language diversity30Linear, cap 15
Has dependency file20Binary
Dependency count20Linear, cap 200

Difficulty Classification

combined=activityScore+complexityScore2\mathrm{combined} = \frac{\mathrm{activityScore} + \mathrm{complexityScore}}{2}
Combined scoreLevelDescription
Below 35BeginnerGood for newcomers
35 to 65IntermediateSome experience needed
Above 65AdvancedSignificant experience required

Sample Results

RepositoryActivityComplexityDifficulty
facebook/react55.362.8Advanced
tensorflow/tensorflow48.072.0Advanced
torvalds/linux65.068.0Advanced
fastapi/fastapi42.052.0Intermediate
firstcontributions/first-contributions60.028.0Intermediate

Architecture

Page (app/) -> View (views/) -> API Route (app/api/) -> Service (services/)
LayerLocationResponsibility
Pagesrc/app/analyzer/page.jsServer component that only renders the view
Viewsrc/views/AnalyzerView/Client-side state, form handling, event handlers, rendering
API Routesrc/app/api/analyze/route.jsValidates input, sanitizes URLs, calls the service layer
Servicesrc/services/Server-only GitHub API fetches, scoring, caching, orchestration

Quick Start

npm install
cp .env.example .env.local
# set GITHUB_TOKEN=ghp_your_token_here
npm run dev