Skip to main content

Analyze git hotspots and trigger AI post-processing

Project description

Git Hotspot AI

A lightweight CLI tool for analyzing git hotspots and triggering AI post-processing tasks.

Features

  • Git Hotspot Analysis: Identify the most frequently modified files in your repository
  • Flexible Filtering: Filter by time range, file patterns, and minimum commit counts
  • AI Task Integration: Trigger AI-powered analysis tasks on hotspot files
  • Configurable Output: Select top files by percentage or absolute count
  • Dry Run Mode: Preview results without executing AI tasks

Installation

From Source

git clone https://github.com/yourusername/git-hotspot-ai.git
cd git-hotspot-ai
pip install -e .

Development Installation

git clone https://github.com/yourusername/git-hotspot-ai.git
cd git-hotspot-ai
pip install -e ".[dev]"

Usage

Basic Usage

# analyze current directory
git-hotspot-ai

# analyze specific repository
git-hotspot-ai --repo /path/to/repo

# show top 20 files
git-hotspot-ai --top 20

# show top 15% of files
git-hotspot-ai --top 15%

# dry run (preview without AI tasks)
git-hotspot-ai --dry-run

Advanced Options

# analyze files modified in the last 6 months
git-hotspot-ai --since "6 months ago"

# ignore test files and documentation
git-hotspot-ai --ignore "tests/*,docs/*,*.md"

# only consider files with at least 5 commits
git-hotspot-ai --min-commits 5

# run specific AI tasks
git-hotspot-ai --tasks "annotate,structure,performance"

Command Line Options

Option Description Default
--repo Path to git repository Current directory
--top Top files to select (count or percentage) 10%
--tasks Comma-separated AI tasks annotate,structure,skills,performance,mvp
--since Git time filter (e.g., "6 months ago") None
--dry-run Preview without AI tasks False
--ignore Glob patterns to ignore Empty
--min-commits Minimum commit count 1

AI Tasks

The tool supports the following AI tasks:

  • annotate: Add code annotations and comments
  • structure: Analyze and improve code structure
  • skills: Identify required skills and expertise
  • performance: Analyze performance characteristics
  • mvp: Generate MVP recommendations

How It Works

  1. Git Analysis: Uses git log --numstat to collect file modification statistics
  2. Scoring: Combines commit count and line changes to score files
  3. Filtering: Applies time range, ignore patterns, and minimum commit filters
  4. Selection: Selects top files based on percentage or count
  5. AI Dispatch: Triggers configured AI tasks on selected files

Scoring Algorithm

Files are scored using the formula:

score = commit_count + 0.1 * line_changes

This balances the frequency of changes with the magnitude of changes.

Examples

Find Most Active Files

# top 10 most active files
git-hotspot-ai --top 10

# top 5% of files with at least 3 commits
git-hotspot-ai --top 5% --min-commits 3

Analyze Recent Changes

# files modified in last 3 months
git-hotspot-ai --since "3 months ago"

# recent changes excluding tests
git-hotspot-ai --since "1 month ago" --ignore "test_*,*_test.py"

Development Workflow

# preview what would be analyzed
git-hotspot-ai --dry-run --top 20

# run AI analysis on top files
git-hotspot-ai --top 20 --tasks "annotate,structure"

Development

Running Tests

pytest

Code Formatting

black git_hotspot_ai/
isort git_hotspot_ai/

Type Checking

mypy git_hotspot_ai/

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

Changelog

0.1.0

  • Initial release
  • Basic git hotspot analysis
  • CLI interface
  • AI task dispatch framework

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_hotspot_ai-0.2.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

git_hotspot_ai-0.2.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file git_hotspot_ai-0.2.0.tar.gz.

File metadata

  • Download URL: git_hotspot_ai-0.2.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for git_hotspot_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7faa7a5cb895723ce8b903c08f7e0307bb73d567a2414f3e61180cf8cee7f410
MD5 d270e2ab5a7f64e5c8c3392e6e378c78
BLAKE2b-256 b27038b3839de360fe5bbb8db94cfb6841fd79b8564e6960618fda8d89ae384c

See more details on using hashes here.

File details

Details for the file git_hotspot_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: git_hotspot_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for git_hotspot_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6238a0e1f5f9ee656579a0f0e10c09b7425af27f603d99b563b1ea537e439f36
MD5 1a983b201aff2b379161d6ccc644c9c9
BLAKE2b-256 db08e9da52d8286fa5d861a12db8a927b728e14da20206e1463179d4bf5dbcc2

See more details on using hashes here.

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