codegraphcontext 0.1.22__tar.gz → 0.1.26__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.
Files changed (65) hide show
  1. {codegraphcontext-0.1.22/src/codegraphcontext.egg-info → codegraphcontext-0.1.26}/PKG-INFO +112 -27
  2. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/README.md +111 -26
  3. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/pyproject.toml +1 -1
  4. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/cli/cli_helpers.py +91 -0
  5. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/cli/main.py +71 -0
  6. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/cli/setup_wizard.py +2 -2
  7. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/core/database_falkordb.py +16 -0
  8. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/core/falkor_worker.py +8 -0
  9. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/code_finder.py +15 -13
  10. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/graph_builder.py +85 -13
  11. codegraphcontext-0.1.26/src/codegraphcontext/tools/languages/kotlin.py +631 -0
  12. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/utils/tree_sitter_manager.py +2 -0
  13. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26/src/codegraphcontext.egg-info}/PKG-INFO +112 -27
  14. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext.egg-info/SOURCES.txt +1 -0
  15. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/LICENSE +0 -0
  16. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/MANIFEST.in +0 -0
  17. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/setup.cfg +0 -0
  18. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/__init__.py +0 -0
  19. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/__main__.py +0 -0
  20. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/cli/__init__.py +0 -0
  21. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/cli/config_manager.py +0 -0
  22. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/cli/setup_macos.py +0 -0
  23. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/core/__init__.py +0 -0
  24. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/core/database.py +0 -0
  25. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/core/jobs.py +0 -0
  26. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/core/watcher.py +0 -0
  27. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/prompts.py +0 -0
  28. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/server.py +0 -0
  29. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/__init__.py +0 -0
  30. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/advanced_language_query_tool.py +0 -0
  31. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/c.py +0 -0
  32. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/cpp.py +0 -0
  33. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/csharp.py +0 -0
  34. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/go.py +0 -0
  35. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/java.py +0 -0
  36. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/javascript.py +0 -0
  37. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/php.py +0 -0
  38. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/python.py +0 -0
  39. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/ruby.py +0 -0
  40. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/rust.py +0 -0
  41. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/languages/typescript.py +0 -0
  42. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/package_resolver.py +0 -0
  43. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/c_toolkit.py +0 -0
  44. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +0 -0
  45. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +0 -0
  46. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/go_toolkit.py +0 -0
  47. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/java_toolkit.py +0 -0
  48. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +0 -0
  49. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/python_toolkit.py +0 -0
  50. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +0 -0
  51. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/rust_toolkit.py +0 -0
  52. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +0 -0
  53. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/tools/system.py +0 -0
  54. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext/utils/debug_log.py +0 -0
  55. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext.egg-info/dependency_links.txt +0 -0
  56. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext.egg-info/entry_points.txt +0 -0
  57. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext.egg-info/requires.txt +0 -0
  58. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/src/codegraphcontext.egg-info/top_level.txt +0 -0
  59. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/tests/test_cpp_parser.py +0 -0
  60. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/tests/test_database_validation.py +0 -0
  61. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/tests/test_end_to_end.py +0 -0
  62. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/tests/test_graph_indexing.py +0 -0
  63. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/tests/test_graph_indexing_js.py +0 -0
  64. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/tests/test_tree_sitter_manager.py +0 -0
  65. {codegraphcontext-0.1.22 → codegraphcontext-0.1.26}/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.22
