This document provides guidance for AI agents working on the Git Ladder codebase.
Git Ladder is a static website that displays contribution leaderboards (commits and pull requests) for GitHub organizations. It's designed to be hosted on GitHub Pages with data fetched via GitHub Actions.
| Component | Technology | Notes |
|---|---|---|
| Frontend | Vanilla HTML/CSS/JS | No build step, ES6+ syntax |
| Charts | Chart.js 4.x | Loaded via CDN |
| Data Fetching | Node.js + Octokit | Runs in GitHub Actions |
| Hosting | GitHub Pages | Static files only |
| CI/CD | GitHub Actions | Daily data updates |
git-ladder/
├── .github/workflows/
│ └── fetch-and-deploy.yml # Fetch data and deploy to Pages (daily)
├── data/
│ └── stats.json # Generated statistics (NOT committed, generated at deploy time)
├── scripts/
│ └── fetch-stats.js # Node.js script for fetching data (auto-loads .env)
├── src/
│ ├── css/
│ │ └── style.css # All styling (CSS custom properties)
│ └── js/
│ ├── DataService.js # Data loading and filtering
│ ├── ChartManager.js # Chart.js wrapper
│ └── App.js # Main controller
├── index.html # Single page application
├── package.json # Node.js dependencies
├── .env.example # Example configuration for local dev
├── AGENTS.md # This file
├── FUTURE_IDEAS.md # Planned enhancements
└── README.md # User documentation
The project uses GitHub's artifact-based Pages deployment:
- Data is fetched during the workflow run (not committed)
- The entire site + generated data is packaged as an artifact
- The artifact is deployed directly to GitHub Pages
This keeps the repository clean while ensuring fresh data on every deployment.
The application uses ES6 classes with clear separation of concerns:
-
DataService: Handles data loading and filtering
loadData(): Fetches stats.jsongetUserStats(filters): Returns filtered/sorted user datagetTrendData(options): Returns trend chart data
-
ChartManager: Wraps Chart.js functionality
createLeaderboardChart(): Bar chart for rankingscreateTrendChart(): Line chart for monthly trends
-
App: Main controller
- Initializes services
- Binds event handlers
- Coordinates rendering
- Uses CSS custom properties (
:root) for theming - BEM-like naming convention
- Glassmorphism effects with
backdrop-filter - Mobile-first responsive design
The stats.json structure:
{
"lastUpdated": "ISO8601 timestamp",
"organizations": ["org1", "org2"],
"users": {
"username": {
"avatar": "URL",
"commits": {
"2026": { "total": 100, "months": { "01": 10, ... } }
},
"pullRequests": {
"2026": { "total": 50, "months": { "01": 5, ... } }
}
}
}
}Organizations are configured via the GH_ORGS environment variable:
For GitHub Actions:
- Go to repository Settings > Secrets and variables > Actions > Variables
- Create
GH_ORGSvariable with comma-separated organizations - Create
GH_YEARSvariable with number of years (optional, default: 5)
For Local Development:
# Create .env file from example
cp .env.example .env
# Edit .env with your configuration
# Run fetch (automatically loads .env)
npm run fetch-dataThe fetch script uses dotenv to automatically load configuration from .env.
The frontend automatically reads organizations from the generated stats.json file.
- Update
scripts/fetch-stats.jsto fetch the metric - Update
DataService.jsto handle the new metric - Add toggle button in
index.html - Update
App.jsto handle the new metric filter
All chart configuration is in ChartManager.js. Colors are defined in:
chartColorsarray in ChartManager- CSS custom properties (
--chart-color-*)
All theming is controlled by CSS custom properties in style.css:
:root {
--color-bg-primary: #0d1117;
--color-accent-primary: #58a6ff;
/* ... etc */
}- Run
npm run serveto start local server - Open browser to
http://localhost:3000 - Test with sample data in
data/stats.json
GH_YEARS=2 GH_ORGS="org1,org2" GH_TOKEN=your_token npm run fetch-dataCommits should follow the Conventional Commits specification:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that do not affect the meaning of the code (white-space, formatting, etc)refactor: A code change that neither fixes a bug nor adds a featureperf: A code change that improves performancetest: Adding missing tests or correcting existing testschore: Changes to the build process or auxiliary tools
- Never commit GitHub tokens
- The default
GITHUB_TOKENin Actions only works for public repos - For private repos, use a PAT stored as
GH_PATsecret
- Data is loaded once on page load
- Charts are recreated (not updated) for simplicity
- Consider implementing lazy loading for user avatars if list grows large
- The fetch script uses Octokit's built-in pagination to fetch all commits/PRs per repo
- Modern browsers (Chrome, Firefox, Safari, Edge)
- Requires ES6+ support (no transpilation)
backdrop-filtermay not work in older browsers (graceful degradation)
GNU AGPLv3 License – See LICENSE file for details.
Created by: Benoît VIGNAL Version: 1.0.0 Last Updated: 2026-01-23