git-copilot-commit 0.1.14__tar.gz → 0.1.16__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-copilot-commit
3
- Version: 0.1.14
3
+ Version: 0.1.16
4
4
  Summary: Automatically generate and commit changes using copilot
5
5
  Author-email: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
6
6
  License-File: LICENSE
@@ -38,24 +38,21 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
38
38
  powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
39
39
  ```
40
40
 
41
- Then install `git-copilot-commit`:
41
+ Then install and run `git-copilot-commit`:
42
42
 
43
43
  ```bash
44
- # Install into isolated environment.
44
+ # Install into global isolated environment
45
45
  uv tool install git-copilot-commit
46
- ```
47
-
48
- Run the tool using:
49
46
 
50
- ```bash
47
+ # Run --help to see available commands
51
48
  git-copilot-commit --help
52
49
  ```
53
50
 
54
- Alternatively, you can always install and run the latest version of tool directly in one command by
55
- using:
51
+ Alternatively, you can install and run the latest version of tool directly every time by invoking
52
+ this one command:
56
53
 
57
54
  ```bash
58
- # Install latest version into temporary environment and run
55
+ # Install latest version into temporary environment and run --help
59
56
  uvx git-copilot-commit --help
60
57
  ```
61
58
 
@@ -87,12 +84,8 @@ pipx install git-copilot-commit
87
84
 
88
85
  ```bash
89
86
  git-copilot-commit commit
90
- ```
91
-
92
- 4. Or, if you want to stage all files before committing use:
93
-
94
- ```bash
95
- git-copilot-commit commit --all
87
+ # Or, if you want to stage all files and accept the generated commit message, use:
88
+ git-copilot-commit commit --all --yes
96
89
  ```
97
90
 
98
91
  ## Usage
@@ -107,8 +100,8 @@ Usage: git-copilot-commit commit [OPTIONS]
107
100
 
108
101
  Options:
109
102
  -a, --all Stage all files before committing
110
- -v, --verbose Show verbose output
111
103
  -m, --model TEXT Model to use for generating commit message
104
+ -y, --yes Automatically accept the generated commit message
112
105
  --help Show this message and exit.
113
106
  ```
114
107
 
@@ -158,10 +151,10 @@ Commit all changes:
158
151
  git-copilot-commit commit --all
159
152
  ```
160
153
 
161
- Verbose output:
154
+ Accept the generated commit message without editing:
162
155
 
163
156
  ```bash
164
- git-copilot-commit commit --verbose
157
+ git-copilot-commit commit --yes
165
158
  ```
166
159
 
167
160
  Use a specific model:
@@ -211,8 +204,7 @@ Now you can run:
211
204
 
212
205
  ```bash
213
206
  git ai-commit
214
- git ai-commit --all --verbose
215
- git ai-commit --model claude-3.5-sonnet
207
+ git ai-commit --all --yes --model claude-3.5-sonnet
216
208
  ```
217
209
 
218
210
  Additionally, show more context in diffs by running the following command:
@@ -25,24 +25,21 @@ curl -LsSf https://astral.sh/uv/install.sh | sh
25
25
  powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
26
26
  ```
27
27
 
28
- Then install `git-copilot-commit`:
28
+ Then install and run `git-copilot-commit`:
29
29
 
30
30
  ```bash
31
- # Install into isolated environment.
31
+ # Install into global isolated environment
32
32
  uv tool install git-copilot-commit
33
- ```
34
-
35
- Run the tool using:
36
33
 
37
- ```bash
34
+ # Run --help to see available commands
38
35
  git-copilot-commit --help
39
36
  ```
40
37
 
41
- Alternatively, you can always install and run the latest version of tool directly in one command by
42
- using:
38
+ Alternatively, you can install and run the latest version of tool directly every time by invoking
39
+ this one command:
43
40
 
44
41
  ```bash
45
- # Install latest version into temporary environment and run
42
+ # Install latest version into temporary environment and run --help
46
43
  uvx git-copilot-commit --help
47
44
  ```
48
45
 
@@ -74,12 +71,8 @@ pipx install git-copilot-commit
74
71
 
75
72
  ```bash
76
73
  git-copilot-commit commit
77
- ```
78
-
79
- 4. Or, if you want to stage all files before committing use:
80
-
81
- ```bash
82
- git-copilot-commit commit --all
74
+ # Or, if you want to stage all files and accept the generated commit message, use:
75
+ git-copilot-commit commit --all --yes
83
76
  ```
84
77
 
85
78
  ## Usage
@@ -94,8 +87,8 @@ Usage: git-copilot-commit commit [OPTIONS]
94
87
 
95
88
  Options:
96
89
  -a, --all Stage all files before committing
97
- -v, --verbose Show verbose output
98
90
  -m, --model TEXT Model to use for generating commit message
