git-copilot-commit 0.4.6__tar.gz → 0.5.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.
Files changed (31) hide show
  1. git_copilot_commit-0.5.1/.github/dependabot.yml +18 -0
  2. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/.github/workflows/ci.yml +11 -7
  3. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/.justfile +1 -1
  4. git_copilot_commit-0.5.1/PKG-INFO +205 -0
  5. git_copilot_commit-0.5.1/README.md +191 -0
  6. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/pyproject.toml +9 -2
  7. git_copilot_commit-0.5.1/src/git_copilot_commit/cli.py +972 -0
  8. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/src/git_copilot_commit/git.py +187 -34
  9. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/src/git_copilot_commit/github_copilot.py +410 -157
  10. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/src/git_copilot_commit/prompts/commit-message-generator-prompt.md +2 -0
  11. git_copilot_commit-0.5.1/src/git_copilot_commit/prompts/split-commit-planner-prompt.md +41 -0
  12. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/src/git_copilot_commit/settings.py +30 -3
  13. git_copilot_commit-0.5.1/src/git_copilot_commit/split_commits.py +474 -0
  14. git_copilot_commit-0.5.1/tests/conftest.py +31 -0
  15. git_copilot_commit-0.5.1/tests/test_cli.py +951 -0
  16. git_copilot_commit-0.5.1/tests/test_git.py +203 -0
  17. git_copilot_commit-0.5.1/tests/test_github_copilot_utils.py +485 -0
  18. git_copilot_commit-0.5.1/tests/test_settings.py +131 -0
  19. git_copilot_commit-0.5.1/tests/test_split_commits.py +305 -0
  20. git_copilot_commit-0.5.1/uv.lock +331 -0
  21. git_copilot_commit-0.4.6/PKG-INFO +0 -182
  22. git_copilot_commit-0.4.6/README.md +0 -168
  23. git_copilot_commit-0.4.6/src/git_copilot_commit/cli.py +0 -376
  24. git_copilot_commit-0.4.6/uv.lock +0 -216
  25. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/.gitignore +0 -0
  26. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/.python-version +0 -0
  27. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/LICENSE +0 -0
  28. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/src/git_copilot_commit/__init__.py +0 -0
  29. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/src/git_copilot_commit/py.typed +0 -0
  30. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/src/git_copilot_commit/version.py +0 -0
  31. {git_copilot_commit-0.4.6 → git_copilot_commit-0.5.1}/vhs/demo.vhs +0 -0
@@ -0,0 +1,18 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "github-actions"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ groups:
8
+ github-actions:
9
+ patterns:
10
+ - "*"
11
+ - package-ecosystem: "uv"
12
+ directory: "/"
13
+ schedule:
14
+ interval: "weekly"
15
+ groups:
16
+ uv-dependencies:
17
+ patterns:
18
+ - "*"
@@ -12,31 +12,35 @@ jobs:
12
12
  test:
13
13
  runs-on: ubuntu-latest
14
14
  steps:
15
- - uses: actions/checkout@v4
15
+ - uses: actions/checkout@v6
16
16
  with:
17
17
  fetch-depth: 0 # Fetch full history
18
18
  fetch-tags: true # Fetch all tags
19
19
 
20
20
  - name: Install uv
21
- uses: astral-sh/setup-uv@v6
21
+ uses: astral-sh/setup-uv@v7
22
22
 
23
23
  - name: Install the project
24
- run: uv sync --locked --all-extras --dev
24
+ run: uv sync --locked --all-extras --group dev
25
25
 
26
26
  - name: Run linting
27
- run: uvx ruff check
27
+ run: uv run --group dev ruff check
28
28
 
29
29
  - name: Run type checking
30
- run: uvx ty check
30
+ run: uv run --group dev ty check
31
+
32
+ - name: Run tests
33
+ run: uv run --group dev pytest
31
34
 
32
35
  publish:
33
36
  if: github.event_name == 'release' && github.event.action == 'published'
37
+ needs: test
34
38
  runs-on: ubuntu-latest
35
39
  steps:
