Gitness - Your repo's fitness witness! Track your bus factor before your code misses the bus.
- Calculate repository bus factor and knowledge distribution
- Analyze contributor statistics and activity patterns
- Track recent contributor engagement
- Support for multiple VCS providers (GitHub, Bitbucket)
- Multiple output formats (Console, JSON, Markdown)
- Configurable analysis period (e.g., 6m, 1y, 30d)
- Branch-specific analysis support
- CI/CD pipeline integration
- Docker support
# Analyze all time
gitness https://github.com/user/repo
# Analyze last 6 months
gitness --duration 6m https://github.com/user/repo
# Analyze last 1 year with JSON output
gitness --duration 1y --output json https://github.com/user/repo
# Analyze specific branch with Markdown output
gitness --branch feature-branch --output markdown https://github.com/user/repo
# Analyze specific branch for last 30 days
gitness --duration 30d --branch experimental --output console https://github.com/user/repo
# Analyze last week with console output (default)
gitness --duration 7d --output console https://github.com/user/repo
# Analyze last quarter with JSON output and specific branch
gitness --duration 3m --branch develop --output json https://github.com/user/repo
# Analyze last month with Markdown output and save to file
gitness --duration 1m --output markdown https://github.com/user/repo > report.md
The "Bus Factor" represents the minimum number of developers that would need to be hit by a bus before the project is in serious trouble. It's calculated based on contributors who collectively account for 80% of contributions.
- π΄ Critical (< 2): Project knowledge is dangerously concentrated
- π‘ Warning (2-3): Limited knowledge distribution
- π’ Good (β₯ 4): Healthy knowledge distribution
Measures how evenly the knowledge is distributed across all contributors (0-100).
- π΄ Critical (< 25): Knowledge is heavily concentrated
- π‘ Warning (25-50): Moderate knowledge concentration
- π’ Good (> 50): Well-distributed knowledge
Percentage of contributors who have made significant contributions (>1% of total commits).
- π΄ Critical (< 30%): Most contributors are occasional
- π‘ Warning (30-50%): Moderate active participation
- π’ Good (> 50%): Healthy active participation
Number of contributors active in last 3 months.
- π΄ Critical (< 2): Low recent activity
- π‘ Warning (2-4): Moderate recent activity
- π’ Good (β₯ 5): High recent activity
Detailed analysis of commit patterns and activity trends.
- π Daily Average: Average number of commits per day
- π Weekly Average: Average number of commits per week
- π Monthly Average: Average number of commits per month
- π Most Active Day: Day of the week with highest commit activity
- π Peak Activity Time: Hour of the day with most commits
βββββββ ββββββββββββββββ βββββββββββββββββββββββββββ
ββββββββ βββββββββββββββββ βββββββββββββββββββββββββββ
βββ βββββββ βββ ββββββ βββββββββ ββββββββββββββββ
βββ ββββββ βββ ββββββββββββββββ ββββββββββββββββ
ββββββββββββ βββ βββ ββββββββββββββββββββββββββββββ
βββββββ βββ βββ βββ βββββββββββββββββββββββββββββ
Your repo's fitness witness! Track your bus factor before your code misses the bus.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Repository: user/repo
ββββββββββββββββββββββββββββββββββββββββββββββββββ
πΏ Branch: default
π Analysis Period: Last 6 months
π― Core Metrics
ββββββββββββββββ
π Bus Factor: 4
π Knowledge Distribution: 75.5%
π Total Commits: 330
π₯ Active Contributors: 45.5%
π Recent Contributors: 6
β° Commit Frequency
ββββββββββββββββ
π
Daily Average: 3.77 commits
π
Weekly Average: 26.38 commits
π
Monthly Average: 113.07 commits
π
Most Active Day: Monday
π Peak Activity Time: 18:00
π₯ Top Contributors
ββββββββββββββββ
π€ John Doe: 100 commits (30.3%)
π€ Jane Smith: 90 commits (27.3%)
π€ Bob Wilson: 80 commits (24.2%)
π€ Alice Brown: 60 commits (18.2%)
π€ Charlie Brown: 30 commits (9.1%)
... and 5 more contributors
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Generated by Gitness
GITHUB_TOKEN=your_token
BITBUCKET_CLIENT_ID=your_client_id
BITBUCKET_CLIENT_SECRET=your_client_secret
COMMIT_HISTORY_DURATION=6m # Optional: 6m, 1y, 30d etc.
REPOSITORY_BRANCH=main # Optional: Specify branch to analyze
go install github.com/erdemkosk/gitness@latest
docker build -t gitness .
docker run \ ok
-e GITHUB_TOKEN="TOKEN" \
-e REPOSITORY_URL="https://github.com/user/repo" \
gitness --output json;
REPOSITORY_URL
: Target repository URLGITHUB_TOKEN
: GitHub personal access tokenBITBUCKET_CLIENT_ID
: Bitbucket OAuth client IDBITBUCKET_CLIENT_SECRET
: Bitbucket OAuth client secretOUTPUT_FORMAT
: Output format (console, json, markdown)COMMIT_HISTORY_DURATION
: Analysis period (e.g., 6m, 1y, 30d)REPOSITORY_BRANCH
: Branch to analyze (optional, defaults to repository's default branch)
https://github.com/username/repository
https://bitbucket.org/workspace/repository
Generate a personal access token from GitHub Settings > Developer Settings > Personal Access Tokens.
- Go to Bitbucket Settings > OAuth Consumers
- Create a new OAuth consumer
- Use the Client ID and Client Secret in your environment variables
name: Gitness Bus Factor Analysis
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
check-bus-factor:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Run Bus Factor Analysis
uses: docker://erdemkosk/gitness:latest
env:
GITHUB_TOKEN: ${{ secrets.GITNESS_GITHUB_TOKEN }}
REPOSITORY_URL: "https://github.com/${{ github.repository }}"
OUTPUT_FORMAT: json
id: analysis
name: Gitness Analysis
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Gitness Analysis
id: gitness
run: |
OUTPUT=$(docker run \
-e GITHUB_TOKEN="${{ secrets.GITNESS_GITHUB_TOKEN }}" \
-e REPOSITORY_URL="https://github.com/${{ github.repository }}" \
-e OUTPUT_FORMAT=markdown \
erdemkosk/gitness:latest)
echo "# π Gitness Analysis Report" >> $GITHUB_STEP_SUMMARY
echo "$OUTPUT" >> $GITHUB_STEP_SUMMARY
echo "> This report is automatically generated by [Gitness](https://github.com/erdemkosk/gitness)" >> $GITHUB_STEP_SUMMARY
- Clean architecture principles
- Strategy pattern for output formatting
- Factory pattern for VCS providers
- Dependency injection
- Environment-based configuration
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
--output
: Output format (console, json, markdown)--duration
: Analysis period (e.g., 6m, 1y, 30d)--branch
: Branch to analyze (optional, defaults to repository's default branch)