This tool analyzes the first 10 commits of a Git repository and creates ASCII diagrams showing classes and their communications (including states, props, serializers, function calls, and API calls). It also generates diffs between consecutive commits to track how the code structure evolves over time.
- Analyzes Python code in Git repositories
- Identifies classes, methods, and their relationships
- Detects states, props, serializers, and API calls
- Generates ASCII class diagrams for each commit
- Creates diffs showing changes between consecutive commits
- Supports the first 10 commits by default (configurable)
-
Clone this repository:
git clone https://github.com/yourusername/git_commit_mapping_tool.git cd git_commit_mapping_tool
-
Install the required dependencies:
pip install -r requirements.txt
Run the tool on a Git repository:
python git_commit_mapper.py /path/to/repository [--output-dir OUTPUT_DIR] [--max-commits MAX_COMMITS]
repo_path
: Path to the Git repository to analyze--output-dir
,-o
: Directory where output files will be saved (default: "diagrams")--max-commits
,-n
: Maximum number of commits to analyze (default: 10)
The tool generates the following files in the output directory:
diagram_<commit-hash>.txt
: ASCII diagram for each commitdiff_<old-hash>_<new-hash>.txt
: Diff between consecutive commits
CLASS DIAGRAM:
=============
+--------------------+
| UserController |
+--------------------+
| get_user() |
| update_user() |
+--------------------+
+--------------------+
| UserService |
+--------------------+
| find_by_id() |
| save() |
| validate() |
+--------------------+
CONNECTIONS:
============
UserController calls:
└─→ UserService.find_by_id
└─→ UserService.save
UserController API calls:
└─→ API: requests.get
DIFF BETWEEN abcd123 AND efgh456
==================================================
ADDED CLASSES:
+ Logger
MODIFIED CLASSES:
* UserController:
Added methods:
+ delete_user()
Added calls:
+ Logger.log
- Currently only analyzes Python files
- May not detect all dynamic code patterns
- Simple ASCII visualization (no complex relationships)
MIT