codegraphcontext 0.4.12__py3-none-any.whl → 0.4.13__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.
Files changed (26) hide show
  1. codegraphcontext/api/router.py +1 -1
  2. codegraphcontext/cli/config_manager.py +3 -1
  3. codegraphcontext/cli/main.py +36 -39
  4. codegraphcontext/cli/registry_commands.py +25 -16
  5. codegraphcontext/cli/setup_wizard.py +2 -2
  6. codegraphcontext/core/__init__.py +7 -1
  7. codegraphcontext/core/bundle_registry.py +2 -42
  8. codegraphcontext/core/cgc_bundle.py +101 -42
  9. codegraphcontext/core/database_falkordb.py +13 -6
  10. codegraphcontext/core/database_nornic.py +11 -3
  11. codegraphcontext/tools/advanced_language_query_tool.py +11 -12
  12. codegraphcontext/tools/graph_builder.py +4 -0
  13. codegraphcontext/tools/indexing/persistence/writer.py +7 -7
  14. codegraphcontext/tools/indexing/pre_scan.py +2 -0
  15. codegraphcontext/tools/indexing/resolution/calls.py +2 -1
  16. codegraphcontext/tools/languages/elisp.py +682 -0
  17. codegraphcontext/tools/query_tool_languages/elisp_toolkit.py +73 -0
  18. codegraphcontext/tools/scip_indexer.py +1 -11
  19. codegraphcontext/tools/tree_sitter_parser.py +4 -0
  20. codegraphcontext/utils/tree_sitter_manager.py +5 -0
  21. {codegraphcontext-0.4.12.dist-info → codegraphcontext-0.4.13.dist-info}/METADATA +11 -10
  22. {codegraphcontext-0.4.12.dist-info → codegraphcontext-0.4.13.dist-info}/RECORD +26 -24
  23. {codegraphcontext-0.4.12.dist-info → codegraphcontext-0.4.13.dist-info}/WHEEL +0 -0
  24. {codegraphcontext-0.4.12.dist-info → codegraphcontext-0.4.13.dist-info}/entry_points.txt +0 -0
  25. {codegraphcontext-0.4.12.dist-info → codegraphcontext-0.4.13.dist-info}/licenses/LICENSE +0 -0
  26. {codegraphcontext-0.4.12.dist-info → codegraphcontext-0.4.13.dist-info}/top_level.txt +0 -0
@@ -87,7 +87,7 @@ async def execute_query(
87
87
  server: MCPServer = Depends(get_server)
88
88
  ):
89
89
  result = await server.handle_tool_call("execute_cypher_query", {
90
- "query": request.query,
90
+ "cypher_query": request.query,
91
91
  "params": request.params
92
92
  })
93
93
 
