aicommit2 2.2.15 → 2.2.16
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 +115 -40
- package/dist/cli.mjs +78 -78
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
[](https://github.com/tak-bro/aicommit2/blob/main/LICENSE)
|
|
15
15
|
[](https://www.npmjs.com/package/aicommit2)
|
|
16
16
|
[](https://www.npmjs.com/package/aicommit2)
|
|
17
|
+
[](#nix-installation)
|
|
17
18
|
|
|
18
19
|
</div>
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
______________________________________________________________________
|
|
21
22
|
|
|
22
23
|
## 🚀 Quick Start
|
|
23
24
|
|
|
@@ -59,7 +60,7 @@ _aicommit2_ is a reactive CLI tool that automatically generates Git commit messa
|
|
|
59
60
|
|
|
60
61
|
### Local AI Services
|
|
61
62
|
|
|
62
|
-
- [Ollama](docs/providers/ollama.md)
|
|
63
|
+
- [Ollama](docs/providers/ollama.md)
|
|
63
64
|
|
|
64
65
|
## Setup
|
|
65
66
|
|
|
@@ -80,6 +81,7 @@ aicommit2 config set ANTHROPIC.key=<your key>
|
|
|
80
81
|
```
|
|
81
82
|
|
|
82
83
|
3. Run _aicommit2_ with your staged files in git repository:
|
|
84
|
+
|
|
83
85
|
```shell
|
|
84
86
|
git add <files...>
|
|
85
87
|
aicommit2
|
|
@@ -89,6 +91,54 @@ aicommit2
|
|
|
89
91
|
|
|
90
92
|
### Alternative Installation Methods
|
|
91
93
|
|
|
94
|
+
#### Nix Installation
|
|
95
|
+
|
|
96
|
+
If you use the Nix package manager, aicommit2 can be installed directly using the provided flake:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
# Install temporarily in your current shell
|
|
100
|
+
nix run github:tak-bro/aicommit2
|
|
101
|
+
|
|
102
|
+
# Install permanently to your profile
|
|
103
|
+
nix profile install github:tak-bro/aicommit2
|
|
104
|
+
|
|
105
|
+
# Use the shorter alias
|
|
106
|
+
nix run github:tak-bro/aic2 -- --help
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
##### Using in a Flake-based Project
|
|
110
|
+
|
|
111
|
+
Add aicommit2 to your flake inputs:
|
|
112
|
+
|
|
113
|
+
```nix
|
|
114
|
+
{
|
|
115
|
+
# flake.nix configuration file
|
|
116
|
+
inputs = {
|
|
117
|
+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
118
|
+
aicommit2.url = "github:tak-bro/aicommit2";
|
|
119
|
+
};
|
|
120
|
+
# Rest of your flake.nix file
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
# Somewhere where you define your packages
|
|
124
|
+
{pkgs, inputs, ...}:{
|
|
125
|
+
|
|
126
|
+
environment.systemPackages = [inputs.aicommit2.packages.x86_64-linux.default];
|
|
127
|
+
# Or home packages
|
|
128
|
+
home.packages = [inputs.aicommit2.packages.x86_64-linux.default];
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
##### Development Environment
|
|
133
|
+
|
|
134
|
+
To enter a development shell with all dependencies:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
nix develop github:tak-bro/aicommit2
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
After setting up with Nix, you'll still need to configure API keys as described in the [Setup](#setup) section.
|
|
141
|
+
|
|
92
142
|
#### From Source
|
|
93
143
|
|
|
94
144
|
```sh
|
|
@@ -151,8 +201,9 @@ aicommit2 --all # or -a
|
|
|
151
201
|
- `--pre-commit`: Run in [pre-commit](https://pre-commit.com/) framework mode (default: **false**)
|
|
152
202
|
- This option is specifically for use with the pre-commit framework
|
|
153
203
|
- See [Integration with pre-commit framework](#integration-with-pre-commit-framework) section for setup instructions
|
|
154
|
-
|
|
204
|
+
|
|
155
205
|
Example:
|
|
206
|
+
|
|
156
207
|
```sh
|
|
157
208
|
aicommit2 --locale "jp" --all --type "conventional" --generate 3 --clipboard --exclude "*.json" --exclude "*.ts"
|
|
158
209
|
```
|
|
@@ -177,7 +228,7 @@ if you prefer to set up the hook manually, create or edit the `.git/hooks/prepar
|
|
|
177
228
|
#!/bin/sh
|
|
178
229
|
# your-other-hook "$@"
|
|
179
230
|
aicommit2 --hook-mode "$@"
|
|
180
|
-
|
|
231
|
+
```
|
|
181
232
|
|
|
182
233
|
Make the hook executable:
|
|
183
234
|
|
|
@@ -191,14 +242,14 @@ If you're using the [pre-commit](https://pre-commit.com/) framework, you can add
|
|
|
191
242
|
|
|
192
243
|
```yaml
|
|
193
244
|
repos:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
245
|
+
- repo: local
|
|
246
|
+
hooks:
|
|
247
|
+
- id: aicommit2
|
|
248
|
+
name: AI Commit Message Generator
|
|
249
|
+
entry: aicommit2 --pre-commit
|
|
250
|
+
language: node
|
|
251
|
+
stages: [prepare-commit-msg]
|
|
252
|
+
always_run: true
|
|
202
253
|
```
|
|
203
254
|
|
|
204
255
|
Make sure you have:
|
|
@@ -209,7 +260,6 @@ Make sure you have:
|
|
|
209
260
|
|
|
210
261
|
> **Note** : The `--pre-commit` flag is specifically designed for use with the pre-commit framework and ensures proper integration with other pre-commit hooks.
|
|
211
262
|
|
|
212
|
-
|
|
213
263
|
#### Uninstall
|
|
214
264
|
|
|
215
265
|
In the Git repository you want to uninstall the hook from:
|
|
@@ -224,14 +274,27 @@ Or manually delete the `.git/hooks/prepare-commit-msg` file.
|
|
|
224
274
|
|
|
225
275
|
#### Reading and Setting Configuration
|
|
226
276
|
|
|
227
|
-
- READ: `aicommit2 config get <key
|
|
277
|
+
- READ: `aicommit2 config get [<key> [<key> ...]]`
|
|
228
278
|
- SET: `aicommit2 config set <key>=<value>`
|
|
279
|
+
- DELETE: `aicommit2 config del <config-name>`
|
|
229
280
|
|
|
230
281
|
Example:
|
|
282
|
+
|
|
231
283
|
```sh
|
|
284
|
+
# Get all configurations
|
|
285
|
+
aicommit2 config get
|
|
286
|
+
|
|
287
|
+
# Get specific configuration
|
|
232
288
|
aicommit2 config get OPENAI
|
|
233
289
|
aicommit2 config get GEMINI.key
|
|
290
|
+
|
|
291
|
+
# Set configurations
|
|
234
292
|
aicommit2 config set OPENAI.generate=3 GEMINI.temperature=0.5
|
|
293
|
+
|
|
294
|
+
# Delete a configuration setting or section
|
|
295
|
+
aicommit2 config del OPENAI.key
|
|
296
|
+
aicommit2 config del GEMINI
|
|
297
|
+
aicommit2 config del timeout
|
|
235
298
|
```
|
|
236
299
|
|
|
237
300
|
#### Environment Variables
|
|
@@ -261,17 +324,19 @@ Usage Example:
|
|
|
261
324
|
OPENAI_API_KEY="your-openai-key" ANTHROPIC_API_KEY="your-anthropic-key" aicommit2
|
|
262
325
|
```
|
|
263
326
|
|
|
264
|
-
> **Note**: Environment variables take precedence over configuration file settings.
|
|
327
|
+
> **Note**: Environment variables take precedence over configuration file settings.
|
|
265
328
|
|
|
266
329
|
#### How to Configure in detail
|
|
267
330
|
|
|
268
331
|
1. Command-line arguments: **use the format** `--[Model].[Key]=value`
|
|
332
|
+
|
|
269
333
|
```sh
|
|
270
334
|
aicommit2 --OPENAI.locale="jp" --GEMINI.temperatue="0.5"
|
|
271
335
|
```
|
|
272
336
|
|
|
273
337
|
2. Configuration file: **use INI format in the `~/.aicommit2` file or use `set` command**.
|
|
274
338
|
Example `~/.aicommit2`:
|
|
339
|
+
|
|
275
340
|
```ini
|
|
276
341
|
# General Settings
|
|
277
342
|
logging=true
|
|
@@ -304,7 +369,7 @@ The following settings can be applied to most models, but support may vary.
|
|
|
304
369
|
Please check the documentation for each specific model to confirm which settings are supported.
|
|
305
370
|
|
|
306
371
|
| Setting | Description | Default |
|
|
307
|
-
|
|
372
|
+
| ---------------------- | ------------------------------------------------------------------- | ------------ |
|
|
308
373
|
| `systemPrompt` | System Prompt text | - |
|
|
309
374
|
| `systemPromptPath` | Path to system prompt file | - |
|
|
310
375
|
| `exclude` | Files to exclude from AI analysis | - |
|
|
@@ -322,7 +387,8 @@ Please check the documentation for each specific model to confirm which settings
|
|
|
322
387
|
| `codeReviewPromptPath` | Path to code review prompt file | - |
|
|
323
388
|
| `disabled` | Whether a specific model is enabled or disabled | false |
|
|
324
389
|
|
|
325
|
-
> 👉
|
|
390
|
+
> 👉 **Tip:** To set the General Settings for each model, use the following command.
|
|
391
|
+
>
|
|
326
392
|
> ```shell
|
|
327
393
|
> aicommit2 config set OPENAI.locale="jp"
|
|
328
394
|
> aicommit2 config set CODESTRAL.type="gitmoji"
|
|
@@ -330,6 +396,7 @@ Please check the documentation for each specific model to confirm which settings
|
|
|
330
396
|
> ```
|
|
331
397
|
|
|
332
398
|
##### systemPrompt
|
|
399
|
+
|
|
333
400
|
- Allow users to specify a custom system prompt
|
|
334
401
|
|
|
335
402
|
```sh
|
|
@@ -339,6 +406,7 @@ aicommit2 config set systemPrompt="Generate git commit message."
|
|
|
339
406
|
> `systemPrompt` takes precedence over `systemPromptPath` and does not apply at the same time.
|
|
340
407
|
|
|
341
408
|
##### systemPromptPath
|
|
409
|
+
|
|
342
410
|
- Allow users to specify a custom file path for their own system prompt template
|
|
343
411
|
- Please see [Custom Prompt Template](#custom-prompt-template)
|
|
344
412
|
|
|
@@ -401,7 +469,7 @@ The log files will be stored in the `~/.aicommit2_log` directory(user's home).
|
|
|
401
469
|
|
|
402
470
|

|
|
403
471
|
|
|
404
|
-
- You can remove all logs below
|
|
472
|
+
- You can remove all logs below command.
|
|
405
473
|
|
|
406
474
|
```sh
|
|
407
475
|
aicommit2 log removeAll
|
|
@@ -419,7 +487,6 @@ aicommit2 config set includeBody="true"
|
|
|
419
487
|
|
|
420
488
|

|
|
421
489
|
|
|
422
|
-
|
|
423
490
|
```sh
|
|
424
491
|
aicommit2 config set includeBody="false"
|
|
425
492
|
```
|
|
@@ -514,6 +581,7 @@ aicommit2 config set codeReview=true
|
|
|
514
581
|
- **The code review process consumes a large number of tokens.**
|
|
515
582
|
|
|
516
583
|
##### codeReviewPromptPath
|
|
584
|
+
|
|
517
585
|
- Allow users to specify a custom file path for code review
|
|
518
586
|
|
|
519
587
|
```sh
|
|
@@ -521,24 +589,25 @@ aicommit2 config set codeReviewPromptPath="/path/to/user/prompt.txt"
|
|
|
521
589
|
```
|
|
522
590
|
|
|
523
591
|
## Available General Settings by Model
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
|
527
|
-
|
|
|
528
|
-
|
|
|
529
|
-
|
|
|
530
|
-
|
|
|
531
|
-
|
|
|
532
|
-
|
|
|
533
|
-
|
|
|
534
|
-
|
|
|
535
|
-
|
|
|
536
|
-
|
|
|
592
|
+
|
|
593
|
+
| | timeout | temperature | maxTokens | topP |
|
|
594
|
+
| :-----------------------: | :-----: | :---------: | :-------: | :--: |
|
|
595
|
+
| **OpenAI** | ✓ | ✓ | ✓ | ✓ |
|
|
596
|
+
| **Anthropic Claude** | ✓ | ✓ | ✓ | ✓ |
|
|
597
|
+
| **Gemini** | | ✓ | ✓ | ✓ |
|
|
598
|
+
| **Mistral AI** | ✓ | ✓ | ✓ | ✓ |
|
|
599
|
+
| **Codestral** | ✓ | ✓ | ✓ | ✓ |
|
|
600
|
+
| **Cohere** | ✓ | ✓ | ✓ | ✓ |
|
|
601
|
+
| **Groq** | ✓ | ✓ | ✓ | ✓ |
|
|
602
|
+
| **Perplexity** | ✓ | ✓ | ✓ | ✓ |
|
|
603
|
+
| **DeepSeek** | ✓ | ✓ | ✓ | ✓ |
|
|
604
|
+
| **Ollama** | ✓ | ✓ | | ✓ |
|
|
605
|
+
| **OpenAI API-Compatible** | ✓ | ✓ | ✓ | ✓ |
|
|
537
606
|
|
|
538
607
|
> All AI support the following options in General Settings.
|
|
608
|
+
>
|
|
539
609
|
> - systemPrompt, systemPromptPath, codeReview, codeReviewPromptPath, exclude, type, locale, generate, logging, includeBody, maxLength
|
|
540
610
|
|
|
541
|
-
|
|
542
611
|
## Configuration Examples
|
|
543
612
|
|
|
544
613
|
```
|
|
@@ -554,6 +623,7 @@ aicommit2 config set \
|
|
|
554
623
|
```
|
|
555
624
|
|
|
556
625
|
> 🔍 **Detailed Support Info**: Check each provider's documentation for specific limits and behaviors:
|
|
626
|
+
>
|
|
557
627
|
> - [OpenAI](docs/providers/openai.md)
|
|
558
628
|
> - [Anthropic Claude](docs/providers/anthropic.md)
|
|
559
629
|
> - [Gemini](docs/providers/gemini.md)
|
|
@@ -563,13 +633,14 @@ aicommit2 config set \
|
|
|
563
633
|
> - [Perplexity](docs/providers/perplexity.md)
|
|
564
634
|
> - [DeepSeek](docs/providers/deepseek.md)
|
|
565
635
|
> - [OpenAI API Compatibility](docs/providers/compatible.md)
|
|
566
|
-
> - [Ollama](docs/providers/ollama.md)
|
|
567
|
-
|
|
636
|
+
> - [Ollama](docs/providers/ollama.md)
|
|
637
|
+
|
|
568
638
|
## Custom Prompt Template
|
|
569
639
|
|
|
570
640
|
_aicommit2_ supports custom prompt templates through the `systemPromptPath` option. This feature allows you to define your own prompt structure, giving you more control over the commit message generation process.
|
|
571
641
|
|
|
572
642
|
### Using the systemPromptPath Option
|
|
643
|
+
|
|
573
644
|
To use a custom prompt template, specify the path to your template file when running the tool:
|
|
574
645
|
|
|
575
646
|
```
|
|
@@ -630,7 +701,6 @@ The response should be valid JSON that can be parsed without errors.
|
|
|
630
701
|
|
|
631
702
|
This ensures that the output is consistently formatted as a JSON array, regardless of the custom template used.
|
|
632
703
|
|
|
633
|
-
|
|
634
704
|
## Watch Commit Mode
|
|
635
705
|
|
|
636
706
|

|
|
@@ -642,6 +712,7 @@ aicommit2 --watch-commit
|
|
|
642
712
|
```
|
|
643
713
|
|
|
644
714
|
This feature only works within Git repository directories and automatically triggers whenever a commit event occurs. When a new commit is detected, it automatically:
|
|
715
|
+
|
|
645
716
|
1. Analyzes commit changes
|
|
646
717
|
2. Performs AI code review
|
|
647
718
|
3. Displays results in real-time
|
|
@@ -655,9 +726,10 @@ This feature only works within Git repository directories and automatically trig
|
|
|
655
726
|
- API costs can increase substantially if there are many commits
|
|
656
727
|
- It is recommended to **carefully monitor your token usage** when using this feature
|
|
657
728
|
- To use this feature, you must enable watch mode for at least one AI model:
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
729
|
+
|
|
730
|
+
```sh
|
|
731
|
+
aicommit2 config set [MODEL].watchMode="true"
|
|
732
|
+
```
|
|
661
733
|
|
|
662
734
|
## Upgrading
|
|
663
735
|
|
|
@@ -686,8 +758,11 @@ For bug fixes or feature implementations, please check the [Contribution Guide](
|
|
|
686
758
|
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
|
687
759
|
|
|
688
760
|
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
761
|
+
|
|
689
762
|
<!-- prettier-ignore-start -->
|
|
763
|
+
|
|
690
764
|
<!-- markdownlint-disable -->
|
|
765
|
+
|
|
691
766
|
<table>
|
|
692
767
|
<tr>
|
|
693
768
|
<td align="center"><a href="https://github.com/eltociear"><img src="https://avatars.githubusercontent.com/eltociear" width="100px;" alt=""/><br /><sub><b>@eltociear</b></sub></a><br /><a href="https://github.com/tak-bro/aicommit2/commits?author=eltociear" title="Documentation">📖</a></td>
|
|
@@ -708,7 +783,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
708
783
|
<!-- prettier-ignore-end -->
|
|
709
784
|
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
710
785
|
|
|
711
|
-
|
|
786
|
+
______________________________________________________________________
|
|
712
787
|
|
|
713
788
|
If this project has been helpful, please consider giving it a Star ⭐️!
|
|
714
789
|
|