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

Function hook_install

src/codegraphcontext/cli/main.py:852–869  ·  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

850
851@hook_app.command("install")
852def hook_install(
853 path: str = typer.Argument(".", help="Path inside the Git repository"),
854 force: bool = typer.Option(False, "--force", "-f", help="Replace existing non-CGC hook files"),
855):
856 """
857 Install CGC-managed Git hooks in the nearest repository.
858
859 The installed hooks run `cgc update <repo> --quiet` after commits and
860 checkouts. Existing non-CGC hooks are preserved unless --force is used.
861 """
862 try:
863 status = install_hooks(path, force=force)
864 except HookError as exc:
865 console.print(f"[bold red]Hook install failed:[/bold red] {exc}")
866 raise typer.Exit(code=1)
867
868 console.print(f"[green]✓[/green] Installed CGC hooks in [bold]{status.repo_root}[/bold]")
869 console.print(f"[dim]Git directory: {status.git_dir}[/dim]")
870
871
872@hook_app.command("uninstall")

Callers

nothing calls this directly

Calls 2

install_hooksFunction · 0.85
printMethod · 0.80

Tested by

no test coverage detected