codegraphcontext 0.2.0__tar.gz → 0.2.2__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 (76) hide show
  1. {codegraphcontext-0.2.0/src/codegraphcontext.egg-info → codegraphcontext-0.2.2}/PKG-INFO +4 -3
  2. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/README.md +3 -2
  3. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/pyproject.toml +1 -1
  4. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/config_manager.py +20 -8
  5. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/main.py +20 -6
  6. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/setup_macos.py +2 -4
  7. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/setup_wizard.py +48 -17
  8. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/database.py +6 -2
  9. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/code_finder.py +2 -1
  10. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/graph_builder.py +6 -1
  11. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2/src/codegraphcontext.egg-info}/PKG-INFO +4 -3
  12. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/LICENSE +0 -0
  13. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/MANIFEST.in +0 -0
  14. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/setup.cfg +0 -0
  15. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/__init__.py +0 -0
  16. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/__main__.py +0 -0
  17. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/__init__.py +0 -0
  18. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/cli_helpers.py +0 -0
  19. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/registry_commands.py +0 -0
  20. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/cli/visualizer.py +0 -0
  21. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/__init__.py +0 -0
  22. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/bundle_registry.py +0 -0
  23. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/cgc_bundle.py +0 -0
  24. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/database_falkordb.py +0 -0
  25. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/falkor_worker.py +0 -0
  26. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/jobs.py +0 -0
  27. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/core/watcher.py +0 -0
  28. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/prompts.py +0 -0
  29. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/server.py +0 -0
  30. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tool_definitions.py +0 -0
  31. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/__init__.py +0 -0
  32. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/advanced_language_query_tool.py +0 -0
  33. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/handlers/analysis_handlers.py +0 -0
  34. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/handlers/indexing_handlers.py +0 -0
  35. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/handlers/management_handlers.py +0 -0
  36. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/handlers/query_handlers.py +0 -0
  37. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/handlers/watcher_handlers.py +0 -0
  38. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/c.py +0 -0
  39. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/cpp.py +0 -0
  40. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/csharp.py +0 -0
  41. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/go.py +0 -0
  42. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/haskell.py +0 -0
  43. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/java.py +0 -0
  44. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/javascript.py +0 -0
  45. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/kotlin.py +0 -0
  46. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/php.py +0 -0
  47. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/python.py +0 -0
  48. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/ruby.py +0 -0
  49. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/rust.py +0 -0
  50. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/scala.py +0 -0
  51. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/swift.py +0 -0
  52. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/typescript.py +0 -0
  53. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/languages/typescriptjsx.py +0 -0
  54. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/package_resolver.py +0 -0
  55. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/c_toolkit.py +0 -0
  56. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/cpp_toolkit.py +0 -0
  57. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/csharp_toolkit.py +0 -0
  58. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/go_toolkit.py +0 -0
  59. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/haskell_toolkit.py +0 -0
  60. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/java_toolkit.py +0 -0
  61. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/javascript_toolkit.py +0 -0
  62. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/python_toolkit.py +0 -0
  63. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/ruby_toolkit.py +0 -0
  64. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/rust_toolkit.py +0 -0
  65. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/scala_toolkit.py +0 -0
  66. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/swift_toolkit.py +0 -0
  67. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/query_tool_languages/typescript_toolkit.py +0 -0
  68. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/tools/system.py +0 -0
  69. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/utils/debug_log.py +0 -0
  70. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/utils/tree_sitter_manager.py +0 -0
  71. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext/utils/visualize_graph.py +0 -0
  72. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext.egg-info/SOURCES.txt +0 -0
  73. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext.egg-info/dependency_links.txt +0 -0
  74. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext.egg-info/entry_points.txt +0 -0
  75. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext.egg-info/requires.txt +0 -0
  76. {codegraphcontext-0.2.0 → codegraphcontext-0.2.2}/src/codegraphcontext.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraphcontext
3
- Version: 0.2.0
3
+ Version: 0.2.2
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
@@ -146,7 +146,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
146
146
  ---
147
147
 
148
148
  ## Project Details
149
- - **Version:** 0.2.0
149
+ - **Version:** 0.2.2
150
150
  - **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
151
151
  - **License:** MIT License (See [LICENSE](LICENSE) for details)
152
152
  - **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
@@ -271,7 +271,7 @@ Use CodeGraphContext as a **powerful command-line toolkit** for code analysis:
271
271
 
