#
tokens: 41086/50000 3/367 files (page 12/18)
lines: on (toggle) GitHub
raw markdown copy reset
This is page 12 of 18. Use http://codebase.md/shashankss1205/codegraphcontext?lines=true&page={x} to view the full context.

# Directory Structure

```
├── .github
│   └── workflows
│       ├── e2e-tests.yml
│       ├── post_discord_invite.yml
│       ├── test.yml
│       └── update-contributors.yml
├── .gitignore
├── CONTRIBUTING.md
├── contributors.md
├── docs
│   ├── docs
│   │   ├── architecture.md
│   │   ├── cli.md
│   │   ├── contributing_languages.md
│   │   ├── contributing.md
│   │   ├── cookbook.md
│   │   ├── core.md
│   │   ├── future_work.md
│   │   ├── images
│   │   │   ├── 1.png
│   │   │   ├── 11.png
│   │   │   ├── 12.png
│   │   │   ├── 13.png
│   │   │   ├── 14.png
│   │   │   ├── 16.png
│   │   │   ├── 19.png
│   │   │   ├── 2.png
│   │   │   ├── 20.png
│   │   │   ├── 21.png
│   │   │   ├── 22.png
│   │   │   ├── 23.png
│   │   │   ├── 24.png
│   │   │   ├── 26.png
│   │   │   ├── 28.png
│   │   │   ├── 29.png
│   │   │   ├── 3.png
│   │   │   ├── 30.png
│   │   │   ├── 31.png
│   │   │   ├── 32.png
│   │   │   ├── 33.png
│   │   │   ├── 34.png
│   │   │   ├── 35.png
│   │   │   ├── 36.png
│   │   │   ├── 38.png
│   │   │   ├── 39.png
│   │   │   ├── 4.png
│   │   │   ├── 40.png
│   │   │   ├── 41.png
│   │   │   ├── 42.png
│   │   │   ├── 43.png
│   │   │   ├── 44.png
│   │   │   ├── 5.png
│   │   │   ├── 6.png
│   │   │   ├── 7.png
│   │   │   ├── 8.png
│   │   │   ├── 9.png
│   │   │   ├── Indexing.gif
│   │   │   ├── tool_images
│   │   │   │   ├── 1.png
│   │   │   │   ├── 2.png
│   │   │   │   └── 3.png
│   │   │   └── Usecase.gif
│   │   ├── index.md
│   │   ├── installation.md
│   │   ├── license.md
│   │   ├── server.md
│   │   ├── tools.md
│   │   ├── troubleshooting.md
│   │   └── use_cases.md
│   ├── mkdocs.yml
│   └── site
│       ├── 404.html
│       ├── architecture
│       │   └── index.html
│       ├── assets
│       │   ├── images
│       │   │   └── favicon.png
│       │   ├── javascripts
│       │   │   ├── bundle.f55a23d4.min.js
│       │   │   ├── bundle.f55a23d4.min.js.map
│       │   │   ├── lunr
│       │   │   │   ├── min
│       │   │   │   │   ├── lunr.ar.min.js
│       │   │   │   │   ├── lunr.da.min.js
│       │   │   │   │   ├── lunr.de.min.js
│       │   │   │   │   ├── lunr.du.min.js
│       │   │   │   │   ├── lunr.el.min.js
│       │   │   │   │   ├── lunr.es.min.js
│       │   │   │   │   ├── lunr.fi.min.js
│       │   │   │   │   ├── lunr.fr.min.js
│       │   │   │   │   ├── lunr.he.min.js
│       │   │   │   │   ├── lunr.hi.min.js
│       │   │   │   │   ├── lunr.hu.min.js
│       │   │   │   │   ├── lunr.hy.min.js
│       │   │   │   │   ├── lunr.it.min.js
│       │   │   │   │   ├── lunr.ja.min.js
│       │   │   │   │   ├── lunr.jp.min.js
│       │   │   │   │   ├── lunr.kn.min.js
│       │   │   │   │   ├── lunr.ko.min.js
│       │   │   │   │   ├── lunr.multi.min.js
│       │   │   │   │   ├── lunr.nl.min.js
│       │   │   │   │   ├── lunr.no.min.js
│       │   │   │   │   ├── lunr.pt.min.js
│       │   │   │   │   ├── lunr.ro.min.js
│       │   │   │   │   ├── lunr.ru.min.js
│       │   │   │   │   ├── lunr.sa.min.js
│       │   │   │   │   ├── lunr.stemmer.support.min.js
│       │   │   │   │   ├── lunr.sv.min.js
│       │   │   │   │   ├── lunr.ta.min.js
│       │   │   │   │   ├── lunr.te.min.js
│       │   │   │   │   ├── lunr.th.min.js
│       │   │   │   │   ├── lunr.tr.min.js
│       │   │   │   │   ├── lunr.vi.min.js
│       │   │   │   │   └── lunr.zh.min.js
│       │   │   │   ├── tinyseg.js
│       │   │   │   └── wordcut.js
│       │   │   └── workers
│       │   │       ├── search.973d3a69.min.js
│       │   │       └── search.973d3a69.min.js.map
│       │   └── stylesheets
│       │       ├── main.2a3383ac.min.css
│       │       ├── main.2a3383ac.min.css.map
│       │       ├── palette.06af60db.min.css
│       │       └── palette.06af60db.min.css.map
│       ├── cli
│       │   └── index.html
│       ├── contributing
│       │   └── index.html
│       ├── contributing_languages
│       │   └── index.html
│       ├── cookbook
│       │   └── index.html
│       ├── core
│       │   └── index.html
│       ├── future_work
│       │   └── index.html
│       ├── images
│       │   ├── 1.png
│       │   ├── 11.png
│       │   ├── 12.png
│       │   ├── 13.png
│       │   ├── 14.png
│       │   ├── 16.png
│       │   ├── 19.png
│       │   ├── 2.png
│       │   ├── 20.png
│       │   ├── 21.png
│       │   ├── 22.png
│       │   ├── 23.png
│       │   ├── 24.png
│       │   ├── 26.png
│       │   ├── 28.png
│       │   ├── 29.png
│       │   ├── 3.png
│       │   ├── 30.png
│       │   ├── 31.png
│       │   ├── 32.png
│       │   ├── 33.png
│       │   ├── 34.png
│       │   ├── 35.png
│       │   ├── 36.png
│       │   ├── 38.png
│       │   ├── 39.png
│       │   ├── 4.png
│       │   ├── 40.png
│       │   ├── 41.png
│       │   ├── 42.png
│       │   ├── 43.png
│       │   ├── 44.png
│       │   ├── 5.png
│       │   ├── 6.png
│       │   ├── 7.png
│       │   ├── 8.png
│       │   ├── 9.png
│       │   ├── Indexing.gif
│       │   ├── tool_images
│       │   │   ├── 1.png
│       │   │   ├── 2.png
│       │   │   └── 3.png
│       │   └── Usecase.gif
│       ├── index.html
│       ├── installation
│       │   └── index.html
│       ├── license
│       │   └── index.html
│       ├── search
│       │   └── search_index.json
│       ├── server
│       │   └── index.html
│       ├── sitemap.xml
│       ├── sitemap.xml.gz
│       ├── tools
│       │   └── index.html
│       ├── troubleshooting
│       │   └── index.html
│       └── use_cases
│           └── index.html
├── images
│   ├── 1.png
│   ├── 11.png
│   ├── 12.png
│   ├── 13.png
│   ├── 14.png
│   ├── 16.png
│   ├── 19.png
│   ├── 2.png
│   ├── 20.png
│   ├── 21.png
│   ├── 22.png
│   ├── 23.png
│   ├── 24.png
│   ├── 26.png
│   ├── 28.png
│   ├── 29.png
│   ├── 3.png
│   ├── 30.png
│   ├── 31.png
│   ├── 32.png
│   ├── 33.png
│   ├── 34.png
│   ├── 35.png
│   ├── 36.png
│   ├── 38.png
│   ├── 39.png
│   ├── 4.png
│   ├── 40.png
│   ├── 41.png
│   ├── 42.png
│   ├── 43.png
│   ├── 44.png
│   ├── 5.png
│   ├── 6.png
│   ├── 7.png
│   ├── 8.png
│   ├── 9.png
│   ├── Indexing.gif
│   ├── tool_images
│   │   ├── 1.png
│   │   ├── 2.png
│   │   └── 3.png
│   └── Usecase.gif
├── LICENSE
├── MANIFEST.in
├── organizer
│   ├── CONTRIBUTING_LANGUAGES.md
│   ├── cookbook.md
│   ├── docs.md
│   ├── language_specific_nodes.md
│   ├── Tools_Exploration.md
│   └── troubleshoot.md
├── package-lock.json
├── pyproject.toml
├── README.md
├── scripts
│   ├── generate_lang_contributors.py
│   └── post_install_fix.sh
├── SECURITY.md
├── src
│   └── codegraphcontext
│       ├── __init__.py
│       ├── __main__.py
│       ├── cli
│       │   ├── __init__.py
│       │   ├── cli_helpers.py
│       │   ├── main.py
│       │   ├── setup_macos.py
│       │   └── setup_wizard.py
│       ├── core
│       │   ├── __init__.py
│       │   ├── database.py
│       │   ├── jobs.py
│       │   └── watcher.py
│       ├── prompts.py
│       ├── server.py
│       ├── tools
│       │   ├── __init__.py
│       │   ├── advanced_language_query_tool.py
│       │   ├── code_finder.py
│       │   ├── graph_builder.py
│       │   ├── languages
│       │   │   ├── c.py
│       │   │   ├── cpp.py
│       │   │   ├── go.py
│       │   │   ├── java.py
│       │   │   ├── javascript.py
│       │   │   ├── python.py
│       │   │   ├── ruby.py
│       │   │   ├── rust.py
│       │   │   └── typescript.py
│       │   ├── package_resolver.py
│       │   ├── query_tool_languages
│       │   │   ├── c_toolkit.py
│       │   │   ├── cpp_toolkit.py
│       │   │   ├── go_toolkit.py
│       │   │   ├── java_toolkit.py
│       │   │   ├── javascript_toolkit.py
│       │   │   ├── python_toolkit.py
│       │   │   ├── ruby_toolkit.py
│       │   │   ├── rust_toolkit.py
│       │   │   └── typescript_toolkit.py
│       │   └── system.py
│       └── utils
│           └── debug_log.py
├── tests
│   ├── __init__.py
│   ├── conftest.py
│   ├── sample_project
│   │   ├── advanced_calls.py
│   │   ├── advanced_classes.py
│   │   ├── advanced_classes2.py
│   │   ├── advanced_functions.py
│   │   ├── advanced_imports.py
│   │   ├── async_features.py
│   │   ├── callbacks_decorators.py
│   │   ├── circular1.py
│   │   ├── circular2.py
│   │   ├── class_instantiation.py
│   │   ├── cli_and_dunder.py
│   │   ├── complex_classes.py
│   │   ├── comprehensions_generators.py
│   │   ├── context_managers.py
│   │   ├── control_flow.py
│   │   ├── datatypes.py
│   │   ├── dynamic_dispatch.py
│   │   ├── dynamic_imports.py
│   │   ├── edge_cases
│   │   │   ├── comments_only.py
│   │   │   ├── docstring_only.py
│   │   │   ├── empty.py
│   │   │   ├── hardcoded_secrets.py
│   │   │   ├── long_functions.py
│   │   │   └── syntax_error.py
│   │   ├── function_chains.py
│   │   ├── generators.py
│   │   ├── import_reexports.py
│   │   ├── mapping_calls.py
│   │   ├── module_a.py
│   │   ├── module_b.py
│   │   ├── module_c
│   │   │   ├── __init__.py
│   │   │   ├── submodule1.py
│   │   │   └── submodule2.py
│   │   ├── namespace_pkg
│   │   │   └── ns_module.py
│   │   ├── pattern_matching.py
│   │   └── typing_examples.py
│   ├── sample_project_c
│   │   ├── cgc_sample
│   │   ├── include
│   │   │   ├── config.h
│   │   │   ├── math
│   │   │   │   └── vec.h
│   │   │   ├── module.h
│   │   │   ├── platform.h
│   │   │   └── util.h
│   │   ├── Makefile
│   │   ├── README.md
│   │   └── src
│   │       ├── main.c
│   │       ├── math
│   │       │   └── vec.c
│   │       ├── module.c
│   │       └── util.c
│   ├── sample_project_cpp
│   │   ├── class_features.cpp
│   │   ├── classes.cpp
│   │   ├── control_flow.cpp
│   │   ├── edge_cases.cpp
│   │   ├── enum_struct_union.cpp
│   │   ├── exceptions.cpp
│   │   ├── file_io.cpp
│   │   ├── function_chain.cpp
│   │   ├── function_chain.h
│   │   ├── function_types.cpp
│   │   ├── main.cpp
│   │   ├── main.exe
│   │   ├── namespaces.cpp
│   │   ├── raii_example.cpp
│   │   ├── README.md
│   │   ├── sample_project.exe
│   │   ├── stl_usage.cpp
│   │   ├── templates.cpp
│   │   └── types_variable_assignments.cpp
│   ├── sample_project_go
│   │   ├── advanced_types.go
│   │   ├── basic_functions.go
│   │   ├── embedded_composition.go
│   │   ├── error_handling.go
│   │   ├── generics.go
│   │   ├── go.mod
│   │   ├── goroutines_channels.go
│   │   ├── interfaces.go
│   │   ├── packages_imports.go
│   │   ├── README.md
│   │   ├── structs_methods.go
│   │   └── util
│   │       └── helpers.go
│   ├── sample_project_java
│   │   ├── out
│   │   │   └── com
│   │   │       └── example
│   │   │           └── app
│   │   │               ├── annotations
│   │   │               │   └── Logged.class
│   │   │               ├── Main.class
│   │   │               ├── misc
│   │   │               │   ├── Outer.class
│   │   │               │   └── Outer$Inner.class
│   │   │               ├── model
│   │   │               │   ├── Role.class
│   │   │               │   └── User.class
│   │   │               ├── service
│   │   │               │   ├── AbstractGreeter.class
│   │   │               │   ├── GreetingService.class
│   │   │               │   └── impl
│   │   │               │       └── GreetingServiceImpl.class
│   │   │               └── util
│   │   │                   ├── CollectionUtils.class
│   │   │                   └── IOHelper.class
│   │   ├── README.md
│   │   ├── sources.txt
│   │   └── src
│   │       └── com
│   │           └── example
│   │               └── app
│   │                   ├── annotations
│   │                   │   └── Logged.java
│   │                   ├── Main.java
│   │                   ├── misc
│   │                   │   └── Outer.java
│   │                   ├── model
│   │                   │   ├── Role.java
│   │                   │   └── User.java
│   │                   ├── service
│   │                   │   ├── AbstractGreeter.java
│   │                   │   ├── GreetingService.java
│   │                   │   └── impl
│   │                   │       └── GreetingServiceImpl.java
│   │                   └── util
│   │                       ├── CollectionUtils.java
│   │                       └── IOHelper.java
│   ├── sample_project_javascript
│   │   ├── arrays.js
│   │   ├── asyncAwait.js
│   │   ├── classes.js
│   │   ├── dom.js
│   │   ├── errorHandling.js
│   │   ├── events.js
│   │   ├── exporter.js
│   │   ├── fetchAPI.js
│   │   ├── fixtures
│   │   │   └── js
│   │   │       └── accessors.js
│   │   ├── functions.js
│   │   ├── importer.js
│   │   ├── objects.js
│   │   ├── promises.js
│   │   ├── README.md
│   │   └── variables.js
│   ├── sample_project_misc
│   │   ├── index.html
│   │   ├── README.md
│   │   ├── styles.css
│   │   ├── tables.css
│   │   └── tables.html
│   ├── sample_project_php
│   │   ├── classes_objects.php
│   │   ├── database.php
│   │   ├── edgecases.php
│   │   ├── error_handling.php
│   │   ├── file_handling.php
│   │   ├── functions.php
│   │   ├── generators_iterators.php
│   │   ├── globals_superglobals.php
│   │   ├── Inheritance.php
│   │   ├── interface_traits.php
│   │   └── README.md
│   ├── sample_project_ruby
│   │   ├── class_example.rb
│   │   ├── enumerables.rb
│   │   ├── error_handling.rb
│   │   ├── file_io.rb
│   │   ├── inheritance_example.rb
│   │   ├── main.rb
│   │   ├── metaprogramming.rb
│   │   ├── mixins_example.rb
│   │   ├── module_example.rb
│   │   └── tests
│   │       ├── test_mixins.py
│   │       └── test_sample.rb
│   ├── sample_project_rust
│   │   ├── Cargo.toml
│   │   ├── README.md
│   │   └── src
│   │       ├── basic_functions.rs
│   │       ├── concurrency.rs
│   │       ├── error_handling.rs
│   │       ├── generics.rs
│   │       ├── iterators_closures.rs
│   │       ├── lib.rs
│   │       ├── lifetimes_references.rs
│   │       ├── modules.rs
│   │       ├── smart_pointers.rs
│   │       ├── structs_enums.rs
│   │       └── traits.rs
│   ├── sample_project_typescript
│   │   ├── package.json
│   │   ├── README.md
│   │   ├── src
│   │   │   ├── advanced-types.ts
│   │   │   ├── async-promises.ts
│   │   │   ├── classes-inheritance.ts
│   │   │   ├── decorators-metadata.ts
│   │   │   ├── error-validation.ts
│   │   │   ├── functions-generics.ts
│   │   │   ├── index.ts
│   │   │   ├── modules-namespaces.ts
│   │   │   ├── types-interfaces.ts
│   │   │   └── utilities-helpers.ts
│   │   └── tsconfig.json
│   ├── test_cpp_parser.py
│   ├── test_database_validation.py
│   ├── test_end_to_end.py
│   ├── test_graph_indexing_js.py
│   ├── test_graph_indexing.py
│   ├── test_tree_sitter
│   │   ├── __init__.py
│   │   ├── class_instantiation.py
│   │   ├── complex_classes.py
│   │   └── test_file.py
│   └── test_typescript_parser.py
└── website
    ├── .example.env
    ├── .gitignore
    ├── api
    │   └── pypi.ts
    ├── bun.lockb
    ├── components.json
    ├── eslint.config.js
    ├── index.html
    ├── package-lock.json
    ├── package.json
    ├── postcss.config.js
    ├── public
    │   ├── favicon.ico
    │   ├── placeholder.svg
    │   └── robots.txt
    ├── README.md
    ├── src
    │   ├── App.css
    │   ├── App.tsx
    │   ├── assets
    │   │   ├── function-calls.png
    │   │   ├── graph-total.png
    │   │   ├── hero-graph.jpg
    │   │   └── hierarchy.png
    │   ├── components
    │   │   ├── ComparisonTable.tsx
    │   │   ├── CookbookSection.tsx
    │   │   ├── DemoSection.tsx
    │   │   ├── ExamplesSection.tsx
    │   │   ├── FeaturesSection.tsx
    │   │   ├── Footer.tsx
    │   │   ├── HeroSection.tsx
    │   │   ├── InstallationSection.tsx
    │   │   ├── MoveToTop.tsx
    │   │   ├── ShowDownloads.tsx
    │   │   ├── ShowStarGraph.tsx
    │   │   ├── TestimonialSection.tsx
    │   │   ├── ThemeProvider.tsx
    │   │   ├── ThemeToggle.tsx
    │   │   └── ui
    │   │       ├── accordion.tsx
    │   │       ├── alert-dialog.tsx
    │   │       ├── alert.tsx
    │   │       ├── aspect-ratio.tsx
    │   │       ├── avatar.tsx
    │   │       ├── badge.tsx
    │   │       ├── breadcrumb.tsx
    │   │       ├── button.tsx
    │   │       ├── calendar.tsx
    │   │       ├── card.tsx
    │   │       ├── carousel.tsx
    │   │       ├── chart.tsx
    │   │       ├── checkbox.tsx
    │   │       ├── collapsible.tsx
    │   │       ├── command.tsx
    │   │       ├── context-menu.tsx
    │   │       ├── dialog.tsx
    │   │       ├── drawer.tsx
    │   │       ├── dropdown-menu.tsx
    │   │       ├── form.tsx
    │   │       ├── hover-card.tsx
    │   │       ├── input-otp.tsx
    │   │       ├── input.tsx
    │   │       ├── label.tsx
    │   │       ├── menubar.tsx
    │   │       ├── navigation-menu.tsx
    │   │       ├── orbiting-circles.tsx
    │   │       ├── pagination.tsx
    │   │       ├── popover.tsx
    │   │       ├── progress.tsx
    │   │       ├── radio-group.tsx
    │   │       ├── resizable.tsx
    │   │       ├── scroll-area.tsx
    │   │       ├── select.tsx
    │   │       ├── separator.tsx
    │   │       ├── sheet.tsx
    │   │       ├── sidebar.tsx
    │   │       ├── skeleton.tsx
    │   │       ├── slider.tsx
    │   │       ├── sonner.tsx
    │   │       ├── switch.tsx
    │   │       ├── table.tsx
    │   │       ├── tabs.tsx
    │   │       ├── textarea.tsx
    │   │       ├── toast.tsx
    │   │       ├── toaster.tsx
    │   │       ├── toggle-group.tsx
    │   │       ├── toggle.tsx
    │   │       ├── tooltip.tsx
    │   │       └── use-toast.ts
    │   ├── hooks
    │   │   ├── use-mobile.tsx
    │   │   └── use-toast.ts
    │   ├── index.css
    │   ├── lib
    │   │   └── utils.ts
    │   ├── main.tsx
    │   ├── pages
    │   │   ├── Index.tsx
    │   │   └── NotFound.tsx
    │   └── vite-env.d.ts
    ├── tailwind.config.ts
    ├── tsconfig.app.json
    ├── tsconfig.json
    ├── tsconfig.node.json
    ├── vercel.json
    └── vite.config.ts
```

