git-copilot-commit 0.5.7__tar.gz → 0.6.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 (36) hide show
  1. git_copilot_commit-0.6.1/.config/mise.toml +99 -0
  2. git_copilot_commit-0.6.1/.python-version +1 -0
  3. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/PKG-INFO +86 -8
  4. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/README.md +83 -5
  5. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/pyproject.toml +2 -2
  6. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/cli.py +271 -177
  7. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/git.py +123 -0
  8. git_copilot_commit-0.6.1/src/git_copilot_commit/llms/copilot.py +799 -0
  9. git_copilot_commit-0.6.1/src/git_copilot_commit/llms/core.py +802 -0
  10. git_copilot_commit-0.6.1/src/git_copilot_commit/llms/openai_api.py +219 -0
  11. git_copilot_commit-0.6.1/src/git_copilot_commit/llms/providers.py +373 -0
  12. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/prompts/commit-message-generator-prompt.md +4 -3
  13. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/prompts/split-commit-planner-prompt.md +1 -0
  14. git_copilot_commit-0.6.1/src/git_copilot_commit/py.typed +0 -0
  15. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/tests/test_cli.py +359 -68
  16. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/tests/test_git.py +43 -9
  17. git_copilot_commit-0.5.7/tests/test_github_copilot_utils.py → git_copilot_commit-0.6.1/tests/test_llm_and_copilot.py +118 -135
  18. git_copilot_commit-0.6.1/tests/test_providers.py +178 -0
  19. git_copilot_commit-0.6.1/uv.lock +331 -0
  20. git_copilot_commit-0.5.7/.justfile +0 -61
  21. git_copilot_commit-0.5.7/.python-version +0 -1
  22. git_copilot_commit-0.5.7/src/git_copilot_commit/github_copilot.py +0 -1579
  23. git_copilot_commit-0.5.7/uv.lock +0 -331
  24. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/.github/dependabot.yml +0 -0
  25. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/.github/workflows/ci.yml +0 -0
  26. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/.gitignore +0 -0
  27. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/LICENSE +0 -0
  28. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/__init__.py +0 -0
  29. /git_copilot_commit-0.5.7/src/git_copilot_commit/py.typed → /git_copilot_commit-0.6.1/src/git_copilot_commit/llms/__init__.py +0 -0
  30. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/settings.py +0 -0
  31. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/split_commits.py +0 -0
  32. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/src/git_copilot_commit/version.py +0 -0
  33. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/tests/conftest.py +0 -0
  34. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/tests/test_settings.py +0 -0
  35. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/tests/test_split_commits.py +0 -0
  36. {git_copilot_commit-0.5.7 → git_copilot_commit-0.6.1}/vhs/demo.vhs +0 -0