272
272
  #### 🤖 Mode 2: MCP Server (AI-Powered)
273
273
  Use CodeGraphContext as an **MCP server** for AI assistants:
274
- - Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, etc.)
274
+ - Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, Kiro, etc.)
275
275
  - Let AI agents query your codebase using natural language
276
276
  - Automatic code understanding and relationship analysis
277
277
  - Perfect for AI-assisted development workflows
@@ -371,6 +371,7 @@ cgc help
371
371
  * Cline
372
372
  * RooCode
373
373
  * Amazon Q Developer
374
+ * Kiro
374
375
 
375
376
  Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files:
376
377
  * It creates an `mcp.json` file in your current directory for reference.
@@ -84,7 +84,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
84
84
  ---
85
85
 
86
86
  ## Project Details
87
- - **Version:** 0.2.0
87
+ - **Version:** 0.2.2
88
88
  - **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
89
89
  - **License:** MIT License (See [LICENSE](LICENSE) for details)
90
90
  - **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
@@ -209,7 +209,7 @@ Use CodeGraphContext as a **powerful command-line toolkit** for code analysis:
209
209
 
210
210
  #### 🤖 Mode 2: MCP Server (AI-Powered)
211
211
  Use CodeGraphContext as an **MCP server** for AI assistants:
212
- - Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, etc.)
212
+ - Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, Kiro, etc.)
213
213
  - Let AI agents query your codebase using natural language
214
214
  - Automatic code understanding and relationship analysis
215
215
  - Perfect for AI-assisted development workflows
@@ -309,6 +309,7 @@ cgc help
309
309
  * Cline
310
310
  * RooCode
311
311
  * Amazon Q Developer
312
+ * Kiro
312
313
 
313
314
  Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files:
314
315
  * It creates an `mcp.json` file in your current directory for reference.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codegraphcontext"
3
- version = "0.2.0"
3
+ version = "0.2.2"
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"
@@ -92,9 +92,9 @@ def load_config() -> Dict[str, str]:
92
92
  1. Environment variables
93
93
  2. Local .env file (in current or parent directories)
94
94
  3. Global ~/.codegraphcontext/.env
95
- """
96
- ensure_config_dir()
97
95
 
96
+ Note: Does NOT create config directory - caller must call ensure_config_dir() first if needed.
97
+ """
98
98
  # Start with defaults
99
99
  config = DEFAULT_CONFIG.copy()
100
100
 
@@ -160,12 +160,15 @@ def save_config(config: Dict[str, str], preserve_db_credentials: bool = True):
160
160
  """
161
161
  Save configuration to file.
162
162
  If preserve_db_credentials is True, existing database credentials will be preserved.
163
+ If preserve_db_credentials is False, credentials from config dict will be written.
163
164
  """
164
165
  ensure_config_dir()
165
166
 
166
- # Load existing config to preserve database credentials
167
- existing_config = {}
167
+ # Determine which credentials to write
168
+ credentials_to_write = {}
169
+
168
170
  if preserve_db_credentials and CONFIG_FILE.exists():
171
+ # Load existing credentials from file to preserve them
169
172
  try:
170
173
  with open(CONFIG_FILE, "r") as f:
171
174
  for line in f:
@@ -174,9 +177,14 @@ def save_config(config: Dict[str, str], preserve_db_credentials: bool = True):
174
177
  key, value = line.split("=", 1)
175
178
  key = key.strip()
176
179
  if key in DATABASE_CREDENTIAL_KEYS:
177
- existing_config[key] = value.strip()
180
+ credentials_to_write[key] = value.strip()
178
181
  except Exception:
179
182
  pass
183
+ else:
184
+ # Use credentials from the config dict being passed in
185
+ for key in DATABASE_CREDENTIAL_KEYS:
186
+ if key in config:
187
+ credentials_to_write[key] = config[key]
180
188
 
181
189
  try:
182
190
  with open(CONFIG_FILE, "w") as f:
@@ -184,11 +192,11 @@ def save_config(config: Dict[str, str], preserve_db_credentials: bool = True):
184
192
  f.write(f"# Location: {CONFIG_FILE}\n\n")
185
193
 
186
194
  # Write database credentials first if they exist
187
- if existing_config:
195
+ if credentials_to_write:
188
196
  f.write("# ===== Database Credentials =====\n")
189
197
  for key in sorted(DATABASE_CREDENTIAL_KEYS):
