git-cai-cli 0.9.0__tar.gz → 0.10.0__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 (91) hide show
  1. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.gitignore +1 -0
  2. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.proselintrc +1 -1
  3. git_cai_cli-0.10.0/CLAUDE.md +62 -0
  4. {git_cai_cli-0.9.0/src/git_cai_cli.egg-info → git_cai_cli-0.10.0}/PKG-INFO +58 -1
  5. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/README.md +57 -0
  6. git_cai_cli-0.10.0/docs/git-cai.txt +477 -0
  7. git_cai_cli-0.10.0/docs/man/git-cai.1 +949 -0
  8. git_cai_cli-0.10.0/src/git_cai_cli/_version.py +24 -0
  9. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/cli/cli.py +52 -2
  10. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/cli/helptext.py +5 -1
  11. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/cli/modes.py +7 -4
  12. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/completion.py +19 -10
  13. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/config.py +91 -0
  14. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/gitutils.py +30 -8
  15. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/llm.py +20 -1
  16. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/options.py +6 -6
  17. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/validate.py +1 -0
  18. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/main.py +26 -8
  19. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0/src/git_cai_cli.egg-info}/PKG-INFO +58 -1
  20. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli.egg-info/SOURCES.txt +4 -0
  21. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/integration/test_modes_integration.py +21 -5
  22. git_cai_cli-0.10.0/tests/unit/test_amend.py +112 -0
  23. git_cai_cli-0.10.0/tests/unit/test_conventional.py +74 -0
  24. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_modes.py +5 -5
  25. git_cai_cli-0.10.0/tests/unit/test_set_config.py +176 -0
  26. git_cai_cli-0.9.0/docs/git-cai.txt +0 -247
  27. git_cai_cli-0.9.0/docs/man/git-cai.1 +0 -494
  28. git_cai_cli-0.9.0/src/git_cai_cli/_version.py +0 -34
  29. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.caiignore +0 -0
  30. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.gitattributes +0 -0
  31. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/cd/.SRCINFO +0 -0
  32. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/cd/PKGBUILD +0 -0
  33. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/ci/_version.py +0 -0
  34. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/ci/cai_config.ci.yml +0 -0
  35. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/ci/tokens.ci.yml +0 -0
  36. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/workflows/python-tests.yml +0 -0
  37. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/workflows/release.yml +0 -0
  38. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.github/workflows/release_aur.yml +0 -0
  39. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.bandit.yml +0 -0
  40. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.checkov.yml +0 -0
  41. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.flake8 +0 -0
  42. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.ls-lint.yml +0 -0
  43. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.markdown-link-check.json +0 -0
  44. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.markdownlint.json +0 -0
  45. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.pylintrc +0 -0
  46. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/.yamllint.yml +0 -0
  47. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/check_git_branch_name.sh +0 -0
  48. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/lychee.toml +0 -0
  49. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.linters/pyrightconfig.json +0 -0
  50. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.markdownlintignore +0 -0
  51. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.mega-linter.yml +0 -0
  52. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.semgrepignore +0 -0
  53. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/.trivyignore +0 -0
  54. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/LICENSE +0 -0
  55. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/Makefile +0 -0
  56. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/pyproject.toml +0 -0
  57. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/setup.cfg +0 -0
  58. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/__init__.py +0 -0
  59. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/cli/__init__.py +0 -0
  60. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/__init__.py +0 -0
  61. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/editors.py +0 -0
  62. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/languages.py +0 -0
  63. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/prompts_fallback.py +0 -0
  64. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/spinner.py +0 -0
  65. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/core/squash.py +0 -0
  66. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/defaults/__init__.py +0 -0
  67. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/defaults/commit_prompt.md +0 -0
  68. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli/defaults/squash_prompt.md +0 -0
  69. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli.egg-info/dependency_links.txt +0 -0
  70. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli.egg-info/entry_points.txt +0 -0
  71. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli.egg-info/requires.txt +0 -0
  72. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/src/git_cai_cli.egg-info/top_level.txt +0 -0
  73. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/conftest.py +0 -0
  74. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/integration/test_cli_integration.py +0 -0
  75. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/integration/test_config_integration.py +0 -0
  76. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/integration/test_gitutils_integration.py +0 -0
  77. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/integration/test_options_integration.py +0 -0
  78. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/integration/test_squash_integration.py +0 -0
  79. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_cli.py +0 -0
  80. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_completion.py +0 -0
  81. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_config.py +0 -0
  82. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_gitutils.py +0 -0
  83. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_helptext.py +0 -0
  84. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_llm.py +0 -0
  85. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_main.py +0 -0
  86. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_options.py +0 -0
  87. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_prompt_loading.py +0 -0
  88. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_spinner.py +0 -0
  89. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_squash.py +0 -0
  90. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/tests/unit/test_validate.py +0 -0
  91. {git_cai_cli-0.9.0 → git_cai_cli-0.10.0}/uv.lock +0 -0
