aicommit2 2.4.25 → 2.4.27
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 +87 -1
- package/dist/cli.mjs +118 -114
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -255,10 +255,24 @@ aicommit2 config set forceGit=true
|
|
|
255
255
|
**Features:**
|
|
256
256
|
|
|
257
257
|
- Automatic detection of `.jj` repositories (prioritized over Git since jj v0.34.0+ uses colocated repos)
|
|
258
|
-
- Uses `jj describe`
|
|
258
|
+
- Uses `jj describe` to set commit message (does NOT run `jj new` by default)
|
|
259
259
|
- Supports Jujutsu's fileset syntax for file exclusions
|
|
260
260
|
- Works seamlessly with colocated Git repositories
|
|
261
261
|
|
|
262
|
+
**jj new Behavior:**
|
|
263
|
+
|
|
264
|
+
By default, AICommit2 only runs `jj describe` to set the commit message, without creating a new changeset. This matches the workflow of many Jujutsu users who prefer to manually control when to run `jj new`.
|
|
265
|
+
|
|
266
|
+
To automatically run `jj new` after describing (mimics `jj commit` behavior):
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Via CLI flag
|
|
270
|
+
aicommit2 --jj-auto-new
|
|
271
|
+
|
|
272
|
+
# Or via config (persistent)
|
|
273
|
+
aicommit2 config set jjAutoNew=true
|
|
274
|
+
```
|
|
275
|
+
|
|
262
276
|
**Installation:**
|
|
263
277
|
|
|
264
278
|
```bash
|
|
@@ -362,6 +376,11 @@ aicommit2 --all # or -a
|
|
|
362
376
|
- When enabled, shows detailed log messages including readline errors and other diagnostic information
|
|
363
377
|
- Useful for troubleshooting issues or understanding the tool's internal operations
|
|
364
378
|
- Can also be set via config: `aicommit2 config set logLevel=verbose`
|
|
379
|
+
- `--output` or `-o`: Output format for non-interactive mode (default: **none**)
|
|
380
|
+
- Use `--output json` for JSON Lines format (one JSON object per line)
|
|
381
|
+
- Outputs `{"subject":"...","body":"..."}` for each generated message
|
|
382
|
+
- Designed for integration with tools like [LazyGit](#lazygit-integration)
|
|
383
|
+
- Skips TUI and exits after outputting messages
|
|
365
384
|
|
|
366
385
|
Examples:
|
|
367
386
|
|
|
@@ -382,6 +401,73 @@ aicommit2 -d -c
|
|
|
382
401
|
aicommit2 --verbose # or -v
|
|
383
402
|
```
|
|
384
403
|
|
|
404
|
+
### LazyGit Integration
|
|
405
|
+
|
|
406
|
+
AICommit2 supports non-interactive JSON output mode for seamless integration with [LazyGit](https://github.com/jesseduffield/lazygit).
|
|
407
|
+
|
|
408
|
+
#### Setup
|
|
409
|
+
|
|
410
|
+
Use the `--output json` flag to get AI-generated commit messages in JSON Lines format:
|
|
411
|
+
|
|
412
|
+
```sh
|
|
413
|
+
aicommit2 --output json
|
|
414
|
+
# Output: {"subject":"feat: add user authentication","body":""}
|
|
415
|
+
# Output: {"subject":"fix: resolve login bug","body":"Fixes issue with session handling"}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Each line is a separate JSON object with `subject` and `body` fields, compatible with LazyGit's `menuFromCommand` prompt type.
|
|
419
|
+
|
|
420
|
+
#### LazyGit Configuration
|
|
421
|
+
|
|
422
|
+
Add the following to your LazyGit config file (`~/.config/lazygit/config.yml` or `~/Library/Application Support/lazygit/config.yml` on macOS):
|
|
423
|
+
|
|
424
|
+
```yaml
|
|
425
|
+
customCommands:
|
|
426
|
+
# AI commit with body (Shift+C in files panel)
|
|
427
|
+
- key: "C"
|
|
428
|
+
context: "files"
|
|
429
|
+
description: "AI commit with aicommit2"
|
|
430
|
+
prompts:
|
|
431
|
+
- type: "menuFromCommand"
|
|
432
|
+
title: "Select commit message"
|
|
433
|
+
key: "Commit"
|
|
434
|
+
command: "aicommit2 --output json --include-body"
|
|
435
|
+
filter: '"subject":"(?P<subject>[^"]+)","body":"(?P<body>[^"]*)"'
|
|
436
|
+
valueFormat: '{{ .subject }}<SEP>{{ .body }}'
|
|
437
|
+
labelFormat: '{{ .subject }}'
|
|
438
|
+
command: bash -c 'MSG="{{ .Form.Commit }}" && SUBJ="${MSG%%<SEP>*}" && BODY="${MSG#*<SEP>}" && git commit -m "$SUBJ" ${BODY:+-m "$BODY"}'
|
|
439
|
+
|
|
440
|
+
# AI commit with editable subject and body (Shift+A in files panel)
|
|
441
|
+
- key: "A"
|
|
442
|
+
context: "files"
|
|
443
|
+
description: "AI commit (editable)"
|
|
444
|
+
prompts:
|
|
445
|
+
- type: "menuFromCommand"
|
|
446
|
+
title: "Select commit message"
|
|
447
|
+
key: "Subject"
|
|
448
|
+
command: "aicommit2 --output json"
|
|
449
|
+
filter: '"subject":"(?P<subject>[^"]+)"'
|
|
450
|
+
valueFormat: '{{ .subject }}'
|
|
451
|
+
labelFormat: '{{ .subject }}'
|
|
452
|
+
- type: "input"
|
|
453
|
+
title: "Edit subject"
|
|
454
|
+
key: "FinalSubject"
|
|
455
|
+
initialValue: '{{ .Form.Subject }}'
|
|
456
|
+
- type: "input"
|
|
457
|
+
title: "Add body (optional)"
|
|
458
|
+
key: "Body"
|
|
459
|
+
initialValue: ''
|
|
460
|
+
command: bash -c 'git commit -m "{{ .Form.FinalSubject }}" {{ if .Form.Body }}-m "{{ .Form.Body }}"{{ end }}'
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### Usage in LazyGit
|
|
464
|
+
|
|
465
|
+
1. Stage your changes in LazyGit
|
|
466
|
+
2. Press `Shift+C` to generate AI commit messages and select one
|
|
467
|
+
3. Or press `Shift+A` to generate messages with the ability to edit before committing
|
|
468
|
+
|
|
469
|
+
> **Note:** The editable mode (`Shift+A`) currently supports editing the subject only. The AI-generated body is not carried over to the edit prompt.
|
|
470
|
+
|
|
385
471
|
### Git hook
|
|
386
472
|
|
|
387
473
|
You can also integrate _aicommit2_ with Git via the [`prepare-commit-msg`](https://git-scm.com/docs/githooks#_prepare_commit_msg) hook. This lets you use Git like you normally would, and edit the commit message before committing.
|