190
- if key in existing_config:
191
- f.write(f"{key}={existing_config[key]}\n")
198
+ if key in credentials_to_write:
199
+ f.write(f"{key}={credentials_to_write[key]}\n")
192
200
  f.write("\n")
193
201
 
194
202
  # Write configuration settings
@@ -296,6 +304,9 @@ def get_config_value(key: str) -> Optional[str]:
296
304
 
297
305
  def set_config_value(key: str, value: str) -> bool:
298
306
  """Set a configuration value. Returns True if successful."""
307
+ # Ensure config directory exists
308
+ ensure_config_dir()
309
+
299
310
  # Validate
300
311
  is_valid, error_msg = validate_config_value(key, value)
301
312
  if not is_valid:
@@ -313,6 +324,7 @@ def set_config_value(key: str, value: str) -> bool:
313
324
 
314
325
  def reset_config():
315
326
  """Reset configuration to defaults (preserves database credentials)."""
327
+ ensure_config_dir()
316
328
  save_config(DEFAULT_CONFIG.copy(), preserve_db_credentials=True)
317
329
  console.print("[green]✅ Configuration reset to defaults[/green]")
318
330
  console.print("[cyan]Note: Database credentials were preserved[/cyan]")
@@ -199,6 +199,9 @@ def neo4j_setup_alias():
199
199
  neo4j_setup()
200
200
 
201
201
 
202
+ # ============================================================================
203
+ # CREDENTIALS LOADING PRECEDENCE
204
+ # ============================================================================
202
205
 
203
206
  def _load_credentials():
204
207
  """
@@ -210,6 +213,10 @@ def _load_credentials():
210
213
  3. Global `~/.codegraphcontext/.env` (lowest - user defaults)
211
214
  """
212
215
  from dotenv import dotenv_values
216
+ from codegraphcontext.cli.config_manager import ensure_config_dir
217
+
218
+ # Ensure config directory exists (lazy initialization)
219
+ ensure_config_dir()
213
220
 
214
221
  # Collect all config sources in reverse priority order (lowest to highest)
215
222
  config_sources = []
@@ -287,8 +294,6 @@ def _load_credentials():
287
294
  else:
288
295
  console.print("[cyan]Using database: FalkorDB[/cyan]")
289
296
 
290
-
291
-
292
297
  # ============================================================================
293
298
  # CONFIG COMMAND GROUP
294
299
  # ============================================================================
@@ -655,7 +660,13 @@ def doctor():
655
660
  console.print("[bold]1. Checking Configuration...[/bold]")
656
661
  try:
657
662
  config = config_manager.load_config()
658
- console.print(f" [green]✓[/green] Configuration loaded from {config_manager.CONFIG_FILE}")
663
+
664
+ # Check if config file actually exists
665
+ if config_manager.CONFIG_FILE.exists():
666
+ console.print(f" [green]✓[/green] Configuration loaded from {config_manager.CONFIG_FILE}")
667
+ else:
668
+ console.print(f" [yellow]ℹ[/yellow] No config file found, using defaults")
669
+ console.print(f" [dim]Config will be created at: {config_manager.CONFIG_FILE}[/dim]")
659
670
 
660
671
  # Validate each config value
661
672
  invalid_configs = []