@@ -0,0 +1,99 @@
1
+ [settings]
2
+ env_shell_expand = true
3
+ pipx.uvx = true
4
+
5
+ [tools]
6
+ uv = "latest"
7
+ python = "latest"
8
+
9
+ [tasks."git-copilot-commit:commit"]
10
+ description = "Pass all arguments directly to git-copilot-commit commit"
11
+ usage = """
12
+ arg "[args]" var=#true help="Arguments to pass to git-copilot-commit commit"
13
+ """
14
+ run = """
15
+ set -euo pipefail
16
+
17
+ args=()
18
+ if [ -n "${usage_args:-}" ]; then
19
+ eval "args=($usage_args)"
20
+ fi
21
+
22
+ uv run git-copilot-commit commit "${args[@]}"
23
+ """
24
+
25
+ [tasks."git-copilot-commit:next-version"]
26
+ description = "Get the next version based on bump type"
27
+ usage = """
28
+ arg "[type]" help="Version bump type" default="patch" {
29
+ choices "major" "minor" "patch"
30
+ }
31
+ """
32
+ run = """
33
+ set -euo pipefail
34
+
35
+ latest_tag=$(gh release list --limit 1 --json tagName --jq '.[0].tagName // "v0.0.0"')
36
+ version=${latest_tag#v}
37
+ IFS='.' read -r major minor patch <<< "$version"
38
+
39
+ case "${usage_type?}" in
40
+ major)
41
+ major=$((major + 1))
42
+ minor=0
43
+ patch=0
44
+ ;;
45
+ minor)
46
+ minor=$((minor + 1))
47
+ patch=0
48
+ ;;
49
+ patch)
50
+ patch=$((patch + 1))
51
+ ;;
52
+ esac
53
+
54
+ printf 'v%s.%s.%s\n' "$major" "$minor" "$patch"
55
+ """
56
+
57
+ [tasks."git-copilot-commit:bump"]
58
+ description = "Create an empty version bump commit and tag"
59
+ usage = """
60
+ arg "[type]" help="Version bump type" default="patch" {
61
+ choices "major" "minor" "patch"
62
+ }
63
+ """
64
+ run = """
65
+ set -euo pipefail
66
+
67
+ new_version=$(mise run git-copilot-commit:next-version "${usage_type?}")
68
+ echo "New version: $new_version"
69
+
70
+ git commit --allow-empty -m "chore(build): Bump version to $new_version"
71
+ git tag "$new_version"
72
+
73
+ echo "✓ Created commit and tag for $new_version"
74
+ echo " Run: 'mise run release $new_version'"
75
+ """
76
+
77
+ [tasks."git-copilot-commit:release"]
78
+ description = "Push a tag and create a GitHub release"
79
+ usage = """
80
+ arg "<version>" help="Version tag to push and release"
81
+ """
82
+ run = """
83
+ set -euo pipefail
84
+
85
+ version="${usage_version?}"
86
+
87
+ echo "Pushing commit and tag for $version..."
88
+ git push
89
+ git push origin "$version"
90
+
91
+ echo "Creating GitHub release for $version..."
92
+ gh release create "$version" --title "$version" --generate-notes
93
+
94
+ echo "✓ Release $version created and pushed"
95
+ """
96
+
97
+ [tasks."git-copilot-commit:test"]
98
+ description = "Run tests with uv and pytest"
99
+ run = "uv run --with pytest pytest"
@@ -0,0 +1 @@
1
+ 3.14
@@ -1,15 +1,15 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-copilot-commit
3
- Version: 0.5.7
4
- Summary: Automatically generate and commit changes using GitHub Copilot
3
+ Version: 0.6.1
4
+ Summary: Automatically generate and commit changes using GitHub Copilot or OpenAI-compatible LLMs
5
5
  Author-email: Dheepak Krishnamurthy <1813121+kdheepak@users.noreply.github.com>
6
6
  License-File: LICENSE
7
7
  Requires-Python: >=3.12
8
+ Requires-Dist: cyclopts>=4.11.0
8
9
  Requires-Dist: httpx>=0.28.0
9
10
  Requires-Dist: platformdirs>=4.0.0
10
11
  Requires-Dist: rich>=14.0.0
11
12
  Requires-Dist: truststore>=0.10.4
12
- Requires-Dist: typer>=0.16.0
13
13
  Description-Content-Type: text/markdown
14
14
 
15
15
  # `git-copilot-commit`
