Compare commits
9 Commits
0.0.4
...
6c18e41b00
| Author | SHA1 | Date | |
|---|---|---|---|
| 6c18e41b00 | |||
| 3f5c2cec4f | |||
|
|
7f4c75e606 | ||
| a6dde44a84 | |||
| 5cc850b8a9 | |||
| ad14e31b75 | |||
| 22972d578c | |||
| a48f4638c0 | |||
| b50de01653 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
||||
* text=auto eol=lf
|
||||
@@ -1,3 +1,9 @@
|
||||

|
||||
|
||||
<p align="center">
|
||||
<img width="600" src="./docs/ait.webp">
|
||||
</p>
|
||||
|
||||
# AI-Generated Messages from Git Diffs and Logs
|
||||
|
||||
This script uses the OpenAI API to generate text based on the outputs of `git diff` and `git log` commands. It can be particularly useful for creating pull request descriptions, commit messages, or any other narrative that requires summarizing changes between different branches or commits in a Git repository.
|
||||
|
||||
@@ -6,5 +6,5 @@
|
||||
"prompt": "Generate a concise commit message based on the provided Git diffs, including:\\n - A short and direct subject line (under 50 characters) summarizing the specific changes. No formatting should be used in the subject line.\\n - A brief bullet-point list of the exact modifications made, with basic Markdown formatting allowed in the body.\\n \\n Focus strictly on the changes themselves, avoiding any speculation about the reasons or potential impacts. Ensure that the message is informative enough to understand the changes without needing additional context.",
|
||||
"model": "gpt-4o",
|
||||
"max_tokens": 1000,
|
||||
"temperature": 0.7
|
||||
"temperature": 0.6
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
"diff_expression": "main...",
|
||||
"log_expression": "main...",
|
||||
"system_prompt": "**You are an automatic pull request message generator and an expert in this field!**",
|
||||
"prompt": "Generate a concise pull request message based on the provided Git diffs, including:\\n - A short and direct subject line (under 50 characters) summarizing the specific changes. No formatting should be used in the subject line.\\n - A brief bullet-point list of the exact modifications made, with basic Markdown formatting allowed in the body.\\n - A detailed description in Markdown format explaining the changes, their purpose, and any additional context that is relevant for the reviewers.\\n \\n Focus strictly on the changes themselves, avoiding any speculation about the reasons or potential impacts beyond the modifications. Ensure that the message is informative enough to understand the changes and their context for a comprehensive review.",
|
||||
"prompt": "Generate a concise pull request message based on the provided Git diffs, including:\\n - A short and direct subject line (under 50 characters) summarizing the specific changes. No formatting should be used in the subject line.\\n - A brief bullet-point list of the exact modifications made, with basic Markdown formatting allowed in the body.\\n - A detailed description in Markdown format explaining the changes, and any additional context that is relevant for the reviewers.\\n \\n Focus strictly on the changes themselves, avoiding any speculation about the reasons or potential impacts.\\n **Do not include any closing statements or generic sentences. End the message immediately after providing the necessary details.**",
|
||||
"model": "gpt-4o",
|
||||
"max_tokens": 1000,
|
||||
"temperature": 0.7
|
||||
"max_tokens": 2000,
|
||||
"temperature": 0.6
|
||||
}
|
||||
2
ait.py
2
ait.py
@@ -64,7 +64,7 @@ def run_git_commands(diff_expression, log_expression):
|
||||
diff_command = ["git", "diff", diff_expression]
|
||||
diff_result = subprocess.run(diff_command, capture_output=True, text=True)
|
||||
|
||||
log_command = ["git", "log", log_expression, "--pretty=format:%h %s%n%b%n---%n"]
|
||||
log_command = ["git", "log", log_expression, "--pretty=\"format:%h%n%ad%n%s%n%n%b%n---%n\""]
|
||||
log_result = subprocess.run(log_command, capture_output=True, text=True)
|
||||
|
||||
return diff_result.stdout, log_result.stdout
|
||||
|
||||
BIN
docs/ait.webp
Normal file
BIN
docs/ait.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 306 KiB |
Reference in New Issue
Block a user