3 / 4

GitHub Repo Query

GitHub Repo Query 有三個可行版本,差異主要在執行環境、Repo 更新方式,以及查詢時使用 feature-graph.yamlcodegraph.db

版本設計歷程

V1 GitHub API 即時分析版(PoC)

環境

Cloud Run

前置作業

每個站台建立對應 {siteKey}-docs Repo
在 Docs Repo 建立 feature-graph.yaml 作為功能區域(Area)與程式碼路徑的 Mapping Index

流程

GitHub Issue 觸發分析流程
透過 LLM 解析 Issue 內容並判斷對應站台
從對應 Docs Repo 讀取 feature-graph.yaml
找出相關功能區域與程式碼位置
透過 GitHub API 即時取得程式碼內容
LLM 進行初步問題分析
回傳分析結果

優點

架構簡單
開發成本低
適合作為 MVP 驗證

缺點

需手動維護 feature-graph.yaml
受 GitHub API 影響
很難做多 repo 掃描
V2 Local Repo 分析版

環境

Cloud Run
離線主機

前置作業

預先 Clone 所有 Repo 至分析主機
每個站台建立對應 {siteKey}-docs Repo
在 Docs Repo 建立 feature-graph.yaml 作為功能區域(Area)與程式碼路徑的 Mapping Index

流程

GitHub Issue 觸發分析流程
Hermes Agent 啟動分析任務
更新相關 Repo:git pull origin main
從 Docs Repo 讀取 feature-graph.yaml
找出相關功能區域與程式碼路徑
直接讀取本機 Repo
LLM 進行問題分析
回傳分析結果

優點

降低 GitHub API 使用量
可分析完整 Repo
支援跨檔案與跨模組搜尋

缺點

每次分析仍需執行 Git Pull
Repo 數量增加後同步成本提高
分析速度受 Git 更新影響
V3 Code Graph 索引版

環境

Cloud Run
離線主機

前置作業

預先 Clone 所有 Repo
建立 Code Graph Index(codegraph.db

流程

GitHub Issue 觸發分析流程
Hermes Agent 啟動分析任務
檢查本機 Commit Hash 是否符合 GitHub 最新 Commit Hash
若版本不一致:Git Pull,重新建立 Code Graph,更新 codegraph.db
若版本一致:直接使用現有 Code Graph Index
透過 codegraph.db 定位功能區域與相關程式碼關聯
LLM 分析問題原因與可能影響範圍
回傳分析結果

優點

支援跨 Repo 關聯分析
降低 LLM Token 消耗
可作為未來 Agent 自動修復基礎

缺點

需要儲存空間
Demo