Deletes a repository from the graph.
(repo_path: str, context: Optional[str] = None)
| 463 | |
| 464 | |
| 465 | def 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 | |
| 489 | def _print_query_exception(e: Exception, query: str) -> None: |
| 490 | """ |
no test coverage detected