@@ -31,6 +31,7 @@ DEFAULT_CONFIG = {
31
31
  "FALKORDB_PATH": str(CONFIG_DIR / "global" / "db" / "falkordb"),
32
32
  "FALKORDB_SOCKET_PATH": str(CONFIG_DIR / "global" / "db" / "falkordb.sock"),
33
33
  "LADYBUGDB_PATH": str(CONFIG_DIR / "global" / "db" / "ladybugdb"),
34
+ "KUZUDB_PATH": str(CONFIG_DIR / "global" / "db" / "kuzudb"),
34
35
  "INDEX_VARIABLES": "true",
35
36
  "ALLOW_DB_DELETION": "false",
36
37
  "DEBUG_LOGS": "false",
@@ -72,6 +73,7 @@ CONFIG_DESCRIPTIONS = {
72
73
  "FALKORDB_PATH": "Path to FalkorDB database file",
73
74
  "FALKORDB_SOCKET_PATH": "Path to FalkorDB Unix socket",
74
75
  "LADYBUGDB_PATH": "Path to LadybugDB database directory",
76
+ "KUZUDB_PATH": "Path to KuzuDB database directory",
75
77
  "INDEX_VARIABLES": "Index variable nodes in the graph (lighter graph if false)",
76
78
  "ALLOW_DB_DELETION": "Allow full database deletion commands",
77
79
  "DEBUG_LOGS": "Enable debug logging (for development/troubleshooting)",
@@ -454,7 +456,7 @@ def validate_config_value(key: str, value: str) -> tuple[bool, Optional[str]]:
454
456
  except Exception as e:
455
457
  return False, f"Cannot create log directory: {e}"
456
458
 
457
- if key in ("FALKORDB_PATH", "FALKORDB_SOCKET_PATH", "LADYBUGDB_PATH"):
459
+ if key in ("FALKORDB_PATH", "FALKORDB_SOCKET_PATH", "LADYBUGDB_PATH", "KUZUDB_PATH"):
458
460
  # Validate path is writable
459
461
  db_path = Path(normalize_config_path(value, absolute=True))
460
462
  try:
@@ -250,7 +250,7 @@ def context_list():
250
250
  @context_app.command("create")
251
251
  def context_create(
252
252
  name: str = typer.Argument(..., help="Name of the new context"),
253
- database: str = typer.Option(None, "--database", "-d", help="Database backend (falkordb, kuzudb, neo4j). Defaults to DEFAULT_DATABASE from config."),
253
+ database: str = typer.Option(None, "--database", "--db", "-db", "-d", help="Database backend (falkordb, kuzudb, neo4j). Defaults to DEFAULT_DATABASE from config."),
254
254
  db_path: str = typer.Option(None, "--db-path", help="Explicit path for the DB (defaults to ~/.codegraphcontext/contexts/<name>/db)"),
255
255
  ):
256
256
  """Create a new logical context."""
@@ -291,17 +291,14 @@ def _load_credentials(cli_context_flag: Optional[str] = None):
291
291
  Uses per-variable precedence - each variable is loaded from the highest priority source.
292
292
  Priority order (highest to lowest):
293
293
  1. Runtime environment variables (shell/CI)
294
- 2. Local `.env` in project directory (project-specific overrides)
294
+ 2. Local `.codegraphcontext/.env` and `.env` in the current project directory (project-specific overrides)
295
295
  3. Global `~/.codegraphcontext/.env` (user defaults, including `cgc config set`)
296
296
  4. Local `mcp.json` env vars (project defaults)
297
- 1. Local `mcp.json` env vars (highest - explicit MCP server config)
298
- 2. ``<cwd>/.codegraphcontext/.env`` only (no parent-directory walk)
299
- 3. Global `~/.codegraphcontext/.env` (lowest - user defaults)
300
297
 
301
- Step 2 skips duplicate loading when that file is the same path as the global file.
302
- Arbitrary repo-root `.env` files are not loaded—only CodeGraphContext config paths.
298
+ Duplicate loading is skipped when the local file resolves to the same path as the global file.
299
+ Arbitrary parent directory `.env` files are not loaded—ensuring isolation.
303
300
  """
304
- from dotenv import dotenv_values, find_dotenv
301
+ from dotenv import dotenv_values
305
302
  from codegraphcontext.cli.config_manager import (
306
303
  ensure_config_dir,
307
304
  codegraphcontext_dotenv_at_cwd,
@@ -360,12 +357,12 @@ def _load_credentials(cli_context_flag: Optional[str] = None):
360
357
  except Exception as e:
361
358
  console.print(f"[yellow]Warning: Could not load global .env: {e}[/yellow]")
362
359
 
363
- # 2. Local project .env (project-specific overrides)
360
+ # 2. Local project .env (project-specific overrides - restricted to CWD only, no parent walk)
364
361
  try:
365
- dotenv_path = find_dotenv(usecwd=True, raise_error_if_not_found=False)
366
- if dotenv_path:
367
- with open(dotenv_path, "r", encoding="utf-8", errors="replace") as f:
368
- _append_source(str(dotenv_path), dotenv_values(stream=f))
362
+ local_dot_env = Path.cwd() / ".env"
363
+ if local_dot_env.exists() and local_dot_env.resolve() != global_env_path.resolve():
364
+ with open(local_dot_env, "r", encoding="utf-8", errors="replace") as f:
365
+ _append_source(str(local_dot_env), dotenv_values(stream=f))
369
366
  except Exception as e:
370
367
  console.print(f"[yellow]Warning: Could not load .env from current directory: {e}[/yellow]")
371
368
 
@@ -637,7 +634,7 @@ def bundle_export(
637
634
  if repo_path:
638
635
  console.print(f"[dim]Repository: {repo_path}[/dim]")
639
636
  else:
640
- console.print(f"[dim]Exporting all repositories[/dim]")
637
+ console.print("[dim]Exporting all repositories[/dim]")
641
638
 
642
639
  bundle = CGCBundle(db_manager)
643
640
  success, message = bundle.export_to_bundle(
@@ -748,7 +745,7 @@ def bundle_load(
748
745
 
749
746
  # Try to download from registry
750
747
  console.print(f"[yellow]Bundle '{bundle_name}' not found locally.[/yellow]")
751
- console.print(f"[cyan]Attempting to download from registry...[/cyan]")
748
+ console.print("[cyan]Attempting to download from registry...[/cyan]")
752
749
 
753
750
  try:
754
751
  from .registry_commands import download_bundle
@@ -768,7 +765,7 @@ def bundle_load(
768
765
 
769
766
  except Exception as e:
770
767
  console.print(f"[bold red]Error: {e}[/bold red]")
771
- console.print(f"[dim]Use 'cgc registry list' to see available bundles[/dim]")
768
+ console.print("[dim]Use 'cgc registry list' to see available bundles[/dim]")
772
769
  raise typer.Exit(code=1)
773
770
 
774
771
  # Shortcut commands at root level
@@ -888,7 +885,7 @@ def registry_download(
888
885
  bundle_path = download_bundle(name, output_dir, auto_load=load)
889
886
 
890
887
  if load and bundle_path:
891
- console.print(f"\n[cyan]Loading bundle...[/cyan]")
888
+ console.print("\n[cyan]Loading bundle...[/cyan]")
892
889
  bundle_import(bundle_path, clear=False)
893
890
 
894
891
  @registry_app.command("request")
@@ -941,13 +938,13 @@ def doctor():
941
938
  if config_manager.CONFIG_FILE.exists():
942
939
  console.print(f" [green]✓[/green] Config loaded from {config_manager.CONFIG_FILE}")
943
940
  else:
944
- console.print(f" [yellow]ℹ[/yellow] No .env config found, using defaults")
941
+ console.print(" [yellow]ℹ[/yellow] No .env config found, using defaults")
945
942
  console.print(f" [dim]Config will be created at: {config_manager.CONFIG_FILE}[/dim]")
946
943
 
947
944
  if config_manager.CONTEXT_CONFIG_FILE.exists():
948
945
  console.print(f" [green]✓[/green] Context config loaded from {config_manager.CONTEXT_CONFIG_FILE}")
949
946
  else:
950
- console.print(f" [yellow]ℹ[/yellow] No Context config found")
947
+ console.print(" [yellow]ℹ[/yellow] No Context config found")
951
948
  console.print(f" [dim]Context config will be auto-generated at: {config_manager.CONTEXT_CONFIG_FILE}[/dim]")
952
949
 
953
950
  # Validate each config value
@@ -958,12 +955,12 @@ def doctor():
958
955
  invalid_configs.append(f"{key}: {error_msg}")
959
956
 
960
957
  if invalid_configs:
961
- console.print(f" [red]✗[/red] Invalid configuration values found:")
958
+ console.print(" [red]✗[/red] Invalid configuration values found:")
962
959
  for err in invalid_configs:
963
960
  console.print(f" - {err}")
964
961
  all_checks_passed = False
965
962
  else:
966
- console.print(f" [green]✓[/green] All configuration values are valid")
963
+ console.print(" [green]✓[/green] All configuration values are valid")
967
964
  except Exception as e:
968
965
  console.print(f" [red]✗[/red] Configuration error: {e}")
969
966
  all_checks_passed = False
@@ -1003,10 +1000,10 @@ def doctor():
1003
1000
  console.print(" Start Neo4j Desktop or run: docker run -d -p 7687:7687 -p 7474:7474 neo4j")
1004
1001
  all_checks_passed = False
1005
1002
 
1006
- console.print(f" [cyan]Testing Neo4j authentication/query...[/cyan]")
1003
+ console.print(" [cyan]Testing Neo4j authentication/query...[/cyan]")
1007
1004
  is_connected, error_msg = DatabaseManager.test_connection(uri, username, password, database=database_name)
1008
1005
  if is_connected:
1009
- console.print(f" [green]✓[/green] Neo4j connection successful")
1006
+ console.print(" [green]✓[/green] Neo4j connection successful")
1010
1007
  else:
1011
1008
  console.print(f" [red]✗[/red] Neo4j connection failed (source: {db_source})")
1012
1009
  console.print(f" Reason: {error_msg}")
@@ -1015,28 +1012,28 @@ def doctor():
1015
1012
  from importlib.util import find_spec
1016
1013
 
1017
1014
  if find_spec("kuzu") is not None:
1018
- console.print(f" [green]✓[/green] KuzuDB is installed")
1015
+ console.print(" [green]✓[/green] KuzuDB is installed")
1019
1016
  else:
1020
- console.print(f" [red]✗[/red] KuzuDB is not installed")
1021
- console.print(f" Run: pip install kuzu")
1017
+ console.print(" [red]✗[/red] KuzuDB is not installed")
1018
+ console.print(" Run: pip install kuzu")
1022
1019
  all_checks_passed = False
1023
1020
  elif default_db == "ladybugdb":
1024
1021
  from importlib.util import find_spec
1025
1022
 
1026
1023
  if find_spec("ladybug") is not None:
1027
- console.print(f" [green]✓[/green] LadybugDB core (ladybug) is installed")
1024
+ console.print(" [green]✓[/green] LadybugDB core (ladybug) is installed")
1028
1025
  else:
1029
- console.print(f" [red]✗[/red] LadybugDB core (ladybug) is not installed")
1030
- console.print(f" Run: pip install ladybug")
1026
+ console.print(" [red]✗[/red] LadybugDB core (ladybug) is not installed")
1027
+ console.print(" Run: pip install ladybug")
1031
1028
  all_checks_passed = False
1032
1029
  else:
1033
1030
  # FalkorDB
1034
1031
  try:
1035
1032
  import falkordb
1036
- console.print(f" [green]✓[/green] FalkorDB Lite is installed")
1033
+ console.print(" [green]✓[/green] FalkorDB Lite is installed")
1037
1034
  except ImportError:
1038
- console.print(f" [yellow]⚠[/yellow] FalkorDB Lite not installed (Python 3.12+ only)")
1039
- console.print(f" Run: pip install falkordblite")
1035
+ console.print(" [yellow]⚠[/yellow] FalkorDB Lite not installed (Python 3.12+ only)")
1036
+ console.print(" Run: pip install falkordblite")
1040
1037
  except Exception as e:
1041
1038
  console.print(f" [red]✗[/red] Database check error: {e}")
1042
1039
  all_checks_passed = False
@@ -1045,11 +1042,11 @@ def doctor():
1045
1042
  console.print("\n[bold]3. Checking Tree-Sitter Installation...[/bold]")
1046
1043
  try:
1047
1044
  from tree_sitter import Language, Parser
1048
- console.print(f" [green]✓[/green] tree-sitter is installed")
1045
+ console.print(" [green]✓[/green] tree-sitter is installed")
1049
1046
 
1050
1047
  try:
1051
1048
  from tree_sitter_language_pack import get_language
1052
- console.print(f" [green]✓[/green] tree-sitter-language-pack is installed")
1049
+ console.print(" [green]✓[/green] tree-sitter-language-pack is installed")
1053
1050
 
1054
1051
  from codegraphcontext.utils.tree_sitter_manager import LANGUAGE_ALIASES, LANGUAGE_PACK_NAMES
1055
1052
  all_langs = sorted(set(LANGUAGE_ALIASES.values()))
@@ -1067,7 +1064,7 @@ def doctor():
1067
1064
  if unavailable:
1068
1065
  console.print(f" [yellow]⚠[/yellow] Unavailable: {', '.join(unavailable)}")
1069
1066
  except ImportError:
1070
- console.print(f" [red]✗[/red] tree-sitter-language-pack not installed")
1067
+ console.print(" [red]✗[/red] tree-sitter-language-pack not installed")
1071
1068
  all_checks_passed = False
1072
1069
  except ImportError as e:
1073
1070
  console.print(f" [red]✗[/red] tree-sitter not installed: {e}")
@@ -1085,12 +1082,12 @@ def doctor():
1085
1082
  try:
1086
1083
  test_file.touch()
1087
1084
  test_file.unlink()
1088
- console.print(f" [green]✓[/green] Config directory is writable")
1085
+ console.print(" [green]✓[/green] Config directory is writable")
1089
1086
  except Exception as e:
1090
1087
  console.print(f" [red]✗[/red] Config directory not writable: {e}")
1091
1088
  all_checks_passed = False
1092
1089
  else:
1093
- console.print(f" [yellow]⚠[/yellow] Config directory doesn't exist, will be created on first use")
1090
+ console.print(" [yellow]⚠[/yellow] Config directory doesn't exist, will be created on first use")
1094
1091
  except Exception as e:
1095
1092
  console.print(f" [red]✗[/red] Permission check error: {e}")
1096
1093
  all_checks_passed = False
@@ -1102,7 +1099,7 @@ def doctor():
1102
1099
  if cgc_path:
1103
1100
  console.print(f" [green]✓[/green] cgc command found at: {cgc_path}")
1104
1101
  else:
1105
- console.print(f" [yellow]⚠[/yellow] cgc command not in PATH (using python -m cgc)")
1102
+ console.print(" [yellow]⚠[/yellow] cgc command not in PATH (using python -m cgc)")
1106
1103
 
1107
1104
  # Final summary
1108
1105
  console.print("\n" + "=" * 60)
@@ -2393,7 +2390,7 @@ def analyze_dead_code(
2393
2390
  location_str
2394
2391
  )
2395
2392
 
2396
- console.print(f"\n[bold yellow]⚠️ Potentially Unused Functions:[/bold yellow]")
2393
+ console.print("\n[bold yellow]⚠️ Potentially Unused Functions:[/bold yellow]")
2397
2394
  console.print(table)
2398
2395
  console.print(f"\n[dim]Total: {len(unused_funcs)} function(s)[/dim]")
2399
2396
  console.print(f"[dim]Note: {results.get('note', '')}[/dim]")
@@ -11,7 +11,6 @@ from rich.table import Table
11
11
  from rich.progress import Progress, SpinnerColumn, TextColumn
12
12
  from pathlib import Path
13
13
  from typing import Optional, List, Dict, Any
14
- import time
15
14
 
16
15
  console = Console()
17
16
 
@@ -20,7 +19,7 @@ GITHUB_REPO = "CodeGraphContext"
20
19
 
21
20
 
22
21
  def fetch_available_bundles() -> List[Dict[str, Any]]:
23
- """Fetch all available bundles from GitHub Releases (delegates to core BundleRegistry)."""
22
+ """Fetch all available bundles from the Hugging Face registry (delegates to core BundleRegistry)."""
24
23
  from ..core.bundle_registry import BundleRegistry
25
24
  return BundleRegistry.fetch_available_bundles()
26
25
 
@@ -34,17 +33,27 @@ def _get_base_package_name(bundle_name: str) -> str:
34
33
  'flask-main-abc123' -> 'flask'
35
34
  'requests' -> 'requests'
36
35
  """
36
+ import re
37
37
  # Remove .cgc extension if present
38
38
  name = bundle_name.replace('.cgc', '')
39
39
 
40
- # Split by hyphen and take the first part
41
- # This assumes package names don't contain hyphens (may need refinement)
42
- parts = name.split('-')
43
-
44
- # For multi-word package names like 'python-bitcoin-utils',
45
- # we need smarter logic. For now, take first part.
46
- # TODO: Improve this with a known package list or better heuristics
47
- return parts[0]
40
+ # If the bundle name contains '-main-' or '-master-', split on that
41
+ for branch_indicator in ('-main-', '-master-'):
42
+ if branch_indicator in name:
43
+ return name.split(branch_indicator)[0]
44
+
45
+ # Try matching standard trailing branch and commit hash pattern
46
+ # e.g., -[branch]-[commit_hash] where commit_hash is a hex string
47
+ match = re.search(r'-(?:main|master|dev|development|release)-[a-fA-F0-9]{7,40}$', name)
48
+ if match:
49
+ return name[:match.start()]
50
+
51
+ # Try matching generic trailing branch and 7-8 char hex commit hash
52
+ match_generic = re.search(r'-([a-zA-Z0-9_]+)-([a-fA-F0-9]{7,8})$', name)
53
+ if match_generic:
54
+ return name[:match_generic.start()]
55
+
56
+ return name
48
57
 
49
58
 
50
59
  def list_bundles(verbose: bool = False, unique: bool = False):
@@ -200,7 +209,7 @@ def download_bundle(name: str, output_dir: Optional[str] = None, auto_load: bool
200
209
  console.print(f"[cyan] → {bundle.get('full_name')}[/cyan]")
201
210
 
202
211
  if len(matching_bundles) > 1:
203
- console.print(f"\n[dim]Other available versions:[/dim]")
212
+ console.print("\n[dim]Other available versions:[/dim]")
204
213
  for b in matching_bundles[1:4]: # Show up to 3 alternatives
205
214
  console.print(f"[dim] • {b.get('full_name')}[/dim]")
206
215
  if len(matching_bundles) > 4:
@@ -253,7 +262,7 @@ def download_bundle(name: str, output_dir: Optional[str] = None, auto_load: bool
253
262
  if not typer.confirm("Overwrite?", default=False):
254
263
  console.print("[yellow]Download cancelled[/yellow]")
255
264
  if auto_load:
256
- console.print(f"[cyan]Using existing bundle for loading...[/cyan]")
265
+ console.print("[cyan]Using existing bundle for loading...[/cyan]")
257
266
  return str(output_path)
258
267
  return
259
268
  output_path.unlink()
@@ -324,14 +333,14 @@ def request_bundle(repo_url: str, wait: bool = False):
324
333
  console.print("[cyan]Please use one of these methods:[/cyan]\n")
325
334
 
326
335
  console.print("1. [bold]Via Website (Recommended):[/bold]")
327
- console.print(f" Visit: https://codegraphcontext.vercel.app")
336
+ console.print(" Visit: https://codegraphcontext.vercel.app")
328
337
  console.print(f" Enter: {repo_url}")
329
- console.print(f" Click 'Generate Bundle'\n")
338
+ console.print(" Click 'Generate Bundle'\n")
330
339
 
331
340
  console.print("2. [bold]Via GitHub Actions (Manual):[/bold]")
332
341
  console.print(f" Go to: https://github.com/{GITHUB_ORG}/{GITHUB_REPO}/actions")
333
- console.print(f" Select: 'Generate Bundle On-Demand'")
334
- console.print(f" Click: 'Run workflow'")
342
+ console.print(" Select: 'Generate Bundle On-Demand'")
343
+ console.print(" Click: 'Run workflow'")
335
344
  console.print(f" Enter: {repo_url}\n")
336
345
 
337
346
  console.print("[dim]Bundle generation typically takes 5-10 minutes.[/dim]")
@@ -92,8 +92,8 @@ def _generate_mcp_json(creds):
92
92
  "disabledTools": [],
93
93
  "disabled": False
94
94
  },
95
- "disabled": False,
96
- "alwaysAllow": []
95
+ "disabled": False
96
+
97
97
  }
98
98
  }
99
99
  }
