█

AI/TLDR

मुझे पिलाएं कॉफ़ी
मुझे एक कॉफ़ी पिलाएँ

Code-Graph-RAG

Monorepo को knowledge graph में पार्स करें, फिर plain English में उससे सवाल पूछें और उसे edit करें

Code Indexing & Searchओपन सोर्स
भाषा
Python
लाइसेंस
MIT
संक्षेप में

Code-Graph-RAG क्या है?

Code-Graph-RAG Monorepo को knowledge graph में पार्स करें, फिर plain English में उससे सवाल पूछें और उसे edit करें. यह Retrieval & Knowledge (RAG) टूल्स की Code Indexing & Search श्रेणी में आता है; ओपन सोर्स है, Python में लिखा गया है और MIT लाइसेंस के तहत है। शुरू करने के लिए: cLI इंस्टॉल करें.

सारांश

Code-Graph-RAG Tree-sitter से multi-language codebase को पार्स करता है, उसकी संरचना का knowledge graph Memgraph में बनाता है, और आपको उस कोड को plain English में query, edit और optimise करने देता है। Mixed languages वाला monorepo एक unified graph schema के अंतर्गत आ जाता है, ताकि कोई सवाल language की सीमाओं के पार उसी तरह जा सके जैसे कोड खुद जाता है।

किसी repository पर `cgr` CLI चलाएं, और यह हर source file पढ़कर functions, classes, methods और modules को उनके आपसी संबंधों के साथ निकालता है, और नतीजे को एक जुड़े हुए graph के रूप में सेव करता है। Graph बन जाने के बाद आप असली संरचना पर आधारित natural-language सवाल पूछ सकते हैं, किसी भी symbol का source उसके नाम या मकसद से ढूंढ सकते हैं, entry points से call और reference edges के ज़रिए dead code खोज सकते हैं, और ast-grep से AST pattern के आधार पर structural search या rewrite कर सकते हैं।

यह edit भी करता है। बदलाव AST-based surgical patching से होते हैं, और कुछ भी लिखे जाने से पहले diff preview दिखता है। यह टूल कोड को language best practices या आपके अपने coding standards के हिसाब से optimise भी कर सकता है। Static structure से आगे, `cgr trace` runtime behaviour को ओवरले करता है — test run को trace करें, या production eBPF profiles लें — और जो calls सच में हुए, उन्हें graph में मर्ज करता है, जिससे वह dynamic dispatch दिखता है जो अकेले static analysis नहीं देख सकता।

यह प्रोजेक्ट MCP server के रूप में भी चलता है, इसलिए Claude Code और दूसरे MCP clients उसी graph के ज़रिए आपके codebase को query और edit कर सकते हैं। हाल के काम में pluggable dialect seam के ज़रिए Neo4j को वैकल्पिक graph backend के रूप में जोड़ा गया है, और agent-authored notes के लिए एक Gloss node जोड़ा गया है, जिन्हें MCP पर लिखा और पढ़ा जा सकता है।

यह क्या करता है

  • Mixed-language monorepos की Tree-sitter parsing, एक unified Memgraph graph schema में
  • Natural-language सवालों के जवाब असली call और reference structure के आधार पर, text similarity के आधार पर नहीं
  • AST-based surgical editing, किसी भी फ़ाइल के बदलने से पहले diff preview के साथ
  • Entry points से call और reference edges पर चलते हुए dead-code detection
  • ast-grep के ज़रिए AST pattern से structural search और rewrite
  • `cgr trace` असली runtime calls (test runs या production eBPF profiles) को graph में मर्ज करता है
  • MCP server, ताकि Claude Code और दूसरे MCP clients graph के ज़रिए query और edit कर सकें
  • Pluggable graph backend — Memgraph या Neo4j

शुरू करें

`cgr` PyPI पर प्रकाशित है। आपको Python 3.12+, Docker (Memgraph के लिए), cmake और ripgrep चाहिए। सभी languages के लिए treesitter-full extra और vector search के लिए semantic के साथ इंस्टॉल करें।

