Skip to content

Add LLM hooks management support #1433

Description

@mrexox

Description

Claude and Codex have hooks, and managing them through lefthook feels like something useful.

What problem it is solving?

You don't need to define hooks for the Claude, Codex, etc. You add a hook to lefthook.yml and generate the configs for the provider of your choice.

Details

Need to think of the better approach and configuration option.

Option 1 – Strictly configurable

# lefthook.yml

ai:
  claude:
    Stop: validate # references a named lefthook hook

validate:
  jobs:
    - run: go test ./...

Merges to:

// .claude/settings.json

{
  ... // other local user settings
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "lefthook run validate"
          }
        ]
      }
    ]
  }
} 

Option 2 – Ask user

Stop:
  jobs:
    - run: go test ./...

When you run lefthook install

  1. Detects you have configured hooks for LLM (by name)
  2. Asks if you prefer to use Claude or Codex
    2.1. Another option is to check existing .claude/ and .codex/ dirs
  3. Installs the hook (which call lefthook run Stop)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature requestA new lefthook feature description

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions