git-commit-message 0.6.0__tar.gz → 0.8.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.
Files changed (20) hide show
  1. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/PKG-INFO +115 -33
  2. git_commit_message-0.8.0/README.md +198 -0
  3. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/pyproject.toml +4 -2
  4. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message/_cli.py +81 -18
  5. git_commit_message-0.8.0/src/git_commit_message/_gemini.py +127 -0
  6. git_commit_message-0.8.0/src/git_commit_message/_gpt.py +96 -0
  7. git_commit_message-0.6.0/src/git_commit_message/_gpt.py → git_commit_message-0.8.0/src/git_commit_message/_llm.py +303 -295
  8. git_commit_message-0.8.0/src/git_commit_message/_ollama.py +122 -0
  9. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message.egg-info/PKG-INFO +115 -33
  10. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message.egg-info/SOURCES.txt +3 -0
  11. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message.egg-info/requires.txt +2 -0
  12. git_commit_message-0.6.0/README.md +0 -118
  13. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/UNLICENSE +0 -0
  14. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/setup.cfg +0 -0
  15. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message/__init__.py +0 -0
  16. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message/__main__.py +0 -0
  17. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message/_git.py +0 -0
  18. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message.egg-info/dependency_links.txt +0 -0
  19. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message.egg-info/entry_points.txt +0 -0
  20. {git_commit_message-0.6.0 → git_commit_message-0.8.0}/src/git_commit_message.egg-info/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-commit-message
3
- Version: 0.6.0
4
- Summary: Generate Git commit messages from staged changes using OpenAI GPT
3
+ Version: 0.8.0
4
+ Summary: Generate Git commit messages from staged changes using LLM
5
5
  Maintainer-email: Mina Her <minacle@live.com>
6
6
  License: This is free and unencumbered software released into the public domain.
7
7
 
@@ -44,16 +44,23 @@ Classifier: Topic :: Software Development :: Version Control :: Git
44
44
  Requires-Python: >=3.13
45
45
  Description-Content-Type: text/markdown
46
46
  Requires-Dist: babel>=2.17.0
47
+ Requires-Dist: google-genai>=1.56.0
48
+ Requires-Dist: ollama>=0.4.0
47
49
  Requires-Dist: openai>=2.6.1
48
50
  Requires-Dist: tiktoken>=0.12.0
49
51
 
50
52
  # git-commit-message
51
53
 
52
- Staged changes -> GPT commit message generator.
54
+ Generate a commit message from your staged changes using OpenAI, Google Gemini, or Ollama.
53
55
 
54
56
  [![asciicast](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN.svg)](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN)
55
57
 
56
- ## Install (PyPI)
58
+ ## Requirements
59
+
60
+ - Python 3.13+
61
+ - A Git repo with staged changes (`git add ...`)
62
+
63
+ ## Install
57
64
 
58
65
  Install the latest released version from PyPI:
59
66
 
@@ -77,13 +84,43 @@ Quick check:
77
84
  git-commit-message --help
78
85
  ```
79
86
 
80
- Set your API key (POSIX sh):
87
+ ## Setup
88
+
89
+ ### OpenAI
81
90
 
82
91
  ```sh
83
92
  export OPENAI_API_KEY="sk-..."
84
93
  ```
85
94
 
86
- Note (fish): In fish, set it as follows.
95
+ ### Google Gemini
96
+
97
+ ```sh
98
+ export GOOGLE_API_KEY="..."
99
+ ```
100
+
101
+ ### Ollama (local models)
102
+
103
+ 1. Install Ollama: https://ollama.ai
104
+ 2. Start the server:
105
+
106
+ ```sh
107
+ ollama serve
108
+ ```
109
+
110
+ 3. Pull a model:
111
+
112
+ ```sh
113
+ ollama pull mistral
114
+ ```
115
+
116
+ Optional: set defaults:
117
+
118
+ ```sh
119
+ export GIT_COMMIT_MESSAGE_PROVIDER=ollama
120
+ export OLLAMA_MODEL=mistral
121
+ ```
122
+
123
+ Note (fish):
87
124
 
88
125
  ```fish
89
126
  set -x OPENAI_API_KEY "sk-..."
@@ -97,71 +134,116 @@ python -m pip install -e .
97
134
 
98
135
  ## Usage
99
136
 
100
- - Print commit message only:
137
+ Generate and print a commit message:
101
138
 
102
139
  ```sh
103
140
  git add -A
104
141
  git-commit-message "optional extra context about the change"
105
142
  ```
106
143
 
107
- - Force single-line subject only:
144
+ Generate a single-line subject only:
108
145
 
109
146
  ```sh
110
147
  git-commit-message --one-line "optional context"
111
148
  ```
112
149
 
113
- - Limit subject length (default 72):
150
+ Select provider:
114
151
 
115
152
  ```sh
116
- git-commit-message --one-line --max-length 50 "optional context"
153
+ # OpenAI (default)
154
+ git-commit-message --provider openai
155
+
156
+ # Google Gemini (via google-genai)
157
+ git-commit-message --provider google
158
+
159
+ # Ollama
160
+ git-commit-message --provider ollama
117
161
  ```
118
162
 
119
- - Chunk long diffs by token budget (0 = single chunk + summary, -1 = disable chunking):
163
+ Commit immediately (optionally open editor):
164
+
165
+ ```sh
166
+ git-commit-message --commit "refactor parser for speed"
167
+ git-commit-message --commit --edit "refactor parser for speed"
168
+ ```
169
+
170
+ Limit subject length:
171
+
172
+ ```sh
173
+ git-commit-message --one-line --max-length 50
174
+ ```
175
+
176
+ Chunk/summarise long diffs by token budget:
120
177
 
121
178
  ```sh
122
179
  # force a single summary pass over the whole diff (default)
123
- git-commit-message --chunk-tokens 0 "optional context"
180
+ git-commit-message --chunk-tokens 0
124
181
 
125
182
  # chunk the diff into ~4000-token pieces before summarising
126
- git-commit-message --chunk-tokens 4000 "optional context"
183
+ git-commit-message --chunk-tokens 4000
127
184
 
128
185
  # disable summarisation and use the legacy one-shot prompt
129
- git-commit-message --chunk-tokens -1 "optional context"
186
+ git-commit-message --chunk-tokens -1
130
187
  ```
131
188
 
132
- - Commit immediately with editor:
189
+ Select output language/locale (IETF language tag):
133
190
 
134
191
  ```sh
135
- git-commit-message --commit --edit "refactor parser for speed"
192
+ git-commit-message --language en-US
193
+ git-commit-message --language ko-KR
194
+ git-commit-message --language ja-JP
136
195
  ```
137
196
 
138
- - Select output language/locale (default: en-GB):
197
+ Print debug info:
139
198
 
140
199
  ```sh
141
- # American English
142
- git-commit-message --language en-US "optional context"
200
+ git-commit-message --debug
201
+ ```
143
202
 
144
- # Korean
145
- git-commit-message --language ko-KR
203
+ Configure Ollama host (if running on a different machine):
146
204
 
147
- # Japanese
148
- git-commit-message --language ja-JP
205
+ ```sh
206
+ git-commit-message --provider ollama --host http://192.168.1.100:11434
149
207
  ```
150
208
 
151
- Notes:
209
+ ## Options
210
+
211
+ - `--provider {openai,google,ollama}`: provider to use (default: `openai`)
212
+ - `--model MODEL`: model override (provider-specific)
213
+ - `--language TAG`: output language/locale (default: `en-GB`)
214
+ - `--one-line`: output subject only
215
+ - `--max-length N`: max subject length (default: 72)
216
+ - `--chunk-tokens N`: token budget per diff chunk (`0` = single summary pass, `-1` disables summarisation)
217
+ - `--debug`: print request/response details
218
+ - `--commit`: run `git commit -m <message>`
219
+ - `--edit`: with `--commit`, open editor for final message
220
+ - `--host URL`: host URL for providers like Ollama (default: `http://localhost:11434`)
221
+
222
+ ## Environment variables
223
+
224
+ Required:
225
+
226
+ - `OPENAI_API_KEY`: when provider is `openai`
227
+ - `GOOGLE_API_KEY`: when provider is `google`
228
+
229
+ Optional:
152
230
 
153
- - The model is instructed to write using the selected language/locale.
154
- - In multi-line mode, the only allowed label ("Rationale:") is also translated into the target language.
231
+ - `GIT_COMMIT_MESSAGE_PROVIDER`: default provider (`openai` by default). `--provider` overrides this.
232
+ - `GIT_COMMIT_MESSAGE_MODEL`: model override for any provider. `--model` overrides this.
233
+ - `OPENAI_MODEL`: OpenAI-only model override (used if `--model`/`GIT_COMMIT_MESSAGE_MODEL` are not set)
234
+ - `OLLAMA_MODEL`: Ollama-only model override (used if `--model`/`GIT_COMMIT_MESSAGE_MODEL` are not set)
235
+ - `OLLAMA_HOST`: Ollama server URL (default: `http://localhost:11434`)
236
+ - `GIT_COMMIT_MESSAGE_LANGUAGE`: default language/locale (default: `en-GB`)
237
+ - `GIT_COMMIT_MESSAGE_CHUNK_TOKENS`: default chunk token budget (default: `0`)
155
238
 
156
- Environment:
239
+ Default models (if not overridden):
157
240
 
158
- - `OPENAI_API_KEY`: required
159
- - `GIT_COMMIT_MESSAGE_MODEL` or `OPENAI_MODEL`: optional (default: `gpt-5-mini`)
160
- - `GIT_COMMIT_MESSAGE_LANGUAGE`: optional (default: `en-GB`)
161
- - `GIT_COMMIT_MESSAGE_CHUNK_TOKENS`: optional token budget per diff chunk (default: 0 = single chunk + summary; -1 disables summarisation)
241
+ - OpenAI: `gpt-5-mini`
242
+ - Google: `gemini-2.5-flash`
243
+ - Ollama: `gpt-oss:20b`
162
244
 
163
- ## AIgenerated code notice
245
+ ## AI-generated code notice
164
246
 
165
247
  Parts of this project were created with assistance from AI tools (e.g. large language models).
166
- All AIassisted contributions were reviewed and adapted by maintainers before inclusion.
248
+ All AI-assisted contributions were reviewed and adapted by maintainers before inclusion.
167
249
  If you need provenance for specific changes, please refer to the Git history and commit messages.
