Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.hi-IN.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Build the code review graph for this project
| **टोकन बेंचमार्किंग** | प्रति-प्रश्न अनुपात के साथ नैव फ़ुल-कॉर्पस टोकन बनाम ग्राफ क्वेरी टोकन मापें |
| **मेमोरी लूप** | री-इन्जेशन के लिए Q&A परिणामों को मार्कडाउन के रूप में सहेजें, ताकि ग्राफ क्वेरीज़ से बढ़े |
| **कम्युनिटी ऑटो-स्प्लिट** | बड़ी कम्युनिटीज़ (ग्राफ का >25%) को Leiden के ज़रिए पुनरावर्ती रूप से विभाजित किया जाता है |
| **फ्रेमवर्क-अवेयर पार्सिंग** | Laravel Route→Controller मैपिंग, Eloquent रिलेशनशिप एज, Blade टेम्प्लेट संदर्भ, PSR-4 नेमस्पेस रिज़ॉल्यूशन। Flask/FastAPI/Django/Celery के लिए Python डेकोरेटर डिटेक्शन। |
| **एक्ज़ीक्यूशन फ़्लोज़** | भारित क्रिटिकैलिटी के अनुसार क्रमबद्ध, एंट्री पॉइंट्स से कॉल चेन ट्रेस करें |
| **कम्युनिटी डिटेक्शन** | बड़े ग्राफ़ के लिए रेज़ोल्यूशन स्केलिंग के साथ Leiden एल्गोरिदम से संबंधित कोड क्लस्टर करें |
| **आर्किटेक्चर ओवरव्यू** | कपलिंग चेतावनियों के साथ स्वतः-जनित आर्किटेक्चर मैप |
Expand Down
1 change: 1 addition & 0 deletions README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ gitコミットやファイル保存のたびにフックが起動します。
| **トークンベンチマーク** | ナイーブな全ファイル読み込みとグラフクエリのトークン数を質問ごとに比較 |
| **メモリループ** | Q&A結果をMarkdownとして保存し再取り込み。クエリからグラフが成長 |
| **コミュニティ自動分割** | グラフの25%を超えるコミュニティはLeidenアルゴリズムで再帰的に分割 |
| **フレームワーク対応パース** | Laravel Route→Controller マッピング、Eloquent リレーションエッジ、Blade テンプレート参照、PSR-4 名前空間解決。Flask/FastAPI/Django/Celery 向け Python デコレータ検出。 |
| **実行フロー** | エントリーポイントからの呼び出しチェーンを重み付き重要度でソートしてトレース |
| **コミュニティ検出** | Leidenアルゴリズムで関連コードをクラスタリング。大規模グラフ向け解像度スケーリング対応 |
| **アーキテクチャ概要** | コミュニティ構造から自動生成されるアーキテクチャマップ(結合度警告付き) |
Expand Down
1 change: 1 addition & 0 deletions README.ko-KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ git 커밋이나 파일 저장마다 훅이 실행됩니다. 그래프는 변경
| **토큰 벤치마킹** | 전체 코퍼스 토큰 대비 그래프 쿼리 토큰을 질문별 비율로 측정 |
| **메모리 루프** | Q&A 결과를 마크다운으로 저장하여 재수집, 쿼리로 그래프가 성장 |
| **커뮤니티 자동 분할** | 과대 커뮤니티(그래프의 25% 초과)를 Leiden 알고리즘으로 재귀적 분할 |
| **프레임워크 인식 파싱** | Laravel Route→Controller 매핑, Eloquent 관계 엣지, Blade 템플릿 참조, PSR-4 네임스페이스 해석. Flask/FastAPI/Django/Celery용 Python 데코레이터 감지. |
| **실행 흐름** | 가중 중요도 순으로 정렬된 진입점에서의 호출 체인 추적 |
| **커뮤니티 감지** | 대규모 그래프를 위한 해상도 스케일링이 포함된 Leiden 알고리즘으로 관련 코드 클러스터링 |
| **아키텍처 개요** | 결합 경고가 포함된 자동 생성 아키텍처 맵 |
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ The blast-radius analysis never misses an actually impacted file (perfect recall

- **Small single-file changes:** Graph context can exceed naive file reads for trivial edits (see express results above). The overhead is the structural metadata that enables multi-file analysis.
- **Search quality (MRR 0.35):** Keyword search finds the right result in the top-4 for most queries, but ranking needs improvement. Express queries return 0 hits due to module-pattern naming.
- **Flow detection (33% recall):** Only reliably detects entry points in Python repos (fastapi, httpx) where framework patterns are recognized. JavaScript and Go flow detection needs work.
- **Flow detection (33% recall):** Reliably detects entry points in Python repos (fastapi, httpx) and PHP/Laravel (controllers, commands, middleware, migrations). JavaScript and Go flow detection needs work.
- **Precision vs recall trade-off:** Impact analysis is deliberately conservative. It flags files that *might* be affected, which means some false positives in large dependency graphs.

</details>
Expand Down Expand Up @@ -209,6 +209,7 @@ The blast-radius analysis never misses an actually impacted file (perfect recall
| **Token benchmarking** | Measure naive full-corpus tokens vs graph query tokens with per-question ratios |
| **Memory loop** | Persist Q&A results as markdown for re-ingestion, so the graph grows from queries |
| **Community auto-split** | Oversized communities (>25% of graph) are recursively split via Leiden |
| **Framework-aware parsing** | Laravel Route→Controller mapping, Eloquent relationship edges, Blade template references, PSR-4 namespace resolution. Python decorator detection for Flask/FastAPI/Django/Celery. |
| **Execution flows** | Trace call chains from entry points, sorted by weighted criticality |
| **Community detection** | Cluster related code via Leiden algorithm with resolution scaling for large graphs |
| **Architecture overview** | Auto-generated architecture map with coupling warnings |
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Build the code review graph for this project
| **Token 基准测试** | 测量朴素全量 token 与图查询 token,附带逐题比率 |
| **记忆循环** | 将问答结果持久化为 Markdown 以供重新摄入,使图从查询中不断成长 |
| **社区自动分割** | 过大的社区(>图的 25%)通过 Leiden 算法递归分割 |
| **框架感知解析** | Laravel Route→Controller 映射、Eloquent 关联边、Blade 模板引用、PSR-4 命名空间解析。支持 Flask/FastAPI/Django/Celery 的 Python 装饰器检测。 |
| **执行流** | 从入口点追踪调用链,按加权关键度排序 |
| **社区检测** | 通过 Leiden 算法聚类相关代码,大型图自动调节分辨率 |
| **架构概览** | 自动生成架构图,附带耦合警告 |
Expand Down
29 changes: 26 additions & 3 deletions code_review_graph/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,21 @@
r"^(componentDidMount|componentDidUpdate|componentWillUnmount"
r"|shouldComponentUpdate|render)$"
),
# PHP magic invokable class entry point
re.compile(r"^__invoke$"),
]