@@ -1332,7 +1343,7 @@ def find_by_content_search(
1332
1343
  results = code_finder.find_by_content(query)
1333
1344
  except Exception as e:
1334
1345
  error_msg = str(e).lower()
1335
- if 'fulltext' in error_msg or 'db.index.fulltext' in error_msg:
1346
+ if ('fulltext' in error_msg or 'db.index.fulltext' in error_msg) and "Falkor" in db_manager.__class__.__name__:
1336
1347
  console.print("\n[bold red]❌ Full-text search is not supported on FalkorDB[/bold red]\n")
1337
1348
  console.print("[yellow]💡 You have two options:[/yellow]\n")
1338
1349
  console.print(" 1. [cyan]Switch to Neo4j:[/cyan]")
@@ -2047,9 +2058,12 @@ def cypher_legacy(query: str = typer.Argument(..., help="The read-only Cypher qu
2047
2058
  # ============================================================================
2048
2059
 
2049
2060
  @app.command("i", rich_help_panel="Shortcuts")
2050
- def index_abbrev(path: Optional[str] = typer.Argument(None, help="Path to index")):
2061
+ def index_abbrev(
2062
+ path: Optional[str] = typer.Argument(None, help="Path to index"),
2063
+ force: bool = typer.Option(False, "--force", "-f", help="Force re-index (delete existing and rebuild)")
2064
+ ):
2051
2065
  """Shortcut for 'cgc index'"""
2052
- index(path)
2066
+ index(path, force=force)
2053
2067
 
2054
2068
  @app.command("ls", rich_help_panel="Shortcuts")
2055
2069
  def list_abbrev():
@@ -25,7 +25,7 @@ def _set_initial_password(new_pw: str, run_command, console) -> bool:
25
25
  ]
26
26
  return run_command(cmd, console, check=False) is not None
27
27
 
28
- def setup_macos_binary(console, prompt, run_command, _generate_mcp_json):
28
+ def setup_macos_binary(console, prompt, run_command, _save_neo4j_credentials):
29
29
  """Automates Neo4j install & config on macOS via Homebrew."""
30
30
  os_name = platform.system()
31
31
  console.print(f"Detected Operating System: [bold yellow]{os_name}[/bold yellow]")
@@ -89,7 +89,5 @@ def setup_macos_binary(console, prompt, run_command, _generate_mcp_json):
89
89
  return
90
90
 
91
91
  creds = {"uri": "neo4j://localhost:7687", "username": "neo4j", "password": new_password}
92
- _generate_mcp_json(creds)
92
+ _save_neo4j_credentials(creds)
93
93
 
94
- env_path = Path.home() / ".codegraphcontext" / ".env"
95
- console.print(f"\n[bold green]All done![/bold green] Neo4j running. Credentials saved to: [bold]{env_path}[/bold]")
@@ -19,6 +19,39 @@ DEFAULT_NEO4J_USERNAME = "neo4j"
19
19
  DEFAULT_NEO4J_BOLT_PORT = 7687
20
20
  DEFAULT_NEO4J_HTTP_PORT = 7474
21
21
 
22
+ def _save_neo4j_credentials(creds):
23
+ """
24
+ Save Neo4j credentials to .env file (database setup only).
25
+ Does NOT generate MCP config or configure IDE.
26
+ """
27
+ from codegraphcontext.cli.config_manager import load_config, save_config, ensure_config_dir
28
+
29
+ ensure_config_dir()
30
+
31
+ # Load existing config (or defaults if no file exists)
32
+ config = load_config()
33
+
34
+ # Update Neo4j credentials
35
+ config["NEO4J_URI"] = creds.get('uri', '')
36
+ config["NEO4J_USERNAME"] = creds.get('username', 'neo4j')
37
+ config["NEO4J_PASSWORD"] = creds.get('password', '')
38
+
39
+ # Set default database to neo4j
40
+ config["DEFAULT_DATABASE"] = "neo4j"
41
+
42
+ # Save config (preserves all other settings)
43
+ save_config(config, preserve_db_credentials=False)
44
+
45
+ console.print("\n[bold green]✅ Neo4j setup complete![/bold green]")
46
+ console.print(f"[cyan]📝 Credentials saved to ~/.codegraphcontext/.env[/cyan]")
47
+ console.print(f"[cyan]🔧 Default database set to 'neo4j'[/cyan]")
48
+ console.print("\n[dim]You can now use cgc commands with Neo4j:[/dim]")
49
+ console.print("[dim] • cgc index . - Index your code[/dim]")
50
+ console.print("[dim] • cgc find function - Search your codebase[/dim]")
51
+ console.print("\n[dim]To use cgc as an MCP server in your IDE, run:[/dim]")
52
+ console.print("[dim] cgc mcp setup[/dim]")
53
+
54
+
22
55
  def _generate_mcp_json(creds):
23
56
  """Generates and prints the MCP JSON configuration."""
24
57
  cgc_path = shutil.which("cgc") or sys.executable
@@ -69,15 +102,8 @@ def _generate_mcp_json(creds):
69
102
  json.dump(mcp_config, f, indent=2)
70
103
  console.print(f"\n[cyan]For your convenience, the configuration has also been saved to: {mcp_file}[/cyan]")
71
104
 
72
- # Also save to a .env file for convenience
73
- env_file = Path.home() / ".codegraphcontext" / ".env"
74
- env_file.parent.mkdir(parents=True, exist_ok=True)
75
- with open(env_file, "w") as f:
76
- f.write(f"NEO4J_URI={creds.get('uri', '')}\n")
77
- f.write(f"NEO4J_USERNAME={creds.get('username', 'neo4j')}\n")
78
- f.write(f"NEO4J_PASSWORD={creds.get('password', '')}\n")
79
-
80
- console.print(f"[cyan]Neo4j credentials also saved to: {env_file}[/cyan]")
105
+ # Also save credentials to .env using the proper function
106
+ _save_neo4j_credentials(creds)
81
107
  _configure_ide(mcp_config)
82
108
 
83
109
 
@@ -114,7 +140,7 @@ def _configure_ide(mcp_config):
114
140
  questions = [
115
141
  {
116
142
  "type": "confirm",
117
- "message": "Automatically configure your IDE/CLI (VS Code, Cursor, Windsurf, Claude, Gemini, Cline, RooCode, ChatGPT Codex, Amazon Q Developer, Aider)?",
143
+ "message": "Automatically configure your IDE/CLI (VS Code, Cursor, Windsurf, Claude, Gemini, Cline, RooCode, ChatGPT Codex, Amazon Q Developer, Aider, Kiro)?",
118
144
  "name": "configure_ide",
119
145
  "default": True,
120
146
  }
@@ -128,7 +154,7 @@ def _configure_ide(mcp_config):
128
154
  {
129
155
  "type": "list",
130
156
  "message": "Choose your IDE/CLI to configure:",
131
- "choices": ["VS Code", "Cursor", "Windsurf", "Claude code", "Gemini CLI", "ChatGPT Codex", "Cline", "RooCode", "Amazon Q Developer", "JetBrainsAI", "Aider", "None of the above"],
157
+ "choices": ["VS Code", "Cursor", "Windsurf", "Claude code", "Gemini CLI", "ChatGPT Codex", "Cline", "RooCode", "Amazon Q Developer", "JetBrainsAI", "Aider", "Kiro", "None of the above"],
132
158
  "name": "ide_choice",
133
159
  }
134
160
  ]
@@ -140,7 +166,7 @@ def _configure_ide(mcp_config):
140
166
  return
141
167
 
142
168
 
143
- if ide_choice in ["VS Code", "Cursor/CLI", "Claude code", "Gemini CLI", "ChatGPT Codex", "Cline", "Windsurf", "RooCode", "Amazon Q Developer , JetBrainsAI", "Aider"]:
169
+ if ide_choice in ["VS Code", "Cursor/CLI", "Claude code", "Gemini CLI", "ChatGPT Codex", "Cline", "Windsurf", "RooCode", "Amazon Q Developer , JetBrainsAI", "Aider", "Kiro"]:
144
170
  console.print(f"\n[bold cyan]Configuring for {ide_choice}...[/bold cyan]")
145
171
 
146
172
  if ide_choice == "Amazon Q Developer":
@@ -198,6 +224,11 @@ def _configure_ide(mcp_config):
198
224
  Path.home() / "Library" / "Application Support" / "aider" / "settings.json",
199
225
  Path.home() / "AppData" / "Roaming" / "aider" / "settings.json",
200
226
  Path.home() / ".config" / "Aider" / "User" / "settings.json",
227
+ ],
228
+ "Kiro": [
229
+ Path.home() / ".kiro" / "settings" / "mcp.json", # macOS / Linux / Windows (user-level global)
230
+ Path.home() / ".config" / "kiro" / "settings" / "mcp.json", # Linux (XDG config)
231
+ Path.home() / "AppData" / "Roaming" / "Kiro" / "settings" / "mcp.json", # Windows
201
232
  ]
202
233
  }