@@ -1,5 +1,6 @@
1
1
  # directories
2
2
  build/
3
+ .claude/
3
4
  dist/
4
5
  src/git_cai_cli.egg-info/
5
6
  .ipynb_checkpoints/
@@ -18,7 +18,7 @@
18
18
  , "lgbtq.offensive_terms": true
19
19
  , "lgbtq.terms": true
20
20
  , "lexical_illusions.misc": false
21
- , "links.broken": true
21
+ , "links.broken": false
22
22
  , "malapropisms.misc": true
23
23
  , "misc.apologizing": true
24
24
  , "misc.back_formations": true
@@ -0,0 +1,62 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project
6
+
7
+ **git-cai** — A Python CLI tool that uses LLMs to generate git commit messages. Installed as `git-cai` (invoked as `git cai`). Supports 8 LLM providers: OpenAI, Anthropic, Gemini, Groq, xAI, Mistral, DeepSeek, and Ollama (local).
8
+
9
+ ## Common Commands
10
+
11
+ ```bash
12
+ make test # Run all tests (uv run pytest)
13
+ make lint # Branch name check + MegaLinter
14
+ make lint-fix # Auto-fix lint issues
15
+ make clean # Clean uv cache and .venv
16
+
17
+ # Single test file
18
+ uv run pytest tests/unit/test_llm.py -v
19
+
20
+ # Single test function
21
+ uv run pytest tests/unit/test_llm.py::test_function_name -v
22
+ ```
23
+
24
+ ## Architecture
25
+
26
+ Entry point: `src/git_cai_cli/cli/cli.py` (Typer app) → `main.py` (dispatcher)
27
+
28
+ ### Modes (cli/modes.py)
29
+
30
+ - **COMMIT** (default): git diff → LLM → user edits → commit
31
+ - **LIST**: show supported languages/styles/editors
32
+ - **SQUASH**: squash branch commits with generated summary
33
+ - **UPDATE**: check PyPI for updates
34
+
35
+ ### Core Modules (core/)
36
+
37
+ - **config.py** — Config loading with precedence: repo `cai_config.yml` > home `~/.config/cai/cai_config.yml` > bundled defaults
38
+ - **llm.py** — `CommitMessageGenerator` class with `_dispatch_generate()` routing to provider-specific methods (`generate_openai()`, `generate_anthropic()`, etc.)
39
+ - **gitutils.py** — Git operations (find root, diff with `.caiignore` support, commit)
40
+ - **validate.py** — Config and LLM call validation
41
+ - **squash.py** — Squash commit workflow (stage → generate summary → editor → reset + commit)
42
+ - **options.py** — `CliManager` orchestrating CLI operations
43
+
44
+ ### Prompt Fallback Chain
45
+
46
+ File (repo-level) → File (user home) → Bundled package (`defaults/*.md`) → Hardcoded string (`prompts_fallback.py`)
47
+
48
+ ### Tokens
49
+
50
+ API tokens loaded from `~/.config/cai/tokens.yml`. Ollama is in `TOKENLESS_PROVIDERS` (no key needed).
51
+
52
+ ## Testing
53
+
54
+ - Unit tests in `tests/unit/`, integration tests in `tests/integration/`
55
+ - Uses `requests-mock` for HTTP mocking
56
+ - CI tests against Python 3.10–3.14
57
+
58
+ ## Build & Versioning
59
+
60
+ - Package manager: **uv**
61
+ - Version: auto-generated from git tags via `setuptools-scm` → `src/git_cai_cli/_version.py`
62
+ - Do not edit `_version.py` manually
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-cai-cli
3
- Version: 0.9.0
3
+ Version: 0.10.0
4
4
  Summary: Use LLM to create git commit messages
5
5
  Author-email: Thorsten Foltz <thorsten.foltz@live.com>
6
6
  License-Expression: MIT
