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
| Hook | What it does |
|---|---|
| pre-push | Auto-detects your framework and runs quality checks before pushing |
| commit-msg | Enforces 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.
| Framework | Checks |
|---|---|
| Node.js | TypeScript, ESLint, Prettier, build, test (only when listed as dependencies; auto-detects npm/yarn/pnpm/bun) |
| Python | ruff/flake8, mypy, black/ruff format, pytest |
| Rust | cargo check, clippy, cargo test |
| Go | go vet, golangci-lint, go test |
| PHP | PHPStan, PHPUnit |
| Ruby | RuboCop, RSpec/rake test |
| Java | Maven 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 coverageTeam 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/hooksConfiguration
Skip hooks during install
ck install --no-hooksSkip hooks for a single push
git push --no-verifyUninstall hooks
git config --unset core.hooksPathWas this helpful?
Help us improve the documentation by sharing your feedback.