---
slug: "pi-commit-message"
source_type: "readme"
source_url: "https://cdn.jsdelivr.net/gh/s1lver091/pi-commit-message@main/README.md"
repo: "https://github.com/s1lver091/pi-commit-message"
source_file: "README.md"
branch: "main"
---
# pi-commit-message

[pi](https://github.com/badlogic/pi-mono) extension that adds the `/commit` command to generate Conventional Commits messages from staged diffs and commit directly.

## Features

- Generates Conventional Commits messages using the active LLM
- Interactive confirmation loop: commit, edit, regenerate, or cancel
- Animated loader during message generation
- Smart scope detection from changed files
- Handles edge cases: initial commits, merge resolutions, large diffs, binary files
- Safe git operations using array-form arguments

## Installation

### From npm

```bash
pi install npm:pi-commit-message
```

### From GitHub

```bash
pi install git:github.com/s1lver091/pi-commit-message
```

### Local development

```bash
pi install /path/to/pi-commit-message
```

## Usage

```
/commit                              # generates message from diff
/commit closes #42                  # adds extra context to the LLM
/commit feat(auth): add login       # bypasses generation with explicit message
/commit:config                      # open settings
```

### Extra context

You can pass custom instructions to influence the message generation:

```
/commit write in Italian
/commit focus on the API changes
```

## Configuration

Run `/commit:config` to customize:

- **Max diff length**: Controls when to prompt for truncation (1000–50000 chars)
- **Verbosity**: Controls message length and detail level
  - **Short** — single subject line, max 50 chars
  - **Simple** — subject line, max 72 chars
  - **Normal** — subject + standard Conventional Commits rules (default)
  - **Verbose** — subject + explanatory body

Settings are stored in:
```
~/.pi/agent/data/commit-message/commit-message-settings.json
```

## Local verification

```bash
npm run check
```

## Project structure

```
├── extensions/
│   └── commit-message.ts    — main extension implementation
├── tests/
│   ├── commit-message.test.ts  — automated tests
│   ├── functions.test.ts      — pure function tests
├── package.json
└── README.md
```

## License

MIT