@@ -78,6 +78,9 @@ Currently supported providers:
78
78
  - Override provider and model per invocation (`-P`, `-m`)
79
79
  - Global configuration with per-repository overrides
80
80
  - Repository-specific language, style, and model selection
81
+ - Amend the last commit message with a regenerated one (`-A`)
82
+ - Conventional Commits format support (`-C`)
83
+ - Change configuration from the command line (`-S`, `-H`)
81
84
  - Optional commit squashing with automatic summary generation
82
85
  - Token usage logging for API calls
83
86
  - Generation time measurement (`-t`)
@@ -214,6 +217,7 @@ git cai -g
214
217
  - `load_tokens_from` – path to the file where API tokens are stored
215
218
  - `prompt_file` - path to the file where the prompt for the commit is stored
216
219
  - `squash_prompt_file` - path to the file where the prompt for the squash is stored
220
+ - `conventional` – use Conventional Commits format (default: `false`)
217
221
  - `token_logging` – log token usage after each LLM call (default: `true` for new installs)
218
222
  - `measure_time` – log generation time (default: `false`)
219
223
 
@@ -223,7 +227,9 @@ git cai -g
223
227
 
224
228
  In addition to `git cai`, the following options are available:
225
229
 
230
+ - `-A`, `--amend` – regenerate and amend the last commit message
226
231
  - `-a`, `--all` – stage all tracked modified and deleted files
232
+ - `-C`, `--conventional` – use Conventional Commits format (`type(scope): description`)
227
233
  - `-c`, `--crazy` – Trust the LLM and commit without checking
228
234
  - `-d`, `--debug` – enable debug logging
229
235
  - `-g`, `--generate-config` – generate the default `cai_config.yml` in the current directory
@@ -233,11 +239,62 @@ In addition to `git cai`, the following options are available:
233
239
  - `-m`, `--model` – override the model for this invocation (requires `-P`)
234
240
  - `-p`, `--generate-prompts` – generate default `commit_prompt.md` and `squash_prompt.md` in the current directory (for customization)
235
241
  - `-P`, `--provider` – override the LLM provider for this invocation
242
+ - `-S`, `--set` – set a config value (`key=value`) in repo config (requires existing repo config)
243
+ - `-H`, `--set-home` – set a config value in home config (`key=value`), always targets `~/.config/cai/`
236
244
  - `-s`, `--squash` – squash commits on the current branch and summarize them
237
245
  - `-t`, `--time` – measure and log commit message generation time
238
246
  - `-u`, `--update` – check for updates
239
247
  - `-v`, `--version` – show the installed version
240
248
 