91
+ -y, --yes Automatically accept the generated commit message
99
92
  --help Show this message and exit.
100
93
  ```
101
94
 
@@ -145,10 +138,10 @@ Commit all changes:
145
138
  git-copilot-commit commit --all
146
139
  ```
147
140
 
148
- Verbose output:
141
+ Accept the generated commit message without editing:
149
142
 
150
143
  ```bash
151
- git-copilot-commit commit --verbose
144
+ git-copilot-commit commit --yes
152
145
  ```
153
146
 
154
147
  Use a specific model:
@@ -198,8 +191,7 @@ Now you can run:
198
191
 
199
192
  ```bash
200
193
  git ai-commit
201
- git ai-commit --all --verbose
202
- git ai-commit --model claude-3.5-sonnet
194
+ git ai-commit --all --yes --model claude-3.5-sonnet
203
195
  ```
204
196
 
205
197
  Additionally, show more context in diffs by running the following command:
@@ -41,38 +41,6 @@ def main(
41
41
  raise typer.Exit()
42
42
 
43
43
 
44
- def display_file_status(status: GitStatus) -> None:
45
- """Display file status in a rich table."""
46
- if not status.files:
47
- return
48
-
49
- table = Table(title="Git Status")
50
- table.add_column("Status", style="yellow", width=8)
51
- table.add_column("File", style="white")
52
-
53
- # Group files by status
54
- staged = status.staged_files
55
- unstaged = status.unstaged_files
56
- untracked = status.untracked_files
57
-
58
- if staged:
59
- table.add_row("[green]Staged[/green]", "", style="dim")
60
- for file in staged:
61
- table.add_row(f" {file.staged_status}", file.path)
62
-
63
- if unstaged:
64
- table.add_row("[yellow]Unstaged[/yellow]", "", style="dim")
65
- for file in unstaged:
66
- table.add_row(f" {file.status}", file.path)
67
-
68
- if untracked:
69
- table.add_row("[red]Untracked[/red]", "", style="dim")
70
- for file in untracked:
71
- table.add_row(" ?", file.path)
72
-
73
- console.print(table)
74
-
75
-
76
44
  def generate_commit_message(
77
45
  repo: GitRepository, status: GitStatus, model: str | None = None
78
46
  ) -> str:
@@ -120,11 +88,11 @@ The guidelines for the commit messages are as follows:
120
88
 
121
89
  3. Scope (Optional but encouraged):
122
90
 
123
- - Enclose in parentheses, e.g., feat(auth): add login endpoint.
124
- - Use the affected module, component, or area: `auth`, `api`, `ui`, `database`, `config`.
125
- - For multiple files in same area, use the broader scope: `feat(auth): add login and logout endpoints`.
126
- - For single files, you may use filename: `fix(user-service): handle null email validation`.
127
- - Scope should be a single word or hyphenated phrase describing the affected module.
91
+ - Enclose in parentheses
92
+ - Use the affected module, component, or area
93
+ - For multiple files in same area, use the broader scope
94
+ - For single files, you may use filename
95
+ - Scope should be a single word or hyphenated phrase describing the affected module
128
96
 
129
97
  4. Description:
130
98
 
@@ -132,7 +100,7 @@ The guidelines for the commit messages are as follows:
132
100
  - Be concise yet informative.
133
101
  - Focus on the primary change, not all details.
134
102
  - Do not make assumptions about why the change was made or how it works.
135
- - Do not say "improving code readability" or similar; focus on just the change itself.
103
+ - When bumping versions, do not mention the names of the files.
136
104
 
137
105
  5. Analyzing Git Diffs:
138
106
 
@@ -141,21 +109,6 @@ The guidelines for the commit messages are as follows:
141
109
  - Identify the primary purpose of the change set.
142
110
  - If changes span multiple unrelated areas, focus on the most significant one.
143
111
 
144
- Examples:
145
-
146
- ✅ Good Commit Messages:
147
-
148
- - feat(api): add user authentication with JWT
149
- - fix(database): handle connection retries properly
150
- - docs(readme): update installation instructions
151
- - refactor(utils): simplify date parsing logic
152
- - chore(deps): update dependencies to latest versions
153
- - feat(auth): implement OAuth2 integration
154
- - fix(payments): resolve double-charging bug in subscription renewal
155
- - refactor(database): extract query builder into separate module
156
- - chore(ci): add automated security scanning to pipeline
157
- - docs(api): add OpenAPI specifications for user endpoints
158
-
159
112
  ❌ Strongly Avoid:
160
113
 
161
114
  - Vague descriptions: "fixed bug", "updated code", "made changes"
@@ -165,12 +118,12 @@ Examples:
165
118
  - Not in imperative mood: "new feature", "updates stuff"
166
119
 
167
120
  Given a Git diff, a list of modified files, or a short description of changes,
168
- generate a single clear and structured Conventional Commit message following the above rules.
121
+ generate a single, short, clear and structured Conventional Commit message following the above rules.
169
122
  If multiple changes are detected, prioritize the most important changes in a single commit message.
170
123
  Do not add any body or footer.
171
- You can only give one reply for each conversation turn.
124
+ You can only give one reply for each conversation.
172
125
 
173
- Avoid wrapping the whole response in triple backticks or single backticks.
126
+ Do not wrap the response in triple backticks or single backticks.
174
127
  Return the commit message as the output without any additional text, explanations, or formatting markers.
175
128
  """
176
129
  )
@@ -202,13 +155,15 @@ def commit(
202
155
  all_files: bool = typer.Option(
203
156
  False, "--all", "-a", help="Stage all files before committing"
204
157
  ),
205
- verbose: bool = typer.Option(False, "--verbose", "-v", help="Show verbose output"),
206
158
  model: str | None = typer.Option(
207
159
  None, "--model", "-m", help="Model to use for generating commit message"
208
160
  ),
161
+ yes: bool = typer.Option(
162
+ False, "--yes", "-y", help="Automatically accept the generated commit message"
163
+ ),
209
164
  ):
210
165
  """
211
- Automatically commit changes in the current git repository.
166
+ Generate commit message based on changes in the current git repository and commit them.
212
167
  """
213
168
  try:
214
169
  repo = GitRepository()
@@ -228,10 +183,6 @@ def commit(
228
183
  console.print("[yellow]No changes to commit.[/yellow]")
229
184
  raise typer.Exit()
230
185
 
231
- # Display current status
232
- if verbose:
233
- display_file_status(status)
234
-
235
186
  # Handle staging based on options
236
187
  if all_files:
237
188
  repo.stage_files() # Stage all files
@@ -277,40 +228,42 @@ def commit(
277
228
  # Display commit message
278
229
  console.print(Panel(commit_message, title="Commit Message", border_style="green"))
279
230
 
280
- # Show what will be committed in verbose mode
281
- if verbose:
282
- console.print("\n[bold]Changes to be committed:[/bold]")
283
- for file in status.staged_files:
284
- console.print(f" {file.staged_status} {file.path}")
285
-
286
- # Confirm commit or edit message
287
- choice = typer.prompt(
288
- "Choose action: (c)ommit, (e)dit message, (q)uit",
289
- default="c",
290
- show_default=True,
291
- ).lower()
292
-
293
- if choice == "q":
294
- console.print("Commit cancelled.")
295
- raise typer.Exit()
296
- elif choice == "e":
297
- # Use git's built-in editor with generated message as template
298
- console.print("[cyan]Opening git editor...[/cyan]")
299
- try:
300
- commit_sha = repo.commit(commit_message, use_editor=True)
301
- except GitError as e:
302
- console.print(f"[red]Commit failed: {e}[/red]")
303
- raise typer.Exit(1)
304
- elif choice == "c":
305
- # Commit with generated message
231
+ # Confirm commit or edit message (skip if --yes flag is used)
232
+ if yes:
233
+ # Automatically commit with generated message
306
234
  try:
307
235
  commit_sha = repo.commit(commit_message)
308
236
  except GitError as e:
309
237
  console.print(f"[red]Commit failed: {e}[/red]")
310
238
  raise typer.Exit(1)
311
239
  else:
312
- console.print("Invalid choice. Commit cancelled.")
313
- raise typer.Exit()
240
+ choice = typer.prompt(
241
+ "Choose action: (c)ommit, (e)dit message, (q)uit",
242
+ default="c",
243
+ show_default=True,
244
+ ).lower()
245
+
246
+ if choice == "q":
247
+ console.print("Commit cancelled.")
248
+ raise typer.Exit()
249
+ elif choice == "e":
250
+ # Use git's built-in editor with generated message as template
251
+ console.print("[cyan]Opening git editor...[/cyan]")
252
+ try:
253
+ commit_sha = repo.commit(commit_message, use_editor=True)
254
+ except GitError as e:
255
+ console.print(f"[red]Commit failed: {e}[/red]")
256
+ raise typer.Exit(1)
257
+ elif choice == "c":
258
+ # Commit with generated message
259
+ try:
260
+ commit_sha = repo.commit(commit_message)
261
+ except GitError as e:
262
+ console.print(f"[red]Commit failed: {e}[/red]")
263
+ raise typer.Exit(1)
264
+ else:
265
+ console.print("Invalid choice. Commit cancelled.")
266
+ raise typer.Exit()
314
267
 
315
268
  # Show success message
316
269
  console.print(f"[green]✓ Successfully committed: {commit_sha[:8]}[/green]")