Skip to main content

Code ownership & knowledge map CLI โ€” bus factor, knowledge silos, and CODEOWNERS generation from git history

Project description

git-tribe logo

๐Ÿ” git-tribe

Code Ownership & Knowledge Map CLI โ€” Analyze git history to reveal who owns what code, calculate bus factor, identify knowledge silos, and auto-generate CODEOWNERS files.

CI PyPI Python License: MIT


Why?

  • git blame shows the last editor, not the true owner
  • No CLI tool calculates bus factor โ€” critical for team risk assessment
  • CODEOWNERS files are hand-maintained and go stale quickly
  • Engineering managers need knowledge distribution visibility at a glance
  • Useful for onboarding: "who should I ask about module X?"

Features

Feature Description
Ownership Map Who owns each file/directory by commit volume & line authorship
Bus Factor Risk score: how many people must leave before knowledge is lost
Knowledge Silos Files/modules where only 1-2 people have contributed
CODEOWNERS Gen Auto-generate GitHub/GitLab CODEOWNERS from git history
Turnover Risk Highlight files where top contributor is inactive
Team View Aggregate ownership by team (configurable mapping)

Installation

pip install git-tribe

Quick Start

# Run in any git repository
cd your-repo

# Full ownership report
git-tribe scan

# Deep analysis (blame every file)
git-tribe scan --depth full

# Analyze specific directory
git-tribe scan src/auth/

# Bus factor analysis
git-tribe bus-factor

# Detect knowledge silos
git-tribe silos --threshold 2

# Generate CODEOWNERS
git-tribe codeowners --output CODEOWNERS --format github

# JSON output for CI integration
git-tribe scan --format json --output report.json

# Time-bounded analysis
git-tribe scan --since "6 months ago"

Output Example

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚    ๐Ÿ” git-tribe ยท Code Ownership Report          โ”‚
โ”‚    my-project  ยท  Bus Factor: 3                  โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

๐Ÿ“ Directory Ownership
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Path            โ”‚ Primary Ownerโ”‚ Share  โ”‚ Bus Factor โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ src/auth/       โ”‚ alice        โ”‚ 72%    โ”‚ 1 โš ๏ธ       โ”‚
โ”‚ src/api/        โ”‚ bob          โ”‚ 45%    โ”‚ 3 โœ…       โ”‚
โ”‚ src/core/       โ”‚ charlie      โ”‚ 38%    โ”‚ 4 โœ…       โ”‚
โ”‚ src/utils/      โ”‚ alice        โ”‚ 55%    โ”‚ 2 โš ๏ธ       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โš ๏ธ  Knowledge Silos (single-author files):
  โ€ข src/auth/oauth.py          โ†’ alice (100%)
  โ€ข src/auth/jwt_handler.py    โ†’ alice (97%)

๐Ÿ’ก Recommendations:
  1. src/auth/ has bus factor 1 โ€” schedule pair review sessions
  2. 3 files are single-author โ€” assign cross-review in next sprint

Configuration

Create a .git-tribe.toml in your repository root:

[teams]
backend = ["alice", "bob", "charlie"]
frontend = ["diana", "eve"]
devops = ["frank"]

[ignore]
paths = ["vendor/", "node_modules/", "*.generated.*"]
authors = ["dependabot[bot]", "renovate[bot]"]

[thresholds]
bus_factor_warning = 2    # Warn if bus factor โ‰ค this
silo_max_authors = 2      # Flag files with โ‰ค this many authors
stale_months = 6          # Author considered inactive after this

Output Formats

Format Flag Use Case
Terminal --format terminal (default) Interactive review
JSON --format json CI/CD pipelines, programmatic use
Markdown --format markdown Documentation, PRs
CSV --format csv Spreadsheet analysis
CODEOWNERS git-tribe codeowners GitHub/GitLab integration

How It Works

Ownership Score

Combines multiple signals with weighted formula:

  • 60% โ€” Blame-based (current lines attributed to author)
  • 40% โ€” Commit frequency (number of commits touching file)

Bus Factor

Minimum number of contributors whose departure would result in >50% of the code having no active author. Sort authors by contribution %, accumulate until >50% โ€” that count is the bus factor.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_tribe-1.1.0.tar.gz (635.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_tribe-1.1.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file git_tribe-1.1.0.tar.gz.

File metadata

  • Download URL: git_tribe-1.1.0.tar.gz
  • Upload date:
  • Size: 635.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for git_tribe-1.1.0.tar.gz
Algorithm Hash digest
SHA256 34361d5ba2114c87149a951d5cfb97713e7bd2f30d5613e41b77aaa6e185d5e1
MD5 f708875d134af0ff20e47c87b908e091
BLAKE2b-256 feb9c8be41133377f29dc9e5adc56223d3f48ce51ad031de90da310b8d6bf0c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_tribe-1.1.0.tar.gz:

Publisher: release.yml on bhayanak/git-tribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file git_tribe-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: git_tribe-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for git_tribe-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94c056693eaf3e9ca572450e8a116b99f7308ce21e66293f75588ca002536d9f
MD5 fbfa66e143995d7c52538bf5912d2c21
BLAKE2b-256 4facff87cace43b41b5275201c47a1202de5e50df7395a342dab96362ff8734a

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_tribe-1.1.0-py3-none-any.whl:

Publisher: release.yml on bhayanak/git-tribe

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page