# Files

--------------------------------------------------------------------------------
/docs/site/server/index.html:
--------------------------------------------------------------------------------

```html
   1 | 
   2 | <!doctype html>
   3 | <html lang="en" class="no-js">
   4 |   <head>
   5 |     
   6 |       <meta charset="utf-8">
   7 |       <meta name="viewport" content="width=device-width,initial-scale=1">
   8 |       
   9 |       
  10 |       
  11 |       
  12 |         <link rel="prev" href="../cli/">
  13 |       
  14 |       
  15 |         <link rel="next" href="../core/">
  16 |       
  17 |       
  18 |       <link rel="icon" href="../assets/images/favicon.png">
  19 |       <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.21">
  20 |     
  21 |     
  22 |       
  23 |         <title>Server - CodeGraphContext</title>
  24 |       
  25 |     
  26 |     
  27 |       <link rel="stylesheet" href="../assets/stylesheets/main.2a3383ac.min.css">
  28 |       
  29 |       
  30 | 
  31 | 
  32 |     
  33 |     
  34 |       
  35 |     
  36 |     
  37 |       
  38 |         
  39 |         
  40 |         <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  41 |         <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
  42 |         <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
  43 |       
  44 |     
  45 |     
  46 |     <script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
  47 |     
  48 |       
  49 | 
  50 |     
  51 |     
  52 |     
  53 |   </head>
  54 |   
  55 |   
  56 |     <body dir="ltr">
  57 |   
  58 |     
  59 |     <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
  60 |     <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
  61 |     <label class="md-overlay" for="__drawer"></label>
  62 |     <div data-md-component="skip">
  63 |       
  64 |         
  65 |         <a href="#mcpserver" class="md-skip">
  66 |           Skip to content
  67 |         </a>
  68 |       
  69 |     </div>
  70 |     <div data-md-component="announce">
  71 |       
  72 |     </div>
  73 |     
  74 |     
  75 |       
  76 | 
  77 |   
  78 | 
  79 | <header class="md-header md-header--shadow" data-md-component="header">
  80 |   <nav class="md-header__inner md-grid" aria-label="Header">
  81 |     <a href=".." title="CodeGraphContext" class="md-header__button md-logo" aria-label="CodeGraphContext" data-md-component="logo">
  82 |       
  83 |   
  84 |   <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
  85 | 
  86 |     </a>
  87 |     <label class="md-header__button md-icon" for="__drawer">
  88 |       
  89 |       <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
  90 |     </label>
  91 |     <div class="md-header__title" data-md-component="header-title">
  92 |       <div class="md-header__ellipsis">
  93 |         <div class="md-header__topic">
  94 |           <span class="md-ellipsis">
  95 |             CodeGraphContext
  96 |           </span>
  97 |         </div>
  98 |         <div class="md-header__topic" data-md-component="header-topic">
  99 |           <span class="md-ellipsis">
 100 |             
 101 |               Server
 102 |             
 103 |           </span>
 104 |         </div>
 105 |       </div>
 106 |     </div>
 107 |     
 108 |     
 109 |       <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
 110 |     
 111 |     
 112 |     
 113 |       
 114 |       
 115 |         <label class="md-header__button md-icon" for="__search">
 116 |           
 117 |           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
 118 |         </label>
 119 |         <div class="md-search" data-md-component="search" role="dialog">
 120 |   <label class="md-search__overlay" for="__search"></label>
 121 |   <div class="md-search__inner" role="search">
 122 |     <form class="md-search__form" name="search">
 123 |       <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
 124 |       <label class="md-search__icon md-icon" for="__search">
 125 |         
 126 |         <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
 127 |         
 128 |         <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
 129 |       </label>
 130 |       <nav class="md-search__options" aria-label="Search">
 131 |         
 132 |         <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
 133 |           
 134 |           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
 135 |         </button>
 136 |       </nav>
 137 |       
 138 |     </form>
 139 |     <div class="md-search__output">
 140 |       <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
 141 |         <div class="md-search-result" data-md-component="search-result">
 142 |           <div class="md-search-result__meta">
 143 |             Initializing search
 144 |           </div>
 145 |           <ol class="md-search-result__list" role="presentation"></ol>
 146 |         </div>
 147 |       </div>
 148 |     </div>
 149 |   </div>
 150 | </div>
 151 |       
 152 |     
 153 |     
 154 |   </nav>
 155 |   
 156 | </header>
 157 |     
 158 |     <div class="md-container" data-md-component="container">
 159 |       
 160 |       
 161 |         
 162 |           
 163 |         
 164 |       
 165 |       <main class="md-main" data-md-component="main">
 166 |         <div class="md-main__inner md-grid">
 167 |           
 168 |             
 169 |               
 170 |               <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
 171 |                 <div class="md-sidebar__scrollwrap">
 172 |                   <div class="md-sidebar__inner">
 173 |                     
 174 | 
 175 | 
 176 | 
 177 | <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
 178 |   <label class="md-nav__title" for="__drawer">
 179 |     <a href=".." title="CodeGraphContext" class="md-nav__button md-logo" aria-label="CodeGraphContext" data-md-component="logo">
 180 |       
 181 |   
 182 |   <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
 183 | 
 184 |     </a>
 185 |     CodeGraphContext
 186 |   </label>
 187 |   
 188 |   <ul class="md-nav__list" data-md-scrollfix>
 189 |     
 190 |       
 191 |       
 192 |   
 193 |   
 194 |   
 195 |   
 196 |     <li class="md-nav__item">
 197 |       <a href=".." class="md-nav__link">
 198 |         
 199 |   
 200 |   
 201 |   <span class="md-ellipsis">
 202 |     Home
 203 |     
 204 |   </span>
 205 |   
 206 | 
 207 |       </a>
 208 |     </li>
 209 |   
 210 | 
 211 |     
 212 |       
 213 |       
 214 |   
 215 |   
 216 |   
 217 |   
 218 |     <li class="md-nav__item">
 219 |       <a href="../installation/" class="md-nav__link">
 220 |         
 221 |   
 222 |   
 223 |   <span class="md-ellipsis">
 224 |     Installation
 225 |     
 226 |   </span>
 227 |   
 228 | 
 229 |       </a>
 230 |     </li>
 231 |   
 232 | 
 233 |     
 234 |       
 235 |       
 236 |   
 237 |   
 238 |   
 239 |   
 240 |     <li class="md-nav__item">
 241 |       <a href="../use_cases/" class="md-nav__link">
 242 |         
 243 |   
 244 |   
 245 |   <span class="md-ellipsis">
 246 |     Use Cases
 247 |     
 248 |   </span>
 249 |   
 250 | 
 251 |       </a>
 252 |     </li>
 253 |   
 254 | 
 255 |     
 256 |       
 257 |       
 258 |   
 259 |   
 260 |   
 261 |   
 262 |     <li class="md-nav__item">
 263 |       <a href="../architecture/" class="md-nav__link">
 264 |         
 265 |   
 266 |   
 267 |   <span class="md-ellipsis">
 268 |     Architecture
 269 |     
 270 |   </span>
 271 |   
 272 | 
 273 |       </a>
 274 |     </li>
 275 |   
 276 | 
 277 |     
 278 |       
 279 |       
 280 |   
 281 |   
 282 |   
 283 |   
 284 |     <li class="md-nav__item">
 285 |       <a href="../cli/" class="md-nav__link">
 286 |         
 287 |   
 288 |   
 289 |   <span class="md-ellipsis">
 290 |     CLI Reference
 291 |     
 292 |   </span>
 293 |   
 294 | 
 295 |       </a>
 296 |     </li>
 297 |   
 298 | 
 299 |     
 300 |       
 301 |       
 302 |   
 303 |   
 304 |     
 305 |   
 306 |   
 307 |   
 308 |     <li class="md-nav__item md-nav__item--active">
 309 |       
 310 |       <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
 311 |       
 312 |       
 313 |         
 314 |       
 315 |       
 316 |         <label class="md-nav__link md-nav__link--active" for="__toc">
 317 |           
 318 |   
 319 |   
 320 |   <span class="md-ellipsis">
 321 |     Server
 322 |     
 323 |   </span>
 324 |   
 325 | 
 326 |           <span class="md-nav__icon md-icon"></span>
 327 |         </label>
 328 |       
 329 |       <a href="./" class="md-nav__link md-nav__link--active">
 330 |         
 331 |   
 332 |   
 333 |   <span class="md-ellipsis">
 334 |     Server
 335 |     
 336 |   </span>
 337 |   
 338 | 
 339 |       </a>
 340 |       
 341 |         
 342 | 
 343 | <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
 344 |   
 345 |   
 346 |   
 347 |     
 348 |   
 349 |   
 350 |     <label class="md-nav__title" for="__toc">
 351 |       <span class="md-nav__icon md-icon"></span>
 352 |       Table of contents
 353 |     </label>
 354 |     <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
 355 |       
 356 |         <li class="md-nav__item">
 357 |   <a href="#initialization" class="md-nav__link">
 358 |     <span class="md-ellipsis">
 359 |       Initialization
 360 |     </span>
 361 |   </a>
 362 |   
 363 | </li>
 364 |       
 365 |         <li class="md-nav__item">
 366 |   <a href="#tool-manifest" class="md-nav__link">
 367 |     <span class="md-ellipsis">
 368 |       Tool Manifest
 369 |     </span>
 370 |   </a>
 371 |   
 372 |     <nav class="md-nav" aria-label="Tool Manifest">
 373 |       <ul class="md-nav__list">
 374 |         
 375 |           <li class="md-nav__item">
 376 |   <a href="#add_code_to_graph" class="md-nav__link">
 377 |     <span class="md-ellipsis">
 378 |       add_code_to_graph
 379 |     </span>
 380 |   </a>
 381 |   
 382 | </li>
 383 |         
 384 |           <li class="md-nav__item">
 385 |   <a href="#check_job_status" class="md-nav__link">
 386 |     <span class="md-ellipsis">
 387 |       check_job_status
 388 |     </span>
 389 |   </a>
 390 |   
 391 | </li>
 392 |         
 393 |           <li class="md-nav__item">
 394 |   <a href="#list_jobs" class="md-nav__link">
 395 |     <span class="md-ellipsis">
 396 |       list_jobs
 397 |     </span>
 398 |   </a>
 399 |   
 400 | </li>
 401 |         
 402 |           <li class="md-nav__item">
 403 |   <a href="#find_code" class="md-nav__link">
 404 |     <span class="md-ellipsis">
 405 |       find_code
 406 |     </span>
 407 |   </a>
 408 |   
 409 | </li>
 410 |         
 411 |           <li class="md-nav__item">
 412 |   <a href="#analyze_code_relationships" class="md-nav__link">
 413 |     <span class="md-ellipsis">
 414 |       analyze_code_relationships
 415 |     </span>
 416 |   </a>
 417 |   
 418 | </li>
 419 |         
 420 |           <li class="md-nav__item">
 421 |   <a href="#watch_directory" class="md-nav__link">
 422 |     <span class="md-ellipsis">
 423 |       watch_directory
 424 |     </span>
 425 |   </a>
 426 |   
 427 | </li>
 428 |         
 429 |           <li class="md-nav__item">
 430 |   <a href="#execute_cypher_query" class="md-nav__link">
 431 |     <span class="md-ellipsis">
 432 |       execute_cypher_query
 433 |     </span>
 434 |   </a>
 435 |   
 436 | </li>
 437 |         
 438 |           <li class="md-nav__item">
 439 |   <a href="#add_package_to_graph" class="md-nav__link">
 440 |     <span class="md-ellipsis">
 441 |       add_package_to_graph
 442 |     </span>
 443 |   </a>
 444 |   
 445 | </li>
 446 |         
 447 |           <li class="md-nav__item">
 448 |   <a href="#find_dead_code" class="md-nav__link">
 449 |     <span class="md-ellipsis">
 450 |       find_dead_code
 451 |     </span>
 452 |   </a>
 453 |   
 454 | </li>
 455 |         
 456 |           <li class="md-nav__item">
 457 |   <a href="#calculate_cyclomatic_complexity" class="md-nav__link">
 458 |     <span class="md-ellipsis">
 459 |       calculate_cyclomatic_complexity
 460 |     </span>
 461 |   </a>
 462 |   
 463 | </li>
 464 |         
 465 |           <li class="md-nav__item">
 466 |   <a href="#find_most_complex_functions" class="md-nav__link">
 467 |     <span class="md-ellipsis">
 468 |       find_most_complex_functions
 469 |     </span>
 470 |   </a>
 471 |   
 472 | </li>
 473 |         
 474 |           <li class="md-nav__item">
 475 |   <a href="#list_indexed_repositories" class="md-nav__link">
 476 |     <span class="md-ellipsis">
 477 |       list_indexed_repositories
 478 |     </span>
 479 |   </a>
 480 |   
 481 | </li>
 482 |         
 483 |           <li class="md-nav__item">
 484 |   <a href="#delete_repository" class="md-nav__link">
 485 |     <span class="md-ellipsis">
 486 |       delete_repository
 487 |     </span>
 488 |   </a>
 489 |   
 490 | </li>
 491 |         
 492 |           <li class="md-nav__item">
 493 |   <a href="#visualize_graph_query" class="md-nav__link">
 494 |     <span class="md-ellipsis">
 495 |       visualize_graph_query
 496 |     </span>
 497 |   </a>
 498 |   
 499 | </li>
 500 |         
 501 |           <li class="md-nav__item">
 502 |   <a href="#list_watched_paths" class="md-nav__link">
 503 |     <span class="md-ellipsis">
 504 |       list_watched_paths
 505 |     </span>
 506 |   </a>
 507 |   
 508 | </li>
 509 |         
 510 |           <li class="md-nav__item">
 511 |   <a href="#unwatch_directory" class="md-nav__link">
 512 |     <span class="md-ellipsis">
 513 |       unwatch_directory
 514 |     </span>
 515 |   </a>
 516 |   
 517 | </li>
 518 |         
 519 |       </ul>
 520 |     </nav>
 521 |   
 522 | </li>
 523 |       
 524 |         <li class="md-nav__item">
 525 |   <a href="#other-methods" class="md-nav__link">
 526 |     <span class="md-ellipsis">
 527 |       Other Methods
 528 |     </span>
 529 |   </a>
 530 |   
 531 | </li>
 532 |       
 533 |     </ul>
 534 |   
 535 | </nav>
 536 |       
 537 |     </li>
 538 |   
 539 | 
 540 |     
 541 |       
 542 |       
 543 |   
 544 |   
 545 |   
 546 |   
 547 |     <li class="md-nav__item">
 548 |       <a href="../core/" class="md-nav__link">
 549 |         
 550 |   
 551 |   
 552 |   <span class="md-ellipsis">
 553 |     Core Concepts
 554 |     
 555 |   </span>
 556 |   
 557 | 
 558 |       </a>
 559 |     </li>
 560 |   
 561 | 
 562 |     
 563 |       
 564 |       
 565 |   
 566 |   
 567 |   
 568 |   
 569 |     <li class="md-nav__item">
 570 |       <a href="../tools/" class="md-nav__link">
 571 |         
 572 |   
 573 |   
 574 |   <span class="md-ellipsis">
 575 |     Tools
 576 |     
 577 |   </span>
 578 |   
 579 | 
 580 |       </a>
 581 |     </li>
 582 |   
 583 | 
 584 |     
 585 |       
 586 |       
 587 |   
 588 |   
 589 |   
 590 |   
 591 |     <li class="md-nav__item">
 592 |       <a href="../cookbook/" class="md-nav__link">
 593 |         
 594 |   
 595 |   
 596 |   <span class="md-ellipsis">
 597 |     Cookbook
 598 |     
 599 |   </span>
 600 |   
 601 | 
 602 |       </a>
 603 |     </li>
 604 |   
 605 | 
 606 |     
 607 |       
 608 |       
 609 |   
 610 |   
 611 |   
 612 |   
 613 |     
 614 |     
 615 |     
 616 |     
 617 |     
 618 |     <li class="md-nav__item md-nav__item--nested">
 619 |       
 620 |         
 621 |         
 622 |         <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
 623 |         
 624 |           
 625 |           <label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
 626 |             
 627 |   
 628 |   
 629 |   <span class="md-ellipsis">
 630 |     Contributing
 631 |     
 632 |   </span>
 633 |   
 634 | 
 635 |             <span class="md-nav__icon md-icon"></span>
 636 |           </label>
 637 |         
 638 |         <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
 639 |           <label class="md-nav__title" for="__nav_10">
 640 |             <span class="md-nav__icon md-icon"></span>
 641 |             Contributing
 642 |           </label>
 643 |           <ul class="md-nav__list" data-md-scrollfix>
 644 |             
 645 |               
 646 |                 
 647 |   
 648 |   
 649 |   
 650 |   
 651 |     <li class="md-nav__item">
 652 |       <a href="../contributing/" class="md-nav__link">
 653 |         
 654 |   
 655 |   
 656 |   <span class="md-ellipsis">
 657 |     Overview
 658 |     
 659 |   </span>
 660 |   
 661 | 
 662 |       </a>
 663 |     </li>
 664 |   
 665 | 
 666 |               
 667 |             
 668 |               
 669 |                 
 670 |   
 671 |   
 672 |   
 673 |   
 674 |     <li class="md-nav__item">
 675 |       <a href="../contributing_languages/" class="md-nav__link">
 676 |         
 677 |   
 678 |   
 679 |   <span class="md-ellipsis">
 680 |     Adding New Languages
 681 |     
 682 |   </span>
 683 |   
 684 | 
 685 |       </a>
 686 |     </li>
 687 |   
 688 | 
 689 |               
 690 |             
 691 |           </ul>
 692 |         </nav>
 693 |       
 694 |     </li>
 695 |   
 696 | 
 697 |     
 698 |       
 699 |       
 700 |   
 701 |   
 702 |   
 703 |   
 704 |     <li class="md-nav__item">
 705 |       <a href="../troubleshooting/" class="md-nav__link">
 706 |         
 707 |   
 708 |   
 709 |   <span class="md-ellipsis">
 710 |     Troubleshooting
 711 |     
 712 |   </span>
 713 |   
 714 | 
 715 |       </a>
 716 |     </li>
 717 |   
 718 | 
 719 |     
 720 |       
 721 |       
 722 |   
 723 |   
 724 |   
 725 |   
 726 |     <li class="md-nav__item">
 727 |       <a href="../future_work/" class="md-nav__link">
 728 |         
 729 |   
 730 |   
 731 |   <span class="md-ellipsis">
 732 |     Future Work
 733 |     
 734 |   </span>
 735 |   
 736 | 
 737 |       </a>
 738 |     </li>
 739 |   
 740 | 
 741 |     
 742 |       
 743 |       
 744 |   
 745 |   
 746 |   
 747 |   
 748 |     <li class="md-nav__item">
 749 |       <a href="../license/" class="md-nav__link">
 750 |         
 751 |   
 752 |   
 753 |   <span class="md-ellipsis">
 754 |     License
 755 |     
 756 |   </span>
 757 |   
 758 | 
 759 |       </a>
 760 |     </li>
 761 |   
 762 | 
 763 |     
 764 |   </ul>
 765 | </nav>
 766 |                   </div>
 767 |                 </div>
 768 |               </div>
 769 |             
 770 |             
 771 |               
 772 |               <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
 773 |                 <div class="md-sidebar__scrollwrap">
 774 |                   <div class="md-sidebar__inner">
 775 |                     
 776 | 
 777 | <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
 778 |   
 779 |   
 780 |   
 781 |     
 782 |   
 783 |   
 784 |     <label class="md-nav__title" for="__toc">
 785 |       <span class="md-nav__icon md-icon"></span>
 786 |       Table of contents
 787 |     </label>
 788 |     <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
 789 |       
 790 |         <li class="md-nav__item">
 791 |   <a href="#initialization" class="md-nav__link">
 792 |     <span class="md-ellipsis">
 793 |       Initialization
 794 |     </span>
 795 |   </a>
 796 |   
 797 | </li>
 798 |       
 799 |         <li class="md-nav__item">
 800 |   <a href="#tool-manifest" class="md-nav__link">
 801 |     <span class="md-ellipsis">
 802 |       Tool Manifest
 803 |     </span>
 804 |   </a>
 805 |   
 806 |     <nav class="md-nav" aria-label="Tool Manifest">
 807 |       <ul class="md-nav__list">
 808 |         
 809 |           <li class="md-nav__item">
 810 |   <a href="#add_code_to_graph" class="md-nav__link">
 811 |     <span class="md-ellipsis">
 812 |       add_code_to_graph
 813 |     </span>
 814 |   </a>
 815 |   
 816 | </li>
 817 |         
 818 |           <li class="md-nav__item">
 819 |   <a href="#check_job_status" class="md-nav__link">
 820 |     <span class="md-ellipsis">
 821 |       check_job_status
 822 |     </span>
 823 |   </a>
 824 |   
 825 | </li>
 826 |         
 827 |           <li class="md-nav__item">
 828 |   <a href="#list_jobs" class="md-nav__link">
 829 |     <span class="md-ellipsis">
 830 |       list_jobs
 831 |     </span>
 832 |   </a>
 833 |   
 834 | </li>
 835 |         
 836 |           <li class="md-nav__item">
 837 |   <a href="#find_code" class="md-nav__link">
 838 |     <span class="md-ellipsis">
 839 |       find_code
 840 |     </span>
 841 |   </a>
 842 |   
 843 | </li>
 844 |         
 845 |           <li class="md-nav__item">
 846 |   <a href="#analyze_code_relationships" class="md-nav__link">
 847 |     <span class="md-ellipsis">
 848 |       analyze_code_relationships
 849 |     </span>
 850 |   </a>
 851 |   
 852 | </li>
 853 |         
 854 |           <li class="md-nav__item">
 855 |   <a href="#watch_directory" class="md-nav__link">
 856 |     <span class="md-ellipsis">
 857 |       watch_directory
 858 |     </span>
 859 |   </a>
 860 |   
 861 | </li>
 862 |         
 863 |           <li class="md-nav__item">
 864 |   <a href="#execute_cypher_query" class="md-nav__link">
 865 |     <span class="md-ellipsis">
 866 |       execute_cypher_query
 867 |     </span>
 868 |   </a>
 869 |   
 870 | </li>
 871 |         
 872 |           <li class="md-nav__item">
 873 |   <a href="#add_package_to_graph" class="md-nav__link">
 874 |     <span class="md-ellipsis">
 875 |       add_package_to_graph
 876 |     </span>
 877 |   </a>
 878 |   
 879 | </li>
 880 |         
 881 |           <li class="md-nav__item">
 882 |   <a href="#find_dead_code" class="md-nav__link">
 883 |     <span class="md-ellipsis">
 884 |       find_dead_code
 885 |     </span>
 886 |   </a>
 887 |   
 888 | </li>
 889 |         
 890 |           <li class="md-nav__item">
 891 |   <a href="#calculate_cyclomatic_complexity" class="md-nav__link">
 892 |     <span class="md-ellipsis">
 893 |       calculate_cyclomatic_complexity
 894 |     </span>
 895 |   </a>
 896 |   
 897 | </li>
 898 |         
 899 |           <li class="md-nav__item">
 900 |   <a href="#find_most_complex_functions" class="md-nav__link">
 901 |     <span class="md-ellipsis">
 902 |       find_most_complex_functions
 903 |     </span>
 904 |   </a>
 905 |   
 906 | </li>
 907 |         
 908 |           <li class="md-nav__item">
 909 |   <a href="#list_indexed_repositories" class="md-nav__link">
 910 |     <span class="md-ellipsis">
 911 |       list_indexed_repositories
 912 |     </span>
 913 |   </a>
 914 |   
 915 | </li>
 916 |         
 917 |           <li class="md-nav__item">
 918 |   <a href="#delete_repository" class="md-nav__link">
 919 |     <span class="md-ellipsis">
 920 |       delete_repository
 921 |     </span>
 922 |   </a>
 923 |   
 924 | </li>
 925 |         
 926 |           <li class="md-nav__item">
 927 |   <a href="#visualize_graph_query" class="md-nav__link">
 928 |     <span class="md-ellipsis">
 929 |       visualize_graph_query
 930 |     </span>
 931 |   </a>
 932 |   
 933 | </li>
 934 |         
 935 |           <li class="md-nav__item">
 936 |   <a href="#list_watched_paths" class="md-nav__link">
 937 |     <span class="md-ellipsis">
 938 |       list_watched_paths
 939 |     </span>
 940 |   </a>
 941 |   
 942 | </li>
 943 |         
 944 |           <li class="md-nav__item">
 945 |   <a href="#unwatch_directory" class="md-nav__link">
 946 |     <span class="md-ellipsis">
 947 |       unwatch_directory
 948 |     </span>
 949 |   </a>
 950 |   
 951 | </li>
 952 |         
 953 |       </ul>
 954 |     </nav>
 955 |   
 956 | </li>
 957 |       
 958 |         <li class="md-nav__item">
 959 |   <a href="#other-methods" class="md-nav__link">
 960 |     <span class="md-ellipsis">
 961 |       Other Methods
 962 |     </span>
 963 |   </a>
 964 |   
 965 | </li>
 966 |       
 967 |     </ul>
 968 |   
 969 | </nav>
 970 |                   </div>
 971 |                 </div>
 972 |               </div>
 973 |             
 974 |           
 975 |           
 976 |             <div class="md-content" data-md-component="content">
 977 |               <article class="md-content__inner md-typeset">
 978 |                 
 979 |                   
 980 | 
 981 | 
 982 | 
 983 | <h1 id="mcpserver">MCPServer</h1>
 984 | <p>The <code>MCPServer</code> class is the core of the CodeGraphContext application. It orchestrates all the major components, including database management, background job tracking, file system watching, and tool handling.</p>
 985 | <h2 id="initialization">Initialization</h2>
 986 | <p>The server is initialized with an asyncio event loop. Upon initialization, it sets up the following components:</p>
 987 | <ul>
 988 | <li><code>DatabaseManager</code>: Manages the connection to the Neo4j database.</li>
 989 | <li><code>JobManager</code>: Tracks the status of background jobs, such as code indexing.</li>
 990 | <li><code>CodeWatcher</code>: Monitors the file system for changes to keep the code graph up-to-date.</li>
 991 | <li><code>GraphBuilder</code>: Builds the code graph from the source code.</li>
 992 | <li><code>CodeFinder</code>: Provides tools for searching and analyzing the code graph.</li>
 993 | </ul>
 994 | <h2 id="tool-manifest">Tool Manifest</h2>
 995 | <p>The <code>MCPServer</code> exposes a set of tools to the AI assistant. These tools are defined in the <code>_init_tools</code> method. Here is a list of available tools:</p>
 996 | <h3 id="add_code_to_graph"><code>add_code_to_graph</code></h3>
 997 | <p>Performs a one-time scan of a local folder to add its code to the graph. Ideal for indexing libraries, dependencies, or projects not being actively modified. Returns a job ID for background processing.</p>
 998 | <h3 id="check_job_status"><code>check_job_status</code></h3>
 999 | <p>Check the status and progress of a background job.</p>
1000 | <h3 id="list_jobs"><code>list_jobs</code></h3>
1001 | <p>List all background jobs and their current status.</p>
1002 | <h3 id="find_code"><code>find_code</code></h3>
1003 | <p>Find relevant code snippets related to a keyword (e.g., function name, class name, or content).</p>
1004 | <h3 id="analyze_code_relationships"><code>analyze_code_relationships</code></h3>
1005 | <p>Analyze code relationships like 'who calls this function' or 'class hierarchy'. Supported query types include: find_callers, find_callees, find_all_callers, find_all_callees, find_importers, who_modifies, class_hierarchy, overrides, dead_code, call_chain, module_deps, variable_scope, find_complexity, find_functions_by_argument, find_functions_by_decorator.</p>
1006 | <h3 id="watch_directory"><code>watch_directory</code></h3>
1007 | <p>Performs an initial scan of a directory and then continuously monitors it for changes, automatically keeping the graph up-to-date. Ideal for projects under active development. Returns a job ID for the initial scan.</p>
1008 | <h3 id="execute_cypher_query"><code>execute_cypher_query</code></h3>
1009 | <p>This is an advanced tool for directly querying the underlying Neo4j graph using a read-only Cypher query. It should be used as a fallback when other tools cannot answer very specific or complex questions about the code graph.</p>
1010 | <p><strong>Schema Overview:</strong></p>
1011 | <p>The code graph has the following structure:</p>
1012 | <ul>
1013 | <li><strong>Nodes:</strong><ul>
1014 | <li><code>Repository</code>: Represents a project repository.</li>
1015 | <li><code>File</code>: Represents a single source code file.</li>
1016 | <li><code>Module</code>: Represents a package or a module.</li>
1017 | <li><code>Class</code>: Represents a class definition.</li>
1018 | <li><code>Function</code>: Represents a function or method definition.</li>
1019 | </ul>
1020 | </li>
1021 | <li><strong>Properties:</strong><ul>
1022 | <li>Nodes have properties like <code>name</code>, <code>path</code>, <code>cyclomatic_complexity</code> (for functions), and <code>code</code>.</li>
1023 | </ul>
1024 | </li>
1025 | <li><strong>Relationships:</strong><ul>
1026 | <li><code>CONTAINS</code>: e.g., <code>(:File)-[:CONTAINS]-&gt;(:Function)</code></li>
1027 | <li><code>CALLS</code>: e.g., <code>(:Function)-[:CALLS]-&gt;(:Function)</code></li>
1028 | <li><code>IMPORTS</code>: e.g., <code>(:File)-[:IMPORTS]-&gt;(:Module)</code></li>
1029 | <li><code>INHERITS</code>: e.g., <code>(:Class)-[:INHERITS]-&gt;(:Class)</code></li>
1030 | </ul>
1031 | </li>
1032 | </ul>
1033 | <h3 id="add_package_to_graph"><code>add_package_to_graph</code></h3>
1034 | <p>Add a Python package to Neo4j graph by discovering its location. Returns immediately with job ID.</p>
1035 | <h3 id="find_dead_code"><code>find_dead_code</code></h3>
1036 | <p>Find potentially unused functions (dead code) across the entire indexed codebase, optionally excluding functions with specific decorators.</p>
1037 | <h3 id="calculate_cyclomatic_complexity"><code>calculate_cyclomatic_complexity</code></h3>
1038 | <p>Calculate the cyclomatic complexity of a specific function to measure its complexity.</p>
1039 | <h3 id="find_most_complex_functions"><code>find_most_complex_functions</code></h3>
1040 | <p>Find the most complex functions in the codebase based on cyclomatic complexity.</p>
1041 | <h3 id="list_indexed_repositories"><code>list_indexed_repositories</code></h3>
1042 | <p>List all indexed repositories.</p>
1043 | <h3 id="delete_repository"><code>delete_repository</code></h3>
1044 | <p>Delete an indexed repository from the graph.</p>
1045 | <h3 id="visualize_graph_query"><code>visualize_graph_query</code></h3>
1046 | <p>Generates a URL to visualize the results of a Cypher query in the Neo4j Browser. The user can open this URL in their web browser to see the graph visualization.</p>
1047 | <h3 id="list_watched_paths"><code>list_watched_paths</code></h3>
1048 | <p>Lists all directories currently being watched for live file changes.</p>
1049 | <h3 id="unwatch_directory"><code>unwatch_directory</code></h3>
1050 | <p>Stops watching a directory for live file changes.</p>
1051 | <h2 id="other-methods">Other Methods</h2>
1052 | <ul>
1053 | <li><code>get_database_status()</code>: Returns the current connection status of the Neo4j database.</li>
1054 | <li><code>get_local_package_path(package_name)</code>: Finds the local installation path of a Python package.</li>
1055 | <li><code>run()</code>: Runs the main server loop, listening for JSON-RPC requests from stdin.</li>
1056 | <li><code>shutdown()</code>: Gracefully shuts down the server and its components.</li>
1057 | </ul>
1058 | 
1059 | 
1060 | 
1061 | 
1062 | 
1063 | 
1064 | 
1065 | 
1066 | 
1067 | 
1068 | 
1069 | 
1070 |                 
1071 |               </article>
1072 |             </div>
1073 |           
1074 |           
1075 | <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
1076 |         </div>
1077 |         
1078 |       </main>
1079 |       
1080 |         <footer class="md-footer">
1081 |   
1082 |   <div class="md-footer-meta md-typeset">
1083 |     <div class="md-footer-meta__inner md-grid">
1084 |       <div class="md-copyright">
1085 |   
1086 |   
1087 |     Made with
1088 |     <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
1089 |       Material for MkDocs
1090 |     </a>
1091 |   
1092 | </div>
1093 |       
1094 |     </div>
1095 |   </div>
1096 | </footer>
1097 |       
1098 |     </div>
1099 |     <div class="md-dialog" data-md-component="dialog">
1100 |       <div class="md-dialog__inner md-typeset"></div>
1101 |     </div>
1102 |     
1103 |     
1104 |     
1105 |       
1106 |       <script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
1107 |     
1108 |     
1109 |       <script src="../assets/javascripts/bundle.f55a23d4.min.js"></script>
1110 |       
1111 |     
1112 |   </body>
1113 | </html>
```

