HOW TO USE IT

From install to a protected push.

Set up shared local checks in minutes, then grow them alongside your repository.

You will need
  • Node.js 22 or newer
  • Git
  • Codex, Claude Code, Gemini, Copilot, or Cursor CLI

No Git Hooked account or additional API key.

01

Quick start

Install the CLI, move into a Git repository, and initialize the default checks.

Terminal
cd your-repository
npm install --save-dev @githooked/cli
npx git-hooked init
npx git-hooked check pre-push
That is enough to start.

Future commits and pushes run the configured checks automatically. The manual check above lets you confirm the first setup immediately.

02

What initialization adds

git-hooked init creates a reviewable .githooked/ directory and managed blocks in the repository’s local Git hooks. Existing hook content is preserved, and running init again is safe.

.githooked/ ├── config.yml └── hooks/ ├── pre-commit.yml └── pre-push.yml
Pre-commit

Fast deterministic checks for secrets, environment files, and conflict markers.

Pre-push

Deeper semantic review for security issues and missing tests using your configured agent.

03

Your daily workflow

Work normally. Git Hooked collects the relevant staged or outgoing diff, runs only the configured checks, and reports findings in the terminal.

  1. 1
    Commit

    Fast local checks catch mechanical mistakes before they enter history.

  2. 2
    Push

    Your configured agent reviews the bounded outgoing change in an isolated run.

  3. 3
    Resolve

    Fix blocking findings yourself, or deliberately run git-hooked fix for the latest completed review.

  4. 4
    Push again

    Successful unchanged semantic reviews are reused from the repository’s private Git cache.

Local by design.

Git Hooked has no hosted proxy and collects no telemetry. Agent review goes through the authenticated CLI already installed on your machine.

04

Choose which checks run

Hook files are plain YAML. Reference shipped checks with builtin:<id> and repository-specific checks with check:<id>.

.githooked/hooks/pre-push.yml
checks:
  - builtin:security-review
  - builtin:missing-tests
  - builtin:breaking-changes
  - check:tenant-isolation
05

Add a repository rule

Give Git Hooked a plain-language policy. Your configured agent analyzes bounded repository context in an isolated run, asks focused questions when needed, and recommends an existing, semantic, deterministic, or hybrid implementation.

Terminal
git-hooked rule add "Every database query must include tenantId" --dry-run
git-hooked rule add "Every database query must include tenantId"

Before writing, Git Hooked previews the hook, severity, file globs, evidence, instructions, and any generated script. Generated command checks remain untrusted and cannot run until you inspect them and run git-hooked trust. Commit the resulting .githooked/ files so the whole team receives the same auditable rule.

06

Install a curated guide pack

Packs bundle focused, auditable rules for common security and quality concerns. Inspect every rule and proposed file change before installing it.

Terminal
git-hooked guide list
git-hooked guide inspect security/multi-tenant
git-hooked guide add security/multi-tenant

Installed checks become ordinary Markdown and YAML under .githooked/. Removal refuses to delete a pack check that your team has edited locally.

07

Discover repository-specific security rules

Guided setup maps the repository locally, then asks your configured agent for a bounded set of proposals. Start with dry-run mode to review the evidence and exact file changes.

Terminal
git-hooked setup security --dry-run
git-hooked setup security --focus auth,database --max-proposals 5

Interactive mode asks before installing each proposal. Non-interactive and dry-run modes never modify .githooked/.

08

Using an existing hook manager

If Git Hooked detects Husky, Lefthook, or pre-commit, it creates the configuration but leaves the manager’s hooks untouched. Install the CLI as a development dependency and call it from the manager you already use.

Huskynpx --no-install git-hooked check pre-commit
Lefthookrun: npx --no-install git-hooked check pre-push
pre-commitentry: npx --no-install git-hooked check pre-commit

See complete manager configurations on GitHub

09

Diagnose, repair, or remove

git-hooked doctorCheck the repository, configuration, hooks, and agent.
git-hooked doctor --test-agentAlso run a basic isolated invocation with the configured agent.
git-hooked fixDeliberately fix findings from the latest completed review.
git-hooked uninstallRemove managed hook blocks and keep configuration.
git-hooked uninstall --remove-configRemove managed hooks and the configuration directory.
Need an explicit one-off bypass?

Run GIT_HOOKED_SKIP=1 git push. Git Hooked prints a visible warning and does not present the skipped review as successful.

NEXT

Pick checks for your repository.

Explore the shipped checks and installable packs, with exact IDs and commands.

Open the library