# Language-specific entry-point name patterns. Checked only when the
# node's language matches the key. This avoids polluting all 19+
# languages with framework-specific names like ``handle`` or ``boot``.
_LANG_ENTRY_NAME_PATTERNS: dict[str, list[re.Pattern[str]]] = {
"php": [
re.compile(r"^(register|boot)$"), # Service Provider
re.compile(r"^handle$"), # Command / Middleware / Job
re.compile(r"^(up|down)$"), # Migration
],
}


# ---------------------------------------------------------------------------
# Entry-point detection
Expand All @@ -129,11 +142,21 @@ def _has_framework_decorator(node: GraphNode) -> bool:
return False


def _matches_entry_name(node: GraphNode) -> bool:
"""Return True if *node*'s name matches a conventional entry-point pattern."""
def _matches_entry_name(
node: GraphNode, language: Optional[str] = None,
) -> bool:
"""Return True if *node*'s name matches a conventional entry-point pattern.

When *language* is provided, language-specific patterns from
``_LANG_ENTRY_NAME_PATTERNS`` are also checked.
"""
for pat in _ENTRY_NAME_PATTERNS:
if pat.search(node.name):
return True
if language:
for pat in _LANG_ENTRY_NAME_PATTERNS.get(language, []):
if pat.search(node.name):
return True
return False


Expand Down Expand Up @@ -185,7 +208,7 @@ def detect_entry_points(
is_entry = True

# Conventional name match.
if _matches_entry_name(node):
if _matches_entry_name(node, language=node.language):
is_entry = True

if is_entry and node.qualified_name not in seen_qn:
Expand Down
Loading