Skip to content

Commit 1ca1468

Browse files
author
Dave Horner
committed
feat: add README with project overview, installation instructions, and usage details
- Added a new README.md file that outlines the purpose of the Rust GenAI-Powered Conventional Commit Generator, including its features, installation prerequisites, setup instructions, usage workflow, output logs, and an example.
1 parent 77f313a commit 1ca1468

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

README.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
# Rust GenAI-Powered Conventional Commit Generator
3+
4+
## Overview
5+
6+
This tool generates concise or lengthy, Conventional Commit-compatible commit messages using GPT-4o-mini (ChatGPT), based on your Git diff outputs. It intelligently handles both staged and unstaged changes, progressively refining commit suggestions based on user feedback, and can copy the final commit message directly to your clipboard.
7+
8+
## Features
9+
10+
- **Intelligent Commit Message Generation:** Leverages AI to analyze Git diffs and generate clear, descriptive commit messages.
11+
- **Interactive Refinement:** If the initial suggestion isn't suitable, the tool progressively refines the prompt to generate better commit messages.
12+
- **Clipboard Integration:** Offers the convenience of copying commit messages directly to the clipboard.
13+
- **Detailed Logging:** Maintains logs of both generated commit messages and refined prompts for easy reference.
14+
15+
## Installation
16+
17+
### Prerequisites
18+
19+
- Rust and Cargo installed
20+
- Access to the GPT-4o-mini model (requires an OpenAI API key)
21+
22+
### Setup
23+
24+
1. Clone the repository:
25+
26+
```sh
27+
git clone https://github.com/davehorner/mkcmt.git
28+
cd mkcmt
29+
cargo install --path .
30+
```
31+
32+
33+
2. **Set API Key**
34+
35+
Set your OpenAI API key in the environment variable:
36+
37+
```bash
38+
export OPENAI_API_KEY="your-api-key-here"
39+
```
40+
41+
42+
## Usage
43+
44+
run mkcmt in a git folder with some changes. follow the prompts.
45+
46+
47+
### Workflow:
48+
49+
- The tool checks for both staged (`git diff --cached`) and unstaged (`git diff`) changes.
50+
- Prompts whether to combine staged and unstaged changes if both exist.
51+
- Queries ChatGPT for a suitable commit message based on the provided diff.
52+
- Presents the commit message and prompts for acceptance.
53+
- If accepted, optionally copies it to the clipboard.
54+
- If declined, GPT is used iteratively to refine the prompt until an acceptable commit message is produced.
55+
56+
## Output Logs
57+
58+
The tool maintains two log files for transparency and auditing purposes:
59+
60+
- `cc` stands for conventional commit
61+
62+
- `output_cc_suggestions.txt`
63+
- Logs each generated commit message, clearly separated.
64+
65+
- `output_cc_prompts.txt`
66+
- Logs each refined prompt used for subsequent message generation.
67+
68+
The logs are continually appended with clear separators, facilitating easy review and continuous improvement.
69+
70+
## Requirements
71+
72+
- Rust
73+
- OPENAI_API_KEY key for GPT-4o-mini accessible via your environment.
74+
- git must be installed and accessible via command line.
75+
76+
77+
## Example
78+
79+
```
80+
$ cargo run
81+
Both staged and unstaged changes detected.
82+
Include both staged and unstaged changes in commit message? (y/n): y
83+
84+
Querying ChatGPT for commit message...
85+
86+
Suggested commit message:
87+
feat: implement interactive AI-powered commit message generation tool
88+
89+
Accept this commit message? (y/n): n
90+
Refining prompt for a better commit message...
91+
92+
Querying ChatGPT again with refined prompt...
93+
94+
Suggested commit message:
95+
feat: add interactive refinement for better commit message accuracy based on user feedback
96+
97+
Accept this commit message? (y/n): y
98+
99+
Copy commit message to clipboard? (y/n): y
100+
Commit message copied to clipboard.
101+
```
102+
103+
## License
104+
105+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
106+

0 commit comments

Comments
 (0)