3
+ Version: 0.1.26
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 tool** that indexes local code into a graph database to provide context to AI assistants and developers. Use it as a standalone CLI for code analysis or connect it to your favorite AI IDE via MCP.
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
  ![Indexing using an MCP client](https://github.com/Shashankss1205/CodeGraphContext/blob/main/images/Indexing.gif)
@@ -91,7 +91,7 @@ A powerful **MCP server** and **CLI tool** that indexes local code into a graph
91
91
  ![Using the MCP server](https://github.com/Shashankss1205/CodeGraphContext/blob/main/images/Usecase.gif)
92
92
 
93
93
  ## Project Details
94
- - **Version:** 0.1.22
94
+ - **Version:** 0.1.26
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 Updates:** Watches local files for changes and automatically updates the graph.
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 tool** for developers and as an **MCP server** for AI agents.
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:** Choose between Neo4j or FalkorDB Lite.
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,21 +133,33 @@ Each language parser extracts functions, classes, methods, parameters, inheritan
131
133
 
132
134
  CodeGraphContext supports two graph database backends:
133
135
 
134
- ### Neo4j (Default)
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 development
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
+
144
+ > ⚠️ **Windows Users:**
145
+ > FalkorDB Lite / redislite is **not supported on Windows**.
146
+ > You have three options:
147
+ > 1. Run the project under **WSL (Windows Subsystem for Linux)**: [WSL Install](https://learn.microsoft.com/en-us/windows/wsl/install)
148
+ > 2. Use **Docker** to run the project in a containerized Linux environment
149
+ > 3. Use **Neo4j** directly as your graph database (see below)
146
150
 
147
- The `cgc neo4j setup` wizard helps you configure neo4j database backend while the falkordb database is
148
- supported inherently (enabled by default).
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
161
+
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.
149
163
 
150
164
  ## Used By
151
165
 
@@ -178,9 +192,31 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
178
192
 
179
193
  ## Getting Started
180
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
+
181
219
  1. **Install:** `pip install codegraphcontext`
182
- 2. **Setup:** `cgc mcp setup`
183
- This command configures your IDE to work with CodeGraphContext. To configure a Neo4j database, use `cgc neo4j setup`.
184
220
 
185
221
  <details>
186
222
  <summary>⚙️ Troubleshooting: In case, command <code>cgc</code> not found</summary>
@@ -215,14 +251,56 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
215
251
  ```
216
252
  </details>
217
253
 
254
+ 2. **Database Setup (Automatic for Unix/WSL)**
218
255
 
219
- **Database Configuration:**
220
- * **Local Setup (Docker Recommended):** Helps you set up a local Neo4j instance using Docker. Requires Docker and Docker Compose to be installed.
221
- * **Local Setup (Linux Binary):** For Debian-based Linux systems (like Ubuntu), `cgc neo4j setup` can automate the installation of Neo4j. Requires `sudo` privileges.
222
- * **Hosted Setup:** Allows you to connect to an existing remote Neo4j database (e.g., Neo4j AuraDB).
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
223
271
 
224
- **IDE/CLI Configuration:**
225
- After setting up your database, the wizard will ask to configure your development environment. It can automatically detect and configure the following:
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:
226
304
  * VS Code
227
305
  * Cursor
228
306
  * Windsurf
@@ -235,10 +313,16 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
235
313
 
236
314
  Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files:
237
315
  * It creates an `mcp.json` file in your current directory for reference.
238
- * It stores your Neo4j credentials securely in `~/.codegraphcontext/.env`.
316
+ * It stores your database credentials securely in `~/.codegraphcontext/.env`.
239
317
  * It updates the settings file of your chosen IDE/CLI (e.g., `.claude.json` or VS Code's `settings.json`).
240
318
 
241
- 3. **Start:** `cgc mcp start`
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.
242
326
 
243
327
  ## Ignoring Files (`.cgcignore`)
244
328
 
@@ -270,6 +354,7 @@ Add the following server configuration to your client's settings file (e.g., VS
270
354
  "CodeGraphContext": {
271
355
  "command": "cgc",
272
356
  "args": [
357
+ "mcp",
273
358
  "start"
274
359
  ],
275
360
  "env": {
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
 
23
- A powerful **MCP server** and **CLI tool** that indexes local code into a graph database to provide context to AI assistants and developers. Use it as a standalone CLI for code analysis or connect it to your favorite AI IDE via MCP.
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
  ![Indexing using an MCP client](https://github.com/Shashankss1205/CodeGraphContext/blob/main/images/Indexing.gif)
@@ -29,7 +29,7 @@ A powerful **MCP server** and **CLI tool** that indexes local code into a graph
29
29
  ![Using the MCP server](https://github.com/Shashankss1205/CodeGraphContext/blob/main/images/Usecase.gif)
30
30
 
31
31
  ## Project Details
32
- - **Version:** 0.1.22
32
+ - **Version:** 0.1.26
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 Updates:** Watches local files for changes and automatically updates the graph.
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 tool** for developers and as an **MCP server** for AI agents.
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:** Choose between Neo4j or FalkorDB Lite.
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,21 +71,33 @@ Each language parser extracts functions, classes, methods, parameters, inheritan
69
71
 
70
72
  CodeGraphContext supports two graph database backends:
71
73
 
72
- ### Neo4j (Default)
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 development
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
+
82
+ > ⚠️ **Windows Users:**
83
+ > FalkorDB Lite / redislite is **not supported on Windows**.
84
+ > You have three options:
85
+ > 1. Run the project under **WSL (Windows Subsystem for Linux)**: [WSL Install](https://learn.microsoft.com/en-us/windows/wsl/install)
86
+ > 2. Use **Docker** to run the project in a containerized Linux environment
87
+ > 3. Use **Neo4j** directly as your graph database (see below)
84
88
 
85
- The `cgc neo4j setup` wizard helps you configure neo4j database backend while the falkordb database is
86
- supported inherently (enabled by default).
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
99
+
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.
87
101
 
88
102
  ## Used By
89
103
 
@@ -116,9 +130,31 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
116
130
 
117
131
  ## Getting Started
118
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
+
119
157
  1. **Install:** `pip install codegraphcontext`
120
- 2. **Setup:** `cgc mcp setup`
121
- This command configures your IDE to work with CodeGraphContext. To configure a Neo4j database, use `cgc neo4j setup`.
122
158
 
123
159
  <details>
124
160
  <summary>⚙️ Troubleshooting: In case, command <code>cgc</code> not found</summary>
@@ -153,14 +189,56 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
153
189
  ```
154
190
  </details>
155
191
 
192
+ 2. **Database Setup (Automatic for Unix/WSL)**
156
193
 
157
- **Database Configuration:**
158
- * **Local Setup (Docker Recommended):** Helps you set up a local Neo4j instance using Docker. Requires Docker and Docker Compose to be installed.
159
- * **Local Setup (Linux Binary):** For Debian-based Linux systems (like Ubuntu), `cgc neo4j setup` can automate the installation of Neo4j. Requires `sudo` privileges.
160
- * **Hosted Setup:** Allows you to connect to an existing remote Neo4j database (e.g., Neo4j AuraDB).
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
161
209
 
162
- **IDE/CLI Configuration:**
163
- After setting up your database, the wizard will ask to configure your development environment. It can automatically detect and configure the following:
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:
164
242
  * VS Code
165
243
  * Cursor
166
244
  * Windsurf
@@ -173,10 +251,16 @@ If you’re using CodeGraphContext in your project, feel free to open a PR and a
173
251
 
174
252
  Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files:
175
253
  * It creates an `mcp.json` file in your current directory for reference.
176
- * It stores your Neo4j credentials securely in `~/.codegraphcontext/.env`.
254
+ * It stores your database credentials securely in `~/.codegraphcontext/.env`.
177
255
  * It updates the settings file of your chosen IDE/CLI (e.g., `.claude.json` or VS Code's `settings.json`).
178
256
 
179
- 3. **Start:** `cgc mcp start`
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.
180
264
 
181
265
  ## Ignoring Files (`.cgcignore`)
182
266
 
@@ -208,6 +292,7 @@ Add the following server configuration to your client's settings file (e.g., VS
208
292
  "CodeGraphContext": {
209
293
  "command": "cgc",
210
294
  "args": [
295
+ "mcp",
211
296
  "start"
212
297
  ],
213
298
  "env": {
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codegraphcontext"
3
- version = "0.1.22"
3
+ version = "0.1.26"
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"
@@ -512,3 +512,94 @@ def stats_helper(path: str = None):
512
512
  console.print(f"[bold red]An error occurred:[/bold red] {e}")
513
513
  finally:
514
514
  db_manager.close_driver()
515
+
516
+
517
+ def watch_helper(path: str):
518
+ """Watch a directory for changes and auto-update the graph (blocking mode)."""
519
+ from ..core.watcher import CodeWatcher
520
+
521
+ services = _initialize_services()
522
+ if not all(services):
523
+ return
524
+
525
+ db_manager, graph_builder, code_finder = services
526
+ path_obj = Path(path).resolve()
527
+
528
+ if not path_obj.exists():
529
+ console.print(f"[red]Error: Path does not exist: {path_obj}[/red]")
530
+ db_manager.close_driver()
531
+ return
532
+
533
+ if not path_obj.is_dir():
534
+ console.print(f"[red]Error: Path must be a directory: {path_obj}[/red]")
535
+ db_manager.close_driver()
536
+ return
537
+
538
+ console.print(f"[bold cyan]🔍 Watching {path_obj} for changes...[/bold cyan]")
539
+
540
+ # Check if already indexed
541
+ indexed_repos = code_finder.list_indexed_repositories()
542
+ is_indexed = any(Path(repo["path"]).resolve() == path_obj for repo in indexed_repos)
543
+
544
+ # Create watcher instance
545
+ job_manager = JobManager()
546
+ watcher = CodeWatcher(graph_builder, job_manager)
547
+
548
+ try:
549
+ # Start the observer thread
550
+ watcher.start()
551
+
552
+ # Add the directory to watch
553
+ if is_indexed:
554
+ console.print("[green]✓[/green] Already indexed (no initial scan needed)")
555
+ watcher.watch_directory(str(path_obj), perform_initial_scan=False)
556
+ else:
557
+ console.print("[yellow]⚠[/yellow] Not indexed yet. Performing initial scan...")
558
+
559
+ # Index the repository first (like MCP does)
560
+ async def do_index():
561
+ await graph_builder.build_graph_from_path_async(path_obj, is_dependency=False)
562
+
563
+ asyncio.run(do_index())
564
+ console.print("[green]✓[/green] Initial scan complete")
565
+
566
+ # Now start watching (without another scan)
567
+ watcher.watch_directory(str(path_obj), perform_initial_scan=False)
568
+
569
+ console.print("[bold green]👀 Monitoring for file changes...[/bold green] (Press Ctrl+C to stop)")
570
+ console.print("[dim]💡 Tip: Open a new terminal window to continue working[/dim]\n")
571
+
572
+ # Block here and keep the watcher running
573
+ import threading
574
+ stop_event = threading.Event()
575
+
576
+ try:
577
+ stop_event.wait() # Wait indefinitely until interrupted
578
+ except KeyboardInterrupt:
579
+ console.print("\n[yellow]🛑 Stopping watcher...[/yellow]")
580
+
581
+ except KeyboardInterrupt:
582
+ console.print("\n[yellow]🛑 Stopping watcher...[/yellow]")
583
+ except Exception as e:
584
+ console.print(f"[bold red]An error occurred:[/bold red] {e}")
585
+ finally:
586
+ watcher.stop()
587
+ db_manager.close_driver()
588
+ console.print("[green]✓[/green] Watcher stopped. Graph is up to date.")
589
+
590
+
591
+
592
+ def unwatch_helper(path: str):
593
+ """Stop watching a directory."""
594
+ console.print(f"[yellow]⚠️ Note: 'cgc unwatch' only works when the watcher is running via MCP server.[/yellow]")
595
+ console.print(f"[dim]For CLI watch mode, simply press Ctrl+C in the watch terminal.[/dim]")
596
+ console.print(f"\n[cyan]Path specified:[/cyan] {Path(path).resolve()}")
597
+
598
+
599
+ def list_watching_helper():
600
+ """List all directories currently being watched."""
601
+ console.print(f"[yellow]⚠️ Note: 'cgc watching' only works when the watcher is running via MCP server.[/yellow]")
602
+ console.print(f"[dim]For CLI watch mode, check the terminal where you ran 'cgc watch'.[/dim]")
603
+ console.print(f"\n[cyan]To see watched directories in MCP mode:[/cyan]")
604
+ console.print(f" 1. Start the MCP server: cgc mcp start")
605
+ console.print(f" 2. Use the 'list_watched_paths' MCP tool from your IDE")
@@ -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
 
@@ -26,10 +26,10 @@ def _generate_mcp_json(creds):
26
26
  if "python" in Path(cgc_path).name:
27
27
  # fallback to running as module if no cgc binary is found
28
28
  command = cgc_path
29
- args = ["-m", "cgc", "start"]
29
+ args = ["-m", "cgc", "mcp", "start"]
30
30
  else:
31
31
  command = cgc_path
32
- args = ["start"]
32
+ args = ["mcp","start"]
33
33
 
34
34
  mcp_config = {
35
35
  "mcpServers": {
@@ -65,6 +65,14 @@ class FalkorDBManager:
65
65
  Returns:
66
66
  A FalkorDB graph instance that mimics Neo4j driver interface.
67
67
  """
68
+ import platform
69
+
70
+ if platform.system() == "Windows":
71
+ raise RuntimeError(
72
+ "CodeGraphContext uses redislite/FalkorDB, which does not support Windows.\n"
73
+ "Please run the project using WSL or Docker."
74
+ )
75
+
68
76
  if self._driver is None:
69
77
  if sys.version_info < (3, 12):
70
78
  raise ValueError("FalkorDB Lite is not supported on Python < 3.12.")
@@ -113,6 +121,14 @@ class FalkorDBManager:
113
121
 
114
122
  def _ensure_server_running(self):
115
123
  """Starts the FalkorDB worker subprocess if not reachable."""
124
+ import platform
125
+
126
+ if platform.system() == "Windows":
127
+ raise RuntimeError(
128
+ "CodeGraphContext uses redislite/FalkorDB, which does not support Windows.\n"
129
+ "Please run the project using WSL or Docker."
130
+ )
131
+
116
132
  # 1. Try to connect first (maybe running from previous session or other process)
117
133
  if os.path.exists(self.socket_path):
118
134
  try: