MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / delete_helper

Function delete_helper

src/codegraphcontext/cli/cli_helpers.py:465–487  ·  view source on GitHub ↗

Deletes a repository from the graph.

(repo_path: str, context: Optional[str] = None)

Source from the content-addressed store, hash-verified

463
464
465def delete_helper(repo_path: str, context: Optional[str] = None):
466 """Deletes a repository from the graph."""
467 services = _initialize_services(context)
468 if not all(services[:3]):
469 _fail_services_init()
470
471 db_manager, graph_builder, _, ctx = services
472
473 try:
474 if graph_builder.delete_repository_from_graph(repo_path):
475 console.print(f"[green]Successfully deleted repository: {repo_path}[/green]")
476 else:
477 console.print(f"[yellow]Repository not found in graph: {repo_path}[/yellow]")
478 console.print("[dim]Tip: Use 'cgc list' to see available repositories.[/dim]")
479 raise typer.Exit(code=1)
480 except typer.Exit:
481 # Control flow, not an error — let it through so the exit code survives.
482 raise
483 except Exception as e:
484 console.print(f"[bold red]An error occurred:[/bold red] {e}")
485 raise typer.Exit(code=1)
486 finally:
487 db_manager.close_driver()
488
489def _print_query_exception(e: Exception, query: str) -> None:
490 """

Callers 1

deleteFunction · 0.85

Calls 5

_initialize_servicesFunction · 0.85
_fail_services_initFunction · 0.85
printMethod · 0.80
close_driverMethod · 0.45

Tested by

no test coverage detected