Analyze GitHub repositories for contributor and commit statistics.
- Clone multiple GitHub repositories efficiently
- Analyze contributor statistics and commit history
- Smart repository updates (clone/pull as needed)
- Colorful progress logging
- Save analysis results as JSON with timestamps
- Handle both HTTPS and SSH GitHub URLs
- Support for repositories with various branch configurations
npm install -g @pyramation/git-stats
# or
yarn global add @pyramation/git-stats
import { MultiRepoAnalyzer } from '@pyramation/git-stats';
const repos = [
"https://github.com/username/repo1",
"https://github.com/username/repo2"
];
async function analyze() {
const analyzer = new MultiRepoAnalyzer(repos, 'temp');
const results = await analyzer.analyzeAll();
console.log(results);
}
import { RepositoryAnalyzer } from '@pyramation/git-stats';
async function analyzeSingle() {
const analyzer = new RepositoryAnalyzer(
'https://github.com/username/repo',
'temp'
);
const result = await analyzer.cloneAndAnalyze();
console.log(result);
}
The analysis results include:
interface AnalysisResult {
summary: {
totalCommits: number;
totalContributors: number;
firstCommit: string;
lastCommit: string;
};
contributors: {
name: string;
email: string;
commits: number;
additions: number;
deletions: number;
firstCommit: string;
lastCommit: string;
}[];
recentCommits: {
hash: string;
author: string;
date: string;
message: string;
}[];
repositoryPath: string;
}
- Clone the repository:
git clone https://github.com/pyramation/git-stats.git
cd git-stats
- Install dependencies:
npm install
- Build:
npm run build
- Run tests:
npm test