git-copilot-commit 0.1.0__tar.gz → 0.1.1__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.1/PKG-INFO +143 -0
- git_copilot_commit-0.1.1/README.md +130 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/pyproject.toml +1 -1
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/src/git_copilot_commit/cli.py +4 -54
- git_copilot_commit-0.1.0/PKG-INFO +0 -11
- git_copilot_commit-0.1.0/README.md +0 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/.gitignore +0 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/.python-version +0 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/LICENSE +0 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/src/git_copilot_commit/__init__.py +0 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/src/git_copilot_commit/git.py +0 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/src/git_copilot_commit/py.typed +0 -0
- {git_copilot_commit-0.1.0 → git_copilot_commit-0.1.1}/uv.lock +0 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: git-copilot-commit
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Automatically generate and commit changes using copilot
|
|
5
|
+
Author-email: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.12
|
|
8
|
+
Requires-Dist: pycopilot>=0.1.1
|
|
9
|
+
Requires-Dist: rich>=14.0.0
|
|
10
|
+
Requires-Dist: typer>=0.16.0
|
|
11
|
+
Requires-Dist: xdg-base-dirs>=6.0.2
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
|
|
14
|
+
# git-copilot-commit
|
|
15
|
+
|
|
16
|
+
🤖 AI-powered Git commit assistant that automatically generates conventional commit messages using
|
|
17
|
+
GitHub Copilot.
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **AI-Generated Commit Messages**: Uses GitHub Copilot to analyze your staged changes and generate
|
|
22
|
+
conventional commit messages
|
|
23
|
+
- **Message Editing**: Edit generated messages using your git-configured editor or commit directly
|
|
24
|
+
- **Conventional Commits**: Follows the [Conventional Commits](https://www.conventionalcommits.org/)
|
|
25
|
+
specification
|
|
26
|
+
- **Rich Output**: Beautiful terminal output with syntax highlighting and tables
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
Install using uv (recommended):
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
uv tool install git-copilot-commit
|
|
34
|
+
# or
|
|
35
|
+
uvx git-copilot-commit
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Or with pip:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pipx install git-copilot-commit
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
1. **GitHub Copilot Access**: You need an active GitHub Copilot subscription
|
|
47
|
+
2. **Authentication**: Authenticate with GitHub Copilot before first use
|
|
48
|
+
|
|
49
|
+
## Quick Start
|
|
50
|
+
|
|
51
|
+
1. **Authenticate with GitHub Copilot**:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git-copilot-commit authenticate
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
2. **Make some changes** in your git repository
|
|
58
|
+
|
|
59
|
+
3. **Generate and commit**:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git-copilot-commit commit
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
#### `commit`
|
|
68
|
+
|
|
69
|
+
Automatically commit changes in the current git repository:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
git-copilot-commit commit
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Options:**
|
|
76
|
+
|
|
77
|
+
- `--all, -a`: Stage all files before committing
|
|
78
|
+
- `--verbose, -v`: Show verbose output with file details
|
|
79
|
+
|
|
80
|
+
1. The tool analyzes your changes
|
|
81
|
+
2. Prompts you to stage files (if needed)
|
|
82
|
+
3. Generates an AI-powered commit message
|
|
83
|
+
4. Offers three choices:
|
|
84
|
+
- `(c)ommit`: Commit with the generated message
|
|
85
|
+
- `(e)dit`: Edit the message in your git-configured editor
|
|
86
|
+
- `(q)uit`: Cancel the commit
|
|
87
|
+
|
|
88
|
+
#### `authenticate`
|
|
89
|
+
|
|
90
|
+
Set up authentication with GitHub Copilot:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
git-copilot-commit authenticate
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### `models`
|
|
97
|
+
|
|
98
|
+
List available AI models:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git-copilot-commit models
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Examples
|
|
105
|
+
|
|
106
|
+
**Commit all changes with staging prompts:**
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git-copilot-commit commit --all
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Commit with verbose output:**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
git-copilot-commit commit --verbose
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Generated Commit Message Format
|
|
119
|
+
|
|
120
|
+
The tool follows the [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
<type>[optional scope]: <description>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Supported Types:**
|
|
127
|
+
|
|
128
|
+
- `feat`: A new feature
|
|
129
|
+
- `fix`: A bug fix
|
|
130
|
+
- `docs`: Documentation changes
|
|
131
|
+
- `style`: Code formatting (no logic changes)
|
|
132
|
+
- `refactor`: Code restructuring (no behavior changes)
|
|
133
|
+
- `perf`: Performance improvements
|
|
134
|
+
- `test`: Adding or updating tests
|
|
135
|
+
- `chore`: Maintenance tasks (tooling, dependencies, etc.)
|
|
136
|
+
- `revert`: Reverting previous changes
|
|
137
|
+
|
|
138
|
+
**Example Messages:**
|
|
139
|
+
|
|
140
|
+
- `feat(auth): add user authentication with JWT`
|
|
141
|
+
- `fix(database): handle connection retries properly`
|
|
142
|
+
- `docs(readme): update installation instructions`
|
|
143
|
+
- `refactor(utils): simplify date parsing logic`
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# git-copilot-commit
|
|
2
|
+
|
|
3
|
+
🤖 AI-powered Git commit assistant that automatically generates conventional commit messages using
|
|
4
|
+
GitHub Copilot.
|
|
5
|
+
|
|
6
|
+
## Features
|
|
7
|
+
|
|
8
|
+
- **AI-Generated Commit Messages**: Uses GitHub Copilot to analyze your staged changes and generate
|
|
9
|
+
conventional commit messages
|
|
10
|
+
- **Message Editing**: Edit generated messages using your git-configured editor or commit directly
|
|
11
|
+
- **Conventional Commits**: Follows the [Conventional Commits](https://www.conventionalcommits.org/)
|
|
12
|
+
specification
|
|
13
|
+
- **Rich Output**: Beautiful terminal output with syntax highlighting and tables
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install using uv (recommended):
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv tool install git-copilot-commit
|
|
21
|
+
# or
|
|
22
|
+
uvx git-copilot-commit
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Or with pip:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pipx install git-copilot-commit
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
1. **GitHub Copilot Access**: You need an active GitHub Copilot subscription
|
|
34
|
+
2. **Authentication**: Authenticate with GitHub Copilot before first use
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
1. **Authenticate with GitHub Copilot**:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git-copilot-commit authenticate
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. **Make some changes** in your git repository
|
|
45
|
+
|
|
46
|
+
3. **Generate and commit**:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git-copilot-commit commit
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Usage
|
|
53
|
+
|
|
54
|
+
#### `commit`
|
|
55
|
+
|
|
56
|
+
Automatically commit changes in the current git repository:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git-copilot-commit commit
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Options:**
|
|
63
|
+
|
|
64
|
+
- `--all, -a`: Stage all files before committing
|
|
65
|
+
- `--verbose, -v`: Show verbose output with file details
|
|
66
|
+
|
|
67
|
+
1. The tool analyzes your changes
|
|
68
|
+
2. Prompts you to stage files (if needed)
|
|
69
|
+
3. Generates an AI-powered commit message
|
|
70
|
+
4. Offers three choices:
|
|
71
|
+
- `(c)ommit`: Commit with the generated message
|
|
72
|
+
- `(e)dit`: Edit the message in your git-configured editor
|
|
73
|
+
- `(q)uit`: Cancel the commit
|
|
74
|
+
|
|
75
|
+
#### `authenticate`
|
|
76
|
+
|
|
77
|
+
Set up authentication with GitHub Copilot:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
git-copilot-commit authenticate
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
#### `models`
|
|
84
|
+
|
|
85
|
+
List available AI models:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git-copilot-commit models
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Examples
|
|
92
|
+
|
|
93
|
+
**Commit all changes with staging prompts:**
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git-copilot-commit commit --all
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Commit with verbose output:**
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
git-copilot-commit commit --verbose
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Generated Commit Message Format
|
|
106
|
+
|
|
107
|
+
The tool follows the [Conventional Commits](https://www.conventionalcommits.org/) specification:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
<type>[optional scope]: <description>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Supported Types:**
|
|
114
|
+
|
|
115
|
+
- `feat`: A new feature
|
|
116
|
+
- `fix`: A bug fix
|
|
117
|
+
- `docs`: Documentation changes
|
|
118
|
+
- `style`: Code formatting (no logic changes)
|
|
119
|
+
- `refactor`: Code restructuring (no behavior changes)
|
|
120
|
+
- `perf`: Performance improvements
|
|
121
|
+
- `test`: Adding or updating tests
|
|
122
|
+
- `chore`: Maintenance tasks (tooling, dependencies, etc.)
|
|
123
|
+
- `revert`: Reverting previous changes
|
|
124
|
+
|
|
125
|
+
**Example Messages:**
|
|
126
|
+
|
|
127
|
+
- `feat(auth): add user authentication with JWT`
|
|
128
|
+
- `fix(database): handle connection retries properly`
|
|
129
|
+
- `docs(readme): update installation instructions`
|
|
130
|
+
- `refactor(utils): simplify date parsing logic`
|
|
@@ -59,7 +59,7 @@ def display_file_status(status: GitStatus) -> None:
|
|
|
59
59
|
console.print(table)
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
def generate_commit_message(repo: GitRepository, status: GitStatus) -> str:
|
|
62
|
+
def generate_commit_message(repo: GitRepository, status: GitStatus, model: str = None) -> str:
|
|
63
63
|
"""Generate a conventional commit message using Copilot API."""
|
|
64
64
|
|
|
65
65
|
# Get recent commits for context
|
|
@@ -169,7 +169,7 @@ Avoid wrapping the whole response in triple backticks.
|
|
|
169
169
|
|
|
170
170
|
Generate a conventional commit message:"""
|
|
171
171
|
|
|
172
|
-
response = client.ask(prompt)
|
|
172
|
+
response = client.ask(prompt, model=model) if model else client.ask(prompt)
|
|
173
173
|
return response.content
|
|
174
174
|
|
|
175
175
|
|
|
@@ -179,6 +179,7 @@ def commit(
|
|
|
179
179
|
False, "--all", "-a", help="Stage all files before committing"
|
|
180
180
|
),
|
|
181
181
|
verbose: bool = typer.Option(False, "--verbose", "-v", help="Show verbose output"),
|
|
182
|
+
model: str = typer.Option(None, "--model", "-m", help="Model to use for generating commit message"),
|
|
182
183
|
):
|
|
183
184
|
"""
|
|
184
185
|
Automatically commit changes in the current git repository.
|
|
@@ -229,7 +230,7 @@ def commit(
|
|
|
229
230
|
# Generate or use provided commit message
|
|
230
231
|
console.print("[cyan]Generating commit message...[/cyan]")
|
|
231
232
|
with console.status("[cyan]Generating commit message using Copilot API...[/cyan]"):
|
|
232
|
-
commit_message = generate_commit_message(repo, status)
|
|
233
|
+
commit_message = generate_commit_message(repo, status, model)
|
|
233
234
|
|
|
234
235
|
# Display commit message
|
|
235
236
|
console.print(Panel(commit_message, title="Commit Message", border_style="green"))
|
|
@@ -273,57 +274,6 @@ def commit(
|
|
|
273
274
|
console.print(f"[green]✓ Successfully committed: {commit_sha[:8]}[/green]")
|
|
274
275
|
|
|
275
276
|
|
|
276
|
-
def handle_interactive_staging(repo: GitRepository, status: GitStatus) -> None:
|
|
277
|
-
"""Handle interactive file staging."""
|
|
278
|
-
# Combine all files that can be staged
|
|
279
|
-
stageable_files = [f for f in status.files if not f.is_staged]
|
|
280
|
-
|
|
281
|
-
if not stageable_files:
|
|
282
|
-
console.print("[yellow]No files to stage.[/yellow]")
|
|
283
|
-
return
|
|
284
|
-
|
|
285
|
-
table = Table(title="Select files to stage")
|
|
286
|
-
table.add_column("Index", style="cyan", width=6)
|
|
287
|
-
table.add_column("Status", style="yellow", width=8)
|
|
288
|
-
table.add_column("File", style="white")
|
|
289
|
-
|
|
290
|
-
for i, file in enumerate(stageable_files, 1):
|
|
291
|
-
status_char = file.status if not file.is_untracked else "?"
|
|
292
|
-
table.add_row(str(i), status_char, file.path)
|
|
293
|
-
|
|
294
|
-
console.print(table)
|
|
295
|
-
|
|
296
|
-
selection = (
|
|
297
|
-
console.input(
|
|
298
|
-
"\nEnter file numbers to stage (comma-separated), 'all', or 'quit': "
|
|
299
|
-
)
|
|
300
|
-
.strip()
|
|
301
|
-
.lower()
|
|
302
|
-
)
|
|
303
|
-
|
|
304
|
-
if selection == "quit":
|
|
305
|
-
return
|
|
306
|
-
elif selection == "all":
|
|
307
|
-
repo.stage_files([f.path for f in stageable_files])
|
|
308
|
-
console.print(f"[green]Staged {len(stageable_files)} files.[/green]")
|
|
309
|
-
else:
|
|
310
|
-
try:
|
|
311
|
-
indices = [int(x.strip()) - 1 for x in selection.split(",")]
|
|
312
|
-
files_to_stage = [
|
|
313
|
-
stageable_files[i].path
|
|
314
|
-
for i in indices
|
|
315
|
-
if 0 <= i < len(stageable_files)
|
|
316
|
-
]
|
|
317
|
-
|
|
318
|
-
if files_to_stage:
|
|
319
|
-
repo.stage_files(files_to_stage)
|
|
320
|
-
console.print(f"[green]Staged {len(files_to_stage)} files.[/green]")
|
|
321
|
-
else:
|
|
322
|
-
console.print("[yellow]No valid files selected.[/yellow]")
|
|
323
|
-
except (ValueError, IndexError):
|
|
324
|
-
console.print("[red]Invalid selection.[/red]")
|
|
325
|
-
|
|
326
|
-
|
|
327
277
|
@app.command()
|
|
328
278
|
def authenticate():
|
|
329
279
|
"""Autheticate with GitHub Copilot."""
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: git-copilot-commit
|
|
3
|
-
Version: 0.1.0
|
|
4
|
-
Summary: Automatically generate and commit changes using copilot
|
|
5
|
-
Author-email: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
|
|
6
|
-
License-File: LICENSE
|
|
7
|
-
Requires-Python: >=3.12
|
|
8
|
-
Requires-Dist: pycopilot>=0.1.1
|
|
9
|
-
Requires-Dist: rich>=14.0.0
|
|
10
|
-
Requires-Dist: typer>=0.16.0
|
|
11
|
-
Requires-Dist: xdg-base-dirs>=6.0.2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|