@kyubiware/commit-mint 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -154
- package/dist/cli.mjs +297 -191
- package/dist/cli.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
# commit-mint
|
|
1
|
+
# 🌿 commit-mint
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@kyubiware/commit-mint)
|
|
4
4
|
[](https://github.com/kyubiware/commit-mint/actions)
|
|
5
5
|

|
|
6
6
|
[](LICENSE)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
**AI commit messages that actually handle what goes wrong.**
|
|
9
|
+
|
|
10
|
+
commit-mint generates conventional commit messages from your diff — and when hooks fail, it parses the errors and gives you a recovery menu instead of dumping raw stderr. It auto-groups unrelated changes into separate commits, runs your checks before generating messages, and caches failed attempts for instant retries.
|
|
9
11
|
|
|
10
12
|
```
|
|
11
13
|
┌ commit-mint
|
|
@@ -20,7 +22,7 @@
|
|
|
20
22
|
│
|
|
21
23
|
◇ Committed successfully.
|
|
22
24
|
│
|
|
23
|
-
● ✓
|
|
25
|
+
● ✓ biome
|
|
24
26
|
│ ✓ eslint
|
|
25
27
|
│ ✓ tsc
|
|
26
28
|
│ ✓ vitest
|
|
@@ -35,65 +37,63 @@
|
|
|
35
37
|
└ All groups committed.
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
##
|
|
40
|
+
## Why commit-mint
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
npm install -g @kyubiware/commit-mint
|
|
42
|
-
cmint -a
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
On first run, you'll be prompted for an API key if one isn't set. It's saved for future runs.
|
|
42
|
+
Most AI commit tools generate a message and hope for the best. commit-mint handles the full loop:
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
- **Auto-groups files by intent** — 10 changed files across 3 concerns? Three separate commits, each with its own message. No competitor does this.
|
|
45
|
+
- **Hook failures get a recovery menu** — Parsed errors from biome, tsc, vitest, eslint, and lint-staged. Copy, skip, restage, edit, or cancel. No raw stderr dumps.
|
|
46
|
+
- **Pre-flight checks before AI generation** — `.cmintrc` runs your checks after staging but before the API call, so a failing check never wastes tokens.
|
|
47
|
+
- **Works without OpenAI** — Groq, Cerebras, and Mistral out of the box. No OpenAI key required.
|
|
48
|
+
- **Cached retries** — Failed commit? Fix the error and `cmint --retry` picks up the same message.
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
- **Zero-prompt auto mode** — `cmint -a` stages, groups, generates messages, and commits without a single prompt.
|
|
51
|
-
- **Hook failures handled in-flow** — Parsed error summary with a recovery menu to copy, skip, retry, or edit. No raw stderr dumps.
|
|
52
|
-
- **Multi-provider AI** — Works with Groq, Cerebras, and Mistral out of the box. Per-provider model configuration supported.
|
|
53
|
-
- **Built-in pre-commit checks** — Define checks in a cmint config file and run them before AI generation. A failing check never wastes an API call.
|
|
54
|
-
- **Message caching on failure** — A failed commit caches its message. Fix the error, run `cmint --retry`, and pick up where you left off.
|
|
55
|
-
|
|
56
|
-
## Usage
|
|
50
|
+
## Install
|
|
57
51
|
|
|
58
52
|
```bash
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
npm install -g @kyubiware/commit-mint
|
|
54
|
+
```
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
cmint
|
|
56
|
+
Or try it without installing:
|
|
64
57
|
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
```bash
|
|
59
|
+
npx @kyubiware/commit-mint
|
|
60
|
+
```
|
|
67
61
|
|
|
68
|
-
|
|
69
|
-
cmint -H "refactoring auth module"
|
|
62
|
+
## Quick start
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
cmint
|
|
64
|
+
```bash
|
|
65
|
+
cmint config # set provider + API key (interactive wizard)
|
|
66
|
+
cmint -a # auto-group, generate messages, commit everything
|
|
67
|
+
```
|
|
73
68
|
|
|
74
|
-
|
|
75
|
-
cmint -N
|
|
69
|
+
On first run you'll be prompted for an API key if one isn't configured. It's saved for future runs.
|
|
76
70
|
|
|
77
|
-
|
|
78
|
-
cmint -d
|
|
71
|
+
## Usage
|
|
79
72
|
|
|
80
|
-
|
|
81
|
-
cmint
|
|
82
|
-
cmint
|
|
83
|
-
cmint
|
|
84
|
-
cmint
|
|
73
|
+
```bash
|
|
74
|
+
cmint -a # auto-group and commit everything
|
|
75
|
+
cmint # interactive flow (staging → checks → review → commit)
|
|
76
|
+
cmint -m "feat: ..." # skip AI, use your own message
|
|
77
|
+
cmint -H "context" # pass a hint for better AI messages
|
|
78
|
+
cmint -r # retry last failed commit (cached message)
|
|
79
|
+
cmint -N # skip pre-flight checks
|
|
80
|
+
cmint -d # debug mode (timestamped stderr)
|
|
81
|
+
cmint config # interactive configuration wizard
|
|
85
82
|
```
|
|
86
83
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
|
90
|
-
|
|
91
|
-
|
|
|
92
|
-
|
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
84
|
+
## Comparison
|
|
85
|
+
|
|
86
|
+
| | commit-mint | aicommits | opencommit | cz-git | commitizen |
|
|
87
|
+
|---|:---:|:---:|:---:|:---:|:---:|
|
|
88
|
+
| **Auto-group files into commits** | ✅ | — | — | — | — |
|
|
89
|
+
| **Hook failure recovery menu** | ✅ | — | — | — | — |
|
|
90
|
+
| **Pre-commit checks in-flow** | ✅ | — | — | — | — |
|
|
91
|
+
| **AI message generation** | ✅ | ✅ | ✅ | ✅ | — |
|
|
92
|
+
| **No OpenAI required** | ✅ Groq, Cerebras, Mistral | ✅ Together, Ollama | — default OpenAI | — OpenAI only | n/a |
|
|
93
|
+
| **Message review before commit** | ✅ | ✅ | ✅ | ✅ interactive | ✅ interactive |
|
|
94
|
+
| **Zero-prompt auto mode** | ✅ | ✅ | ✅ | — | — |
|
|
95
|
+
| **Conventional commits** | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
96
|
+
| **Retry cached message** | ✅ | — | — | ✅ | — |
|
|
97
97
|
|
|
98
98
|
## Modes
|
|
99
99
|
|
|
@@ -101,41 +101,26 @@ cmint config set model openai/gpt-oss-20b
|
|
|
101
101
|
|
|
102
102
|
`cmint -a` runs the full pipeline with no prompts:
|
|
103
103
|
|
|
104
|
-
1.
|
|
105
|
-
2.
|
|
106
|
-
3.
|
|
107
|
-
4.
|
|
108
|
-
5. Hook failures
|
|
104
|
+
1. Excluded files (lockfiles, generated) are committed upfront.
|
|
105
|
+
2. `.cmintrc` checks run before AI grouping.
|
|
106
|
+
3. AI groups files into logical commits by intent.
|
|
107
|
+
4. Each group gets a generated conventional commit message.
|
|
108
|
+
5. Groups are committed sequentially. Hook failures pause the sequence with a recovery menu.
|
|
109
109
|
|
|
110
110
|
### Manual mode
|
|
111
111
|
|
|
112
112
|
Run `cmint` without flags for the interactive flow:
|
|
113
113
|
|
|
114
|
-
1. **Staging menu** — stage all, select files, auto-group, or run checks
|
|
115
|
-
2. **
|
|
116
|
-
3. **Message review** — review the AI
|
|
117
|
-
4. **Commit
|
|
118
|
-
|
|
119
|
-
If only one file changed, it's staged automatically.
|
|
120
|
-
|
|
121
|
-
## Providers
|
|
122
|
-
|
|
123
|
-
commit-mint supports multiple AI providers with per-provider configuration:
|
|
124
|
-
|
|
125
|
-
| Provider | Env key | Default model |
|
|
126
|
-
|----------|---------|---------------|
|
|
127
|
-
| **Groq** | `GROQ_API_KEY` | `openai/gpt-oss-20b` |
|
|
128
|
-
| **Cerebras** | `CEREBRAS_API_KEY` | `gpt-oss-120b` |
|
|
129
|
-
| **Mistral** | `MISTRAL_API_KEY` | `mistral-small` |
|
|
130
|
-
|
|
131
|
-
Switch providers with `cmint config set provider <name>`. Override the model per-provider with `cmint config set model_cerebras <model>`.
|
|
114
|
+
1. **Staging menu** — stage all, select files, auto-group, or run checks.
|
|
115
|
+
2. **Pre-flight checks** — `.cmintrc` checks run automatically (skip with `-N`).
|
|
116
|
+
3. **Message review** — review the AI message before committing.
|
|
117
|
+
4. **Commit** — hooks run, recovery menu on failure.
|
|
132
118
|
|
|
133
|
-
|
|
134
|
-
> All providers use OpenAI-compatible APIs. Groq uses the official SDK; Cerebras and Mistral use a built-in fetch client.
|
|
119
|
+
Single-file changes are staged automatically.
|
|
135
120
|
|
|
136
121
|
## Recovery menu
|
|
137
122
|
|
|
138
|
-
When a pre-commit hook blocks your commit, commit-mint parses the error
|
|
123
|
+
When a pre-commit hook blocks your commit, commit-mint parses the error and presents an interactive menu:
|
|
139
124
|
|
|
140
125
|
```
|
|
141
126
|
╭─────────────────────────────────────────────────╮
|
|
@@ -155,116 +140,62 @@ When a pre-commit hook blocks your commit, commit-mint parses the error output a
|
|
|
155
140
|
╰─────────────────────────────────────────────────╯
|
|
156
141
|
```
|
|
157
142
|
|
|
158
|
-
|
|
159
|
-
|--------|-------------|
|
|
160
|
-
| **Copy error report** | Copies parsed, clean error output to clipboard |
|
|
161
|
-
| **View full output** | Shows raw stderr from the failed hook |
|
|
162
|
-
| **Skip hooks** | Re-runs `git commit --no-verify` with the same message |
|
|
163
|
-
| **Re-stage & retry** | Runs `git add -A` again, then retries the commit |
|
|
164
|
-
| **Edit message** | Opens a prompt to modify the commit message, then retries |
|
|
165
|
-
| **Cancel** | Exits. Commit message is cached for `cmint --retry` |
|
|
166
|
-
|
|
167
|
-
Errors are parsed from **lint-staged**, **biome**, **TypeScript** (`tsc`), **vitest**/**jest**, and **ESLint**. Unrecognized output falls back to raw stderr.
|
|
143
|
+
Errors are parsed from **lint-staged**, **biome**, **tsc**, **vitest**/**jest**, and **eslint**. Unrecognized output falls back to raw stderr.
|
|
168
144
|
|
|
169
|
-
## Pre-
|
|
145
|
+
## Pre-flight checks
|
|
170
146
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
`.cmintrc`, `.cmintrc.json`, `.cmintrc.{mjs,mts,js,ts,cjs,cts}`, `cmint.config.{mjs,mts,js,ts,cjs,cts}`
|
|
174
|
-
|
|
175
|
-
Checks run after staging, before AI message generation, so a failing check never wastes an API call.
|
|
147
|
+
`.cmintrc` is commit-mint's in-flow replacement for lint-staged. Define checks once at your project root and commit-mint runs them after staging but before AI generation — so failing checks never waste an API call.
|
|
176
148
|
|
|
177
149
|
```js
|
|
150
|
+
// .cmintrc.ts
|
|
178
151
|
export default {
|
|
179
|
-
// String: matched files are appended as arguments
|
|
180
152
|
"*.{js,ts,json}": "biome check --write --no-errors-on-unmatched",
|
|
181
|
-
|
|
182
|
-
// Function: receive matched filenames, return command(s)
|
|
183
153
|
"*.ts": () => ["tsc --noEmit", "vitest run --passWithNoTests"],
|
|
184
154
|
};
|
|
185
155
|
```
|
|
186
156
|
|
|
187
|
-
Glob patterns use [picomatch](https://github.com/micromatch/picomatch). String commands receive matched files as trailing arguments. Functions receive the
|
|
188
|
-
|
|
189
|
-
### TypeScript config
|
|
190
|
-
|
|
191
|
-
Use `.cmintrc.ts` or `cmint.config.ts` for type safety without adding commit-mint as a project dependency:
|
|
192
|
-
|
|
193
|
-
```ts
|
|
194
|
-
interface Cmintrc {
|
|
195
|
-
[glob: string]: string | string[] | ((filenames: string[]) => string | string[]);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export default {
|
|
199
|
-
"*.{js,ts,json}": "biome check --write --no-errors-on-unmatched",
|
|
200
|
-
"*.ts": () => ["tsc --noEmit", "vitest run --passWithNoTests"],
|
|
201
|
-
} satisfies Cmintrc;
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
This gives you editor autocomplete and catches invalid values at edit time — no package install needed.
|
|
205
|
-
|
|
206
|
-
Checks execute sequentially and fail fast. Each command has a 60-second timeout.
|
|
157
|
+
Glob patterns use [picomatch](https://github.com/micromatch/picomatch). String commands receive matched files as trailing arguments. Functions receive the file list and return one or more commands. Checks run sequentially and fail fast (60s timeout per command).
|
|
207
158
|
|
|
208
|
-
|
|
159
|
+
Supported config file names: `.cmintrc`, `.cmintrc.json`, `.cmintrc.{mjs,mts,js,ts,cjs,cts}`, `cmint.config.{mjs,mts,js,ts,cjs,cts}`
|
|
209
160
|
|
|
210
|
-
|
|
161
|
+
## Providers
|
|
211
162
|
|
|
212
|
-
|
|
|
213
|
-
|
|
214
|
-
| **
|
|
215
|
-
| **
|
|
216
|
-
| **
|
|
217
|
-
| **Cancel** | Exits. Message is cached for `cmint --retry` |
|
|
163
|
+
| Provider | Env key | Default model |
|
|
164
|
+
|----------|---------|---------------|
|
|
165
|
+
| **Groq** | `GROQ_API_KEY` | `openai/gpt-oss-20b` |
|
|
166
|
+
| **Cerebras** | `CEREBRAS_API_KEY` | `gpt-oss-120b` |
|
|
167
|
+
| **Mistral** | `MISTRAL_API_KEY` | `mistral-small` |
|
|
218
168
|
|
|
219
|
-
|
|
169
|
+
Use `cmint config` to switch providers or override the model per-provider. All providers use OpenAI-compatible APIs (Groq via official SDK, Cerebras and Mistral via built-in fetch client).
|
|
220
170
|
|
|
221
171
|
## Configuration
|
|
222
172
|
|
|
223
|
-
Stored in `~/.commit-mint` (INI format).
|
|
224
|
-
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
GROQ_API_KEY=gsk_...
|
|
228
|
-
model=openai/gpt-oss-20b
|
|
229
|
-
locale=en
|
|
230
|
-
max-length=100
|
|
231
|
-
type=conventional
|
|
232
|
-
timeout=10000
|
|
233
|
-
proxy=
|
|
173
|
+
Stored in `~/.commit-mint` (INI format). Run the wizard:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
cmint config
|
|
234
177
|
```
|
|
235
178
|
|
|
236
179
|
| Key | Default | Description |
|
|
237
180
|
|-----|---------|-------------|
|
|
238
181
|
| `provider` | `groq` | AI provider (`groq`, `cerebras`, or `mistral`) |
|
|
239
|
-
| `
|
|
240
|
-
| `CEREBRAS_API_KEY` | — | Cerebras API key (or set `CEREBRAS_API_KEY` env var) |
|
|
241
|
-
| `MISTRAL_API_KEY` | — | Mistral API key (or set `MISTRAL_API_KEY` env var) |
|
|
242
|
-
| `model` | `openai/gpt-oss-20b` | Default AI model for message generation |
|
|
243
|
-
| `model_groq` | — | Model override for Groq provider |
|
|
244
|
-
| `model_cerebras` | — | Model override for Cerebras provider |
|
|
245
|
-
| `model_mistral` | — | Model override for Mistral provider |
|
|
182
|
+
| `model` | `openai/gpt-oss-20b` | Default model (overridable per-provider with `model_groq`, `model_cerebras`, `model_mistral`) |
|
|
246
183
|
| `locale` | `en` | Locale for generated messages |
|
|
247
|
-
| `max-length` | `100` |
|
|
248
|
-
| `type` | — | Commit type prefix
|
|
184
|
+
| `max-length` | `100` | Max commit message length |
|
|
185
|
+
| `type` | — | Commit type prefix |
|
|
249
186
|
| `timeout` | `10000` | AI request timeout in ms |
|
|
250
187
|
| `proxy` | — | Proxy URL for API requests |
|
|
251
188
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
## Retry persistence
|
|
189
|
+
## Excluded files
|
|
255
190
|
|
|
256
|
-
|
|
191
|
+
Lockfiles, build output, and generated files are excluded from AI generation. When all staged files match excludes, commit-mint uses a hardcoded message (`chore: update lockfile` or `chore: update generated files`). In auto-group mode, lockfiles are promoted alongside their companion manifests (e.g. `package-lock.json` with `package.json`).
|
|
257
192
|
|
|
258
193
|
## Requirements
|
|
259
194
|
|
|
260
195
|
- **Node.js 18+**
|
|
261
|
-
- **Git**
|
|
262
|
-
-
|
|
263
|
-
- **xclip**, **wl-copy**, **xsel**, or **pbcopy** for clipboard support
|
|
196
|
+
- **Git**
|
|
197
|
+
- Optional clipboard tool for error copy: `wl-copy`, `xclip`, `xsel`, or `pbcopy`
|
|
264
198
|
|
|
265
|
-
##
|
|
199
|
+
## License
|
|
266
200
|
|
|
267
|
-
|
|
268
|
-
- Not a linter/formatter — use biome, eslint, or prettier.
|
|
269
|
-
- Not a git TUI — use lazygit or gitui.
|
|
270
|
-
- Not a commitizen replacement — generates conventional commit messages via AI.
|
|
201
|
+
[MIT](LICENSE)
|