codegraphcontext 0.1.23__tar.gz → 0.1.27__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.1.23/src/codegraphcontext.egg-info → codegraphcontext-0.1.27}/PKG-INFO +108 -29
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/README.md +107 -28
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/pyproject.toml +1 -1
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/cli/cli_helpers.py +96 -2
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/cli/config_manager.py +2 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/cli/main.py +71 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/server.py +10 -5
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/code_finder.py +15 -13
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/graph_builder.py +143 -17
- codegraphcontext-0.1.27/src/codegraphcontext/tools/languages/kotlin.py +631 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/utils/tree_sitter_manager.py +2 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27/src/codegraphcontext.egg-info}/PKG-INFO +108 -29
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext.egg-info/SOURCES.txt +2 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/tests/test_end_to_end.py +3 -3
- codegraphcontext-0.1.27/tests/test_kotlin_parser.py +97 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/LICENSE +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/MANIFEST.in +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/setup.cfg +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/__init__.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/__main__.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/cli/__init__.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/cli/setup_macos.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/cli/setup_wizard.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/core/__init__.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/core/database.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/core/database_falkordb.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/core/falkor_worker.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/core/jobs.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/core/watcher.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/prompts.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/__init__.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/advanced_language_query_tool.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/c.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/cpp.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/csharp.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/go.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/java.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/javascript.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/php.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/python.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/ruby.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/rust.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/languages/typescript.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/package_resolver.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/c_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/go_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/java_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/python_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/rust_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/tools/system.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/utils/debug_log.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext.egg-info/dependency_links.txt +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext.egg-info/entry_points.txt +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext.egg-info/requires.txt +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext.egg-info/top_level.txt +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/tests/test_cpp_parser.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/tests/test_database_validation.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/tests/test_graph_indexing.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/tests/test_graph_indexing_js.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/tests/test_tree_sitter_manager.py +0 -0
- {codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/tests/test_typescript_parser.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codegraphcontext
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.27
|
|
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
|
|
@@ -82,7 +82,7 @@ Dynamic: license-file
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
|
|
85
|
-
A powerful **MCP server** and **CLI
|
|
85
|
+
A powerful **MCP server** and **CLI toolkit** that indexes local code into a graph database to provide context to AI assistants and developers. Use it as a standalone CLI for comprehensive code analysis or connect it to your favorite AI IDE via MCP for AI-powered code understanding.
|
|
86
86
|
|
|
87
87
|
### Indexing a codebase
|
|
88
88
|

|
|
@@ -91,7 +91,7 @@ A powerful **MCP server** and **CLI tool** that indexes local code into a graph
|
|
|
91
91
|

|
|
92
92
|
|
|
93
93
|
## Project Details
|
|
94
|
-
- **Version:** 0.1.
|
|
94
|
+
- **Version:** 0.1.27
|
|
95
95
|
- **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
96
96
|
- **License:** MIT License (See [LICENSE](LICENSE) for details)
|
|
97
97
|
- **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
|
|
@@ -103,11 +103,12 @@ A powerful **MCP server** and **CLI tool** that indexes local code into a graph
|
|
|
103
103
|
|
|
104
104
|
- **Code Indexing:** Analyzes code and builds a knowledge graph of its components.
|
|
105
105
|
- **Relationship Analysis:** Query for callers, callees, class hierarchies, call chains and more.
|
|
106
|
-
- **Live
|
|
106
|
+
- **Live File Watching:** Watch directories for changes and automatically update the graph in real-time (`cgc watch`).
|
|
107
107
|
- **Interactive Setup:** A user-friendly command-line wizard for easy setup.
|
|
108
|
-
- **Dual Mode:** Works as a standalone **CLI
|
|
108
|
+
- **Dual Mode:** Works as a standalone **CLI toolkit** for developers and as an **MCP server** for AI agents.
|
|
109
109
|
- **Multi-Language Support:** Full support for 11 programming languages.
|
|
110
|
-
- **Flexible Database Backend:**
|
|
110
|
+
- **Flexible Database Backend:** FalkorDB Lite (default, inbuilt for Unix and through WSL for Windows) or Neo4j (all platforms via Docker/native).
|
|
111
|
+
|
|
111
112
|
|
|
112
113
|
## Supported Programming Languages
|
|
113
114
|
|
|
@@ -124,6 +125,7 @@ CodeGraphContext provides comprehensive parsing and analysis for the following l
|
|
|
124
125
|
- **Rust** (`.rs`)
|
|
125
126
|
- **Ruby** (`.rb`)
|
|
126
127
|
- **PHP** (`.php`)
|
|
128
|
+
- **Kotlin** (`.kt`) - Full support for classes, objects, companions, functions, and coroutines
|
|
127
129
|
|
|
128
130
|
Each language parser extracts functions, classes, methods, parameters, inheritance relationships, function calls, and imports to build a comprehensive code graph.
|
|
129
131
|
|
|
@@ -131,27 +133,33 @@ Each language parser extracts functions, classes, methods, parameters, inheritan
|
|
|
131
133
|
|
|
132
134
|
CodeGraphContext supports two graph database backends:
|
|
133
135
|
|
|
134
|
-
###
|
|
135
|
-
- **Production-ready** and widely used graph database
|
|
136
|
-
- Supports local instances (via Docker or native installation) and cloud hosting (Neo4j AuraDB)
|
|
137
|
-
- Full Cypher query support for advanced graph analytics
|
|
138
|
-
- Recommended for most use cases
|
|
139
|
-
|
|
140
|
-
### FalkorDB Lite
|
|
136
|
+
### FalkorDB Lite (Default for Unix/Linux/macOS)
|
|
141
137
|
- **Lightweight** in-memory graph database
|
|
142
138
|
- **No external dependencies** - runs entirely in-process
|
|
139
|
+
- **Inbuilt and enabled by default** for Unix-based systems (Linux, macOS)
|
|
143
140
|
- Available for **Python 3.12+** only
|
|
144
|
-
- Perfect for quick testing and
|
|
145
|
-
- Automatically installed when using Python 3.12 or higher
|
|
141
|
+
- Perfect for quick testing, development, and most use cases
|
|
142
|
+
- Automatically installed and configured when using Python 3.12 or higher on Unix systems
|
|
143
|
+
|
|
146
144
|
> ⚠️ **Windows Users:**
|
|
147
145
|
> FalkorDB Lite / redislite is **not supported on Windows**.
|
|
148
|
-
> You have
|
|
146
|
+
> You have three options:
|
|
149
147
|
> 1. Run the project under **WSL (Windows Subsystem for Linux)**: [WSL Install](https://learn.microsoft.com/en-us/windows/wsl/install)
|
|
150
|
-
> 2.
|
|
148
|
+
> 2. Use **Docker** to run the project in a containerized Linux environment
|
|
149
|
+
> 3. Use **Neo4j** directly as your graph database (see below)
|
|
151
150
|
|
|
151
|
+
### Neo4j (Available for All Platforms)
|
|
152
|
+
- **Production-ready** and widely used graph database
|
|
153
|
+
- **Available on all operating systems**: Windows, Linux, macOS
|
|
154
|
+
- Can be installed via:
|
|
155
|
+
- **Docker** (recommended, cross-platform)
|
|
156
|
+
- **WSL** (for Windows users)
|
|
157
|
+
- **Native installation** (dedicated command for each OS)
|
|
158
|
+
- Supports local instances and cloud hosting (Neo4j AuraDB)
|
|
159
|
+
- Full Cypher query support for advanced graph analytics
|
|
160
|
+
- Recommended for Windows users and production deployments
|
|
152
161
|
|
|
153
|
-
The `cgc neo4j setup` wizard helps you configure
|
|
154
|
-
supported inherently (enabled by default).
|
|
162
|
+
The `cgc neo4j setup` wizard helps you configure the Neo4j database backend, while FalkorDB Lite is enabled by default on Unix systems with no configuration needed.
|
|
155
163
|
|
|
156
164
|
## Used By
|
|
157
165
|
|
|
@@ -184,9 +192,31 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
|
|
|
184
192
|
|
|
185
193
|
## Getting Started
|
|
186
194
|
|
|
195
|
+
### 📋 Understanding CodeGraphContext Modes
|
|
196
|
+
|
|
197
|
+
CodeGraphContext operates in **two modes**, and you can use either or both:
|
|
198
|
+
|
|
199
|
+
#### 🛠️ Mode 1: CLI Toolkit (Standalone)
|
|
200
|
+
Use CodeGraphContext as a **powerful command-line toolkit** for code analysis:
|
|
201
|
+
- Index and analyze codebases directly from your terminal
|
|
202
|
+
- Query code relationships, find dead code, analyze complexity
|
|
203
|
+
- Visualize code graphs and dependencies
|
|
204
|
+
- Perfect for developers who want direct control via CLI commands
|
|
205
|
+
|
|
206
|
+
#### 🤖 Mode 2: MCP Server (AI-Powered)
|
|
207
|
+
Use CodeGraphContext as an **MCP server** for AI assistants:
|
|
208
|
+
- Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, etc.)
|
|
209
|
+
- Let AI agents query your codebase using natural language
|
|
210
|
+
- Automatic code understanding and relationship analysis
|
|
211
|
+
- Perfect for AI-assisted development workflows
|
|
212
|
+
|
|
213
|
+
**You can use both modes!** Install once, then use CLI commands directly OR connect to your AI assistant.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
### Installation (Both Modes)
|
|
218
|
+
|
|
187
219
|
1. **Install:** `pip install codegraphcontext`
|
|
188
|
-
2. **Setup:** `cgc mcp setup`
|
|
189
|
-
This command configures your IDE to work with CodeGraphContext. To configure a Neo4j database, use `cgc neo4j setup`.
|
|
190
220
|
|
|
191
221
|
<details>
|
|
192
222
|
<summary>⚙️ Troubleshooting: In case, command <code>cgc</code> not found</summary>
|
|
@@ -221,14 +251,56 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
|
|
|
221
251
|
```
|
|
222
252
|
</details>
|
|
223
253
|
|
|
254
|
+
2. **Database Setup (Automatic for Unix/WSL)**
|
|
224
255
|
|
|
225
|
-
**
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
256
|
+
- **FalkorDB Lite (Default):** If you're on Unix/Linux/macOS/WSL with Python 3.12+, you're done! FalkorDB Lite is already configured.
|
|
257
|
+
- **Neo4j (Optional/Windows):** To use Neo4j instead, or if you're on Windows without WSL, run: `cgc neo4j setup`
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
### 🛠️ For CLI Toolkit Mode
|
|
262
|
+
|
|
263
|
+
**Start using immediately with CLI commands:**
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
# Index your current directory
|
|
267
|
+
cgc index .
|
|
268
|
+
|
|
269
|
+
# List all indexed repositories
|
|
270
|
+
cgc list
|
|
229
271
|
|
|
230
|
-
|
|
231
|
-
|
|
272
|
+
# Analyze who calls a function
|
|
273
|
+
cgc analyze callers my_function
|
|
274
|
+
|
|
275
|
+
# Find complex code
|
|
276
|
+
cgc analyze complexity --threshold 10
|
|
277
|
+
|
|
278
|
+
# Find dead code
|
|
279
|
+
cgc analyze dead-code
|
|
280
|
+
|
|
281
|
+
# Watch for live changes (optional)
|
|
282
|
+
cgc watch .
|
|
283
|
+
|
|
284
|
+
# See all commands
|
|
285
|
+
cgc help
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**See the full [CLI Commands Guide](CLI_Commands.md) for all available commands and usage scenarios.**
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
### 🤖 For MCP Server Mode
|
|
294
|
+
|
|
295
|
+
**Configure your AI assistant to use CodeGraphContext:**
|
|
296
|
+
|
|
297
|
+
1. **Setup:** Run the MCP setup wizard to configure your IDE/AI assistant:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
cgc mcp setup
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
The wizard can automatically detect and configure:
|
|
232
304
|
* VS Code
|
|
233
305
|
* Cursor
|
|
234
306
|
* Windsurf
|
|
@@ -241,10 +313,16 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
|
|
|
241
313
|
|
|
242
314
|
Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files:
|
|
243
315
|
* It creates an `mcp.json` file in your current directory for reference.
|
|
244
|
-
* It stores your
|
|
316
|
+
* It stores your database credentials securely in `~/.codegraphcontext/.env`.
|
|
245
317
|
* It updates the settings file of your chosen IDE/CLI (e.g., `.claude.json` or VS Code's `settings.json`).
|
|
246
318
|
|
|
247
|
-
|
|
319
|
+
2. **Start:** Launch the MCP server:
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
cgc mcp start
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
3. **Use:** Now interact with your codebase through your AI assistant using natural language! See examples below.
|
|
248
326
|
|
|
249
327
|
## Ignoring Files (`.cgcignore`)
|
|
250
328
|
|
|
@@ -276,6 +354,7 @@ Add the following server configuration to your client's settings file (e.g., VS
|
|
|
276
354
|
"CodeGraphContext": {
|
|
277
355
|
"command": "cgc",
|
|
278
356
|
"args": [
|
|
357
|
+
"mcp",
|
|
279
358
|
"start"
|
|
280
359
|
],
|
|
281
360
|
"env": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
A powerful **MCP server** and **CLI
|
|
23
|
+
A powerful **MCP server** and **CLI toolkit** that indexes local code into a graph database to provide context to AI assistants and developers. Use it as a standalone CLI for comprehensive code analysis or connect it to your favorite AI IDE via MCP for AI-powered code understanding.
|
|
24
24
|
|
|
25
25
|
### Indexing a codebase
|
|
26
26
|

|
|
@@ -29,7 +29,7 @@ A powerful **MCP server** and **CLI tool** that indexes local code into a graph
|
|
|
29
29
|

|
|
30
30
|
|
|
31
31
|
## Project Details
|
|
32
|
-
- **Version:** 0.1.
|
|
32
|
+
- **Version:** 0.1.27
|
|
33
33
|
- **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
|
|
34
34
|
- **License:** MIT License (See [LICENSE](LICENSE) for details)
|
|
35
35
|
- **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
|
|
@@ -41,11 +41,12 @@ A powerful **MCP server** and **CLI tool** that indexes local code into a graph
|
|
|
41
41
|
|
|
42
42
|
- **Code Indexing:** Analyzes code and builds a knowledge graph of its components.
|
|
43
43
|
- **Relationship Analysis:** Query for callers, callees, class hierarchies, call chains and more.
|
|
44
|
-
- **Live
|
|
44
|
+
- **Live File Watching:** Watch directories for changes and automatically update the graph in real-time (`cgc watch`).
|
|
45
45
|
- **Interactive Setup:** A user-friendly command-line wizard for easy setup.
|
|
46
|
-
- **Dual Mode:** Works as a standalone **CLI
|
|
46
|
+
- **Dual Mode:** Works as a standalone **CLI toolkit** for developers and as an **MCP server** for AI agents.
|
|
47
47
|
- **Multi-Language Support:** Full support for 11 programming languages.
|
|
48
|
-
- **Flexible Database Backend:**
|
|
48
|
+
- **Flexible Database Backend:** FalkorDB Lite (default, inbuilt for Unix and through WSL for Windows) or Neo4j (all platforms via Docker/native).
|
|
49
|
+
|
|
49
50
|
|
|
50
51
|
## Supported Programming Languages
|
|
51
52
|
|
|
@@ -62,6 +63,7 @@ CodeGraphContext provides comprehensive parsing and analysis for the following l
|
|
|
62
63
|
- **Rust** (`.rs`)
|
|
63
64
|
- **Ruby** (`.rb`)
|
|
64
65
|
- **PHP** (`.php`)
|
|
66
|
+
- **Kotlin** (`.kt`) - Full support for classes, objects, companions, functions, and coroutines
|
|
65
67
|
|
|
66
68
|
Each language parser extracts functions, classes, methods, parameters, inheritance relationships, function calls, and imports to build a comprehensive code graph.
|
|
67
69
|
|
|
@@ -69,27 +71,33 @@ Each language parser extracts functions, classes, methods, parameters, inheritan
|
|
|
69
71
|
|
|
70
72
|
CodeGraphContext supports two graph database backends:
|
|
71
73
|
|
|
72
|
-
###
|
|
73
|
-
- **Production-ready** and widely used graph database
|
|
74
|
-
- Supports local instances (via Docker or native installation) and cloud hosting (Neo4j AuraDB)
|
|
75
|
-
- Full Cypher query support for advanced graph analytics
|
|
76
|
-
- Recommended for most use cases
|
|
77
|
-
|
|
78
|
-
### FalkorDB Lite
|
|
74
|
+
### FalkorDB Lite (Default for Unix/Linux/macOS)
|
|
79
75
|
- **Lightweight** in-memory graph database
|
|
80
76
|
- **No external dependencies** - runs entirely in-process
|
|
77
|
+
- **Inbuilt and enabled by default** for Unix-based systems (Linux, macOS)
|
|
81
78
|
- Available for **Python 3.12+** only
|
|
82
|
-
- Perfect for quick testing and
|
|
83
|
-
- Automatically installed when using Python 3.12 or higher
|
|
79
|
+
- Perfect for quick testing, development, and most use cases
|
|
80
|
+
- Automatically installed and configured when using Python 3.12 or higher on Unix systems
|
|
81
|
+
|
|
84
82
|
> ⚠️ **Windows Users:**
|
|
85
83
|
> FalkorDB Lite / redislite is **not supported on Windows**.
|
|
86
|
-
> You have
|
|
84
|
+
> You have three options:
|
|
87
85
|
> 1. Run the project under **WSL (Windows Subsystem for Linux)**: [WSL Install](https://learn.microsoft.com/en-us/windows/wsl/install)
|
|
88
|
-
> 2.
|
|
86
|
+
> 2. Use **Docker** to run the project in a containerized Linux environment
|
|
87
|
+
> 3. Use **Neo4j** directly as your graph database (see below)
|
|
89
88
|
|
|
89
|
+
### Neo4j (Available for All Platforms)
|
|
90
|
+
- **Production-ready** and widely used graph database
|
|
91
|
+
- **Available on all operating systems**: Windows, Linux, macOS
|
|
92
|
+
- Can be installed via:
|
|
93
|
+
- **Docker** (recommended, cross-platform)
|
|
94
|
+
- **WSL** (for Windows users)
|
|
95
|
+
- **Native installation** (dedicated command for each OS)
|
|
96
|
+
- Supports local instances and cloud hosting (Neo4j AuraDB)
|
|
97
|
+
- Full Cypher query support for advanced graph analytics
|
|
98
|
+
- Recommended for Windows users and production deployments
|
|
90
99
|
|
|
91
|
-
The `cgc neo4j setup` wizard helps you configure
|
|
92
|
-
supported inherently (enabled by default).
|
|
100
|
+
The `cgc neo4j setup` wizard helps you configure the Neo4j database backend, while FalkorDB Lite is enabled by default on Unix systems with no configuration needed.
|
|
93
101
|
|
|
94
102
|
## Used By
|
|
95
103
|
|
|
@@ -122,9 +130,31 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
|
|
|
122
130
|
|
|
123
131
|
## Getting Started
|
|
124
132
|
|
|
133
|
+
### 📋 Understanding CodeGraphContext Modes
|
|
134
|
+
|
|
135
|
+
CodeGraphContext operates in **two modes**, and you can use either or both:
|
|
136
|
+
|
|
137
|
+
#### 🛠️ Mode 1: CLI Toolkit (Standalone)
|
|
138
|
+
Use CodeGraphContext as a **powerful command-line toolkit** for code analysis:
|
|
139
|
+
- Index and analyze codebases directly from your terminal
|
|
140
|
+
- Query code relationships, find dead code, analyze complexity
|
|
141
|
+
- Visualize code graphs and dependencies
|
|
142
|
+
- Perfect for developers who want direct control via CLI commands
|
|
143
|
+
|
|
144
|
+
#### 🤖 Mode 2: MCP Server (AI-Powered)
|
|
145
|
+
Use CodeGraphContext as an **MCP server** for AI assistants:
|
|
146
|
+
- Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, etc.)
|
|
147
|
+
- Let AI agents query your codebase using natural language
|
|
148
|
+
- Automatic code understanding and relationship analysis
|
|
149
|
+
- Perfect for AI-assisted development workflows
|
|
150
|
+
|
|
151
|
+
**You can use both modes!** Install once, then use CLI commands directly OR connect to your AI assistant.
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
### Installation (Both Modes)
|
|
156
|
+
|
|
125
157
|
1. **Install:** `pip install codegraphcontext`
|
|
126
|
-
2. **Setup:** `cgc mcp setup`
|
|
127
|
-
This command configures your IDE to work with CodeGraphContext. To configure a Neo4j database, use `cgc neo4j setup`.
|
|
128
158
|
|
|
129
159
|
<details>
|
|
130
160
|
<summary>⚙️ Troubleshooting: In case, command <code>cgc</code> not found</summary>
|
|
@@ -159,14 +189,56 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
|
|
|
159
189
|
```
|
|
160
190
|
</details>
|
|
161
191
|
|
|
192
|
+
2. **Database Setup (Automatic for Unix/WSL)**
|
|
162
193
|
|
|
163
|
-
**
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
194
|
+
- **FalkorDB Lite (Default):** If you're on Unix/Linux/macOS/WSL with Python 3.12+, you're done! FalkorDB Lite is already configured.
|
|
195
|
+
- **Neo4j (Optional/Windows):** To use Neo4j instead, or if you're on Windows without WSL, run: `cgc neo4j setup`
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
### 🛠️ For CLI Toolkit Mode
|
|
200
|
+
|
|
201
|
+
**Start using immediately with CLI commands:**
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
# Index your current directory
|
|
205
|
+
cgc index .
|
|
206
|
+
|
|
207
|
+
# List all indexed repositories
|
|
208
|
+
cgc list
|
|
167
209
|
|
|
168
|
-
|
|
169
|
-
|
|
210
|
+
# Analyze who calls a function
|
|
211
|
+
cgc analyze callers my_function
|
|
212
|
+
|
|
213
|
+
# Find complex code
|
|
214
|
+
cgc analyze complexity --threshold 10
|
|
215
|
+
|
|
216
|
+
# Find dead code
|
|
217
|
+
cgc analyze dead-code
|
|
218
|
+
|
|
219
|
+
# Watch for live changes (optional)
|
|
220
|
+
cgc watch .
|
|
221
|
+
|
|
222
|
+
# See all commands
|
|
223
|
+
cgc help
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**See the full [CLI Commands Guide](CLI_Commands.md) for all available commands and usage scenarios.**
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### 🤖 For MCP Server Mode
|
|
232
|
+
|
|
233
|
+
**Configure your AI assistant to use CodeGraphContext:**
|
|
234
|
+
|
|
235
|
+
1. **Setup:** Run the MCP setup wizard to configure your IDE/AI assistant:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
cgc mcp setup
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
The wizard can automatically detect and configure:
|
|
170
242
|
* VS Code
|
|
171
243
|
* Cursor
|
|
172
244
|
* Windsurf
|
|
@@ -179,10 +251,16 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
|
|
|
179
251
|
|
|
180
252
|
Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files:
|
|
181
253
|
* It creates an `mcp.json` file in your current directory for reference.
|
|
182
|
-
* It stores your
|
|
254
|
+
* It stores your database credentials securely in `~/.codegraphcontext/.env`.
|
|
183
255
|
* It updates the settings file of your chosen IDE/CLI (e.g., `.claude.json` or VS Code's `settings.json`).
|
|
184
256
|
|
|
185
|
-
|
|
257
|
+
2. **Start:** Launch the MCP server:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
cgc mcp start
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
3. **Use:** Now interact with your codebase through your AI assistant using natural language! See examples below.
|
|
186
264
|
|
|
187
265
|
## Ignoring Files (`.cgcignore`)
|
|
188
266
|
|
|
@@ -214,6 +292,7 @@ Add the following server configuration to your client's settings file (e.g., VS
|
|
|
214
292
|
"CodeGraphContext": {
|
|
215
293
|
"command": "cgc",
|
|
216
294
|
"args": [
|
|
295
|
+
"mcp",
|
|
217
296
|
"start"
|
|
218
297
|
],
|
|
219
298
|
"env": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "codegraphcontext"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.27"
|
|
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"
|
|
@@ -159,8 +159,11 @@ def delete_helper(repo_path: str):
|
|
|
159
159
|
db_manager, graph_builder, _ = services
|
|
160
160
|
|
|
161
161
|
try:
|
|
162
|
-
graph_builder.delete_repository_from_graph(repo_path)
|
|
163
|
-
|
|
162
|
+
if graph_builder.delete_repository_from_graph(repo_path):
|
|
163
|
+
console.print(f"[green]Successfully deleted repository: {repo_path}[/green]")
|
|
164
|
+
else:
|
|
165
|
+
console.print(f"[yellow]Repository not found in graph: {repo_path}[/yellow]")
|
|
166
|
+
console.print("[dim]Tip: Use 'cgc list' to see available repositories.[/dim]")
|
|
164
167
|
except Exception as e:
|
|
165
168
|
console.print(f"[bold red]An error occurred:[/bold red] {e}")
|
|
166
169
|
finally:
|
|
@@ -512,3 +515,94 @@ def stats_helper(path: str = None):
|
|
|
512
515
|
console.print(f"[bold red]An error occurred:[/bold red] {e}")
|
|
513
516
|
finally:
|
|
514
517
|
db_manager.close_driver()
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
def watch_helper(path: str):
|
|
521
|
+
"""Watch a directory for changes and auto-update the graph (blocking mode)."""
|
|
522
|
+
from ..core.watcher import CodeWatcher
|
|
523
|
+
|
|
524
|
+
services = _initialize_services()
|
|
525
|
+
if not all(services):
|
|
526
|
+
return
|
|
527
|
+
|
|
528
|
+
db_manager, graph_builder, code_finder = services
|
|
529
|
+
path_obj = Path(path).resolve()
|
|
530
|
+
|
|
531
|
+
if not path_obj.exists():
|
|
532
|
+
console.print(f"[red]Error: Path does not exist: {path_obj}[/red]")
|
|
533
|
+
db_manager.close_driver()
|
|
534
|
+
return
|
|
535
|
+
|
|
536
|
+
if not path_obj.is_dir():
|
|
537
|
+
console.print(f"[red]Error: Path must be a directory: {path_obj}[/red]")
|
|
538
|
+
db_manager.close_driver()
|
|
539
|
+
return
|
|
540
|
+
|
|
541
|
+
console.print(f"[bold cyan]🔍 Watching {path_obj} for changes...[/bold cyan]")
|
|
542
|
+
|
|
543
|
+
# Check if already indexed
|
|
544
|
+
indexed_repos = code_finder.list_indexed_repositories()
|
|
545
|
+
is_indexed = any(Path(repo["path"]).resolve() == path_obj for repo in indexed_repos)
|
|
546
|
+
|
|
547
|
+
# Create watcher instance
|
|
548
|
+
job_manager = JobManager()
|
|
549
|
+
watcher = CodeWatcher(graph_builder, job_manager)
|
|
550
|
+
|
|
551
|
+
try:
|
|
552
|
+
# Start the observer thread
|
|
553
|
+
watcher.start()
|
|
554
|
+
|
|
555
|
+
# Add the directory to watch
|
|
556
|
+
if is_indexed:
|
|
557
|
+
console.print("[green]✓[/green] Already indexed (no initial scan needed)")
|
|
558
|
+
watcher.watch_directory(str(path_obj), perform_initial_scan=False)
|
|
559
|
+
else:
|
|
560
|
+
console.print("[yellow]⚠[/yellow] Not indexed yet. Performing initial scan...")
|
|
561
|
+
|
|
562
|
+
# Index the repository first (like MCP does)
|
|
563
|
+
async def do_index():
|
|
564
|
+
await graph_builder.build_graph_from_path_async(path_obj, is_dependency=False)
|
|
565
|
+
|
|
566
|
+
asyncio.run(do_index())
|
|
567
|
+
console.print("[green]✓[/green] Initial scan complete")
|
|
568
|
+
|
|
569
|
+
# Now start watching (without another scan)
|
|
570
|
+
watcher.watch_directory(str(path_obj), perform_initial_scan=False)
|
|
571
|
+
|
|
572
|
+
console.print("[bold green]👀 Monitoring for file changes...[/bold green] (Press Ctrl+C to stop)")
|
|
573
|
+
console.print("[dim]💡 Tip: Open a new terminal window to continue working[/dim]\n")
|
|
574
|
+
|
|
575
|
+
# Block here and keep the watcher running
|
|
576
|
+
import threading
|
|
577
|
+
stop_event = threading.Event()
|
|
578
|
+
|
|
579
|
+
try:
|
|
580
|
+
stop_event.wait() # Wait indefinitely until interrupted
|
|
581
|
+
except KeyboardInterrupt:
|
|
582
|
+
console.print("\n[yellow]🛑 Stopping watcher...[/yellow]")
|
|
583
|
+
|
|
584
|
+
except KeyboardInterrupt:
|
|
585
|
+
console.print("\n[yellow]🛑 Stopping watcher...[/yellow]")
|
|
586
|
+
except Exception as e:
|
|
587
|
+
console.print(f"[bold red]An error occurred:[/bold red] {e}")
|
|
588
|
+
finally:
|
|
589
|
+
watcher.stop()
|
|
590
|
+
db_manager.close_driver()
|
|
591
|
+
console.print("[green]✓[/green] Watcher stopped. Graph is up to date.")
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
def unwatch_helper(path: str):
|
|
596
|
+
"""Stop watching a directory."""
|
|
597
|
+
console.print(f"[yellow]⚠️ Note: 'cgc unwatch' only works when the watcher is running via MCP server.[/yellow]")
|
|
598
|
+
console.print(f"[dim]For CLI watch mode, simply press Ctrl+C in the watch terminal.[/dim]")
|
|
599
|
+
console.print(f"\n[cyan]Path specified:[/cyan] {Path(path).resolve()}")
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
def list_watching_helper():
|
|
603
|
+
"""List all directories currently being watched."""
|
|
604
|
+
console.print(f"[yellow]⚠️ Note: 'cgc watching' only works when the watcher is running via MCP server.[/yellow]")
|
|
605
|
+
console.print(f"[dim]For CLI watch mode, check the terminal where you ran 'cgc watch'.[/dim]")
|
|
606
|
+
console.print(f"\n[cyan]To see watched directories in MCP mode:[/cyan]")
|
|
607
|
+
console.print(f" 1. Start the MCP server: cgc mcp start")
|
|
608
|
+
console.print(f" 2. Use the 'list_watched_paths' MCP tool from your IDE")
|
{codegraphcontext-0.1.23 → codegraphcontext-0.1.27}/src/codegraphcontext/cli/config_manager.py
RENAMED
|
@@ -33,6 +33,7 @@ DEFAULT_CONFIG = {
|
|
|
33
33
|
"MAX_DEPTH": "unlimited",
|
|
34
34
|
"PARALLEL_WORKERS": "4",
|
|
35
35
|
"CACHE_ENABLED": "true",
|
|
36
|
+
"IGNORE_DIRS": "node_modules,venv,.venv,env,.env,dist,build,target,out,.git,.idea,.vscode,__pycache__",
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
# Configuration key descriptions
|
|
@@ -50,6 +51,7 @@ CONFIG_DESCRIPTIONS = {
|
|
|
50
51
|
"MAX_DEPTH": "Maximum directory depth for indexing (unlimited or number)",
|
|
51
52
|
"PARALLEL_WORKERS": "Number of parallel indexing workers",
|
|
52
53
|
"CACHE_ENABLED": "Enable caching for faster re-indexing",
|
|
54
|
+
"IGNORE_DIRS": "Comma-separated list of directory names to ignore during indexing",
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
# Valid values for each config key
|
|
@@ -38,6 +38,9 @@ from .cli_helpers import (
|
|
|
38
38
|
clean_helper,
|
|
39
39
|
stats_helper,
|
|
40
40
|
_initialize_services,
|
|
41
|
+
watch_helper,
|
|
42
|
+
unwatch_helper,
|
|
43
|
+
list_watching_helper,
|
|
41
44
|
)
|
|
42
45
|
|
|
43
46
|
# Set the log level for the noisy neo4j and asyncio logger to WARNING to keep the output clean.
|
|
@@ -610,6 +613,68 @@ def add_package(package_name: str = typer.Argument(..., help="Name of the packag
|
|
|
610
613
|
_load_credentials()
|
|
611
614
|
add_package_helper(package_name, language)
|
|
612
615
|
|
|
616
|
+
# ============================================================================
|
|
617
|
+
# WATCH COMMAND GROUP - Live File Monitoring
|
|
618
|
+
# ============================================================================
|
|
619
|
+
|
|
620
|
+
@app.command()
|
|
621
|
+
def watch(
|
|
622
|
+
path: str = typer.Argument(".", help="Path to the directory to watch. Defaults to current directory.")
|
|
623
|
+
):
|
|
624
|
+
"""
|
|
625
|
+
Watch a directory for file changes and automatically update the code graph.
|
|
626
|
+
|
|
627
|
+
This command runs in the foreground and monitors the specified directory
|
|
628
|
+
for any file changes. When changes are detected, the code graph is
|
|
629
|
+
automatically updated.
|
|
630
|
+
|
|
631
|
+
The watcher will:
|
|
632
|
+
- Perform an initial scan if the directory is not yet indexed
|
|
633
|
+
- Monitor for file creation, modification, deletion, and moves
|
|
634
|
+
- Automatically re-index affected files and update relationships
|
|
635
|
+
|
|
636
|
+
Press Ctrl+C to stop watching.
|
|
637
|
+
|
|
638
|
+
Examples:
|
|
639
|
+
cgc watch . # Watch current directory
|
|
640
|
+
cgc watch /path/to/project # Watch specific directory
|
|
641
|
+
cgc w . # Using shortcut alias
|
|
642
|
+
"""
|
|
643
|
+
_load_credentials()
|
|
644
|
+
watch_helper(path)
|
|
645
|
+
|
|
646
|
+
@app.command()
|
|
647
|
+
def unwatch(
|
|
648
|
+
path: str = typer.Argument(..., help="Path to stop watching")
|
|
649
|
+
):
|
|
650
|
+
"""
|
|
651
|
+
Stop watching a directory for changes.
|
|
652
|
+
|
|
653
|
+
Note: This command is primarily for MCP server mode.
|
|
654
|
+
For CLI watch mode, simply press Ctrl+C in the watch terminal.
|
|
655
|
+
|
|
656
|
+
Examples:
|
|
657
|
+
cgc unwatch /path/to/project
|
|
658
|
+
"""
|
|
659
|
+
_load_credentials()
|
|
660
|
+
unwatch_helper(path)
|
|
661
|
+
|
|
662
|
+
@app.command()
|
|
663
|
+
def watching():
|
|
664
|
+
"""
|
|
665
|
+
List all directories currently being watched for changes.
|
|
666
|
+
|
|
667
|
+
Note: This command is primarily for MCP server mode.
|
|
668
|
+
For CLI watch mode, check the terminal where you ran 'cgc watch'.
|
|
669
|
+
|
|
670
|
+
Examples:
|
|
671
|
+
cgc watching
|
|
672
|
+
"""
|
|
673
|
+
_load_credentials()
|
|
674
|
+
list_watching_helper()
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
613
678
|
# ============================================================================
|
|
614
679
|
# FIND COMMAND GROUP - Code Search & Discovery
|
|
615
680
|
# ============================================================================
|
|
@@ -1220,6 +1285,12 @@ def visualize_abbrev(query: Optional[str] = typer.Argument(None, help="Cypher qu
|
|
|
1220
1285
|
"""Shortcut for 'cgc visualize'"""
|
|
1221
1286
|
visualize(query)
|
|
1222
1287
|
|
|
1288
|
+
@app.command("w", rich_help_panel="Shortcuts")
|
|
1289
|
+
def watch_abbrev(path: str = typer.Argument(".", help="Path to watch")):
|
|
1290
|
+
"""Shortcut for 'cgc watch'"""
|
|
1291
|
+
watch(path)
|
|
1292
|
+
|
|
1293
|
+
|
|
1223
1294
|
# ============================================================================
|
|
1224
1295
|
|
|
1225
1296
|
|