gptcomet 0.0.2__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.
gptcomet-0.0.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024, Belingud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,146 @@
1
+ Metadata-Version: 2.1
2
+ Name: gptcomet
3
+ Version: 0.0.2
4
+ Summary: gptcomet: A tool that leverages AI to automatically generate Git commit messages.
5
+ Keywords: python
6
+ Author-Email: belingud <im.victor@qq.com>
7
+ License: MIT license
8
+ Project-URL: Homepage, https://belingud.github.io/gptcomet/
9
+ Project-URL: Repository, https://github.com/belingud/gptcomet
10
+ Project-URL: Documentation, https://belingud.github.io/gptcomet/
11
+ Requires-Python: <4.0,>=3.9
12
+ Requires-Dist: gitpython>=3.1.43
13
+ Requires-Dist: click>=8.1.7
14
+ Requires-Dist: litellm>=1.43.0
15
+ Requires-Dist: tomlkit>=0.13.0
16
+ Requires-Dist: tenacity>=9.0.0
17
+ Requires-Dist: orjson>=3.10.6
18
+ Description-Content-Type: text/markdown
19
+
20
+ # GPTComet: AI-Powered Git Commit Message Generator
21
+
22
+ ## Table of content
23
+
24
+ <!-- TOC -->
25
+ - [GPTComet: AI-Powered Git Commit Message Generator](#gptcomet-ai-powered-git-commit-message-generator)
26
+ - [Table of content](#table-of-content)
27
+ - [Overview](#overview)
28
+ - [Features](#features)
29
+ - [Installation](#installation)
30
+ - [Usage](#usage)
31
+ - [Commands](#commands)
32
+ - [Configuration](#configuration)
33
+ - [Supported Keys](#supported-keys)
34
+ - [Example](#example)
35
+ - [Development](#development)
36
+ - [License](#license)
37
+ - [Contact](#contact)
38
+ <!-- TOC -->
39
+
40
+ ## Overview
41
+
42
+ GPTComet is a Python library designed to automate the process of generating commit messages for Git repositories.
43
+ It leverages the power of AI to create meaningful commit messages based on the changes made in the codebase.
44
+
45
+ ## Features
46
+
47
+ * **Automatic Commit Message Generation**: GPTComet can generate commit messages based on the changes made in the code.
48
+ * **Support for Multiple Languages**: GPTComet supports multiple languages, including English and Chinese.
49
+ * **Customizable Configuration**: GPTComet allows users to customize the configuration to suit their needs.
50
+ * **Support for Rich Commit Messages**: GPTComet supports rich commit messages, which include a title, summary, and detailed description.
51
+
52
+ ## Installation
53
+
54
+ To use GPTComet, you need to have Python installed on your system. You can install the library using pip:
55
+
56
+ ```shell
57
+ pip install gptcomet
58
+ ```
59
+
60
+ Recommend install use `pipx` on Mac or Linux.
61
+
62
+ ```shell
63
+ pipx install gptcomet
64
+ ```
65
+
66
+
67
+ ## Usage
68
+
69
+ To use gptcomet, follow these steps:
70
+
71
+ 1. **Install GPTComet**: Install GPTComet through pypi.
72
+ 2. **Configure GPTComet**: Configure GPTComet with your api_key The configuration file should contain the following keys:
73
+ * `provider`: The provider of the language model (e.g., `openai`).
74
+ * `api_base`: The base URL of the API (e.g., `https://api.openai.com/v1`).
75
+ * `api_key`: The API key for the provider.
76
+ * `model`: The model used for generating commit messages (e.g., `gpt-3.5-turbo`).
77
+ * `retries`: The number of retries for the API request (e.g., `2`).
78
+ 3. **Run GPTComet**: Run GPTComet using the following command: `gptcomet generate commit`.
79
+
80
+ ## Commands
81
+
82
+ The following are the available commands for GPTComet:
83
+
84
+ * `gptcomet config`: Config manage commands group.
85
+ * `set`: Set a configuration value.
86
+ * `get`: Get a configuration value.
87
+ * `list`: List all configuration values.
88
+ * `reset`: Reset the configuration to its default values.
89
+ * `keys`: List all supported keys.
90
+ * `gptcomet hook`: Hook manage commands group(Prototype phase.).
91
+ * `install`: Install the GPTComet hook.
92
+ * `uninstall`: Uninstall the GPTComet hook.
93
+ * `status`: Check the status of the GPTComet hook.
94
+ * `gptcomet generate`: Generate messages by changes/diff.
95
+ * `commit`: Generate a commit message based on the changes made in the code.
96
+ * `pr`: Generate a pull request message based on the changes made in the code.
97
+
98
+
99
+ ## Configuration
100
+
101
+ The configuration file for GPTComet is `gptcomet.toml`. The file should contain the following keys:
102
+
103
+ * `provider`: The provider of the language model (e.g., `openai`).
104
+ * `api_base`: The base URL of the API (e.g., `https://api.openai.com/v1`).
105
+ * `api_key`: The API key for the provider.
106
+ * `model`: The model used for generating commit messages (e.g., `gpt-3.5-turbo`).
107
+ * `retries`: The number of retries for the API request (e.g., `2`).
108
+ * `prompt.brief_commit_message`: The prompt for generating brief commit messages.
109
+ * `prompt.translation`: The prompt for translating commit messages to a target language.
110
+ * `output.lang`: The language of the commit message (e.g., `en`).
111
+
112
+
113
+ ## Supported Keys
114
+
115
+ You can use `gptcomet config keys` to check supported keys.
116
+
117
+ ## Example
118
+
119
+ Here is an example of how to use GPTComet:
120
+
121
+ 1. When you first set your OpenAI KEY by `gptcomet config set openai.api_key YOUR_API_KEY`, it will generate config file at `~/.local/gptcomet/gptcomet.toml`, includes:
122
+ ```
123
+ provider = "openai"
124
+ api_base = "https://api.openai.com/v1"
125
+ api_key = "YOUR_API_KEY"
126
+ model = "gpt-3.5-turbo"
127
+ retries = 2
128
+ output.lang = "en"
129
+ ```
130
+ 2. Run the following command to generate a commit message: `GPTComet generate commit`
131
+ 3. GPTComet will generate a commit message based on the changes made in the code and display it in the console.
132
+
133
+ Note: Replace `YOUR_API_KEY` with your actual API key for the provider.
134
+
135
+
136
+ ## Development
137
+
138
+ If you'd like to contribute to GPTComet, feel free to fork this project and submit a pull request.
139
+
140
+ ## License
141
+
142
+ GPTComet is licensed under the MIT License.
143
+
144
+ ## Contact
145
+
146
+ If you have any questions or suggestions, feel free to contact.
@@ -0,0 +1,127 @@
1
+ # GPTComet: AI-Powered Git Commit Message Generator
2
+
3
+ ## Table of content
4
+
5
+ <!-- TOC -->
6
+ - [GPTComet: AI-Powered Git Commit Message Generator](#gptcomet-ai-powered-git-commit-message-generator)
7
+ - [Table of content](#table-of-content)
8
+ - [Overview](#overview)
9
+ - [Features](#features)
10
+ - [Installation](#installation)
11
+ - [Usage](#usage)
12
+ - [Commands](#commands)
13
+ - [Configuration](#configuration)
14
+ - [Supported Keys](#supported-keys)
15
+ - [Example](#example)
16
+ - [Development](#development)
17
+ - [License](#license)
18
+ - [Contact](#contact)
19
+ <!-- TOC -->
20
+
21
+ ## Overview
22
+
23
+ GPTComet is a Python library designed to automate the process of generating commit messages for Git repositories.
24
+ It leverages the power of AI to create meaningful commit messages based on the changes made in the codebase.
25
+
26
+ ## Features
27
+
28
+ * **Automatic Commit Message Generation**: GPTComet can generate commit messages based on the changes made in the code.
29
+ * **Support for Multiple Languages**: GPTComet supports multiple languages, including English and Chinese.
30
+ * **Customizable Configuration**: GPTComet allows users to customize the configuration to suit their needs.
31
+ * **Support for Rich Commit Messages**: GPTComet supports rich commit messages, which include a title, summary, and detailed description.
32
+
33
+ ## Installation
34
+
35
+ To use GPTComet, you need to have Python installed on your system. You can install the library using pip:
36
+
37
+ ```shell
38
+ pip install gptcomet
39
+ ```
40
+
41
+ Recommend install use `pipx` on Mac or Linux.
42
+
43
+ ```shell
44
+ pipx install gptcomet
45
+ ```
46
+
47
+
48
+ ## Usage
49
+
50
+ To use gptcomet, follow these steps:
51
+
52
+ 1. **Install GPTComet**: Install GPTComet through pypi.
53
+ 2. **Configure GPTComet**: Configure GPTComet with your api_key The configuration file should contain the following keys:
54
+ * `provider`: The provider of the language model (e.g., `openai`).
55
+ * `api_base`: The base URL of the API (e.g., `https://api.openai.com/v1`).
56
+ * `api_key`: The API key for the provider.
57
+ * `model`: The model used for generating commit messages (e.g., `gpt-3.5-turbo`).
58
+ * `retries`: The number of retries for the API request (e.g., `2`).
59
+ 3. **Run GPTComet**: Run GPTComet using the following command: `gptcomet generate commit`.
60
+
61
+ ## Commands
62
+
63
+ The following are the available commands for GPTComet:
64
+
65
+ * `gptcomet config`: Config manage commands group.
66
+ * `set`: Set a configuration value.
67
+ * `get`: Get a configuration value.
68
+ * `list`: List all configuration values.
69
+ * `reset`: Reset the configuration to its default values.
70
+ * `keys`: List all supported keys.
71
+ * `gptcomet hook`: Hook manage commands group(Prototype phase.).
72
+ * `install`: Install the GPTComet hook.
73
+ * `uninstall`: Uninstall the GPTComet hook.
74
+ * `status`: Check the status of the GPTComet hook.
75
+ * `gptcomet generate`: Generate messages by changes/diff.
76
+ * `commit`: Generate a commit message based on the changes made in the code.
77
+ * `pr`: Generate a pull request message based on the changes made in the code.
78
+
79
+
80
+ ## Configuration
81
+
82
+ The configuration file for GPTComet is `gptcomet.toml`. The file should contain the following keys:
83
+
84
+ * `provider`: The provider of the language model (e.g., `openai`).
85
+ * `api_base`: The base URL of the API (e.g., `https://api.openai.com/v1`).
86
+ * `api_key`: The API key for the provider.
87
+ * `model`: The model used for generating commit messages (e.g., `gpt-3.5-turbo`).
88
+ * `retries`: The number of retries for the API request (e.g., `2`).
89
+ * `prompt.brief_commit_message`: The prompt for generating brief commit messages.
90
+ * `prompt.translation`: The prompt for translating commit messages to a target language.
91
+ * `output.lang`: The language of the commit message (e.g., `en`).
92
+
93
+
94
+ ## Supported Keys
95
+
96
+ You can use `gptcomet config keys` to check supported keys.
97
+
98
+ ## Example
99
+
100
+ Here is an example of how to use GPTComet:
101
+
102
+ 1. When you first set your OpenAI KEY by `gptcomet config set openai.api_key YOUR_API_KEY`, it will generate config file at `~/.local/gptcomet/gptcomet.toml`, includes:
103
+ ```
104
+ provider = "openai"
105
+ api_base = "https://api.openai.com/v1"
106
+ api_key = "YOUR_API_KEY"
107
+ model = "gpt-3.5-turbo"
108
+ retries = 2
109
+ output.lang = "en"
110
+ ```
111
+ 2. Run the following command to generate a commit message: `GPTComet generate commit`
112
+ 3. GPTComet will generate a commit message based on the changes made in the code and display it in the console.
113
+
114
+ Note: Replace `YOUR_API_KEY` with your actual API key for the provider.
115
+
116
+
117
+ ## Development
118
+
119
+ If you'd like to contribute to GPTComet, feel free to fork this project and submit a pull request.
120
+
121
+ ## License
122
+
123
+ GPTComet is licensed under the MIT License.
124
+
125
+ ## Contact
126
+
127
+ If you have any questions or suggestions, feel free to contact.
@@ -0,0 +1,6 @@
1
+ __version__ = "0.0.2"
2
+
3
+ from gptcomet.cli import cli
4
+
5
+ if __name__ == "__main__":
6
+ cli()
@@ -0,0 +1,24 @@
1
+ import typing as t
2
+
3
+ import tomlkit
4
+
5
+ # Config class types
6
+ CacheKeys = t.Literal["default_config", "config"]
7
+
8
+
9
+ class CacheType(t.TypedDict):
10
+ default_config: t.Optional[tomlkit.TOMLDocument]
11
+ config: t.Optional[tomlkit.TOMLDocument]
12
+
13
+
14
+ class CompleteParams(t.TypedDict):
15
+ api_base: str
16
+ api_key: str
17
+ model: str
18
+ retries: int
19
+ messages: t.Union[list[dict], None, list]
20
+ max_tokens: t.Optional[int]
21
+ temperature: t.Optional[float]
22
+ top_p: t.Optional[float]
23
+ frequency_penalty: t.Optional[float]
24
+ extra_headers: t.Optional[dict]
@@ -0,0 +1,300 @@
1
+ import logging
2
+ import sys
3
+
4
+ import click
5
+ from click import Context
6
+ from git import InvalidGitRepositoryError, NoSuchPathError
7
+
8
+ import gptcomet
9
+ from gptcomet.config_manager import ConfigManager
10
+ from gptcomet.exceptions import ConfigKeyError, GitNoStagedChanges, KeyNotFound
11
+ from gptcomet.hook import AICommitHook
12
+ from gptcomet.message_generator import MessageGenerator
13
+ from gptcomet.utils import common_options
14
+
15
+ logger = logging.getLogger(__name__)
16
+ logging.basicConfig(
17
+ format="%(asctime)s [%(levelname)s] %(filename)s::%(funcName)s: %(message)s",
18
+ datefmt="%Y-%m-%d %H:%M:%S",
19
+ level=logging.WARNING,
20
+ )
21
+
22
+
23
+ @click.group(
24
+ name="gptcomet",
25
+ help="AI-Powered Git Commit Message Generator",
26
+ context_settings={"help_option_names": ["-h", "--help"]},
27
+ )
28
+ @click.pass_context
29
+ @common_options
30
+ @click.version_option(
31
+ gptcomet.__version__,
32
+ "--version",
33
+ "-v",
34
+ prog_name="gptcomet",
35
+ message="%(prog)s: %(version)s",
36
+ )
37
+ def cli(ctx: Context, debug, local):
38
+ """GPTComet CLI"""
39
+ if debug:
40
+ logger.setLevel(logging.DEBUG)
41
+ else:
42
+ logger.setLevel(logging.INFO)
43
+ logger.debug(f"Running with debug={debug}, local={local}")
44
+
45
+ ctx.obj["debug"] = debug
46
+ ctx.obj["local"] = local
47
+ ctx.obj["config_manager"] = None
48
+
49
+
50
+ config: click.Group # type hints for IDE
51
+
52
+ @cli.group(name="config")
53
+ @click.pass_context
54
+ @common_options
55
+ def config(ctx, debug, local):
56
+ """Manage gptcomet configuration."""
57
+ logger.debug(f"Config manage, local={local}")
58
+ if not ctx.obj["config_manager"]:
59
+ ctx.obj["config_manager"] = ConfigManager(ctx.obj["local"])
60
+
61
+
62
+ @config.command("set", help="Set a configuration value.")
63
+ @click.argument("key")
64
+ @click.argument("value")
65
+ @click.pass_context
66
+ @common_options
67
+ def config_set(ctx: Context, key, value, debug, local):
68
+ """Set a configuration value."""
69
+ try:
70
+ ctx.obj["config_manager"].set(key, value)
71
+ click.echo(
72
+ f"[GPTComet] Set {click.style(key, fg='green')} to {click.style(value, fg='green')}."
73
+ )
74
+ except ConfigKeyError as e:
75
+ click.echo(f"[GPTComet] Error: {e!s}")
76
+
77
+
78
+ @config.command("get")
79
+ @click.argument("key")
80
+ @click.pass_context
81
+ @common_options
82
+ def config_get(ctx, key, debug, local):
83
+ """Get a configuration value."""
84
+ try:
85
+ value = ctx.obj["config_manager"].get(key)
86
+ click.echo(f"{key}: {value}")
87
+ except ValueError as e:
88
+ click.echo(f"Error: {e!s}")
89
+ except ConfigKeyError as e:
90
+ click.echo(str(e))
91
+
92
+
93
+ @config.command("list")
94
+ @click.pass_context
95
+ @common_options
96
+ def config_list(ctx: Context, debug, local):
97
+ """List all configuration values."""
98
+ click.echo(
99
+ click.style("Current configuration:\n", fg="green") + ctx.obj["config_manager"].list()
100
+ )
101
+
102
+
103
+ @config.command("reset")
104
+ @click.pass_context
105
+ @common_options
106
+ def reset(ctx: Context, debug, local):
107
+ """Reset configuration to default values."""
108
+ ctx.obj["config_manager"].reset()
109
+ click.echo("Configuration reset to default values")
110
+
111
+
112
+ @config.command(name="keys")
113
+ @click.pass_context
114
+ @common_options
115
+ def config_keys(ctx, debug, local):
116
+ cfg_manager: ConfigManager = ctx.obj["config_manager"]
117
+ keys = cfg_manager.list_keys()
118
+ click.echo(click.style("Supported keys:\n", fg="green") + keys)
119
+
120
+
121
+ @config.command("path")
122
+ @click.pass_context
123
+ @common_options
124
+ def config_path(ctx: Context, debug, local):
125
+ """Get the path to the configuration file."""
126
+ click.echo(
127
+ click.style("Current configuration path:\n", fg="green")
128
+ + ctx.obj["config_manager"].current_config_path.as_posix()
129
+ )
130
+
131
+
132
+ hook: click.Group # type hints for IDE
133
+
134
+
135
+ @cli.group("hook", help="Manage GPTComet prepare-commit-msg hook.")
136
+ @common_options
137
+ @click.pass_context
138
+ def hook(ctx: click.Context, debug, local):
139
+ pass
140
+
141
+
142
+ @hook.command("install", help="Install GPTComet prepare-commit-msg hook to current repository.")
143
+ @click.option(
144
+ "--force/--no-force",
145
+ "-f/-nf",
146
+ default=False,
147
+ help="Force installation or not.",
148
+ show_default=True,
149
+ )
150
+ @common_options
151
+ @click.pass_context
152
+ def install_hook(ctx, debug, local, force=False):
153
+ """Install GPTComet prepare-commit-msg hook."""
154
+ try:
155
+ comet_hook = AICommitHook()
156
+ if comet_hook.is_hook_installed() and not force:
157
+ click.echo(
158
+ "GPTComet prepare-commit-msg hook is already installed, use --force to force installation."
159
+ )
160
+ return
161
+ comet_hook.install_hook()
162
+ click.echo("GPTComet prepare-commit-msg hook has been installed successfully.")
163
+ except InvalidGitRepositoryError as e:
164
+ click.echo(f"Error: {e!s}")
165
+ except Exception as e:
166
+ click.echo(f"An error occurred while installing the hook: {e!s}")
167
+
168
+
169
+ @hook.command("uninstall", help="Uninstall GPTComet prepare-commit-msg hook from current repository.")
170
+ @common_options
171
+ @click.pass_context
172
+ def uninstall_hook(ctx: click.Context, debug, local, **kwargs):
173
+ """Uninstall GPTComet prepare-commit-msg hook."""
174
+ try:
175
+ comet_hook = AICommitHook()
176
+ comet_hook.uninstall_hook()
177
+ except (InvalidGitRepositoryError, NoSuchPathError) as e:
178
+ click.echo(f"Error: {e!s}")
179
+ except Exception as e:
180
+ click.echo(f"An error occurred while uninstalling the hook: {e!s}")
181
+
182
+
183
+ @hook.command("status")
184
+ def hook_status():
185
+ """Check if GPTComet prepare-commit-msg hook is installed."""
186
+ try:
187
+ comet_hook = AICommitHook()
188
+ if comet_hook.is_hook_installed():
189
+ click.echo("GPTComet prepare-commit-msg hook is installed.")
190
+ else:
191
+ click.echo(
192
+ f"GPTComet prepare-commit-msg hook is {click.style('not', fg='yellow')} installed."
193
+ )
194
+ except InvalidGitRepositoryError as e:
195
+ click.echo(f"Error: {e!s}")
196
+ except Exception as e:
197
+ click.echo(f"An error occurred while checking the hook status: {e!s}")
198
+
199
+
200
+ generate: click.Group # type hints for IDE
201
+
202
+
203
+ @cli.group("generate", help="Generate a commit message based on `git diff --staged`.")
204
+ @click.pass_context
205
+ @common_options
206
+ def generate(ctx: click.Context, debug, local):
207
+ ctx.obj["config_manager"] = ConfigManager(ctx.obj["local"])
208
+
209
+
210
+ @generate.command("commit")
211
+ # @click.option("--rich", is_flag=True, default=False, help="Generate rich commit message")
212
+ @common_options
213
+ @click.pass_context
214
+ def generate_commit(ctx: click.Context, debug, local, rich=False, **kwargs):
215
+ """Generate a commit message based on git diff"""
216
+ click.echo(
217
+ click.style(
218
+ "🤖 Hang tight! I'm having a chat with the AI to craft your commit message...",
219
+ fg="green",
220
+ )
221
+ )
222
+ config_manager = ctx.obj["config_manager"]
223
+ message_generator = MessageGenerator(config_manager)
224
+ retry = True
225
+ commit_msg = None
226
+ while retry:
227
+ try:
228
+ commit_msg = message_generator.generate_commit_message(rich)
229
+ except KeyNotFound as e:
230
+ click.echo(f"Error: {e!s}, please check your configuration.")
231
+ raise click.Abort() from None
232
+ except GitNoStagedChanges as e:
233
+ click.echo(str(e))
234
+ raise click.Abort() from None
235
+
236
+ if commit_msg is None:
237
+ click.echo(click.style("No commit message generated.", fg="magenta"))
238
+ return
239
+
240
+ click.echo(click.style("Generated commit message:", fg="green"))
241
+ click.echo(commit_msg)
242
+
243
+ if sys.stdin.isatty():
244
+ # Interactive mode will ask for confirmation
245
+ char = click.prompt(
246
+ click.style(
247
+ "Do you want to use this commit message? y: yes, n: no, r: retry.", fg="green"
248
+ ),
249
+ default="y",
250
+ type=click.Choice(["y", "n", "r"]),
251
+ )
252
+ else:
253
+ click.echo(
254
+ click.style(
255
+ "Non-interactive mode detected, using the generated commit message directly.",
256
+ fg="yellow",
257
+ )
258
+ )
259
+ char = "y"
260
+
261
+ if char == "n":
262
+ click.echo(click.style("Commit message discarded.", fg="yellow"))
263
+ return
264
+ elif char == "y":
265
+ retry = False
266
+ logger.debug(f"Input: {char}")
267
+ if char == "n":
268
+ click.echo(click.style("Commit message discarded.", fg="yellow"))
269
+ return
270
+ elif char == "y":
271
+ retry = False
272
+
273
+ message_generator.repo.index.commit(commit_msg)
274
+ click.echo(click.style("Commit message saved.", fg="green"))
275
+
276
+
277
+ @click.command()
278
+ @click.pass_context
279
+ def generate_prmsg(ctx: click.Context, debug, local):
280
+ """Generate a pull request message based on changes compared to master"""
281
+ config_manager = ctx.obj["config_manager"]
282
+ message_generator = MessageGenerator(config_manager)
283
+
284
+ pr_msg = message_generator.generate_pr_message()
285
+
286
+ click.echo("Generated pull request message:")
287
+ click.echo(pr_msg)
288
+
289
+ if click.confirm("Do you want to use this pull request message?"):
290
+ # Here you could integrate with your Git hosting platform's API
291
+ # to create a pull request with this message
292
+ click.echo(
293
+ "Pull request message saved. You can now use it to create a PR on your Git hosting platform."
294
+ )
295
+ else:
296
+ click.echo("Pull request message discarded.")
297
+
298
+
299
+ if __name__ == "__main__":
300
+ cli()
File without changes