loading…
Search for a command to run...
loading…
AI modifies a function but misses 5 callers that also need updating. crag fixes this — it builds precise call graphs via static analysis, so AI knows exactly wh
AI modifies a function but misses 5 callers that also need updating. crag fixes this — it builds precise call graphs via static analysis, so AI knows exactly what's affected before making changes.
AI modifies a function but misses 5 callers that also need updating. crag fixes this — it builds precise call graphs via static analysis, so AI knows exactly what's affected before making changes.
crag analyze . # Build call graph using SSA + VTA static analysis
# → Stored in SQLite, fast to query
AI: "Modify ProcessRequest"
→ crag automatically finds all 5 callers
→ AI updates them together, nothing missed
git clone https://github.com/zheng/crag.git
cd crag
go install ./cmd/crag
# 1. Analyze your Go project
crag analyze . -o .crag.db
# 2. Configure MCP for your AI editor (Cursor / Claude Code)
# Add to .cursor/mcp.json or claude_desktop_config.json:
{
"mcpServers": {
"crag": {
"command": "crag",
"args": ["mcp", "-d", "/absolute/path/.crag.db"]
}
}
}
# 3. Keep it updated (pick one)
crag watch . -d .crag.db # Auto-update on file changes
# or: add `crag analyze . -i` to .git/hooks/post-commit
That's it. Your AI editor can now query call graphs directly.
After MCP setup, just ask naturally:
crag impact "HandleRequest" -d .crag.db # Impact analysis (callers + callees)
crag upstream "db.Query" -d .crag.db # Who calls this? (recursive)
crag downstream "Process" -d .crag.db # What does this call?
crag search "Handler" -d .crag.db # Search functions by name
crag risk -d .crag.db # Show high-risk functions
crag implements -d .crag.db # Interface implementations
crag view -d .crag.db # Web UI visualization
crag export -d .crag.db -o crag.md # Export as Markdown (RAG context)
| Text search (grep) | IDE (gopls) | crag | |
|---|---|---|---|
| Interface calls | miss | partial | VTA precise resolution |
| Persisted & queryable | no | no | SQLite |
| AI integration | manual copy | no | MCP native |
| Incremental update | n/a | n/a | Git-aware |
| Zero CGO | n/a | n/a | Pure Go SQLite |
golang.org/x/toolsmodernc.org/sqlite (pure Go, single binary)cobra · Web UI: embedded vis.jsMIT
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"code-rag-golang": {
"command": "npx",
"args": []
}
}
}