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.2.0.tar.gz (636.1 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.2.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_tribe-1.2.0.tar.gz
  • Upload date:
  • Size: 636.1 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.2.0.tar.gz
Algorithm Hash digest
SHA256 7526e1fce3582e0a72356b27cc39c1580df697b980a0ad3b41071520abb3de8e
MD5 3c357ede7ca94bfbb1a1c12fdc060a90
BLAKE2b-256 15c472ed4cb9d302edd6f51d44b9ff28b5cf91583682aa5e7fa4dfc48eb4999d

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_tribe-1.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: git_tribe-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.9 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a36fa4c9129d4b0dcf1dd056ead53ae9a2224da2a6be280bf0ea661f36657da
MD5 9b5162dbf29673de0992d98a3dde4e3b
BLAKE2b-256 72e418cb759bdc852ac07478c6244a6b00d32c58ec49bfb1b7867106f9852af7

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_tribe-1.2.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