CLI इंस्टॉल करें

uv को recommended installer माना गया है; pipx भी काम करता है। दोनों से PyPI का सबसे नया release मिलता है।

bashbash
# with uv (recommended)
uv tool install "code-graph-rag[treesitter-full,semantic]"

# or with pipx
pipx install "code-graph-rag[treesitter-full,semantic]"

Graph stack शुरू करें

इससे packaged Memgraph और Qdrant services चालू हो जाती हैं — आपको compose file लिखने की ज़रूरत नहीं है।

bashbash
cgr daemon up

Repository index करें, फिर उसे query करें

पहला command repo को graph में पार्स करता है; दूसरा उसके खिलाफ querying शुरू करता है। जिस भी repository को index करना हो, उसके लिए parse दोहराएं — graph साझा होता है, और एक project को sync करने से बाकी प्रभावित नहीं होते।

bashbash
cgr start --repo-path /path/to/repo --update-graph
cgr start --repo-path /path/to/repo

Release cadence से पहले चलाएं (वैकल्पिक)

PyPI हर 50वें version के साथ-साथ security fixes प्रकाशित करता है, इसलिए नवीनतम git tag आमतौर पर नवीनतम release से आगे रहता है। main को ट्रैक करने के लिए git से इंस्टॉल करें।

bashbash
uv tool install "code-graph-rag[treesitter-full,semantic] @ git+https://github.com/vitali87/code-graph-rag@main"

कमांड और कोड प्रोजेक्ट के अपने दस्तावेज़ों से लिए गए हैं — हमेशा जांचें आधिकारिक repo ताज़ा जानकारी के लिए।

कब इस्तेमाल करें

  • एक monorepo में, जो कई languages में फैला है, यह जवाब पाएं कि 'इसे कौन call करता है और इसे बदलने पर क्या टूटेगा'
  • MCP server के ज़रिए coding agent को raw file dumps की जगह आपके codebase का structural context दें
  • Real entry points से call graph पर चलते हुए सच में unreachable code ढूंढें
  • Traced test run को graph में मर्ज करके वह dynamic dispatch पकड़ें जो static analysis से छूट जाता है
  • AST patching और हर बदलाव के लिए diff preview के साथ बड़े codebase पर एक coding standard लागू करें

How Code-Graph-RAG compares

Code-Graph-RAG alongside other open-source code indexing & search tools AI/TLDR tracks, ranked by GitHub stars.

टूलस्टारयह क्या करता है
CodeGraph★ 79.4kएजेंट के सवाल का जवाब एक ही tool call में देने वाला लोकल कोड नॉलेज ग्राफ़
codebase-memory-mcp★ 49.5kMCP के ज़रिए agents तक पहुँचने वाला आपके codebase का Tree-sitter knowledge graph
GitNexus★ 49kकोडबेस को नॉलेज ग्राफ़ में इंडेक्स करता है और उसे MCP के ज़रिए एजेंट्स तक पहुँचाता है
code-review-graph★ 33kकोडबेस का Tree-sitter map बनाकर उसे MCP के ज़रिए AI कोडिंग टूल्स को देता है, ताकि वे किसी टास्क के लिए सिर्फ़ ज़रूरी कोड पढ़ें
XERJ★ 23.4kएक लोकल, Elasticsearch-compatible सर्च इंजन, जो किसी भी फ़ोल्डर को अपने-आप ऑटोइंडेक्स कर देता है, ताकि coding agents grep के बजाय उसी से query करें
Claude Context★ 12.8kClaude Code के लिए पूरे कोडबेस में सेमांटिक कोड सर्च देने वाला MCP प्लगइन
Graft★ 11.6kहर कोडबेस का नॉलेज ग्राफ़ एक बार बनाएँ, फिर उसे हर कोडिंग एजेंट को दें
Code-Graph-RAG★ 5.5kMonorepo को knowledge graph में पार्स करें, फिर plain English में उससे सवाल पूछें और उसे edit करें