Git Hooks & Quality Gates

ContextKit provides framework-aware quality checks via Git hooks. No external dependencies like Husky required — works in any git repo, not just Node.js projects.

Overview

HookWhat it does
pre-pushAuto-detects your framework and runs quality checks before pushing
commit-msgEnforces Conventional Commits format

No dependencies required

ContextKit uses git config core.hooksPath to point Git at .contextkit/hooks/. No npm packages, no Husky, no lint-staged. Works with any language.

How It Works

1During install

ck install runs git config core.hooksPath .contextkit/hooks to tell Git where hooks live.

2For Node.js projects

A prepare script is added to package.json so hooks activate automatically for all developers after npm install.

"scripts": {
  "prepare": "git config core.hooksPath .contextkit/hooks"
}

3For non-Node projects

Each developer runs bash .contextkit/hooks/setup-hooks.sh once, or adds the git config command to their build tool's setup task.

Pre-push Quality Gates

The pre-push hook auto-detects your project framework and runs the appropriate quality checks. All gates skip gracefully when tools aren't installed.

FrameworkChecks
Node.jsTypeScript, ESLint, Prettier, build, test (only when listed as dependencies; auto-detects npm/yarn/pnpm/bun)
Pythonruff/flake8, mypy, black/ruff format, pytest
Rustcargo check, clippy, cargo test
Gogo vet, golangci-lint, go test
PHPPHPStan, PHPUnit
RubyRuboCop, RSpec/rake test
JavaMaven verify / Gradle check

Graceful skipping

If a tool isn't installed (e.g., no ESLint in your project), that gate is skipped with a message — it won't block your push. Only installed tools are checked.

Commit Message Hook

When enabled, the commit-msg hook enforces Conventional Commits format:

<type>(<scope>): <description>

Types: feat, fix, docs, style, refactor, test, chore

Examples

feat(auth): add login pagefix: resolve null pointer in checkoutdocs: update API referencetest(cart): add edge case coverage

Team Setup

One developer enables hooks during ck install. For Node.js projects, the prepare script ensures hooks work for everyone automatically.

Node.js projects

The prepare script in package.json runs automatically after npm install, so hooks activate for all developers without any extra steps.

Other projects (Python, Rust, Go, etc.)

Add this to your project's setup instructions or Makefile:

git config core.hooksPath .contextkit/hooks

Configuration

Skip hooks during install

ck install --no-hooks

Skip hooks for a single push

git push --no-verify

Uninstall hooks

git config --unset core.hooksPath

Was this helpful?

Help us improve the documentation by sharing your feedback.