Skip to main content

Reveal hidden risks in any git repository — bus factor, hotspots, hidden coupling, knowledge decay, complexity trends

Project description

git-xray

Reveal hidden risks in any git repository. Zero dependencies, pure Python.

Point it at a repo and get an instant report on bus factor, change hotspots, hidden coupling between files, knowledge decay, and complexity trends — all from git history alone.

pip install git-xray-cli
git-xray /path/to/repo

What it finds

Analysis What it reveals
Hotspots Files that change most often with highest churn — statistically where bugs concentrate
Bus Factor Directories where 1-2 people own all knowledge — team risk if they leave
Hidden Coupling Files in different directories that always change together — hidden architectural dependencies
Knowledge Decay Code last modified by people no longer active on the project
Complexity Trend Whether average churn per commit is rising — a sign the codebase is getting harder to maintain

Example output

──────────────────────────────────────────────────────────────────────
  GIT X-RAY  v0.1.0
  my-project  ·  main
  4,300 commits  ·  60 authors  ·  4,404 files
  Jun 14, 2025 — Feb 10, 2026 (241 days)
──────────────────────────────────────────────────────────────────────

  HOTSPOTS  files with highest change frequency
──────────────────────────────────────────────────────────────────────
  RISK   FILE                                       COMMITS         CHURN

  ▓▓▓▓▓▓▓▓▓░ shared/types.ts                              448     +4,516/-3,245
  ▓▓▓▓▓▓▓▓░░ package.json                                 397       +554/-497
  ▓▓▓▓▓▓▓░░░ crates/server/src/routes/task_attempts.rs    265     +9,690/-6,866

  BUS FACTOR  knowledge concentration risk
──────────────────────────────────────────────────────────────────────

  CRITICAL  frontend/src/                        bus factor: 1
             ██████████████████████████████████░░░░░░
             louis 61% · alex 12% · gabriel 6%

  CRITICAL  backend/src/                         bus factor: 1
             █████████████████████████████████████░░░
             louis 61% · anastasiya 11% · gabriel 5%

  HIDDEN COUPLING  files that always change together
──────────────────────────────────────────────────────────────────────

  100%  KanbanContainer.tsx
        <--->  AssigneeDropdown.tsx
        6 shared commits  (cross-directory!)

  COMPLEXITY TREND  is the codebase getting harder to change?
──────────────────────────────────────────────────────────────────────

  2025 Q3  ▓▓▓▓▓▓▓▓▓▓▓░░░░  avg 286 lines/commit (1,440 commits)
  2025 Q4  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓  avg 381 lines/commit (1,285 commits)  ^
  2026 Q1  ▓▓▓▓▓▓▓▓▓▓▓▓▓▓░  avg 367 lines/commit (1,233 commits)

  >> Complexity is trending UP.

Usage

# Full report on current directory
git-xray

# Analyze a specific repo
git-xray /path/to/repo

# Only show specific sections
git-xray . --section hotspots
git-xray . --section bus-factor --section coupling

# Limit to recent history
git-xray . --since "6 months ago"
git-xray . --since "2024-01-01"

# More results per section
git-xray . --top 20

# Machine-readable output
git-xray . --json

# Adjust bus-factor directory depth
git-xray . --depth 3

# Change "active author" threshold (default: 90 days)
git-xray . --active-days 180

Installation

Requires Python 3.9+ and git. No other dependencies.

# From PyPI
pip install git-xray-cli

# From source
git clone https://github.com/bot-anica/git-xray
cd git-xray
pip install .

# Or just run directly
python3 -m git_xray /path/to/repo

How it works

Git X-Ray runs a single git log --numstat command and parses the output in one pass. All analysis is done in-memory. No network calls, no external services, no data leaves your machine.

Performance: Parses ~4,000 commits in under 2 seconds.

Analysis details

Hotspots rank files by a weighted score: 60% change frequency + 40% normalized churn magnitude. Lock files and generated assets are automatically excluded.

Bus Factor calculates the minimum number of authors needed to cover >50% of commits per directory. CRITICAL = bus factor of 1 (single point of failure).

Hidden Coupling uses confidence-based co-change analysis: coupling(A, B) = co_commits / min(commits_A, commits_B). Commits touching >30 files are excluded as noise (bulk reformats, merges). Cross-directory coupling is prioritized.

Knowledge Decay identifies files where the last modifier hasn't committed in N days (default: 90). STALE = author inactive + file untouched for 6+ months.

Complexity Trend tracks average churn (additions + deletions) per commit by quarter. Rising averages suggest the codebase is becoming harder to work with.

JSON output

Use --json for machine-readable output suitable for CI dashboards:

git-xray . --json | jq '.bus_factor[] | select(.risk == "CRITICAL")'

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_xray_cli-0.1.2.tar.gz (15.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_xray_cli-0.1.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file git_xray_cli-0.1.2.tar.gz.

File metadata

  • Download URL: git_xray_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for git_xray_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6df05757f557bf9f01896f16229085c34b7df186065a23515e0de9f53b520c3f
MD5 7aa924a0906591ace706a5449f310b34
BLAKE2b-256 7e9b70466843815662efc95d79b1490a9e2303834d152ea54e76d9ce9dc5d45b

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_xray_cli-0.1.2.tar.gz:

Publisher: publish.yml on bot-anica/git-xray

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_xray_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: git_xray_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for git_xray_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bd3f65514e92b90db2ef94356b7723d1d3be3ef0dcd0a66370dfa3e4d31a8b98
MD5 ad4f7e94c6fada2dde1669384f00fce6
BLAKE2b-256 32ee65b731beb677ce109e4f7ae9bc04992e13443741703d04288bbf8c638641

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_xray_cli-0.1.2-py3-none-any.whl:

Publisher: publish.yml on bot-anica/git-xray

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