You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: enable JSON dependencies and refine documentation
- uncomment serde and serde_json dependencies to support JSON output
- remove duplicate dependency entries in Cargo.toml
- add debug=false to release profile for optimized builds
- bump package version to 1.5.2 for patch release
- rephrase README sections for improved clarity and consistency
- update features list and configuration examples in README.md
- enhance Docker and git hook usage instructions in README.md
Signed-off-by: mingcheng <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+39-53Lines changed: 39 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@
5
5
6
6

7
7
8
-
A simple tool to help you write Git semantic commit messages by using AI.
8
+
A simple tool to help you write Git semantic commit messages using AI.
9
9
10
10
## References
11
11
@@ -15,20 +15,19 @@ A simple tool to help you write Git semantic commit messages by using AI.
15
15
16
16
## Features
17
17
18
-
- Generates meaningfulcommit messages based on your code changes
19
-
-It allows you to commit straight to the repository and integrate with the Git workflow.
20
-
-The created message can be copied to the clipboard.
21
-
- Easy-to-use command-line interface
22
-
-By using the libgit2 library, there is no need to call an external command for security reasons
23
-
-The system supports multiple AI models that are compatible with the OpenAI API
24
-
-Auto sign-off commit messages, if specified environment is set to `true`
25
-
-Socks5 and HTTP proxy supported
18
+
- Generates meaningful, semantic commit messages from staged changes.
19
+
-Commit directly to the repository with the `--commit` flag or copy the generated message with `--copy`.
20
+
-Output formats: human-readable text, JSON (machine-readable) and table view. JSON output is useful for CI integrations and automation; table view makes it easy to scan multiple suggested lines.
21
+
- Easy-to-use command-line interface with sensible defaults and confirm prompts (can be skipped with `--yes`).
22
+
-Uses libgit2 via the `git2` crate, avoiding external git commands for improved security and performance.
23
+
-Supports multiple OpenAI-compatible models and configurable API base, token, and proxy settings.
24
+
-Optional auto sign-off of commits when `GIT_AUTO_SIGNOFF=true`.
25
+
-Proxy support: HTTP and SOCKS5 (set via `OPENAI_API_PROXY`).
26
26
27
-
## How It Works
28
27
29
-
AIGitCommit looks at your Git staged changes and uses AI to make commit lines that are clear and helpful.
28
+
## How It Works
30
29
31
-
It looks at the diff result and uses machine learning to figure out what your changes were meant to do and why you made them. It then generates a commit message that is clear and helpful.
30
+
AIGitCommit inspects your staged Git changes, summarizes the intent of those changes, and generates clear semantic commit messages. It examines diffs and uses an AI model to infer intent and produce concise, useful commit lines.
32
31
33
32
## Install
34
33
@@ -48,32 +47,33 @@ Those command will auto-download the latest version of the project and install i
48
47
49
48
## Configuration
50
49
51
-
Initially, you must configure your `OPENAI_*` environment variables to request prompts from an OpenAI-compatible API service. Set them as follows in your shell configuration file:
52
-
53
-
-`OPENAI_API_TOKEN`: Your individual OpenAI token
54
-
-`OPENAI_API_BASE`: Your specified openAI request base
55
-
-`OPENAI_MODEL_NAME`: Give the model name you wish to request
56
-
-`OPENAI_API_PROXY`: The proxy address if you need to use a proxy
57
-
-`GIT_AUTO_SIGNOFF`: If you want to sign off your commit messages, set this variable to `true`
50
+
Configuration
58
51
59
-
If your network requirements a proxy to access the API service, you must specify the proxy address using the `OPENAI_API_PROXY` environment variable.
52
+
Before using AIGitCommit, export the following environment variables (for example in your shell profile):
60
53
61
-
For instance, `http://127.0.0.1:1080` is suitable for an HTTP proxy, while `socks://127.0.0.1:1086` is an appropriate choice for a Socks5 proxy.
54
+
-`OPENAI_API_TOKEN`: Your OpenAI-compatible API token.
55
+
-`OPENAI_API_BASE`: The API base URL (useful for alternative providers or local proxies).
56
+
-`OPENAI_MODEL_NAME`: The model name to query (e.g., a GPT-compatible model).
57
+
-`OPENAI_API_PROXY`: Optional. Proxy address for network access (e.g., `http://127.0.0.1:1080` or `socks://127.0.0.1:1086`).
58
+
-`GIT_AUTO_SIGNOFF`: Optional. Set to `true` to append a Signed-off-by line to commits.
62
59
63
60
## Usage
64
61
65
-
The way to use AIGitComment is really simple. For example, you can run `aigitcoment` in the current directory after staging the file to have git commits generated automatically before git commit. Additionally, you may provide the git directory using`aigitcommit <dir>`.
62
+
Run `aigitcommit` in a repository with staged changes. Optionally provide a path to the git directory:`aigitcommit <dir>`.
66
63
67
-
1. You can use `--commit` parameters to commit the changes straight to the repository.
68
-
2. Or you may just copy the commit message to the clipboard by using `--copy`.
64
+
Common flags:
69
65
70
-
If you would like more usage settings, just use `aigitcommit --help` to get more details.
66
+
1.`--commit` commit generated message directly to the repository.
67
+
2.`--copy-to-clipboard` copy the generated message to the clipboard.
68
+
3.`--json` print the suggestions as JSON for CI or automation.
69
+
4.`--yes` skip confirmation prompts and apply the default action.
70
+
5.`--signoff` append a Signed-off-by line to the commit message.
71
71
72
-
### Docker Image
72
+
See `aigitcommit --help` for the full list of options.
73
73
74
-
You can also utilise the Docker image without installing the binary executable file.
74
+
### Docker image
75
75
76
-
Simply enter the subsequent command or reference the `compose.yaml` file.
76
+
AIGitCommit can run in Docker if you prefer not to install the binary locally. Example (read-only repository):
77
77
78
78
```bash
79
79
docker run \
@@ -82,11 +82,11 @@ docker run \
82
82
-e OPENAI_API_BASE='<api base>' \
83
83
-e OPENAI_API_TOKEN='<api token>' \
84
84
-e OPENAI_MODEL_NAME='<model name>' \
85
-
-e OPENAI_API_PROXY='<the proxy address if you need>' \
85
+
-e OPENAI_API_PROXY='<proxy if needed>' \
86
86
ghcr.io/mingcheng/aigitcommit
87
87
```
88
88
89
-
Notice: If you wish to utilise the `--commit`option, you must ensure that the `/repo` directory is writable:
89
+
If you want to use `--commit`from inside the container, mount the repo as writable and run interactively:
90
90
91
91
```bash
92
92
docker run \
@@ -96,41 +96,27 @@ docker run \
96
96
-e OPENAI_API_BASE='<api base>' \
97
97
-e OPENAI_API_TOKEN='<api token>' \
98
98
-e OPENAI_MODEL_NAME='<model name>' \
99
-
-e OPENAI_API_PROXY='<the proxy address if you need>' \
99
+
-e OPENAI_API_PROXY='<proxy if needed>' \
100
100
ghcr.io/mingcheng/aigitcommit --commit
101
101
```
102
102
103
-
Tips: You can add `--yes`options to skip the confirm.
103
+
Use `--yes` to skip interactive confirmations.
104
104
105
-
### Git Hook
105
+
### Git hook
106
106
107
-
The `AIGitCommit` also supports git hooks. To integrate the hook, simply copy the `hooks/prepare-commit-msg`file into the repository's `.git/hooks/prepare-commit-msg`, and you're done.
107
+
AIGitCommit ships a `hooks/prepare-commit-msg`hook you can copy into a repository's `.git/hooks/prepare-commit-msg` to automatically generate commit messages during `git commit`.
108
108
109
-
You can make it global by using Git's `core.hooksPath` instead of setting it up per repository.
109
+
To install globally:
110
110
111
-
```
112
-
# Create global hooks directory
111
+
```bash
113
112
mkdir -p ~/.git-hooks
114
-
115
-
# Copy the script contents above into this file
116
-
vim ~/.git-hooks/prepare-commit-msg # Or use your preferred editor
117
-
118
-
# Make the script executable
113
+
# copy the file from this project into ~/.git-hooks/prepare-commit-msg
119
114
chmod +x ~/.git-hooks/prepare-commit-msg
120
-
121
-
# Configure Git to use global hooks
122
115
git config --global core.hooksPath ~/.git-hooks
123
116
```
124
117
125
-
Now every repository automatically gets `AIGitCommit` commit messages, just use `git commit` command.
126
-
127
-
128
-
## Contributing
129
-
130
-
Contributions are welcome! Please feel free to submit a Pull Request.
118
+
After installing the hook, `git commit` will run the hook and populate the commit message. Use `--no-verify` to bypass hooks when necessary.
131
119
132
120
## License
133
121
134
-
This project is licensed under the MIT License - see the LICENSE file for details.
135
-
136
-
`- eof -`
122
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
0 commit comments