@@ -95,7 +95,7 @@ def get_database_manager(db_path: Optional[str] = None) -> Union['DatabaseManage
95
95
  info_logger("FalkorDB Lite is not supported or not installed. Falling back to KùzuDB.")
96
96
  if _is_kuzudb_available():
97
97
  from .database_kuzu import KuzuDBManager
98
- return KuzuDBManager()
98
+ return KuzuDBManager(db_path=db_path)
99
99
  raise ValueError("Database set to 'falkordb' but FalkorDB Lite is not installed or not supported on this OS.\nRun 'pip install falkordblite'")
100
100
 
101
101
  from .database_falkordb import FalkorDBManager, FalkorDBUnavailableError
@@ -168,6 +168,12 @@ def get_database_manager(db_path: Optional[str] = None) -> Union['DatabaseManage
168
168
  info_logger(f"Using KùzuDB (default) at {db_path or 'default path'}")
169
169
  return KuzuDBManager(db_path=db_path)
170
170
 
171
+ # Implicit: LadybugDB when available
172
+ if _is_ladybugdb_available():
173
+ from .database_ladybug import LadybugDBManager
174
+ info_logger(f"Using LadybugDB (default) at {db_path or 'default path'}")
175
+ return LadybugDBManager(db_path=db_path)
176
+
171
177
  # Implicit: Neo4j when configured
172
178
  if _is_neo4j_configured():
173
179
  from .database import DatabaseManager
@@ -18,11 +18,9 @@ def _github_headers() -> dict:
18
18
 
19
19
  def _get_manifest_url() -> str:
20
20
  import os
21
- hf_repo = os.environ.get("HF_REGISTRY_REPO") or "codegraphcontext/bundles"
21
+ hf_repo = os.environ.get("HF_REGISTRY_REPO") or "codegraphcontext/registry"
22
22
  return f"https://huggingface.co/datasets/{hf_repo}/raw/main/manifest.json"
23
23
 
24
- REGISTRY_API_URL = "https://api.github.com/repos/CodeGraphContext/CodeGraphContext/releases"
25
-
26
24
  class BundleRegistry:
27
25
  """
28
26
  Core logic for interacting with the CodeGraphContext bundle registry.
@@ -32,7 +30,7 @@ class BundleRegistry:
32
30
  @staticmethod
33
31
  def fetch_available_bundles() -> List[Dict[str, Any]]:
34
32
  """
35
- Fetch all available bundles from GitHub Releases and the on-demand manifest.
33
+ Fetch all available bundles from the Hugging Face raw dataset registry manifest.
36
34
  Returns a list of bundle dictionaries with metadata.
37
35
  Preserves all versions - no deduplication.
38
36
  """
@@ -53,44 +51,6 @@ class BundleRegistry:
53
51
  all_bundles.append(bundle)
54
52
  except Exception as e:
55
53
  logger.warning(f"Could not fetch on-demand bundles from manifest: {e}")
56
-
57
- # 2. Fetch weekly pre-indexed bundles
58
- try:
59
- response = requests.get(REGISTRY_API_URL, headers=_github_headers(), timeout=10)
60
- if response.status_code == 200:
61
- releases = response.json()
62
-
63
- # Find weekly releases (bundles-YYYYMMDD pattern)
64
- weekly_releases = [r for r in releases if r['tag_name'].startswith('bundles-') and r['tag_name'] != 'bundles-latest']
65
-
66
- if weekly_releases:
67
- # Get the most recent weekly release
68
- latest_weekly = weekly_releases[0]
69
-
70
- for asset in latest_weekly.get('assets', []):
71
- if asset['name'].endswith('.cgc'):
72
- # Full bundle name without extension
73
- full_name = asset['name'].replace('.cgc', '')
74
-
75
- # Parse bundle name
76
- name_parts = full_name.split('-')
77
- bundle = {
78
- 'name': name_parts[0], # Base package name
79
- 'full_name': full_name, # Complete name with version
80
- 'repo': f"{name_parts[0]}/{name_parts[0]}", # Simplified
81
- 'bundle_name': asset['name'],
82
- 'version': name_parts[1] if len(name_parts) > 1 else 'latest',
83
- 'commit': name_parts[2] if len(name_parts) > 2 else 'unknown',
84
- 'size_bytes': asset.get('size', 0),
85
- 'size': f"{asset['size'] / 1024 / 1024:.1f}MB",
86
- 'download_url': asset['browser_download_url'],
87
- 'generated_at': asset['updated_at'],
88
- 'source': 'weekly'
89
- }
90
- all_bundles.append(bundle)
91
- except Exception as e:
92
- logger.warning(f"Could not fetch weekly bundles from GitHub API: {e}")
93
-
94
54
  # Normalize all bundles to have required fields
95
55
  for bundle in all_bundles:
96
56
  # Ensure 'name' field exists (base package name)