@@ -18,14 +18,15 @@ Description-Content-Type: text/markdown
18
18
  [![PyPI](https://img.shields.io/pypi/v/git-copilot-commit)](https://pypi.org/project/git-copilot-commit/)
19
19
  [![License](https://img.shields.io/github/license/kdheepak/git-copilot-commit)](https://github.com/kdheepak/git-copilot-commit/blob/main/LICENSE)
20
20
 
21
- AI-powered Git commit assistant that generates conventional commit messages using GitHub Copilot.
21
+ AI-powered Git commit assistant that generates conventional commit messages using GitHub Copilot or any OpenAI-compatible LLM.
22
22
 
23
23
  ![Screenshot of git-copilot-commit in action](https://github.com/user-attachments/assets/6a6d70a6-6060-44e6-8cf4-a6532e9e9142)
24
24
 
25
25
  ## Features
26
26
 
27
27
  - Generates commit messages based on your staged changes
28
- - Supports multiple LLM models: GPT-4, Claude, Gemini, and more
28
+ - Supports GitHub Copilot and OpenAI-compatible `/v1/models` + `/v1/chat/completions` APIs
29
+ - Supports multiple LLM models: GPT, Claude, Gemini, local models, and more
29
30
  - Allows editing of generated messages before committing
30
31
  - Follows the [Conventional Commits](https://www.conventionalcommits.org/) standard
31
32
 
@@ -50,7 +51,7 @@ You can run the latest version of tool directly every time by invoking this one
50
51
  uvx git-copilot-commit --help
51
52
  ```
52
53
 
53
- Alternatively, you can install the tool once into a global isolated environment
54
+ Alternatively, you can install the tool once into a global isolated environment
54
55
  and run `git-copilot-commit` to invoke it:
55
56
 
56
57
  ```bash
@@ -65,10 +66,12 @@ git-copilot-commit --help
65
66
 
66
67
  ## Prerequisites
67
68
 
68
- - Active GitHub Copilot subscription
69
+ - Either an active GitHub Copilot subscription or access to an OpenAI-compatible API endpoint
69
70
 
70
71
  ## Quick Start
71
72
 
73
+ ### GitHub Copilot
74
+
72
75
  1. Authenticate with GitHub Copilot:
73
76
 
74
77
  ```bash
@@ -91,6 +94,42 @@ git-copilot-commit --help
91
94
  uvx git-copilot-commit commit --all --yes
92
95
  ```
93
96
 
97
+ ### OpenAI-compatible provider
98
+
99
+ 1. Point the CLI at your server.
100
+
101
+ The base URL can be either the provider root such as `http://127.0.0.1:11434/v1`
102
+ or the full chat completions endpoint such as
103
+ `http://127.0.0.1:11434/v1/chat/completions`.
104
+
105
+ ```bash
106
+ uvx git-copilot-commit models \
107
+ --provider openai \
108
+ --base-url http://127.0.0.1:11434/v1
109
+ ```
110
+
111
+ 2. Generate and commit.
112
+
113
+ ```bash
114
+ uvx git-copilot-commit commit \
115
+ --provider openai \
116
+ --base-url http://127.0.0.1:11434/v1 \
117
+ --model your-model-id
118
+ ```
119
+
120
+ If your server requires an API key, also pass `--api-key ...` or set `OPENAI_API_KEY`.
121
+
122
+ 3. Example: use a self-hosted GPT-OSS model:
123
+
124
+ ```bash
125
+ uvx git-copilot-commit commit \
126
+ --provider openai \
127
+ --base-url http://example.com:8001/v1/chat/completions \
128
+ --model openai/gpt-oss-120b
129
+ ```
130
+
131
+ Model ids with slashes such as `openai/gpt-oss-120b` are supported.
132
+
94
133
  ## Usage
95
134
 
96
135
  ### Commit changes
@@ -109,6 +148,9 @@ $ uvx git-copilot-commit commit --help
109
148
  │ --model -m MODEL_ID Model to use for generating commit message │
110
149
  │ --yes -y Automatically accept the generated commit message │
111
150
  │ --context -c TEXT Optional user-provided context to guide commit message │
151
+ │ --provider TEXT LLM provider to use: copilot or openai │
152
+ │ --base-url URL Base URL for an OpenAI-compatible provider │
153
+ │ --api-key TEXT API key for an OpenAI-compatible provider │
112
154
  │ --ca-bundle PATH Path to a custom CA bundle (PEM) │
113
155
  │ --insecure Disable SSL certificate verification. │
114
156
  │ --native-tls --no-native-tls Use the OS's native certificate store via 'truststore' │
@@ -139,6 +181,24 @@ Use a specific model:
139
181
  uvx git-copilot-commit commit --model claude-3.5-sonnet
140
182
  ```
141
183
 
184
+ Use a local OpenAI-compatible server:
185
+
186
+ ```bash
187
+ uvx git-copilot-commit commit \
188
+ --provider openai \
189
+ --base-url http://127.0.0.1:11434/v1 \
190
+ --model your-model-id
191
+ ```
192
+
193
+ Use a self-hosted GPT-OSS endpoint:
194
+
195
+ ```bash
196
+ uvx git-copilot-commit commit \
197
+ --provider openai \
198
+ --base-url http://example.com:8001/v1/chat/completions \
199
+ --model openai/gpt-oss-120b
200
+ ```
201
+
142
202
  Split staged hunks into separate commits:
143
203
 
144
204
  ```bash
@@ -193,6 +253,24 @@ specify which model should be used to generate the commit in one CLI invocation.
193
253
  git ai-commit --all --yes --model claude-3.5-sonnet
194
254
  ```
195
255
 
256
+ You can also set provider defaults with environment variables:
257
+
258
+ ```bash
259
+ export GIT_COPILOT_COMMIT_PROVIDER=openai
260
+ export GIT_COPILOT_COMMIT_BASE_URL=http://127.0.0.1:11434/v1
261
+ export GIT_COPILOT_COMMIT_API_KEY=...
262
+ export OPENAI_API_KEY=...
263
+ git ai-commit --provider openai --model your-model-id
264
+ ```
265
+
266
+ For example:
267
+
268
+ ```bash
269
+ export GIT_COPILOT_COMMIT_PROVIDER=openai
270
+ export GIT_COPILOT_COMMIT_BASE_URL=http://example.com:8001/v1
271
+ git ai-commit --model openai/gpt-oss-120b
272
+ ```
273
+
196
274
  > [!TIP]
197
275
  >
198
276
  > Show more context in diffs by running the following command:
@@ -201,5 +279,5 @@ git ai-commit --all --yes --model claude-3.5-sonnet
201
279
  > git config --global diff.context 3
202
280
  > ```
203
281
  >
204
- > This may be useful because this tool sends the diffs with surrounding context
282
+ > This may be useful because this tool sends the diffs with surrounding context
205
283
  > to the LLM for generating a commit message
@@ -4,14 +4,15 @@
4
4
  [![PyPI](https://img.shields.io/pypi/v/git-copilot-commit)](https://pypi.org/project/git-copilot-commit/)
5
5
  [![License](https://img.shields.io/github/license/kdheepak/git-copilot-commit)](https://github.com/kdheepak/git-copilot-commit/blob/main/LICENSE)
6
6
 
7
- AI-powered Git commit assistant that generates conventional commit messages using GitHub Copilot.
7
+ AI-powered Git commit assistant that generates conventional commit messages using GitHub Copilot or any OpenAI-compatible LLM.
8
8
 
9
9
  ![Screenshot of git-copilot-commit in action](https://github.com/user-attachments/assets/6a6d70a6-6060-44e6-8cf4-a6532e9e9142)
10
10
 
11
11
  ## Features
12
12
 
13
13
  - Generates commit messages based on your staged changes
14
- - Supports multiple LLM models: GPT-4, Claude, Gemini, and more
14
+ - Supports GitHub Copilot and OpenAI-compatible `/v1/models` + `/v1/chat/completions` APIs
15
+ - Supports multiple LLM models: GPT, Claude, Gemini, local models, and more
15
16
  - Allows editing of generated messages before committing
16
17
  - Follows the [Conventional Commits](https://www.conventionalcommits.org/) standard
17
18
 
@@ -36,7 +37,7 @@ You can run the latest version of tool directly every time by invoking this one
36
37
  uvx git-copilot-commit --help
37
38
  ```
38
39
 
39
- Alternatively, you can install the tool once into a global isolated environment
40
+ Alternatively, you can install the tool once into a global isolated environment
40
41
  and run `git-copilot-commit` to invoke it:
41
42
 
42
43
  ```bash
@@ -51,10 +52,12 @@ git-copilot-commit --help
51
52
 
52
53
  ## Prerequisites
53
54
 
54
- - Active GitHub Copilot subscription
55
+ - Either an active GitHub Copilot subscription or access to an OpenAI-compatible API endpoint
55
56
 
56
57
  ## Quick Start
57
58
 
59
+ ### GitHub Copilot
60
+
58
61
  1. Authenticate with GitHub Copilot:
59
62
 
60
63
  ```bash
@@ -77,6 +80,42 @@ git-copilot-commit --help
77
80
  uvx git-copilot-commit commit --all --yes
78
81
  ```
79
82
 
83
+ ### OpenAI-compatible provider
84
+
85
+ 1. Point the CLI at your server.
86
+
87
+ The base URL can be either the provider root such as `http://127.0.0.1:11434/v1`
88
+ or the full chat completions endpoint such as
89
+ `http://127.0.0.1:11434/v1/chat/completions`.
90
+
91
+ ```bash
92
+ uvx git-copilot-commit models \
93
+ --provider openai \
94
+ --base-url http://127.0.0.1:11434/v1
95
+ ```
96
+
97
+ 2. Generate and commit.
98
+
99
+ ```bash
100
+ uvx git-copilot-commit commit \
101
+ --provider openai \
102
+ --base-url http://127.0.0.1:11434/v1 \
103
+ --model your-model-id
104
+ ```
105
+
106
+ If your server requires an API key, also pass `--api-key ...` or set `OPENAI_API_KEY`.
107
+
108
+ 3. Example: use a self-hosted GPT-OSS model:
109
+
110
+ ```bash
111
+ uvx git-copilot-commit commit \
112
+ --provider openai \
113
+ --base-url http://example.com:8001/v1/chat/completions \
114
+ --model openai/gpt-oss-120b
115
+ ```
116
+
117
+ Model ids with slashes such as `openai/gpt-oss-120b` are supported.
118
+
80
119
  ## Usage
81
120
 
82
121
  ### Commit changes
@@ -95,6 +134,9 @@ $ uvx git-copilot-commit commit --help
95
134
  │ --model -m MODEL_ID Model to use for generating commit message │
96
135
  │ --yes -y Automatically accept the generated commit message │
97
136
  │ --context -c TEXT Optional user-provided context to guide commit message │
137
+ │ --provider TEXT LLM provider to use: copilot or openai │
138
+ │ --base-url URL Base URL for an OpenAI-compatible provider │
139
+ │ --api-key TEXT API key for an OpenAI-compatible provider │
98
140
  │ --ca-bundle PATH Path to a custom CA bundle (PEM) │
99
141
  │ --insecure Disable SSL certificate verification. │
100
142
  │ --native-tls --no-native-tls Use the OS's native certificate store via 'truststore' │
@@ -125,6 +167,24 @@ Use a specific model:
125
167
  uvx git-copilot-commit commit --model claude-3.5-sonnet
126
168
  ```
127
169
 
170
+ Use a local OpenAI-compatible server:
171
+
172
+ ```bash
173
+ uvx git-copilot-commit commit \
174
+ --provider openai \
175
+ --base-url http://127.0.0.1:11434/v1 \
176
+ --model your-model-id
177
+ ```
178
+
179
+ Use a self-hosted GPT-OSS endpoint:
180
+
181
+ ```bash
182
+ uvx git-copilot-commit commit \
183
+ --provider openai \
184
+ --base-url http://example.com:8001/v1/chat/completions \
185
+ --model openai/gpt-oss-120b
186
+ ```
187
+
128
188
  Split staged hunks into separate commits:
129
189
 
130
190
  ```bash
@@ -179,6 +239,24 @@ specify which model should be used to generate the commit in one CLI invocation.
179
239
  git ai-commit --all --yes --model claude-3.5-sonnet
180
240
  ```
181
241
 
242
+ You can also set provider defaults with environment variables:
243
+
244
+ ```bash
245
+ export GIT_COPILOT_COMMIT_PROVIDER=openai
246
+ export GIT_COPILOT_COMMIT_BASE_URL=http://127.0.0.1:11434/v1
247
+ export GIT_COPILOT_COMMIT_API_KEY=...
248
+ export OPENAI_API_KEY=...
249
+ git ai-commit --provider openai --model your-model-id
250
+ ```
251
+
252
+ For example:
253
+
254
+ ```bash
255
+ export GIT_COPILOT_COMMIT_PROVIDER=openai
256
+ export GIT_COPILOT_COMMIT_BASE_URL=http://example.com:8001/v1
257
+ git ai-commit --model openai/gpt-oss-120b
258
+ ```
259
+
182
260
  > [!TIP]
183
261
  >
184
262
  > Show more context in diffs by running the following command:
@@ -187,5 +265,5 @@ git ai-commit --all --yes --model claude-3.5-sonnet
187
265
  > git config --global diff.context 3
188
266
  > ```
189
267
  >
190
- > This may be useful because this tool sends the diffs with surrounding context
268
+ > This may be useful because this tool sends the diffs with surrounding context
191
269
  > 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 GitHub Copilot"
4
+ description = "Automatically generate and commit changes using GitHub Copilot or OpenAI-compatible LLMs"
5
5
  readme = "README.md"
6
6
  authors = [
7
7
  { name = "Dheepak Krishnamurthy", email = "1813121+kdheepak@users.noreply.github.com" },
@@ -10,9 +10,9 @@ requires-python = ">=3.12"
10
10
  dependencies = [
11
11
  "httpx>=0.28.0",
12
12
  "rich>=14.0.0",
13
- "typer>=0.16.0",
14
13
  "platformdirs>=4.0.0",
15
14
  "truststore>=0.10.4",
15
+ "cyclopts>=4.11.0",
16
16
  ]
17
17
 
18
18
  [project.scripts]