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.0.0.tar.gz (635.4 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.0.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: git_tribe-1.0.0.tar.gz
  • Upload date:
  • Size: 635.4 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.0.0.tar.gz
Algorithm Hash digest
SHA256 27c2089d2ba95ad2b28805d8afb47368e975eaedaae6e3a552a1dfdfb8863f9e
MD5 34b47e280ef67ac95af77d63f7a02b0d
BLAKE2b-256 8b91b42056ff29ec8094e5f54105895f0dbf24d993684ab6f5253bae2c538eed

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: git_tribe-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 735d42e6598c7c898fe13c36c201f28a433d75e585b66ce5fd2eb6142c2ad80c
MD5 da6c0d9d7e09aa1421aac7b9547c3577
BLAKE2b-256 136e5e1f89f0effbf504945f7022ddfeb5be5150eaef652d121fb1d49ee43999

See more details on using hashes here.

Provenance

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