--------------------------------------------------------------------------------
/docs/site/index.html:
--------------------------------------------------------------------------------

```html
  1 | 
  2 | <!doctype html>
  3 | <html lang="en" class="no-js">
  4 |   <head>
  5 |     
  6 |       <meta charset="utf-8">
  7 |       <meta name="viewport" content="width=device-width,initial-scale=1">
  8 |       
  9 |       
 10 |       
 11 |       
 12 |       
 13 |         <link rel="next" href="installation/">
 14 |       
 15 |       
 16 |       <link rel="icon" href="assets/images/favicon.png">
 17 |       <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.21">
 18 |     
 19 |     
 20 |       
 21 |         <title>CodeGraphContext</title>
 22 |       
 23 |     
 24 |     
 25 |       <link rel="stylesheet" href="assets/stylesheets/main.2a3383ac.min.css">
 26 |       
 27 |       
 28 | 
 29 | 
 30 |     
 31 |     
 32 |       
 33 |     
 34 |     
 35 |       
 36 |         
 37 |         
 38 |         <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 39 |         <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
 40 |         <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
 41 |       
 42 |     
 43 |     
 44 |     <script>__md_scope=new URL(".",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
 45 |     
 46 |       
 47 | 
 48 |     
 49 |     
 50 |     
 51 |   </head>
 52 |   
 53 |   
 54 |     <body dir="ltr">
 55 |   
 56 |     
 57 |     <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
 58 |     <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
 59 |     <label class="md-overlay" for="__drawer"></label>
 60 |     <div data-md-component="skip">
 61 |       
 62 |         
 63 |         <a href="#welcome-to-codegraphcontext" class="md-skip">
 64 |           Skip to content
 65 |         </a>
 66 |       
 67 |     </div>
 68 |     <div data-md-component="announce">
 69 |       
 70 |     </div>
 71 |     
 72 |     
 73 |       
 74 | 
 75 |   
 76 | 
 77 | <header class="md-header md-header--shadow" data-md-component="header">
 78 |   <nav class="md-header__inner md-grid" aria-label="Header">
 79 |     <a href="." title="CodeGraphContext" class="md-header__button md-logo" aria-label="CodeGraphContext" data-md-component="logo">
 80 |       
 81 |   
 82 |   <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
 83 | 
 84 |     </a>
 85 |     <label class="md-header__button md-icon" for="__drawer">
 86 |       
 87 |       <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
 88 |     </label>
 89 |     <div class="md-header__title" data-md-component="header-title">
 90 |       <div class="md-header__ellipsis">
 91 |         <div class="md-header__topic">
 92 |           <span class="md-ellipsis">
 93 |             CodeGraphContext
 94 |           </span>
 95 |         </div>
 96 |         <div class="md-header__topic" data-md-component="header-topic">
 97 |           <span class="md-ellipsis">
 98 |             
 99 |               Home
100 |             
101 |           </span>
102 |         </div>
103 |       </div>
104 |     </div>
105 |     
106 |     
107 |       <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
108 |     
109 |     
110 |     
111 |       
112 |       
113 |         <label class="md-header__button md-icon" for="__search">
114 |           
115 |           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
116 |         </label>
117 |         <div class="md-search" data-md-component="search" role="dialog">
118 |   <label class="md-search__overlay" for="__search"></label>
119 |   <div class="md-search__inner" role="search">
120 |     <form class="md-search__form" name="search">
121 |       <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
122 |       <label class="md-search__icon md-icon" for="__search">
123 |         
124 |         <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
125 |         
126 |         <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
127 |       </label>
128 |       <nav class="md-search__options" aria-label="Search">
129 |         
130 |         <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
131 |           
132 |           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
133 |         </button>
134 |       </nav>
135 |       
136 |     </form>
137 |     <div class="md-search__output">
138 |       <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
139 |         <div class="md-search-result" data-md-component="search-result">
140 |           <div class="md-search-result__meta">
141 |             Initializing search
142 |           </div>
143 |           <ol class="md-search-result__list" role="presentation"></ol>
144 |         </div>
145 |       </div>
146 |     </div>
147 |   </div>
148 | </div>
149 |       
150 |     
151 |     
152 |   </nav>
153 |   
154 | </header>
155 |     
156 |     <div class="md-container" data-md-component="container">
157 |       
158 |       
159 |         
160 |           
161 |         
162 |       
163 |       <main class="md-main" data-md-component="main">
164 |         <div class="md-main__inner md-grid">
165 |           
166 |             
167 |               
168 |               <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
169 |                 <div class="md-sidebar__scrollwrap">
170 |                   <div class="md-sidebar__inner">
171 |                     
172 | 
173 | 
174 | 
175 | <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
176 |   <label class="md-nav__title" for="__drawer">
177 |     <a href="." title="CodeGraphContext" class="md-nav__button md-logo" aria-label="CodeGraphContext" data-md-component="logo">
178 |       
179 |   
180 |   <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
181 | 
182 |     </a>
183 |     CodeGraphContext
184 |   </label>
185 |   
186 |   <ul class="md-nav__list" data-md-scrollfix>
187 |     
188 |       
189 |       
190 |   
191 |   
192 |     
193 |   
194 |   
195 |   
196 |     <li class="md-nav__item md-nav__item--active">
197 |       
198 |       <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
199 |       
200 |       
201 |         
202 |       
203 |       
204 |       <a href="." class="md-nav__link md-nav__link--active">
205 |         
206 |   
207 |   
208 |   <span class="md-ellipsis">
209 |     Home
210 |     
211 |   </span>
212 |   
213 | 
214 |       </a>
215 |       
216 |     </li>
217 |   
218 | 
219 |     
220 |       
221 |       
222 |   
223 |   
224 |   
225 |   
226 |     <li class="md-nav__item">
227 |       <a href="installation/" class="md-nav__link">
228 |         
229 |   
230 |   
231 |   <span class="md-ellipsis">
232 |     Installation
233 |     
234 |   </span>
235 |   
236 | 
237 |       </a>
238 |     </li>
239 |   
240 | 
241 |     
242 |       
243 |       
244 |   
245 |   
246 |   
247 |   
248 |     <li class="md-nav__item">
249 |       <a href="use_cases/" class="md-nav__link">
250 |         
251 |   
252 |   
253 |   <span class="md-ellipsis">
254 |     Use Cases
255 |     
256 |   </span>
257 |   
258 | 
259 |       </a>
260 |     </li>
261 |   
262 | 
263 |     
264 |       
265 |       
266 |   
267 |   
268 |   
269 |   
270 |     <li class="md-nav__item">
271 |       <a href="architecture/" class="md-nav__link">
272 |         
273 |   
274 |   
275 |   <span class="md-ellipsis">
276 |     Architecture
277 |     
278 |   </span>
279 |   
280 | 
281 |       </a>
282 |     </li>
283 |   
284 | 
285 |     
286 |       
287 |       
288 |   
289 |   
290 |   
291 |   
292 |     <li class="md-nav__item">
293 |       <a href="cli/" class="md-nav__link">
294 |         
295 |   
296 |   
297 |   <span class="md-ellipsis">
298 |     CLI Reference
299 |     
300 |   </span>
301 |   
302 | 
303 |       </a>
304 |     </li>
305 |   
306 | 
307 |     
308 |       
309 |       
310 |   
311 |   
312 |   
313 |   
314 |     <li class="md-nav__item">
315 |       <a href="server/" class="md-nav__link">
316 |         
317 |   
318 |   
319 |   <span class="md-ellipsis">
320 |     Server
321 |     
322 |   </span>
323 |   
324 | 
325 |       </a>
326 |     </li>
327 |   
328 | 
329 |     
330 |       
331 |       
332 |   
333 |   
334 |   
335 |   
336 |     <li class="md-nav__item">
337 |       <a href="core/" class="md-nav__link">
338 |         
339 |   
340 |   
341 |   <span class="md-ellipsis">
342 |     Core Concepts
343 |     
344 |   </span>
345 |   
346 | 
347 |       </a>
348 |     </li>
349 |   
350 | 
351 |     
352 |       
353 |       
354 |   
355 |   
356 |   
357 |   
358 |     <li class="md-nav__item">
359 |       <a href="tools/" class="md-nav__link">
360 |         
361 |   
362 |   
363 |   <span class="md-ellipsis">
364 |     Tools
365 |     
366 |   </span>
367 |   
368 | 
369 |       </a>
370 |     </li>
371 |   
372 | 
373 |     
374 |       
375 |       
376 |   
377 |   
378 |   
379 |   
380 |     <li class="md-nav__item">
381 |       <a href="cookbook/" class="md-nav__link">
382 |         
383 |   
384 |   
385 |   <span class="md-ellipsis">
386 |     Cookbook
387 |     
388 |   </span>
389 |   
390 | 
391 |       </a>
392 |     </li>
393 |   
394 | 
395 |     
396 |       
397 |       
398 |   
399 |   
400 |   
401 |   
402 |     
403 |     
404 |     
405 |     
406 |     
407 |     <li class="md-nav__item md-nav__item--nested">
408 |       
409 |         
410 |         
411 |         <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" >
412 |         
413 |           
414 |           <label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
415 |             
416 |   
417 |   
418 |   <span class="md-ellipsis">
419 |     Contributing
420 |     
421 |   </span>
422 |   
423 | 
424 |             <span class="md-nav__icon md-icon"></span>
425 |           </label>
426 |         
427 |         <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="false">
428 |           <label class="md-nav__title" for="__nav_10">
429 |             <span class="md-nav__icon md-icon"></span>
430 |             Contributing
431 |           </label>
432 |           <ul class="md-nav__list" data-md-scrollfix>
433 |             
434 |               
435 |                 
436 |   
437 |   
438 |   
439 |   
440 |     <li class="md-nav__item">
441 |       <a href="contributing/" class="md-nav__link">
442 |         
443 |   
444 |   
445 |   <span class="md-ellipsis">
446 |     Overview
447 |     
448 |   </span>
449 |   
450 | 
451 |       </a>
452 |     </li>
453 |   
454 | 
455 |               
456 |             
457 |               
458 |                 
459 |   
460 |   
461 |   
462 |   
463 |     <li class="md-nav__item">
464 |       <a href="contributing_languages/" class="md-nav__link">
465 |         
466 |   
467 |   
468 |   <span class="md-ellipsis">
469 |     Adding New Languages
470 |     
471 |   </span>
472 |   
473 | 
474 |       </a>
475 |     </li>
476 |   
477 | 
478 |               
479 |             
480 |           </ul>
481 |         </nav>
482 |       
483 |     </li>
484 |   
485 | 
486 |     
487 |       
488 |       
489 |   
490 |   
491 |   
492 |   
493 |     <li class="md-nav__item">
494 |       <a href="troubleshooting/" class="md-nav__link">
495 |         
496 |   
497 |   
498 |   <span class="md-ellipsis">
499 |     Troubleshooting
500 |     
501 |   </span>
502 |   
503 | 
504 |       </a>
505 |     </li>
506 |   
507 | 
508 |     
509 |       
510 |       
511 |   
512 |   
513 |   
514 |   
515 |     <li class="md-nav__item">
516 |       <a href="future_work/" class="md-nav__link">
517 |         
518 |   
519 |   
520 |   <span class="md-ellipsis">
521 |     Future Work
522 |     
523 |   </span>
524 |   
525 | 
526 |       </a>
527 |     </li>
528 |   
529 | 
530 |     
531 |       
532 |       
533 |   
534 |   
535 |   
536 |   
537 |     <li class="md-nav__item">
538 |       <a href="license/" class="md-nav__link">
539 |         
540 |   
541 |   
542 |   <span class="md-ellipsis">
543 |     License
544 |     
545 |   </span>
546 |   
547 | 
548 |       </a>
549 |     </li>
550 |   
551 | 
552 |     
553 |   </ul>
554 | </nav>
555 |                   </div>
556 |                 </div>
557 |               </div>
558 |             
559 |             
560 |               
561 |               <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
562 |                 <div class="md-sidebar__scrollwrap">
563 |                   <div class="md-sidebar__inner">
564 |                     
565 | 
566 | <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
567 |   
568 |   
569 |   
570 |     
571 |   
572 |   
573 | </nav>
574 |                   </div>
575 |                 </div>
576 |               </div>
577 |             
578 |           
579 |           
580 |             <div class="md-content" data-md-component="content">
581 |               <article class="md-content__inner md-typeset">
582 |                 
583 |                   
584 | 
585 | 
586 | 
587 | <h1 id="welcome-to-codegraphcontext">Welcome to CodeGraphContext</h1>
588 | <p>This is the official documentation for CodeGraphContext.</p>
589 | <hr />
590 | <h1 id="codegraphcontext">CodeGraphContext</h1>
591 | <!-- ====== Project stats ====== -->
592 | <p><a href="https://github.com/Shashankss1205/CodeGraphContext/stargazers"><img alt="Stars" src="https://img.shields.io/github/stars/Shashankss1205/CodeGraphContext?logo=github" /></a>
593 | <a href="https://github.com/Shashankss1205/CodeGraphContext/network/members"><img alt="Forks" src="https://img.shields.io/github/forks/Shashankss1205/CodeGraphContext?logo=github" /></a>
594 | <a href="https://github.com/Shashankss1205/CodeGraphContext/issues"><img alt="Open Issues" src="https://img.shields.io/github/issues-raw/Shashankss1205/CodeGraphContext?logo=github" /></a>
595 | <a href="https://github.com/Shashankss1205/CodeGraphContext/pulls"><img alt="Open PRs" src="https://img.shields.io/github/issues-pr/Shashankss1205/CodeGraphContext?logo=github" /></a>
596 | <a href="https://github.com/Shashankss1205/CodeGraphContext/pulls?q=is%3Apr+is%3Aclosed"><img alt="Closed PRs" src="https://img.shields.io/github/issues-pr-closed/Shashankss1205/CodeGraphContext?logo=github&amp;color=lightgrey" /></a>
597 | <a href="https://github.com/Shashankss1205/CodeGraphContext/graphs/contributors"><img alt="Contributors" src="https://img.shields.io/github/contributors/Shashankss1205/CodeGraphContext?logo=github" /></a>
598 | <a href="https://github.com/Shashankss1205/CodeGraphContext"><img alt="Languages" src="https://img.shields.io/github/languages/count/Shashankss1205/CodeGraphContext?logo=github" /></a>
599 | <a href="https://github.com/Shashankss1205/CodeGraphContext/actions/workflows/test.yml"><img alt="Build Status" src="https://github.com/Shashankss1205/CodeGraphContext/actions/workflows/test.yml/badge.svg" /></a>
600 | <a href="https://github.com/Shashankss1205/CodeGraphContext/actions/workflows/e2e-tests.yml"><img alt="Build Status" src="https://github.com/Shashankss1205/CodeGraphContext/actions/workflows/e2e-tests.yml/badge.svg" /></a>
601 | <a href="https://pypi.org/project/codegraphcontext/"><img alt="PyPI version" src="https://img.shields.io/pypi/v/codegraphcontext?" /></a>
602 | <a href="https://pypi.org/project/codegraphcontext/"><img alt="PyPI downloads" src="https://img.shields.io/pypi/dm/codegraphcontext?" /></a>
603 | <a href="license/"><img alt="License" src="https://img.shields.io/github/license/Shashankss1205/CodeGraphContext?" /></a>
604 | <a href="http://codegraphcontext.vercel.app/"><img alt="Website" src="https://img.shields.io/badge/website-up-brightgreen?" /></a>
605 | <a href="https://youtu.be/KYYSdxhg1xU"><img alt="YouTube" src="https://img.shields.io/badge/YouTube-Watch%20Demo-red?logo=youtube" /></a>
606 | <a href="https://discord.gg/dR4QY32uYQ"><img alt="Discord" src="https://img.shields.io/badge/Discord-Join%20Chat-7289da?logo=discord&amp;logoColor=white" /></a></p>
607 | <p>An MCP server that indexes local code into a graph database to provide context to AI assistants.</p>
608 | <h3 id="indexing-a-codebase">Indexing a codebase</h3>
609 | <p><img alt="Indexing using an MCP client" src="images/Indexing.gif" /></p>
610 | <h3 id="using-the-mcp-server">Using the MCP server</h3>
611 | <p><img alt="Using the MCP server" src="images/Usecase.gif" /></p>
612 | <h2 id="project-details">Project Details</h2>
613 | <ul>
614 | <li><strong>Version:</strong> 0.1.15</li>
615 | <li><strong>Authors:</strong> Shashank Shekhar Singh <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#115;&#104;&#97;&#115;&#104;&#97;&#110;&#107;&#115;&#104;&#101;&#107;&#104;&#97;&#114;&#115;&#105;&#110;&#103;&#104;&#49;&#50;&#48;&#53;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;">&#115;&#104;&#97;&#115;&#104;&#97;&#110;&#107;&#115;&#104;&#101;&#107;&#104;&#97;&#114;&#115;&#105;&#110;&#103;&#104;&#49;&#50;&#48;&#53;&#64;&#103;&#109;&#97;&#105;&#108;&#46;&#99;&#111;&#109;</a></li>
616 | <li><strong>License:</strong> MIT License (See <a href="license/">LICENSE</a> for details)</li>
617 | <li><strong>Website:</strong> <a href="http://codegraphcontext.vercel.app/">CodeGraphContext</a></li>
618 | </ul>
619 | <h2 id="star-history">Star History</h2>
620 | <p><a href="https://www.star-history.com/#Shashankss1205/CodeGraphContext&amp;Date"><img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Shashankss1205/CodeGraphContext&amp;type=Date" /></a></p>
621 | <h2 id="features">Features</h2>
622 | <ul>
623 | <li><strong>Code Indexing:</strong> Analyzes code and builds a knowledge graph of its components.</li>
624 | <li><strong>Relationship Analysis:</strong> Query for callers, callees, class hierarchies, call chains and more.</li>
625 | <li><strong>Live Updates:</strong> Watches local files for changes and automatically updates the graph.</li>
626 | <li><strong>Interactive Setup:</strong> A user-friendly command-line wizard for easy setup.</li>
627 | <li><strong>File Exclusion:</strong> Supports <code>.cgcignore</code> files to exclude specific files and directories from indexing.</li>
628 | </ul>
629 | <h2 id="used-by">Used By</h2>
630 | <p>CodeGraphContext is already being explored by developers and projects for:</p>
631 | <ul>
632 | <li><strong>Static code analysis in AI assistants</strong></li>
633 | <li><strong>Graph-based visualization of projects</strong></li>
634 | <li><strong>Dead code and complexity detection</strong></li>
635 | </ul>
636 | <p>If you’re using CodeGraphContext in your project, feel free to open a PR and add it here! 🚀</p>
637 | <h2 id="dependencies">Dependencies</h2>
638 | <ul>
639 | <li><code>neo4j&gt;=5.15.0</code></li>
640 | <li><code>watchdog&gt;=3.0.0</code></li>
641 | <li><code>requests&gt;=2.31.0</code></li>
642 | <li><code>stdlibs&gt;=2023.11.18</code></li>
643 | <li><code>typer[all]&gt;=0.9.0</code></li>
644 | <li><code>rich&gt;=13.7.0</code></li>
645 | <li><code>inquirerpy&gt;=0.3.4</code></li>
646 | <li><code>python-dotenv&gt;=1.0.0</code></li>
647 | <li><code>tree-sitter==0.20.4</code></li>
648 | <li><code>tree-sitter-languages==1.10.2</code></li>
649 | </ul>
650 | <h2 id="getting-started">Getting Started</h2>
651 | <ol>
652 | <li><strong>Install:</strong> <code>pip install codegraphcontext</code></li>
653 | <li>
654 | <p><strong>Configure Your Environment:</strong>
655 |     Run the interactive setup wizard to connect to your database and configure your IDE:
656 |     <code>bash
657 |     cgc setup</code>
658 |     The wizard helps you with:</p>
659 | <ul>
660 | <li><strong>Database Connection:</strong><ul>
661 | <li><strong>Docker (Recommended):</strong> Automatically sets up a local Neo4j instance.</li>
662 | <li><strong>Linux Binary:</strong> Installs Neo4j directly on Debian-based systems.</li>
663 | <li><strong>Hosted:</strong> Connects to a remote Neo4j database like AuraDB.</li>
664 | </ul>
665 | </li>
666 | <li><strong>IDE Integration:</strong><ul>
667 | <li>Automatically configures tools like VS Code, Cursor, Gemini CLI, and more.</li>
668 | <li>Generates the necessary <code>mcp.json</code> and <code>.env</code> files for you.</li>
669 | </ul>
670 | </li>
671 | </ul>
672 | </li>
673 | <li>
674 | <p><strong>Start:</strong> <code>cgc start</code></p>
675 | </li>
676 | </ol>
677 | <h2 id="mcp-client-configuration">MCP Client Configuration</h2>
678 | <p>The <code>cgc setup</code> command attempts to automatically configure your IDE/CLI. If you choose not to use the automatic setup, or if your tool is not supported, you can configure it manually.</p>
679 | <p>Add the following server configuration to your client's settings file (e.g., VS Code's <code>settings.json</code> or <code>.claude.json</code>):</p>
680 | <pre><code class="language-json">{
681 |   &quot;mcpServers&quot;: {
682 |     &quot;CodeGraphContext&quot;: {
683 |       &quot;command&quot;: &quot;cgc&quot;,
684 |       &quot;args&quot;: [
685 |         &quot;start&quot;
686 |       ],
687 |       &quot;env&quot;: {
688 |         &quot;NEO4J_URI&quot;: &quot;YOUR_NEO4J_URI&quot;,
689 |         &quot;NEO4J_USERNAME&quot;: &quot;YOUR_NEO4J_USERNAME&quot;,
690 |         &quot;NEO4J_PASSWORD&quot;: &quot;YOUR_NEO4J_PASSWORD&quot;
691 |       },
692 |       &quot;tools&quot;: {
693 |         &quot;alwaysAllow&quot;: [
694 |           &quot;add_code_to_graph&quot;,
695 |           &quot;add_package_to_graph&quot;,
696 |           &quot;check_job_status&quot;,
697 |           &quot;list_jobs&quot;,
698 |           &quot;find_code&quot;,
699 |           &quot;analyze_code_relationships&quot;,
700 |           &quot;watch_directory&quot;,
701 |           &quot;find_dead_code&quot;,
702 |           &quot;execute_cypher_query&quot;,
703 |           &quot;calculate_cyclomatic_complexity&quot;,
704 |           &quot;find_most_complex_functions&quot;,
705 |           &quot;list_indexed_repositories&quot;,
706 |           &quot;delete_repository&quot;,
707 |           &quot;visualize_graph_query&quot;,
708 |           &quot;list_watched_paths&quot;,
709 |           &quot;unwatch_directory&quot;
710 |         ],
711 |         &quot;disabled&quot;: false
712 |       },
713 |       &quot;disabled&quot;: false,
714 |       &quot;alwaysAllow&quot;: []
715 |     }
716 |   }
717 | }
718 | </code></pre>
719 | <h2 id="natural-language-interaction-examples">Natural Language Interaction Examples</h2>
720 | <p>Once the server is running, you can interact with it through your AI assistant using plain English. Here are some examples of what you can say:</p>
721 | <h3 id="indexing-and-watching-files">Indexing and Watching Files</h3>
722 | <ul>
723 | <li>
724 | <p><strong>To index a new project:</strong></p>
725 | <ul>
726 | <li>"Please index the code in the <code>/path/to/my-project</code> directory."
727 | OR</li>
728 | <li>"Add the project at <code>~/dev/my-other-project</code> to the code graph."</li>
729 | </ul>
730 | </li>
731 | <li>
732 | <p><strong>To start watching a directory for live changes:</strong></p>
733 | <ul>
734 | <li>"Watch the <code>/path/to/my-active-project</code> directory for changes."
735 | OR</li>
736 | <li>"Keep the code graph updated for the project I'm working on at <code>~/dev/main-app</code>."</li>
737 | </ul>
738 | <p>When you ask to watch a directory, the system performs two actions at once:
739 | 1.  It kicks off a full scan to index all the code in that directory. This process runs in the background, and you'll receive a <code>job_id</code> to track its progress.
740 | 2.  It begins watching the directory for any file changes to keep the graph updated in real-time.</p>
741 | <p>This means you can start by simply telling the system to watch a directory, and it will handle both the initial indexing and the continuous updates automatically.</p>
742 | </li>
743 | </ul>
744 | <h3 id="querying-and-understanding-code">Querying and Understanding Code</h3>
745 | <ul>
746 | <li>
747 | <p><strong>Finding where code is defined:</strong></p>
748 | <ul>
749 | <li>"Where is the <code>process_payment</code> function?"</li>
750 | <li>"Find the <code>User</code> class for me."</li>
751 | <li>"Show me any code related to 'database connection'."</li>
752 | </ul>
753 | </li>
754 | <li>
755 | <p><strong>Analyzing relationships and impact:</strong></p>
756 | <ul>
757 | <li>"What other functions call the <code>get_user_by_id</code> function?"</li>
758 | <li>"If I change the <code>calculate_tax</code> function, what other parts of the code will be affected?"</li>
759 | <li>"Show me the inheritance hierarchy for the <code>BaseController</code> class."</li>
760 | <li>"What methods does the <code>Order</code> class have?"</li>
761 | </ul>
762 | </li>
763 | <li>
764 | <p><strong>Exploring dependencies:</strong></p>
765 | <ul>
766 | <li>"Which files import the <code>requests</code> library?"</li>
767 | <li>"Find all implementations of the <code>render</code> method."</li>
768 | </ul>
769 | </li>
770 | <li>
771 | <p><strong>Advanced Call Chain and Dependency Tracking (Spanning Hundreds of Files):</strong>
772 |     The CodeGraphContext excels at tracing complex execution flows and dependencies across vast codebases. Leveraging the power of graph databases, it can identify direct and indirect callers and callees, even when a function is called through multiple layers of abstraction or across numerous files. This is invaluable for:</p>
773 | <ul>
774 | <li><strong>Impact Analysis:</strong> Understand the full ripple effect of a change to a core function.</li>
775 | <li><strong>Debugging:</strong> Trace the path of execution from an entry point to a specific bug.</li>
776 | <li>
777 | <p><strong>Code Comprehension:</strong> Grasp how different parts of a large system interact.</p>
778 | </li>
779 | <li>
780 | <p>"Show me the full call chain from the <code>main</code> function to <code>process_data</code>."</p>
781 | </li>
782 | <li>"Find all functions that directly or indirectly call <code>validate_input</code>."</li>
783 | <li>"What are all the functions that <code>initialize_system</code> eventually calls?"</li>
784 | <li>"Trace the dependencies of the <code>DatabaseManager</code> module."</li>
785 | </ul>
786 | </li>
787 | <li>
788 | <p><strong>Code Quality and Maintenance:</strong></p>
789 | <ul>
790 | <li>"Is there any dead or unused code in this project?"</li>
791 | <li>"Calculate the cyclomatic complexity of the <code>process_data</code> function in <code>src/utils.py</code>."</li>
792 | <li>"Find the 5 most complex functions in the codebase."</li>
793 | </ul>
794 | </li>
795 | <li>
796 | <p><strong>Repository Management:</strong></p>
797 | <ul>
798 | <li>"List all currently indexed repositories."</li>
799 | <li>"Delete the indexed repository at <code>/path/to/old-project</code>."</li>
800 | </ul>
801 | </li>
802 | </ul>
803 | <h2 id="social-coverage">Social Coverage</h2>
804 | <ul>
805 | <li><strong>Youtube:</strong> <a href="https://www.youtube.com/watch?v=KYYSdxhg1xU">https://www.youtube.com/watch?v=KYYSdxhg1xU</a></li>
806 | <li><strong>Blog:</strong> <a href="https://medium.com/@shashankshekharsingh1205/building-codegraphcontext-my-end-term-journey-in-summer-of-bitcoin-2025-422c9a4dc87e">https://medium.com/@shashankshekharsingh1205/building-codegraphcontext-my-end-term-journey-in-summer-of-bitcoin-2025-422c9a4dc87e</a></li>
807 | <li><strong>Twitter:</strong> <a href="https://x.com/braidpool/status/1968683721625637203">https://x.com/braidpool/status/1968683721625637203</a></li>
808 | <li><strong>PulseMCP:</strong> <a href="https://www.pulsemcp.com/servers/codegraphcontext">https://www.pulsemcp.com/servers/codegraphcontext</a></li>
809 | <li><strong>MCPMarket:</strong> <a href="https://mcpmarket.com/server/codegraphcontext">https://mcpmarket.com/server/codegraphcontext</a></li>
810 | <li><strong>Playbooks:</strong> <a href="https://playbooks.com/mcp/codegraphcontext">https://playbooks.com/mcp/codegraphcontext</a></li>
811 | <li><strong>MCPHunt:</strong> <a href="https://mcp-hunt.com/mcp/server/codegraphcontext">https://mcp-hunt.com/mcp/server/codegraphcontext</a></li>
812 | <li><strong>StackerNews:</strong> <a href="https://stacker.news/items/1227191">https://stacker.news/items/1227191</a></li>
813 | <li><strong>Glama.ai:</strong> <a href="https://glama.ai/mcp/servers/@Shashankss1205/CodeGraphContext/blob/a346d340d8f705ce93626b4b322dd0e2823ba46b/src/codegraphcontext/core/jobs.py">https://glama.ai/mcp/servers/@Shashankss1205/CodeGraphContext/blob/a346d340d8f705ce93626b4b322dd0e2823ba46b/src/codegraphcontext/core/jobs.py</a></li>
814 | </ul>
815 | <h2 id="contributing">Contributing</h2>
816 | <p>Contributions are welcome! 🎉<br />
817 | Please see our <a href="contributing/">CONTRIBUTING.md</a> for detailed guidelines.
818 | If you have ideas for new features, integrations, or improvements, open an <a href="https://github.com/Shashankss1205/CodeGraphContext/issues">issue</a> or submit a Pull Request.</p>
819 | <p>Join discussions and help shape the future of CodeGraphContext.</p>
820 | 
821 | 
822 | 
823 | 
824 | 
825 | 
826 | 
827 | 
828 | 
829 | 
830 | 
831 | 
832 |                 
833 |               </article>
834 |             </div>
835 |           
836 |           
837 | <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
838 |         </div>
839 |         
840 |       </main>
841 |       
842 |         <footer class="md-footer">
843 |   
844 |   <div class="md-footer-meta md-typeset">
845 |     <div class="md-footer-meta__inner md-grid">
846 |       <div class="md-copyright">
847 |   
848 |   
849 |     Made with
850 |     <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
851 |       Material for MkDocs
852 |     </a>
853 |   
854 | </div>
855 |       
856 |     </div>
857 |   </div>
858 | </footer>
859 |       
860 |     </div>
861 |     <div class="md-dialog" data-md-component="dialog">
862 |       <div class="md-dialog__inner md-typeset"></div>
863 |     </div>
864 |     
865 |     
866 |     
867 |       
868 |       <script id="__config" type="application/json">{"base": ".", "features": [], "search": "assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
869 |     
870 |     
871 |       <script src="assets/javascripts/bundle.f55a23d4.min.js"></script>
872 |       
873 |     
874 |   </body>
875 | </html>
```

