Skip to main content
GGA works alongside popular git hook managers. Use these integrations when your project already uses a hook manager, or when you want to combine GGA with linters, formatters, and type checkers in a single hook pipeline.
If your project has no existing hook manager, gga install is all you need — it writes a native git hook directly and requires no additional tooling.

Husky

Husky is widely used in JavaScript and TypeScript projects.

Basic setup

1

Install Husky

npm install -D husky
2

Initialize Husky

npx husky init
This creates a .husky/ directory with a default pre-commit file.
3

Edit the pre-commit hook

Replace the contents of .husky/pre-commit with:
.husky/pre-commit
#!/usr/bin/env bash

# Run Gentleman Guardian Angel
gga run || exit 1

# Your other checks (optional)
npm run lint
npm run typecheck
Use lint-staged alongside GGA to run formatters only on staged files.
1

Install dependencies

npm install -D husky lint-staged
2

Configure lint-staged in package.json

package.json
{
  "scripts": {
    "prepare": "husky"
  },
  "lint-staged": {
    "*.{ts,tsx,js,jsx}": ["eslint --fix", "prettier --write"]
  }
}
3

Edit the pre-commit hook

.husky/pre-commit
#!/usr/bin/env bash

# AI Review first (uses git staged files internally)
gga run || exit 1

# Then lint-staged for formatting
npx lint-staged
Run GGA before lint-staged so that formatting changes do not affect the files GGA reviews. GGA reads from the git staging area directly.

pre-commit

pre-commit is the standard hook manager for Python projects and works with any language.

Setup

1

Install pre-commit

pip install pre-commit
2

Create .pre-commit-config.yaml

.pre-commit-config.yaml
repos:
  # Gentleman Guardian Angel (runs first)
  - repo: local
    hooks:
      - id: gga
        name: Gentleman Guardian Angel
        entry: gga run
        language: system
        pass_filenames: false
        stages: [pre-commit]

  # Your other hooks
  - repo: https://github.com/psf/black
    rev: 24.4.2
    hooks:
      - id: black

  - repo: https://github.com/pycqa/flake8
    rev: 7.0.0
    hooks:
      - id: flake8

  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.10.0
    hooks:
      - id: mypy
3

Install the hooks

pre-commit install
Run all configured hooks against every file in the repository:
pre-commit run --all-files
Run only the GGA hook:
pre-commit run gga
pass_filenames: false is required. GGA determines which files to review from the git staging area, not from command-line arguments.

Lefthook

Lefthook is a fast, language-agnostic hook manager written in Go.

Setup

1

Install Lefthook

brew install lefthook
2

Create lefthook.yml

lefthook.yml
pre-commit:
  parallel: false
  commands:
    ai-review:
      run: gga run
      fail_text: "Gentleman Guardian Angel failed. Fix violations before committing."

    lint:
      glob: "*.{ts,tsx,js,jsx}"
      run: npm run lint

    typecheck:
      run: npm run typecheck
3

Activate the hooks

lefthook install
parallel: false is set intentionally. Lefthook runs commands in parallel by default, but GGA must complete before other commands run — otherwise a failed review would not block subsequent steps.

Build docs developers (and LLMs) love