git-copilot-commit 0.1.13__tar.gz → 0.1.15__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_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/PKG-INFO +10 -16
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/README.md +9 -15
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/src/git_copilot_commit/cli.py +35 -24
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/src/git_copilot_commit/git.py +0 -48
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/.github/workflows/ci.yml +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/.gitignore +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/.python-version +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/LICENSE +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/pyproject.toml +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/src/git_copilot_commit/__init__.py +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/src/git_copilot_commit/py.typed +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/src/git_copilot_commit/settings.py +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/src/git_copilot_commit/version.py +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/uv.lock +0 -0
- {git_copilot_commit-0.1.13 → git_copilot_commit-0.1.15}/vhs/demo.vhs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: git-copilot-commit
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.15
|
|
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
|
-
|
|
47
|
+
# Run --help to see available commands
|
|
51
48
|
git-copilot-commit --help
|
|
52
49
|
```
|
|
53
50
|
|
|
54
|
-
Alternatively, you can
|
|
55
|
-
|
|
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
|
|
@@ -109,6 +102,7 @@ Options:
|
|
|
109
102
|
-a, --all Stage all files before committing
|
|
110
103
|
-v, --verbose Show verbose output
|
|
111
104
|
-m, --model TEXT Model to use for generating commit message
|
|
105
|
+
-y, --yes Automatically accept the generated commit message
|
|
112
106
|
--help Show this message and exit.
|
|
113
107
|
```
|
|
114
108
|
|
|
@@ -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
|
-
|
|
34
|
+
# Run --help to see available commands
|
|
38
35
|
git-copilot-commit --help
|
|
39
36
|
```
|
|
40
37
|
|
|
41
|
-
Alternatively, you can
|
|
42
|
-
|
|
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
|
|
@@ -96,6 +89,7 @@ Options:
|
|
|
96
89
|
-a, --all Stage all files before committing
|
|
97
90
|
-v, --verbose Show verbose output
|
|
98
91
|
-m, --model TEXT Model to use for generating commit message
|
|
92
|
+
-y, --yes Automatically accept the generated commit message
|
|
99
93
|
--help Show this message and exit.
|
|
100
94
|
```
|
|
101
95
|
|
|
@@ -9,7 +9,7 @@ from rich.panel import Panel
|
|
|
9
9
|
from rich.table import Table
|
|
10
10
|
import rich
|
|
11
11
|
|
|
12
|
-
from pycopilot.copilot import Copilot
|
|
12
|
+
from pycopilot.copilot import Copilot # type: ignore
|
|
13
13
|
from pycopilot.auth import Authentication
|
|
14
14
|
from .git import GitRepository, GitError, NotAGitRepositoryError, GitStatus
|
|
15
15
|
from .settings import Settings
|
|
@@ -206,9 +206,12 @@ def commit(
|
|
|
206
206
|
model: str | None = typer.Option(
|
|
207
207
|
None, "--model", "-m", help="Model to use for generating commit message"
|
|
208
208
|
),
|
|
209
|
+
yes: bool = typer.Option(
|
|
210
|
+
False, "--yes", "-y", help="Automatically accept the generated commit message"
|
|
211
|
+
),
|
|
209
212
|
):
|
|
210
213
|
"""
|
|
211
|
-
|
|
214
|
+
Generate commit message based on changes in the current git repository and commit them.
|
|
212
215
|
"""
|
|
213
216
|
try:
|
|
214
217
|
repo = GitRepository()
|
|
@@ -283,34 +286,42 @@ def commit(
|
|
|
283
286
|
for file in status.staged_files:
|
|
284
287
|
console.print(f" {file.staged_status} {file.path}")
|
|
285
288
|
|
|
286
|
-
# Confirm commit or edit message
|
|
287
|
-
|
|
288
|
-
|
|
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
|
|
289
|
+
# Confirm commit or edit message (skip if --yes flag is used)
|
|
290
|
+
if yes:
|
|
291
|
+
# Automatically commit with generated message
|
|
306
292
|
try:
|
|
307
293
|
commit_sha = repo.commit(commit_message)
|
|
308
294
|
except GitError as e:
|
|
309
295
|
console.print(f"[red]Commit failed: {e}[/red]")
|
|
310
296
|
raise typer.Exit(1)
|
|
311
297
|
else:
|
|
312
|
-
|
|
313
|
-
|
|
298
|
+
choice = typer.prompt(
|
|
299
|
+
"Choose action: (c)ommit, (e)dit message, (q)uit",
|
|
300
|
+
default="c",
|
|
301
|
+
show_default=True,
|
|
302
|
+
).lower()
|
|
303
|
+
|
|
304
|
+
if choice == "q":
|
|
305
|
+
console.print("Commit cancelled.")
|
|
306
|
+
raise typer.Exit()
|
|
307
|
+
elif choice == "e":
|
|
308
|
+
# Use git's built-in editor with generated message as template
|
|
309
|
+
console.print("[cyan]Opening git editor...[/cyan]")
|
|
310
|
+
try:
|
|
311
|
+
commit_sha = repo.commit(commit_message, use_editor=True)
|
|
312
|
+
except GitError as e:
|
|
313
|
+
console.print(f"[red]Commit failed: {e}[/red]")
|
|
314
|
+
raise typer.Exit(1)
|
|
315
|
+
elif choice == "c":
|
|
316
|
+
# Commit with generated message
|
|
317
|
+
try:
|
|
318
|
+
commit_sha = repo.commit(commit_message)
|
|
319
|
+
except GitError as e:
|
|
320
|
+
console.print(f"[red]Commit failed: {e}[/red]")
|
|
321
|
+
raise typer.Exit(1)
|
|
322
|
+
else:
|
|
323
|
+
console.print("Invalid choice. Commit cancelled.")
|
|
324
|
+
raise typer.Exit()
|
|
314
325
|
|
|
315
326
|
# Show success message
|
|
316
327
|
console.print(f"[green]✓ Successfully committed: {commit_sha[:8]}[/green]")
|
|
@@ -302,51 +302,3 @@ class GitRepository:
|
|
|
302
302
|
commits.append((sha, message))
|
|
303
303
|
|
|
304
304
|
return commits
|
|
305
|
-
|
|
306
|
-
def get_current_branch(self) -> str:
|
|
307
|
-
"""Get the name of the current branch."""
|
|
308
|
-
result = self._run_git_command(["rev-parse", "--abbrev-ref", "HEAD"])
|
|
309
|
-
return result.stdout.strip()
|
|
310
|
-
|
|
311
|
-
def has_changes(self) -> bool:
|
|
312
|
-
"""Check if there are any changes (staged, unstaged, or untracked)."""
|
|
313
|
-
status = self.get_status()
|
|
314
|
-
return (
|
|
315
|
-
status.has_staged_changes
|
|
316
|
-
or status.has_unstaged_changes
|
|
317
|
-
or status.has_untracked_files
|
|
318
|
-
)
|
|
319
|
-
|
|
320
|
-
def get_diff(self, staged: bool = False, paths: list[str] | None = None) -> str:
|
|
321
|
-
"""
|
|
322
|
-
Get diff output.
|
|
323
|
-
|
|
324
|
-
Args:
|
|
325
|
-
staged: Whether to get staged diff (--staged flag).
|
|
326
|
-
paths: Specific paths to diff.
|
|
327
|
-
|
|
328
|
-
Returns:
|
|
329
|
-
Diff output as string.
|
|
330
|
-
"""
|
|
331
|
-
args = ["diff"]
|
|
332
|
-
if staged:
|
|
333
|
-
args.append("--staged")
|
|
334
|
-
if paths:
|
|
335
|
-
args.extend(["--"] + paths)
|
|
336
|
-
|
|
337
|
-
result = self._run_git_command(args)
|
|
338
|
-
return result.stdout
|
|
339
|
-
|
|
340
|
-
def get_file_content(self, path: str, revision: str = "HEAD") -> str:
|
|
341
|
-
"""
|
|
342
|
-
Get content of a file at a specific revision.
|
|
343
|
-
|
|
344
|
-
Args:
|
|
345
|
-
path: File path.
|
|
346
|
-
revision: Git revision (default: HEAD).
|
|
347
|
-
|
|
348
|
-
Returns:
|
|
349
|
-
File content as string.
|
|
350
|
-
"""
|
|
351
|
-
result = self._run_git_command(["show", f"{revision}:{path}"])
|
|
352
|
-
return result.stdout
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|