--------------------------------------------------------------------------------
/docs/site/contributing_languages/index.html:
--------------------------------------------------------------------------------

```html
   1 | 
   2 | <!doctype html>
   3 | <html lang="en" class="no-js">
   4 |   <head>
   5 |     
   6 |       <meta charset="utf-8">
   7 |       <meta name="viewport" content="width=device-width,initial-scale=1">
   8 |       
   9 |       
  10 |       
  11 |       
  12 |         <link rel="prev" href="../contributing/">
  13 |       
  14 |       
  15 |         <link rel="next" href="../troubleshooting/">
  16 |       
  17 |       
  18 |       <link rel="icon" href="../assets/images/favicon.png">
  19 |       <meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.6.21">
  20 |     
  21 |     
  22 |       
  23 |         <title>Adding New Languages - CodeGraphContext</title>
  24 |       
  25 |     
  26 |     
  27 |       <link rel="stylesheet" href="../assets/stylesheets/main.2a3383ac.min.css">
  28 |       
  29 |       
  30 | 
  31 | 
  32 |     
  33 |     
  34 |       
  35 |     
  36 |     
  37 |       
  38 |         
  39 |         
  40 |         <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  41 |         <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
  42 |         <style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
  43 |       
  44 |     
  45 |     
  46 |     <script>__md_scope=new URL("..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
  47 |     
  48 |       
  49 | 
  50 |     
  51 |     
  52 |     
  53 |   </head>
  54 |   
  55 |   
  56 |     <body dir="ltr">
  57 |   
  58 |     
  59 |     <input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
  60 |     <input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
  61 |     <label class="md-overlay" for="__drawer"></label>
  62 |     <div data-md-component="skip">
  63 |       
  64 |         
  65 |         <a href="#contributing-new-language-support-to-codegraphcontext" class="md-skip">
  66 |           Skip to content
  67 |         </a>
  68 |       
  69 |     </div>
  70 |     <div data-md-component="announce">
  71 |       
  72 |     </div>
  73 |     
  74 |     
  75 |       
  76 | 
  77 |   
  78 | 
  79 | <header class="md-header md-header--shadow" data-md-component="header">
  80 |   <nav class="md-header__inner md-grid" aria-label="Header">
  81 |     <a href=".." title="CodeGraphContext" class="md-header__button md-logo" aria-label="CodeGraphContext" data-md-component="logo">
  82 |       
  83 |   
  84 |   <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
  85 | 
  86 |     </a>
  87 |     <label class="md-header__button md-icon" for="__drawer">
  88 |       
  89 |       <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
  90 |     </label>
  91 |     <div class="md-header__title" data-md-component="header-title">
  92 |       <div class="md-header__ellipsis">
  93 |         <div class="md-header__topic">
  94 |           <span class="md-ellipsis">
  95 |             CodeGraphContext
  96 |           </span>
  97 |         </div>
  98 |         <div class="md-header__topic" data-md-component="header-topic">
  99 |           <span class="md-ellipsis">
 100 |             
 101 |               Adding New Languages
 102 |             
 103 |           </span>
 104 |         </div>
 105 |       </div>
 106 |     </div>
 107 |     
 108 |     
 109 |       <script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
 110 |     
 111 |     
 112 |     
 113 |       
 114 |       
 115 |         <label class="md-header__button md-icon" for="__search">
 116 |           
 117 |           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
 118 |         </label>
 119 |         <div class="md-search" data-md-component="search" role="dialog">
 120 |   <label class="md-search__overlay" for="__search"></label>
 121 |   <div class="md-search__inner" role="search">
 122 |     <form class="md-search__form" name="search">
 123 |       <input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
 124 |       <label class="md-search__icon md-icon" for="__search">
 125 |         
 126 |         <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
 127 |         
 128 |         <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
 129 |       </label>
 130 |       <nav class="md-search__options" aria-label="Search">
 131 |         
 132 |         <button type="reset" class="md-search__icon md-icon" title="Clear" aria-label="Clear" tabindex="-1">
 133 |           
 134 |           <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
 135 |         </button>
 136 |       </nav>
 137 |       
 138 |     </form>
 139 |     <div class="md-search__output">
 140 |       <div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
 141 |         <div class="md-search-result" data-md-component="search-result">
 142 |           <div class="md-search-result__meta">
 143 |             Initializing search
 144 |           </div>
 145 |           <ol class="md-search-result__list" role="presentation"></ol>
 146 |         </div>
 147 |       </div>
 148 |     </div>
 149 |   </div>
 150 | </div>
 151 |       
 152 |     
 153 |     
 154 |   </nav>
 155 |   
 156 | </header>
 157 |     
 158 |     <div class="md-container" data-md-component="container">
 159 |       
 160 |       
 161 |         
 162 |           
 163 |         
 164 |       
 165 |       <main class="md-main" data-md-component="main">
 166 |         <div class="md-main__inner md-grid">
 167 |           
 168 |             
 169 |               
 170 |               <div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
 171 |                 <div class="md-sidebar__scrollwrap">
 172 |                   <div class="md-sidebar__inner">
 173 |                     
 174 | 
 175 | 
 176 | 
 177 | <nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
 178 |   <label class="md-nav__title" for="__drawer">
 179 |     <a href=".." title="CodeGraphContext" class="md-nav__button md-logo" aria-label="CodeGraphContext" data-md-component="logo">
 180 |       
 181 |   
 182 |   <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
 183 | 
 184 |     </a>
 185 |     CodeGraphContext
 186 |   </label>
 187 |   
 188 |   <ul class="md-nav__list" data-md-scrollfix>
 189 |     
 190 |       
 191 |       
 192 |   
 193 |   
 194 |   
 195 |   
 196 |     <li class="md-nav__item">
 197 |       <a href=".." class="md-nav__link">
 198 |         
 199 |   
 200 |   
 201 |   <span class="md-ellipsis">
 202 |     Home
 203 |     
 204 |   </span>
 205 |   
 206 | 
 207 |       </a>
 208 |     </li>
 209 |   
 210 | 
 211 |     
 212 |       
 213 |       
 214 |   
 215 |   
 216 |   
 217 |   
 218 |     <li class="md-nav__item">
 219 |       <a href="../installation/" class="md-nav__link">
 220 |         
 221 |   
 222 |   
 223 |   <span class="md-ellipsis">
 224 |     Installation
 225 |     
 226 |   </span>
 227 |   
 228 | 
 229 |       </a>
 230 |     </li>
 231 |   
 232 | 
 233 |     
 234 |       
 235 |       
 236 |   
 237 |   
 238 |   
 239 |   
 240 |     <li class="md-nav__item">
 241 |       <a href="../use_cases/" class="md-nav__link">
 242 |         
 243 |   
 244 |   
 245 |   <span class="md-ellipsis">
 246 |     Use Cases
 247 |     
 248 |   </span>
 249 |   
 250 | 
 251 |       </a>
 252 |     </li>
 253 |   
 254 | 
 255 |     
 256 |       
 257 |       
 258 |   
 259 |   
 260 |   
 261 |   
 262 |     <li class="md-nav__item">
 263 |       <a href="../architecture/" class="md-nav__link">
 264 |         
 265 |   
 266 |   
 267 |   <span class="md-ellipsis">
 268 |     Architecture
 269 |     
 270 |   </span>
 271 |   
 272 | 
 273 |       </a>
 274 |     </li>
 275 |   
 276 | 
 277 |     
 278 |       
 279 |       
 280 |   
 281 |   
 282 |   
 283 |   
 284 |     <li class="md-nav__item">
 285 |       <a href="../cli/" class="md-nav__link">
 286 |         
 287 |   
 288 |   
 289 |   <span class="md-ellipsis">
 290 |     CLI Reference
 291 |     
 292 |   </span>
 293 |   
 294 | 
 295 |       </a>
 296 |     </li>
 297 |   
 298 | 
 299 |     
 300 |       
 301 |       
 302 |   
 303 |   
 304 |   
 305 |   
 306 |     <li class="md-nav__item">
 307 |       <a href="../server/" class="md-nav__link">
 308 |         
 309 |   
 310 |   
 311 |   <span class="md-ellipsis">
 312 |     Server
 313 |     
 314 |   </span>
 315 |   
 316 | 
 317 |       </a>
 318 |     </li>
 319 |   
 320 | 
 321 |     
 322 |       
 323 |       
 324 |   
 325 |   
 326 |   
 327 |   
 328 |     <li class="md-nav__item">
 329 |       <a href="../core/" class="md-nav__link">
 330 |         
 331 |   
 332 |   
 333 |   <span class="md-ellipsis">
 334 |     Core Concepts
 335 |     
 336 |   </span>
 337 |   
 338 | 
 339 |       </a>
 340 |     </li>
 341 |   
 342 | 
 343 |     
 344 |       
 345 |       
 346 |   
 347 |   
 348 |   
 349 |   
 350 |     <li class="md-nav__item">
 351 |       <a href="../tools/" class="md-nav__link">
 352 |         
 353 |   
 354 |   
 355 |   <span class="md-ellipsis">
 356 |     Tools
 357 |     
 358 |   </span>
 359 |   
 360 | 
 361 |       </a>
 362 |     </li>
 363 |   
 364 | 
 365 |     
 366 |       
 367 |       
 368 |   
 369 |   
 370 |   
 371 |   
 372 |     <li class="md-nav__item">
 373 |       <a href="../cookbook/" class="md-nav__link">
 374 |         
 375 |   
 376 |   
 377 |   <span class="md-ellipsis">
 378 |     Cookbook
 379 |     
 380 |   </span>
 381 |   
 382 | 
 383 |       </a>
 384 |     </li>
 385 |   
 386 | 
 387 |     
 388 |       
 389 |       
 390 |   
 391 |   
 392 |     
 393 |   
 394 |   
 395 |   
 396 |     
 397 |     
 398 |     
 399 |     
 400 |     
 401 |     <li class="md-nav__item md-nav__item--active md-nav__item--nested">
 402 |       
 403 |         
 404 |         
 405 |         <input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_10" checked>
 406 |         
 407 |           
 408 |           <label class="md-nav__link" for="__nav_10" id="__nav_10_label" tabindex="0">
 409 |             
 410 |   
 411 |   
 412 |   <span class="md-ellipsis">
 413 |     Contributing
 414 |     
 415 |   </span>
 416 |   
 417 | 
 418 |             <span class="md-nav__icon md-icon"></span>
 419 |           </label>
 420 |         
 421 |         <nav class="md-nav" data-md-level="1" aria-labelledby="__nav_10_label" aria-expanded="true">
 422 |           <label class="md-nav__title" for="__nav_10">
 423 |             <span class="md-nav__icon md-icon"></span>
 424 |             Contributing
 425 |           </label>
 426 |           <ul class="md-nav__list" data-md-scrollfix>
 427 |             
 428 |               
 429 |                 
 430 |   
 431 |   
 432 |   
 433 |   
 434 |     <li class="md-nav__item">
 435 |       <a href="../contributing/" class="md-nav__link">
 436 |         
 437 |   
 438 |   
 439 |   <span class="md-ellipsis">
 440 |     Overview
 441 |     
 442 |   </span>
 443 |   
 444 | 
 445 |       </a>
 446 |     </li>
 447 |   
 448 | 
 449 |               
 450 |             
 451 |               
 452 |                 
 453 |   
 454 |   
 455 |     
 456 |   
 457 |   
 458 |   
 459 |     <li class="md-nav__item md-nav__item--active">
 460 |       
 461 |       <input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
 462 |       
 463 |       
 464 |         
 465 |       
 466 |       
 467 |         <label class="md-nav__link md-nav__link--active" for="__toc">
 468 |           
 469 |   
 470 |   
 471 |   <span class="md-ellipsis">
 472 |     Adding New Languages
 473 |     
 474 |   </span>
 475 |   
 476 | 
 477 |           <span class="md-nav__icon md-icon"></span>
 478 |         </label>
 479 |       
 480 |       <a href="./" class="md-nav__link md-nav__link--active">
 481 |         
 482 |   
 483 |   
 484 |   <span class="md-ellipsis">
 485 |     Adding New Languages
 486 |     
 487 |   </span>
 488 |   
 489 | 
 490 |       </a>
 491 |       
 492 |         
 493 | 
 494 | <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
 495 |   
 496 |   
 497 |   
 498 |     
 499 |   
 500 |   
 501 |     <label class="md-nav__title" for="__toc">
 502 |       <span class="md-nav__icon md-icon"></span>
 503 |       Table of contents
 504 |     </label>
 505 |     <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
 506 |       
 507 |         <li class="md-nav__item">
 508 |   <a href="#1-understanding-the-architecture" class="md-nav__link">
 509 |     <span class="md-ellipsis">
 510 |       1. Understanding the Architecture
 511 |     </span>
 512 |   </a>
 513 |   
 514 | </li>
 515 |       
 516 |         <li class="md-nav__item">
 517 |   <a href="#2-steps-to-add-a-new-language-eg-typescript-ts" class="md-nav__link">
 518 |     <span class="md-ellipsis">
 519 |       2. Steps to Add a New Language (e.g., TypeScript - .ts)
 520 |     </span>
 521 |   </a>
 522 |   
 523 |     <nav class="md-nav" aria-label="2. Steps to Add a New Language (e.g., TypeScript - .ts)">
 524 |       <ul class="md-nav__list">
 525 |         
 526 |           <li class="md-nav__item">
 527 |   <a href="#step-21-create-the-language-module-file" class="md-nav__link">
 528 |     <span class="md-ellipsis">
 529 |       Step 2.1: Create the Language Module File
 530 |     </span>
 531 |   </a>
 532 |   
 533 | </li>
 534 |         
 535 |           <li class="md-nav__item">
 536 |   <a href="#step-22-define-tree-sitter-queries-ts_queries" class="md-nav__link">
 537 |     <span class="md-ellipsis">
 538 |       Step 2.2: Define Tree-sitter Queries (TS_QUERIES)
 539 |     </span>
 540 |   </a>
 541 |   
 542 | </li>
 543 |         
 544 |           <li class="md-nav__item">
 545 |   <a href="#step-23-implement-langtreesitterparser-class" class="md-nav__link">
 546 |     <span class="md-ellipsis">
 547 |       Step 2.3: Implement &lt;Lang&gt;TreeSitterParser Class
 548 |     </span>
 549 |   </a>
 550 |   
 551 | </li>
 552 |         
 553 |           <li class="md-nav__item">
 554 |   <a href="#step-24-implement-pre_scan_lang-function" class="md-nav__link">
 555 |     <span class="md-ellipsis">
 556 |       Step 2.4: Implement pre_scan_&lt;lang&gt; Function
 557 |     </span>
 558 |   </a>
 559 |   
 560 | </li>
 561 |         
 562 |           <li class="md-nav__item">
 563 |   <a href="#step-25-integrate-into-graph_builderpy" class="md-nav__link">
 564 |     <span class="md-ellipsis">
 565 |       Step 2.5: Integrate into graph_builder.py
 566 |     </span>
 567 |   </a>
 568 |   
 569 | </li>
 570 |         
 571 |       </ul>
 572 |     </nav>
 573 |   
 574 | </li>
 575 |       
 576 |         <li class="md-nav__item">
 577 |   <a href="#3-verification-and-debugging-using-neo4j" class="md-nav__link">
 578 |     <span class="md-ellipsis">
 579 |       3. Verification and Debugging using Neo4j
 580 |     </span>
 581 |   </a>
 582 |   
 583 |     <nav class="md-nav" aria-label="3. Verification and Debugging using Neo4j">
 584 |       <ul class="md-nav__list">
 585 |         
 586 |           <li class="md-nav__item">
 587 |   <a href="#step-31-prepare-a-sample-project" class="md-nav__link">
 588 |     <span class="md-ellipsis">
 589 |       Step 3.1: Prepare a Sample Project
 590 |     </span>
 591 |   </a>
 592 |   
 593 | </li>
 594 |         
 595 |           <li class="md-nav__item">
 596 |   <a href="#step-32-index-the-sample-project" class="md-nav__link">
 597 |     <span class="md-ellipsis">
 598 |       Step 3.2: Index the Sample Project
 599 |     </span>
 600 |   </a>
 601 |   
 602 | </li>
 603 |         
 604 |           <li class="md-nav__item">
 605 |   <a href="#step-33-query-the-neo4j-graph" class="md-nav__link">
 606 |     <span class="md-ellipsis">
 607 |       Step 3.3: Query the Neo4j Graph
 608 |     </span>
 609 |   </a>
 610 |   
 611 | </li>
 612 |         
 613 |           <li class="md-nav__item">
 614 |   <a href="#step-34-debugging-common-issues" class="md-nav__link">
 615 |     <span class="md-ellipsis">
 616 |       Step 3.4: Debugging Common Issues
 617 |     </span>
 618 |   </a>
 619 |   
 620 | </li>
 621 |         
 622 |       </ul>
 623 |     </nav>
 624 |   
 625 | </li>
 626 |       
 627 |     </ul>
 628 |   
 629 | </nav>
 630 |       
 631 |     </li>
 632 |   
 633 | 
 634 |               
 635 |             
 636 |           </ul>
 637 |         </nav>
 638 |       
 639 |     </li>
 640 |   
 641 | 
 642 |     
 643 |       
 644 |       
 645 |   
 646 |   
 647 |   
 648 |   
 649 |     <li class="md-nav__item">
 650 |       <a href="../troubleshooting/" class="md-nav__link">
 651 |         
 652 |   
 653 |   
 654 |   <span class="md-ellipsis">
 655 |     Troubleshooting
 656 |     
 657 |   </span>
 658 |   
 659 | 
 660 |       </a>
 661 |     </li>
 662 |   
 663 | 
 664 |     
 665 |       
 666 |       
 667 |   
 668 |   
 669 |   
 670 |   
 671 |     <li class="md-nav__item">
 672 |       <a href="../future_work/" class="md-nav__link">
 673 |         
 674 |   
 675 |   
 676 |   <span class="md-ellipsis">
 677 |     Future Work
 678 |     
 679 |   </span>
 680 |   
 681 | 
 682 |       </a>
 683 |     </li>
 684 |   
 685 | 
 686 |     
 687 |       
 688 |       
 689 |   
 690 |   
 691 |   
 692 |   
 693 |     <li class="md-nav__item">
 694 |       <a href="../license/" class="md-nav__link">
 695 |         
 696 |   
 697 |   
 698 |   <span class="md-ellipsis">
 699 |     License
 700 |     
 701 |   </span>
 702 |   
 703 | 
 704 |       </a>
 705 |     </li>
 706 |   
 707 | 
 708 |     
 709 |   </ul>
 710 | </nav>
 711 |                   </div>
 712 |                 </div>
 713 |               </div>
 714 |             
 715 |             
 716 |               
 717 |               <div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
 718 |                 <div class="md-sidebar__scrollwrap">
 719 |                   <div class="md-sidebar__inner">
 720 |                     
 721 | 
 722 | <nav class="md-nav md-nav--secondary" aria-label="Table of contents">
 723 |   
 724 |   
 725 |   
 726 |     
 727 |   
 728 |   
 729 |     <label class="md-nav__title" for="__toc">
 730 |       <span class="md-nav__icon md-icon"></span>
 731 |       Table of contents
 732 |     </label>
 733 |     <ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
 734 |       
 735 |         <li class="md-nav__item">
 736 |   <a href="#1-understanding-the-architecture" class="md-nav__link">
 737 |     <span class="md-ellipsis">
 738 |       1. Understanding the Architecture
 739 |     </span>
 740 |   </a>
 741 |   
 742 | </li>
 743 |       
 744 |         <li class="md-nav__item">
 745 |   <a href="#2-steps-to-add-a-new-language-eg-typescript-ts" class="md-nav__link">
 746 |     <span class="md-ellipsis">
 747 |       2. Steps to Add a New Language (e.g., TypeScript - .ts)
 748 |     </span>
 749 |   </a>
 750 |   
 751 |     <nav class="md-nav" aria-label="2. Steps to Add a New Language (e.g., TypeScript - .ts)">
 752 |       <ul class="md-nav__list">
 753 |         
 754 |           <li class="md-nav__item">
 755 |   <a href="#step-21-create-the-language-module-file" class="md-nav__link">
 756 |     <span class="md-ellipsis">
 757 |       Step 2.1: Create the Language Module File
 758 |     </span>
 759 |   </a>
 760 |   
 761 | </li>
 762 |         
 763 |           <li class="md-nav__item">
 764 |   <a href="#step-22-define-tree-sitter-queries-ts_queries" class="md-nav__link">
 765 |     <span class="md-ellipsis">
 766 |       Step 2.2: Define Tree-sitter Queries (TS_QUERIES)
 767 |     </span>
 768 |   </a>
 769 |   
 770 | </li>
 771 |         
 772 |           <li class="md-nav__item">
 773 |   <a href="#step-23-implement-langtreesitterparser-class" class="md-nav__link">
 774 |     <span class="md-ellipsis">
 775 |       Step 2.3: Implement &lt;Lang&gt;TreeSitterParser Class
 776 |     </span>
 777 |   </a>
 778 |   
 779 | </li>
 780 |         
 781 |           <li class="md-nav__item">
 782 |   <a href="#step-24-implement-pre_scan_lang-function" class="md-nav__link">
 783 |     <span class="md-ellipsis">
 784 |       Step 2.4: Implement pre_scan_&lt;lang&gt; Function
 785 |     </span>
 786 |   </a>
 787 |   
 788 | </li>
 789 |         
 790 |           <li class="md-nav__item">
 791 |   <a href="#step-25-integrate-into-graph_builderpy" class="md-nav__link">
 792 |     <span class="md-ellipsis">
 793 |       Step 2.5: Integrate into graph_builder.py
 794 |     </span>
 795 |   </a>
 796 |   
 797 | </li>
 798 |         
 799 |       </ul>
 800 |     </nav>
 801 |   
 802 | </li>
 803 |       
 804 |         <li class="md-nav__item">
 805 |   <a href="#3-verification-and-debugging-using-neo4j" class="md-nav__link">
 806 |     <span class="md-ellipsis">
 807 |       3. Verification and Debugging using Neo4j
 808 |     </span>
 809 |   </a>
 810 |   
 811 |     <nav class="md-nav" aria-label="3. Verification and Debugging using Neo4j">
 812 |       <ul class="md-nav__list">
 813 |         
 814 |           <li class="md-nav__item">
 815 |   <a href="#step-31-prepare-a-sample-project" class="md-nav__link">
 816 |     <span class="md-ellipsis">
 817 |       Step 3.1: Prepare a Sample Project
 818 |     </span>
 819 |   </a>
 820 |   
 821 | </li>
 822 |         
 823 |           <li class="md-nav__item">
 824 |   <a href="#step-32-index-the-sample-project" class="md-nav__link">
 825 |     <span class="md-ellipsis">
 826 |       Step 3.2: Index the Sample Project
 827 |     </span>
 828 |   </a>
 829 |   
 830 | </li>
 831 |         
 832 |           <li class="md-nav__item">
 833 |   <a href="#step-33-query-the-neo4j-graph" class="md-nav__link">
 834 |     <span class="md-ellipsis">
 835 |       Step 3.3: Query the Neo4j Graph
 836 |     </span>
 837 |   </a>
 838 |   
 839 | </li>
 840 |         
 841 |           <li class="md-nav__item">
 842 |   <a href="#step-34-debugging-common-issues" class="md-nav__link">
 843 |     <span class="md-ellipsis">
 844 |       Step 3.4: Debugging Common Issues
 845 |     </span>
 846 |   </a>
 847 |   
 848 | </li>
 849 |         
 850 |       </ul>
 851 |     </nav>
 852 |   
 853 | </li>
 854 |       
 855 |     </ul>
 856 |   
 857 | </nav>
 858 |                   </div>
 859 |                 </div>
 860 |               </div>
 861 |             
 862 |           
 863 |           
 864 |             <div class="md-content" data-md-component="content">
 865 |               <article class="md-content__inner md-typeset">
 866 |                 
 867 |                   
 868 | 
 869 | 
 870 | 
 871 | <h1 id="contributing-new-language-support-to-codegraphcontext">Contributing New Language Support to CodeGraphContext</h1>
 872 | <p>This document outlines the steps and best practices for adding support for a new programming language to CodeGraphContext. By following this guide, contributors can efficiently integrate new languages and leverage the Neo4j graph for verification.</p>
 873 | <h2 id="1-understanding-the-architecture">1. Understanding the Architecture</h2>
 874 | <p>CodeGraphContext uses a modular architecture for multi-language support:</p>
 875 | <ul>
 876 | <li><strong>Generic <code>TreeSitterParser</code> (in <code>graph_builder.py</code>):</strong> This acts as a wrapper, dispatching parsing tasks to language-specific implementations.</li>
 877 | <li><strong>Language-Specific Parser Modules (in <code>src/codegraphcontext/tools/languages/</code>):</strong> Each language (e.g., Python, JavaScript) has its own module (e.g., <code>python.py</code>, <code>javascript.py</code>) containing:<ul>
 878 | <li>Tree-sitter queries (<code>&lt;LANG&gt;_QUERIES</code>).</li>
 879 | <li>A <code>&lt;Lang&gt;TreeSitterParser</code> class that encapsulates language-specific parsing logic.</li>
 880 | <li>A <code>pre_scan_&lt;lang&gt;</code> function for initial symbol mapping.</li>
 881 | </ul>
 882 | </li>
 883 | <li><strong><code>GraphBuilder</code> (in <code>graph_builder.py</code>):</strong> Manages the overall graph building process, including file discovery, pre-scanning, and dispatching to the correct language parser.</li>
 884 | </ul>
 885 | <h2 id="2-steps-to-add-a-new-language-eg-typescript-ts">2. Steps to Add a New Language (e.g., TypeScript - <code>.ts</code>)</h2>
 886 | <h3 id="step-21-create-the-language-module-file">Step 2.1: Create the Language Module File</h3>
 887 | <ol>
 888 | <li>Create a new file: <code>src/codegraphcontext/tools/languages/typescript.py</code>.</li>
 889 | <li>Add the necessary imports: <code>from pathlib import Path</code>, <code>from typing import Any, Dict, Optional, Tuple</code>, <code>import logging</code>, <code>import ast</code> (if needed for AST manipulation).</li>
 890 | <li>Define <code>TS_QUERIES</code> (Tree-sitter queries for TypeScript).</li>
 891 | <li>Create a <code>TypescriptTreeSitterParser</code> class.</li>
 892 | <li>Create a <code>pre_scan_typescript</code> function.</li>
 893 | </ol>
 894 | <h3 id="step-22-define-tree-sitter-queries-ts_queries">Step 2.2: Define Tree-sitter Queries (<code>TS_QUERIES</code>)</h3>
 895 | <p>This is the most critical and often iterative step. You'll need to define queries for:</p>
 896 | <ul>
 897 | <li><strong><code>functions</code></strong>: Function declarations, arrow functions, methods.</li>
 898 | <li><strong><code>classes</code></strong>: Class declarations, class expressions.</li>
 899 | <li><strong><code>imports</code></strong>: ES6 imports (<code>import ... from ...</code>), CommonJS <code>require()</code>.</li>
 900 | <li><strong><code>calls</code></strong>: Function calls, method calls.</li>
 901 | <li><strong><code>variables</code></strong>: Variable declarations (<code>let</code>, <code>const</code>, <code>var</code>).</li>
 902 | <li><strong><code>docstrings</code></strong>: (Optional) How documentation comments are identified.</li>
 903 | <li><strong><code>lambda_assignments</code></strong>: (Optional, Python-specific) If the language has similar constructs.</li>
 904 | </ul>
 905 | <p><strong>Tips for Query Writing:</strong>
 906 | *   <strong>Consult Tree-sitter Grammars:</strong> Find the <code>node-types.json</code> or grammar definition for your language (e.g., <code>tree-sitter-typescript</code>).
 907 | *   <strong>Use <code>tree-sitter parse</code>:</strong> Use the <code>tree-sitter parse</code> command-line tool to inspect the AST of sample code snippets. This is invaluable for identifying correct node types and field names.
 908 | *   <strong>Start Simple:</strong> Begin with basic queries and gradually add complexity.
 909 | *   <strong>Test Iteratively:</strong> After each query, test it with sample code.</p>
 910 | <h3 id="step-23-implement-langtreesitterparser-class">Step 2.3: Implement <code>&lt;Lang&gt;TreeSitterParser</code> Class</h3>
 911 | <p>This class (e.g., <code>TypescriptTreeSitterParser</code>) will encapsulate the language-specific logic.</p>
 912 | <ol>
 913 | <li><strong><code>__init__(self, generic_parser_wrapper)</code></strong>:<ul>
 914 | <li>Store <code>generic_parser_wrapper</code>, <code>language_name</code>, <code>language</code>, <code>parser</code> from the generic wrapper.</li>
 915 | <li>Load <code>TS_QUERIES</code> using <code>self.language.query(query_str)</code>.</li>
 916 | </ul>
 917 | </li>
 918 | <li><strong>Helper Methods</strong>:<ul>
 919 | <li><code>_get_node_text(self, node)</code>: Extracts text from a tree-sitter node.</li>
 920 | <li><code>_get_parent_context(self, node, types=...)</code>: (Language-specific node types for context).</li>
 921 | <li><code>_calculate_complexity(self, node)</code>: (Language-specific complexity nodes).</li>
 922 | <li><code>_get_docstring(self, body_node)</code>: (Language-specific docstring extraction).</li>
 923 | </ul>
 924 | </li>
 925 | <li><strong><code>parse(self, file_path: Path, is_dependency: bool = False) -&gt; Dict</code></strong>:<ul>
 926 | <li>Reads the file, parses it with <code>self.parser</code>.</li>
 927 | <li>Calls its own <code>_find_*</code> methods (<code>_find_functions</code>, <code>_find_classes</code>, etc.).</li>
 928 | <li>Returns a standardized dictionary format (as seen in <code>python.py</code> and <code>javascript.py</code>).</li>
 929 | </ul>
 930 | </li>
 931 | <li><strong><code>_find_*</code> Methods</strong>:
 932 |     Implement these for each query type, extracting data from the AST and populating the standardized dictionary.</li>
 933 | </ol>
 934 | <h3 id="step-24-implement-pre_scan_lang-function">Step 2.4: Implement <code>pre_scan_&lt;lang&gt;</code> Function</h3>
 935 | <p>This function (e.g., <code>pre_scan_typescript</code>) will quickly scan files to build an initial <code>imports_map</code>.</p>
 936 | <ol>
 937 | <li>It takes <code>files: list[Path]</code> and <code>parser_wrapper</code> (an instance of <code>TreeSitterParser</code>).</li>
 938 | <li>Uses a simplified query (e.g., for <code>class_declaration</code> and <code>function_declaration</code>) to quickly find definitions.</li>
 939 | <li>Returns a dictionary mapping symbol names to file paths.</li>
 940 | </ol>
 941 | <h3 id="step-25-integrate-into-graph_builderpy">Step 2.5: Integrate into <code>graph_builder.py</code></h3>
 942 | <ol>
 943 | <li><strong><code>GraphBuilder.__init__</code></strong>:<ul>
 944 | <li>Add <code>'.ts': TreeSitterParser('typescript')</code> to <code>self.parsers</code>.</li>
 945 | </ul>
 946 | </li>
 947 | <li><strong><code>TreeSitterParser.__init__</code></strong>:<ul>
 948 | <li>Add an <code>elif self.language_name == 'typescript':</code> block to initialize <code>self.language_specific_parser</code> with <code>TypescriptTreeSitterParser(self)</code>.</li>
 949 | </ul>
 950 | </li>
 951 | <li><strong><code>GraphBuilder._pre_scan_for_imports</code></strong>:<ul>
 952 | <li>Add an <code>elif '.ts' in files_by_lang:</code> block to import <code>pre_scan_typescript</code> and call it.</li>
 953 | </ul>
 954 | </li>
 955 | </ol>
 956 | <h2 id="3-verification-and-debugging-using-neo4j">3. Verification and Debugging using Neo4j</h2>
 957 | <p>After implementing support for a new language, it's crucial to verify that the graph is being built correctly.</p>
 958 | <h3 id="step-31-prepare-a-sample-project">Step 3.1: Prepare a Sample Project</h3>
 959 | <p>Create a small sample project for your new language (e.g., <code>tests/sample_project_typescript/</code>) with:
 960 | *   Function declarations.
 961 | *   Class declarations (including inheritance).
 962 | *   Various import types (if applicable).
 963 | *   Function calls.
 964 | *   Variable declarations.</p>
 965 | <h3 id="step-32-index-the-sample-project">Step 3.2: Index the Sample Project</h3>
 966 | <ol>
 967 | <li><strong>Delete existing data (if any):</strong>
 968 |     ```bash
 969 |     # Replace with your sample project path
 970 |     <tool_code>print(default_api.delete_repository(repo_path='/path/to/your/sample_project'))</tool_code></li>
 971 | <li><strong>Index the project:</strong>
 972 |     ```bash
 973 |     # Replace with your sample project path
 974 |     <tool_code>print(default_api.add_code_to_graph(path='/path/to/your/sample_project'))</tool_code></li>
 975 | <li><strong>Monitor job status:</strong>
 976 |     ```bash
 977 |     # Use the job_id returned by add_code_to_graph
 978 |     <tool_code>print(default_api.check_job_status(job_id='<your_job_id>'))</tool_code></li>
 979 | </ol>
 980 | <h3 id="step-33-query-the-neo4j-graph">Step 3.3: Query the Neo4j Graph</h3>
 981 | <p>Use Cypher queries to inspect the generated graph.</p>
 982 | <ul>
 983 | <li>
 984 | <p><strong>Check for Files and Language Tags:</strong>
 985 |     <code>cypher
 986 |     MATCH (f:File)
 987 |     WHERE f.path STARTS WITH '/path/to/your/sample_project'
 988 |     RETURN f.name, f.path, f.lang</code>
 989 |     <em>Expected:</em> All files from your sample project should be listed with the correct <code>lang</code> tag.</p>
 990 | </li>
 991 | <li>
 992 | <p><strong>Check for Functions:</strong>
 993 |     <code>cypher
 994 |     MATCH (f:File)-[:CONTAINS]-&gt;(fn:Function)
 995 |     WHERE f.path STARTS WITH '/path/to/your/sample_project'
 996 |       AND fn.lang = '&lt;your_language_name&gt;'
 997 |     RETURN f.name AS FileName, fn.name AS FunctionName, fn.line_number AS Line</code>
 998 |     <em>Expected:</em> All functions from your sample project should be listed.</p>
 999 | </li>
