@sugarmo/aicommits 1.15.0 → 1.16.1

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.
Files changed (3) hide show
  1. package/README.md +59 -117
  2. package/dist/cli.mjs +114 -121
  3. package/package.json +2 -3
package/README.md CHANGED
@@ -63,8 +63,6 @@ For example, you can stage all changes in tracked files with as you commit:
63
63
  aicommits --all # or -a
64
64
  ```
65
65
 
66
- > 👉 **Tip:** Use the `aic` alias if `aicommits` is too long for you.
67
-
68
66
  #### Generate multiple recommendations
69
67
 
70
68
  Sometimes the recommended commit message isn't the best so you want it to generate a few to pick from. You can generate multiple commit messages at once by passing in the `--generate <i>` flag, where 'i' is the number of generated messages:
@@ -82,49 +80,33 @@ If your environment does not provide an interactive TTY, skip prompts explicitly
82
80
  aicommits --confirm # or -y / --yes
83
81
  ```
84
82
 
85
- #### Generate title + optional details
86
-
87
- Enable `details` when you want a body only when the title is not clear enough on its own:
83
+ #### Guide output with Markdown
88
84
 
89
- ```sh
90
- aicommits --details
91
- ```
85
+ Commit message style is now controlled by a Markdown file instead of individual formatting flags.
92
86
 
93
- If you prefer a bullet-list body style:
87
+ By default, aicommits reads `~/.aicommits/message.md`. The file is created automatically on first use.
94
88
 
95
89
  ```sh
96
- aicommits --details --details-style list
90
+ aicommits
97
91
  ```
98
92
 
99
- If you prefer markdown-formatted detail body:
93
+ To use a different Markdown file for one run:
100
94
 
101
95
  ```sh
102
- aicommits --details --details-style markdown
96
+ aicommits --message-file release-message.md
103
97
  ```
104
98
 
105
- #### Default style
106
-
107
- The generator uses a GitHub Copilot-like style by default and prefers commit titles with a concrete file/class/module anchor so commit lists are easier to scan.
108
-
109
- You can still fine-tune output using custom instructions:
110
-
111
- ```sh
112
- aicommits --details --instructions "Use shorter body sentences and prioritize class names in the title"
113
- ```
99
+ The default file includes editable instructions for language, title format, body rules, and style. If you were previously using settings like `type`, `details`, `instructions`, or `conventional-*`, upgrade once and those values will be migrated into `message.md` automatically.
114
100
 
115
- #### Customize conventional format
101
+ #### Post-process the AI response
116
102
 
117
- You can combine conventional commits with custom output format and type mapping:
103
+ You can run an executable after the model responds and before the message is shown or committed.
118
104
 
119
105
  ```sh
120
- aicommits --type conventional --conventional-format "<type>(<scope>): <subject>" --conventional-types '{"feature":"Introduce a feature","bugfix":"Fix defects"}'
106
+ aicommits --post-response-script rewrite-message.sh
121
107
  ```
122
108
 
123
- By default, conventional mode omits scope and uses `type: subject`. You can enable scope preference (for example `refactor(RecentScrollshotController): ...`) when there is a clear dominant file/class/module:
124
-
125
- ```sh
126
- aicommits --conventional-scope true
127
- ```
109
+ The script receives the raw AI message on stdin and must write the final message to stdout.
128
110
 
129
111
  ### Git hook
130
112
 
@@ -199,7 +181,7 @@ aicommits config set api-key=<your-api-key>
199
181
  You can also set multiple configuration options at once by separating them with spaces, like
200
182
 
201
183
  ```sh
202
- aicommits config set api-key=<your-api-key> generate=3 locale=en
184
+ aicommits config set api-key=<your-api-key> generate=3
203
185
  ```
204
186
 
205
187
  ### Options
@@ -207,13 +189,21 @@ aicommits config set api-key=<your-api-key> generate=3 locale=en
207
189
 
208
190
  Required
