git-commit-message 0.4.0__tar.gz → 0.5.0__tar.gz
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.
- git_commit_message-0.5.0/PKG-INFO +143 -0
- git_commit_message-0.4.0/PKG-INFO → git_commit_message-0.5.0/README.md +31 -9
- git_commit_message-0.5.0/UNLICENSE +24 -0
- git_commit_message-0.5.0/pyproject.toml +53 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message/_cli.py +1 -1
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message/_gpt.py +61 -43
- git_commit_message-0.5.0/src/git_commit_message.egg-info/PKG-INFO +143 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message.egg-info/SOURCES.txt +1 -0
- git_commit_message-0.4.0/README.md +0 -66
- git_commit_message-0.4.0/pyproject.toml +0 -20
- git_commit_message-0.4.0/src/git_commit_message.egg-info/PKG-INFO +0 -74
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/setup.cfg +0 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message/__init__.py +0 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message/__main__.py +0 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message/_git.py +0 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message.egg-info/dependency_links.txt +0 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message.egg-info/entry_points.txt +0 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message.egg-info/requires.txt +0 -0
- {git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-commit-message
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Generate Git commit messages from staged changes using OpenAI GPT
|
|
5
|
+
Maintainer-email: Mina Her <minacle@live.com>
|
|
6
|
+
License: This is free and unencumbered software released into the public domain.
|
|
7
|
+
|
|
8
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
9
|
+
distribute this software, either in source code form or as a compiled
|
|
10
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
11
|
+
means.
|
|
12
|
+
|
|
13
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
14
|
+
of this software dedicate any and all copyright interest in the
|
|
15
|
+
software to the public domain. We make this dedication for the benefit
|
|
16
|
+
of the public at large and to the detriment of our heirs and
|
|
17
|
+
successors. We intend this dedication to be an overt act of
|
|
18
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
19
|
+
software under copyright law.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
22
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
24
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
25
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
26
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
27
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
For more information, please refer to <https://unlicense.org/>
|
|
30
|
+
|
|
31
|
+
Project-URL: Homepage, https://github.com/minacle/git-commit-message
|
|
32
|
+
Project-URL: Repository, https://github.com/minacle/git-commit-message
|
|
33
|
+
Project-URL: Issues, https://github.com/minacle/git-commit-message/issues
|
|
34
|
+
Classifier: Development Status :: 3 - Alpha
|
|
35
|
+
Classifier: Environment :: Console
|
|
36
|
+
Classifier: Intended Audience :: Developers
|
|
37
|
+
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
|
|
38
|
+
Classifier: Operating System :: OS Independent
|
|
39
|
+
Classifier: Programming Language :: Python
|
|
40
|
+
Classifier: Programming Language :: Python :: 3
|
|
41
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
43
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
44
|
+
Requires-Python: >=3.13
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
Requires-Dist: openai>=2.6.1
|
|
47
|
+
|
|
48
|
+
# git-commit-message
|
|
49
|
+
|
|
50
|
+
Staged changes -> GPT commit message generator.
|
|
51
|
+
|
|
52
|
+
## Install (PyPI)
|
|
53
|
+
|
|
54
|
+
Install the latest released version from PyPI:
|
|
55
|
+
|
|
56
|
+
```fish
|
|
57
|
+
# User environment (recommended)
|
|
58
|
+
python -m pip install --user git-commit-message
|
|
59
|
+
|
|
60
|
+
# Or system/virtualenv as appropriate
|
|
61
|
+
python -m pip install git-commit-message
|
|
62
|
+
|
|
63
|
+
# Or with pipx for isolated CLI installs
|
|
64
|
+
pipx install git-commit-message
|
|
65
|
+
|
|
66
|
+
# Upgrade to the newest version
|
|
67
|
+
python -m pip install --upgrade git-commit-message
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Quick check:
|
|
71
|
+
|
|
72
|
+
```fish
|
|
73
|
+
git-commit-message --help
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Set your API key (fish):
|
|
77
|
+
|
|
78
|
+
```fish
|
|
79
|
+
set -x OPENAI_API_KEY "sk-..."
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Install (editable)
|
|
83
|
+
|
|
84
|
+
```fish
|
|
85
|
+
python -m pip install -e .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
- Print commit message only:
|
|
91
|
+
|
|
92
|
+
```fish
|
|
93
|
+
git add -A
|
|
94
|
+
git-commit-message "optional extra context about the change"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- Force single-line subject only:
|
|
98
|
+
|
|
99
|
+
```fish
|
|
100
|
+
git-commit-message --one-line "optional context"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- Limit subject length (default 72):
|
|
104
|
+
|
|
105
|
+
```fish
|
|
106
|
+
git-commit-message --one-line --max-length 50 "optional context"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- Commit immediately with editor:
|
|
110
|
+
|
|
111
|
+
```fish
|
|
112
|
+
git-commit-message --commit --edit "refactor parser for speed"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- Select output language/locale (default: en-GB):
|
|
116
|
+
|
|
117
|
+
```fish
|
|
118
|
+
# American English
|
|
119
|
+
git-commit-message --language en-US "optional context"
|
|
120
|
+
|
|
121
|
+
# Korean
|
|
122
|
+
git-commit-message --language ko-KR
|
|
123
|
+
|
|
124
|
+
# Japanese
|
|
125
|
+
git-commit-message --language ja-JP
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Notes:
|
|
129
|
+
|
|
130
|
+
- The model is instructed to write using the selected language/locale.
|
|
131
|
+
- In multi-line mode, the only allowed label ("Rationale:") is also translated into the target language.
|
|
132
|
+
|
|
133
|
+
Environment:
|
|
134
|
+
|
|
135
|
+
- `OPENAI_API_KEY`: required
|
|
136
|
+
- `GIT_COMMIT_MESSAGE_MODEL` or `OPENAI_MODEL`: optional (default: `gpt-5-mini`)
|
|
137
|
+
- `GIT_COMMIT_MESSAGE_LANGUAGE`: optional (default: `en-GB`)
|
|
138
|
+
|
|
139
|
+
## AI‑generated code notice
|
|
140
|
+
|
|
141
|
+
Parts of this project were created with assistance from AI tools (e.g. large language models).
|
|
142
|
+
All AI‑assisted contributions were reviewed and adapted by maintainers before inclusion.
|
|
143
|
+
If you need provenance for specific changes, please refer to the Git history and commit messages.
|
|
@@ -1,15 +1,37 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: git-commit-message
|
|
3
|
-
Version: 0.4.0
|
|
4
|
-
Summary: Generate Git commit messages from staged changes using OpenAI GPT
|
|
5
|
-
Requires-Python: >=3.13
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: openai>=2.6.1
|
|
8
|
-
|
|
9
1
|
# git-commit-message
|
|
10
2
|
|
|
11
3
|
Staged changes -> GPT commit message generator.
|
|
12
4
|
|
|
5
|
+
## Install (PyPI)
|
|
6
|
+
|
|
7
|
+
Install the latest released version from PyPI:
|
|
8
|
+
|
|
9
|
+
```fish
|
|
10
|
+
# User environment (recommended)
|
|
11
|
+
python -m pip install --user git-commit-message
|
|
12
|
+
|
|
13
|
+
# Or system/virtualenv as appropriate
|
|
14
|
+
python -m pip install git-commit-message
|
|
15
|
+
|
|
16
|
+
# Or with pipx for isolated CLI installs
|
|
17
|
+
pipx install git-commit-message
|
|
18
|
+
|
|
19
|
+
# Upgrade to the newest version
|
|
20
|
+
python -m pip install --upgrade git-commit-message
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Quick check:
|
|
24
|
+
|
|
25
|
+
```fish
|
|
26
|
+
git-commit-message --help
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Set your API key (fish):
|
|
30
|
+
|
|
31
|
+
```fish
|
|
32
|
+
set -x OPENAI_API_KEY "sk-..."
|
|
33
|
+
```
|
|
34
|
+
|
|
13
35
|
## Install (editable)
|
|
14
36
|
|
|
15
37
|
```fish
|
|
@@ -65,7 +87,7 @@ Environment:
|
|
|
65
87
|
|
|
66
88
|
- `OPENAI_API_KEY`: required
|
|
67
89
|
- `GIT_COMMIT_MESSAGE_MODEL` or `OPENAI_MODEL`: optional (default: `gpt-5-mini`)
|
|
68
|
-
- `GIT_COMMIT_MESSAGE_LANGUAGE
|
|
90
|
+
- `GIT_COMMIT_MESSAGE_LANGUAGE`: optional (default: `en-GB`)
|
|
69
91
|
|
|
70
92
|
## AI‑generated code notice
|
|
71
93
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is free and unencumbered software released into the public domain.
|
|
2
|
+
|
|
3
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
4
|
+
distribute this software, either in source code form or as a compiled
|
|
5
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
6
|
+
means.
|
|
7
|
+
|
|
8
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
9
|
+
of this software dedicate any and all copyright interest in the
|
|
10
|
+
software to the public domain. We make this dedication for the benefit
|
|
11
|
+
of the public at large and to the detriment of our heirs and
|
|
12
|
+
successors. We intend this dedication to be an overt act of
|
|
13
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
14
|
+
software under copyright law.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
20
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
21
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
For more information, please refer to <https://unlicense.org/>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "git-commit-message"
|
|
3
|
+
version = "0.5.0"
|
|
4
|
+
description = "Generate Git commit messages from staged changes using OpenAI GPT"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.13"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"openai>=2.6.1",
|
|
9
|
+
]
|
|
10
|
+
maintainers = [{ name = "Mina Her", email = "minacle@live.com" }]
|
|
11
|
+
license = { file = "UNLICENSE" }
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 3 - Alpha",
|
|
14
|
+
"Environment :: Console",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: The Unlicense (Unlicense)",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Topic :: Software Development :: Version Control :: Git",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
git-commit-message = "git_commit_message:main"
|
|
27
|
+
|
|
28
|
+
[build-system]
|
|
29
|
+
requires = ["setuptools>=80", "wheel"]
|
|
30
|
+
build-backend = "setuptools.build_meta"
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
package-dir = {"" = "src"}
|
|
34
|
+
packages = ["git_commit_message"]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/minacle/git-commit-message"
|
|
38
|
+
Repository = "https://github.com/minacle/git-commit-message"
|
|
39
|
+
Issues = "https://github.com/minacle/git-commit-message/issues"
|
|
40
|
+
|
|
41
|
+
[tool.pyright]
|
|
42
|
+
# Ensure Pyright/Pylance resolves project imports and uses correct Python version
|
|
43
|
+
pythonVersion = "3.13"
|
|
44
|
+
extraPaths = ["src"]
|
|
45
|
+
typeCheckingMode = "basic"
|
|
46
|
+
|
|
47
|
+
# So that SDK dynamic types or untyped third-party libs don't flood with "unknown" diagnostics
|
|
48
|
+
reportUnknownParameterType = "none"
|
|
49
|
+
reportUnknownArgumentType = "none"
|
|
50
|
+
reportUnknownVariableType = "none"
|
|
51
|
+
reportUnknownMemberType = "none"
|
|
52
|
+
reportUnknownLambdaType = "none"
|
|
53
|
+
reportUnknownCalleeType = "none"
|
|
@@ -67,7 +67,7 @@ def _build_parser() -> ArgumentParser:
|
|
|
67
67
|
default=None,
|
|
68
68
|
help=(
|
|
69
69
|
"Target language/locale IETF tag for the output (default: en-GB). "
|
|
70
|
-
"You may also set GIT_COMMIT_MESSAGE_LANGUAGE
|
|
70
|
+
"You may also set GIT_COMMIT_MESSAGE_LANGUAGE."
|
|
71
71
|
),
|
|
72
72
|
)
|
|
73
73
|
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
from openai.types.responses import ResponseInputParam
|
|
4
|
+
|
|
5
|
+
"""Generate Git commit messages by calling an OpenAI GPT model.
|
|
6
|
+
|
|
7
|
+
Migrated to use OpenAI Responses API (client.responses.create).
|
|
8
|
+
"""
|
|
4
9
|
|
|
5
10
|
import os
|
|
6
|
-
from typing import Final
|
|
11
|
+
from typing import Final
|
|
7
12
|
from openai import OpenAI
|
|
8
13
|
|
|
9
14
|
|
|
@@ -56,14 +61,14 @@ def _build_system_prompt(
|
|
|
56
61
|
)
|
|
57
62
|
|
|
58
63
|
|
|
59
|
-
def
|
|
64
|
+
def _instructions(
|
|
60
65
|
*,
|
|
61
66
|
single_line: bool,
|
|
62
67
|
subject_max: int | None,
|
|
63
68
|
language: str,
|
|
64
|
-
) ->
|
|
65
|
-
"""Create the system
|
|
66
|
-
return
|
|
69
|
+
) -> str:
|
|
70
|
+
"""Create the system/developer instructions string for the Responses API."""
|
|
71
|
+
return _build_system_prompt(single_line=single_line, subject_max=subject_max, language=language)
|
|
67
72
|
|
|
68
73
|
|
|
69
74
|
class CommitMessageResult:
|
|
@@ -131,23 +136,21 @@ def _resolve_language(
|
|
|
131
136
|
return (
|
|
132
137
|
language
|
|
133
138
|
or os.environ.get("GIT_COMMIT_MESSAGE_LANGUAGE")
|
|
134
|
-
or os.environ.get("OPENAI_LANGUAGE")
|
|
135
139
|
or _DEFAULT_LANGUAGE
|
|
136
140
|
)
|
|
137
141
|
|
|
138
142
|
|
|
139
|
-
def
|
|
143
|
+
def _build_responses_input(
|
|
140
144
|
*,
|
|
141
145
|
diff: str,
|
|
142
146
|
hint: str | None,
|
|
143
|
-
) ->
|
|
144
|
-
"""Compose
|
|
147
|
+
) -> ResponseInputParam:
|
|
148
|
+
"""Compose Responses API input items, separating auxiliary context and diff.
|
|
145
149
|
|
|
146
150
|
Returns
|
|
147
151
|
-------
|
|
148
|
-
|
|
149
|
-
The
|
|
150
|
-
second is the list of user messages to send to the Chat Completions API.
|
|
152
|
+
ResponseInputParam
|
|
153
|
+
The list of input items to send to the Responses API.
|
|
151
154
|
"""
|
|
152
155
|
|
|
153
156
|
hint_content: str | None = (
|
|
@@ -155,15 +158,35 @@ def _build_user_messages(
|
|
|
155
158
|
)
|
|
156
159
|
diff_content: str = f"# Changes (diff)\n{diff}"
|
|
157
160
|
|
|
158
|
-
|
|
161
|
+
input_items: ResponseInputParam = []
|
|
159
162
|
if hint_content:
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
input_items.append(
|
|
164
|
+
{
|
|
165
|
+
"role": "user",
|
|
166
|
+
"content": [
|
|
167
|
+
{"type": "input_text", "text": hint_content},
|
|
168
|
+
],
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
input_items.append(
|
|
172
|
+
{
|
|
173
|
+
"role": "user",
|
|
174
|
+
"content": [
|
|
175
|
+
{"type": "input_text", "text": diff_content},
|
|
176
|
+
],
|
|
177
|
+
}
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
return input_items
|
|
162
181
|
|
|
163
|
-
|
|
164
|
-
|
|
182
|
+
|
|
183
|
+
def _build_combined_prompt(*, diff: str, hint: str | None) -> str:
|
|
184
|
+
"""Compose a combined string of hint and diff for debug/info output."""
|
|
185
|
+
hint_content: str | None = (
|
|
186
|
+
f"# Auxiliary context (user-provided)\n{hint}" if hint else None
|
|
165
187
|
)
|
|
166
|
-
|
|
188
|
+
diff_content: str = f"# Changes (diff)\n{diff}"
|
|
189
|
+
return "\n\n".join([part for part in (hint_content, diff_content) if part is not None])
|
|
167
190
|
|
|
168
191
|
|
|
169
192
|
def generate_commit_message(
|
|
@@ -185,20 +208,17 @@ def generate_commit_message(
|
|
|
185
208
|
|
|
186
209
|
client = OpenAI(api_key=api_key)
|
|
187
210
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
# Use Chat Completions API to generate a single response (send hint and diff as separate user messages)
|
|
191
|
-
all_messages: list[dict[str, str]] = [
|
|
192
|
-
_system_message(single_line=single_line, subject_max=subject_max, language=chosen_language),
|
|
193
|
-
*user_messages,
|
|
194
|
-
]
|
|
211
|
+
input_items = _build_responses_input(diff=diff, hint=hint)
|
|
195
212
|
|
|
196
|
-
|
|
213
|
+
# Use Responses API to generate a single response (send hint and diff as separate user inputs)
|
|
214
|
+
resp = client.responses.create(
|
|
197
215
|
model=chosen_model,
|
|
198
|
-
|
|
216
|
+
instructions=_instructions(single_line=single_line, subject_max=subject_max, language=chosen_language),
|
|
217
|
+
input=input_items,
|
|
199
218
|
)
|
|
200
219
|
|
|
201
|
-
|
|
220
|
+
# Prefer SDK convenience aggregate text if available
|
|
221
|
+
text: str = (resp.output_text or "").strip()
|
|
202
222
|
if not text:
|
|
203
223
|
raise RuntimeError("An empty commit message was generated.")
|
|
204
224
|
return text
|
|
@@ -228,31 +248,29 @@ def generate_commit_message_with_info(
|
|
|
228
248
|
raise RuntimeError("The OPENAI_API_KEY environment variable is required.")
|
|
229
249
|
|
|
230
250
|
client = OpenAI(api_key=api_key)
|
|
231
|
-
combined_prompt
|
|
232
|
-
|
|
233
|
-
all_messages = [
|
|
234
|
-
_system_message(single_line=single_line, subject_max=subject_max, language=chosen_language),
|
|
235
|
-
*user_messages,
|
|
236
|
-
]
|
|
251
|
+
combined_prompt = _build_combined_prompt(diff=diff, hint=hint)
|
|
252
|
+
input_items = _build_responses_input(diff=diff, hint=hint)
|
|
237
253
|
|
|
238
|
-
resp = client.
|
|
254
|
+
resp = client.responses.create(
|
|
239
255
|
model=chosen_model,
|
|
240
|
-
|
|
256
|
+
instructions=_instructions(single_line=single_line, subject_max=subject_max, language=chosen_language),
|
|
257
|
+
input=input_items,
|
|
241
258
|
)
|
|
242
259
|
|
|
243
|
-
response_text: str = (resp.
|
|
260
|
+
response_text: str = (resp.output_text or "").strip()
|
|
244
261
|
if not response_text:
|
|
245
262
|
raise RuntimeError("An empty commit message was generated.")
|
|
246
263
|
|
|
247
|
-
response_id: str | None =
|
|
248
|
-
usage =
|
|
264
|
+
response_id: str | None = resp.id
|
|
265
|
+
usage = resp.usage
|
|
249
266
|
prompt_tokens: int | None = None
|
|
250
267
|
completion_tokens: int | None = None
|
|
251
268
|
total_tokens: int | None = None
|
|
252
269
|
if usage is not None:
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
270
|
+
# Responses API exposes input/output/total token fields.
|
|
271
|
+
total_tokens = usage.total_tokens
|
|
272
|
+
prompt_tokens = usage.input_tokens
|
|
273
|
+
completion_tokens = usage.output_tokens
|
|
256
274
|
|
|
257
275
|
return CommitMessageResult(
|
|
258
276
|
message=response_text,
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-commit-message
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Generate Git commit messages from staged changes using OpenAI GPT
|
|
5
|
+
Maintainer-email: Mina Her <minacle@live.com>
|
|
6
|
+
License: This is free and unencumbered software released into the public domain.
|
|
7
|
+
|
|
8
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or
|
|
9
|
+
distribute this software, either in source code form or as a compiled
|
|
10
|
+
binary, for any purpose, commercial or non-commercial, and by any
|
|
11
|
+
means.
|
|
12
|
+
|
|
13
|
+
In jurisdictions that recognize copyright laws, the author or authors
|
|
14
|
+
of this software dedicate any and all copyright interest in the
|
|
15
|
+
software to the public domain. We make this dedication for the benefit
|
|
16
|
+
of the public at large and to the detriment of our heirs and
|
|
17
|
+
successors. We intend this dedication to be an overt act of
|
|
18
|
+
relinquishment in perpetuity of all present and future rights to this
|
|
19
|
+
software under copyright law.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
22
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
23
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
24
|
+
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
25
|
+
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
26
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
27
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
|
|
29
|
+
For more information, please refer to <https://unlicense.org/>
|
|
30
|
+
|
|
31
|
+
Project-URL: Homepage, https://github.com/minacle/git-commit-message
|
|
32
|
+
Project-URL: Repository, https://github.com/minacle/git-commit-message
|
|
33
|
+
Project-URL: Issues, https://github.com/minacle/git-commit-message/issues
|
|
34
|
+
Classifier: Development Status :: 3 - Alpha
|
|
35
|
+
Classifier: Environment :: Console
|
|
36
|
+
Classifier: Intended Audience :: Developers
|
|
37
|
+
Classifier: License :: OSI Approved :: The Unlicense (Unlicense)
|
|
38
|
+
Classifier: Operating System :: OS Independent
|
|
39
|
+
Classifier: Programming Language :: Python
|
|
40
|
+
Classifier: Programming Language :: Python :: 3
|
|
41
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
43
|
+
Classifier: Topic :: Software Development :: Version Control :: Git
|
|
44
|
+
Requires-Python: >=3.13
|
|
45
|
+
Description-Content-Type: text/markdown
|
|
46
|
+
Requires-Dist: openai>=2.6.1
|
|
47
|
+
|
|
48
|
+
# git-commit-message
|
|
49
|
+
|
|
50
|
+
Staged changes -> GPT commit message generator.
|
|
51
|
+
|
|
52
|
+
## Install (PyPI)
|
|
53
|
+
|
|
54
|
+
Install the latest released version from PyPI:
|
|
55
|
+
|
|
56
|
+
```fish
|
|
57
|
+
# User environment (recommended)
|
|
58
|
+
python -m pip install --user git-commit-message
|
|
59
|
+
|
|
60
|
+
# Or system/virtualenv as appropriate
|
|
61
|
+
python -m pip install git-commit-message
|
|
62
|
+
|
|
63
|
+
# Or with pipx for isolated CLI installs
|
|
64
|
+
pipx install git-commit-message
|
|
65
|
+
|
|
66
|
+
# Upgrade to the newest version
|
|
67
|
+
python -m pip install --upgrade git-commit-message
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Quick check:
|
|
71
|
+
|
|
72
|
+
```fish
|
|
73
|
+
git-commit-message --help
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Set your API key (fish):
|
|
77
|
+
|
|
78
|
+
```fish
|
|
79
|
+
set -x OPENAI_API_KEY "sk-..."
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Install (editable)
|
|
83
|
+
|
|
84
|
+
```fish
|
|
85
|
+
python -m pip install -e .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Usage
|
|
89
|
+
|
|
90
|
+
- Print commit message only:
|
|
91
|
+
|
|
92
|
+
```fish
|
|
93
|
+
git add -A
|
|
94
|
+
git-commit-message "optional extra context about the change"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
- Force single-line subject only:
|
|
98
|
+
|
|
99
|
+
```fish
|
|
100
|
+
git-commit-message --one-line "optional context"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- Limit subject length (default 72):
|
|
104
|
+
|
|
105
|
+
```fish
|
|
106
|
+
git-commit-message --one-line --max-length 50 "optional context"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
- Commit immediately with editor:
|
|
110
|
+
|
|
111
|
+
```fish
|
|
112
|
+
git-commit-message --commit --edit "refactor parser for speed"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
- Select output language/locale (default: en-GB):
|
|
116
|
+
|
|
117
|
+
```fish
|
|
118
|
+
# American English
|
|
119
|
+
git-commit-message --language en-US "optional context"
|
|
120
|
+
|
|
121
|
+
# Korean
|
|
122
|
+
git-commit-message --language ko-KR
|
|
123
|
+
|
|
124
|
+
# Japanese
|
|
125
|
+
git-commit-message --language ja-JP
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Notes:
|
|
129
|
+
|
|
130
|
+
- The model is instructed to write using the selected language/locale.
|
|
131
|
+
- In multi-line mode, the only allowed label ("Rationale:") is also translated into the target language.
|
|
132
|
+
|
|
133
|
+
Environment:
|
|
134
|
+
|
|
135
|
+
- `OPENAI_API_KEY`: required
|
|
136
|
+
- `GIT_COMMIT_MESSAGE_MODEL` or `OPENAI_MODEL`: optional (default: `gpt-5-mini`)
|
|
137
|
+
- `GIT_COMMIT_MESSAGE_LANGUAGE`: optional (default: `en-GB`)
|
|
138
|
+
|
|
139
|
+
## AI‑generated code notice
|
|
140
|
+
|
|
141
|
+
Parts of this project were created with assistance from AI tools (e.g. large language models).
|
|
142
|
+
All AI‑assisted contributions were reviewed and adapted by maintainers before inclusion.
|
|
143
|
+
If you need provenance for specific changes, please refer to the Git history and commit messages.
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# git-commit-message
|
|
2
|
-
|
|
3
|
-
Staged changes -> GPT commit message generator.
|
|
4
|
-
|
|
5
|
-
## Install (editable)
|
|
6
|
-
|
|
7
|
-
```fish
|
|
8
|
-
python -m pip install -e .
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
- Print commit message only:
|
|
14
|
-
|
|
15
|
-
```fish
|
|
16
|
-
git add -A
|
|
17
|
-
git-commit-message "optional extra context about the change"
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
- Force single-line subject only:
|
|
21
|
-
|
|
22
|
-
```fish
|
|
23
|
-
git-commit-message --one-line "optional context"
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
- Limit subject length (default 72):
|
|
27
|
-
|
|
28
|
-
```fish
|
|
29
|
-
git-commit-message --one-line --max-length 50 "optional context"
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
- Commit immediately with editor:
|
|
33
|
-
|
|
34
|
-
```fish
|
|
35
|
-
git-commit-message --commit --edit "refactor parser for speed"
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
- Select output language/locale (default: en-GB):
|
|
39
|
-
|
|
40
|
-
```fish
|
|
41
|
-
# American English
|
|
42
|
-
git-commit-message --language en-US "optional context"
|
|
43
|
-
|
|
44
|
-
# Korean
|
|
45
|
-
git-commit-message --language ko-KR
|
|
46
|
-
|
|
47
|
-
# Japanese
|
|
48
|
-
git-commit-message --language ja-JP
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Notes:
|
|
52
|
-
|
|
53
|
-
- The model is instructed to write using the selected language/locale.
|
|
54
|
-
- In multi-line mode, the only allowed label ("Rationale:") is also translated into the target language.
|
|
55
|
-
|
|
56
|
-
Environment:
|
|
57
|
-
|
|
58
|
-
- `OPENAI_API_KEY`: required
|
|
59
|
-
- `GIT_COMMIT_MESSAGE_MODEL` or `OPENAI_MODEL`: optional (default: `gpt-5-mini`)
|
|
60
|
-
- `GIT_COMMIT_MESSAGE_LANGUAGE` or `OPENAI_LANGUAGE`: optional (default: `en-GB`)
|
|
61
|
-
|
|
62
|
-
## AI‑generated code notice
|
|
63
|
-
|
|
64
|
-
Parts of this project were created with assistance from AI tools (e.g. large language models).
|
|
65
|
-
All AI‑assisted contributions were reviewed and adapted by maintainers before inclusion.
|
|
66
|
-
If you need provenance for specific changes, please refer to the Git history and commit messages.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
[project]
|
|
2
|
-
name = "git-commit-message"
|
|
3
|
-
version = "0.4.0"
|
|
4
|
-
description = "Generate Git commit messages from staged changes using OpenAI GPT"
|
|
5
|
-
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.13"
|
|
7
|
-
dependencies = [
|
|
8
|
-
"openai>=2.6.1",
|
|
9
|
-
]
|
|
10
|
-
|
|
11
|
-
[project.scripts]
|
|
12
|
-
git-commit-message = "git_commit_message:main"
|
|
13
|
-
|
|
14
|
-
[build-system]
|
|
15
|
-
requires = ["setuptools>=80", "wheel"]
|
|
16
|
-
build-backend = "setuptools.build_meta"
|
|
17
|
-
|
|
18
|
-
[tool.setuptools]
|
|
19
|
-
package-dir = {"" = "src"}
|
|
20
|
-
packages = ["git_commit_message"]
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: git-commit-message
|
|
3
|
-
Version: 0.4.0
|
|
4
|
-
Summary: Generate Git commit messages from staged changes using OpenAI GPT
|
|
5
|
-
Requires-Python: >=3.13
|
|
6
|
-
Description-Content-Type: text/markdown
|
|
7
|
-
Requires-Dist: openai>=2.6.1
|
|
8
|
-
|
|
9
|
-
# git-commit-message
|
|
10
|
-
|
|
11
|
-
Staged changes -> GPT commit message generator.
|
|
12
|
-
|
|
13
|
-
## Install (editable)
|
|
14
|
-
|
|
15
|
-
```fish
|
|
16
|
-
python -m pip install -e .
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
- Print commit message only:
|
|
22
|
-
|
|
23
|
-
```fish
|
|
24
|
-
git add -A
|
|
25
|
-
git-commit-message "optional extra context about the change"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
- Force single-line subject only:
|
|
29
|
-
|
|
30
|
-
```fish
|
|
31
|
-
git-commit-message --one-line "optional context"
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
- Limit subject length (default 72):
|
|
35
|
-
|
|
36
|
-
```fish
|
|
37
|
-
git-commit-message --one-line --max-length 50 "optional context"
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
- Commit immediately with editor:
|
|
41
|
-
|
|
42
|
-
```fish
|
|
43
|
-
git-commit-message --commit --edit "refactor parser for speed"
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
- Select output language/locale (default: en-GB):
|
|
47
|
-
|
|
48
|
-
```fish
|
|
49
|
-
# American English
|
|
50
|
-
git-commit-message --language en-US "optional context"
|
|
51
|
-
|
|
52
|
-
# Korean
|
|
53
|
-
git-commit-message --language ko-KR
|
|
54
|
-
|
|
55
|
-
# Japanese
|
|
56
|
-
git-commit-message --language ja-JP
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Notes:
|
|
60
|
-
|
|
61
|
-
- The model is instructed to write using the selected language/locale.
|
|
62
|
-
- In multi-line mode, the only allowed label ("Rationale:") is also translated into the target language.
|
|
63
|
-
|
|
64
|
-
Environment:
|
|
65
|
-
|
|
66
|
-
- `OPENAI_API_KEY`: required
|
|
67
|
-
- `GIT_COMMIT_MESSAGE_MODEL` or `OPENAI_MODEL`: optional (default: `gpt-5-mini`)
|
|
68
|
-
- `GIT_COMMIT_MESSAGE_LANGUAGE` or `OPENAI_LANGUAGE`: optional (default: `en-GB`)
|
|
69
|
-
|
|
70
|
-
## AI‑generated code notice
|
|
71
|
-
|
|
72
|
-
Parts of this project were created with assistance from AI tools (e.g. large language models).
|
|
73
|
-
All AI‑assisted contributions were reviewed and adapted by maintainers before inclusion.
|
|
74
|
-
If you need provenance for specific changes, please refer to the Git history and commit messages.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message.egg-info/requires.txt
RENAMED
|
File without changes
|
{git_commit_message-0.4.0 → git_commit_message-0.5.0}/src/git_commit_message.egg-info/top_level.txt
RENAMED
|
File without changes
|