This is page 2 of 22. Use http://codebase.md/shashankss1205/codegraphcontext?lines=true&page={x} to view the full context.
# Directory Structure
```
├── .cgcignore
├── .github
│ ├── FUNDING.yml
│ └── workflows
│ ├── e2e-tests.yml
│ ├── post_discord_invite.yml
│ ├── test.yml
│ └── update-contributors.yml
├── .gitignore
├── CLI_Commands.md
├── 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
│ │ └── watching.md
│ ├── mkdocs.yml
│ └── site
│ ├── 404.html
│ ├── architecture
│ │ └── index.html
│ ├── assets
│ │ ├── images
│ │ │ └── favicon.png
│ │ ├── javascripts
│ │ │ ├── bundle.79ae519e.min.js
│ │ │ ├── bundle.79ae519e.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.2c215733.min.js
│ │ │ └── search.2c215733.min.js.map
│ │ └── stylesheets
│ │ ├── main.484c7ddc.min.css
│ │ ├── main.484c7ddc.min.css.map
│ │ ├── palette.ab4e12ef.min.css
│ │ └── palette.ab4e12ef.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
│ └── watching
│ └── index.html
├── funding.json
├── 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
├── pyproject.toml
├── README.md
├── scripts
│ ├── generate_lang_contributors.py
│ ├── post_install_fix.sh
│ ├── test_all_parsers.py
│ └── update_language_parsers.py
├── SECURITY.md
├── src
│ └── codegraphcontext
│ ├── __init__.py
│ ├── __main__.py
│ ├── cli
│ │ ├── __init__.py
│ │ ├── cli_helpers.py
│ │ ├── config_manager.py
│ │ ├── main.py
│ │ ├── setup_macos.py
│ │ └── setup_wizard.py
│ ├── core
│ │ ├── __init__.py
│ │ ├── database_falkordb.py
│ │ ├── database.py
│ │ ├── falkor_worker.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
│ │ │ ├── csharp.py
│ │ │ ├── go.py
│ │ │ ├── java.py
│ │ │ ├── javascript.py
│ │ │ ├── kotlin.py
│ │ │ ├── php.py
│ │ │ ├── python.py
│ │ │ ├── ruby.py
│ │ │ ├── rust.py
│ │ │ ├── scala.py
│ │ │ ├── swift.py
│ │ │ ├── typescript.py
│ │ │ └── typescriptjsx.py
│ │ ├── package_resolver.py
│ │ ├── query_tool_languages
│ │ │ ├── c_toolkit.py
│ │ │ ├── cpp_toolkit.py
│ │ │ ├── csharp_toolkit.py
│ │ │ ├── go_toolkit.py
│ │ │ ├── java_toolkit.py
│ │ │ ├── javascript_toolkit.py
│ │ │ ├── python_toolkit.py
│ │ │ ├── ruby_toolkit.py
│ │ │ ├── rust_toolkit.py
│ │ │ ├── scala_toolkit.py
│ │ │ ├── swift_toolkit.py
│ │ │ └── typescript_toolkit.py
│ │ └── system.py
│ └── utils
│ ├── debug_log.py
│ └── tree_sitter_manager.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_csharp
│ │ ├── README.md
│ │ └── src
│ │ └── Example.App
│ │ ├── Attributes
│ │ │ └── CustomAttributes.cs
│ │ ├── Example.App.csproj
│ │ ├── Models
│ │ │ ├── Person.cs
│ │ │ ├── Point.cs
│ │ │ ├── Role.cs
│ │ │ └── User.cs
│ │ ├── OuterClass.cs
│ │ ├── Program.cs
│ │ ├── Services
│ │ │ ├── GreetingService.cs
│ │ │ ├── IGreetingService.cs
│ │ │ └── LegacyService.cs
│ │ └── Utils
│ │ ├── CollectionHelper.cs
│ │ └── FileHelper.cs
│ ├── 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_kotlin
│ │ ├── AdvancedClasses.kt
│ │ ├── Annotations.kt
│ │ ├── Coroutines.kt
│ │ ├── EdgeCases.kt
│ │ ├── Functions.kt
│ │ ├── Main.kt
│ │ ├── Properties.kt
│ │ └── User.kt
│ ├── 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_scala
│ │ ├── Animals.scala
│ │ ├── Complex.scala
│ │ ├── Functional.scala
│ │ ├── Geometry.scala
│ │ ├── Main.scala
│ │ ├── PackageObject.scala
│ │ ├── Script.sc
│ │ ├── Services.scala
│ │ ├── Shapes.scala
│ │ ├── Utils.scala
│ │ └── Variables.scala
│ ├── sample_project_swift
│ │ ├── Generics.swift
│ │ ├── Main.swift
│ │ ├── README.md
│ │ ├── Shapes.swift
│ │ ├── User.swift
│ │ └── Vehicles.swift
│ ├── sample_project_typescript
│ │ ├── package.json
│ │ ├── README.md
│ │ ├── sample_tsx.tsx
│ │ ├── 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_kotlin_parser.py
│ ├── test_swift_parser.py
│ ├── test_tree_sitter
│ │ ├── __init__.py
│ │ ├── class_instantiation.py
│ │ ├── complex_classes.py
│ │ └── test_file.py
│ ├── test_tree_sitter_manager.py
│ └── test_typescript_parser.py
├── visualize_graph.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
│ │ │ ├── SocialMentionsTimeline.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
└── windows_setup_guide.md
```
# Files
--------------------------------------------------------------------------------
/tests/sample_project_typescript/tsconfig.json:
--------------------------------------------------------------------------------
```json
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "lib": ["ES2020", "DOM"],
5 | "module": "commonjs",
6 | "moduleResolution": "node",
7 | "outDir": "./dist",
8 | "rootDir": "./src",
9 | "strict": true,
10 | "esModuleInterop": true,
11 | "skipLibCheck": true,
12 | "forceConsistentCasingInFileNames": true,
13 | "resolveJsonModule": true,
14 | "declaration": true,
15 | "declarationMap": true,
16 | "sourceMap": true,
17 | "experimentalDecorators": true,
18 | "emitDecoratorMetadata": true,
19 | "strictPropertyInitialization": true,
20 | "noImplicitReturns": true,
21 | "noFallthroughCasesInSwitch": true,
22 | "noUncheckedIndexedAccess": true,
23 | "exactOptionalPropertyTypes": true,
24 | "noImplicitOverride": true,
25 | "allowUnusedLabels": false,
26 | "allowUnreachableCode": false,
27 | "noPropertyAccessFromIndexSignature": true
28 | },
29 | "include": [
30 | "src/**/*"
31 | ],
32 | "exclude": [
33 | "node_modules",
34 | "dist",
35 | "**/*.test.ts",
36 | "**/*.spec.ts"
37 | ]
38 | }
```
--------------------------------------------------------------------------------
/tests/sample_project_csharp/src/Example.App/OuterClass.cs:
--------------------------------------------------------------------------------
```csharp
1 | namespace Example.App
2 | {
3 | /// <summary>
4 | /// Demonstrates nested classes in C#
5 | /// </summary>
6 | public class OuterClass
7 | {
8 | private string _outerValue;
9 |
10 | public OuterClass(string value)
11 | {
12 | _outerValue = value;
13 | }
14 |
15 | public InnerClass CreateInner(string innerValue)
16 | {
17 | return new InnerClass(this, innerValue);
18 | }
19 |
20 | /// <summary>
21 | /// Inner class that can access outer class members
22 | /// </summary>
23 | public class InnerClass
24 | {
25 | private OuterClass _outer;
26 | private string _innerValue;
27 |
28 | public InnerClass(OuterClass outer, string value)
29 | {
30 | _outer = outer;
31 | _innerValue = value;
32 | }
33 |
34 | public string Combine()
35 | {
36 | return $"{_outer._outerValue}-{_innerValue}";
37 | }
38 | }
39 | }
40 | }
41 |
```
--------------------------------------------------------------------------------
/docs/site/assets/javascripts/lunr/min/lunr.th.min.js:
--------------------------------------------------------------------------------
```javascript
1 | !function(e,r){"function"==typeof define&&define.amd?define(r):"object"==typeof exports?module.exports=r():r()(e.lunr)}(this,function(){return function(e){if(void 0===e)throw new Error("Lunr is not present. Please include / require Lunr before this script.");if(void 0===e.stemmerSupport)throw new Error("Lunr stemmer support is not present. Please include / require Lunr stemmer support before this script.");var r="2"==e.version[0];e.th=function(){this.pipeline.reset(),this.pipeline.add(e.th.trimmer),r?this.tokenizer=e.th.tokenizer:(e.tokenizer&&(e.tokenizer=e.th.tokenizer),this.tokenizerFn&&(this.tokenizerFn=e.th.tokenizer))},e.th.wordCharacters="[-]",e.th.trimmer=e.trimmerSupport.generateTrimmer(e.th.wordCharacters),e.Pipeline.registerFunction(e.th.trimmer,"trimmer-th");var t=e.wordcut;t.init(),e.th.tokenizer=function(i){if(!arguments.length||null==i||void 0==i)return[];if(Array.isArray(i))return i.map(function(t){return r?new e.Token(t):t});var n=i.toString().replace(/^\s+/,"");return t.cut(n).split("|")}}});
```
--------------------------------------------------------------------------------
/tests/sample_project_typescript/package.json:
--------------------------------------------------------------------------------
```json
1 | {
2 | "name": "sample_project_typescript",
3 | "version": "1.0.0",
4 | "description": "Comprehensive TypeScript sample project for testing code analysis and indexing tools",
5 | "main": "dist/index.js",
6 | "scripts": {
7 | "build": "tsc",
8 | "build:watch": "tsc --watch",
9 | "start": "node dist/index.js",
10 | "dev": "ts-node src/index.ts",
11 | "test": "jest",
12 | "test:watch": "jest --watch",
13 | "lint": "eslint src/**/*.ts",
14 | "lint:fix": "eslint src/**/*.ts --fix",
15 | "clean": "rimraf dist"
16 | },
17 | "keywords": [
18 | "typescript",
19 | "sample",
20 | "code-analysis",
21 | "indexing",
22 | "testing"
23 | ],
24 | "author": "Sample Project",
25 | "license": "MIT",
26 | "devDependencies": {
27 | "@types/node": "^20.0.0",
28 | "@typescript-eslint/eslint-plugin": "^6.0.0",
29 | "@typescript-eslint/parser": "^6.0.0",
30 | "eslint": "^8.0.0",
31 | "jest": "^29.0.0",
32 | "@types/jest": "^29.0.0",
33 | "ts-jest": "^29.0.0",
34 | "ts-node": "^10.0.0",
35 | "typescript": "^5.0.0",
36 | "rimraf": "^5.0.0"
37 | },
38 | "dependencies": {
39 | "reflect-metadata": "^0.1.13"
40 | }
41 | }
```
--------------------------------------------------------------------------------
/website/src/components/ui/checkbox.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3 | import { Check } from "lucide-react";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | const Checkbox = React.forwardRef<
8 | React.ElementRef<typeof CheckboxPrimitive.Root>,
9 | React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
10 | >(({ className, ...props }, ref) => (
11 | <CheckboxPrimitive.Root
12 | ref={ref}
13 | className={cn(
14 | "peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
15 | className,
16 | )}
17 | {...props}
18 | >
19 | <CheckboxPrimitive.Indicator className={cn("flex items-center justify-center text-current")}>
20 | <Check className="h-4 w-4" />
21 | </CheckboxPrimitive.Indicator>
22 | </CheckboxPrimitive.Root>
23 | ));
24 | Checkbox.displayName = CheckboxPrimitive.Root.displayName;
25 |
26 | export { Checkbox };
27 |
```
--------------------------------------------------------------------------------
/.github/workflows/update-contributors.yml:
--------------------------------------------------------------------------------
```yaml
1 | name: Update Contributors
2 |
3 | on:
4 | schedule:
5 | - cron: '0 */6 * * *' # Runs every 6 hours
6 | workflow_dispatch: # Allows manual triggering
7 |
8 | jobs:
9 | update-contributors:
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: Check out repository
13 | uses: actions/checkout@v3
14 | with:
15 | fetch-depth: 0
16 |
17 | - name: Set up Python
18 | uses: actions/setup-python@v4
19 | with:
20 | python-version: '3.x'
21 |
22 | - name: Run script to generate contributors file
23 | run: python scripts/generate_lang_contributors.py
24 |
25 | - name: Commit and push if there are changes
26 | env:
27 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 | run: |
29 | git config --global user.name 'github-actions[bot]'
30 | git config --global user.email 'github-actions[bot]@users.noreply.github.com'
31 | git add contributors.md
32 | if ! git diff --staged --quiet; then
33 | git commit -m "docs: update contributors"
34 | git push
35 | else
36 | echo "No changes to contributors.md"
37 | fi
38 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/slider.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as SliderPrimitive from "@radix-ui/react-slider";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const Slider = React.forwardRef<
7 | React.ElementRef<typeof SliderPrimitive.Root>,
8 | React.ComponentPropsWithoutRef<typeof SliderPrimitive.Root>
9 | >(({ className, ...props }, ref) => (
10 | <SliderPrimitive.Root
11 | ref={ref}
12 | className={cn("relative flex w-full touch-none select-none items-center", className)}
13 | {...props}
14 | >
15 | <SliderPrimitive.Track className="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
16 | <SliderPrimitive.Range className="absolute h-full bg-primary" />
17 | </SliderPrimitive.Track>
18 | <SliderPrimitive.Thumb className="block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" />
19 | </SliderPrimitive.Root>
20 | ));
21 | Slider.displayName = SliderPrimitive.Root.displayName;
22 |
23 | export { Slider };
24 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/badge.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { cva, type VariantProps } from "class-variance-authority";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const badgeVariants = cva(
7 | "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
8 | {
9 | variants: {
10 | variant: {
11 | default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
12 | secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
13 | destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
14 | outline: "text-foreground",
15 | },
16 | },
17 | defaultVariants: {
18 | variant: "default",
19 | },
20 | },
21 | );
22 |
23 | export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}
24 |
25 | function Badge({ className, variant, ...props }: BadgeProps) {
26 | return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
27 | }
28 |
29 | export { Badge, badgeVariants };
30 |
```
--------------------------------------------------------------------------------
/tests/sample_project_cpp/function_types.cpp:
--------------------------------------------------------------------------------
```cpp
1 | #include <iostream>
2 | #include <vector>
3 | #include <algorithm>
4 |
5 | // Regular function
6 | int add(int a, int b) {
7 | return a + b;
8 | }
9 |
10 | // Templated function
11 | template <typename T>
12 | T multiply(T a, T b) {
13 | return a * b;
14 | }
15 |
16 | class Calculator {
17 | public:
18 | // Static member function
19 | static int subtract(int a, int b) {
20 | return a - b;
21 | }
22 |
23 | // Method using a local lambda
24 | void printSum(const std::vector<int>& nums) {
25 | auto printer = [](int val) { std::cout << val << std::endl; };
26 | for (int n : nums) printer(n);
27 | }
28 | };
29 |
30 | int main() {
31 | Calculator calc;
32 | std::vector<int> numbers = {1, 2, 3};
33 |
34 | calc.printSum(numbers);
35 |
36 | // Standalone lambda
37 | auto lambda = [](int a, int b) { return a + b; };
38 | std::cout << "Lambda sum: " << lambda(3,4) << std::endl;
39 |
40 | // Regular function call
41 | std::cout << "Add: " << add(2,3) << std::endl;
42 |
43 | // Templated function call
44 | std::cout << "Multiply: " << multiply(2,3) << std::endl;
45 |
46 | // Static member function call
47 | std::cout << "Subtract: " << Calculator::subtract(5,2) << std::endl;
48 |
49 | return 0;
50 | }
51 |
```
--------------------------------------------------------------------------------
/tests/sample_project_ruby/tests/test_mixins.py:
--------------------------------------------------------------------------------
```python
1 | def test_ruby_class_includes_module(graph):
2 | # Check that the module node exists
3 | rows = graph.query('MATCH (:Module {name:"Flyable"}) RETURN 1 AS ok LIMIT 1')
4 | assert rows, "Expected a Module node named 'Flyable' but none was found."
5 |
6 | # Check that the class node exists
7 | rows = graph.query('MATCH (:Class {name:"Bird"}) RETURN 1 AS ok LIMIT 1')
8 | assert rows, "Expected a Class node named 'Bird' but none was found."
9 |
10 | # Check that the INCLUDES relationship exists between Bird and Flyable
11 | rows = graph.query('''
12 | MATCH (:Class {name:"Bird"})-[:INCLUDES]->(:Module {name:"Flyable"})
13 | RETURN count(*) AS c
14 | ''')
15 | assert rows and rows[0]["c"] > 0, \
16 | "Expected an INCLUDES relationship from Class 'Bird' to Module 'Flyable', but none was found."
17 |
18 |
19 | def test_module_is_unique(graph):
20 | # Ensure only one Module node named 'Flyable' exists
21 | rows = graph.query('MATCH (m:Module {name:"Flyable"}) RETURN count(m) AS c')
22 | assert rows and rows[0]["c"] == 1, \
23 | f"Expected exactly one Module node named 'Flyable', but found {rows[0]['c'] if rows else 0}."
24 |
```
--------------------------------------------------------------------------------
/tests/sample_project_java/src/com/example/app/Main.java:
--------------------------------------------------------------------------------
```java
1 | package com.example.app;
2 |
3 | import com.example.app.model.Role;
4 | import com.example.app.model.User;
5 | import com.example.app.service.GreetingService;
6 | import com.example.app.service.impl.GreetingServiceImpl;
7 | import com.example.app.util.CollectionUtils;
8 | import com.example.app.util.IOHelper;
9 |
10 | import java.util.List;
11 |
12 | public class Main {
13 | public static void main(String[] args) {
14 | GreetingService svc = new GreetingServiceImpl();
15 | User u = new User("Priya", Role.ADMIN);
16 | System.out.println(svc.greet(u));
17 |
18 | int sumSquares = CollectionUtils.sumOfSquares(List.of(1, 2, 3, 4, 5));
19 | System.out.println("sumSquares=" + sumSquares);
20 |
21 | try {
22 | String first = IOHelper.readFirstLine("README.md");
23 | System.out.println("firstLine=" + first);
24 | } catch (RuntimeException e) {
25 | System.out.println("IO failed: " + e.getMessage());
26 | }
27 |
28 | com.example.app.misc.Outer outer = new com.example.app.misc.Outer("outer");
29 | com.example.app.misc.Outer.Inner inner = outer.new Inner("inner");
30 | System.out.println(inner.combine());
31 | }
32 | }
33 |
```
--------------------------------------------------------------------------------
/tests/sample_project_kotlin/AdvancedClasses.kt:
--------------------------------------------------------------------------------
```kotlin
1 | package com.example.project.advanced
2 |
3 | // Abstract class hierarchy
4 | abstract class Shape {
5 | abstract fun area(): Double
6 | open fun description(): String = "Unknown Shape"
7 | }
8 |
9 | class Circle(val radius: Double) : Shape() {
10 | override fun area(): Double = Math.PI * radius * radius
11 | override fun description(): String = "Circle with radius $radius"
12 | }
13 |
14 | // Sealed class hierarchy
15 | sealed class Result {
16 | data class Success(val data: String) : Result()
17 | data class Error(val message: String) : Result()
18 | object Loading : Result()
19 | }
20 |
21 | // Nested and Inner classes
22 | class Outer {
23 | private val bar: Int = 1
24 |
25 | class Nested {
26 | fun foo() = 2
27 | }
28 |
29 | inner class Inner {
30 | fun foo() = bar
31 | }
32 | }
33 |
34 | // Companion Object
35 | class DatabaseConnection {
36 | companion object Factory {
37 | fun create(): DatabaseConnection = DatabaseConnection()
38 | const val TIMEOUT = 3000
39 | }
40 | }
41 |
42 | // Object declaration (Singleton)
43 | object Configuration {
44 | var host: String = "localhost"
45 | var port: Int = 8080
46 | }
47 |
48 | interface Clickable {
49 | fun click()
50 | fun doubleClick() {
51 | click()
52 | click()
53 | }
54 | }
55 |
```
--------------------------------------------------------------------------------
/website/index.html:
--------------------------------------------------------------------------------
```html
1 | <!doctype html>
2 | <html lang="en">
3 | <head>
4 | <meta charset="UTF-8" />
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6 | <title>CodeGraphContext - AI-Powered Code Knowledge Graphs</title>
7 | <meta name="description" content="Transform your codebase into an intelligent knowledge graph for AI assistants. Index Python code, analyze relationships, and provide context with CodeGraphContext MCP server." />
8 | <meta name="author" content="Shashank Shekhar Singh" />
9 | <meta name="keywords" content="code analysis, knowledge graph, AI assistant, MCP server, Python, Neo4j, code indexing" />
10 |
11 | <meta property="og:title" content="CodeGraphContext - AI-Powered Code Knowledge Graphs" />
12 | <meta property="og:description" content="Transform your codebase into an intelligent knowledge graph for AI assistants. Index Python code, analyze relationships, and provide context." />
13 | <meta property="og:type" content="website" />
14 | <meta name="twitter:card" content="summary_large_image" />
15 | </head>
16 |
17 | <body>
18 | <div id="root"></div>
19 | <script type="module" src="/src/main.tsx"></script>
20 | </body>
21 | </html>
22 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/switch.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as SwitchPrimitives from "@radix-ui/react-switch";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const Switch = React.forwardRef<
7 | React.ElementRef<typeof SwitchPrimitives.Root>,
8 | React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
9 | >(({ className, ...props }, ref) => (
10 | <SwitchPrimitives.Root
11 | className={cn(
12 | "peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",
13 | className,
14 | )}
15 | {...props}
16 | ref={ref}
17 | >
18 | <SwitchPrimitives.Thumb
19 | className={cn(
20 | "pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
21 | )}
22 | />
23 | </SwitchPrimitives.Root>
24 | ));
25 | Switch.displayName = SwitchPrimitives.Root.displayName;
26 |
27 | export { Switch };
28 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/tooltip.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as TooltipPrimitive from "@radix-ui/react-tooltip";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const TooltipProvider = TooltipPrimitive.Provider;
7 |
8 | const Tooltip = TooltipPrimitive.Root;
9 |
10 | const TooltipTrigger = TooltipPrimitive.Trigger;
11 |
12 | const TooltipContent = React.forwardRef<
13 | React.ElementRef<typeof TooltipPrimitive.Content>,
14 | React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
15 | >(({ className, sideOffset = 4, ...props }, ref) => (
16 | <TooltipPrimitive.Content
17 | ref={ref}
18 | sideOffset={sideOffset}
19 | className={cn(
20 | "z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
21 | className,
22 | )}
23 | {...props}
24 | />
25 | ));
26 | TooltipContent.displayName = TooltipPrimitive.Content.displayName;
27 |
28 | export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
29 |
```
--------------------------------------------------------------------------------
/website/src/components/ThemeToggle.tsx:
--------------------------------------------------------------------------------
```typescript
1 | "use client"
2 |
3 | import * as React from "react"
4 | import { Moon, Sun } from "lucide-react"
5 | import { useTheme } from "next-themes"
6 | import { Button } from "@/components/ui/button"
7 | import { motion, AnimatePresence } from "framer-motion"
8 |
9 | export function ThemeToggle() {
10 | const { setTheme, theme } = useTheme()
11 |
12 | const toggleTheme = () => {
13 | setTheme(theme === 'dark' ? 'light' : 'dark')
14 | }
15 |
16 | return (
17 | <Button variant="outline" size="icon" onClick={toggleTheme} className="relative overflow-hidden">
18 | <AnimatePresence initial={false} mode="wait">
19 | <motion.div
20 | key={theme === 'dark' ? 'sun' : 'moon'}
21 | initial={{ y: 20, opacity: 0, rotate: -90 }}
22 | animate={{ y: 0, opacity: 1, rotate: 0 }}
23 | exit={{ y: -20, opacity: 0, rotate: 90 }}
24 | transition={{ duration: 0.3 }}
25 | className="absolute"
26 | >
27 | {theme === 'dark' ? (
28 | <Sun className="h-[1.2rem] w-[1.2rem]" />
29 | ) : (
30 | <Moon className="h-[1.2rem] w-[1.2rem]" />
31 | )}
32 | </motion.div>
33 | </AnimatePresence>
34 | <span className="sr-only">Toggle theme</span>
35 | </Button>
36 | )
37 | }
38 |
39 |
40 |
```
--------------------------------------------------------------------------------
/tests/sample_project_swift/Generics.swift:
--------------------------------------------------------------------------------
```swift
1 | import Foundation
2 |
3 | // Generic data structure
4 | class Stack<T> {
5 | private var items: [T] = []
6 |
7 | func push(_ item: T) {
8 | items.append(item)
9 | }
10 |
11 | func pop() -> T? {
12 | return items.isEmpty ? nil : items.removeLast()
13 | }
14 |
15 | func peek() -> T? {
16 | return items.last
17 | }
18 |
19 | var count: Int {
20 | return items.count
21 | }
22 |
23 | var isEmpty: Bool {
24 | return items.isEmpty
25 | }
26 | }
27 |
28 | // Generic function
29 | func swap<T>(_ a: inout T, _ b: inout T) {
30 | let temp = a
31 | a = b
32 | b = temp
33 | }
34 |
35 | // Protocol with associated type
36 | protocol Container {
37 | associatedtype Item
38 | mutating func append(_ item: Item)
39 | var count: Int { get }
40 | subscript(i: Int) -> Item { get }
41 | }
42 |
43 | // Array extension conforming to Container
44 | extension Array: Container {
45 | // Array already has append, count, and subscript
46 | }
47 |
48 | // Custom collection
49 | struct IntCollection: Container {
50 | typealias Item = Int
51 |
52 | private var items: [Int] = []
53 |
54 | mutating func append(_ item: Int) {
55 | items.append(item)
56 | }
57 |
58 | var count: Int {
59 | return items.count
60 | }
61 |
62 | subscript(i: Int) -> Int {
63 | return items[i]
64 | }
65 | }
66 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/hover-card.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const HoverCard = HoverCardPrimitive.Root;
7 |
8 | const HoverCardTrigger = HoverCardPrimitive.Trigger;
9 |
10 | const HoverCardContent = React.forwardRef<
11 | React.ElementRef<typeof HoverCardPrimitive.Content>,
12 | React.ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>
13 | >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
14 | <HoverCardPrimitive.Content
15 | ref={ref}
16 | align={align}
17 | sideOffset={sideOffset}
18 | className={cn(
19 | "z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
20 | className,
21 | )}
22 | {...props}
23 | />
24 | ));
25 | HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
26 |
27 | export { HoverCard, HoverCardTrigger, HoverCardContent };
28 |
```
--------------------------------------------------------------------------------
/tests/sample_project_rust/src/lib.rs:
--------------------------------------------------------------------------------
```rust
1 | // lib.rs - Main library file for Rust sample project
2 |
3 | pub mod basic_functions;
4 | pub mod structs_enums;
5 | pub mod traits;
6 | pub mod error_handling;
7 | pub mod lifetimes_references;
8 | pub mod generics;
9 | pub mod concurrency;
10 | pub mod iterators_closures;
11 | pub mod smart_pointers;
12 | pub mod modules;
13 |
14 | // Re-exports for convenience
15 | pub use basic_functions::*;
16 | pub use structs_enums::{Person, Status};
17 | pub use traits::{Describable, Area};
18 |
19 | /// Library-level documentation
20 | ///
21 | /// This is a comprehensive Rust sample project demonstrating:
22 | /// - Basic and advanced function patterns
23 | /// - Structs, enums, and their implementations
24 | /// - Traits and trait implementations
25 | /// - Error handling with Result and custom errors
26 | /// - Lifetimes and references
27 | /// - Generics and type parameters
28 | /// - Concurrency with threads and channels
29 | /// - Iterators and closures
30 | /// - Smart pointers (Box, Rc, Arc, RefCell)
31 | /// - Module organization
32 |
33 | #[cfg(test)]
34 | mod integration_tests {
35 | use super::*;
36 |
37 | #[test]
38 | fn test_basic_workflow() {
39 | let result = simple_function(5);
40 | assert_eq!(result, 10);
41 |
42 | let person = Person::new("Alice".to_string(), 30);
43 | assert_eq!(person.name, "Alice");
44 | }
45 | }
46 |
47 |
```
--------------------------------------------------------------------------------
/tests/sample_project_csharp/src/Example.App/Models/Point.cs:
--------------------------------------------------------------------------------
```csharp
1 | using System;
2 |
3 | namespace Example.App.Models
4 | {
5 | /// <summary>
6 | /// Struct for representing a 2D point
7 | /// </summary>
8 | public struct Point
9 | {
10 | public double X { get; set; }
11 | public double Y { get; set; }
12 |
13 | public Point(double x, double y)
14 | {
15 | X = x;
16 | Y = y;
17 | }
18 |
19 | public double DistanceFromOrigin()
20 | {
21 | return Math.Sqrt(X * X + Y * Y);
22 | }
23 |
24 | public static Point operator +(Point a, Point b)
25 | {
26 | return new Point(a.X + b.X, a.Y + b.Y);
27 | }
28 |
29 | public override string ToString()
30 | {
31 | return $"({X}, {Y})";
32 | }
33 | }
34 |
35 | /// <summary>
36 | /// Readonly struct for immutable coordinates
37 | /// </summary>
38 | public readonly struct Coordinate
39 | {
40 | public double Latitude { get; }
41 | public double Longitude { get; }
42 |
43 | public Coordinate(double latitude, double longitude)
44 | {
45 | Latitude = latitude;
46 | Longitude = longitude;
47 | }
48 |
49 | public override string ToString()
50 | {
51 | return $"Lat: {Latitude}, Lon: {Longitude}";
52 | }
53 | }
54 | }
55 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/popover.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as PopoverPrimitive from "@radix-ui/react-popover";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const Popover = PopoverPrimitive.Root;
7 |
8 | const PopoverTrigger = PopoverPrimitive.Trigger;
9 |
10 | const PopoverContent = React.forwardRef<
11 | React.ElementRef<typeof PopoverPrimitive.Content>,
12 | React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
13 | >(({ className, align = "center", sideOffset = 4, ...props }, ref) => (
14 | <PopoverPrimitive.Portal>
15 | <PopoverPrimitive.Content
16 | ref={ref}
17 | align={align}
18 | sideOffset={sideOffset}
19 | className={cn(
20 | "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
21 | className,
22 | )}
23 | {...props}
24 | />
25 | </PopoverPrimitive.Portal>
26 | ));
27 | PopoverContent.displayName = PopoverPrimitive.Content.displayName;
28 |
29 | export { Popover, PopoverTrigger, PopoverContent };
30 |
```
--------------------------------------------------------------------------------
/tests/sample_project_csharp/src/Example.App/Services/GreetingService.cs:
--------------------------------------------------------------------------------
```csharp
1 | using System;
2 | using Example.App.Models;
3 |
4 | namespace Example.App.Services
5 | {
6 | /// <summary>
7 | /// Implementation of greeting service
8 | /// </summary>
9 | public class GreetingService : IGreetingService
10 | {
11 | private readonly string _defaultGreeting = "Hello";
12 |
13 | public GreetingService()
14 | {
15 | }
16 |
17 | public GreetingService(string defaultGreeting)
18 | {
19 | _defaultGreeting = defaultGreeting;
20 | }
21 |
22 | public string Greet(User user)
23 | {
24 | if (user == null)
25 | {
26 | throw new ArgumentNullException(nameof(user));
27 | }
28 |
29 | return FormatGreeting(user);
30 | }
31 |
32 | private string FormatGreeting(User user)
33 | {
34 | string rolePrefix = GetRolePrefix(user.Role);
35 | return $"{_defaultGreeting}, {rolePrefix}{user.Name}!";
36 | }
37 |
38 | private string GetRolePrefix(Role role)
39 | {
40 | return role switch
41 | {
42 | Role.Admin => "Administrator ",
43 | Role.SuperAdmin => "Super Admin ",
44 | Role.User => "",
45 | Role.Guest => "Guest ",
46 | _ => ""
47 | };
48 | }
49 | }
50 | }
51 |
```
--------------------------------------------------------------------------------
/tests/sample_project_csharp/src/Example.App/Utils/CollectionHelper.cs:
--------------------------------------------------------------------------------
```csharp
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 |
5 | namespace Example.App.Utils
6 | {
7 | /// <summary>
8 | /// Helper class for collection operations
9 | /// </summary>
10 | public static class CollectionHelper
11 | {
12 | /// <summary>
13 | /// Calculates the sum of squares of all numbers in the collection
14 | /// </summary>
15 | public static int SumOfSquares(IEnumerable<int> numbers)
16 | {
17 | if (numbers == null)
18 | {
19 | throw new ArgumentNullException(nameof(numbers));
20 | }
21 |
22 | return numbers.Select(n => n * n).Sum();
23 | }
24 |
25 | /// <summary>
26 | /// Filters even numbers from the collection
27 | /// </summary>
28 | public static IEnumerable<int> FilterEven(IEnumerable<int> numbers)
29 | {
30 | return numbers.Where(n => n % 2 == 0);
31 | }
32 |
33 | /// <summary>
34 | /// Finds the maximum value in the collection
35 | /// </summary>
36 | public static int FindMax(IEnumerable<int> numbers)
37 | {
38 | if (!numbers.Any())
39 | {
40 | throw new InvalidOperationException("Collection is empty");
41 | }
42 |
43 | return numbers.Max();
44 | }
45 | }
46 | }
47 |
```
--------------------------------------------------------------------------------
/tests/sample_project_swift/Shapes.swift:
--------------------------------------------------------------------------------
```swift
1 | import Foundation
2 |
3 | // Protocol for shapes
4 | protocol Shape {
5 | func area() -> Double
6 | func perimeter() -> Double
7 | }
8 |
9 | // Circle class implementing Shape
10 | class Circle: Shape {
11 | let radius: Double
12 |
13 | init(radius: Double) {
14 | self.radius = radius
15 | }
16 |
17 | func area() -> Double {
18 | return Double.pi * radius * radius
19 | }
20 |
21 | func perimeter() -> Double {
22 | return 2 * Double.pi * radius
23 | }
24 | }
25 |
26 | // Rectangle struct implementing Shape
27 | struct Rectangle: Shape {
28 | let width: Double
29 | let height: Double
30 |
31 | func area() -> Double {
32 | return width * height
33 | }
34 |
35 | func perimeter() -> Double {
36 | return 2 * (width + height)
37 | }
38 |
39 | func isSquare() -> Bool {
40 | return width == height
41 | }
42 | }
43 |
44 | // Triangle class implementing Shape
45 | class Triangle: Shape {
46 | let base: Double
47 | let height: Double
48 | let sideA: Double
49 | let sideB: Double
50 |
51 | init(base: Double, height: Double, sideA: Double, sideB: Double) {
52 | self.base = base
53 | self.height = height
54 | self.sideA = sideA
55 | self.sideB = sideB
56 | }
57 |
58 | func area() -> Double {
59 | return 0.5 * base * height
60 | }
61 |
62 | func perimeter() -> Double {
63 | return base + sideA + sideB
64 | }
65 | }
66 |
```
--------------------------------------------------------------------------------
/tests/sample_project_kotlin/Functions.kt:
--------------------------------------------------------------------------------
```kotlin
1 | package com.example.project.functions
2 |
3 | // Higher-Order Function
4 | fun <T> List<T>.customFilter(predicate: (T) -> Boolean): List<T> {
5 | val result = ArrayList<T>()
6 | for (item in this) {
7 | if (predicate(item)) {
8 | result.add(item)
9 | }
10 | }
11 | return result
12 | }
13 |
14 | // Extension Function
15 | fun String.removeSpaces(): String {
16 | return this.replace(" ", "")
17 | }
18 |
19 | // Inline Function
20 | inline fun <T> lock(lock: Any, body: () -> T): T {
21 | // simulated lock
22 | return body()
23 | }
24 |
25 | // Function with default args
26 | fun join(
27 | elements: List<String>,
28 | separator: String = ", ",
29 | prefix: String = "",
30 | postfix: String = ""
31 | ): String {
32 | return prefix + elements.joinToString(separator) + postfix
33 | }
34 |
35 | // Single Expression Function
36 | fun double(x: Int): Int = x * 2
37 |
38 | class Calculator {
39 | // Operator overloading
40 | operator fun plus(other: Calculator): Calculator = Calculator()
41 |
42 | // Infix function
43 | infix fun add(x: Int): Int {
44 | return x + 10
45 | }
46 | }
47 |
48 | fun usage() {
49 | val list = listOf(1, 2, 3)
50 | val filtered = list.customFilter { it > 1 }
51 |
52 | val text = "Hello World"
53 | println(text.removeSpaces())
54 |
55 | val calc = Calculator()
56 | val res = calc add 5
57 |
58 | lock(calc) {
59 | println("Inside lock")
60 | }
61 | }
62 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/avatar.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as AvatarPrimitive from "@radix-ui/react-avatar";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const Avatar = React.forwardRef<
7 | React.ElementRef<typeof AvatarPrimitive.Root>,
8 | React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
9 | >(({ className, ...props }, ref) => (
10 | <AvatarPrimitive.Root
11 | ref={ref}
12 | className={cn("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full", className)}
13 | {...props}
14 | />
15 | ));
16 | Avatar.displayName = AvatarPrimitive.Root.displayName;
17 |
18 | const AvatarImage = React.forwardRef<
19 | React.ElementRef<typeof AvatarPrimitive.Image>,
20 | React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
21 | >(({ className, ...props }, ref) => (
22 | <AvatarPrimitive.Image ref={ref} className={cn("aspect-square h-full w-full", className)} {...props} />
23 | ));
24 | AvatarImage.displayName = AvatarPrimitive.Image.displayName;
25 |
26 | const AvatarFallback = React.forwardRef<
27 | React.ElementRef<typeof AvatarPrimitive.Fallback>,
28 | React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
29 | >(({ className, ...props }, ref) => (
30 | <AvatarPrimitive.Fallback
31 | ref={ref}
32 | className={cn("flex h-full w-full items-center justify-center rounded-full bg-muted", className)}
33 | {...props}
34 | />
35 | ));
36 | AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
37 |
38 | export { Avatar, AvatarImage, AvatarFallback };
39 |
```
--------------------------------------------------------------------------------
/.github/workflows/post_discord_invite.yml:
--------------------------------------------------------------------------------
```yaml
1 | name: Post Discord Invite on Issue or PR
2 |
3 | permissions:
4 | issues: write
5 | pull-requests: write
6 |
7 | on:
8 | issues:
9 | types: [opened]
10 | pull_request:
11 | types: [opened]
12 |
13 | jobs:
14 | post_discord_invite:
15 | # Skip if the event is a PR from a fork; still run for issues and in-repo PRs
16 | if: ${{ github.event_name == 'issues' || (github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork) }}
17 | runs-on: ubuntu-latest
18 | steps:
19 | - name: Post Discord Invite Comment
20 | uses: actions/github-script@v6
21 | with:
22 | github-token: ${{ secrets.GITHUB_TOKEN }}
23 | script: |
24 | const discord_link = "https://discord.gg/dR4QY32uYQ";
25 |
26 | let number;
27 | if (context.payload.issue) {
28 | number = context.payload.issue.number;
29 | } else if (context.payload.pull_request) {
30 | number = context.payload.pull_request.number;
31 | } else {
32 | console.log("No issue or PR found. Exiting.");
33 | return;
34 | }
35 |
36 | console.log("Detected issue/PR number:", number);
37 |
38 | await github.rest.issues.createComment({
39 | owner: context.repo.owner,
40 | repo: context.repo.repo,
41 | issue_number: number,
42 | body: `Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: ${discord_link}`
43 | });
44 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/toggle.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as TogglePrimitive from "@radix-ui/react-toggle";
3 | import { cva, type VariantProps } from "class-variance-authority";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | const toggleVariants = cva(
8 | "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
9 | {
10 | variants: {
11 | variant: {
12 | default: "bg-transparent",
13 | outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",
14 | },
15 | size: {
16 | default: "h-10 px-3",
17 | sm: "h-9 px-2.5",
18 | lg: "h-11 px-5",
19 | },
20 | },
21 | defaultVariants: {
22 | variant: "default",
23 | size: "default",
24 | },
25 | },
26 | );
27 |
28 | const Toggle = React.forwardRef<
29 | React.ElementRef<typeof TogglePrimitive.Root>,
30 | React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> & VariantProps<typeof toggleVariants>
31 | >(({ className, variant, size, ...props }, ref) => (
32 | <TogglePrimitive.Root ref={ref} className={cn(toggleVariants({ variant, size, className }))} {...props} />
33 | ));
34 |
35 | Toggle.displayName = TogglePrimitive.Root.displayName;
36 |
37 | export { Toggle, toggleVariants };
38 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/radio-group.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
3 | import { Circle } from "lucide-react";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | const RadioGroup = React.forwardRef<
8 | React.ElementRef<typeof RadioGroupPrimitive.Root>,
9 | React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>
10 | >(({ className, ...props }, ref) => {
11 | return <RadioGroupPrimitive.Root className={cn("grid gap-2", className)} {...props} ref={ref} />;
12 | });
13 | RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
14 |
15 | const RadioGroupItem = React.forwardRef<
16 | React.ElementRef<typeof RadioGroupPrimitive.Item>,
17 | React.ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>
18 | >(({ className, ...props }, ref) => {
19 | return (
20 | <RadioGroupPrimitive.Item
21 | ref={ref}
22 | className={cn(
23 | "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
24 | className,
25 | )}
26 | {...props}
27 | >
28 | <RadioGroupPrimitive.Indicator className="flex items-center justify-center">
29 | <Circle className="h-2.5 w-2.5 fill-current text-current" />
30 | </RadioGroupPrimitive.Indicator>
31 | </RadioGroupPrimitive.Item>
32 | );
33 | });
34 | RadioGroupItem.displayName = RadioGroupPrimitive.Item.displayName;
35 |
36 | export { RadioGroup, RadioGroupItem };
37 |
```
--------------------------------------------------------------------------------
/tests/sample_project_csharp/src/Example.App/Program.cs:
--------------------------------------------------------------------------------
```csharp
1 | using System;
2 | using System.Collections.Generic;
3 | using Example.App.Models;
4 | using Example.App.Services;
5 | using Example.App.Utils;
6 |
7 | namespace Example.App
8 | {
9 | /// <summary>
10 | /// Main program entry point
11 | /// </summary>
12 | public class Program
13 | {
14 | public static void Main(string[] args)
15 | {
16 | // Create a greeting service
17 | IGreetingService greetingService = new GreetingService();
18 |
19 | // Create a user
20 | var user = new User("Alice", Role.Admin);
21 |
22 | // Greet the user
23 | string greeting = greetingService.Greet(user);
24 | Console.WriteLine(greeting);
25 |
26 | // Use collection utilities
27 | var numbers = new List<int> { 1, 2, 3, 4, 5 };
28 | int sumOfSquares = CollectionHelper.SumOfSquares(numbers);
29 | Console.WriteLine($"Sum of squares: {sumOfSquares}");
30 |
31 | // Use file helper
32 | try
33 | {
34 | string firstLine = FileHelper.ReadFirstLine("README.md");
35 | Console.WriteLine($"First line: {firstLine}");
36 | }
37 | catch (Exception ex)
38 | {
39 | Console.WriteLine($"File read failed: {ex.Message}");
40 | }
41 |
42 | // Demonstrate nested class
43 | var outer = new OuterClass("outer");
44 | var inner = outer.CreateInner("inner");
45 | Console.WriteLine(inner.Combine());
46 | }
47 | }
48 | }
49 |
```
--------------------------------------------------------------------------------
/website/src/pages/Index.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import HeroSection from "../components/HeroSection";
2 | import FeaturesSection from "../components/FeaturesSection";
3 | import InstallationSection from "../components/InstallationSection";
4 | import DemoSection from "../components/DemoSection";
5 | import ExamplesSection from "../components/ExamplesSection";
6 | import CookbookSection from "../components/CookbookSection";
7 | import Footer from "../components/Footer";
8 | import TestimonialSection from "../components/TestimonialSection";
9 | import SocialMentionsTimeline from "../components/SocialMentionsTimeline";
10 | import ComparisonTable from "../components/ComparisonTable";
11 |
12 | const Index = () => {
13 | return (
14 | <main className="min-h-screen overflow-x-hidden">
15 | <div data-aos="fade-in">
16 | <HeroSection />
17 | </div>
18 | <div data-aos="fade-up">
19 | <DemoSection />
20 | </div>
21 | <div data-aos="fade-up">
22 | <ComparisonTable />
23 | </div>
24 | <div data-aos="fade-up">
25 | <FeaturesSection />
26 | </div>
27 | <div data-aos="fade-up">
28 | <InstallationSection />
29 | </div>
30 | <div data-aos="fade-up">
31 | <ExamplesSection />
32 | </div>
33 | <div data-aos="fade-up">
34 | <TestimonialSection />
35 | </div>
36 | <div data-aos="fade-up">
37 | <CookbookSection />
38 | </div>
39 | <div data-aos="fade-up">
40 | <SocialMentionsTimeline />
41 | </div>
42 | <div data-aos="fade-up" data-aos-anchor-placement="top-bottom">
43 | <Footer />
44 | </div>
45 | </main>
46 | );
47 | };
48 |
49 | export default Index;
50 |
51 |
```
--------------------------------------------------------------------------------
/tests/sample_project_csharp/src/Example.App/Utils/FileHelper.cs:
--------------------------------------------------------------------------------
```csharp
1 | using System;
2 | using System.IO;
3 |
4 | namespace Example.App.Utils
5 | {
6 | /// <summary>
7 | /// Helper class for file I/O operations
8 | /// </summary>
9 | public static class FileHelper
10 | {
11 | /// <summary>
12 | /// Reads the first line from a file
13 | /// </summary>
14 | public static string ReadFirstLine(string filePath)
15 | {
16 | if (string.IsNullOrEmpty(filePath))
17 | {
18 | throw new ArgumentException("File path cannot be null or empty", nameof(filePath));
19 | }
20 |
21 | if (!File.Exists(filePath))
22 | {
23 | throw new FileNotFoundException($"File not found: {filePath}");
24 | }
25 |
26 | using (var reader = new StreamReader(filePath))
27 | {
28 | return reader.ReadLine() ?? string.Empty;
29 | }
30 | }
31 |
32 | /// <summary>
33 | /// Writes text to a file
34 | /// </summary>
35 | public static void WriteToFile(string filePath, string content)
36 | {
37 | if (string.IsNullOrEmpty(filePath))
38 | {
39 | throw new ArgumentException("File path cannot be null or empty", nameof(filePath));
40 | }
41 |
42 | File.WriteAllText(filePath, content);
43 | }
44 |
45 | /// <summary>
46 | /// Checks if a file exists
47 | /// </summary>
48 | public static bool FileExists(string filePath)
49 | {
50 | return !string.IsNullOrEmpty(filePath) && File.Exists(filePath);
51 | }
52 | }
53 | }
54 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/alert.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { cva, type VariantProps } from "class-variance-authority";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const alertVariants = cva(
7 | "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
8 | {
9 | variants: {
10 | variant: {
11 | default: "bg-background text-foreground",
12 | destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive",
13 | },
14 | },
15 | defaultVariants: {
16 | variant: "default",
17 | },
18 | },
19 | );
20 |
21 | const Alert = React.forwardRef<
22 | HTMLDivElement,
23 | React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
24 | >(({ className, variant, ...props }, ref) => (
25 | <div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
26 | ));
27 | Alert.displayName = "Alert";
28 |
29 | const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
30 | ({ className, ...props }, ref) => (
31 | <h5 ref={ref} className={cn("mb-1 font-medium leading-none tracking-tight", className)} {...props} />
32 | ),
33 | );
34 | AlertTitle.displayName = "AlertTitle";
35 |
36 | const AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
37 | ({ className, ...props }, ref) => (
38 | <div ref={ref} className={cn("text-sm [&_p]:leading-relaxed", className)} {...props} />
39 | ),
40 | );
41 | AlertDescription.displayName = "AlertDescription";
42 |
43 | export { Alert, AlertTitle, AlertDescription };
44 |
```
--------------------------------------------------------------------------------
/tests/sample_project_swift/Vehicles.swift:
--------------------------------------------------------------------------------
```swift
1 | import Foundation
2 |
3 | // Enum for different types of vehicles
4 | enum VehicleType {
5 | case car
6 | case truck
7 | case motorcycle
8 | case bicycle
9 |
10 | func description() -> String {
11 | switch self {
12 | case .car:
13 | return "Four-wheeled vehicle"
14 | case .truck:
15 | return "Large cargo vehicle"
16 | case .motorcycle:
17 | return "Two-wheeled motorized vehicle"
18 | case .bicycle:
19 | return "Two-wheeled pedal vehicle"
20 | }
21 | }
22 | }
23 |
24 | // Enum with associated values
25 | enum Result<T> {
26 | case success(T)
27 | case failure(Error)
28 |
29 | func getValue() -> T? {
30 | switch self {
31 | case .success(let value):
32 | return value
33 | case .failure:
34 | return nil
35 | }
36 | }
37 | }
38 |
39 | // Vehicle class
40 | class Vehicle {
41 | let type: VehicleType
42 | var speed: Double
43 |
44 | init(type: VehicleType, speed: Double = 0.0) {
45 | self.type = type
46 | self.speed = speed
47 | }
48 |
49 | func accelerate(by amount: Double) {
50 | speed += amount
51 | }
52 |
53 | func brake(by amount: Double) {
54 | speed = max(0, speed - amount)
55 | }
56 |
57 | func getInfo() -> String {
58 | return "\(type.description()) traveling at \(speed) km/h"
59 | }
60 | }
61 |
62 | // Car class inheriting from Vehicle
63 | class Car: Vehicle {
64 | let numberOfDoors: Int
65 |
66 | init(numberOfDoors: Int, speed: Double = 0.0) {
67 | self.numberOfDoors = numberOfDoors
68 | super.init(type: .car, speed: speed)
69 | }
70 |
71 | override func getInfo() -> String {
72 | return "\(numberOfDoors)-door car traveling at \(speed) km/h"
73 | }
74 | }
75 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/scroll-area.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const ScrollArea = React.forwardRef<
7 | React.ElementRef<typeof ScrollAreaPrimitive.Root>,
8 | React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
9 | >(({ className, children, ...props }, ref) => (
10 | <ScrollAreaPrimitive.Root ref={ref} className={cn("relative overflow-hidden", className)} {...props}>
11 | <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">{children}</ScrollAreaPrimitive.Viewport>
12 | <ScrollBar />
13 | <ScrollAreaPrimitive.Corner />
14 | </ScrollAreaPrimitive.Root>
15 | ));
16 | ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
17 |
18 | const ScrollBar = React.forwardRef<
19 | React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
20 | React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
21 | >(({ className, orientation = "vertical", ...props }, ref) => (
22 | <ScrollAreaPrimitive.ScrollAreaScrollbar
23 | ref={ref}
24 | orientation={orientation}
25 | className={cn(
26 | "flex touch-none select-none transition-colors",
27 | orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
28 | orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
29 | className,
30 | )}
31 | {...props}
32 | >
33 | <ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
34 | </ScrollAreaPrimitive.ScrollAreaScrollbar>
35 | ));
36 | ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
37 |
38 | export { ScrollArea, ScrollBar };
39 |
```
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
```toml
1 | [project]
2 | name = "codegraphcontext"
3 | version = "0.1.32"
4 | description = "An MCP server that indexes local code into a graph database to provide context to AI assistants."
5 | authors = [{ name = "Shashank Shekhar Singh", email = "[email protected]" }]
6 | readme = "README.md"
7 | license = { file = "LICENSE" }
8 | requires-python = ">=3.10"
9 | classifiers = [
10 | "Programming Language :: Python :: 3",
11 | "License :: OSI Approved :: MIT License",
12 | "Operating System :: OS Independent",
13 | "Development Status :: 3 - Alpha",
14 | "Intended Audience :: Developers",
15 | "Topic :: Software Development :: Libraries :: Application Frameworks",
16 | ]
17 | dependencies = [
18 | "neo4j>=5.15.0",
19 | "watchdog>=3.0.0",
20 | "stdlibs>=2023.11.18",
21 | "typer[all]>=0.9.0",
22 | "rich>=13.7.0",
23 | "inquirerpy>=0.3.4",
24 | "python-dotenv>=1.0.0",
25 | "tree-sitter>=0.21.0",
26 | "tree-sitter-language-pack>=0.6.0",
27 | "pyyaml",
28 | "pytest",
29 | "nbformat",
30 | "nbconvert>=7.16.6",
31 | "pathspec>=0.12.1",
32 | "falkordblite>=0.1.0; sys_platform != 'win32' and python_version >= '3.12'"
33 | ]
34 |
35 | [project.optional-dependencies]
36 | parsing = [
37 | "tree-sitter>=0.21.0",
38 | "tree-sitter-language-pack>=0.6.0",
39 | ]
40 | dev = [
41 | "pytest>=7.4.0",
42 | "black>=23.11.0",
43 | "pytest-asyncio>=0.21.0",
44 | ]
45 |
46 | [project.urls]
47 | "Homepage" = "https://github.com/Shashankss1205/CodeGraphContext"
48 | "Bug Tracker" = "https://github.com/Shashankss1205/CodeGraphContext/issues"
49 |
50 | [project.scripts]
51 | cgc = "codegraphcontext.cli.main:app"
52 | codegraphcontext = "codegraphcontext.cli.main:app"
53 |
54 | [tool.setuptools]
55 | package-dir = { "" = "src" }
56 |
57 | [tool.setuptools.packages.find]
58 | where = ["src"]
59 | include = ["codegraphcontext*"]
60 |
```
--------------------------------------------------------------------------------
/website/src/App.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import { useEffect } from "react";
2 | import { Toaster } from "@/components/ui/toaster";
3 | import { Toaster as Sonner } from "@/components/ui/sonner";
4 | import { TooltipProvider } from "@/components/ui/tooltip";
5 | import { ThemeProvider } from "@/components/ThemeProvider";
6 | import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
7 | import { BrowserRouter, Routes, Route } from "react-router-dom";
8 | import Index from "./pages/Index";
9 | import NotFound from "./pages/NotFound";
10 | import MoveToTop from "./components/MoveToTop";
11 |
12 | // ✅ Import AOS library and CSS
13 | import AOS from "aos";
14 | import "aos/dist/aos.css";
15 |
16 | const queryClient = new QueryClient();
17 |
18 | const App: React.FC = () => {
19 | // ✅ Initialize AOS once on mount
20 | useEffect(() => {
21 | AOS.init({
22 | duration: 800, // Animation duration (ms)
23 | easing: "ease-in-out", // Smooth transition
24 | once: true, // Run animation only once
25 | mirror: false, // Do not animate when scrolling back up
26 | });
27 | }, []);
28 |
29 | return (
30 | <QueryClientProvider client={queryClient}>
31 | <ThemeProvider
32 | attribute="class"
33 | defaultTheme="dark"
34 | enableSystem
35 | disableTransitionOnChange
36 | >
37 | <TooltipProvider>
38 | <Toaster />
39 | <Sonner />
40 | <BrowserRouter>
41 | <Routes>
42 | <Route path="/" element={<Index />} />
43 | {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
44 | <Route path="*" element={<NotFound />} />
45 | </Routes>
46 | </BrowserRouter>
47 |
48 | {/* Move to Top button */}
49 | <MoveToTop />
50 | </TooltipProvider>
51 | </ThemeProvider>
52 | </QueryClientProvider>
53 | );
54 | };
55 |
56 | export default App;
57 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/resizable.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import { GripVertical } from "lucide-react";
2 | import * as ResizablePrimitive from "react-resizable-panels";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const ResizablePanelGroup = ({ className, ...props }: React.ComponentProps<typeof ResizablePrimitive.PanelGroup>) => (
7 | <ResizablePrimitive.PanelGroup
8 | className={cn("flex h-full w-full data-[panel-group-direction=vertical]:flex-col", className)}
9 | {...props}
10 | />
11 | );
12 |
13 | const ResizablePanel = ResizablePrimitive.Panel;
14 |
15 | const ResizableHandle = ({
16 | withHandle,
17 | className,
18 | ...props
19 | }: React.ComponentProps<typeof ResizablePrimitive.PanelResizeHandle> & {
20 | withHandle?: boolean;
21 | }) => (
22 | <ResizablePrimitive.PanelResizeHandle
23 | className={cn(
24 | "relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 [&[data-panel-group-direction=vertical]>div]:rotate-90",
25 | className,
26 | )}
27 | {...props}
28 | >
29 | {withHandle && (
30 | <div className="z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border">
31 | <GripVertical className="h-2.5 w-2.5" />
32 | </div>
33 | )}
34 | </ResizablePrimitive.PanelResizeHandle>
35 | );
36 |
37 | export { ResizablePanelGroup, ResizablePanel, ResizableHandle };
38 |
```
--------------------------------------------------------------------------------
/website/src/components/ShowDownloads.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import { useEffect, useState } from "react";
2 |
3 | const LAST_MONTH_KEY = "cgc_last_month_downloads";
4 | type PypiStats = {
5 | data: {
6 | last_day: number;
7 | last_month: number;
8 | last_week: number;
9 | };
10 | package: string;
11 | type: string;
12 | };
13 |
14 | export default function ShowDownloads() {
15 | const [stats, setStats] = useState<PypiStats | null>(null);
16 | const [error, setError] = useState<string | null>(null);
17 |
18 | useEffect(() => {
19 | async function fetchStats() {
20 | try {
21 | const res = await fetch("/api/pypi/packages/codegraphcontext/recent");
22 |
23 | if (!res.ok) {
24 | throw new Error(`API error: ${res.status}`);
25 | }
26 |
27 | const data = await res.json();
28 |
29 | // Save last successful monthly downloads
30 | if (data?.data?.last_month) {
31 | localStorage.setItem(
32 | LAST_MONTH_KEY,
33 | data.data.last_month.toString()
34 | );
35 | }
36 |
37 | setStats(data);
38 | } catch (err: unknown) {
39 | // Trying to use last saved value
40 | const savedLastMonth = localStorage.getItem(LAST_MONTH_KEY);
41 |
42 | if (savedLastMonth) {
43 | setStats({
44 | data: {
45 | last_day: 0,
46 | last_week: 0,
47 | last_month: Number(savedLastMonth),
48 | },
49 | package: "codegraphcontext",
50 | type: "fallback",
51 | });
52 | } else {
53 | setError((err as Error).message);
54 | }
55 | }
56 | }
57 |
58 | fetchStats();
59 | }, []);
60 |
61 | if (error) return <p className="text-red-500">Error: {error}</p>;
62 | if (!stats) return <p>Loading stats...</p>;
63 |
64 | return (
65 | <div data-aos="fade-in">
66 | {stats?.data ? (
67 | <>
68 | <p>Last month downloads: {stats.data.last_month.toLocaleString()}+</p>
69 | </>
70 | ) : (
71 | <p>No data available yet for this package</p>
72 | )}
73 | </div>
74 | );
75 | }
```
--------------------------------------------------------------------------------
/website/src/components/ui/toggle-group.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
3 | import { type VariantProps } from "class-variance-authority";
4 |
5 | import { cn } from "@/lib/utils";
6 | import { toggleVariants } from "@/components/ui/toggle";
7 |
8 | const ToggleGroupContext = React.createContext<VariantProps<typeof toggleVariants>>({
9 | size: "default",
10 | variant: "default",
11 | });
12 |
13 | const ToggleGroup = React.forwardRef<
14 | React.ElementRef<typeof ToggleGroupPrimitive.Root>,
15 | React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Root> & VariantProps<typeof toggleVariants>
16 | >(({ className, variant, size, children, ...props }, ref) => (
17 | <ToggleGroupPrimitive.Root ref={ref} className={cn("flex items-center justify-center gap-1", className)} {...props}>
18 | <ToggleGroupContext.Provider value={{ variant, size }}>{children}</ToggleGroupContext.Provider>
19 | </ToggleGroupPrimitive.Root>
20 | ));
21 |
22 | ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
23 |
24 | const ToggleGroupItem = React.forwardRef<
25 | React.ElementRef<typeof ToggleGroupPrimitive.Item>,
26 | React.ComponentPropsWithoutRef<typeof ToggleGroupPrimitive.Item> & VariantProps<typeof toggleVariants>
27 | >(({ className, children, variant, size, ...props }, ref) => {
28 | const context = React.useContext(ToggleGroupContext);
29 |
30 | return (
31 | <ToggleGroupPrimitive.Item
32 | ref={ref}
33 | className={cn(
34 | toggleVariants({
35 | variant: context.variant || variant,
36 | size: context.size || size,
37 | }),
38 | className,
39 | )}
40 | {...props}
41 | >
42 | {children}
43 | </ToggleGroupPrimitive.Item>
44 | );
45 | });
46 |
47 | ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
48 |
49 | export { ToggleGroup, ToggleGroupItem };
50 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/orbiting-circles.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import React from "react"
2 |
3 | import { cn } from "@/lib/utils"
4 |
5 | export interface OrbitingCirclesProps
6 | extends React.HTMLAttributes<HTMLDivElement> {
7 | className?: string
8 | children?: React.ReactNode
9 | reverse?: boolean
10 | duration?: number
11 | delay?: number
12 | radius?: number
13 | path?: boolean
14 | iconSize?: number
15 | speed?: number
16 | }
17 |
18 | export function OrbitingCircles({
19 | className,
20 | children,
21 | reverse,
22 | duration = 20,
23 | radius = 160,
24 | path = true,
25 | iconSize = 30,
26 | speed = 1,
27 | ...props
28 | }: OrbitingCirclesProps) {
29 | const calculatedDuration = duration / speed
30 | return (
31 | <>
32 | {path && (
33 | <svg
34 | xmlns="http://www.w3.org/2000/svg"
35 | version="1.1"
36 | className="pointer-events-none absolute inset-0 size-full"
37 | >
38 | <circle
39 | className="stroke-black/10 stroke-1 dark:stroke-white/10"
40 | cx="50%"
41 | cy="50%"
42 | r={radius}
43 | fill="none"
44 | />
45 | </svg>
46 | )}
47 | {React.Children.map(children, (child, index) => {
48 | const angle = (360 / React.Children.count(children)) * index
49 | return (
50 | <div
51 | style={
52 | {
53 | "--duration": calculatedDuration,
54 | "--radius": radius,
55 | "--angle": angle,
56 | "--icon-size": `${iconSize}px`,
57 | } as React.CSSProperties
58 | }
59 | className={cn(
60 | `animate-orbit absolute flex size-[var(--icon-size)] transform-gpu items-center justify-center rounded-full`,
61 | { "[animation-direction:reverse]": reverse },
62 | className
63 | )}
64 | {...props}
65 | >
66 | {child}
67 | </div>
68 | )
69 | })}
70 | </>
71 | )
72 | }
73 |
```
--------------------------------------------------------------------------------
/tests/sample_project/edge_cases/long_functions.py:
--------------------------------------------------------------------------------
```python
1 | def long_loop_example(n):
2 | result = []
3 | for i in range(n):
4 | if i % 2 == 0:
5 | result.append(i * 2)
6 | else:
7 | result.append(i + 3)
8 | if i % 5 == 0:
9 | result.append(i - 1)
10 | if i % 7 == 0:
11 | result.append(i * i)
12 | if i % 3 == 0:
13 | result.append(i // 2)
14 | if i % 4 == 0:
15 | result.append(i + 10)
16 | if i % 6 == 0:
17 | result.append(i - 5)
18 | if i % 8 == 0:
19 | result.append(i * 3)
20 | if i % 9 == 0:
21 | result.append(i + 7)
22 | if i % 10 == 0:
23 | result.append(i - 2)
24 | return result
25 |
26 | def verbose_conditions(x, y):
27 | if x > 0:
28 | a = x + y
29 | else:
30 | a = x - y
31 | if y > 0:
32 | b = y * 2
33 | else:
34 | b = y // 2
35 | if x == y:
36 | c = x * y
37 | else:
38 | c = x + y
39 | if x % 2 == 0:
40 | d = x // 2
41 | else:
42 | d = x * 2
43 | if y % 3 == 0:
44 | e = y // 3
45 | else:
46 | e = y * 3
47 | if x > 10:
48 | f = x - 10
49 | else:
50 | f = x + 10
51 | return a + b + c + d + e + f
52 |
53 | def extended_try_except(val):
54 | try:
55 | if val < 0:
56 | raise ValueError("Negative value")
57 | elif val == 0:
58 | raise ZeroDivisionError("Zero value")
59 | elif val > 100:
60 | raise OverflowError("Too large")
61 | result = val * 2
62 | for i in range(5):
63 | result += i
64 | if result % 2 == 0:
65 | result //= 2
66 | else:
67 | result += 1
68 | return result
69 | except ValueError as ve:
70 | return str(ve)
71 | except ZeroDivisionError as zde:
72 | return str(zde)
73 | except OverflowError as oe:
74 | return str(oe)
75 | except Exception as e:
76 | return "Unknown error: " + str(e)
77 | finally:
78 | _ = "done"
```
--------------------------------------------------------------------------------
/website/src/components/ui/card.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 |
3 | import { cn } from "@/lib/utils";
4 |
5 | const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => (
6 | <div ref={ref} className={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)} {...props} />
7 | ));
8 | Card.displayName = "Card";
9 |
10 | const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
11 | ({ className, ...props }, ref) => (
12 | <div ref={ref} className={cn("flex flex-col space-y-1.5 p-6", className)} {...props} />
13 | ),
14 | );
15 | CardHeader.displayName = "CardHeader";
16 |
17 | const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
18 | ({ className, ...props }, ref) => (
19 | <h3 ref={ref} className={cn("text-2xl font-semibold leading-none tracking-tight", className)} {...props} />
20 | ),
21 | );
22 | CardTitle.displayName = "CardTitle";
23 |
24 | const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
25 | ({ className, ...props }, ref) => (
26 | <p ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
27 | ),
28 | );
29 | CardDescription.displayName = "CardDescription";
30 |
31 | const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
32 | ({ className, ...props }, ref) => <div ref={ref} className={cn("p-6 pt-0", className)} {...props} />,
33 | );
34 | CardContent.displayName = "CardContent";
35 |
36 | const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
37 | ({ className, ...props }, ref) => (
38 | <div ref={ref} className={cn("flex items-center p-6 pt-0", className)} {...props} />
39 | ),
40 | );
41 | CardFooter.displayName = "CardFooter";
42 |
43 | export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
44 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/button.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { Slot } from "@radix-ui/react-slot";
3 | import { cva, type VariantProps } from "class-variance-authority";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | const buttonVariants = cva(
8 | "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
9 | {
10 | variants: {
11 | variant: {
12 | default: "bg-primary text-primary-foreground hover:bg-primary/90",
13 | destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
14 | outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
15 | secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
16 | ghost: "hover:bg-accent hover:text-accent-foreground",
17 | link: "text-primary underline-offset-4 hover:underline",
18 | },
19 | size: {
20 | default: "h-10 px-4 py-2",
21 | sm: "h-9 rounded-md px-3",
22 | lg: "h-11 rounded-md px-8",
23 | icon: "h-10 w-10",
24 | },
25 | },
26 | defaultVariants: {
27 | variant: "default",
28 | size: "default",
29 | },
30 | },
31 | );
32 |
33 | export interface ButtonProps
34 | extends React.ButtonHTMLAttributes<HTMLButtonElement>,
35 | VariantProps<typeof buttonVariants> {
36 | asChild?: boolean;
37 | }
38 |
39 | const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
40 | ({ className, variant, size, asChild = false, ...props }, ref) => {
41 | const Comp = asChild ? Slot : "button";
42 | return <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />;
43 | },
44 | );
45 | Button.displayName = "Button";
46 |
47 | export { Button, buttonVariants };
48 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/tabs.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as TabsPrimitive from "@radix-ui/react-tabs";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const Tabs = TabsPrimitive.Root;
7 |
8 | const TabsList = React.forwardRef<
9 | React.ElementRef<typeof TabsPrimitive.List>,
10 | React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>
11 | >(({ className, ...props }, ref) => (
12 | <TabsPrimitive.List
13 | ref={ref}
14 | className={cn(
15 | "inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
16 | className,
17 | )}
18 | {...props}
19 | />
20 | ));
21 | TabsList.displayName = TabsPrimitive.List.displayName;
22 |
23 | const TabsTrigger = React.forwardRef<
24 | React.ElementRef<typeof TabsPrimitive.Trigger>,
25 | React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
26 | >(({ className, ...props }, ref) => (
27 | <TabsPrimitive.Trigger
28 | ref={ref}
29 | className={cn(
30 | "inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
31 | className,
32 | )}
33 | {...props}
34 | />
35 | ));
36 | TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
37 |
38 | const TabsContent = React.forwardRef<
39 | React.ElementRef<typeof TabsPrimitive.Content>,
40 | React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
41 | >(({ className, ...props }, ref) => (
42 | <TabsPrimitive.Content
43 | ref={ref}
44 | className={cn(
45 | "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
46 | className,
47 | )}
48 | {...props}
49 | />
50 | ));
51 | TabsContent.displayName = TabsPrimitive.Content.displayName;
52 |
53 | export { Tabs, TabsList, TabsTrigger, TabsContent };
54 |
```
--------------------------------------------------------------------------------
/tests/sample_project_misc/tables.html:
--------------------------------------------------------------------------------
```html
1 | <!DOCTYPE html>
2 | <html lang="en">
3 | <head>
4 | <meta charset="UTF-8">
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | <title>Hacktoberfest Contributors</title>
7 | <link rel="stylesheet" href="tables.css">
8 | </head>
9 | <body>
10 | <h1>Hacktoberfest 2025 Contributors</h1>
11 |
12 | <table>
13 | <caption>Open Source Contributors</caption>
14 | <thead>
15 | <tr>
16 | <th>Contributor</th>
17 | <th>Project</th>
18 | <th>Pull Requests</th>
19 | <th>Contribution Type</th>
20 | <th>Status</th>
21 | </tr>
22 | </thead>
23 | <tbody>
24 | <tr>
25 | <td>Nureni Jamiu</td>
26 | <td>CodeGraphContext</td>
27 | <td>2</td>
28 | <td>Indexing Pipeline</td>
29 | <td>Completed</td>
30 | </tr>
31 | <tr>
32 | <td>Alex Chen</td>
33 | <td>PyViz</td>
34 | <td>3</td>
35 | <td>Bug Fixes</td>
36 | <td>In Progress</td>
37 | </tr>
38 | <tr>
39 | <td>Maria Garcia</td>
40 | <td>WebTools</td>
41 | <td>5</td>
42 | <td>Feature</td>
43 | <td>Completed</td>
44 | </tr>
45 | <tr>
46 | <td>James Wilson</td>
47 | <td>DataFlow</td>
48 | <td>2</td>
49 | <td>Testing</td>
50 | <td>In Progress</td>
51 | </tr>
52 | <tr>
53 | <td>Aisha Patel</td>
54 | <td>UIKit</td>
55 | <td>4</td>
56 | <td>Enhancement</td>
57 | <td>Completed</td>
58 | </tr>
59 | </tbody>
60 | <tfoot>
61 | <tr>
62 | <th colspan="2">Total Contributions:</th>
63 | <td>18</td>
64 | <td colspan="2">80% Complete</td>
65 | </tr>
66 | </tfoot>
67 | </table>
68 | </body>
69 | </html>
```
--------------------------------------------------------------------------------
/website/src/components/ui/accordion.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import * as AccordionPrimitive from "@radix-ui/react-accordion";
3 | import { ChevronDown } from "lucide-react";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | const Accordion = AccordionPrimitive.Root;
8 |
9 | const AccordionItem = React.forwardRef<
10 | React.ElementRef<typeof AccordionPrimitive.Item>,
11 | React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
12 | >(({ className, ...props }, ref) => (
13 | <AccordionPrimitive.Item ref={ref} className={cn("border-b", className)} {...props} />
14 | ));
15 | AccordionItem.displayName = "AccordionItem";
16 |
17 | const AccordionTrigger = React.forwardRef<
18 | React.ElementRef<typeof AccordionPrimitive.Trigger>,
19 | React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
20 | >(({ className, children, ...props }, ref) => (
21 | <AccordionPrimitive.Header className="flex">
22 | <AccordionPrimitive.Trigger
23 | ref={ref}
24 | className={cn(
25 | "flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
26 | className,
27 | )}
28 | {...props}
29 | >
30 | {children}
31 | <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
32 | </AccordionPrimitive.Trigger>
33 | </AccordionPrimitive.Header>
34 | ));
35 | AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
36 |
37 | const AccordionContent = React.forwardRef<
38 | React.ElementRef<typeof AccordionPrimitive.Content>,
39 | React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
40 | >(({ className, children, ...props }, ref) => (
41 | <AccordionPrimitive.Content
42 | ref={ref}
43 | className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
44 | {...props}
45 | >
46 | <div className={cn("pb-4 pt-0", className)}>{children}</div>
47 | </AccordionPrimitive.Content>
48 | ));
49 |
50 | AccordionContent.displayName = AccordionPrimitive.Content.displayName;
51 |
52 | export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
53 |
```
--------------------------------------------------------------------------------
/tests/sample_project_cpp/types_variable_assignments.cpp:
--------------------------------------------------------------------------------
```cpp
1 | #include <iostream>
2 | #include <string>
3 | #include <vector>
4 |
5 | // --- Demo class ---
6 | class Demo {
7 | public:
8 | int member; // non-static member
9 | static int static_member; // static member
10 | const char* name = "Demo";
11 |
12 | void setMember(int value) { member = value; }
13 | };
14 |
15 | int Demo::static_member = 100;
16 |
17 | // --- Point struct for structured bindings ---
18 | struct Point {
19 | int x;
20 | int y;
21 | };
22 |
23 | // --- Global variable declarations ---
24 | int global_int = 10;
25 | double global_double(3.14);
26 | std::string global_str = "Hello";
27 | const int CONST_VAL = 42;
28 | int *global_ptr = &global_int;
29 | int global_arr[5] = {1, 2, 3, 4, 5};
30 |
31 | // --- Function demonstrating variable declarations ---
32 | void testVariables() {
33 | // Basic declarations
34 | int a = 5;
35 | float b = 2.5f;
36 | double c(9.81);
37 | bool flag = true;
38 | char ch = 'A';
39 | std::string s = "Tree-sitter";
40 |
41 | // Pointer and reference
42 | int x = 10;
43 | int *p = &x;
44 | int &ref = x;
45 | const int *const_ptr = &x;
46 |
47 | // Arrays
48 | int nums[3] = {1, 2, 3};
49 | char letters[] = {'a', 'b', 'c'};
50 | std::string words[2] = {"hello", "world"};
51 |
52 | // Vector and auto type
53 | std::vector<int> vec = {1, 2, 3, 4};
54 | auto val = vec[2];
55 |
56 | // Structured bindings (C++17)
57 | Point pt = {10, 20};
58 | auto [px, py] = pt;
59 |
60 | // Assignments and compound ops
61 | a = 10;
62 | a += 5;
63 | b *= 3.0f;
64 | c /= 2;
65 | flag = !flag;
66 | s += " test";
67 | x = a + b - c;
68 |
69 | // Expressions and function calls
70 | std::cout << "Sum: " << (a + b + c) << std::endl;
71 |
72 | // Dynamic allocation
73 | int *dyn = new int(99);
74 | delete dyn;
75 |
76 | // Static and const local variables
77 | static int counter = 0;
78 | const double PI = 3.14159;
79 |
80 | // Lambda with captured variable
81 | auto lambda = [=]() { return PI * a; };
82 | double result = lambda();
83 |
84 | // Object and member assignments
85 | Demo d;
86 | d.member = 50;
87 | d.setMember(25);
88 | Demo::static_member = 200;
89 | }
90 |
91 | int main() {
92 | testVariables();
93 | return 0;
94 | }
95 |
```
--------------------------------------------------------------------------------
/website/src/components/MoveToTop.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import React, { useState, useEffect } from "react";
2 |
3 | const MoveToTop: React.FC = () => {
4 | const [showButton, setShowButton] = useState<boolean>(false);
5 |
6 | useEffect(() => {
7 | const handleScroll = () => {
8 | if (window.scrollY > window.innerHeight * 0.05) {
9 | setShowButton(true);
10 | } else {
11 | setShowButton(false);
12 | }
13 | };
14 |
15 | window.addEventListener("scroll", handleScroll);
16 | return () => window.removeEventListener("scroll", handleScroll);
17 | }, []);
18 |
19 | const scrollToTop = () => {
20 | window.scrollTo({ top: 0, behavior: "smooth" });
21 | };
22 |
23 | return (
24 | <>
25 | {showButton && (
26 | <button
27 | onClick={scrollToTop}
28 | data-aos="fade-in"
29 | data-aos-duration="300"
30 | style={{
31 | position: "fixed",
32 | bottom: "40px",
33 | right: "40px",
34 | width: "40px",
35 | height: "40px",
36 | borderRadius: "50%",
37 | border: "none",
38 | background: "linear-gradient(135deg, hsl(263 70% 65%), hsl(180 100% 70%))",
39 | color: "#fff",
40 | cursor: "pointer",
41 | zIndex: 99,
42 | display: "flex",
43 | alignItems: "center",
44 | justifyContent: "center",
45 | padding: 0,
46 | }}
47 | >
48 | <div
49 | style={{
50 | width: "14px",
51 | height: "14px",
52 | borderTop: "1.5px solid black",
53 | borderLeft: "1.5px solid black",
54 | transform: "rotate(45deg) translateY(3px) translateX(2px)",
55 | }}
56 | ></div>
57 | </button>
58 | )}
59 | </>
60 | );
61 | };
62 |
63 | export default MoveToTop;
64 |
```
--------------------------------------------------------------------------------
/tests/sample_project_kotlin/EdgeCases.kt:
--------------------------------------------------------------------------------
```kotlin
1 | package com.example.project.edgecases
2 |
3 | // 1. Destructuring Declarations
4 | data class Point(val x: Int, val y: Int)
5 | fun destructuring() {
6 | val (x, y) = Point(1, 2)
7 | }
8 |
9 | // 2. Type Aliases
10 | typealias NodeSet = Set<String>
11 | typealias FileTable<K> = MutableMap<K, MutableList<File>>
12 |
13 | fun processNodes(nodes: NodeSet) {}
14 |
15 | // 3. Anonymous Objects (Object Expressions)
16 | fun createListener() {
17 | val listener = object : MouseAdapter() {
18 | override fun mouseClicked(e: MouseEvent) {
19 | println("Clicked")
20 | }
21 | }
22 | }
23 |
24 | // 4. Functional (SAM) Interfaces
25 | fun interface IntPredicate {
26 | fun accept(i: Int): Boolean
27 | }
28 | val isEven = IntPredicate { it % 2 == 0 }
29 |
30 | // 5. Generic Constraints
31 | fun <T> copyWhenGreater(list: List<T>, threshold: T): List<String>
32 | where T : CharSequence,
33 | T : Comparable<T> {
34 | return list.filter { it > threshold }.map { it.toString() }
35 | }
36 |
37 | // 6. Contracts (Experimental)
38 | import kotlin.contracts.*
39 | fun require(condition: Boolean) {
40 | contract {
41 | returns() implies condition
42 | }
43 | if (!condition) throw IllegalArgumentException()
44 | }
45 |
46 | // 7. Value Classes (Inline Classes)
47 | @JvmInline
48 | value class Password(private val s: String)
49 |
50 | // 8. Expect/Actual (Multiplatform) - purely syntax check if parser handles keywords
51 | // expect fun format(str: String): String
52 |
53 | // 9. Delegated Properties (Custom)
54 | import kotlin.reflect.KProperty
55 | class Delegate {
56 | operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
57 | return "$thisRef, thank you for delegating '${property.name}' to me!"
58 | }
59 | }
60 | class Example {
61 | val p: String by Delegate()
62 | }
63 |
64 | // 10. Secondary Constructors
65 | class Person {
66 | var children: MutableList<Person> = mutableListOf()
67 | constructor(parent: Person) {
68 | parent.children.add(this)
69 | }
70 | }
71 |
72 | // 11. Property in Constructor
73 | class User(val name: String, var age: Int)
74 |
75 | // 12. Enum Classes with methods
76 | enum class ProtocolState {
77 | WAITING {
78 | override fun signal() = TALKING
79 | },
80 | TALKING {
81 | override fun signal() = WAITING
82 | };
83 | abstract fun signal(): ProtocolState
84 | }
85 |
```
--------------------------------------------------------------------------------
/tests/sample_project_go/basic_functions.go:
--------------------------------------------------------------------------------
```go
1 | // basic_functions.go - Demonstrates basic Go function patterns
2 | package main
3 |
4 | import (
5 | "fmt"
6 | "math"
7 | )
8 |
9 | // SimpleFunction is a basic function with single return
10 | func SimpleFunction(x int) int {
11 | return x * 2
12 | }
13 |
14 | // MultipleReturns demonstrates multiple return values
15 | func MultipleReturns(a, b int) (int, int, error) {
16 | if b == 0 {
17 | return 0, 0, fmt.Errorf("division by zero")
18 | }
19 | return a + b, a - b, nil
20 | }
21 |
22 | // NamedReturns uses named return values
23 | func NamedReturns(x, y int) (sum int, product int) {
24 | sum = x + y
25 | product = x * y
26 | return // naked return
27 | }
28 |
29 | // VariadicFunction accepts variable number of arguments
30 | func VariadicFunction(prefix string, numbers ...int) string {
31 | result := prefix
32 | for _, num := range numbers {
33 | result += fmt.Sprintf(" %d", num)
34 | }
35 | return result
36 | }
37 |
38 | // HigherOrderFunction takes a function as parameter
39 | func HigherOrderFunction(fn func(int) int, value int) int {
40 | return fn(value) + 10
41 | }
42 |
43 | // FunctionReturningFunction returns a closure
44 | func FunctionReturningFunction(multiplier int) func(int) int {
45 | return func(x int) int {
46 | return x * multiplier
47 | }
48 | }
49 |
50 | // RecursiveFunction demonstrates recursion
51 | func RecursiveFunction(n int) int {
52 | if n <= 1 {
53 | return 1
54 | }
55 | return n * RecursiveFunction(n-1)
56 | }
57 |
58 | // DeferExample shows defer usage
59 | func DeferExample() string {
60 | defer fmt.Println("This runs last")
61 | fmt.Println("This runs first")
62 | return "Function complete"
63 | }
64 |
65 | // PanicRecoverExample demonstrates panic and recover
66 | func PanicRecoverExample(shouldPanic bool) (result string) {
67 | defer func() {
68 | if r := recover(); r != nil {
69 | result = fmt.Sprintf("Recovered from: %v", r)
70 | }
71 | }()
72 |
73 | if shouldPanic {
74 | panic("something went wrong")
75 | }
76 |
77 | result = "No panic occurred"
78 | return
79 | }
80 |
81 | // MathHelper calls external package function
82 | func MathHelper(x float64) float64 {
83 | return math.Sqrt(x)
84 | }
85 |
86 | // init function runs before main
87 | func init() {
88 | fmt.Println("Initializing basic_functions package")
89 | }
90 |
91 | func main() {
92 | fmt.Println(SimpleFunction(5))
93 | sum, diff, _ := MultipleReturns(10, 3)
94 | fmt.Println(sum, diff)
95 |
96 | doubler := FunctionReturningFunction(2)
97 | fmt.Println(doubler(5))
98 | }
99 |
100 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/input-otp.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { OTPInput, OTPInputContext } from "input-otp";
3 | import { Dot } from "lucide-react";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | const InputOTP = React.forwardRef<React.ElementRef<typeof OTPInput>, React.ComponentPropsWithoutRef<typeof OTPInput>>(
8 | ({ className, containerClassName, ...props }, ref) => (
9 | <OTPInput
10 | ref={ref}
11 | containerClassName={cn("flex items-center gap-2 has-[:disabled]:opacity-50", containerClassName)}
12 | className={cn("disabled:cursor-not-allowed", className)}
13 | {...props}
14 | />
15 | ),
16 | );
17 | InputOTP.displayName = "InputOTP";
18 |
19 | const InputOTPGroup = React.forwardRef<React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div">>(
20 | ({ className, ...props }, ref) => <div ref={ref} className={cn("flex items-center", className)} {...props} />,
21 | );
22 | InputOTPGroup.displayName = "InputOTPGroup";
23 |
24 | const InputOTPSlot = React.forwardRef<
25 | React.ElementRef<"div">,
26 | React.ComponentPropsWithoutRef<"div"> & { index: number }
27 | >(({ index, className, ...props }, ref) => {
28 | const inputOTPContext = React.useContext(OTPInputContext);
29 | const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
30 |
31 | return (
32 | <div
33 | ref={ref}
34 | className={cn(
35 | "relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
36 | isActive && "z-10 ring-2 ring-ring ring-offset-background",
37 | className,
38 | )}
39 | {...props}
40 | >
41 | {char}
42 | {hasFakeCaret && (
43 | <div className="pointer-events-none absolute inset-0 flex items-center justify-center">
44 | <div className="animate-caret-blink h-4 w-px bg-foreground duration-1000" />
45 | </div>
46 | )}
47 | </div>
48 | );
49 | });
50 | InputOTPSlot.displayName = "InputOTPSlot";
51 |
52 | const InputOTPSeparator = React.forwardRef<React.ElementRef<"div">, React.ComponentPropsWithoutRef<"div">>(
53 | ({ ...props }, ref) => (
54 | <div ref={ref} role="separator" {...props}>
55 | <Dot />
56 | </div>
57 | ),
58 | );
59 | InputOTPSeparator.displayName = "InputOTPSeparator";
60 |
61 | export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator };
62 |
```
--------------------------------------------------------------------------------
/src/codegraphcontext/core/falkor_worker.py:
--------------------------------------------------------------------------------
```python
1 | import sys
2 | import os
3 | import time
4 | import signal
5 | from pathlib import Path
6 | import logging
7 |
8 | # Configure logging
9 | logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
10 | logger = logging.getLogger("falkor_worker")
11 |
12 | # Global to handle shutdown
13 | db_instance = None
14 |
15 | def handle_signal(signum, frame):
16 | logger.info(f"Received signal {signum}. Stopping FalkorDB worker...")
17 | sys.exit(0)
18 |
19 | def run_worker():
20 | global db_instance
21 |
22 | # Get configuration from env
23 | db_path = os.getenv('FALKORDB_PATH')
24 | socket_path = os.getenv('FALKORDB_SOCKET_PATH')
25 |
26 | if not db_path or not socket_path:
27 | logger.error("Missing configuration. FALKORDB_PATH and FALKORDB_SOCKET_PATH must be set.")
28 | sys.exit(1)
29 |
30 | # Ensure dir exists
31 | Path(db_path).parent.mkdir(parents=True, exist_ok=True)
32 |
33 | logger.info(f"Starting FalkorDB Lite worker...")
34 | logger.info(f"DB Path: {db_path}")
35 | logger.info(f"Socket: {socket_path}")
36 |
37 | try:
38 | import platform
39 |
40 | if platform.system() == "Windows":
41 | raise RuntimeError(
42 | "CodeGraphContext uses redislite/FalkorDB, which does not support Windows.\n"
43 | "Please run the project using WSL or Docker."
44 | )
45 |
46 | from redislite.falkordb_client import FalkorDB
47 |
48 | # Start Embedded DB
49 | # Note: redislite might raise error if socket is in use/locked.
50 | # Ideally we clean up stale socket if check fails.
51 | if os.path.exists(socket_path):
52 | try:
53 | os.remove(socket_path)
54 | except OSError:
55 | pass
56 |
57 | db_instance = FalkorDB(db_path, unix_socket_path=socket_path)
58 | logger.info("FalkorDB Lite is running.")
59 |
60 | # Keep alive loop
61 | while True:
62 | time.sleep(1)
63 |
64 | except ImportError:
65 | logger.error("Failed to import redislite.falkordb_client. Is falkordblite installed?")
66 | sys.exit(1)
67 | except Exception as e:
68 | logger.error(f"FalkorDB Worker Critical Failure: {e}")
69 | import traceback
70 | traceback.print_exc()
71 | sys.exit(1)
72 |
73 | if __name__ == '__main__':
74 | signal.signal(signal.SIGTERM, handle_signal)
75 | signal.signal(signal.SIGINT, handle_signal)
76 | run_worker()
77 |
```
--------------------------------------------------------------------------------
/docs/docs/core.md:
--------------------------------------------------------------------------------
```markdown
1 | # Core Concepts
2 |
3 | The core of CodeGraphContext is built upon a few key components that manage the database connection, handle background tasks, and watch for file system changes.
4 |
5 | ## `DatabaseManager`
6 |
7 | The `DatabaseManager` class in `database.py` is a thread-safe singleton responsible for managing the connection to the Neo4j database. This ensures that only one connection pool is created and shared across the application, which is crucial for performance and resource management.
8 |
9 | ### Key Methods
10 |
11 | - `get_driver()`: Returns the active Neo4j Driver instance, creating it if it doesn't exist.
12 | - `close_driver()`: Closes the Neo4j driver connection.
13 | - `is_connected()`: Checks if the database connection is currently active.
14 |
15 | ## `JobManager`
16 |
17 | The `JobManager` class in `jobs.py` handles long-running, background jobs, such as code indexing. It stores job information in memory and provides a thread-safe way to create, update, and retrieve information about these jobs.
18 |
19 | ### `JobStatus`
20 |
21 | An enumeration for the possible statuses of a background job:
22 | - `PENDING`
23 | - `RUNNING`
24 | - `COMPLETED`
25 | - `FAILED`
26 | - `CANCELLED`
27 |
28 | ### `JobInfo`
29 |
30 | A data class that holds all information about a single background job, including its ID, status, start/end times, progress, and any errors.
31 |
32 | ### Key Methods
33 |
34 | - `create_job()`: Creates a new job with a unique ID.
35 | - `update_job()`: Updates the information for a specific job.
36 | - `get_job()`: Retrieves the information for a single job.
37 | - `list_jobs()`: Returns a list of all jobs.
38 | - `cleanup_old_jobs()`: Removes old, completed jobs from memory.
39 |
40 | ## `CodeWatcher`
41 |
42 | The `CodeWatcher` class in `watcher.py` implements the live file-watching functionality using the `watchdog` library. It observes directories for changes and triggers updates to the code graph.
43 |
44 | ### `RepositoryEventHandler`
45 |
46 | A dedicated event handler for a single repository. It performs an initial scan and then uses a debouncing mechanism to efficiently handle file changes, creations, or deletions.
47 |
48 | ### Key Methods
49 |
50 | - `watch_directory()`: Schedules a directory to be watched for changes.
51 | - `unwatch_directory()`: Stops watching a directory.
52 | - `list_watched_paths()`: Returns a list of all currently watched directory paths.
53 | - `start()`: Starts the observer thread.
54 | - `stop()`: Stops the observer thread gracefully.
```
--------------------------------------------------------------------------------
/organizer/Tools_Exploration.md:
--------------------------------------------------------------------------------
```markdown
1 | # Tools Exploration
2 | There are a total of 14 tools available to the users, and here we have attached illustrative demos for each one of them.
3 |
4 | ## find_code Tool
5 |
6 | The `find_code` tool allows users to search for code snippets, functions, classes, and variables within the codebase using natural language queries. This tool helps developers understand and navigate large codebases efficiently.
7 |
8 | Below is an embedded link to a demo video showcasing the usage of the `find_code` tool in action.
9 | [](https://drive.google.com/file/d/1ojCDIIAwcir9e3jgHHIVC5weZ9nuIQcs/view?usp=drive_link)
10 |
11 | ---
12 |
13 | ## watch_directory Tool
14 |
15 | The `watch_directory` tool allows users to monitor a specified directory for file changes, additions, or deletions in real-time. It helps developers automate workflows such as triggering scripts, updating indexes, or syncing files whenever changes occur in the directory.
16 |
17 | Below is an embedded link to a demo video showcasing the usage of the `watch_directory` tool in a development environment.
18 | [](https://drive.google.com/file/d/1OEjcS2iwwymss99zLidbeBjcblferKBX/view?usp=drive_link)
19 |
20 | ---
21 |
22 | ## analyze_code_relationships Tool
23 |
24 | The `analyze_code_relationships` tool in CodeGraphContext is designed to let users query and explore the various relationships between code elements in a codebase, represented as a graph in Neo4j.
25 |
26 | ### Relationship Types That Can Be Analyzed
27 |
28 | - **CALLS:** Finds which functions call or are called by a function.
29 | - **CALLED_BY:** Finds all functions that directly or indirectly call a target function (inverse of CALLS).
30 | - **INHERITS_FROM:** Finds class inheritance relationships; which classes inherit from which.
31 | - **CONTAINS:** Shows containment (which classes/functions are inside which modules or files).
32 | - **IMPLEMENTS:** Shows which classes implement an interface.
33 | - **IMPORTS:** Identifies which files or modules import a specific module.
34 | - **DEFINED_IN:** Locates where an entity (function/class) is defined.
35 | - **HAS_ARGUMENT:** Shows relationships from functions to their arguments.
36 | - **DECLARES:** Finds variables declared in functions or classes.
37 |
38 | Below is an embedded link to a demo video showcasing the usage of the `analyse_code_relationships` tool.
39 | [](https://drive.google.com/file/d/154M_lTPbg9_Gj9bd2ErnAVbJArSbcb2M/view?usp=drive_link)
40 |
41 | ---
42 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/calendar.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { ChevronLeft, ChevronRight } from "lucide-react";
3 | import { DayPicker } from "react-day-picker";
4 |
5 | import { cn } from "@/lib/utils";
6 | import { buttonVariants } from "@/components/ui/button";
7 |
8 | export type CalendarProps = React.ComponentProps<typeof DayPicker>;
9 |
10 | function Calendar({ className, classNames, showOutsideDays = true, ...props }: CalendarProps) {
11 | return (
12 | <DayPicker
13 | showOutsideDays={showOutsideDays}
14 | className={cn("p-3", className)}
15 | classNames={{
16 | months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
17 | month: "space-y-4",
18 | caption: "flex justify-center pt-1 relative items-center",
19 | caption_label: "text-sm font-medium",
20 | nav: "space-x-1 flex items-center",
21 | nav_button: cn(
22 | buttonVariants({ variant: "outline" }),
23 | "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
24 | ),
25 | nav_button_previous: "absolute left-1",
26 | nav_button_next: "absolute right-1",
27 | table: "w-full border-collapse space-y-1",
28 | head_row: "flex",
29 | head_cell: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
30 | row: "flex w-full mt-2",
31 | cell: "h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",
32 | day: cn(buttonVariants({ variant: "ghost" }), "h-9 w-9 p-0 font-normal aria-selected:opacity-100"),
33 | day_range_end: "day-range-end",
34 | day_selected:
35 | "bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
36 | day_today: "bg-accent text-accent-foreground",
37 | day_outside:
38 | "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
39 | day_disabled: "text-muted-foreground opacity-50",
40 | day_range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
41 | day_hidden: "invisible",
42 | ...classNames,
43 | }}
44 | components={{
45 | IconLeft: ({ ..._props }) => <ChevronLeft className="h-4 w-4" />,
46 | IconRight: ({ ..._props }) => <ChevronRight className="h-4 w-4" />,
47 | }}
48 | {...props}
49 | />
50 | );
51 | }
52 | Calendar.displayName = "Calendar";
53 |
54 | export { Calendar };
55 |
```
--------------------------------------------------------------------------------
/tests/sample_project_rust/src/modules.rs:
--------------------------------------------------------------------------------
```rust
1 | // modules.rs - Demonstrates Rust module system and organization
2 |
3 | // Nested modules
4 | pub mod geometry {
5 | pub mod shapes {
6 | pub struct Circle {
7 | pub radius: f64,
8 | }
9 |
10 | pub struct Rectangle {
11 | pub width: f64,
12 | pub height: f64,
13 | }
14 |
15 | impl Circle {
16 | pub fn new(radius: f64) -> Self {
17 | Self { radius }
18 | }
19 |
20 | pub fn area(&self) -> f64 {
21 | std::f64::consts::PI * self.radius * self.radius
22 | }
23 | }
24 |
25 | impl Rectangle {
26 | pub fn new(width: f64, height: f64) -> Self {
27 | Self { width, height }
28 | }
29 |
30 | pub fn area(&self) -> f64 {
31 | self.width * self.height
32 | }
33 | }
34 | }
35 |
36 | pub mod calculations {
37 | use super::shapes::{Circle, Rectangle};
38 |
39 | pub fn total_area(circle: &Circle, rectangle: &Rectangle) -> f64 {
40 | circle.area() + rectangle.area()
41 | }
42 | }
43 | }
44 |
45 | // Module with private items
46 | pub mod data {
47 | pub struct PublicStruct {
48 | pub public_field: i32,
49 | private_field: i32,
50 | }
51 |
52 | impl PublicStruct {
53 | pub fn new(public_field: i32, private_field: i32) -> Self {
54 | Self {
55 | public_field,
56 | private_field,
57 | }
58 | }
59 |
60 | pub fn get_private(&self) -> i32 {
61 | self.private_field
62 | }
63 | }
64 |
65 | pub fn public_function() -> i32 {
66 | private_function() + 10
67 | }
68 |
69 | fn private_function() -> i32 {
70 | 42
71 | }
72 | }
73 |
74 | // Re-exports
75 | pub mod utils {
76 | pub use super::geometry::shapes::Circle;
77 | pub use super::geometry::shapes::Rectangle;
78 |
79 | pub fn create_default_circle() -> Circle {
80 | Circle::new(1.0)
81 | }
82 | }
83 |
84 | // Module with use statements
85 | pub mod operations {
86 | use std::collections::HashMap;
87 |
88 | pub fn create_map() -> HashMap<String, i32> {
89 | let mut map = HashMap::new();
90 | map.insert("one".to_string(), 1);
91 | map.insert("two".to_string(), 2);
92 | map
93 | }
94 | }
95 |
96 | // Glob imports (use with caution)
97 | pub mod prelude {
98 | pub use super::geometry::shapes::*;
99 | pub use super::data::*;
100 | }
101 |
102 | #[cfg(test)]
103 | mod tests {
104 | use super::*;
105 |
106 | #[test]
107 | fn test_circle_area() {
108 | let circle = geometry::shapes::Circle::new(5.0);
109 | let area = circle.area();
110 | assert!((area - 78.54).abs() < 0.01);
111 | }
112 |
113 | #[test]
114 | fn test_public_struct() {
115 | let s = data::PublicStruct::new(10, 20);
116 | assert_eq!(s.public_field, 10);
117 | assert_eq!(s.get_private(), 20);
118 | }
119 | }
120 |
121 |
```
--------------------------------------------------------------------------------
/scripts/test_all_parsers.py:
--------------------------------------------------------------------------------
```python
1 | #!/usr/bin/env python3
2 | """Test all language parsers and identify any query issues."""
3 |
4 | from codegraphcontext.tools.graph_builder import TreeSitterParser
5 | from pathlib import Path
6 |
7 | test_cases = {
8 | 'python': '''
9 | def hello():
10 | print('world')
11 |
12 | class MyClass:
13 | pass
14 | ''',
15 | 'javascript': '''
16 | function hello() {
17 | console.log('world');
18 | }
19 |
20 | class MyClass {
21 | constructor() {}
22 | }
23 | ''',
24 | 'typescript': '''
25 | function hello(): void {
26 | console.log('world');
27 | }
28 |
29 | interface MyInterface {
30 | name: string;
31 | }
32 | ''',
33 | 'go': '''
34 | package main
35 |
36 | func hello() {
37 | println("world")
38 | }
39 |
40 | type MyStruct struct {
41 | Name string
42 | }
43 | ''',
44 | 'rust': '''
45 | fn hello() {
46 | println!("world");
47 | }
48 |
49 | struct MyStruct {
50 | name: String,
51 | }
52 | ''',
53 | 'c': '''
54 | #include <stdio.h>
55 |
56 | void hello() {
57 | printf("world");
58 | }
59 |
60 | struct MyStruct {
61 | int value;
62 | };
63 | ''',
64 | 'cpp': '''
65 | #include <iostream>
66 |
67 | void hello() {
68 | std::cout << "world";
69 | }
70 |
71 | class MyClass {
72 | public:
73 | int value;
74 | };
75 | ''',
76 | 'java': '''
77 | public class Test {
78 | public void hello() {
79 | System.out.println("world");
80 | }
81 | }
82 | ''',
83 | 'ruby': '''
84 | def hello
85 | puts "world"
86 | end
87 |
88 | class MyClass
89 | end
90 | ''',
91 | 'c_sharp': '''
92 | using System;
93 |
94 | class Test {
95 | void Hello() {
96 | Console.WriteLine("world");
97 | }
98 | }
99 | '''
100 | }
101 |
102 | extensions = {
103 | 'python': '.py',
104 | 'javascript': '.js',
105 | 'typescript': '.ts',
106 | 'go': '.go',
107 | 'rust': '.rs',
108 | 'c': '.c',
109 | 'cpp': '.cpp',
110 | 'java': '.java',
111 | 'ruby': '.rb',
112 | 'c_sharp': '.cs'
113 | }
114 |
115 | results = {}
116 |
117 | for lang, code in test_cases.items():
118 | print(f'Testing {lang}...')
119 | try:
120 | parser = TreeSitterParser(lang)
121 | ext = extensions[lang]
122 | file = Path(f'/tmp/test{ext}')
123 | file.write_text(code)
124 | result = parser.parse(file, is_dependency=False)
125 |
126 | funcs = len(result.get('functions', []))
127 | classes = len(result.get('classes', []))
128 | results[lang] = {'status': 'OK', 'functions': funcs, 'classes': classes}
129 | print(f' ✓ {lang}: {funcs} functions, {classes} classes')
130 | except Exception as e:
131 | error_msg = str(e)
132 | results[lang] = {'status': 'ERROR', 'error': error_msg}
133 | print(f' ✗ {lang}: {error_msg[:150]}')
134 |
135 | print('\n' + '='*60)
136 | print('SUMMARY')
137 | print('='*60)
138 |
139 | ok_count = sum(1 for r in results.values() if r['status'] == 'OK')
140 | error_count = sum(1 for r in results.values() if r['status'] == 'ERROR')
141 |
142 | print(f'✓ Working: {ok_count}/{len(results)}')
143 | print(f'✗ Errors: {error_count}/{len(results)}')
144 |
145 | if error_count > 0:
146 | print('\nLanguages with errors:')
147 | for lang, result in results.items():
148 | if result['status'] == 'ERROR':
149 | print(f' - {lang}')
150 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/pagination.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { ChevronLeft, ChevronRight, MoreHorizontal } from "lucide-react";
3 |
4 | import { cn } from "@/lib/utils";
5 | import { ButtonProps, buttonVariants } from "@/components/ui/button";
6 |
7 | const Pagination = ({ className, ...props }: React.ComponentProps<"nav">) => (
8 | <nav
9 | role="navigation"
10 | aria-label="pagination"
11 | className={cn("mx-auto flex w-full justify-center", className)}
12 | {...props}
13 | />
14 | );
15 | Pagination.displayName = "Pagination";
16 |
17 | const PaginationContent = React.forwardRef<HTMLUListElement, React.ComponentProps<"ul">>(
18 | ({ className, ...props }, ref) => (
19 | <ul ref={ref} className={cn("flex flex-row items-center gap-1", className)} {...props} />
20 | ),
21 | );
22 | PaginationContent.displayName = "PaginationContent";
23 |
24 | const PaginationItem = React.forwardRef<HTMLLIElement, React.ComponentProps<"li">>(({ className, ...props }, ref) => (
25 | <li ref={ref} className={cn("", className)} {...props} />
26 | ));
27 | PaginationItem.displayName = "PaginationItem";
28 |
29 | type PaginationLinkProps = {
30 | isActive?: boolean;
31 | } & Pick<ButtonProps, "size"> &
32 | React.ComponentProps<"a">;
33 |
34 | const PaginationLink = ({ className, isActive, size = "icon", ...props }: PaginationLinkProps) => (
35 | <a
36 | aria-current={isActive ? "page" : undefined}
37 | className={cn(
38 | buttonVariants({
39 | variant: isActive ? "outline" : "ghost",
40 | size,
41 | }),
42 | className,
43 | )}
44 | {...props}
45 | />
46 | );
47 | PaginationLink.displayName = "PaginationLink";
48 |
49 | const PaginationPrevious = ({ className, ...props }: React.ComponentProps<typeof PaginationLink>) => (
50 | <PaginationLink aria-label="Go to previous page" size="default" className={cn("gap-1 pl-2.5", className)} {...props}>
51 | <ChevronLeft className="h-4 w-4" />
52 | <span>Previous</span>
53 | </PaginationLink>
54 | );
55 | PaginationPrevious.displayName = "PaginationPrevious";
56 |
57 | const PaginationNext = ({ className, ...props }: React.ComponentProps<typeof PaginationLink>) => (
58 | <PaginationLink aria-label="Go to next page" size="default" className={cn("gap-1 pr-2.5", className)} {...props}>
59 | <span>Next</span>
60 | <ChevronRight className="h-4 w-4" />
61 | </PaginationLink>
62 | );
63 | PaginationNext.displayName = "PaginationNext";
64 |
65 | const PaginationEllipsis = ({ className, ...props }: React.ComponentProps<"span">) => (
66 | <span aria-hidden className={cn("flex h-9 w-9 items-center justify-center", className)} {...props}>
67 | <MoreHorizontal className="h-4 w-4" />
68 | <span className="sr-only">More pages</span>
69 | </span>
70 | );
71 | PaginationEllipsis.displayName = "PaginationEllipsis";
72 |
73 | export {
74 | Pagination,
75 | PaginationContent,
76 | PaginationEllipsis,
77 | PaginationItem,
78 | PaginationLink,
79 | PaginationNext,
80 | PaginationPrevious,
81 | };
82 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/breadcrumb.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { Slot } from "@radix-ui/react-slot";
3 | import { ChevronRight, MoreHorizontal } from "lucide-react";
4 |
5 | import { cn } from "@/lib/utils";
6 |
7 | const Breadcrumb = React.forwardRef<
8 | HTMLElement,
9 | React.ComponentPropsWithoutRef<"nav"> & {
10 | separator?: React.ReactNode;
11 | }
12 | >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />);
13 | Breadcrumb.displayName = "Breadcrumb";
14 |
15 | const BreadcrumbList = React.forwardRef<HTMLOListElement, React.ComponentPropsWithoutRef<"ol">>(
16 | ({ className, ...props }, ref) => (
17 | <ol
18 | ref={ref}
19 | className={cn(
20 | "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",
21 | className,
22 | )}
23 | {...props}
24 | />
25 | ),
26 | );
27 | BreadcrumbList.displayName = "BreadcrumbList";
28 |
29 | const BreadcrumbItem = React.forwardRef<HTMLLIElement, React.ComponentPropsWithoutRef<"li">>(
30 | ({ className, ...props }, ref) => (
31 | <li ref={ref} className={cn("inline-flex items-center gap-1.5", className)} {...props} />
32 | ),
33 | );
34 | BreadcrumbItem.displayName = "BreadcrumbItem";
35 |
36 | const BreadcrumbLink = React.forwardRef<
37 | HTMLAnchorElement,
38 | React.ComponentPropsWithoutRef<"a"> & {
39 | asChild?: boolean;
40 | }
41 | >(({ asChild, className, ...props }, ref) => {
42 | const Comp = asChild ? Slot : "a";
43 |
44 | return <Comp ref={ref} className={cn("transition-colors hover:text-foreground", className)} {...props} />;
45 | });
46 | BreadcrumbLink.displayName = "BreadcrumbLink";
47 |
48 | const BreadcrumbPage = React.forwardRef<HTMLSpanElement, React.ComponentPropsWithoutRef<"span">>(
49 | ({ className, ...props }, ref) => (
50 | <span
51 | ref={ref}
52 | role="link"
53 | aria-disabled="true"
54 | aria-current="page"
55 | className={cn("font-normal text-foreground", className)}
56 | {...props}
57 | />
58 | ),
59 | );
60 | BreadcrumbPage.displayName = "BreadcrumbPage";
61 |
62 | const BreadcrumbSeparator = ({ children, className, ...props }: React.ComponentProps<"li">) => (
63 | <li role="presentation" aria-hidden="true" className={cn("[&>svg]:size-3.5", className)} {...props}>
64 | {children ?? <ChevronRight />}
65 | </li>
66 | );
67 | BreadcrumbSeparator.displayName = "BreadcrumbSeparator";
68 |
69 | const BreadcrumbEllipsis = ({ className, ...props }: React.ComponentProps<"span">) => (
70 | <span
71 | role="presentation"
72 | aria-hidden="true"
73 | className={cn("flex h-9 w-9 items-center justify-center", className)}
74 | {...props}
75 | >
76 | <MoreHorizontal className="h-4 w-4" />
77 | <span className="sr-only">More</span>
78 | </span>
79 | );
80 | BreadcrumbEllipsis.displayName = "BreadcrumbElipssis";
81 |
82 | export {
83 | Breadcrumb,
84 | BreadcrumbList,
85 | BreadcrumbItem,
86 | BreadcrumbLink,
87 | BreadcrumbPage,
88 | BreadcrumbSeparator,
89 | BreadcrumbEllipsis,
90 | };
91 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/table.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 |
3 | import { cn } from "@/lib/utils";
4 |
5 | const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
6 | ({ className, ...props }, ref) => (
7 | <div className="relative w-full overflow-auto">
8 | <table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...props} />
9 | </div>
10 | ),
11 | );
12 | Table.displayName = "Table";
13 |
14 | const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
15 | ({ className, ...props }, ref) => <thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />,
16 | );
17 | TableHeader.displayName = "TableHeader";
18 |
19 | const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
20 | ({ className, ...props }, ref) => (
21 | <tbody ref={ref} className={cn("[&_tr:last-child]:border-0", className)} {...props} />
22 | ),
23 | );
24 | TableBody.displayName = "TableBody";
25 |
26 | const TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
27 | ({ className, ...props }, ref) => (
28 | <tfoot ref={ref} className={cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className)} {...props} />
29 | ),
30 | );
31 | TableFooter.displayName = "TableFooter";
32 |
33 | const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
34 | ({ className, ...props }, ref) => (
35 | <tr
36 | ref={ref}
37 | className={cn("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50", className)}
38 | {...props}
39 | />
40 | ),
41 | );
42 | TableRow.displayName = "TableRow";
43 |
44 | const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(
45 | ({ className, ...props }, ref) => (
46 | <th
47 | ref={ref}
48 | className={cn(
49 | "h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
50 | className,
51 | )}
52 | {...props}
53 | />
54 | ),
55 | );
56 | TableHead.displayName = "TableHead";
57 |
58 | const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
59 | ({ className, ...props }, ref) => (
60 | <td ref={ref} className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)} {...props} />
61 | ),
62 | );
63 | TableCell.displayName = "TableCell";
64 |
65 | const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(
66 | ({ className, ...props }, ref) => (
67 | <caption ref={ref} className={cn("mt-4 text-sm text-muted-foreground", className)} {...props} />
68 | ),
69 | );
70 | TableCaption.displayName = "TableCaption";
71 |
72 | export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption };
73 |
```
--------------------------------------------------------------------------------
/tests/test_typescript_parser.py:
--------------------------------------------------------------------------------
```python
1 | import pytest
2 | from pathlib import Path
3 | import time
4 |
5 | # Import the helper function from the conftest.py file
6 | from .conftest import call_tool
7 |
8 | # Define the path to the TypeScript sample project
9 | TS_SAMPLE_PROJECT_PATH = str(Path(__file__).parent / "sample_project_typescript")
10 |
11 | def wait_for_job_completion(server, job_id, timeout=60):
12 | """Helper function to wait for an indexing job to complete."""
13 | start_time = time.time()
14 | while True:
15 | if time.time() - start_time > timeout:
16 | pytest.fail(f"Job {job_id} timed out after {timeout} seconds.")
17 |
18 | status_result = call_tool(server, "check_job_status", {"job_id": job_id})
19 | job_status = status_result.get("job", {}).get("status")
20 |
21 | if job_status == "completed":
22 | break
23 | elif job_status in ["failed", "cancelled"]:
24 | pytest.fail(f"Indexing job failed with status: {job_status}")
25 |
26 | time.sleep(1)
27 |
28 | # This test uses the 'server' fixture from conftest.py
29 | # Pytest automatically starts the cgc server and passes in a communication function.
30 | def test_typescript_interfaces_and_types_are_indexed(server):
31 | """
32 | This is an integration test. It indexes the TypeScript sample project
33 | and then queries the live database to verify the results.
34 | """
35 | # ARRANGE: First, delete any previous data for this project to ensure a clean slate.
36 | call_tool(server, "delete_repository", {"repo_path": TS_SAMPLE_PROJECT_PATH})
37 |
38 | # ACT (Part 1): Index the entire TypeScript sample project.
39 | add_result = call_tool(server, "add_code_to_graph", {"path": TS_SAMPLE_PROJECT_PATH})
40 | assert add_result.get("success") is True, "Failed to start indexing job"
41 | job_id = add_result.get("job_id")
42 |
43 | # Wait for the indexing to finish.
44 | wait_for_job_completion(server, job_id)
45 |
46 | # ACT (Part 2): Query the database for the interfaces and types we expect to find.
47 | interface_query = "MATCH (i:Interface {name: 'User'}) RETURN i.name AS name"
48 | type_alias_query = "MATCH (t:TypeAlias {name: 'UserID'}) RETURN t.name AS name"
49 |
50 | interface_result = call_tool(server, "execute_cypher_query", {"cypher_query": interface_query})
51 | type_alias_result = call_tool(server, "execute_cypher_query", {"cypher_query": type_alias_query})
52 |
53 | # ASSERT: Check that the queries returned the expected results from the database.
54 | assert interface_result.get("success") is True
55 | assert len(interface_result.get("results", [])) == 1, "Should find exactly one 'User' interface"
56 | assert interface_result["results"][0]["name"] == "User"
57 |
58 | assert type_alias_result.get("success") is True
59 | assert len(type_alias_result.get("results", [])) == 1, "Should find exactly one 'UserID' type alias"
60 | assert type_alias_result["results"][0]["name"] == "UserID"
```
--------------------------------------------------------------------------------
/tests/sample_project_javascript/functions.js:
--------------------------------------------------------------------------------
```javascript
1 | /**
2 | * Sample JavaScript file demonstrating various function definitions
3 | * This file tests function declarations, arrow functions, and method definitions
4 | */
5 |
6 | // Regular function declaration
7 | function regularFunction(param1, param2) {
8 | console.log('Regular function called with:', param1, param2);
9 | return param1 + param2;
10 | }
11 |
12 | /**
13 | * Function with JSDoc documentation
14 | * @param {string} name - The name to greet
15 | * @param {number} age - The age of the person
16 | * @returns {string} A greeting message
17 | */
18 | function greetPerson(name, age = 25) {
19 | return `Hello ${name}, you are ${age} years old!`;
20 | }
21 |
22 | // Function expression assigned to variable
23 | const functionExpression = function(x, y) {
24 | return x * y;
25 | };
26 |
27 | // Arrow function with multiple parameters
28 | const arrowFunction = (a, b, c) => {
29 | const result = a + b + c;
30 | return result;
31 | };
32 |
33 | // Arrow function with single parameter (no parentheses)
34 | const singleParamArrow = x => x * 2;
35 |
36 | // Arrow function with no parameters
37 | const noParamsArrow = () => {
38 | console.log('No parameters arrow function');
39 | return 42;
40 | };
41 |
42 | // Arrow function with rest parameters
43 | const restParamsFunction = (...args) => {
44 | return args.reduce((sum, val) => sum + val, 0);
45 | };
46 |
47 | // Arrow function with destructuring parameters
48 | const destructuringParams = ({name, age}) => {
49 | return `${name} is ${age} years old`;
50 | };
51 |
52 | // Higher-order function
53 | const higherOrderFunction = (callback) => {
54 | return function(value) {
55 | return callback(value * 2);
56 | };
57 | };
58 |
59 | // Immediately Invoked Function Expression (IIFE)
60 | const iife = (function() {
61 | const privateVar = 'secret';
62 | return function() {
63 | return privateVar;
64 | };
65 | })();
66 |
67 | // Function with complex parameters
68 | function complexParams(required, optional = 'default', ...rest) {
69 | console.log('Required:', required);
70 | console.log('Optional:', optional);
71 | console.log('Rest:', rest);
72 | }
73 |
74 | // Async function
75 | async function asyncFunction(url) {
76 | try {
77 | const response = await fetch(url);
78 | return await response.json();
79 | } catch (error) {
80 | console.error('Error:', error);
81 | throw error;
82 | }
83 | }
84 |
85 | // Async arrow function
86 | const asyncArrowFunction = async (data) => {
87 | const processed = await processData(data);
88 | return processed;
89 | };
90 |
91 | // Generator function
92 | function* generatorFunction(start, end) {
93 | for (let i = start; i <= end; i++) {
94 | yield i;
95 | }
96 | }
97 |
98 | // Function that calls other functions
99 | function orchestrator() {
100 | const result1 = regularFunction(5, 3);
101 | const result2 = functionExpression(4, 6);
102 | const result3 = arrowFunction(1, 2, 3);
103 |
104 | return {
105 | sum: result1,
106 | product: result2,
107 | total: result3
108 | };
109 | }
110 |
111 | // Export functions for module usage
112 | export { regularFunction, greetPerson, arrowFunction };
113 | export default orchestrator;
```
--------------------------------------------------------------------------------
/tests/test_tree_sitter/test_file.py:
--------------------------------------------------------------------------------
```python
1 | import os
2 | from pathlib import Path
3 | from src.codegraphcontext.tools.languages.python import PythonTreeSitterParser
4 | class MockParser:
5 | def parse(self, source_bytes):
6 | class MockTree:
7 | @property
8 | def root_node(self):
9 | return None # You can mock this deeper if needed
10 | return MockTree()
11 |
12 | class MockQuery:
13 | def captures(self, node):
14 | return [] # Simulate no matches for now
15 |
16 | class MockLanguage:
17 | def query(self, query_str):
18 | return MockQuery()
19 |
20 | class MockGenericParserWrapper:
21 | def __init__(self):
22 | self.language_name = "python"
23 | self.language = MockLanguage()
24 | self.parser = MockParser()
25 |
26 |
27 | def test_super_resolution():
28 | # Simulated parsed output from two files
29 | parsed = [
30 | {
31 | "type": "function_call",
32 | "full_name": "super().greet",
33 | "class_context": "B",
34 | "name": "greet"
35 | },
36 | {
37 | "type": "class",
38 | "name": "B",
39 | "bases": ["A"]
40 | },
41 | {
42 | "type": "class",
43 | "name": "A",
44 | "bases": []
45 | },
46 | {
47 | "type": "function",
48 | "name": "greet",
49 | "class_context": "A",
50 | "file_path": "class_instantiation.py"
51 | },
52 | {
53 | "type": "function",
54 | "name": "greet",
55 | "class_context": "Z",
56 | "file_path": "complex_classes.py"
57 | }
58 | ]
59 |
60 | # Find the super().greet() call
61 | target_call = next(
62 | (item for item in parsed if item.get("type") == "function_call" and item.get("full_name") == "super().greet"),
63 | None
64 | )
65 |
66 | assert target_call is not None, "super().greet() call not found"
67 |
68 | # Simulated resolution logic
69 | current_class = target_call.get("class_context")
70 | method_name = target_call.get("name")
71 |
72 | class_map = {
73 | cls["name"]: cls
74 | for cls in parsed
75 | if cls.get("type") == "class"
76 | }
77 |
78 | resolved = None
79 | if current_class and current_class in class_map:
80 | bases = class_map[current_class].get("bases", [])
81 | for base in bases:
82 | base_class = class_map.get(base)
83 | if base_class:
84 | for item in parsed:
85 | if (
86 | item.get("type") == "function"
87 | and item.get("name") == method_name
88 | and item.get("class_context") == base
89 | ):
90 | resolved = f"{item.get('file_path')}:{base}.{method_name}"
91 | break
92 | if resolved:
93 | break
94 |
95 | assert resolved is not None, "Resolution failed: no matching method found in base classes"
96 | assert not resolved.endswith("Z.greet"), f"Bug: super().greet() incorrectly resolved to {resolved}"
97 |
```
--------------------------------------------------------------------------------
/src/codegraphcontext/utils/debug_log.py:
--------------------------------------------------------------------------------
```python
1 | import os
2 | from datetime import datetime
3 | import logging
4 | from pathlib import Path
5 | logger = logging.getLogger(__name__)
6 |
7 | # Log level mapping
8 | LOG_LEVELS = {
9 | 'DEBUG': logging.DEBUG,
10 | 'INFO': logging.INFO,
11 | 'WARNING': logging.WARNING,
12 | 'ERROR': logging.ERROR,
13 | 'CRITICAL': logging.CRITICAL,
14 | 'DISABLED': logging.CRITICAL + 10 # Higher than CRITICAL to disable all
15 | }
16 |
17 | def _get_config_value(key, default):
18 | """Helper to get config value with fallback"""
19 | try:
20 | from codegraphcontext.cli.config_manager import get_config_value
21 | value = get_config_value(key)
22 | if value is None:
23 | return default
24 | # Convert string boolean to actual boolean
25 | if isinstance(value, str):
26 | if value.lower() in ('true', 'false'):
27 | return value.lower() == 'true'
28 | return value
29 | except Exception:
30 | return default
31 |
32 | def _should_log(level_name):
33 | """Check if a message at the given level should be logged"""
34 | configured_level = _get_config_value('ENABLE_APP_LOGS', 'INFO')
35 |
36 | # Handle legacy boolean values
37 | if isinstance(configured_level, bool):
38 | return configured_level
39 |
40 | # Convert to uppercase for comparison
41 | configured_level = str(configured_level).upper()
42 |
43 | # If disabled, don't log anything
44 | if configured_level == 'DISABLED':
45 | return False
46 |
47 | # Get numeric levels
48 | configured_numeric = LOG_LEVELS.get(configured_level, logging.INFO)
49 | message_numeric = LOG_LEVELS.get(level_name.upper(), logging.INFO)
50 |
51 | # Log if message level >= configured level
52 | return message_numeric >= configured_numeric
53 |
54 | def debug_log(message):
55 | """Write debug message to a file if DEBUG_LOGS is enabled"""
56 | # Check if debug logging is enabled via config
57 | debug_mode = _get_config_value('DEBUG_LOGS', False)
58 | if not debug_mode:
59 | return
60 |
61 | # Get debug log path from config
62 | debug_file = _get_config_value('DEBUG_LOG_PATH', os.path.expanduser("~/mcp_debug.log"))
63 |
64 | # Ensure parent directory exists
65 | Path(debug_file).parent.mkdir(parents=True, exist_ok=True)
66 |
67 | timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
68 | with open(debug_file, "a") as f:
69 | f.write(f"[{timestamp}] {message}\n")
70 | f.flush()
71 |
72 | def info_logger(msg):
73 | """Log info message if log level allows"""
74 | if _should_log('INFO'):
75 | return logger.info(msg)
76 |
77 | def error_logger(msg):
78 | """Log error message if log level allows"""
79 | if _should_log('ERROR'):
80 | return logger.error(msg)
81 |
82 | def warning_logger(msg):
83 | """Log warning message if log level allows"""
84 | if _should_log('WARNING'):
85 | return logger.warning(msg)
86 |
87 | def debug_logger(msg):
88 | """Log debug message if log level allows"""
89 | if _should_log('DEBUG'):
90 | return logger.debug(msg)
91 |
```
--------------------------------------------------------------------------------
/tests/sample_project_go/structs_methods.go:
--------------------------------------------------------------------------------
```go
1 | // structs_methods.go - Demonstrates Go structs and methods
2 | package main
3 |
4 | import "fmt"
5 |
6 | // Person represents a basic struct
7 | type Person struct {
8 | Name string
9 | Age int
10 | }
11 |
12 | // Employee extends Person concept with additional fields
13 | type Employee struct {
14 | Person
15 | ID int
16 | Position string
17 | Salary float64
18 | }
19 |
20 | // AnonymousFieldStruct uses anonymous fields
21 | type AnonymousFieldStruct struct {
22 | string
23 | int
24 | bool
25 | }
26 |
27 | // PrivateFieldStruct demonstrates private fields
28 | type PrivateFieldStruct struct {
29 | PublicField string
30 | privateField int // unexported field
31 | }
32 |
33 | // NewPerson is a constructor function
34 | func NewPerson(name string, age int) *Person {
35 | return &Person{
36 | Name: name,
37 | Age: age,
38 | }
39 | }
40 |
41 | // Greet is a value receiver method
42 | func (p Person) Greet() string {
43 | return fmt.Sprintf("Hello, my name is %s", p.Name)
44 | }
45 |
46 | // HaveBirthday is a pointer receiver method (modifies struct)
47 | func (p *Person) HaveBirthday() {
48 | p.Age++
49 | }
50 |
51 | // IsAdult demonstrates method with return value
52 | func (p Person) IsAdult() bool {
53 | return p.Age >= 18
54 | }
55 |
56 | // NewEmployee creates a new employee
57 | func NewEmployee(name string, age, id int, position string) *Employee {
58 | return &Employee{
59 | Person: Person{
60 | Name: name,
61 | Age: age,
62 | },
63 | ID: id,
64 | Position: position,
65 | }
66 | }
67 |
68 | // GetDetails is a method on embedded struct
69 | func (e Employee) GetDetails() string {
70 | return fmt.Sprintf("%s (%d) - %s [ID: %d]", e.Name, e.Age, e.Position, e.ID)
71 | }
72 |
73 | // Promote modifies employee position
74 | func (e *Employee) Promote(newPosition string, newSalary float64) {
75 | e.Position = newPosition
76 | e.Salary = newSalary
77 | }
78 |
79 | // GivesRaise calculates new salary
80 | func (e *Employee) GiveRaise(percentage float64) {
81 | e.Salary = e.Salary * (1 + percentage/100)
82 | }
83 |
84 | // SetPrivateField demonstrates accessing private fields through methods
85 | func (p *PrivateFieldStruct) SetPrivateField(val int) {
86 | p.privateField = val
87 | }
88 |
89 | // GetPrivateField gets the private field value
90 | func (p *PrivateFieldStruct) GetPrivateField() int {
91 | return p.privateField
92 | }
93 |
94 | // MethodCallingMethod demonstrates internal method calls
95 | func (p Person) FullIntroduction() string {
96 | greeting := p.Greet()
97 | ageStatus := "minor"
98 | if p.IsAdult() {
99 | ageStatus = "adult"
100 | }
101 | return fmt.Sprintf("%s and I am a %s", greeting, ageStatus)
102 | }
103 |
104 | // CompareAge compares two persons
105 | func (p Person) CompareAge(other Person) string {
106 | if p.Age > other.Age {
107 | return fmt.Sprintf("%s is older than %s", p.Name, other.Name)
108 | } else if p.Age < other.Age {
109 | return fmt.Sprintf("%s is younger than %s", p.Name, other.Name)
110 | }
111 | return fmt.Sprintf("%s and %s are the same age", p.Name, other.Name)
112 | }
113 |
114 | func demonstrateStructs() {
115 | person := NewPerson("Alice", 30)
116 | fmt.Println(person.Greet())
117 | person.HaveBirthday()
118 |
119 | employee := NewEmployee("Bob", 25, 1001, "Developer")
120 | employee.Promote("Senior Developer", 90000)
121 | fmt.Println(employee.GetDetails())
122 | }
123 |
124 |
```
--------------------------------------------------------------------------------
/website/package.json:
--------------------------------------------------------------------------------
```json
1 | {
2 | "name": "vite_react_shadcn_ts",
3 | "private": true,
4 | "version": "0.0.0",
5 | "type": "module",
6 | "scripts": {
7 | "dev": "vite",
8 | "build": "vite build",
9 | "build:dev": "vite build --mode development",
10 | "lint": "eslint .",
11 | "preview": "vite preview"
12 | },
13 | "dependencies": {
14 | "@hookform/resolvers": "^3.10.0",
15 | "@radix-ui/react-accordion": "^1.2.11",
16 | "@radix-ui/react-alert-dialog": "^1.1.14",
17 | "@radix-ui/react-aspect-ratio": "^1.1.7",
18 | "@radix-ui/react-avatar": "^1.1.10",
19 | "@radix-ui/react-checkbox": "^1.3.2",
20 | "@radix-ui/react-collapsible": "^1.1.11",
21 | "@radix-ui/react-context-menu": "^2.2.15",
22 | "@radix-ui/react-dialog": "^1.1.14",
23 | "@radix-ui/react-dropdown-menu": "^2.1.15",
24 | "@radix-ui/react-hover-card": "^1.1.14",
25 | "@radix-ui/react-label": "^2.1.7",
26 | "@radix-ui/react-menubar": "^1.1.15",
27 | "@radix-ui/react-navigation-menu": "^1.2.13",
28 | "@radix-ui/react-popover": "^1.1.14",
29 | "@radix-ui/react-progress": "^1.1.7",
30 | "@radix-ui/react-radio-group": "^1.3.7",
31 | "@radix-ui/react-scroll-area": "^1.2.9",
32 | "@radix-ui/react-select": "^2.2.5",
33 | "@radix-ui/react-separator": "^1.1.7",
34 | "@radix-ui/react-slider": "^1.3.5",
35 | "@radix-ui/react-slot": "^1.2.3",
36 | "@radix-ui/react-switch": "^1.2.5",
37 | "@radix-ui/react-tabs": "^1.1.12",
38 | "@radix-ui/react-toast": "^1.2.14",
39 | "@radix-ui/react-toggle": "^1.1.9",
40 | "@radix-ui/react-toggle-group": "^1.1.10",
41 | "@radix-ui/react-tooltip": "^1.2.7",
42 | "@supabase/supabase-js": "^2.75.0",
43 | "@tanstack/react-query": "^5.83.0",
44 | "@types/aos": "^3.0.7",
45 | "aos": "^2.3.4",
46 | "class-variance-authority": "^0.7.1",
47 | "clsx": "^2.1.1",
48 | "cmdk": "^1.1.1",
49 | "date-fns": "^3.6.0",
50 | "embla-carousel-react": "^8.6.0",
51 | "framer-motion": "^12.23.22",
52 | "input-otp": "^1.4.2",
53 | "lucide-react": "^0.462.0",
54 | "next-themes": "^0.3.0",
55 | "react": "^18.3.1",
56 | "react-day-picker": "^8.10.1",
57 | "react-dom": "^18.3.1",
58 | "react-hook-form": "^7.61.1",
59 | "react-icons": "^5.5.0",
60 | "react-intersection-observer": "^9.16.0",
61 | "react-resizable-panels": "^2.1.9",
62 | "react-router-dom": "^6.30.1",
63 | "recharts": "^2.15.4",
64 | "sonner": "^1.7.4",
65 | "tailwind-merge": "^2.6.0",
66 | "tailwindcss-animate": "^1.0.7",
67 | "vaul": "^0.9.9",
68 | "zod": "^3.25.76"
69 | },
70 | "devDependencies": {
71 | "@eslint/js": "^9.32.0",
72 | "@tailwindcss/typography": "^0.5.16",
73 | "@types/node": "^22.16.5",
74 | "@types/react": "^18.3.23",
75 | "@types/react-dom": "^18.3.7",
76 | "@vitejs/plugin-react-swc": "^3.11.0",
77 | "autoprefixer": "^10.4.21",
78 | "eslint": "^9.32.0",
79 | "eslint-plugin-react-hooks": "^5.2.0",
80 | "eslint-plugin-react-refresh": "^0.4.20",
81 | "globals": "^15.15.0",
82 | "postcss": "^8.5.6",
83 | "tailwindcss": "^3.4.17",
84 | "typescript": "^5.8.3",
85 | "typescript-eslint": "^8.38.0",
86 | "vite": "^5.4.19"
87 | }
88 | }
89 |
```
--------------------------------------------------------------------------------
/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py:
--------------------------------------------------------------------------------
```python
1 | class CppToolkit:
2 | """Handles Neo4j queries for C++ file graph."""
3 | def get_cypher_query(query: str) -> str:
4 | """
5 | Returns a Cypher query string based on the query type requested.
6 |
7 | Supported query types:
8 | - functions
9 | - classes
10 | - imports
11 | - structs
12 | - enums
13 | - unions
14 | - macros
15 | - variables
16 | """
17 |
18 |
19 | query = query.strip().lower()
20 |
21 | if query == "functions":
22 | return """
23 | MATCH (f:Function)
24 | RETURN f.name AS name, f.file_path AS file_path,
25 | f.line_number AS line_number, f.docstring AS docstring
26 | ORDER BY f.file_path, f.line_number
27 | """
28 |
29 | elif query == "classes":
30 | return """
31 | MATCH (c:Class)
32 | RETURN c.name AS name, c.file_path AS file_path,
33 | c.line_number AS line_number, c.docstring AS docstring
34 | ORDER BY c.file_path, c.line_number
35 | """
36 |
37 | elif query == "imports":
38 | return """
39 | MATCH (f:File)-[i:IMPORTS]->(m:Module)
40 | RETURN f.name AS file_name, m.name AS module_name,
41 | m.full_import_name AS full_import_name, m.alias AS alias
42 | ORDER BY f.name
43 | """
44 |
45 | elif query == "structs":
46 | return """
47 | MATCH (s:Struct)
48 | RETURN s.name AS name, s.file_path AS file_path,
49 | s.line_number AS line_number, s.fields AS fields
50 | ORDER BY s.file_path, s.line_number
51 | """
52 |
53 | elif query == "enums":
54 | return """
55 | MATCH (e:Enum)
56 | RETURN e.name AS name, e.file_path AS file_path,
57 | e.line_number AS line_number, e.values AS values
58 | ORDER BY e.file_path, e.line_number
59 | """
60 |
61 | elif query == "unions":
62 | return """
63 | MATCH (u:Union)
64 | RETURN u.name AS name, u.file_path AS file_path,
65 | u.line_number AS line_number, u.members AS members
66 | ORDER BY u.file_path, u.line_number
67 | """
68 |
69 | elif query == "macros":
70 | return """
71 | MATCH (m:Macro)
72 | RETURN m.name AS name, m.file_path AS file_path,
73 | m.line_number AS line_number, m.value AS value
74 | ORDER BY m.file_path, m.line_number
75 | """
76 |
77 | elif query == "variables":
78 | return """
79 | MATCH (v:Variable)
80 | RETURN v.name AS name, v.file_path AS file_path,
81 | v.line_number AS line_number, v.value AS value,
82 | v.context AS context
83 | ORDER BY v.file_path, v.line_number
84 | """
85 |
86 | else:
87 | raise ValueError(f"Unsupported query type: {query}")
88 |
```
--------------------------------------------------------------------------------
/website/src/components/ui/drawer.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import * as React from "react";
2 | import { Drawer as DrawerPrimitive } from "vaul";
3 |
4 | import { cn } from "@/lib/utils";
5 |
6 | const Drawer = ({ shouldScaleBackground = true, ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
7 | <DrawerPrimitive.Root shouldScaleBackground={shouldScaleBackground} {...props} />
8 | );
9 | Drawer.displayName = "Drawer";
10 |
11 | const DrawerTrigger = DrawerPrimitive.Trigger;
12 |
13 | const DrawerPortal = DrawerPrimitive.Portal;
14 |
15 | const DrawerClose = DrawerPrimitive.Close;
16 |
17 | const DrawerOverlay = React.forwardRef<
18 | React.ElementRef<typeof DrawerPrimitive.Overlay>,
19 | React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
20 | >(({ className, ...props }, ref) => (
21 | <DrawerPrimitive.Overlay ref={ref} className={cn("fixed inset-0 z-50 bg-black/80", className)} {...props} />
22 | ));
23 | DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName;
24 |
25 | const DrawerContent = React.forwardRef<
26 | React.ElementRef<typeof DrawerPrimitive.Content>,
27 | React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
28 | >(({ className, children, ...props }, ref) => (
29 | <DrawerPortal>
30 | <DrawerOverlay />
31 | <DrawerPrimitive.Content
32 | ref={ref}
33 | className={cn(
34 | "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
35 | className,
36 | )}
37 | {...props}
38 | >
39 | <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
40 | {children}
41 | </DrawerPrimitive.Content>
42 | </DrawerPortal>
43 | ));
44 | DrawerContent.displayName = "DrawerContent";
45 |
46 | const DrawerHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
47 | <div className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)} {...props} />
48 | );
49 | DrawerHeader.displayName = "DrawerHeader";
50 |
51 | const DrawerFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
52 | <div className={cn("mt-auto flex flex-col gap-2 p-4", className)} {...props} />
53 | );
54 | DrawerFooter.displayName = "DrawerFooter";
55 |
56 | const DrawerTitle = React.forwardRef<
57 | React.ElementRef<typeof DrawerPrimitive.Title>,
58 | React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
59 | >(({ className, ...props }, ref) => (
60 | <DrawerPrimitive.Title
61 | ref={ref}
62 | className={cn("text-lg font-semibold leading-none tracking-tight", className)}
63 | {...props}
64 | />
65 | ));
66 | DrawerTitle.displayName = DrawerPrimitive.Title.displayName;
67 |
68 | const DrawerDescription = React.forwardRef<
69 | React.ElementRef<typeof DrawerPrimitive.Description>,
70 | React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
71 | >(({ className, ...props }, ref) => (
72 | <DrawerPrimitive.Description ref={ref} className={cn("text-sm text-muted-foreground", className)} {...props} />
73 | ));
74 | DrawerDescription.displayName = DrawerPrimitive.Description.displayName;
75 |
76 | export {
77 | Drawer,
78 | DrawerPortal,
79 | DrawerOverlay,
80 | DrawerTrigger,
81 | DrawerClose,
82 | DrawerContent,
83 | DrawerHeader,
84 | DrawerFooter,
85 | DrawerTitle,
86 | DrawerDescription,
87 | };
88 |
```
--------------------------------------------------------------------------------
/website/src/components/FeaturesSection.tsx:
--------------------------------------------------------------------------------
```typescript
1 | import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
2 | import { GitBranch, Eye, Zap, Terminal } from "lucide-react";
3 |
4 | const features = [
5 | {
6 | icon: GitBranch,
7 | title: "Code Indexing",
8 | description: "Analyzes code and builds a comprehensive knowledge graph of its components, relationships, and dependencies.",
9 | color: "graph-node-1"
10 | },
11 | {
12 | icon: Eye,
13 | title: "Relationship Analysis",
14 | description: "Query for callers, callees, class hierarchies, and complex code relationships through natural language.",
15 | color: "graph-node-2"
16 | },
17 | {
18 | icon: Zap,
19 | title: "Live Updates",
20 | description: "Watches local files for changes and automatically updates the graph in real-time as you code.",
21 | color: "graph-node-3"
22 | },
23 | {
24 | icon: Terminal,
25 | title: "Interactive Setup",
26 | description: "User-friendly command-line wizard for easy setup. FalkorDB Lite is default (Unix and WSL), with Neo4j available via Docker or native installation.",
27 | color: "graph-node-1"
28 | }
29 | ];
30 |
31 | const FeaturesSection = () => {
32 | return (
33 | <section className="py-24 px-4">
34 | <div className="container mx-auto max-w-6xl">
35 | <div className="text-center mb-16" data-aos="fade-down">
36 | <h2 className="text-4xl md:text-5xl font-bold mb-6 bg-gradient-to-r from-primary via-primary to-accent bg-clip-text text-transparent">
37 | Powerful Features
38 | </h2>
39 | <p className="text-xl text-muted-foreground max-w-3xl mx-auto">
40 | Transform your codebase into an intelligent knowledge graph that AI assistants can understand and navigate
41 | </p>
42 | </div>
43 |
44 | <div className="grid md:grid-cols-2 gap-8">
45 | {features.map((feature, index) => (
46 | <div key={index} data-aos="fade-up" data-aos-delay={index * 100}>
47 | <Card
48 | className="border-border/50 hover:border-primary/30 transition-smooth group hover:shadow-glow animate-float-up dark:bg-gradient-card dark:bg-card/50 dark:border-border/30 dark:hover:border-primary/40 bg-white/95 border-gray-200/50 hover:border-primary/50 shadow-sm h-full"
49 | style={{ animationDelay: `${index * 0.1}s` }}
50 | >
51 | <CardHeader>
52 | <div className="flex items-center gap-4 mb-4">
53 | <div className={`p-3 rounded-xl bg-${feature.color}/10 border border-${feature.color}/20 group-hover:bg-${feature.color}/20 transition-smooth dark:bg-${feature.color}/20 dark:border-${feature.color}/30 bg-${feature.color}/5 border-${feature.color}/15`}>
54 | <feature.icon className={`h-6 w-6 text-${feature.color}`} />
55 | </div>
56 | <CardTitle className="text-xl font-semibold dark:text-foreground text-gray-900">{feature.title}</CardTitle>
57 | </div>
58 | <CardDescription className="text-base text-muted-foreground leading-relaxed dark:text-muted-foreground text-gray-600">
59 | {feature.description}
60 | </CardDescription>
61 | </CardHeader>
62 | </Card>
63 | </div>
64 | ))}
65 | </div>
66 | </div>
67 | </section>
68 | );
69 | };
70 |
71 | export default FeaturesSection;
72 |
73 |
```
--------------------------------------------------------------------------------
/website/public/placeholder.svg:
--------------------------------------------------------------------------------
```
1 | <svg xmlns="http://www.w3.org/2000/svg" width="1200" height="1200" fill="none"><rect width="1200" height="1200" fill="#EAEAEA" rx="3"/><g opacity=".5"><g opacity=".5"><path fill="#FAFAFA" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 736.5c-75.454 0-136.621-61.167-136.621-136.62 0-75.454 61.167-136.621 136.621-136.621 75.453 0 136.62 61.167 136.62 136.621 0 75.453-61.167 136.62-136.62 136.62Z"/></g><path stroke="url(#a)" stroke-width="2.418" d="M0-1.209h553.581" transform="scale(1 -1) rotate(45 1163.11 91.165)"/><path stroke="url(#b)" stroke-width="2.418" d="M404.846 598.671h391.726"/><path stroke="url(#c)" stroke-width="2.418" d="M599.5 795.742V404.017"/><path stroke="url(#d)" stroke-width="2.418" d="m795.717 796.597-391.441-391.44"/><path fill="#fff" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/><g clip-path="url(#e)"><path fill="#666" fill-rule="evenodd" d="M616.426 586.58h-31.434v16.176l3.553-3.554.531-.531h9.068l.074-.074 8.463-8.463h2.565l7.18 7.181V586.58Zm-15.715 14.654 3.698 3.699 1.283 1.282-2.565 2.565-1.282-1.283-5.2-5.199h-6.066l-5.514 5.514-.073.073v2.876a2.418 2.418 0 0 0 2.418 2.418h26.598a2.418 2.418 0 0 0 2.418-2.418v-8.317l-8.463-8.463-7.181 7.181-.071.072Zm-19.347 5.442v4.085a6.045 6.045 0 0 0 6.046 6.045h26.598a6.044 6.044 0 0 0 6.045-6.045v-7.108l1.356-1.355-1.282-1.283-.074-.073v-17.989h-38.689v23.43l-.146.146.146.147Z" clip-rule="evenodd"/></g><path stroke="#C9C9C9" stroke-width="2.418" d="M600.709 656.704c-31.384 0-56.825-25.441-56.825-56.824 0-31.384 25.441-56.825 56.825-56.825 31.383 0 56.824 25.441 56.824 56.825 0 31.383-25.441 56.824-56.824 56.824Z"/></g><defs><linearGradient id="a" x1="554.061" x2="-.48" y1=".083" y2=".087" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="b" x1="796.912" x2="404.507" y1="599.963" y2="599.965" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="c" x1="600.792" x2="600.794" y1="403.677" y2="796.082" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><linearGradient id="d" x1="404.85" x2="796.972" y1="403.903" y2="796.02" gradientUnits="userSpaceOnUse"><stop stop-color="#C9C9C9" stop-opacity="0"/><stop offset=".208" stop-color="#C9C9C9"/><stop offset=".792" stop-color="#C9C9C9"/><stop offset="1" stop-color="#C9C9C9" stop-opacity="0"/></linearGradient><clipPath id="e"><path fill="#fff" d="M581.364 580.535h38.689v38.689h-38.689z"/></clipPath></defs></svg>
```