209
191
 
210
- API key for your chat completions provider.
192
+ API key for your configured API provider.
193
+
194
+ You can also keep the secret outside `config.toml` and reference an environment variable instead:
195
+
196
+ ```toml
197
+ api-key = "env:OPENAI_API_KEY"
198
+ ```
199
+
200
+ `${OPENAI_API_KEY}` is also supported if you prefer shell-style syntax.
211
201
 
212
202
  #### base-url
213
203
 
214
204
  Required
215
205
 
216
- Base URL used for chat completions requests.
206
+ Base URL used for API requests.
217
207
 
218
208
  ```sh
219
209
  aicommits config set base-url=https://api.openai.com/v1
@@ -242,13 +232,6 @@ model = "gpt-5.2-codex"
242
232
  base-url = "https://api.example.com/v1"
243
233
  ```
244
234
 
245
- #### locale
246
- Default: `en`
247
-
248
- The locale to use for the generated commit messages. Consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes.
249
-
250
- Common aliases are normalized automatically (for example `cn` -> `zh-CN`).
251
-
252
235
  #### generate
253
236
 
254
237
  Default: `1`
@@ -271,7 +254,20 @@ aicommits config set proxy=
271
254
 
272
255
  Default: `gpt-3.5-turbo`
273
256
 
274
- The Chat Completions (`/v1/chat/completions`) model to use.
257
+ The model to use for generation.
258
+
259
+ #### api-mode
260
+
261
+ Default: `responses`
262
+
263
+ Controls which API primitive aicommits uses.
264
+
265
+ - `responses`: default and recommended for new setups
266
+ - `chat`: legacy compatibility mode
267
+
268
+ ```sh
269
+ aicommits config set api-mode=chat
270
+ ```
275
271
 
276
272
 
277
273
  #### timeout
@@ -308,59 +304,24 @@ Use `0` to switch back to auto mode:
308
304
  aicommits config set context-window=0
309
305
  ```
310
306
 
311
- #### title-length-guide
312
- Guidance target for commit title length.
313
-
314
- Default: `50`
315
-
316
- ```sh
317
- aicommits config set title-length-guide=100
318
- ```
307
+ #### message-path
319
308
 
320
- `max-length` is kept as a compatibility alias.
309
+ Default: `message.md`
321
310
 
322
- #### type
323
-
324
- Default: plain format
325
-
326
- Set commit type formatting:
327
-
328
- ```sh
329
- aicommits config set type=conventional
330
- ```
331
-
332
- #### details
333
-
334
- Default: `false`
335
-
336
- Set this to `true` to allow optional body details. If the title already explains the change clearly, it can still return title only:
337
-
338
- ```sh
339
- aicommits config set details=true
340
- ```
341
-
342
- #### details-style
343
-
344
- Default: `paragraph`
345
-
346
- Controls body formatting when `details=true`.
347
-
348
- Allowed values: `paragraph`, `list`, `markdown`
311
+ Relative paths resolve from `~/.aicommits/`. The referenced Markdown file controls how commit messages should be written.
349
312
 
350
313
  ```sh
351
- aicommits config set details-style=list
352
- aicommits config set details-style=markdown
314
+ aicommits config set message-path=release-message.md
353
315
  ```
354
316
 
355
- #### detail-column-guide
317
+ #### post-response-script
356
318
 
357
- Default: `72`
319
+ Default: empty
358
320
 
359
- Guidance target for where detail/body lines should wrap.
360
- Applies to `paragraph` and `list` styles. `markdown` style keeps original line breaks.
321
+ Relative paths resolve from `~/.aicommits/`. The executable receives the AI response on stdin and must write the final commit message to stdout.
361
322
 
362
323
  ```sh
363
- aicommits config set detail-column-guide=88
324
+ aicommits config set post-response-script=rewrite-message.sh
364
325
  ```
365
326
 
366
327
  #### show-reasoning
@@ -368,7 +329,7 @@ aicommits config set detail-column-guide=88
368
329
  Default: `false`
369
330
 
370
331
  By default, aicommits shows normal analyzing progress.
371
- If the model emits reasoning tokens, it switches to elapsed thinking time (for example `Thinking for 1m 12s`).
332
+ If the API emits reasoning content, it switches to elapsed thinking time (for example `The AI (gpt-5.4) is thinking for 1m 12s`).
372
333
  Enable this option to print full streamed model reasoning (debug mode):
373
334
 
374
335
  ```sh
@@ -381,55 +342,36 @@ Or enable for a single run:
381
342
  aicommits --show-reasoning
382
343
  ```
383
344
 
384
- #### instructions
385
-
386
- Default: empty
387
-
388
- Additional custom prompt instructions:
345
+ #### reasoning-effort
389
346
 
390
- ```sh
391
- aicommits config set instructions="Use short and direct wording"
392
- ```
347
+ Default: unset
393
348
 
394
- #### conventional-format
349
+ Controls the model reasoning effort requested by aicommits.
395
350
 
396
- Default: `<type>[optional (<scope>)]: <commit message>`
351
+ - `none`, `low`, `medium`, `high`, `xhigh`: request an explicit reasoning level
397
352
 
398
- Customize the conventional output template:
353
+ This is the supported way to configure reasoning effort.
354
+ aicommits maps it to `reasoning.effort` for Responses API requests and `reasoning_effort` for Chat requests.
399
355
 
400
356
  ```sh
401
- aicommits config set conventional-format="<type>(<scope>): <subject>"
357
+ aicommits config set reasoning-effort=low
402
358
  ```
403
359
 
404
- #### conventional-types
405
-
406
- Default: built-in conventional type map
407
-
408
- Customize type descriptions with JSON:
409
-
410
- ```sh
411
- aicommits config set conventional-types='{"feature":"Introduce a feature","bugfix":"Fix defects"}'
412
- ```
413
-
414
- #### conventional-scope
415
-
416
- Default: `false`
417
-
418
- When enabled, conventional commits strongly prefer `type(scope): subject` using the primary file/class/module as scope.
419
- When disabled (default), conventional commits prefer `type: subject`.
360
+ Or for a single run:
420
361
 
421
362
  ```sh
422
- aicommits config set conventional-scope=true
363
+ aicommits --reasoning-effort high
423
364
  ```
424
365
 
425
366
  #### request-options
426
367
 
427
368
  Default: empty
428
369
 
429
- Raw JSON object merged into the Chat Completions request body.
370
+ Raw JSON object merged into the selected API request body.
430
371
 
431
- Use this for provider-specific fields (for example, disabling reasoning/thinking when supported).
432
- Internal fields `model`, `messages`, and `stream` are controlled by aicommits and cannot be overridden.
372
+ Use this for provider-specific fields that do not already have a dedicated aicommits option.
373
+ For reasoning effort, prefer `reasoning-effort` instead of passing `reasoning` or `reasoning_effort` manually.
374
+ Internal fields `model`, `messages`, `instructions`, `input`, and `stream` are controlled by aicommits and cannot be overridden.
433
375
 
434
376
  ```sh
435
377
  aicommits config set request-options='{"thinking":{"type":"disabled"}}'
@@ -437,7 +379,7 @@ aicommits config set request-options='{"thinking":{"type":"disabled"}}'
437
379
 
438
380
  ## How it works
439
381
 
440
- This CLI tool runs `git diff` to grab your latest code changes, sends them to your configured chat completions API, then returns the generated commit message.
382
+ This CLI tool runs `git diff` to grab your latest code changes, sends them to your configured API provider using the Responses API by default, then returns the generated commit message. You can switch back to Chat Completions with `api-mode=chat`.
441
383
 
442
384
  Video coming soon where I rebuild it from scratch to show you how to easily build your own CLI tools powered by AI.
443
385