203
234
 
@@ -540,7 +571,7 @@ def setup_existing_db():
540
571
 
541
572
 
542
573
  if creds.get("uri") and creds.get("password"):
543
- _generate_mcp_json(creds)
574
+ _save_neo4j_credentials(creds)
544
575
  else:
545
576
  console.print("[red]❌ Incomplete credentials. Please try again.[/red]")
546
577
 
@@ -658,7 +689,7 @@ def setup_hosted_db():
658
689
 
659
690
 
660
691
  if creds.get("uri") and creds.get("password"):
661
- _generate_mcp_json(creds)
692
+ _save_neo4j_credentials(creds)
662
693
  else:
663
694
  console.print("[red]❌ Incomplete credentials. Please try again.[/red]")
664
695
 
@@ -681,7 +712,7 @@ def setup_local_db():
681
712
  if platform.system() == "Darwin":
682
713
  # lazy import to avoid circular import
683
714
  from .setup_macos import setup_macos_binary
684
- setup_macos_binary(console, prompt, run_command, _generate_mcp_json)
715
+ setup_macos_binary(console, prompt, run_command, _save_neo4j_credentials)
685
716
  else:
686
717
  setup_local_binary()
687
718
 
@@ -829,7 +860,7 @@ volumes:
829
860
  "password": password
