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

Function hook_install

src/codegraphcontext/cli/main.py:949–966  ·  view source on GitHub ↗

Install CGC-managed Git hooks in the nearest repository. The installed hooks run `cgc update --quiet` after commits and checkouts. Existing non-CGC hooks are preserved unless --force is used.

(
    path: str = typer.Argument(".", help="Path inside the Git repository"),
    force: bool = typer.Option(False, "--force", "-f", help="Replace existing non-CGC hook files"),
)

Source from the content-addressed store, hash-verified

947
948@hook_app.command("install")
949def hook_install(
950 path: str = typer.Argument(".", help="Path inside the Git repository"),
951 force: bool = typer.Option(False, "--force", "-f", help="Replace existing non-CGC hook files"),
952):
953 """
954 Install CGC-managed Git hooks in the nearest repository.
955
956 The installed hooks run `cgc update <repo> --quiet` after commits and
957 checkouts. Existing non-CGC hooks are preserved unless --force is used.
958 """
959 try:
960 status = install_hooks(path, force=force)
961 except HookError as exc:
962 console.print(f"[bold red]Hook install failed:[/bold red] {exc}")
963 raise typer.Exit(code=1)
964
965 console.print(f"[green]✓[/green] Installed CGC hooks in [bold]{status.repo_root}[/bold]")
966 console.print(f"[dim]Git directory: {status.git_dir}[/dim]")
967
968
969@hook_app.command("uninstall")

Callers

nothing calls this directly

Calls 2

install_hooksFunction · 0.85
printMethod · 0.80

Tested by

no test coverage detected