Skip to main content

hardpoint hook

Install, uninstall, or check status of Hardpoint git hooks.

Usage

hardpoint hook <subcommand> [flags]

Subcommands

CommandDescription
installInstall a git hook
uninstallRemove a git hook
statusCheck hook installation status

Flags

FlagDescription
--type <type>Hook type: pre-commit, pre-push, commit-msg (default: pre-commit)
--manager <manager>Hook manager: native, husky, lefthook (default: native)

Examples

Install Hook

hardpoint hook install
Output:
Installed pre-commit hook at .git/hooks/pre-commit
Hardpoint will run on every commit.

Check Status

hardpoint hook status
Output (installed):
Hook Status
===========

Native Hooks (.git/hooks/):
  pre-commit:  installed (hardpoint)
  pre-push:    not installed
  commit-msg:  not installed

Husky:
  not configured

Lefthook:
  not configured

Uninstall Hook

hardpoint hook uninstall
Output:
Removed pre-commit hook.

Hook Managers

Hardpoint detects and integrates with popular hook managers:
ManagerDetectionIntegration
Native git.git/hooks/Direct installation
Husky.husky/Adds to existing config
Lefthooklefthook.ymlAdds to existing config

Native Git Hooks

By default, Hardpoint creates .git/hooks/pre-commit:
#!/bin/sh
# Hardpoint pre-commit hook
hardpoint scan --ci --staged

Husky Integration

If Husky is detected, install with:
hardpoint hook install --manager husky

Lefthook Integration

If Lefthook is detected, install with:
hardpoint hook install --manager lefthook
This adds to lefthook.yml:
pre-commit:
  commands:
    hardpoint:
      run: hardpoint scan --ci --staged

Hook Behavior

The installed hook:
  1. Runs hardpoint scan --ci --staged
  2. Only scans staged files (fast)
  3. Exits with code 1 if findings detected
  4. Blocks the commit until issues are fixed

Bypassing the Hook

In emergencies, skip the hook:
git commit --no-verify -m "Emergency fix"
Use sparingly - this bypasses security checks.