830
861
  }
831
862
 
832
- _generate_mcp_json(creds)
863
+ _save_neo4j_credentials(creds)
833
864
 
834
865
  console.print("\n[bold green]🎉 Setup complete![/bold green]")
835
866
  console.print("Neo4j is running at:")
@@ -924,5 +955,5 @@ def setup_local_binary():
924
955
  "username": "neo4j",
925
956
  "password": new_password
926
957
  }
927
- _generate_mcp_json(creds)
958
+ _save_neo4j_credentials(creds)
928
959
  console.print("\n[bold green]All done! Your local Neo4j instance is ready to use.[/bold green]")
@@ -178,8 +178,12 @@ class DatabaseManager:
178
178
  try:
179
179
  # Extract host and port from URI
180
180
  host_port = uri.split('://')[1]
181
- host = host_port.split(':')[0]
182
- port = int(host_port.split(':')[1])
181
+ if ':' in host_port:
182
+ host = host_port.split(':')[0]
183
+ port = int(host_port.split(':')[1])
184
+ else:
185
+ host = host_port
186
+ port = 7687 # Default Neo4j port
183
187
 
184
188
  # Test socket connection
185
189
  sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
@@ -84,13 +84,14 @@ class CodeFinder:
84
84
  CALL db.index.fulltext.queryNodes("code_search_index", $search_term) YIELD node, score
85
85
  WITH node, score
86
86
  WHERE node:Function OR node:Class OR node:Variable
87
+ MATCH (node)<-[:CONTAINS]-(f:File)
87
88
  RETURN
88
89
  CASE
89
90
  WHEN node:Function THEN 'function'
90
91
  WHEN node:Class THEN 'class'
91
92
  ELSE 'variable'
92
93
  END as type,
93
- node.name as name, node.path as path,
94
+ node.name as name, f.path as path,
94
95
  node.line_number as line_number, node.source as source,
95
96
  node.docstring as docstring, node.is_dependency as is_dependency
96
97
  ORDER BY score DESC
@@ -277,7 +277,12 @@ class GraphBuilder:
277
277
  """, path=file_path_str, name=file_name, relative_path=relative_path, is_dependency=is_dependency)
278
278
 
279
279
  file_path_obj = Path(file_path_str)
280
- repo_path_obj = Path(repo_result['path'])
280
+ if repo_result:
281
+ repo_path_obj = Path(repo_result['path'])
282
+ else:
283
+ # Fallback to the path we queried for
284
+ warning_logger(f"Repository node not found for {file_data['repo_path']} during indexing of {file_name}. Using original path.")
285
+ repo_path_obj = Path(file_data['repo_path']).resolve()
281
286
 
282
287
  relative_path_to_file = file_path_obj.relative_to(repo_path_obj)
283
288
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraphcontext
3
- Version: 0.2.0
3
+ Version: 0.2.2
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
@@ -146,7 +146,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
146
146
  ---
147
147
 
148
148
  ## Project Details
149
- - **Version:** 0.2.0
149
+ - **Version:** 0.2.2
150
150
  - **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
151
151
  - **License:** MIT License (See [LICENSE](LICENSE) for details)
152
152
  - **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
@@ -271,7 +271,7 @@ Use CodeGraphContext as a **powerful command-line toolkit** for code analysis:
271
271
 
272
272
  #### 🤖 Mode 2: MCP Server (AI-Powered)
273
273
  Use CodeGraphContext as an **MCP server** for AI assistants:
274
- - Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, etc.)
274
+ - Connect to AI IDEs (VS Code, Cursor, Windsurf, Claude, Kiro, etc.)
275
275
  - Let AI agents query your codebase using natural language
276
276
  - Automatic code understanding and relationship analysis
277
277
  - Perfect for AI-assisted development workflows
@@ -371,6 +371,7 @@ cgc help
371
371
  * Cline
372
372
  * RooCode
373
373
  * Amazon Q Developer
374
+ * Kiro
374
375
 
375
376
  Upon successful configuration, `cgc mcp setup` will generate and place the necessary configuration files:
376
377
  * It creates an `mcp.json` file in your current directory for reference.