Understand — Phân tích codebase
Tạo knowledge graph từ codebase để hiểu architecture, components, và dependencies. Hỗ trợ onboarding, code review, và impact analysis.Sử dụng GitLab Knowledge Graph (GKG) engine bên dưới. Hỗ trợ go-to-definition, find-usages, impact analysis.
Cú pháp
Bảng tham chiếu nhanh
| Lệnh | Mô tả | Use case |
|---|---|---|
/understand | Scan + build knowledge graph | Lần đầu phân tích codebase |
/understand-chat | Hỏi đáp interactive về code | ”API auth flow hoạt động thế nào?” |
/understand-dashboard | Web dashboard visualize | Xem architecture diagram |
/understand-diff | Phân tích changes | Review PR, impact analysis |
/understand-explain | Deep-dive 1 file/function | Hiểu logic phức tạp |
/understand-onboard | Generate onboarding guide | Thành viên mới join team |
Luồng hoạt động
Bước 2: Build knowledge graph
Tạo graph với nodes (files, functions, classes) và edges (imports, calls, dependencies).
Ví dụ thực tế
- /understand-explain
- /understand-diff
- /understand-onboard
GKG — GitLab Knowledge Graph
/gkg là engine bên dưới, cung cấp semantic code intelligence:
| Tính năng | Mô tả |
|---|---|
| Go-to-definition | Nhảy đến nơi function/class được define |
| Find-usages | Tìm tất cả nơi sử dụng 1 symbol |
| Impact analysis | Đánh giá ảnh hưởng khi thay đổi code |
| Dependency graph | Visualize module dependencies |
Khi nào dùng / không dùng
| Dùng | Không dùng |
|---|---|
| Onboarding thành viên mới | Tìm 1 file cụ thể (dùng /scout) |
| Review PR phức tạp | Debug lỗi (dùng /debug) |
| Hiểu legacy codebase | Task đơn giản, đã biết code |
| Đánh giá refactoring impact | Generate code (dùng /cook) |