Metadata-Version: 2.4
Name: agenthook
Version: 0.0.2
Summary: Declarative agent hooks manager.
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.14
Requires-Dist: anyio>=4.11.0
Requires-Dist: pydantic>=2.12.0
Requires-Dist: pyyaml>=6.0.3
Requires-Dist: returns>=0.26.0
Requires-Dist: wcmatch>=10.1
Description-Content-Type: text/markdown

# agenthook

Declarative agent hooks manager.

## Overview

Lint hook for agentic coding (currently Claude Code only).
Runs fix commands sequentially, then check commands in parallel, and blocks the edit on failure.

## Requirements

- [uv](https://docs.astral.sh/uv/)

## Setup

`.claude/settings.json`:

```json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|MultiEdit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "uvx agenthook",
            "timeout": 45
          }
        ]
      }
    ]
  }
}
```

See [`agenthook.example.yml`](agenthook.example.yml) for all available configuration options.

## How it works

1. Claude Code triggers the hook after each file edit (git-ignored files are skipped)
2. Fix commands run sequentially (formatting, auto-fix)
3. Check commands run in parallel (linting, type checking)
4. On failure, the edit is blocked with a report describing the issues

## Development

```bash
just setup-dev
```

### Tooling

- Runtime: [uv](https://docs.astral.sh/uv/)
- JS/TS: [Biome](https://biomejs.dev/)
- Python: [Ruff](https://docs.astral.sh/ruff/), [ty](https://docs.astral.sh/ty/), [Poe](https://github.com/nat-n/poethepoet), [pytest](https://docs.pytest.org/)
- Project template: [Copier](https://copier.readthedocs.io/)
- Task runner: [just](https://github.com/casey/just)
- Git hooks: [Lefthook](https://github.com/evilmartians/lefthook)

## Dependencies

Automated via [Renovate](https://docs.renovatebot.com/).
Dependency update PRs are created automatically.

## Release

Automated via [release-please](https://github.com/googleapis/release-please).
Merge the auto-generated Release PR to bump version, update [`CHANGELOG.md`](CHANGELOG.md), and create a tag.
