codegraphcontext 0.2.12__py3-none-any.whl → 0.3.0__py3-none-any.whl

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.
@@ -6,6 +6,15 @@ from pathlib import Path
6
6
  import time
7
7
  from rich.console import Console
8
8
  from rich.table import Table
9
+ from rich.progress import (
10
+ Progress,
11
+ SpinnerColumn,
12
+ TextColumn,
13
+ BarColumn,
14
+ TaskProgressColumn,
15
+ TimeRemainingColumn,
16
+ MofNCompleteColumn,
17
+ )
9
18
 
10
19
  from ..core import get_database_manager
11
20
  from ..core.jobs import JobManager
@@ -67,6 +76,64 @@ def _initialize_services():
67
76
  return db_manager, graph_builder, code_finder
68
77
 
69
78
 
79
+ async def _run_index_with_progress(graph_builder: GraphBuilder, path_obj: Path, is_dependency: bool = False):
80
+ """Internal helper to run indexing with a Live progress bar."""
81
+ job_id = graph_builder.job_manager.create_job(str(path_obj), is_dependency=is_dependency)
82
+
83
+ # Create the progress bar
84
+ with Progress(
85
+ SpinnerColumn(),
86
+ TextColumn("[progress.description]{task.description}"),
87
+ BarColumn(),
88
+ TaskProgressColumn(),
89
+ MofNCompleteColumn(),
90
+ TimeRemainingColumn(),
91
+ TextColumn("[dim]{task.fields[filename]}"),
92
+ console=console,
93
+ transient=True,
94
+ ) as progress:
95
+
96
+ task_id = progress.add_task(
97
+ "Indexing...",
98
+ total=None, # Will be updated once file discovery is done
99
+ filename=""
100
+ )
101
+
102
+ indexing_task = asyncio.create_task(
103
+ graph_builder.build_graph_from_path_async(path_obj, is_dependency=is_dependency, job_id=job_id)
104
+ )
105
+
106
+ from ..core.jobs import JobStatus
107
+
108
+ # Poll for updates
109
+ while not indexing_task.done():
110
+ job = graph_builder.job_manager.get_job(job_id)
111
+ if job:
112
+ if job.total_files > 0:
113
+ progress.update(task_id, total=job.total_files, completed=job.processed_files)
114
+
115
+ # Update the current filename in the UI
116
+ current_file = job.current_file or ""
117
+ if len(current_file) > 40:
118
+ current_file = "..." + current_file[-37:]
119
+ progress.update(task_id, filename=current_file)
120
+
121
+ if job.status in [JobStatus.COMPLETED, JobStatus.FAILED, JobStatus.CANCELLED]:
122
+ break
123
+
124
+ await asyncio.sleep(0.1)
125
+
126
+ # Wait for actual completion and handle final state
127
+ try:
128
+ await indexing_task
129
+ job = graph_builder.job_manager.get_job(job_id)
130
+ if job and job.status == JobStatus.FAILED:
131
+ error_msg = job.errors[0] if job.errors else "Unknown error"
132
+ raise RuntimeError(error_msg)
133
+ except Exception as e:
134
+ raise e
135
+
136
+
70
137
  def index_helper(path: str):
71
138
  """Synchronously indexes a repository."""
72
139
  time_start = time.time()
@@ -107,13 +174,9 @@ def index_helper(path: str):
107
174
  console.print(f"[yellow]Warning: Could not check file count: {e}. Proceeding with indexing...[/yellow]")
108
175
 
109
176
  console.print(f"Starting indexing for: {path_obj}")
110
- console.print("[yellow]This may take a few minutes for large repositories...[/yellow]")
111
-
112
- async def do_index():
113
- await graph_builder.build_graph_from_path_async(path_obj, is_dependency=False)
114
177
 
115
178
  try:
116
- asyncio.run(do_index())
179
+ asyncio.run(_run_index_with_progress(graph_builder, path_obj, is_dependency=False))
117
180
  time_end = time.time()
118
181
  elapsed = time_end - time_start
119
182
  console.print(f"[green]Successfully finished indexing: {path} in {elapsed:.2f} seconds[/green]")
@@ -159,13 +222,9 @@ def add_package_helper(package_name: str, language: str):
159
222
  return
160
223
 
161
224
  console.print(f"Starting indexing for package '{package_name}' at: {package_path}")
162
- console.print("[yellow]This may take a few minutes...[/yellow]")
163
-
164
- async def do_index():
165
- await graph_builder.build_graph_from_path_async(package_path, is_dependency=True)
166
225
 
167
226
  try:
168
- asyncio.run(do_index())
227
+ asyncio.run(_run_index_with_progress(graph_builder, package_path, is_dependency=True))
169
228
  console.print(f"[green]Successfully finished indexing package: {package_name}[/green]")
170
229
  except Exception as e:
171
230
  console.print(f"[bold red]An error occurred during package indexing:[/bold red] {e}")
@@ -587,13 +646,9 @@ def reindex_helper(path: str):
587
646
  return
588
647
 
589
648
  console.print(f"[cyan]Re-indexing: {path_obj}[/cyan]")
590
- console.print("[yellow]This may take a few minutes for large repositories...[/yellow]")
591
-
592
- async def do_index():
593
- await graph_builder.build_graph_from_path_async(path_obj, is_dependency=False)
594
-
649
+
595
650
  try:
596
- asyncio.run(do_index())
651
+ asyncio.run(_run_index_with_progress(graph_builder, path_obj, is_dependency=False))
597
652
  time_end = time.time()
598
653
  elapsed = time_end - time_start
599
654
  console.print(f"[green]Successfully re-indexed: {path} in {elapsed:.2f} seconds[/green]")
@@ -125,7 +125,14 @@ def get_database_manager() -> Union['DatabaseManager', 'FalkorDBManager', 'Falko
125
125
  else:
126
126
  raise ValueError(f"Unknown database type: '{db_type}'. Use 'kuzudb', 'falkordb', 'falkordb-remote', or 'neo4j'.")
127
127
 
128
- # 4. Implicit Default -> FalkorDB Lite (Unix Zero Config)
128
+ # 4. Auto-detect: Remote FalkorDB (if FALKORDB_HOST is set)
129
+ # This takes priority over zero-config local backends because it's an explicit signal
130
+ if _is_falkordb_remote_configured():
131
+ from .database_falkordb_remote import FalkorDBRemoteManager
132
+ info_logger("Using remote FalkorDB (auto-detected via FALKORDB_HOST)")
133
+ return FalkorDBRemoteManager()
134
+
135
+ # 5. Implicit Default -> FalkorDB Lite (Unix Zero Config)
129
136
  if _is_falkordb_available():
130
137
  from .database_falkordb import FalkorDBManager, FalkorDBUnavailableError
131
138
  try:
@@ -139,18 +146,12 @@ def get_database_manager() -> Union['DatabaseManager', 'FalkorDBManager', 'Falko
139
146
  )
140
147
  # fall through to KùzuDB below
141
148
 
142
- # 5. Implicit Default -> KùzuDB (Best Zero Config)
149
+ # 6. Implicit Default -> KùzuDB (Best Zero Config)
143
150
  if _is_kuzudb_available():
144
151
  from .database_kuzu import KuzuDBManager
145
152
  info_logger("Using KùzuDB (default)")
146
153
  return KuzuDBManager()
147
154
 
148
- # 6. Auto-detect: Remote FalkorDB (if FALKORDB_HOST is set)
149
- if _is_falkordb_remote_configured():
150
- from .database_falkordb_remote import FalkorDBRemoteManager
151
- info_logger("Using remote FalkorDB (auto-detected via FALKORDB_HOST)")
152
- return FalkorDBRemoteManager()
153
-
154
155
  # 7. Fallback if configured
155
156
  if _is_neo4j_configured():
156
157
  from .database import DatabaseManager
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraphcontext
3
- Version: 0.2.12
3
+ Version: 0.3.0
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
@@ -147,7 +147,7 @@ A powerful **MCP server** and **CLI toolkit** that indexes local code into a gra
147
147
  ---
148
148
 
149
149
  ## Project Details
150
- - **Version:** 0.2.12
150
+ - **Version:** 0.3.0
151
151
  - **Authors:** Shashank Shekhar Singh <shashankshekharsingh1205@gmail.com>
152
152
  - **License:** MIT License (See [LICENSE](LICENSE) for details)
153
153
  - **Website:** [CodeGraphContext](http://codegraphcontext.vercel.app/)
@@ -4,14 +4,14 @@ codegraphcontext/prompts.py,sha256=E5P55paM0oHfBcNVfxkxpXRGZnya1kr_mKDg9i49FwM,6
4
4
  codegraphcontext/server.py,sha256=gcb6V4x0Oh8haBOCm2WBjTCO9FDukrSalAMMApL-oc8,12806
5
5
  codegraphcontext/tool_definitions.py,sha256=_0ahezQSURX_ewWydT2sFcvC6OFGdMoPA7KwgWNVcks,11482
6
6
  codegraphcontext/cli/__init__.py,sha256=v6CMDVKM5d_sXn3S5nZNf0phXn0IdrnhLazUoen9k9w,38
7
- codegraphcontext/cli/cli_helpers.py,sha256=e3WLdCdP63cbSji1RJZC9pwZt0mDgzM2ibeZqsdieJM,33996
7
+ codegraphcontext/cli/cli_helpers.py,sha256=2T8eP1RmM_p2Z1XfZDv44wx3Hf01jF_b3KGoWVBG0lk,35945
8
8
  codegraphcontext/cli/config_manager.py,sha256=MK7GMGZ4hd8-ZOShXBd_KDtNqHQ3ngdbef5KM_naPrQ,15899
9
9
  codegraphcontext/cli/main.py,sha256=PSJ5BxQhbdNdCWWyYvW9-6COCiw852iVi-zhP43nYPA,86328
10
10
  codegraphcontext/cli/registry_commands.py,sha256=30rJm4SeS0n1jax4JVuhuv4zYLzyMmlHcCSnsDDhgc8,19964
11
11
  codegraphcontext/cli/setup_macos.py,sha256=Xjlv_9jk9qv8Gh7stpH1pvlalzC0Fg176y7jc5G1zh0,3575
12
12
  codegraphcontext/cli/setup_wizard.py,sha256=yVXKqvAtUM0UC4tUreiS6C5utJbBO5Et2MiPUPWit9s,41393
13
13
  codegraphcontext/cli/visualizer.py,sha256=rZOLPx44wlaxVXGLR6uOaiL2GaQvxEnpyDQ4tjRDVC8,45750
14
- codegraphcontext/core/__init__.py,sha256=tDXBV2Tr2Rt6uYYHZH2PsOTsvePTirzijbxVhkIxj6g,7188
14
+ codegraphcontext/core/__init__.py,sha256=r-dC2b8hn5e4ZBVfWnCcBYMTQVcayxG5-eA5Do6uSM4,7278
15
15
  codegraphcontext/core/bundle_registry.py,sha256=kLvTLEl99QwfyAw8a7-4hqconLCtS64G9ECPVdfVBsM,7476
16
16
  codegraphcontext/core/cgc_bundle.py,sha256=YHL_uamATXYVweh5qbg9TQjT1lKlt69gXyF-xKKk67c,31353
17
17
  codegraphcontext/core/database.py,sha256=2UL8AyE6vX5mVHg1zcD74TYEREmddhKzN7Bjy2THQwM,11435
@@ -71,9 +71,9 @@ codegraphcontext/tools/query_tool_languages/typescript_toolkit.py,sha256=3S4hpmO
71
71
  codegraphcontext/utils/debug_log.py,sha256=Qg7jwyeg7x2h3Ur_2S34bdMCkHdlk_ngHfPwa97A9vE,2836
72
72
  codegraphcontext/utils/tree_sitter_manager.py,sha256=bIuKYN1aj1Zi6BnksGjZSLZzgBwuFRselZzyUpbToAU,9180
73
73
  codegraphcontext/utils/visualize_graph.py,sha256=Ntq8l8SvAOvsOp19QKByjEwU7-5rPa_XfcGLOrUehq4,5003
74
- codegraphcontext-0.2.12.dist-info/licenses/LICENSE,sha256=Btzdu2kIoMbdSp6OyCLupB1aRgpTCJ_szMimgEnpkkE,1056
75
- codegraphcontext-0.2.12.dist-info/METADATA,sha256=EgsTEDqJ5yLjKXbLI4GQ2gTgI3xOEP2s3Qi5TGbeIVg,21095
76
- codegraphcontext-0.2.12.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
77
- codegraphcontext-0.2.12.dist-info/entry_points.txt,sha256=LCxWCWMshdvYGoHBPuQZ8C-e4CiNSHCLXofrNSGHkoE,103
78
- codegraphcontext-0.2.12.dist-info/top_level.txt,sha256=CBgc6LAPZIO5FS0nSYYkylDifHsZTIqw3Gf5UwDxeGI,17
79
- codegraphcontext-0.2.12.dist-info/RECORD,,
74
+ codegraphcontext-0.3.0.dist-info/licenses/LICENSE,sha256=Btzdu2kIoMbdSp6OyCLupB1aRgpTCJ_szMimgEnpkkE,1056
75
+ codegraphcontext-0.3.0.dist-info/METADATA,sha256=FH-FTUU-gexxDfZePS6rqliF6540hUmv3ARwXJ_qO-I,21093
76
+ codegraphcontext-0.3.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
77
+ codegraphcontext-0.3.0.dist-info/entry_points.txt,sha256=LCxWCWMshdvYGoHBPuQZ8C-e4CiNSHCLXofrNSGHkoE,103
78
+ codegraphcontext-0.3.0.dist-info/top_level.txt,sha256=CBgc6LAPZIO5FS0nSYYkylDifHsZTIqw3Gf5UwDxeGI,17
79
+ codegraphcontext-0.3.0.dist-info/RECORD,,