249
+ ### Amend
250
+
251
+ To regenerate the last commit message and amend it:
252
+
253
+ ```sh
254
+ git cai -A
255
+ ```
256
+
257
+ This reads the diff from the most recent commit, sends it to the LLM, and opens the editor for review.
258
+ Use with `-c` to amend immediately without the editor: `git cai -A -c`.
259
+
260
+ ### Conventional Commits
261
+
262
+ To generate commit messages in [Conventional Commits](https://www.conventionalcommits.org/) format:
263
+
264
+ ```sh
265
+ git cai -C
266
+ ```
267
+
268
+ This enforces the `type(scope): description` structure. Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Use `!` after the type/scope for breaking changes.
269
+
270
+ To enable it permanently:
271
+
272
+ ```sh
273
+ git cai -S conventional=true
274
+ ```
275
+
276
+ ### Changing configuration from the CLI
277
+
278
+ Instead of editing YAML files manually, use `--set` or `--set-home` to update config values.
279
+
280
+ `--set` (`-S`) targets the **repo config** (requires an existing `cai_config.yml` in the repo root):
281
+
282
+ ```sh
283
+ git cai -S default=anthropic # change the default provider
284
+ git cai -S emoji=false # disable emojis
285
+ git cai -S groq.model=llama-3.3-70b # nested key (dot notation)
286
+ git cai -S openai.temperature=0.7 # set temperature as float
287
+ ```
288
+
289
+ If no repo config exists, an error is shown. Use `git cai -g` to create one first.
290
+
291
+ `--set-home` (`-H`) always targets the **home (default) config** (`~/.config/cai/`):
292
+
293
+ ```sh
294
+ git cai -H language=de
295
+ git cai -H emoji=false
296
+ ```
297
+
241
298
  ---
242
299
 
243
300
  ## License
@@ -49,6 +49,9 @@ Currently supported providers:
49
49
  - Override provider and model per invocation (`-P`, `-m`)
50
50
  - Global configuration with per-repository overrides
51
51
  - Repository-specific language, style, and model selection
52
+ - Amend the last commit message with a regenerated one (`-A`)
53
+ - Conventional Commits format support (`-C`)
54
+ - Change configuration from the command line (`-S`, `-H`)
52
55
  - Optional commit squashing with automatic summary generation
53
56
  - Token usage logging for API calls
54
57
  - Generation time measurement (`-t`)
@@ -185,6 +188,7 @@ git cai -g
185
188
  - `load_tokens_from` – path to the file where API tokens are stored
186
189
  - `prompt_file` - path to the file where the prompt for the commit is stored
187
190
  - `squash_prompt_file` - path to the file where the prompt for the squash is stored
191
+ - `conventional` – use Conventional Commits format (default: `false`)
188
192
  - `token_logging` – log token usage after each LLM call (default: `true` for new installs)
189
193
  - `measure_time` – log generation time (default: `false`)
190
194
 
@@ -194,7 +198,9 @@ git cai -g
194
198
 
195
199
  In addition to `git cai`, the following options are available:
196
200
 
201
+ - `-A`, `--amend` – regenerate and amend the last commit message
197
202
  - `-a`, `--all` – stage all tracked modified and deleted files
203
+ - `-C`, `--conventional` – use Conventional Commits format (`type(scope): description`)
198
204
  - `-c`, `--crazy` – Trust the LLM and commit without checking
199
205
  - `-d`, `--debug` – enable debug logging
200
206
  - `-g`, `--generate-config` – generate the default `cai_config.yml` in the current directory
@@ -204,11 +210,62 @@ In addition to `git cai`, the following options are available:
204
210
  - `-m`, `--model` – override the model for this invocation (requires `-P`)
205
211
  - `-p`, `--generate-prompts` – generate default `commit_prompt.md` and `squash_prompt.md` in the current directory (for customization)
206
212
  - `-P`, `--provider` – override the LLM provider for this invocation
213
+ - `-S`, `--set` – set a config value (`key=value`) in repo config (requires existing repo config)
214
+ - `-H`, `--set-home` – set a config value in home config (`key=value`), always targets `~/.config/cai/`
207
215
  - `-s`, `--squash` – squash commits on the current branch and summarize them
208
216
  - `-t`, `--time` – measure and log commit message generation time
209
217
  - `-u`, `--update` – check for updates
210
218
  - `-v`, `--version` – show the installed version
211
219
 
220
+ ### Amend
221
+
222
+ To regenerate the last commit message and amend it:
223
+
224
+ ```sh
225
+ git cai -A
226
+ ```
227
+
228
+ This reads the diff from the most recent commit, sends it to the LLM, and opens the editor for review.
229
+ Use with `-c` to amend immediately without the editor: `git cai -A -c`.
230
+
231
+ ### Conventional Commits
232
+
233
+ To generate commit messages in [Conventional Commits](https://www.conventionalcommits.org/) format:
234
+
235
+ ```sh
236
+ git cai -C
237
+ ```
238
+
239
+ This enforces the `type(scope): description` structure. Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Use `!` after the type/scope for breaking changes.
240
+
241
+ To enable it permanently:
242
+
243
+ ```sh
244
+ git cai -S conventional=true
245
+ ```
246
+
247
+ ### Changing configuration from the CLI
248
+
249
+ Instead of editing YAML files manually, use `--set` or `--set-home` to update config values.
250
+
251
+ `--set` (`-S`) targets the **repo config** (requires an existing `cai_config.yml` in the repo root):
252
+
253
+ ```sh
254
+ git cai -S default=anthropic # change the default provider
255
+ git cai -S emoji=false # disable emojis
256
+ git cai -S groq.model=llama-3.3-70b # nested key (dot notation)
257
+ git cai -S openai.temperature=0.7 # set temperature as float
258
+ ```
259
+
260
+ If no repo config exists, an error is shown. Use `git cai -g` to create one first.
261
+
262
+ `--set-home` (`-H`) always targets the **home (default) config** (`~/.config/cai/`):
263
+
264
+ ```sh
265
+ git cai -H language=de
266
+ git cai -H emoji=false
267
+ ```
268
+
212
269
  ---
213
270
 
214
271
  ## License