codegraphcontext 0.4.16__tar.gz → 0.4.17__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codegraphcontext-0.4.16/src/codegraphcontext.egg-info → codegraphcontext-0.4.17}/PKG-INFO +82 -2
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/README.md +81 -1
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/pyproject.toml +1 -1
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/api/router.py +78 -23
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/cli/cli_helpers.py +65 -46
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/cli/config_manager.py +56 -21
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/cli/main.py +156 -130
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/cli/registry_commands.py +34 -11
- codegraphcontext-0.4.17/src/codegraphcontext/cli/visualizer.py +165 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/__init__.py +33 -19
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/bundle_registry.py +18 -4
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/cgc_bundle.py +241 -182
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/cgcignore.py +3 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/database_falkordb.py +45 -21
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/database_kuzu.py +38 -23
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/database_ladybug.py +25 -14
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/falkor_worker.py +39 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/jobs.py +1 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/watcher.py +45 -4
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/server.py +57 -21
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/code_finder.py +16 -13
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/graph_builder.py +10 -7
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/handlers/analysis_handlers.py +4 -2
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/handlers/indexing_handlers.py +13 -36
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/handlers/management_handlers.py +68 -16
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/handlers/query_handlers.py +24 -37
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/handlers/watcher_handlers.py +38 -27
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/constants.py +4 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/persistence/writer.py +72 -133
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/pipeline.py +20 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/resolution/calls.py +14 -1
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/c.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/dart.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/elisp.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/elixir.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/go.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/javascript.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/lua.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/perl.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/python.py +77 -35
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/ruby.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/swift.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/typescript.py +13 -3
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/report_generator.py +80 -15
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/scip_indexer.py +6 -1
- codegraphcontext-0.4.17/src/codegraphcontext/utils/cypher_readonly.py +65 -0
- codegraphcontext-0.4.17/src/codegraphcontext/utils/path_sandbox.py +90 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/server.py +57 -37
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17/src/codegraphcontext.egg-info}/PKG-INFO +82 -2
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext.egg-info/SOURCES.txt +2 -0
- codegraphcontext-0.4.16/src/codegraphcontext/cli/visualizer.py +0 -51
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/LICENSE +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/MANIFEST.in +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/setup.cfg +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/__main__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/api/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/api/app.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/api/mcp_sse.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/api/schemas.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/cli/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/cli/setup_macos.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/cli/setup_wizard.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/database.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/database_falkordb_remote.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/core/database_nornic.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/prompts.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tool_definitions.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/advanced_language_query_tool.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/datasources/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/datasources/cassandra_ingester.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/datasources/mysql_ingester.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/datasources/redis_ingester.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/discovery.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/embeddings.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/persistence/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/pre_scan.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/resolution/__init__.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/resolution/inheritance.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/resolution/post_resolution.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/sanitize.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/schema.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/schema_contract.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/scip_pipeline.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/indexing/vector_resolver.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/cpp.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/csharp.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/css.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/gradle.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/haskell.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/html.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/java.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/kotlin.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/maven.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/mybatis.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/php.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/rust.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/scala.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/languages/typescriptjsx.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/package_resolver.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/c_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/dart_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/elisp_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/go_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/haskell_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/java_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/perl_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/python_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/rust_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/scala_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/swift_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/scip_pb2.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/system.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/tree_sitter_parser.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/tools/type_utils.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/utils/debug_log.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/utils/git_utils.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/utils/path_ignore.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/utils/repo_path.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/utils/tool_limits.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/utils/tree_sitter_manager.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/utils/visualize_graph.py +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/__vite-browser-external-9wXp6ZBx.js +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/function-calls-BtRHrqa2.png +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/graph-total-D1fBAugo.png +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/hero-graph-2voMJp2a.jpg +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/hierarchy-DGADo0YT.png +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/index-C-187lf0.js +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/index-fNAa6jgv.css +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/parser-pyodide.worker-BgsDfaad.js +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/parser.worker-_nvrecvj.js +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/assets/tree-sitter-qKYAACSa.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/cgcIcon.png +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/favicon.ico +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/index.html +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/logo-icon.svg +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/logo.svg +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/placeholder.svg +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/preview-image.png +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/robots.txt +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-c.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-c_sharp.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-core.js +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-cpp.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-dart.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-go.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-java.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-javascript.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-kotlin.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-perl.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-php.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-python.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-ruby.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-rust.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-swift.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-tsx.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter-typescript.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/tree-sitter.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/web-tree-sitter.js +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext/viz/dist/wasm/web-tree-sitter.wasm +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext.egg-info/dependency_links.txt +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext.egg-info/entry_points.txt +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext.egg-info/requires.txt +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/src/codegraphcontext.egg-info/top_level.txt +0 -0
- {codegraphcontext-0.4.16 → codegraphcontext-0.4.17}/tests/test_issue_806_fix.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codegraphcontext
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.17
|
|
4
4
|
Summary: An MCP server that indexes local code into a graph database to provide context to AI assistants.
|
|
5
5
|
Author-email: Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
6
6
|
License: MIT License
|
|
@@ -156,6 +156,8 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
|
|
|
156
156
|
|
|
157
157
|
## 📍 Quick Navigation
|
|
158
158
|
* [🚀 Quick Start](#-installation--quick-start)
|
|
159
|
+
* [📋 Prerequisites](#-prerequisites)
|
|
160
|
+
* [🏃 How to Run the Project Locally](#-how-to-run-the-project-locally)
|
|
159
161
|
* [🌐 Supported Programming Languages](#supported-programming-languages)
|
|
160
162
|
* [🛠️ CLI Toolkit](#for-cli-toolkit-mode)
|
|
161
163
|
* [🤖 MCP Server](#-for-mcp-server-mode)
|
|
@@ -183,7 +185,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
|
|
|
183
185
|
---
|
|
184
186
|
|
|
185
187
|
## Project Details
|
|
186
|
-
- **Version:** 0.4.
|
|
188
|
+
- **Version:** 0.4.17
|
|
187
189
|
- **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
188
190
|
- **License:** MIT License (See [LICENSE](LICENSE) for details)
|
|
189
191
|
- **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
|
|
@@ -326,6 +328,84 @@ _If you’re using CodeGraphContext in your project, feel free to open a PR and
|
|
|
326
328
|
|
|
327
329
|
---
|
|
328
330
|
|
|
331
|
+
## 📋 Prerequisites
|
|
332
|
+
|
|
333
|
+
Before installing CodeGraphContext, ensure you have:
|
|
334
|
+
|
|
335
|
+
* Python 3.10 or later
|
|
336
|
+
* pip package manager
|
|
337
|
+
* Git (optional, for cloning repositories)
|
|
338
|
+
|
|
339
|
+
Verify your Python installation:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
python --version
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## 🚀 Step-by-Step Setup Guide
|
|
348
|
+
|
|
349
|
+
### Step 1: Install CodeGraphContext
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
pip install codegraphcontext
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
This command installs CodeGraphContext and all required dependencies.
|
|
356
|
+
|
|
357
|
+
### Step 2: Verify Installation
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
codegraphcontext --help
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
If the command displays the available CLI commands, the installation was successful.
|
|
364
|
+
|
|
365
|
+
### Step 3: Database Setup
|
|
366
|
+
|
|
367
|
+
CodeGraphContext automatically uses an embedded database by default, so no additional configuration is required for most users.
|
|
368
|
+
|
|
369
|
+
---
|
|
370
|
+
|
|
371
|
+
## 🏃 How to Run the Project Locally
|
|
372
|
+
|
|
373
|
+
### Index a Repository
|
|
374
|
+
|
|
375
|
+
```bash
|
|
376
|
+
codegraphcontext index .
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
This scans the current project and creates a searchable code graph.
|
|
380
|
+
|
|
381
|
+
### View Indexed Repositories
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
codegraphcontext list
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
Displays all repositories currently indexed by CodeGraphContext.
|
|
388
|
+
|
|
389
|
+
### Analyze Code
|
|
390
|
+
|
|
391
|
+
```bash
|
|
392
|
+
codegraphcontext analyze dead-code
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Finds potentially unused code in the indexed repository.
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
## ✅ Verify Everything Works
|
|
400
|
+
|
|
401
|
+
After indexing a repository, run:
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
codegraphcontext list
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
If the command executes successfully and displays indexed repositories, your setup is complete and CodeGraphContext is ready to use.
|
|
408
|
+
|
|
329
409
|
### For CLI Toolkit Mode
|
|
330
410
|
|
|
331
411
|
**Start using immediately with CLI commands:**
|
|
@@ -71,6 +71,8 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
|
|
|
71
71
|
|
|
72
72
|
## 📍 Quick Navigation
|
|
73
73
|
* [🚀 Quick Start](#-installation--quick-start)
|
|
74
|
+
* [📋 Prerequisites](#-prerequisites)
|
|
75
|
+
* [🏃 How to Run the Project Locally](#-how-to-run-the-project-locally)
|
|
74
76
|
* [🌐 Supported Programming Languages](#supported-programming-languages)
|
|
75
77
|
* [🛠️ CLI Toolkit](#for-cli-toolkit-mode)
|
|
76
78
|
* [🤖 MCP Server](#-for-mcp-server-mode)
|
|
@@ -98,7 +100,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
|
|
|
98
100
|
---
|
|
99
101
|
|
|
100
102
|
## Project Details
|
|
101
|
-
- **Version:** 0.4.
|
|
103
|
+
- **Version:** 0.4.17
|
|
102
104
|
- **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
103
105
|
- **License:** MIT License (See [LICENSE](LICENSE) for details)
|
|
104
106
|
- **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
|
|
@@ -241,6 +243,84 @@ _If you’re using CodeGraphContext in your project, feel free to open a PR and
|
|
|
241
243
|
|
|
242
244
|
---
|
|
243
245
|
|
|
246
|
+
## 📋 Prerequisites
|
|
247
|
+
|
|
248
|
+
Before installing CodeGraphContext, ensure you have:
|
|
249
|
+
|
|
250
|
+
* Python 3.10 or later
|
|
251
|
+
* pip package manager
|
|
252
|
+
* Git (optional, for cloning repositories)
|
|
253
|
+
|
|
254
|
+
Verify your Python installation:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
python --version
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## 🚀 Step-by-Step Setup Guide
|
|
263
|
+
|
|
264
|
+
### Step 1: Install CodeGraphContext
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
pip install codegraphcontext
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
This command installs CodeGraphContext and all required dependencies.
|
|
271
|
+
|
|
272
|
+
### Step 2: Verify Installation
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
codegraphcontext --help
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
If the command displays the available CLI commands, the installation was successful.
|
|
279
|
+
|
|
280
|
+
### Step 3: Database Setup
|
|
281
|
+
|
|
282
|
+
CodeGraphContext automatically uses an embedded database by default, so no additional configuration is required for most users.
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## 🏃 How to Run the Project Locally
|
|
287
|
+
|
|
288
|
+
### Index a Repository
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
codegraphcontext index .
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
This scans the current project and creates a searchable code graph.
|
|
295
|
+
|
|
296
|
+
### View Indexed Repositories
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
codegraphcontext list
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Displays all repositories currently indexed by CodeGraphContext.
|
|
303
|
+
|
|
304
|
+
### Analyze Code
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
codegraphcontext analyze dead-code
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
Finds potentially unused code in the indexed repository.
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## ✅ Verify Everything Works
|
|
315
|
+
|
|
316
|
+
After indexing a repository, run:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
codegraphcontext list
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
If the command executes successfully and displays indexed repositories, your setup is complete and CodeGraphContext is ready to use.
|
|
323
|
+
|
|
244
324
|
### For CLI Toolkit Mode
|
|
245
325
|
|
|
246
326
|
**Start using immediately with CLI commands:**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "codegraphcontext"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.17"
|
|
4
4
|
description = "An MCP server that indexes local code into a graph database to provide context to AI assistants."
|
|
5
5
|
authors = [{ name = "Shashank Shekhar Singh", email = "shashankshekharsingh1205@gmail.com" }]
|
|
6
6
|
readme = "README.md"
|
|
@@ -13,6 +13,8 @@ from .schemas import (
|
|
|
13
13
|
)
|
|
14
14
|
from codegraphcontext.server import MCPServer
|
|
15
15
|
|
|
16
|
+
import socket
|
|
17
|
+
|
|
16
18
|
router = APIRouter()
|
|
17
19
|
|
|
18
20
|
# Global server instance (initialized on startup)
|
|
@@ -25,9 +27,19 @@ def get_server() -> MCPServer:
|
|
|
25
27
|
_server_instance = MCPServer(cwd=Path.cwd())
|
|
26
28
|
return _server_instance
|
|
27
29
|
|
|
30
|
+
def raise_service_unavailable(exc: Exception):
|
|
31
|
+
raise HTTPException(
|
|
32
|
+
status_code=503,
|
|
33
|
+
detail="Database service unavailable",
|
|
34
|
+
) from exc
|
|
35
|
+
|
|
28
36
|
@router.get("/status", response_model=ApiResponse)
|
|
29
37
|
async def get_status(server: MCPServer = Depends(get_server)):
|
|
30
|
-
|
|
38
|
+
try:
|
|
39
|
+
status = server.db_manager.is_connected()
|
|
40
|
+
except (OSError, socket.error) as exc:
|
|
41
|
+
raise_service_unavailable(exc)
|
|
42
|
+
|
|
31
43
|
return ApiResponse(
|
|
32
44
|
status="ok",
|
|
33
45
|
message="Connected" if status else "Disconnected",
|
|
@@ -43,16 +55,35 @@ async def list_tools(server: MCPServer = Depends(get_server)):
|
|
|
43
55
|
|
|
44
56
|
@router.post("/tools/call", response_model=ApiResponse)
|
|
45
57
|
async def call_tool(
|
|
46
|
-
request: ToolCallRequest,
|
|
58
|
+
request: ToolCallRequest,
|
|
47
59
|
server: MCPServer = Depends(get_server)
|
|
48
60
|
):
|
|
49
61
|
try:
|
|
50
|
-
result = await server.handle_tool_call(
|
|
62
|
+
result = await server.handle_tool_call(
|
|
63
|
+
request.name,
|
|
64
|
+
request.arguments
|
|
65
|
+
)
|
|
66
|
+
|
|
51
67
|
if "error" in result:
|
|
52
|
-
return ApiResponse(
|
|
53
|
-
|
|
68
|
+
return ApiResponse(
|
|
69
|
+
status="error",
|
|
70
|
+
error=result["error"]
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
return ApiResponse(
|
|
74
|
+
status="ok",
|
|
75
|
+
data=result
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
except (OSError, socket.error) as exc:
|
|
79
|
+
raise_service_unavailable(exc)
|
|
80
|
+
|
|
54
81
|
except Exception as e:
|
|
55
|
-
return ApiResponse(
|
|
82
|
+
return ApiResponse(
|
|
83
|
+
status="error",
|
|
84
|
+
error=str(e)
|
|
85
|
+
)
|
|
86
|
+
|
|
56
87
|
|
|
57
88
|
@router.post("/index", response_model=ApiResponse)
|
|
58
89
|
async def index_repository(
|
|
@@ -60,21 +91,27 @@ async def index_repository(
|
|
|
60
91
|
background_tasks: BackgroundTasks,
|
|
61
92
|
server: MCPServer = Depends(get_server)
|
|
62
93
|
):
|
|
63
|
-
# Map to add_code_to_graph tool
|
|
64
94
|
args = {
|
|
65
95
|
"path": request.path,
|
|
66
96
|
"repo_name": request.repo_name,
|
|
67
97
|
"branch": request.branch,
|
|
68
98
|
"force": request.force
|
|
69
99
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
100
|
+
|
|
101
|
+
try:
|
|
102
|
+
result = await server.handle_tool_call(
|
|
103
|
+
"add_code_to_graph",
|
|
104
|
+
args
|
|
105
|
+
)
|
|
106
|
+
except (OSError, socket.error) as exc:
|
|
107
|
+
raise_service_unavailable(exc)
|
|
108
|
+
|
|
75
109
|
if "error" in result:
|
|
76
|
-
raise HTTPException(
|
|
77
|
-
|
|
110
|
+
raise HTTPException(
|
|
111
|
+
status_code=400,
|
|
112
|
+
detail=result["error"]
|
|
113
|
+
)
|
|
114
|
+
|
|
78
115
|
return ApiResponse(
|
|
79
116
|
status="ok",
|
|
80
117
|
message="Indexing job started",
|
|
@@ -86,17 +123,35 @@ async def execute_query(
|
|
|
86
123
|
request: QueryRequest,
|
|
87
124
|
server: MCPServer = Depends(get_server)
|
|
88
125
|
):
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
126
|
+
try:
|
|
127
|
+
result = await server.handle_tool_call(
|
|
128
|
+
"execute_cypher_query",
|
|
129
|
+
{
|
|
130
|
+
"cypher_query": request.query,
|
|
131
|
+
"params": request.params,
|
|
132
|
+
},
|
|
133
|
+
)
|
|
134
|
+
except (OSError, socket.error) as exc:
|
|
135
|
+
raise_service_unavailable(exc)
|
|
136
|
+
|
|
94
137
|
if "error" in result:
|
|
95
138
|
return ApiResponse(status="error", error=result["error"])
|
|
96
|
-
|
|
139
|
+
|
|
97
140
|
return ApiResponse(status="ok", data=result)
|
|
98
141
|
|
|
99
142
|
@router.get("/repositories", response_model=ApiResponse)
|
|
100
|
-
async def list_repositories(
|
|
101
|
-
|
|
102
|
-
|
|
143
|
+
async def list_repositories(
|
|
144
|
+
server: MCPServer = Depends(get_server)
|
|
145
|
+
):
|
|
146
|
+
try:
|
|
147
|
+
result = await server.handle_tool_call(
|
|
148
|
+
"list_indexed_repositories",
|
|
149
|
+
{}
|
|
150
|
+
)
|
|
151
|
+
except (OSError, socket.error) as exc:
|
|
152
|
+
raise_service_unavailable(exc)
|
|
153
|
+
|
|
154
|
+
return ApiResponse(
|
|
155
|
+
status="ok",
|
|
156
|
+
data=result
|
|
157
|
+
)
|
|
@@ -29,7 +29,13 @@ from ..tools.package_resolver import get_local_package_path
|
|
|
29
29
|
from ..utils.debug_log import info_logger, warning_logger
|
|
30
30
|
from ..core.database import Neo4jConnectionError
|
|
31
31
|
from ..utils.repo_path import any_repo_matches_path
|
|
32
|
-
from .config_manager import
|
|
32
|
+
from .config_manager import (
|
|
33
|
+
resolve_context,
|
|
34
|
+
ResolvedContext,
|
|
35
|
+
register_repo_in_context,
|
|
36
|
+
ensure_first_run_bootstrap,
|
|
37
|
+
ContextNotFoundError,
|
|
38
|
+
)
|
|
33
39
|
|
|
34
40
|
console = Console()
|
|
35
41
|
|
|
@@ -41,6 +47,9 @@ def _fail_services_init() -> None:
|
|
|
41
47
|
|
|
42
48
|
def _kuzu_fallback_path(ctx: ResolvedContext) -> Optional[str]:
|
|
43
49
|
"""Derive a KùzuDB directory when falling back from another backend."""
|
|
50
|
+
runtime = os.getenv("CGC_RUNTIME_DB_PATH")
|
|
51
|
+
if runtime:
|
|
52
|
+
return str(Path(runtime).expanduser().resolve())
|
|
44
53
|
if ctx.db_path:
|
|
45
54
|
return str(Path(ctx.db_path).parent / "kuzudb")
|
|
46
55
|
try:
|
|
@@ -85,7 +94,11 @@ def _initialize_services(
|
|
|
85
94
|
"""
|
|
86
95
|
ensure_first_run_bootstrap()
|
|
87
96
|
console.print("[dim]Resolving context...[/dim]")
|
|
88
|
-
|
|
97
|
+
try:
|
|
98
|
+
ctx = resolve_context(cli_context_flag, cwd=cwd)
|
|
99
|
+
except ContextNotFoundError as exc:
|
|
100
|
+
console.print(f"[bold red]Error:[/bold red] {exc}")
|
|
101
|
+
raise typer.Exit(code=1)
|
|
89
102
|
|
|
90
103
|
# Let the user know what context we're operating in
|
|
91
104
|
if ctx.mode == "named":
|
|
@@ -120,6 +133,8 @@ def _initialize_services(
|
|
|
120
133
|
# Check if this is a FalkorDB failure that should trigger a KùzuDB fallback
|
|
121
134
|
from ..core.database_falkordb import FalkorDBUnavailableError
|
|
122
135
|
if isinstance(e, FalkorDBUnavailableError):
|
|
136
|
+
from ..core import mark_falkordb_unavailable
|
|
137
|
+
mark_falkordb_unavailable()
|
|
123
138
|
console.print(f"[yellow]⚠ FalkorDB Lite is not functional in this environment: {e}[/yellow]")
|
|
124
139
|
console.print("[cyan]Falling back to KùzuDB for a reliable experience...[/cyan]")
|
|
125
140
|
|
|
@@ -219,8 +234,8 @@ async def _run_index_with_progress(graph_builder: GraphBuilder, path_obj: Path,
|
|
|
219
234
|
if job.total_files > 0:
|
|
220
235
|
progress.update(task_id, total=job.total_files, completed=job.processed_files)
|
|
221
236
|
|
|
222
|
-
#
|
|
223
|
-
current_file = job.current_file or ""
|
|
237
|
+
# Prefer post-processing status over the last parsed file path
|
|
238
|
+
current_file = job.status_message or job.current_file or ""
|
|
224
239
|
if len(current_file) > 40:
|
|
225
240
|
current_file = "..." + current_file[-37:]
|
|
226
241
|
progress.update(task_id, filename=current_file)
|
|
@@ -283,9 +298,10 @@ def index_helper(path: str, context: Optional[str] = None):
|
|
|
283
298
|
except Exception as e:
|
|
284
299
|
console.print(f"[yellow]Warning: Could not check file count: {e}. Proceeding with indexing...[/yellow]")
|
|
285
300
|
|
|
286
|
-
# Auto-register the repo into the named context (auto-creates if needed)
|
|
287
301
|
if context and ctx.mode == "named":
|
|
288
|
-
register_repo_in_context(context, str(path_obj), auto_create=
|
|
302
|
+
if not register_repo_in_context(context, str(path_obj), auto_create=False):
|
|
303
|
+
db_manager.close_driver()
|
|
304
|
+
raise typer.Exit(code=1)
|
|
289
305
|
|
|
290
306
|
console.print(f"Starting indexing for: {path_obj}")
|
|
291
307
|
|
|
@@ -327,7 +343,7 @@ def add_package_helper(package_name: str, language: str, context: Optional[str]
|
|
|
327
343
|
if not package_path_str:
|
|
328
344
|
console.print(f"[red]Error: Could not find package '{package_name}' for language '{language}'.[/red]")
|
|
329
345
|
db_manager.close_driver()
|
|
330
|
-
|
|
346
|
+
raise typer.Exit(code=1)
|
|
331
347
|
|
|
332
348
|
package_path = Path(package_path_str)
|
|
333
349
|
|
|
@@ -345,6 +361,7 @@ def add_package_helper(package_name: str, language: str, context: Optional[str]
|
|
|
345
361
|
console.print(f"[green]Successfully finished indexing package: {package_name}[/green]")
|
|
346
362
|
except Exception as e:
|
|
347
363
|
console.print(f"[bold red]An error occurred during package indexing:[/bold red] {e}")
|
|
364
|
+
raise typer.Exit(code=1)
|
|
348
365
|
finally:
|
|
349
366
|
db_manager.close_driver()
|
|
350
367
|
|
|
@@ -406,23 +423,26 @@ def cypher_helper(query: str, context: Optional[str] = None):
|
|
|
406
423
|
_fail_services_init()
|
|
407
424
|
|
|
408
425
|
db_manager, _, _, ctx = services
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
if re.search(pattern, query, re.IGNORECASE):
|
|
415
|
-
console.print("[bold red]Error: This command only supports read-only queries.[/bold red]")
|
|
426
|
+
|
|
427
|
+
from ..utils.cypher_readonly import is_read_only_cypher, read_only_rejection_message
|
|
428
|
+
|
|
429
|
+
if not is_read_only_cypher(query):
|
|
430
|
+
console.print(f"[bold red]Error:[/bold red] {read_only_rejection_message()}")
|
|
416
431
|
db_manager.close_driver()
|
|
417
432
|
raise typer.Exit(code=1)
|
|
418
433
|
|
|
434
|
+
backend = getattr(db_manager, "get_backend_type", lambda: "neo4j")()
|
|
435
|
+
session_kwargs = {"default_access_mode": "READ"} if backend == "neo4j" else {}
|
|
436
|
+
|
|
419
437
|
try:
|
|
420
|
-
with db_manager.get_driver().session() as session:
|
|
438
|
+
with db_manager.get_driver().session(**session_kwargs) as session:
|
|
421
439
|
result = session.run(query)
|
|
422
440
|
records = [record.data() for record in result]
|
|
423
441
|
console.print(json.dumps(records, indent=2))
|
|
424
442
|
except Exception as e:
|
|
425
443
|
console.print(f"[bold red]An error occurred while executing query:[/bold red] {e}")
|
|
444
|
+
db_manager.close_driver()
|
|
445
|
+
raise typer.Exit(code=1)
|
|
426
446
|
finally:
|
|
427
447
|
db_manager.close_driver()
|
|
428
448
|
|
|
@@ -430,34 +450,25 @@ def cypher_helper(query: str, context: Optional[str] = None):
|
|
|
430
450
|
def cypher_helper_visual(query: str, context: Optional[str] = None):
|
|
431
451
|
"""Executes a read-only Cypher query and visualizes the results."""
|
|
432
452
|
from .visualizer import visualize_cypher_results
|
|
433
|
-
|
|
453
|
+
from ..utils.cypher_readonly import is_read_only_cypher, read_only_rejection_message
|
|
454
|
+
|
|
434
455
|
services = _initialize_services(context)
|
|
435
456
|
if not all(services[:3]):
|
|
436
457
|
_fail_services_init()
|
|
437
458
|
|
|
438
459
|
db_manager, _, _, ctx = services
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
forbidden_keywords = ['CREATE', 'MERGE', 'DELETE', 'SET', 'REMOVE', 'DROP', 'CALL apoc']
|
|
443
|
-
pattern = r'\b(' + '|'.join(forbidden_keywords) + r')\b'
|
|
444
|
-
if re.search(pattern, query, re.IGNORECASE):
|
|
445
|
-
console.print("[bold red]Error: This command only supports read-only queries.[/bold red]")
|
|
460
|
+
|
|
461
|
+
if not is_read_only_cypher(query):
|
|
462
|
+
console.print(f"[bold red]Error:[/bold red] {read_only_rejection_message()}")
|
|
446
463
|
db_manager.close_driver()
|
|
447
464
|
raise typer.Exit(code=1)
|
|
448
465
|
|
|
449
466
|
try:
|
|
450
|
-
|
|
451
|
-
result = session.run(query)
|
|
452
|
-
records = [record.data() for record in result]
|
|
453
|
-
|
|
454
|
-
if not records:
|
|
455
|
-
console.print("[yellow]No results to visualize.[/yellow]")
|
|
456
|
-
return # finally block will close driver
|
|
457
|
-
|
|
458
|
-
visualize_cypher_results(records, query)
|
|
467
|
+
visualize_cypher_results(query)
|
|
459
468
|
except Exception as e:
|
|
460
469
|
console.print(f"[bold red]An error occurred while executing query:[/bold red] {e}")
|
|
470
|
+
db_manager.close_driver()
|
|
471
|
+
raise typer.Exit(code=1)
|
|
461
472
|
finally:
|
|
462
473
|
db_manager.close_driver()
|
|
463
474
|
|
|
@@ -466,7 +477,12 @@ import uvicorn
|
|
|
466
477
|
import urllib.parse
|
|
467
478
|
from ..viz.server import run_server, set_db_manager
|
|
468
479
|
|
|
469
|
-
def visualize_helper(
|
|
480
|
+
def visualize_helper(
|
|
481
|
+
repo_path: Optional[str] = None,
|
|
482
|
+
port: int = 8000,
|
|
483
|
+
context: Optional[str] = None,
|
|
484
|
+
cypher_query: Optional[str] = None,
|
|
485
|
+
):
|
|
470
486
|
"""Generates an interactive visualization using the Playground UI."""
|
|
471
487
|
services = _initialize_services(context)
|
|
472
488
|
if not all(services[:3]):
|
|
@@ -537,7 +553,9 @@ def visualize_helper(repo_path: Optional[str] = None, port: int = 8000, context:
|
|
|
537
553
|
params = {"backend": backend_url}
|
|
538
554
|
if repo_path:
|
|
539
555
|
params["repo_path"] = str(Path(repo_path).resolve())
|
|
540
|
-
|
|
556
|
+
if cypher_query:
|
|
557
|
+
params["cypher_query"] = cypher_query
|
|
558
|
+
|
|
541
559
|
query_string = urllib.parse.urlencode(params)
|
|
542
560
|
visualization_url = f"{backend_url}/explore?{query_string}"
|
|
543
561
|
|
|
@@ -558,6 +576,7 @@ def visualize_helper(repo_path: Optional[str] = None, port: int = 8000, context:
|
|
|
558
576
|
run_server(host="127.0.0.1", port=port, static_dir=str(static_dir))
|
|
559
577
|
except Exception as e:
|
|
560
578
|
console.print(f"[bold red]An error occurred while running the server:[/bold red] {e}")
|
|
579
|
+
raise typer.Exit(code=1)
|
|
561
580
|
finally:
|
|
562
581
|
db_manager.close_driver()
|
|
563
582
|
|
|
@@ -565,17 +584,18 @@ def visualize_helper(repo_path: Optional[str] = None, port: int = 8000, context:
|
|
|
565
584
|
def reindex_helper(path: str, context: Optional[str] = None):
|
|
566
585
|
"""Force re-index by deleting and rebuilding the repository."""
|
|
567
586
|
time_start = time.time()
|
|
568
|
-
|
|
587
|
+
path_obj = Path(path).resolve()
|
|
588
|
+
index_cwd = path_obj if path_obj.is_dir() else path_obj.parent
|
|
589
|
+
services = _initialize_services(context, cwd=index_cwd)
|
|
569
590
|
if not all(services[:3]):
|
|
570
591
|
_fail_services_init()
|
|
571
592
|
|
|
572
593
|
db_manager, graph_builder, code_finder, ctx = services
|
|
573
|
-
path_obj = Path(path).resolve()
|
|
574
594
|
|
|
575
595
|
if not path_obj.exists():
|
|
576
596
|
console.print(f"[red]Error: Path does not exist: {path_obj}[/red]")
|
|
577
597
|
db_manager.close_driver()
|
|
578
|
-
|
|
598
|
+
raise typer.Exit(code=1)
|
|
579
599
|
|
|
580
600
|
# Check if already indexed
|
|
581
601
|
indexed_repos = code_finder.list_indexed_repositories()
|
|
@@ -589,7 +609,7 @@ def reindex_helper(path: str, context: Optional[str] = None):
|
|
|
589
609
|
except Exception as e:
|
|
590
610
|
console.print(f"[red]Error deleting old index: {e}[/red]")
|
|
591
611
|
db_manager.close_driver()
|
|
592
|
-
|
|
612
|
+
raise typer.Exit(code=1)
|
|
593
613
|
|
|
594
614
|
console.print(f"[cyan]Re-indexing: {path_obj}[/cyan]")
|
|
595
615
|
|
|
@@ -627,14 +647,13 @@ def clean_helper(context: Optional[str] = None):
|
|
|
627
647
|
batch_size = 500
|
|
628
648
|
|
|
629
649
|
with db_manager.get_driver().session() as session:
|
|
630
|
-
#
|
|
631
|
-
#
|
|
632
|
-
# Repository → File → Class/Function → Variable hierarchy.
|
|
650
|
+
# Delete nodes with no incoming relationships (true orphans).
|
|
651
|
+
# Parameters (HAS_PARAMETER), import Modules (IMPORTS), etc. are kept.
|
|
633
652
|
while True:
|
|
634
653
|
result = session.run("""
|
|
635
654
|
MATCH (n)
|
|
636
655
|
WHERE NOT n:Repository
|
|
637
|
-
AND NOT ()-[
|
|
656
|
+
AND NOT ()-[]->(n)
|
|
638
657
|
WITH n LIMIT $batch_size
|
|
639
658
|
DETACH DELETE n
|
|
640
659
|
RETURN count(n) as deleted
|
|
@@ -762,7 +781,7 @@ def stats_helper(path: str = None, context: Optional[str] = None):
|
|
|
762
781
|
db_manager.close_driver()
|
|
763
782
|
|
|
764
783
|
|
|
765
|
-
def watch_helper(path: str, context: Optional[str] = None):
|
|
784
|
+
def watch_helper(path: str, context: Optional[str] = None, use_polling: Optional[bool] = None):
|
|
766
785
|
"""Watch a directory for changes and auto-update the graph (blocking mode)."""
|
|
767
786
|
import logging
|
|
768
787
|
from ..core.watcher import CodeWatcher
|
|
@@ -782,12 +801,12 @@ def watch_helper(path: str, context: Optional[str] = None):
|
|
|
782
801
|
if not path_obj.exists():
|
|
783
802
|
console.print(f"[red]Error: Path does not exist: {path_obj}[/red]")
|
|
784
803
|
db_manager.close_driver()
|
|
785
|
-
|
|
804
|
+
raise typer.Exit(code=1)
|
|
786
805
|
|
|
787
806
|
if not path_obj.is_dir():
|
|
788
807
|
console.print(f"[red]Error: Path must be a directory: {path_obj}[/red]")
|
|
789
808
|
db_manager.close_driver()
|
|
790
|
-
|
|
809
|
+
raise typer.Exit(code=1)
|
|
791
810
|
|
|
792
811
|
console.print(f"[bold cyan]🔍 Watching {path_obj} for changes...[/bold cyan]")
|
|
793
812
|
|
|
@@ -817,7 +836,7 @@ def watch_helper(path: str, context: Optional[str] = None):
|
|
|
817
836
|
|
|
818
837
|
# Create watcher instance
|
|
819
838
|
job_manager = JobManager()
|
|
820
|
-
watcher = CodeWatcher(graph_builder, job_manager)
|
|
839
|
+
watcher = CodeWatcher(graph_builder, job_manager, use_polling=use_polling)
|
|
821
840
|
|
|
822
841
|
try:
|
|
823
842
|
# Start the observer thread
|