@@ -0,0 +1,198 @@
1
+ # git-commit-message
2
+
3
+ Generate a commit message from your staged changes using OpenAI, Google Gemini, or Ollama.
4
+
5
+ [![asciicast](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN.svg)](https://asciinema.org/a/jk0phFqNnc5vaCiIZEYBwZOyN)
6
+
7
+ ## Requirements
8
+
9
+ - Python 3.13+
10
+ - A Git repo with staged changes (`git add ...`)
11
+
12
+ ## Install
13
+
14
+ Install the latest released version from PyPI:
15
+
16
+ ```sh
17
+ # User environment (recommended)
18
+ python -m pip install --user git-commit-message
19
+
20
+ # Or system/virtualenv as appropriate
21
+ python -m pip install git-commit-message
22
+
23
+ # Or with pipx for isolated CLI installs
24
+ pipx install git-commit-message
25
+
26
+ # Upgrade to the newest version
27
+ python -m pip install --upgrade git-commit-message
28
+ ```
29
+
30
+ Quick check:
31
+
32
+ ```sh
33
+ git-commit-message --help
34
+ ```
35
+
36
+ ## Setup
37
+
38
+ ### OpenAI
39
+
40
+ ```sh
41
+ export OPENAI_API_KEY="sk-..."
42
+ ```
43
+
44
+ ### Google Gemini
45
+
46
+ ```sh
47
+ export GOOGLE_API_KEY="..."
48
+ ```
49
+
50
+ ### Ollama (local models)
51
+
52
+ 1. Install Ollama: https://ollama.ai
53
+ 2. Start the server:
54
+
55
+ ```sh
56
+ ollama serve
57
+ ```
58
+
59
+ 3. Pull a model:
60
+
61
+ ```sh
62
+ ollama pull mistral
63
+ ```
64
+
65
+ Optional: set defaults:
66
+
67
+ ```sh
68
+ export GIT_COMMIT_MESSAGE_PROVIDER=ollama
69
+ export OLLAMA_MODEL=mistral
70
+ ```
71
+
72
+ Note (fish):
73
+
74
+ ```fish
75
+ set -x OPENAI_API_KEY "sk-..."
76
+ ```
77
+
78
+ ## Install (editable)
79
+
80
+ ```sh
81
+ python -m pip install -e .
82
+ ```
83
+
84
+ ## Usage
85
+
86
+ Generate and print a commit message:
87
+
88
+ ```sh
89
+ git add -A
90
+ git-commit-message "optional extra context about the change"
91
+ ```
92
+
93
+ Generate a single-line subject only:
94
+
95
+ ```sh
96
+ git-commit-message --one-line "optional context"
97
+ ```
98
+
99
+ Select provider:
100
+
101
+ ```sh
102
+ # OpenAI (default)
103
+ git-commit-message --provider openai
104
+
105
+ # Google Gemini (via google-genai)
106
+ git-commit-message --provider google
107
+
108
+ # Ollama
109
+ git-commit-message --provider ollama
110
+ ```
111
+
112
+ Commit immediately (optionally open editor):
113
+
114
+ ```sh
115
+ git-commit-message --commit "refactor parser for speed"
116
+ git-commit-message --commit --edit "refactor parser for speed"
117
+ ```
118
+
119
+ Limit subject length:
120
+
121
+ ```sh
122
+ git-commit-message --one-line --max-length 50
123
+ ```
124
+
125
+ Chunk/summarise long diffs by token budget:
126
+
127
+ ```sh
128
+ # force a single summary pass over the whole diff (default)
129
+ git-commit-message --chunk-tokens 0
130
+
131
+ # chunk the diff into ~4000-token pieces before summarising
132
+ git-commit-message --chunk-tokens 4000
133
+
134
+ # disable summarisation and use the legacy one-shot prompt
135
+ git-commit-message --chunk-tokens -1
136
+ ```
137
+
138
+ Select output language/locale (IETF language tag):
139
+
140
+ ```sh
141
+ git-commit-message --language en-US
142
+ git-commit-message --language ko-KR
143
+ git-commit-message --language ja-JP
144
+ ```
145
+
146
+ Print debug info:
147
+
148
+ ```sh
149
+ git-commit-message --debug
150
+ ```
151
+
152
+ Configure Ollama host (if running on a different machine):
153
+
154
+ ```sh
155
+ git-commit-message --provider ollama --host http://192.168.1.100:11434
156
+ ```
157
+
158
+ ## Options
159
+
160
+ - `--provider {openai,google,ollama}`: provider to use (default: `openai`)
161
+ - `--model MODEL`: model override (provider-specific)
162
+ - `--language TAG`: output language/locale (default: `en-GB`)
163
+ - `--one-line`: output subject only
164
+ - `--max-length N`: max subject length (default: 72)
165
+ - `--chunk-tokens N`: token budget per diff chunk (`0` = single summary pass, `-1` disables summarisation)
166
+ - `--debug`: print request/response details
167
+ - `--commit`: run `git commit -m <message>`
168
+ - `--edit`: with `--commit`, open editor for final message
169
+ - `--host URL`: host URL for providers like Ollama (default: `http://localhost:11434`)
170
+
171
+ ## Environment variables
172
+
173
+ Required:
174
+
175
+ - `OPENAI_API_KEY`: when provider is `openai`
176
+ - `GOOGLE_API_KEY`: when provider is `google`
177
+
178
+ Optional:
179
+
180
+ - `GIT_COMMIT_MESSAGE_PROVIDER`: default provider (`openai` by default). `--provider` overrides this.
181
+ - `GIT_COMMIT_MESSAGE_MODEL`: model override for any provider. `--model` overrides this.
182
+ - `OPENAI_MODEL`: OpenAI-only model override (used if `--model`/`GIT_COMMIT_MESSAGE_MODEL` are not set)
183
+ - `OLLAMA_MODEL`: Ollama-only model override (used if `--model`/`GIT_COMMIT_MESSAGE_MODEL` are not set)
184
+ - `OLLAMA_HOST`: Ollama server URL (default: `http://localhost:11434`)
185
+ - `GIT_COMMIT_MESSAGE_LANGUAGE`: default language/locale (default: `en-GB`)
186
+ - `GIT_COMMIT_MESSAGE_CHUNK_TOKENS`: default chunk token budget (default: `0`)
187
+
188
+ Default models (if not overridden):
189
+
190
+ - OpenAI: `gpt-5-mini`
191
+ - Google: `gemini-2.5-flash`
192
+ - Ollama: `gpt-oss:20b`
193
+
194
+ ## AI-generated code notice
195
+
196
+ Parts of this project were created with assistance from AI tools (e.g. large language models).
197
+ All AI-assisted contributions were reviewed and adapted by maintainers before inclusion.
198
+ If you need provenance for specific changes, please refer to the Git history and commit messages.
@@ -1,11 +1,13 @@
1
1
  [project]
2
2
  name = "git-commit-message"
3
- version = "0.6.0"
4
- description = "Generate Git commit messages from staged changes using OpenAI GPT"
3
+ version = "0.8.0"
4
+ description = "Generate Git commit messages from staged changes using LLM"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
7
7
  dependencies = [
8
8
  "babel>=2.17.0",
9
+ "google-genai>=1.56.0",
10
+ "ollama>=0.4.0",
9
11
  "openai>=2.6.1",
10
12
  "tiktoken>=0.12.0",
11
13
  ]
@@ -1,6 +1,6 @@
1
1
  """Command-line interface entry point.
2
2
 
3
- Collect staged changes from the repository and call an OpenAI GPT model
3
+ Collect staged changes from the repository and call an LLM provider
4
4
  to generate a commit message, or create a commit straight away.
5
5
  """
6
6
 
@@ -19,13 +19,46 @@ from ._git import (
19
19
  get_staged_diff,
20
20
  has_staged_changes,
21
21
  )
22
- from ._gpt import (
22
+ from ._llm import (
23
+ CommitMessageResult,
24
+ UnsupportedProviderError,
23
25
  generate_commit_message,
24
26
  generate_commit_message_with_info,
25
- CommitMessageResult,
26
27
  )
27
28
 
28
29
 
30
+ class CliArgs(Namespace):
31
+ __slots__ = (
32
+ "description",
33
+ "commit",
34
+ "edit",
35
+ "provider",
36
+ "model",
37
+ "language",
38
+ "debug",
39
+ "one_line",
40
+ "max_length",
41
+ "chunk_tokens",
42
+ "host",
43
+ )
44
+
45
+ def __init__(
46
+ self,
47
+ /,
48
+ ) -> None:
49
+ self.description: str | None = None
50
+ self.commit: bool = False
51
+ self.edit: bool = False
52
+ self.provider: str | None = None
53
+ self.model: str | None = None
54
+ self.language: str | None = None
55
+ self.debug: bool = False
56
+ self.one_line: bool = False
57
+ self.max_length: int | None = None
58
+ self.chunk_tokens: int | None = None
59
+ self.host: str | None = None
60
+
61
+
29
62
  def _env_chunk_tokens_default() -> int | None:
30
63
  """Return chunk token default from env if valid, else None."""
31
64
 
@@ -50,7 +83,7 @@ def _build_parser() -> ArgumentParser:
50
83
  parser: ArgumentParser = ArgumentParser(
51
84
  prog="git-commit-message",
52
85
  description=(
53
- "Generate a commit message with OpenAI GPT based on the staged changes."
86
+ "Generate a commit message based on the staged changes."
54
87
  ),
55
88
  )
56
89
 
@@ -72,11 +105,21 @@ def _build_parser() -> ArgumentParser:
72
105
  help="Open an editor to amend the message before committing. Use with '--commit'.",
73
106
  )
74
107
 
108
+ parser.add_argument(
109
+ "--provider",
110
+ default=None,
111
+ help=(
112
+ "LLM provider to use (default: openai). "
113
+ "You may also set GIT_COMMIT_MESSAGE_PROVIDER. "
114
+ "The CLI flag overrides the environment variable."
115
+ ),
116
+ )
117
+
75
118
  parser.add_argument(
76
119
  "--model",
77
120
  default=None,
78
121
  help=(
79
- "OpenAI model name to use. If unspecified, uses the environment variables (GIT_COMMIT_MESSAGE_MODEL, OPENAI_MODEL) or 'gpt-5-mini'."
122
+ "Model name to use. If unspecified, uses GIT_COMMIT_MESSAGE_MODEL or a provider-specific default (openai: gpt-5-mini; google: gemini-2.5-flash; ollama: gpt-oss:20b)."
80
123
  ),
81
124
  )
82
125
 
@@ -123,11 +166,21 @@ def _build_parser() -> ArgumentParser:
123
166
  ),
124
167
  )
125
168
 
169
+ parser.add_argument(
170
+ "--host",
171
+ dest="host",
172
+ default=None,
173
+ help=(
174
+ "Host URL for API providers like Ollama (default: http://localhost:11434). "
175
+ "You may also set OLLAMA_HOST for Ollama."
176
+ ),
177
+ )
178
+
126
179
  return parser
127
180
 
128
181
 
129
182
  def _run(
130
- args: Namespace,
183
+ args: CliArgs,
131
184
  /,
132
185
  ) -> int:
133
186
  """Main execution logic.
@@ -166,10 +219,12 @@ def _run(
166
219
  diff_text,
167
220
  hint,
168
221
  args.model,
169
- getattr(args, "one_line", False),
170
- getattr(args, "max_length", None),
171
- getattr(args, "language", None),
222
+ args.one_line,
223
+ args.max_length,
224
+ args.language,
172
225
  chunk_tokens,
226
+ args.provider,
227
+ args.host,
173
228
  )
174
229
  message = result.message
175
230
  else:
@@ -177,17 +232,22 @@ def _run(
177
232
  diff_text,
178
233
  hint,
179
234
  args.model,
180
- getattr(args, "one_line", False),
181
- getattr(args, "max_length", None),
182
- getattr(args, "language", None),
235
+ args.one_line,
236
+ args.max_length,
237
+ args.language,
183
238
  chunk_tokens,
239
+ args.provider,
240
+ args.host,
184
241
  )
242
+ except UnsupportedProviderError as exc:
243
+ print(str(exc), file=stderr)
244
+ return 3
185
245
  except Exception as exc: # noqa: BLE001 - to preserve standard output messaging
186
246
  print(f"Failed to generate commit message: {exc}", file=stderr)
187
247
  return 3
188
248
 
189
249
  # Option: force single-line message
190
- if getattr(args, "one_line", False):
250
+ if args.one_line:
191
251
  # Use the first non-empty line only
192
252
  for line in (ln.strip() for ln in message.splitlines()):
193
253
  if line:
@@ -199,9 +259,10 @@ def _run(
199
259
  if not args.commit:
200
260
  if args.debug and result is not None:
201
261
  # Print debug information
202
- print("==== OpenAI Usage ====")
262
+ print(f"==== {result.provider} Usage ====")
263
+ print(f"provider: {result.provider}")
203
264
  print(f"model: {result.model}")
204
- print(f"response_id: {getattr(result, 'response_id', '(n/a)')}")
265
+ print(f"response_id: {result.response_id or '(n/a)'}")
205
266
  if result.total_tokens is not None:
206
267
  print(
207
268
  f"tokens: prompt={result.prompt_tokens} completion={result.completion_tokens} total={result.total_tokens}"
@@ -220,9 +281,10 @@ def _run(
220
281
 
221
282
  if args.debug and result is not None:
222
283
  # Also print debug info before commit
223
- print("==== OpenAI Usage ====")
284
+ print(f"==== {result.provider} Usage ====")
285
+ print(f"provider: {result.provider}")
224
286
  print(f"model: {result.model}")
225
- print(f"response_id: {getattr(result, 'response_id', '(n/a)')}")
287
+ print(f"response_id: {result.response_id or '(n/a)'}")
226
288
  if result.total_tokens is not None:
227
289
  print(
228
290
  f"tokens: prompt={result.prompt_tokens} completion={result.completion_tokens} total={result.total_tokens}"
@@ -251,7 +313,8 @@ def main() -> None:
251
313
  """
252
314
 
253
315
  parser: Final[ArgumentParser] = _build_parser()
254
- args: Namespace = parser.parse_args()
316
+ args = CliArgs()
317
+ parser.parse_args(namespace=args)
255
318
 
256
319
  if args.edit and not args.commit:
257
320
  print("'--edit' must be used together with '--commit'.", file=stderr)