CLI tool for analyzing git repositories
Project description
๐ GitSense
Intelligent Git Repository Analysis at Your Fingertips
A powerful CLI tool that analyzes git repositories to provide actionable insights about code health, team contributions, and commit quality. GitSense helps you understand repository patterns, identify risk hotspots, and maintain high code standards.
โจ Features
๐งโ๐ผ Contributor Analytics
- Top Contributors: Identify your most active team members
- Ranked by commit count over the repository history
- Quick insight into team engagement patterns
๐ฅ Risk Hotspot Detection
- File Churn Analysis: Spot files that change frequently
- Identify potential stability concerns in your codebase
- Focus refactoring efforts on high-volatility areas
๐ง Commit Quality Scoring
- Intelligent Quality Assessment: Evaluate commit hygiene
- Detects common bad patterns (vague messages, incomplete descriptions)
- Scores from 0-100 based on commit message standards
- Encourages better documentation practices
๐ Rich Terminal Output
- Beautiful formatted tables and panels
- Color-coded results for easy scanning
- Intuitive visual hierarchy
๐ Quick Start
Installation
# Clone the repository
git clone https://github.com/buildandbreak-bnb/gitsense.git
cd gitsense
# Install in development mode
pip install -e .
Basic Usage
# Analyze the current repository
gitsense analyze
# Analyze a specific repository
gitsense analyze /path/to/repo
๐ Usage Examples
Default Analysis (Current Directory)
$ gitsense analyze
This will display:
- Top 5 Contributors: Shows who has been most active
- Most Changed Files: Highlights files with high churn
- Commit Quality Score: Overall assessment of commit messages
Analyze a Specific Repository
$ gitsense analyze ~/projects/my-awesome-project
$ gitsense
Example Output
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ GitSense Analysis โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Top Contributors
โโโโโโโโโโโโโโโณโโโโโโโโโโ
โ Name โ Commits โ
โกโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ Alice Chen โ 342 โ
โ Bob Smith โ 289 โ
โ Carol White โ 156 โ
โโโโโโโโโโโโโโโดโโโโโโโโโโ
๐ฅ Most Changed Files (Risk Hotspots)
โโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโ
โ File โ Changes โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ src/main.py โ 156 โ
โ tests/test_api.py โ 98 โ
โ config/settings.pyโ 67 โ
โโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโ
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ ๐ง Commit Quality Score: 78/100 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
๐ Metrics Explained
Top Contributors
Displays the 5 most active developers by commit count (last 1000 commits). Useful for:
- Understanding team activity distribution
- Identifying code owners
- Recognizing consistent contributors
File Churn (Risk Hotspots)
Shows the 5 most frequently modified files (last 500 commits). Files with high churn may indicate:
- Areas under active development
- Unstable or complex code
- Code that needs refactoring
- Potential quality issues
Use this to: Focus code reviews, refactoring efforts, and testing on high-churn files.
Commit Quality Score
Analyzes the last 200 commits and assigns a score (0-100) based on:
- Message Length: Encourages descriptive commit messages (minimum 5 characters)
- Message Clarity: Flags vague messages like "fix", "update", "stuff", "asdf", "wip"
- Overall Hygiene: Rewards thoughtful, well-documented commits
Scoring Rules:
-1point: Message shorter than 5 characters-1point: Weak commit message containing "fix" but too short-2points: Anti-pattern messages (update, stuff, asdf, wip)
Interpretation:
- 80-100: Excellent commit practice
- 60-79: Good, with room for improvement
- 40-59: Needs attention to commit message quality
- 0-39: Significant quality concerns
๐ ๏ธ Architecture
gitsense/
โโโ __init__.py # Package initialization
โโโ main.py # CLI entry point (Typer commands)
โโโ analyzer.py # Git repository interface
โโโ metrics/
โโโ __init__.py
โโโ contributors.py # Top contributors metric
โโโ churn.py # File churn analysis
โโโ scoring.py # Commit quality scoring
Key Components
main.py: CLI interface using Typer
- Orchestrates analysis workflow
- Formats and displays results with Rich
analyzer.py: Repository wrapper
- Loads git repositories safely
- Provides error handling for invalid paths
metrics/: Analysis engines
contributors.py: Author frequency analysischurn.py: File modification trackingscoring.py: Commit message evaluation
๐ Requirements
- Python: 3.8 or higher
- Dependencies:
typer- Modern Python CLI frameworkrich- Beautiful terminal formattinggitpython- Python Git library
See pyproject.toml for exact version specifications.
๐ง Installation & Development
Clone & Install
git clone https://github.com/buildandbreak-bnb/gitsense.git
cd gitsense
pip install -e .
Verify Installation
gitsense --help
Run Tests (if available)
pytest
๐ก Use Cases
๐ Team Onboarding
Run GitSense to show new team members who the domain experts are and where code changes happen most frequently.
๐ฏ Code Review Focus
Prioritize deeper reviews for high-churn files identified by file churn analysis.
๐ Quality Improvement
Check commit quality scores regularly to maintain standards and encourage better documentation.
๐ Codebase Health Audit
Use GitSense as part of regular repository health assessments.
๐จ Identify Risk Areas
Quick identification of unstable areas of the codebase that may need refactoring.
๐ Troubleshooting
Error: "Not a git repository"
โ Not a git repository.
๐ Run inside a repo or pass a path:
gitsense analyze /path/to/repo
Solution: Run gitsense inside a git repository or provide the full path:
gitsense analyze /path/to/your/git/repo
Command Not Found
If gitsense command isn't recognized:
# Reinstall in development mode
pip install -e .
๐ฆ Roadmap
- Additional metrics (code complexity, test coverage)
- Export results to JSON/CSV
- Custom time range filtering
- Integration with CI/CD pipelines
- Repository comparison tools
- Configuration file support
- Advanced filtering and sorting
๐ค Contributing
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
git clone https://github.com/buildandbreak-bnb/gitsense.git
cd gitsense
pip install -e ".[dev]"
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ฅ Author
Build and Break - Crafting tools for better development
๐ Support & Feedback
- ๐ Found a bug? Open an issue
- ๐ญ Have an idea? Suggest a feature
- ๐ง Questions? Feel free to reach out
๐ Acknowledgments
Built with:
- Typer - For elegant CLI creation
- Rich - For beautiful terminal output
- GitPython - For git repository interaction
Made with โค๏ธ for developers who care about code quality
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gitsense-0.1.1.tar.gz.
File metadata
- Download URL: gitsense-0.1.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
870de16d51fdd738dd2c49baeda0cbdef10e9b56ecc7e970918f20f4850948b1
|
|
| MD5 |
82ba40dc6faba18b7e9cd54519639f57
|
|
| BLAKE2b-256 |
93f022f44cfd68f9765c406cc54aa4f96a3f7fc031d035ff22162a9412cd7bbf
|
File details
Details for the file gitsense-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: gitsense-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
362626d7c43f8ebd37ea27cedaa8d62be0157c67a5c902ac5eea662b36e76df5
|
|
| MD5 |
356ee721cea56e9ebb0cae884c9168ad
|
|
| BLAKE2b-256 |
71de3d36167d6770ebc4cf7ce3b65d7ba7c3de25e91237df70356c4298dba8cc
|