PluginWorld
Bl

block-no-verify

Claude Code✓ SPEC VERIFIED

CLI tool to block --no-verify flag in git commands. Prevents AI agents from bypassing git hooks.

@tupe12334 · v1.3.0 · MIT · updated 4d ago

SECURITY

A

SCORE

81

INSTALLS

70K

PLUG IN

/plugin marketplace add tupe12334/block-no-verify
/plugin install block-no-verify

README

block-no-verify

A security tool that blocks ways AI agents can bypass local git hooks. It flags the --no-verify flag, core.hooksPath overrides, GitHub MCP tool calls that write through the GitHub API, and hook-manager disable env vars (Husky, Lefthook, Overcommit, pre-commit).

Powered by @polyhook/sdk — write the hook once, run it everywhere.

Why?

When using AI coding assistants like Claude Code, Cursor, Windsurf, Cline, or Amp, you might have git hooks (pre-commit, pre-push) that enforce code quality, run tests, or perform security checks. Agents can side-step those hooks in several common ways:

  • passing --no-verify to a git command,
  • overriding core.hooksPath (e.g. git -c core.hooksPath=/dev/null ...),
  • calling GitHub MCP tools such as mcp__github__push_files that commit or merge directly through the GitHub API, skipping the local hook chain entirely,
  • setting a hook manager's own disable environment variable, e.g. HUSKY=0, LEFTHOOK=0, OVERCOMMIT_DISABLE=1, or a non-empty SKIP= (pre-commit framework).

This package provides a CLI that blocks all of these, working with any AI tool that supports command / tool-use hooks.

Used By

Dify Glances RxDB Promptfoo Dify Plus Salesforce Extensions for VS Code Centy Worktree

Supported Agents

See polyhook's supported tools list.

Installation

Add as a dev dependency to ensure a consistent, pinned version:

pnpm add -D block-no-verify
# or
npm install --save-dev block-no-verify

Then use it with pnpm exec block-no-verify or npm exec block-no-verify.

Platform Integration

Claude Code

Add to your .claude/settings.json. The first matcher handles shell commands (--no-verify, core.hooksPath); the second matches any GitHub MCP tool so direct-to-API writes are also blocked:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "pnpm exec block-no-verify"
          }
        ]
      },
      {
        "matcher": "mcp__github__.*",
        "hooks": [
          {
            "type": "command",
            "command": "pnpm exec block-no-verify"
          }
        ]
      }
    ]
  }
}

Cursor

Cursor 1.7+ supports hooks via .cursor/hooks.json. The beforeShellExecution hook runs before any shell command.

Create .cursor/hooks.json in your project root:

{
  "version": 1,
  "hooks": {
    "beforeShellExecution": [
      {
        "command": "pnpm exec block-no-verify"
      }
    ]
  }
}

Note: Cursor hooks are in beta. See Cursor Hooks Documentation for the latest information.

Windsurf

Add to your .windsurf/settings.json:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": ".*",
        "hooks": [
          {
            "type": "command",
            "command": "pnpm exec block-no-verify"
          }
        ]
      }
    ]
  }
}

Gemini CLI

Add to your .gemini/settings.json:

{
  "hooks": {
    "BeforeTool": [
      {
        "matcher": "run_shell_command",
        "hooks": [
          {
            "name": "block-no-verify",
            "type": "command",
            "command": "pnpm exec block-no-verify",
            "timeout": 5000
          }
        ]
      }
    ]
  }
}

Note: Hooks are disabled by default in Gemini CLI. See Gemini CLI Hooks Documentation for details.

Supported Git Commands

The following git commands are monitored for --no-verify:

  • git commit
  • git push
  • git merge
  • git cherry-pick
  • git rebase
  • git am

Blocked GitHub MCP Tools

The following GitHub MCP tools are blocked because they write through the GitHub API and therefore skip local git hooks:

  • mcp__github__create_or_update_file
  • mcp__github__delete_file
  • mcp__github__push_files
  • mcp__github__merge_pull_request
  • mcp__github__update_pull_request_branch

Read-only GitHub MCP tools (e.g. mcp__github__get_file_contents, mcp__github__list_pull_requests) are not blocked.

Hook Manager Bypasses

Some hook managers ship their own escape hatch, separate from git --no-verify. These are detected and blocked when present alongside a monitored git command:

Manager Bypass Notes
Husky HUSKY=0 Disables all husky hooks
Lefthook LEFTHOOK=0 Disables all lefthook hooks
Overcommit OVERCOMMIT_DISABLE=1 Disables all overcommit hooks
pre-commit non-empty SKIP= Skips the named hook(s), or all with SKIP=*

Behavior

Command Blocked? Notes
git commit --no-verify Yes
git commit -n Yes -n is shorthand for --no-verify in commit
git push --no-verify Yes
git push -n No -n means --dry-run in push
git merge --no-verify Yes
git merge -n No -n means --no-commit in merge
git commit -m "msg" No No --no-verify flag

Testing

This package is end-to-end tested daily via the moadim.io tool.

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT

References

SIMILAR PLUGINS