1000 | <li>
1001 | <p><strong>Check for Classes:</strong>
1002 |     <code>cypher
1003 |     MATCH (f:File)-[:CONTAINS]-&gt;(c:Class)
1004 |     WHERE f.path STARTS WITH '/path/to/your/sample_project'
1005 |       AND c.lang = '&lt;your_language_name&gt;'
1006 |     RETURN f.name AS FileName, c.name AS ClassName, c.line_number AS Line</code>
1007 |     <em>Expected:</em> All classes from your sample project should be listed.</p>
1008 | </li>
1009 | <li>
1010 | <p><strong>Check for Imports (Module-level):</strong>
1011 |     <code>cypher
1012 |     MATCH (f:File)-[:IMPORTS]-&gt;(m:Module)
1013 |     WHERE f.path STARTS WITH '/path/to/your/sample_project'
1014 |       AND f.lang = '&lt;your_language_name&gt;'
1015 |     RETURN f.name AS FileName, m.name AS ImportedModule, m.full_import_name AS FullImportName</code>
1016 |     <em>Expected:</em> All module-level imports should be listed.</p>
1017 | </li>
1018 | <li>
1019 | <p><strong>Check for Function Calls:</strong>
1020 |     <code>cypher
1021 |     MATCH (caller:Function)-[:CALLS]-&gt;(callee:Function)
1022 |     WHERE caller.file_path STARTS WITH '/path/to/your/sample_project'
1023 |       AND caller.lang = '&lt;your_language_name&gt;'
1024 |     RETURN caller.name AS Caller, callee.name AS Callee, caller.file_path AS CallerFile, callee.file_path AS CalleeFile</code>
1025 |     <em>Expected:</em> All function calls should be correctly linked.</p>
1026 | </li>
1027 | <li>
1028 | <p><strong>Check for Class Inheritance:</strong>
1029 |     <code>cypher
1030 |     MATCH (child:Class)-[:INHERITS]-&gt;(parent:Class)
1031 |     WHERE child.file_path STARTS WITH '/path/to/your/sample_project'
1032 |       AND child.lang = '&lt;your_language_name&gt;'
1033 |     RETURN child.name AS ChildClass, parent.name AS ParentClass, child.file_path AS ChildFile, parent.file_path AS ParentFile</code>
1034 |     <em>Expected:</em> All inheritance relationships should be correctly linked.</p>
1035 | </li>
1036 | </ul>
1037 | <h3 id="step-34-debugging-common-issues">Step 3.4: Debugging Common Issues</h3>
1038 | <ul>
1039 | <li><strong><code>NameError: Invalid node type ...</code></strong>: Your tree-sitter query is using a node type that doesn't exist in the language's grammar. Use <code>tree-sitter parse</code> to inspect the AST.</li>
1040 | <li><strong>Missing Relationships (e.g., <code>CALLS</code>, <code>IMPORTS</code>)</strong>:<ul>
1041 | <li><strong>Check <code>_find_*</code> methods</strong>: Ensure your <code>_find_*</code> methods are correctly extracting the necessary data.</li>
1042 | <li><strong>Check <code>imports_map</code></strong>: Verify that the <code>pre_scan_&lt;lang&gt;</code> function is correctly populating the <code>imports_map</code>.</li>
1043 | <li><strong>Check <code>local_imports</code> map</strong>: Ensure the <code>local_imports</code> map (built in <code>_create_function_calls</code> and <code>_create_inheritance_links</code>) is correctly resolving symbols.</li>
1044 | </ul>
1045 | </li>
1046 | <li><strong>Incorrect <code>lang</code> tags</strong>: Ensure <code>self.language_name</code> is correctly passed and stored.</li>
1047 | </ul>
1048 | <p>By following these steps, contributors can effectively add and verify new language support.</p>
1049 | 
1050 | 
1051 | 
1052 | 
1053 | 
1054 | 
1055 | 
1056 | 
1057 | 
1058 | 
1059 | 
1060 | 
1061 |                 
1062 |               </article>
1063 |             </div>
1064 |           
1065 |           
1066 | <script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
1067 |         </div>
1068 |         
1069 |       </main>
1070 |       
1071 |         <footer class="md-footer">
1072 |   
1073 |   <div class="md-footer-meta md-typeset">
1074 |     <div class="md-footer-meta__inner md-grid">
1075 |       <div class="md-copyright">
1076 |   
1077 |   
1078 |     Made with
1079 |     <a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
1080 |       Material for MkDocs
1081 |     </a>
1082 |   
1083 | </div>
1084 |       
1085 |     </div>
1086 |   </div>
1087 | </footer>
1088 |       
1089 |     </div>
1090 |     <div class="md-dialog" data-md-component="dialog">
1091 |       <div class="md-dialog__inner md-typeset"></div>
1092 |     </div>
1093 |     
1094 |     
1095 |     
1096 |       
1097 |       <script id="__config" type="application/json">{"base": "..", "features": [], "search": "../assets/javascripts/workers/search.973d3a69.min.js", "tags": null, "translations": {"clipboard.copied": "Copied to clipboard", "clipboard.copy": "Copy to clipboard", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.placeholder": "Type to start searching", "search.result.term.missing": "Missing", "select.version": "Select version"}, "version": null}</script>
1098 |     
1099 |     
1100 |       <script src="../assets/javascripts/bundle.f55a23d4.min.js"></script>
1101 |       
1102 |     
1103 |   </body>
1104 | </html>
```
Page 12/18FirstPrevNextLast