36
- - uses: actions/checkout@v4
40
+ - uses: actions/checkout@v6
37
41
 
38
42
  - name: Install uv
39
- uses: astral-sh/setup-uv@v6
43
+ uses: astral-sh/setup-uv@v7
40
44
 
41
45
  - name: Install the project
42
46
  run: uv sync --locked --all-extras --dev
@@ -38,7 +38,7 @@ bump type="patch":
38
38
  new_version=$(just next-version {{type}})
39
39
  echo "New version: $new_version"
40
40
 
41
- git commit --allow-empty -m "Bump version to $new_version"
41
+ git commit --allow-empty -m "chore(build): Bump version to $new_version"
42
42
  git tag "$new_version"
43
43
 
44
44
  echo "✓ Created commit and tag for $new_version"
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: git-copilot-commit
3
+ Version: 0.5.1
4
+ Summary: Automatically generate and commit changes using GitHub Copilot
5
+ Author-email: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12
8
+ Requires-Dist: httpx>=0.28.0
9
+ Requires-Dist: platformdirs>=4.0.0
10
+ Requires-Dist: rich>=14.0.0
11
+ Requires-Dist: truststore>=0.10.4
12
+ Requires-Dist: typer>=0.16.0
13
+ Description-Content-Type: text/markdown
14
+
15
+ # `git-copilot-commit`
16
+
17
+ [![CI](https://img.shields.io/github/actions/workflow/status/kdheepak/git-copilot-commit/ci.yml?branch=main&label=CI)](https://github.com/kdheepak/git-copilot-commit/actions/workflows/ci.yml)
18
+ [![PyPI](https://img.shields.io/pypi/v/git-copilot-commit)](https://pypi.org/project/git-copilot-commit/)
19
+ [![License](https://img.shields.io/github/license/kdheepak/git-copilot-commit)](https://github.com/kdheepak/git-copilot-commit/blob/main/LICENSE)
20
+
21
+ AI-powered Git commit assistant that generates conventional commit messages using GitHub Copilot.
22
+
23
+ ![Screenshot of git-copilot-commit in action](https://github.com/user-attachments/assets/6a6d70a6-6060-44e6-8cf4-a6532e9e9142)
24
+
25
+ ## Features
26
+
27
+ - Generates commit messages based on your staged changes
28
+ - Supports multiple LLM models: GPT-4, Claude, Gemini, and more
29
+ - Allows editing of generated messages before committing
30
+ - Follows the [Conventional Commits](https://www.conventionalcommits.org/) standard
31
+
32
+ ## Installation
33
+
34
+ ### Install the tool using [`uv`]
35
+
36
+ Install [`uv`]:
37
+
38
+ ```bash
39
+ # On macOS and Linux.
40
+ curl -LsSf https://astral.sh/uv/install.sh | sh
41
+
42
+ # On Windows.
43
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
44
+ ```
45
+
46
+ You can run the latest version of tool directly every time by invoking this one command:
47
+
48
+ ```bash
49
+ # Every invocation installs latest version into temporary environment and runs --help
50
+ uvx git-copilot-commit --help
51
+ ```
52
+
53
+ Alternatively, you can install the tool once into a global isolated environment
54
+ and run `git-copilot-commit` to invoke it:
55
+
56
+ ```bash
57
+ # Install into global isolated environment
58
+ uv tool install git-copilot-commit
59
+
60
+ # Run --help to see available commands
61
+ git-copilot-commit --help
62
+ ```
63
+
64
+ [`uv`]: https://github.com/astral-sh/uv
65
+
66
+ ## Prerequisites
67
+
68
+ - Active GitHub Copilot subscription
69
+
70
+ ## Quick Start
71
+
72
+ 1. Authenticate with GitHub Copilot:
73
+
74
+ ```bash
75
+ uvx git-copilot-commit authenticate
76
+ ```
77
+
78
+ If your cached GitHub token is revoked or expires, refresh it with:
79
+
80
+ ```bash
81
+ uvx git-copilot-commit authenticate --force
82
+ ```
83
+
84
+ 2. Make changes in your repository.
85
+
86
+ 3. Generate and commit:
87
+
88
+ ```bash
89
+ uvx git-copilot-commit commit
90
+ # Or, if you want to stage all files and accept the generated commit message, use:
91
+ uvx git-copilot-commit commit --all --yes
92
+ ```
93
+
94
+ ## Usage
95
+
96
+ ### Commit changes
97
+
98
+ ```bash
99
+ $ uvx git-copilot-commit commit --help
100
+
101
+ Usage: git-copilot-commit commit [OPTIONS]
102
+
103
+ Generate commit message based on changes in the current git repository and commit them.
104
+
105
+ ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────╮
106
+ │ --all -a Stage all files before committing │
107
+ │ --split Split staged hunks into multiple commits automatically. │
108
+ │ Pass `--split=N` to express a preference for N commits. │
109
+ │ --model -m MODEL_ID Model to use for generating commit message │
110
+ │ --yes -y Automatically accept the generated commit message │
111
+ │ --context -c TEXT Optional user-provided context to guide commit message │
112
+ │ --ca-bundle PATH Path to a custom CA bundle (PEM) │
113
+ │ --insecure Disable SSL certificate verification. │
114
+ │ --native-tls --no-native-tls Use the OS's native certificate store via 'truststore' │
115
+ │ for httpx instead of the Python bundle. Ignored if │
116
+ │ --ca-bundle or --insecure is used. │
117
+ │ [default: no-native-tls] │
118
+ │ --help Show this message and exit. │
119
+ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
120
+ ```
121
+
122
+ ## Examples
123
+
124
+ Commit all changes:
125
+
126
+ ```bash
127
+ uvx git-copilot-commit commit --all
128
+ ```
129
+
130
+ Accept the generated commit message without editing:
131
+
132
+ ```bash
133
+ uvx git-copilot-commit commit --yes
134
+ ```
135
+
136
+ Use a specific model:
137
+
138
+ ```bash
139
+ uvx git-copilot-commit commit --model claude-3.5-sonnet
140
+ ```
141
+
142
+ Split staged hunks into separate commits:
143
+
144
+ ```bash
145
+ uvx git-copilot-commit commit --split
146
+ ```
147
+
148
+ Prefer two commits:
149
+
150
+ ```bash
151
+ uvx git-copilot-commit commit --split 2
152
+ ```
153
+
154
+ ## Commit Message Format
155
+
156
+ Follows [Conventional Commits](https://www.conventionalcommits.org/):
157
+
158
+ ```plaintext
159
+ <type>[optional scope]: <description>
160
+ ```
161
+
162
+ **Types:**
163
+
164
+ - `feat`: New feature
165
+ - `fix`: Bug fix
166
+ - `docs`: Documentation
167
+ - `style`: Formatting only
168
+ - `refactor`: Code restructure
169
+ - `perf`: Performance
170
+ - `test`: Tests
171
+ - `chore`: Maintenance
172
+ - `revert`: Revert changes
173
+
174
+ ## Git Configuration
175
+
176
+ Add a git alias by adding the following to your `~/.gitconfig`:
177
+
178
+ ```ini
179
+ [alias]
180
+ ai-commit = "!f() { uvx git-copilot-commit commit $@; }; f"
181
+ ```
182
+
183
+ Now you can run to review the message before committing:
184
+
185
+ ```bash
186
+ git ai-commit
187
+ ```
188
+
189
+ Alternatively, you can stage all files and auto accept the commit message and
190
+ specify which model should be used to generate the commit in one CLI invocation.
191
+
192
+ ```bash
193
+ git ai-commit --all --yes --model claude-3.5-sonnet
194
+ ```
195
+
196
+ > [!TIP]
197
+ >
198
+ > Show more context in diffs by running the following command:
199
+ >
200
+ > ```bash
201
+ > git config --global diff.context 3
202
+ > ```
203
+ >
204
+ > This may be useful because this tool sends the diffs with surrounding context
205
+ > to the LLM for generating a commit message
@@ -0,0 +1,191 @@
1
+ # `git-copilot-commit`
2
+
3
+ [![CI](https://img.shields.io/github/actions/workflow/status/kdheepak/git-copilot-commit/ci.yml?branch=main&label=CI)](https://github.com/kdheepak/git-copilot-commit/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/git-copilot-commit)](https://pypi.org/project/git-copilot-commit/)
5
+ [![License](https://img.shields.io/github/license/kdheepak/git-copilot-commit)](https://github.com/kdheepak/git-copilot-commit/blob/main/LICENSE)
6
+
7
+ AI-powered Git commit assistant that generates conventional commit messages using GitHub Copilot.
8
+
9
+ ![Screenshot of git-copilot-commit in action](https://github.com/user-attachments/assets/6a6d70a6-6060-44e6-8cf4-a6532e9e9142)
10
+
11
+ ## Features
12
+
13
+ - Generates commit messages based on your staged changes
14
+ - Supports multiple LLM models: GPT-4, Claude, Gemini, and more
15
+ - Allows editing of generated messages before committing
16
+ - Follows the [Conventional Commits](https://www.conventionalcommits.org/) standard
17
+
18
+ ## Installation
19
+
20
+ ### Install the tool using [`uv`]
21
+
22
+ Install [`uv`]:
23
+
24
+ ```bash
25
+ # On macOS and Linux.
26
+ curl -LsSf https://astral.sh/uv/install.sh | sh
27
+
28
+ # On Windows.
29
+ powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
30
+ ```
31
+
32
+ You can run the latest version of tool directly every time by invoking this one command:
33
+
34
+ ```bash
35
+ # Every invocation installs latest version into temporary environment and runs --help
36
+ uvx git-copilot-commit --help
37
+ ```
38
+
39
+ Alternatively, you can install the tool once into a global isolated environment
40
+ and run `git-copilot-commit` to invoke it:
41
+
42
+ ```bash
43
+ # Install into global isolated environment
44
+ uv tool install git-copilot-commit
45
+
46
+ # Run --help to see available commands
47
+ git-copilot-commit --help
48
+ ```
49
+
50
+ [`uv`]: https://github.com/astral-sh/uv
51
+
52
+ ## Prerequisites
53
+
54
+ - Active GitHub Copilot subscription
55
+
56
+ ## Quick Start
57
+
58
+ 1. Authenticate with GitHub Copilot:
59
+
60
+ ```bash
61
+ uvx git-copilot-commit authenticate
62
+ ```
63
+
64
+ If your cached GitHub token is revoked or expires, refresh it with:
65
+
66
+ ```bash
67
+ uvx git-copilot-commit authenticate --force
68
+ ```
69
+
70
+ 2. Make changes in your repository.
71
+
72
+ 3. Generate and commit:
73
+
74
+ ```bash
75
+ uvx git-copilot-commit commit
76
+ # Or, if you want to stage all files and accept the generated commit message, use:
77
+ uvx git-copilot-commit commit --all --yes
78
+ ```
79
+
80
+ ## Usage
81
+
82
+ ### Commit changes
83
+
84
+ ```bash
85
+ $ uvx git-copilot-commit commit --help
86
+
87
+ Usage: git-copilot-commit commit [OPTIONS]
88
+
89
+ Generate commit message based on changes in the current git repository and commit them.
90
+
91
+ ╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────╮
92
+ │ --all -a Stage all files before committing │
93
+ │ --split Split staged hunks into multiple commits automatically. │
94
+ │ Pass `--split=N` to express a preference for N commits. │
95
+ │ --model -m MODEL_ID Model to use for generating commit message │
96
+ │ --yes -y Automatically accept the generated commit message │
97
+ │ --context -c TEXT Optional user-provided context to guide commit message │
98
+ │ --ca-bundle PATH Path to a custom CA bundle (PEM) │
99
+ │ --insecure Disable SSL certificate verification. │
100
+ │ --native-tls --no-native-tls Use the OS's native certificate store via 'truststore' │
101
+ │ for httpx instead of the Python bundle. Ignored if │
102
+ │ --ca-bundle or --insecure is used. │
103
+ │ [default: no-native-tls] │
104
+ │ --help Show this message and exit. │
105
+ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯
106
+ ```
107
+
108
+ ## Examples
109
+
110
+ Commit all changes:
111
+
112
+ ```bash
113
+ uvx git-copilot-commit commit --all
114
+ ```
115
+
116
+ Accept the generated commit message without editing:
117
+
118
+ ```bash
119
+ uvx git-copilot-commit commit --yes
120
+ ```
121
+
122
+ Use a specific model:
123
+
124
+ ```bash
125
+ uvx git-copilot-commit commit --model claude-3.5-sonnet
126
+ ```
127
+
128
+ Split staged hunks into separate commits:
129
+
130
+ ```bash
131
+ uvx git-copilot-commit commit --split
132
+ ```
133
+
134
+ Prefer two commits:
135
+
136
+ ```bash
137
+ uvx git-copilot-commit commit --split 2
138
+ ```
139
+
140
+ ## Commit Message Format
141
+
142
+ Follows [Conventional Commits](https://www.conventionalcommits.org/):
143
+
144
+ ```plaintext
145
+ <type>[optional scope]: <description>
146
+ ```
147
+
148
+ **Types:**
149
+
150
+ - `feat`: New feature
151
+ - `fix`: Bug fix
152
+ - `docs`: Documentation
153
+ - `style`: Formatting only
154
+ - `refactor`: Code restructure
155
+ - `perf`: Performance
156
+ - `test`: Tests
157
+ - `chore`: Maintenance
158
+ - `revert`: Revert changes
159
+
160
+ ## Git Configuration
161
+
162
+ Add a git alias by adding the following to your `~/.gitconfig`:
163
+
164
+ ```ini
165
+ [alias]
166
+ ai-commit = "!f() { uvx git-copilot-commit commit $@; }; f"
167
+ ```
168
+
169
+ Now you can run to review the message before committing:
170
+
171
+ ```bash
172
+ git ai-commit
173
+ ```
174
+
175
+ Alternatively, you can stage all files and auto accept the commit message and
176
+ specify which model should be used to generate the commit in one CLI invocation.
177
+
178
+ ```bash
179
+ git ai-commit --all --yes --model claude-3.5-sonnet
180
+ ```
181
+
182
+ > [!TIP]
183
+ >
184
+ > Show more context in diffs by running the following command:
185
+ >
186
+ > ```bash
187
+ > git config --global diff.context 3
188
+ > ```
189
+ >
190
+ > This may be useful because this tool sends the diffs with surrounding context
191
+ > to the LLM for generating a commit message
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "git-copilot-commit"
3
3
  dynamic = ["version"]
4
- description = "Automatically generate and commit changes using copilot"
4
+ description = "Automatically generate and commit changes using GitHub Copilot"
5
5
  readme = "README.md"
6
6
  authors = [
7
7
  { name = "Dheepak Krishnamurthy", email = "1813121+kdheepak@users.noreply.github.com" },
@@ -16,7 +16,7 @@ dependencies = [
16
16
  ]
17
17
 
18
18
  [project.scripts]
19
- git-copilot-commit = "git_copilot_commit.cli:app"
19
+ git-copilot-commit = "git_copilot_commit.cli:run"
20
20
 
21
21
  [build-system]
22
22
  requires = ["hatchling", "versioningit"]
@@ -42,6 +42,13 @@ dirty = "{base_version}+d{build_date:%Y%m%d}"
42
42
  # Example formatted version: 1.2.3+d20230922
43
43
 
44
44
  distance-dirty = "{next_version}.dev{distance}+{vcs}{rev}.d{build_date:%Y%m%d}"
45
+
46
+ [dependency-groups]
47
+ dev = [
48
+ "pytest>=9.0.2",
49
+ "ruff>=0.13.0",
50
+ "ty>=0.0.1a17",
51
+ ]
45
52
  # Example formatted version: 1.2.4.dev42+ge174a1f.d20230922
46
53
 
47
54
  [tool.versioningit]