Initial upload: TermDiagram v0.1.0
Some checks failed
CI / test (push) Has been cancelled
CI / build (push) Has been cancelled

This commit is contained in:
2026-01-29 22:28:11 +00:00
parent afd408fd24
commit 25fc4fb0f4

View File

@@ -0,0 +1,35 @@
from typing import Dict, Any, Optional
from git import Repo
class ArchitectureDiffAnalyzer:
def __init__(self, repo_path: str):
self.repo_path = repo_path
self.repo: Optional[Repo] = None
def initialize(self) -> bool:
try:
self.repo = Repo(self.repo_path)
return not self.repo.bare
except:
return False
def get_change_report(self, old_commit: str, new_commit: str) -> str:
if not self.repo:
if not self.initialize():
return "Error: Not a git repository"
try:
old_tree = self.repo.commit(old_commit).tree
new_tree = self.repo.commit(new_commit).tree
diffs = old_tree.diff(new_tree)
report = [f"Architecture changes from {old_commit} to {new_commit}", "=" * 60]
for diff in diffs:
report.append(f" {diff.a_path} -> {diff.b_path}")
return "\n".join(report)
except Exception as e:
return f"Error comparing commits: {e}"