# nit

> A lightweight, zero-dependency Git hooks manager for JavaScript and Node.js projects.

A Git hooks manager that reads its configuration straight from `package.json`. It needs no extra config files and no dependencies.

## Features

- Zero runtime dependencies.
- Configuration lives under the `"nit"` key in `package.json`.
- Hooks install automatically through the `prepare` lifecycle script.
- A `check` command exits with code 1 when installed hooks drift from the config, which keeps CI honest.
- Staged hooks run commands only on files that match a glob pattern.
- Works with any package manager: Bun, npm, pnpm, or Yarn.

## Usage

```json
{
  "nit": {
    "hooks": {
      "pre-commit": "bun run lint && bun run typecheck",
      "commit-msg": "bun run test"
    }
  }
}
```

Hooks can also target only staged files that match a pattern:

```json
{
  "nit": {
    "hooks": {
      "pre-commit": {
        "stages": {
          "**/*.{ts,js}": "biome check --write {staged_files}"
        }
      }
    }
  }
}
```

## CLI

- `nit install`: Writes hooks to `.git/hooks/`.
- `nit check`: Exits with code 1 if the installed hooks differ from the config.
- `nit exec <hook>`: Runs a staged hook against the currently staged files.
