[{"data":1,"prerenderedAt":769},["ShallowReactive",2],{"navigation":3,"\u002Fdocs\u002Finstall":135,"\u002Fdocs\u002Finstall-surround":764},[4],{"title":5,"path":6,"stem":7,"children":8,"page":134},"Docs","\u002Fdocs","docs",[9,13,17,21,25,29,33,37,41,45,49,53,57,61,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130],{"title":10,"path":11,"stem":12},"AI harnesses: LLM tools, MCP servers and agents","\u002Fdocs\u002Fai-tools","docs\u002Fai-tools",{"title":14,"path":15,"stem":16},"Architecture","\u002Fdocs\u002Farchitecture","docs\u002Farchitecture",{"title":18,"path":19,"stem":20},"Web \u002F native bridges","\u002Fdocs\u002Fbridges","docs\u002Fbridges",{"title":22,"path":23,"stem":24},"Broadcast channels and tests","\u002Fdocs\u002Fchannels-and-tests","docs\u002Fchannels-and-tests",{"title":26,"path":27,"stem":28},"CLI reference","\u002Fdocs\u002Fcli","docs\u002Fcli",{"title":30,"path":31,"stem":32},"Completeness: how far an answer reaches","\u002Fdocs\u002Fcompleteness","docs\u002Fcompleteness",{"title":34,"path":35,"stem":36},"Configuration","\u002Fdocs\u002Fconfiguration","docs\u002Fconfiguration",{"title":38,"path":39,"stem":40},"External systems","\u002Fdocs\u002Fexternal","docs\u002Fexternal",{"title":42,"path":43,"stem":44},"Generated, copied and vendored files","\u002Fdocs\u002Fgenerated","docs\u002Fgenerated",{"title":46,"path":47,"stem":48},"Installing and updating cg","\u002Fdocs\u002Finstall","docs\u002Finstall",{"title":50,"path":51,"stem":52},"Java","\u002Fdocs\u002Fjava","docs\u002Fjava",{"title":54,"path":55,"stem":56},"Kotlin","\u002Fdocs\u002Fkotlin","docs\u002Fkotlin",{"title":58,"path":59,"stem":60},"Known limitations","\u002Fdocs\u002Flimitations","docs\u002Flimitations",{"title":62,"path":63,"stem":64,"children":65},"MCP server","\u002Fdocs\u002Fmcp","docs\u002Fmcp",[66],{"title":67,"path":68,"stem":69},"code-graph MCP: sample outputs (real calls via the MCP Python SDK stdio client)","\u002Fdocs\u002Fmcp\u002Fsample_outputs","docs\u002Fmcp\u002Fsample_outputs",{"title":71,"path":72,"stem":73},"Rust, C and C++","\u002Fdocs\u002Fnative","docs\u002Fnative",{"title":75,"path":76,"stem":77},"Port gaps: cg parity","\u002Fdocs\u002Fparity","docs\u002Fparity",{"title":79,"path":80,"stem":81},"PHP","\u002Fdocs\u002Fphp","docs\u002Fphp",{"title":83,"path":84,"stem":85},"Planned changes","\u002Fdocs\u002Fplans","docs\u002Fplans",{"title":87,"path":88,"stem":89},"Platform-specific code","\u002Fdocs\u002Fplatforms","docs\u002Fplatforms",{"title":91,"path":92,"stem":93},"Protocol links","\u002Fdocs\u002Fprotocols","docs\u002Fprotocols",{"title":95,"path":96,"stem":97},"Python","\u002Fdocs\u002Fpython","docs\u002Fpython",{"title":99,"path":100,"stem":101},"Quick start","\u002Fdocs\u002Fquickstart","docs\u002Fquickstart",{"title":103,"path":104,"stem":105},"Graph schema","\u002Fdocs\u002Fschema","docs\u002Fschema",{"title":107,"path":108,"stem":109},"Attack surface","\u002Fdocs\u002Fsurface","docs\u002Fsurface",{"title":111,"path":112,"stem":113},"Swift","\u002Fdocs\u002Fswift","docs\u002Fswift",{"title":115,"path":116,"stem":117},"TypeScript \u002F JavaScript frameworks","\u002Fdocs\u002Fts-frameworks","docs\u002Fts-frameworks",{"title":119,"path":120,"stem":121},"How we validate","\u002Fdocs\u002Fvalidation","docs\u002Fvalidation",{"title":123,"path":124,"stem":125},"Validation log","\u002Fdocs\u002Fvalidation-log","docs\u002Fvalidation-log",{"title":127,"path":128,"stem":129},"Value facts and resolutions","\u002Fdocs\u002Fvalue-facts","docs\u002Fvalue-facts",{"title":131,"path":132,"stem":133},"Visual view","\u002Fdocs\u002Fviz","docs\u002Fviz",false,{"id":136,"title":46,"body":137,"description":758,"extension":759,"meta":760,"navigation":761,"path":47,"seo":762,"stem":48,"__hash__":763},"docs\u002Fdocs\u002Finstall.md",{"type":138,"value":139,"toc":746},"minimark",[140,157,164,169,279,284,287,296,300,309,316,320,349,371,409,413,442,446,543,555,559,575,688,692,742],[141,142,143,144,148,149,152,153,156],"p",{},"cg is a Python package (Python 3.11+). The PyPI name is ",[145,146,147],"code",{},"cg-code-graph","; the commands are ",[145,150,151],{},"cg"," and ",[145,154,155],{},"cg-mcp",". It installs as a user-level tool. No checkout and no sudo.",[141,158,159,160,163],{},"New here? ",[161,162,99],"a",{"href":100}," indexes a sample app and runs the first queries in a few minutes.",[165,166,168],"h2",{"id":167},"install","Install",[170,171,173,197,212,227,242],"tabs",{"default-value":172},"0",[174,175,177,180],"tabs-item",{"label":176},"uv",[141,178,179],{},"Recommended.",[181,182,187],"pre",{"className":183,"code":184,"language":185,"meta":186,"style":186},"language-console shiki shiki-themes cg-light cg-light cg-dark","uv tool install cg-code-graph\n","console","",[145,188,189],{"__ignoreMap":186},[190,191,194],"span",{"class":192,"line":193},"line",1,[190,195,184],{"class":196},"snmWg",[174,198,200,203],{"label":199},"pipx",[141,201,202],{},"If you already use pipx.",[181,204,206],{"className":183,"code":205,"language":185,"meta":186,"style":186},"pipx install cg-code-graph\n",[145,207,208],{"__ignoreMap":186},[190,209,210],{"class":192,"line":193},[190,211,205],{"class":196},[174,213,215,218],{"label":214},"macOS \u002F Linux",[141,216,217],{},"The install script picks uv or pipx.",[181,219,221],{"className":183,"code":220,"language":185,"meta":186,"style":186},"curl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002Fcyberchronos00\u002Fcode-graph\u002Fmain\u002Finstall.sh | sh\n",[145,222,223],{"__ignoreMap":186},[190,224,225],{"class":192,"line":193},[190,226,220],{"class":196},[174,228,230,233],{"label":229},"Windows",[141,231,232],{},"Run this in PowerShell.",[181,234,236],{"className":183,"code":235,"language":185,"meta":186,"style":186},"irm https:\u002F\u002Fraw.githubusercontent.com\u002Fcyberchronos00\u002Fcode-graph\u002Fmain\u002Finstall.ps1 | iex\n",[145,237,238],{"__ignoreMap":186},[190,239,240],{"class":192,"line":193},[190,241,235],{"class":196},[174,243,245,252,261,270],{"label":244},"Advanced",[141,246,247,248,251],{},"Latest commit or a tag. ",[145,249,250],{},"pipx install"," takes the same git URL.",[181,253,255],{"className":183,"code":254,"language":185,"meta":186,"style":186},"uv tool install git+https:\u002F\u002Fgithub.com\u002Fcyberchronos00\u002Fcode-graph\n",[145,256,257],{"__ignoreMap":186},[190,258,259],{"class":192,"line":193},[190,260,254],{"class":196},[181,262,264],{"className":183,"code":263,"language":185,"meta":186,"style":186},"uv tool install git+https:\u002F\u002Fgithub.com\u002Fcyberchronos00\u002Fcode-graph@vX.Y.Z\n",[145,265,266],{"__ignoreMap":186},[190,267,268],{"class":192,"line":193},[190,269,263],{"class":196},[181,271,273],{"className":183,"code":272,"language":185,"meta":186,"style":186},"install.sh --version vX.Y.Z\n",[145,274,275],{"__ignoreMap":186},[190,276,277],{"class":192,"line":193},[190,278,272],{"class":196},[280,281,283],"h3",{"id":282},"virtual-environment","Virtual environment",[141,285,286],{},"Inside a venv, pip works too.",[181,288,290],{"className":183,"code":289,"language":185,"meta":186,"style":186},"pip install cg-code-graph\n",[145,291,292],{"__ignoreMap":186},[190,293,294],{"class":192,"line":193},[190,295,289],{"class":196},[280,297,299],{"id":298},"cg-doctor","cg doctor",[181,301,303],{"className":183,"code":302,"language":185,"meta":186,"style":186},"cg doctor\n",[145,304,305],{"__ignoreMap":186},[190,306,307],{"class":192,"line":193},[190,308,302],{"class":196},[141,310,311,312,315],{},"It lists the tools it found, whether extractor dependencies are installed, and for each language whether indexing is exact or heuristic. Pass a project path to check that project. The MCP ",[145,313,314],{},"doctor"," tool prints the same report.",[280,317,319],{"id":318},"one-mcp-server-for-many-graphs","One MCP server for many graphs",[141,321,322,325,326,152,329,332,333,336,337,341,342,345,346,348],{},[145,323,324],{},"cg install --host cursor"," registers one project graph. In a project it also writes a short \"use cg first\" rule for agents: a marked section in ",[145,327,328],{},"AGENTS.md",[145,330,331],{},".cursor\u002Frules\u002Fcg.mdc"," (",[145,334,335],{},"--no-rules"," skips both; see ",[161,338,340],{"href":339},"\u002Fdocs\u002Fmcp#install-into-a-host","Install into a host","). When several repos would each add their own ",[145,343,344],{},"cg-*"," server, register them once and run a single ",[145,347,155],{},":",[181,350,352],{"className":183,"code":351,"language":185,"meta":186,"style":186},"cg install --global --registry --host cursor\ncg install --global --migrate --host cursor          # dry run\ncg install --global --migrate --apply --host cursor  # write ~\u002F.config\u002Fcg\u002Fgraphs.toml and the host config\n",[145,353,354,359,365],{"__ignoreMap":186},[190,355,356],{"class":192,"line":193},[190,357,358],{"class":196},"cg install --global --registry --host cursor\n",[190,360,362],{"class":192,"line":361},2,[190,363,364],{"class":196},"cg install --global --migrate --host cursor          # dry run\n",[190,366,368],{"class":192,"line":367},3,[190,369,370],{"class":196},"cg install --global --migrate --apply --host cursor  # write ~\u002F.config\u002Fcg\u002Fgraphs.toml and the host config\n",[141,372,373,376,377,379,380,383,384,332,387,390,391,394,395,397,398,401,402,405,406,408],{},[145,374,375],{},"--registry"," writes one ",[145,378,151],{}," entry with no ",[145,381,382],{},"--db",". The server reads ",[145,385,386],{},"~\u002F.config\u002Fcg\u002Fgraphs.toml",[145,388,389],{},"CG_GRAPHS"," overrides the path). ",[145,392,393],{},"--migrate"," folds existing per-repo ",[145,396,344],{}," entries into that file. It prints the plan and writes nothing until ",[145,399,400],{},"--apply",", which also saves a ",[145,403,404],{},".bak"," of each config it changes. Details: ",[161,407,62],{"href":63},".",[280,410,412],{"id":411},"javascript-runtime","JavaScript runtime",[141,414,415,416,419,420,419,423,426,427,430,431,434,435,438,439,441],{},"TypeScript \u002F JavaScript indexing needs Node.js 20+ or Bun (tested with Bun 1.4.2).\nLookup order: ",[145,417,418],{},"CG_NODE",", then ",[145,421,422],{},"node",[145,424,425],{},"bun"," on PATH.\nExtractor dependencies install with ",[145,428,429],{},"npm ci",", or ",[145,432,433],{},"bun install"," when npm is missing.\nA Bun-only container (",[145,436,437],{},"oven\u002Fbun",") needs nothing else.\n",[145,440,299],{}," names the runtime it found.",[165,443,445],{"id":444},"update-and-uninstall","Update and uninstall",[170,447,448,474,498],{},[174,449,450,453,462,465],{"label":176},[141,451,452],{},"Update.",[181,454,456],{"className":183,"code":455,"language":185,"meta":186,"style":186},"uv tool upgrade cg-code-graph\n",[145,457,458],{"__ignoreMap":186},[190,459,460],{"class":192,"line":193},[190,461,455],{"class":196},[141,463,464],{},"Uninstall.",[181,466,468],{"className":183,"code":467,"language":185,"meta":186,"style":186},"uv tool uninstall cg-code-graph\n",[145,469,470],{"__ignoreMap":186},[190,471,472],{"class":192,"line":193},[190,473,467],{"class":196},[174,475,476,478,487,489],{"label":199},[141,477,452],{},[181,479,481],{"className":183,"code":480,"language":185,"meta":186,"style":186},"pipx upgrade cg-code-graph\n",[145,482,483],{"__ignoreMap":186},[190,484,485],{"class":192,"line":193},[190,486,480],{"class":196},[141,488,464],{},[181,490,492],{"className":183,"code":491,"language":185,"meta":186,"style":186},"pipx uninstall cg-code-graph\n",[145,493,494],{"__ignoreMap":186},[190,495,496],{"class":192,"line":193},[190,497,491],{"class":196},[174,499,501,504,513,522,525,534],{"label":500},"script",[141,502,503],{},"Update, shell then PowerShell.",[181,505,507],{"className":183,"code":506,"language":185,"meta":186,"style":186},"install.sh --update\n",[145,508,509],{"__ignoreMap":186},[190,510,511],{"class":192,"line":193},[190,512,506],{"class":196},[181,514,516],{"className":183,"code":515,"language":185,"meta":186,"style":186},"install.ps1 -Update\n",[145,517,518],{"__ignoreMap":186},[190,519,520],{"class":192,"line":193},[190,521,515],{"class":196},[141,523,524],{},"Uninstall, shell then PowerShell.",[181,526,528],{"className":183,"code":527,"language":185,"meta":186,"style":186},"install.sh --uninstall\n",[145,529,530],{"__ignoreMap":186},[190,531,532],{"class":192,"line":193},[190,533,527],{"class":196},[181,535,537],{"className":183,"code":536,"language":185,"meta":186,"style":186},"install.ps1 -Uninstall\n",[145,538,539],{"__ignoreMap":186},[190,540,541],{"class":192,"line":193},[190,542,536],{"class":196},[141,544,545,546,549,550,552,553,408],{},"The old package name ",[145,547,548],{},"codegraph"," (through v0.9.0) is removed by the install scripts. By hand: uninstall ",[145,551,548],{},", then install ",[145,554,147],{},[165,556,558],{"id":557},"upgrading-to-017","Upgrading to 0.17",[141,560,561,562,565,566,152,568,571,572,574],{},"0.17 renames the import package to ",[145,563,564],{},"cg_code_graph",". Two other PyPI projects (",[145,567,548],{},[145,569,570],{},"codegraph-py",") already ship a top-level ",[145,573,548],{}," package, and another project uses the older environment prefix, so this project no longer uses either.",[576,577,578,613,638,673],"ul",{},[579,580,581,582,332,585,588,589,592,593,596,597,600,601,604,605,152,608,600,611,408],"li",{},"Environment variables are ",[145,583,584],{},"CG_*",[145,586,587],{},"CG_JOBS",", ",[145,590,591],{},"CG_CACHE",", …). The ",[145,594,595],{},"CODEGRAPH_*"," names were removed in 0.19.0: rename ",[145,598,599],{},"CODEGRAPH_\u003CNAME>"," to ",[145,602,603],{},"CG_\u003CNAME>",", and rename ",[145,606,607],{},"CODEGRAPH_CACHE",[145,609,610],{},"CODEGRAPH_CACHE_DIR",[145,612,591],{},[579,614,615,616,332,619,622,623,626,627,630,631,634,635,637],{},"The cache root is ",[145,617,618],{},"~\u002F.cache\u002Fcg",[145,620,621],{},"%LOCALAPPDATA%\\cg"," on Windows, or ",[145,624,625],{},"$XDG_CACHE_HOME\u002Fcg","). The first command that uses the default root moves ",[145,628,629],{},"~\u002F.cache\u002Fcodegraph"," there and drops ",[145,632,633],{},"swift-build\u002F"," (SwiftPM build directories embed absolute paths, so the next Swift index rebuilds). Extractor installs, SCIP output and fact caches move with it. Set ",[145,636,591],{}," to keep a cache where it is.",[579,639,640,643,644,647,648,651,652,152,654,656,657,660,661,663,664,667,668,670,671,408],{},[145,641,642],{},"python -m cg_code_graph.cli"," replaces ",[145,645,646],{},"python -m codegraph.cli",". ",[145,649,650],{},"python -m cg_code_graph"," works the same way. The ",[145,653,151],{},[145,655,155],{}," commands are unchanged. MCP entries that ",[145,658,659],{},"cg install"," wrote with an absolute ",[145,662,155],{}," keep working. An entry that still runs ",[145,665,666],{},"python -m codegraph.mcp_server"," is reported by ",[145,669,299],{},"; re-run ",[145,672,659],{},[579,674,675,676,678,679,647,682,152,685,687],{},"Git hooks that still run ",[145,677,646],{}," stop refreshing until you re-run ",[145,680,681],{},"cg hooks install",[145,683,684],{},"cg hooks status",[145,686,299],{}," name an outdated hook.",[165,689,691],{"id":690},"elsewhere","Elsewhere",[576,693,694,708,729],{},[579,695,696,697,700,701,152,704,408],{},"Extractors install on the first index that needs them, or with ",[145,698,699],{},"cg setup",". Cache and prune: ",[145,702,703],{},"cg setup -h",[161,705,707],{"href":706},"\u002Fdocs\u002Fcli#clean","clean",[579,709,710,711,588,713,588,715,717,718,721,722,725,726,728],{},"Exact mode for Rust, C \u002F C++, Kotlin and Swift needs optional indexers: ",[161,712,71],{"href":72},[161,714,54],{"href":55},[161,716,111],{"href":112},". Java heuristic mode needs no JDK; ",[145,719,720],{},"cg setup java"," \u002F ",[145,723,724],{},"install.sh --with java"," print the JDK 17+ hint for scip-java (",[161,727,50],{"href":51},").",[579,730,731,732,735,736,408],{},"What the install scripts do: ",[145,733,734],{},"install.sh --help",". Working on a checkout of cg: ",[161,737,741],{"href":738,"rel":739},"https:\u002F\u002Fgithub.com\u002Fcyberchronos00\u002Fcode-graph\u002Fblob\u002Fmain\u002FCONTRIBUTING.md",[740],"nofollow","Contributing",[743,744,745],"style",{},"html pre.shiki code .snmWg, html code.shiki .snmWg{--shiki-light:#27272A;--shiki-default:#27272A;--shiki-dark:#E4E4E7}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":186,"searchDepth":747,"depth":361,"links":748},4,[749,755,756,757],{"id":167,"depth":361,"text":168,"children":750},[751,752,753,754],{"id":282,"depth":367,"text":283},{"id":298,"depth":367,"text":299},{"id":318,"depth":367,"text":319},{"id":411,"depth":367,"text":412},{"id":444,"depth":361,"text":445},{"id":557,"depth":361,"text":558},{"id":690,"depth":361,"text":691},"cg is a Python package (Python 3.11+). The PyPI name is cg-code-graph; the commands are cg and cg-mcp. It installs as a user-level tool. No checkout and no sudo.","md",{},true,{"title":46,"description":758},"vGkbLdal2Dm774WrkOKFNZ1mvXSCWy1HFkuHUcXqqOQ",[765,767],{"title":42,"path":43,"stem":44,"description":766,"children":-1},"cg keeps generated files out of the graph by default and lists them in cg coverage. A copy\npoints back at the file you edit.",{"title":50,"path":51,"stem":52,"description":768,"children":-1},"What .java adds beyond Install, CLI specs, and Graph schema: the heuristic syntax layer and the ids those pages do not spell out. Toolchain fit: cg doctor. Why a file stayed heuristic: cg coverage.",1792170232400]