git-cai-cli 0.18.0__tar.gz → 0.18.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 (115) hide show
  1. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/PKG-INFO +27 -1
  2. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/README.md +26 -0
  3. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/cai_config.yml +3 -2
  4. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/docs/git-cai.txt +22 -0
  5. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/docs/man/git-cai.1 +44 -2
  6. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/_version.py +3 -3
  7. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/cli/cli.py +7 -0
  8. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/cli/helptext.py +1 -0
  9. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/completion.py +3 -1
  10. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/config.py +2 -0
  11. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/gitutils.py +17 -2
  12. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/squash.py +11 -0
  13. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/validate.py +1 -0
  14. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/main.py +12 -0
  15. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli.egg-info/PKG-INFO +27 -1
  16. git_cai_cli-0.18.1/src/git_cai_cli.egg-info/scm_version.json +8 -0
  17. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_completion.py +3 -0
  18. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_signoff.py +24 -1
  19. git_cai_cli-0.18.0/src/git_cai_cli.egg-info/scm_version.json +0 -8
  20. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.caiignore +0 -0
  21. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.gitattributes +0 -0
  22. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/cd/.SRCINFO +0 -0
  23. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/cd/PKGBUILD +0 -0
  24. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/ci/_version.py +0 -0
  25. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/ci/cai_config.ci.yml +0 -0
  26. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/ci/tokens.ci.yml +0 -0
  27. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/workflows/python-tests.yml +0 -0
  28. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/workflows/release.yml +0 -0
  29. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.github/workflows/release_aur.yml +0 -0
  30. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.gitignore +0 -0
  31. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.bandit.yml +0 -0
  32. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.checkov.yml +0 -0
  33. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.flake8 +0 -0
  34. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.ls-lint.yml +0 -0
  35. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.markdownlint.json +0 -0
  36. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.proselintrc.json +0 -0
  37. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.pylintrc +0 -0
  38. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/.yamllint.yml +0 -0
  39. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/check_git_branch_name.sh +0 -0
  40. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/lychee.toml +0 -0
  41. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.linters/pyrightconfig.json +0 -0
  42. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.markdownlintignore +0 -0
  43. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.mega-linter.yml +0 -0
  44. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.semgrepignore +0 -0
  45. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/.trivyignore +0 -0
  46. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/CLAUDE.md +0 -0
  47. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/LICENSE +0 -0
  48. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/Makefile +0 -0
  49. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/pyproject.toml +0 -0
  50. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/setup.cfg +0 -0
  51. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/__init__.py +0 -0
  52. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/cli/__init__.py +0 -0
  53. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/cli/modes.py +0 -0
  54. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/__init__.py +0 -0
  55. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/changelog.py +0 -0
  56. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/doctor.py +0 -0
  57. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/explain.py +0 -0
  58. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/generation.py +0 -0
  59. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/init.py +0 -0
  60. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/languages.py +0 -0
  61. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/llm.py +0 -0
  62. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/options.py +0 -0
  63. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/pr.py +0 -0
  64. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/prompts_fallback.py +0 -0
  65. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/release.py +0 -0
  66. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/secrets.py +0 -0
  67. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/spinner.py +0 -0
  68. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/split.py +0 -0
  69. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/stats.py +0 -0
  70. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli/core/subscription.py +0 -0
  71. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli.egg-info/SOURCES.txt +0 -0
  72. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli.egg-info/dependency_links.txt +0 -0
  73. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli.egg-info/entry_points.txt +0 -0
  74. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli.egg-info/requires.txt +0 -0
  75. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli.egg-info/scm_file_list.json +0 -0
  76. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/src/git_cai_cli.egg-info/top_level.txt +0 -0
  77. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/conftest.py +0 -0
  78. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/integration/test_cli_integration.py +0 -0
  79. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/integration/test_config_integration.py +0 -0
  80. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/integration/test_gitutils_integration.py +0 -0
  81. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/integration/test_modes_integration.py +0 -0
  82. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/integration/test_options_integration.py +0 -0
  83. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/integration/test_pr_integration.py +0 -0
  84. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/integration/test_squash_integration.py +0 -0
  85. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_amend.py +0 -0
  86. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_branch_context.py +0 -0
  87. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_changelog.py +0 -0
  88. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_classification.py +0 -0
  89. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_cli.py +0 -0
  90. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_config.py +0 -0
  91. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_conventional.py +0 -0
  92. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_custom_provider.py +0 -0
  93. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_doctor.py +0 -0
  94. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_explain.py +0 -0
  95. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_generation.py +0 -0
  96. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_gitutils.py +0 -0
  97. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_helptext.py +0 -0
  98. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_init.py +0 -0
  99. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_llm.py +0 -0
  100. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_main.py +0 -0
  101. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_modes.py +0 -0
  102. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_options.py +0 -0
  103. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_pr.py +0 -0
  104. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_print.py +0 -0
  105. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_prompt_loading.py +0 -0
  106. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_release.py +0 -0
  107. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_secrets.py +0 -0
  108. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_set_config.py +0 -0
  109. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_spinner.py +0 -0
  110. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_split.py +0 -0
  111. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_squash.py +0 -0
  112. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_stats.py +0 -0
  113. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_subscription.py +0 -0
  114. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/tests/unit/test_validate.py +0 -0
  115. {git_cai_cli-0.18.0 → git_cai_cli-0.18.1}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-cai-cli
3
- Version: 0.18.0
3
+ Version: 0.18.1
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
@@ -88,6 +88,7 @@ Anthropic and OpenAI can also run on a Claude or ChatGPT subscription instead of
88
88
  - Amend mode refines the existing commit message instead of regenerating it from scratch, preserving trailers and intent
89
89
  - Conventional Commits format support
90
90
  - `Signed-off-by:` (DCO) trailer support via `--signoff`
91
+ - Optional `Branch:` trailer with the current branch name via `--branch-trailer`
91
92
  - `--print` mode that emits the generated message to stdout for scripting
92
93
  - Change configuration from the command line
93
94
  - Optional commit squashing with automatic summary generation (all, last N, or up to a specific commit)
@@ -327,6 +328,7 @@ OpenAI style providers include the version (`https://gateway.example/v1`); `anth
327
328
  - `stats` – opt in to local-only usage analytics (per-run row in a SQLite DB at `~/.local/share/git-cai/stats.db`); default `false`.
328
329
  No diff content, commit messages, or file paths are stored — only metadata (provider, model, kind, repo name, token counts, latency, settings)
329
330
  - `signoff` – append a `Signed-off-by:` trailer (built from git `user.name` / `user.email`) to every commit message; default `false`
331
+ - `branch_trailer` – append a `Branch: <name>` trailer with the current branch name, placed above any sign-off; default `false`
330
332
  - `secret_scan` – scan the outgoing diff for likely secrets and ask before sending; default `true`. Bypass once with `-B` / `--allow-secrets`,
331
333
  or disable entirely by setting it to `false`. Skipped for tokenless providers (Ollama), where nothing leaves the machine.
332
334
  Custom providers are always scanned, even with `requires_token: false`, since the diff may leave the machine
@@ -352,6 +354,7 @@ In addition to `git cai`, the following options are available:
352
354
  - `-h`, `--help` – show help and available commands
353
355
  - `-I`, `--init` – interactive setup wizard (writes home config and tokens.yml)
354
356
  - `-i`, `--install-completion` – install shell completion for bash, zsh, or fish. Rerun after upgrading to get custom provider completion
357
+ - `-j`, `--branch-trailer` / `--no-branch-trailer` – append a `Branch: <name>` trailer with the current branch name (above any sign-off; skipped on a detached HEAD); applies to commit, amend, and squash modes
355
358
  - `-K`, `--no-subscription` – use the API for this invocation even when the config has `subscription: true` (error for `copilot`)
356
359
  - `-k`, `--check` – run configuration diagnostics offline (config source, provider, token, prompts, editor, style)
357
360
  - `-l`, `--list` – list available information. Valid types: `config`, `editor`, `language`, `model`, `path`, `provider`, `style`
@@ -506,6 +509,29 @@ is appended to that block without an extra blank line. Re-running with
506
509
  `--signoff` on a message that already carries the same trailer is a
507
510
  no-op.
508
511
 
512
+ ### Branch trailer
513
+
514
+ cai can also record the branch a commit was made on as a `Branch:`
515
+ trailer. It goes at the bottom of the message, directly above the
516
+ `Signed-off-by:` line when sign-off is active:
517
+
518
+ ```sh
519
+ git cai -j # one-off
520
+ git cai -j -o # with sign-off
521
+ git cai -S branch_trailer=true # enable persistently in the repo config
522
+ ```
523
+
524
+ ```text
525
+ feat: add login timeout
526
+
527
+ Body.
528
+
529
+ Branch: feature/login-timeout
530
+ Signed-off-by: Alice <alice@example.com>
531
+ ```
532
+
533
+ On a detached HEAD there is no branch name, so nothing is added.
534
+
509
535
  ### Print-only output (no commit)
510
536
 
511
537
  `--print` generates the commit message and writes it to stdout instead
@@ -59,6 +59,7 @@ Anthropic and OpenAI can also run on a Claude or ChatGPT subscription instead of
59
59
  - Amend mode refines the existing commit message instead of regenerating it from scratch, preserving trailers and intent
60
60
  - Conventional Commits format support
61
61
  - `Signed-off-by:` (DCO) trailer support via `--signoff`
62
+ - Optional `Branch:` trailer with the current branch name via `--branch-trailer`
62
63
  - `--print` mode that emits the generated message to stdout for scripting
63
64
  - Change configuration from the command line
64
65
  - Optional commit squashing with automatic summary generation (all, last N, or up to a specific commit)
@@ -298,6 +299,7 @@ OpenAI style providers include the version (`https://gateway.example/v1`); `anth
298
299
  - `stats` – opt in to local-only usage analytics (per-run row in a SQLite DB at `~/.local/share/git-cai/stats.db`); default `false`.
299
300
  No diff content, commit messages, or file paths are stored — only metadata (provider, model, kind, repo name, token counts, latency, settings)
300
301
  - `signoff` – append a `Signed-off-by:` trailer (built from git `user.name` / `user.email`) to every commit message; default `false`
302
+ - `branch_trailer` – append a `Branch: <name>` trailer with the current branch name, placed above any sign-off; default `false`
301
303
  - `secret_scan` – scan the outgoing diff for likely secrets and ask before sending; default `true`. Bypass once with `-B` / `--allow-secrets`,
302
304
  or disable entirely by setting it to `false`. Skipped for tokenless providers (Ollama), where nothing leaves the machine.
303
305
  Custom providers are always scanned, even with `requires_token: false`, since the diff may leave the machine
@@ -323,6 +325,7 @@ In addition to `git cai`, the following options are available:
323
325
  - `-h`, `--help` – show help and available commands
324
326
  - `-I`, `--init` – interactive setup wizard (writes home config and tokens.yml)
325
327
  - `-i`, `--install-completion` – install shell completion for bash, zsh, or fish. Rerun after upgrading to get custom provider completion
328
+ - `-j`, `--branch-trailer` / `--no-branch-trailer` – append a `Branch: <name>` trailer with the current branch name (above any sign-off; skipped on a detached HEAD); applies to commit, amend, and squash modes
326
329
  - `-K`, `--no-subscription` – use the API for this invocation even when the config has `subscription: true` (error for `copilot`)
327
330
  - `-k`, `--check` – run configuration diagnostics offline (config source, provider, token, prompts, editor, style)
328
331
  - `-l`, `--list` – list available information. Valid types: `config`, `editor`, `language`, `model`, `path`, `provider`, `style`
@@ -477,6 +480,29 @@ is appended to that block without an extra blank line. Re-running with
477
480
  `--signoff` on a message that already carries the same trailer is a
478
481
  no-op.
479
482
 
483
+ ### Branch trailer
484
+
485
+ cai can also record the branch a commit was made on as a `Branch:`
486
+ trailer. It goes at the bottom of the message, directly above the
487
+ `Signed-off-by:` line when sign-off is active:
488
+
489
+ ```sh
490
+ git cai -j # one-off
491
+ git cai -j -o # with sign-off
492
+ git cai -S branch_trailer=true # enable persistently in the repo config
493
+ ```
494
+
495
+ ```text
496
+ feat: add login timeout
497
+
498
+ Body.
499
+
500
+ Branch: feature/login-timeout
501
+ Signed-off-by: Alice <alice@example.com>
502
+ ```
503
+
504
+ On a detached HEAD there is no branch name, so nothing is added.
505
+
480
506
  ### Print-only output (no commit)
481
507
 
482
508
  `--print` generates the commit message and writes it to stdout instead
@@ -4,7 +4,8 @@ style: professional
4
4
  emoji: true
5
5
  conventional: false
6
6
  branch_context: false
7
- load_tokens_from: /home/thorsten/.config/cai/tokens.yml
7
+ branch_trailer: true
8
+ load_tokens_from: ~/.config/cai/tokens.yml
8
9
  prompt_file: ""
9
10
  squash_prompt_file: ""
10
11
  full_files_prompt_file: ""
@@ -14,7 +15,7 @@ timeout: 30
14
15
  full_files: false
15
16
  pr_to_file: false
16
17
  pr_file_name: PR_DESCRIPTION.md
17
- pr_prompt_file: "/home/thorsten/.config/cai/pr_prompt.md"
18
+ pr_prompt_file: "~/.config/cai/pr_prompt.md"
18
19
  stats: true
19
20
  signoff: true
20
21
  subscription: true
@@ -20,6 +20,7 @@ SYNOPSIS
20
20
  [-g | --generate-config]
21
21
  [-H KEY=VALUE | --set-home KEY=VALUE] [-h | --help]
22
22
  [-I | --init] [-i | --install-completion]
23
+ [-j | --branch-trailer | --no-branch-trailer]
23
24
  [-k | --check]
24
25
  [-L CODE | --language CODE]
25
26
  [-l [config|editor|language|model|path|provider|style] |
@@ -435,6 +436,25 @@ file for the completions to take effect.
435
436
  git cai -i
436
437
  ----
437
438
 
439
+ -j, --branch-trailer / --no-branch-trailer::
440
+ Append a `Branch: <name>` trailer with the current branch name to the
441
+ generated commit message. Applies in COMMIT, AMEND, and SQUASH modes.
442
+ The trailer goes at the bottom; when `--signoff` is active as well, it
443
+ sits directly above the `Signed-off-by:` line. On a detached HEAD there
444
+ is no branch name, so nothing is added. Off by default.
445
+ +
446
+ Use `--no-branch-trailer` to explicitly disable for the current run when
447
+ the persisted config has `branch_trailer: true`. To enable permanently:
448
+ +
449
+ ----
450
+ git cai -S branch_trailer=true
451
+ ----
452
+ +
453
+ ----
454
+ git cai -j
455
+ git cai -j -o
456
+ ----
457
+
438
458
  -K, --no-subscription::
439
459
  Use the API for this invocation even when the persisted config has
440
460
  `subscription: true`. The provider then needs its API token as usual. This is
@@ -1141,6 +1161,8 @@ Available configuration keys:
1141
1161
  `funny`, `excited`, `sarcastic`, `apologetic`, `academic`)
1142
1162
  - `emoji` -- enable or disable emojis in commit messages (`true`/`false`)
1143
1163
  - `branch_context` -- include current branch name as LLM context (`true`/`false`)
1164
+ - `branch_trailer` -- append a `Branch: <name>` trailer above any sign-off
1165
+ (`true`/`false`, default `false`)
1144
1166
  - `conventional` -- use Conventional Commits format (`true`/`false`)
1145
1167
  - `secret_scan` -- scan the diff (and any full-file contents) for likely
1146
1168
  secrets before sending to the LLM (`true`/`false`, default `true`). On a
@@ -2,12 +2,12 @@
2
2
  .\" Title: git-cai
3
3
  .\" Author: Thorsten Foltz
4
4
  .\" Generator: Asciidoctor 2.0.26
5
- .\" Date: 2026-11-26
5
+ .\" Date: 2026-12-01
6
6
  .\" Manual: \ \&
7
7
  .\" Source: \ \&
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "GIT\-CAI" "1" "2026-11-26" "\ \&" "\ \&"
10
+ .TH "GIT\-CAI" "1" "2026-12-01" "\ \&" "\ \&"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -42,6 +42,7 @@ git-cai \- AI\-powered commit message generator
42
42
  [\-g | \-\-generate\-config]
43
43
  [\-H KEY=VALUE | \-\-set\-home KEY=VALUE] [\-h | \-\-help]
44
44
  [\-I | \-\-init] [\-i | \-\-install\-completion]
45
+ [\-j | \-\-branch\-trailer | \-\-no\-branch\-trailer]
45
46
  [\-k | \-\-check]
46
47
  [\-L CODE | \-\-language CODE]
47
48
  [\-l [config|editor|language|model|path|provider|style] |
@@ -842,6 +843,35 @@ git cai \-i
842
843
  .if n .RE
843
844
  .RE
844
845
  .sp
846
+ \-j, \-\-branch\-trailer / \-\-no\-branch\-trailer
847
+ .RS 4
848
+ Append a \f(CRBranch: <name>\fP trailer with the current branch name to the
849
+ generated commit message. Applies in COMMIT, AMEND, and SQUASH modes.
850
+ The trailer goes at the bottom; when \f(CR\-\-signoff\fP is active as well, it
851
+ sits directly above the \f(CRSigned\-off\-by:\fP line. On a detached HEAD there
852
+ is no branch name, so nothing is added. Off by default.
853
+ .sp
854
+ Use \f(CR\-\-no\-branch\-trailer\fP to explicitly disable for the current run when
855
+ the persisted config has \f(CRbranch_trailer: true\fP. To enable permanently:
856
+ .sp
857
+ .if n .RS 4
858
+ .nf
859
+ .fam C
860
+ git cai \-S branch_trailer=true
861
+ .fam
862
+ .fi
863
+ .if n .RE
864
+ .sp
865
+ .if n .RS 4
866
+ .nf
867
+ .fam C
868
+ git cai \-j
869
+ git cai \-j \-o
870
+ .fam
871
+ .fi
872
+ .if n .RE
873
+ .RE
874
+ .sp
845
875
  \-K, \-\-no\-subscription
846
876
  .RS 4
847
877
  Use the API for this invocation even when the persisted config has
@@ -1895,6 +1925,18 @@ command line tool of the vendor instead of the API (\f(CRtrue\fP/\f(CRfalse\fP,
1895
1925
  . sp -1
1896
1926
  . IP \(bu 2.3
1897
1927
  .\}
1928
+ \f(CRbranch_trailer\fP \(em append a \f(CRBranch: <name>\fP trailer above any sign\-off
1929
+ (\f(CRtrue\fP/\f(CRfalse\fP, default \f(CRfalse\fP)
1930
+ .RE
1931
+ .sp
1932
+ .RS 4
1933
+ .ie n \{\
1934
+ \h'-04'\(bu\h'+03'\c
1935
+ .\}
1936
+ .el \{\
1937
+ . sp -1
1938
+ . IP \(bu 2.3
1939
+ .\}
1898
1940
  \f(CRconventional\fP \(em use Conventional Commits format (\f(CRtrue\fP/\f(CRfalse\fP)
1899
1941
  .RE
1900
1942
  .sp
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.18.0'
22
- __version_tuple__ = version_tuple = (0, 18, 0)
21
+ __version__ = version = '0.18.1'
22
+ __version_tuple__ = version_tuple = (0, 18, 1)
23
23
 
24
- __commit_id__ = commit_id = 'ga3de86a5e'
24
+ __commit_id__ = commit_id = 'g6372aafbf'
@@ -201,6 +201,12 @@ def callback( # pylint: disable=too-many-arguments,too-many-positional-argument
201
201
  "-o",
202
202
  help="Append a `Signed-off-by:` trailer using git user.name/user.email. Use --no-signoff to disable when the persisted config has it enabled.",
203
203
  ),
204
+ branch_trailer: bool | None = typer.Option(
205
+ None,
206
+ "--branch-trailer/--no-branch-trailer",
207
+ "-j",
208
+ help="Append a `Branch:` trailer with the current branch name (before any sign-off). Use --no-branch-trailer to disable when the persisted config has it enabled.",
209
+ ),
204
210
  print_only: bool = typer.Option(
205
211
  False,
206
212
  "--print",
@@ -400,6 +406,7 @@ def callback( # pylint: disable=too-many-arguments,too-many-positional-argument
400
406
  stats_json=stats_json,
401
407
  stats_reset=stats_reset,
402
408
  signoff=signoff,
409
+ branch_trailer=branch_trailer,
403
410
  print_only=print_only,
404
411
  temperature_override=temperature,
405
412
  style_override=style,
@@ -32,6 +32,7 @@ Flags:
32
32
  -h, --help Show this help message or opens manual
33
33
  -I, --init Interactive setup wizard (writes home config and tokens.yml)
34
34
  -i, --install-completion Install shell completion for git-cai
35
+ -j, --branch-trailer Append a `Branch:` trailer with the current branch name
35
36
  -K, --no-subscription Use the API instead of the subscription (API key)
36
37
  -k, --check Run configuration diagnostics (offline; add --ping for a live probe)
37
38
  -L, --language CODE Override the commit message language (e.g. de, fr, none)
@@ -41,6 +41,7 @@ _git-cai() {
41
41
  '(-h --help)'{-h,--help}'[Show help]'
42
42
  '(-I --init)'{-I,--init}'[Interactive setup wizard]'
43
43
  '(-i --install-completion)'{-i,--install-completion}'[Install shell completion]'
44
+ '(-j --branch-trailer)'{-j,--branch-trailer}'[Append a Branch trailer]'
44
45
  '(-l --list)'{-l,--list}'[List information]:type:(config editor language model path provider style)'
45
46
  '(-m --model)'{-m,--model}'[Override model (requires --provider)]:model:'
46
47
  '(-o --signoff)'{-o,--signoff}'[Append a Signed-off-by trailer]'
@@ -84,7 +85,7 @@ _git_cai_completion() {
84
85
  opts="-A --amend -a --all -b --branch -C --conventional -c --crazy \\
85
86
  -d --debug -e --temperature -F --full-files -f --files \\
86
87
  -g --generate-config -H --set-home -h --help -I --init \\
87
- -i --install-completion -l --list -m --model -o --signoff \\
88
+ -i --install-completion -j --branch-trailer -l --list -m --model -o --signoff \\
88
89
  -P --provider -p --generate-prompts --print -q --sql \\
89
90
  -r --PR --base -S --set -s --squash -T --timeout -t --time \\
90
91
  -U --subscription -K --no-subscription \\
@@ -139,6 +140,7 @@ complete -c git-cai -s H -l set-home -d 'Set config value in home config' -r
139
140
  complete -c git-cai -s h -l help -d 'Show help'
140
141
  complete -c git-cai -s I -l init -d 'Interactive setup wizard'
141
142
  complete -c git-cai -s i -l install-completion -d 'Install shell completion'
143
+ complete -c git-cai -s j -l branch-trailer -d 'Append a Branch trailer'
142
144
  complete -c git-cai -s l -l list -d 'List information' -x -a 'config editor language model path provider style'
143
145
  complete -c git-cai -s m -l model -d 'Override model' -r
144
146
  complete -c git-cai -s o -l signoff -d 'Append a Signed-off-by trailer'
@@ -90,6 +90,7 @@ DEFAULT_CONFIG: dict[str, Any] = {
90
90
  "stats": False,
91
91
  "stats_db_path": "", # empty → XDG default (see stats.resolve_db_path)
92
92
  "signoff": False,
93
+ "branch_trailer": False,
93
94
  "secret_scan": True,
94
95
  "secret_scan_exclude": [],
95
96
  }
@@ -560,6 +561,7 @@ def ordered_default_config(
560
561
  "stats",
561
562
  "stats_db_path",
562
563
  "signoff",
564
+ "branch_trailer",
563
565
  "secret_scan",
564
566
  "secret_scan_exclude",
565
567
  ]
@@ -250,8 +250,23 @@ def append_signoff(message: str, identity: tuple[str, str] | None = None) -> str
250
250
  Pre-adding ``\\n`` here would defeat that signal.
251
251
  """
252
252
  name, email = identity if identity is not None else get_git_identity()
253
- trailer = f"Signed-off-by: {name} <{email}>"
253
+ return _append_trailer(message, f"Signed-off-by: {name} <{email}>")
254
254
 
255
+
256
+ def append_branch(message: str, branch: str | None = None) -> str:
257
+ """Append a ``Branch: <name>`` trailer for the current branch.
258
+
259
+ Runs before ``append_signoff`` so the sign-off stays the last line.
260
+ A detached HEAD has no branch name, so the message is returned as is.
261
+ """
262
+ branch = branch if branch is not None else get_current_branch()
263
+ if not branch:
264
+ return message
265
+ return _append_trailer(message, f"Branch: {branch}")
266
+
267
+
268
+ def _append_trailer(message: str, trailer: str) -> str:
269
+ """Append ``trailer`` to ``message`` (idempotent); see ``append_signoff``."""
255
270
  if trailer in message:
256
271
  return message
257
272
 
@@ -262,7 +277,7 @@ def append_signoff(message: str, identity: tuple[str, str] | None = None) -> str
262
277
  # Only join an existing trailer block directly: a block is the final
263
278
  # paragraph and must consist solely of ``Key: value`` lines. A message
264
279
  # with a single paragraph never qualifies — a lone conventional subject
265
- # ("feat: add x") looks like a trailer line, and gluing the sign-off to
280
+ # ("feat: add x") looks like a trailer line, and gluing the trailer to
266
281
  # it makes git stop recognizing the trailer at all.
267
282
  paragraphs = stripped.split("\n\n")
268
283
  if len(paragraphs) > 1 and all(
@@ -20,6 +20,7 @@ from git_cai_cli.core.config import (
20
20
  )
21
21
  from git_cai_cli.core.gitutils import (
22
22
  _has_upstream,
23
+ append_branch,
23
24
  append_signoff,
24
25
  apply_diff_limit,
25
26
  commit_with_edit_template,
@@ -210,6 +211,7 @@ def squash_branch(
210
211
  context: str | None = None,
211
212
  sql_override: bool | None = None,
212
213
  signoff: bool | None = None,
214
+ branch_trailer: bool | None = None,
213
215
  allow_secrets: bool = False,
214
216
  subscription_override: bool | None = None,
215
217
  ) -> None:
@@ -263,6 +265,11 @@ def squash_branch(
263
265
  apply_cli_overrides(config, sql_override=sql_override)
264
266
 
265
267
  apply_signoff = signoff if signoff is not None else config.get("signoff", False)
268
+ apply_branch = (
269
+ branch_trailer
270
+ if branch_trailer is not None
271
+ else config.get("branch_trailer", False)
272
+ )
266
273
 
267
274
  from git_cai_cli.core import stats as stats_module
268
275
 
@@ -324,6 +331,8 @@ def squash_branch(
324
331
  log.info("Commit message generated in %.2fs", elapsed)
325
332
  generator.record_elapsed(int(elapsed * 1000))
326
333
 
334
+ if apply_branch:
335
+ msg = append_branch(msg)
327
336
  if apply_signoff:
328
337
  try:
329
338
  msg = append_signoff(msg)
@@ -419,6 +428,8 @@ def squash_branch(
419
428
  # The trailer is added before the editor opens — same as commit mode,
420
429
  # so the user sees (and can drop) it instead of it appearing only
421
430
  # after the squash commit was already written.
431
+ if apply_branch:
432
+ summary_message = append_branch(summary_message)
422
433
  if apply_signoff:
423
434
  try:
424
435
  summary_message = append_signoff(summary_message)
@@ -48,6 +48,7 @@ ALLOWED_GLOBAL_KEYS = frozenset(
48
48
  "stats",
49
49
  "stats_db_path",
50
50
  "signoff",
51
+ "branch_trailer",
51
52
  "secret_scan",
52
53
  "secret_scan_exclude",
53
54
  }
@@ -117,6 +117,7 @@ def run(
117
117
  stats_json: bool = False,
118
118
  stats_reset: bool = False,
119
119
  signoff: bool | None = None,
120
+ branch_trailer: bool | None = None,
120
121
  print_only: bool = False,
121
122
  temperature_override: float | None = None,
122
123
  style_override: str | None = None,
@@ -200,6 +201,7 @@ def run(
200
201
  context=context,
201
202
  sql_override=sql_override,
202
203
  signoff=signoff,
204
+ branch_trailer=branch_trailer,
203
205
  allow_secrets=allow_secrets,
204
206
  subscription_override=subscription_override,
205
207
  )
@@ -414,6 +416,16 @@ def run(
414
416
  log.info("Commit message generated in %.2fs", elapsed)
415
417
  generator.record_elapsed(int(elapsed * 1000))
416
418
 
419
+ apply_branch = (
420
+ branch_trailer
421
+ if branch_trailer is not None
422
+ else config.get("branch_trailer", False)
423
+ )
424
+ if apply_branch:
425
+ from git_cai_cli.core.gitutils import append_branch
426
+
427
+ commit_message = append_branch(commit_message)
428
+
417
429
  apply_signoff = signoff if signoff is not None else config.get("signoff", False)
418
430
  if apply_signoff:
419
431
  from git_cai_cli.core.gitutils import append_signoff
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: git-cai-cli
3
- Version: 0.18.0
3
+ Version: 0.18.1
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
@@ -88,6 +88,7 @@ Anthropic and OpenAI can also run on a Claude or ChatGPT subscription instead of
88
88
  - Amend mode refines the existing commit message instead of regenerating it from scratch, preserving trailers and intent
89
89
  - Conventional Commits format support
90
90
  - `Signed-off-by:` (DCO) trailer support via `--signoff`
91
+ - Optional `Branch:` trailer with the current branch name via `--branch-trailer`
91
92
  - `--print` mode that emits the generated message to stdout for scripting
92
93
  - Change configuration from the command line
93
94
  - Optional commit squashing with automatic summary generation (all, last N, or up to a specific commit)
@@ -327,6 +328,7 @@ OpenAI style providers include the version (`https://gateway.example/v1`); `anth
327
328
  - `stats` – opt in to local-only usage analytics (per-run row in a SQLite DB at `~/.local/share/git-cai/stats.db`); default `false`.
328
329
  No diff content, commit messages, or file paths are stored — only metadata (provider, model, kind, repo name, token counts, latency, settings)
329
330
  - `signoff` – append a `Signed-off-by:` trailer (built from git `user.name` / `user.email`) to every commit message; default `false`
331
+ - `branch_trailer` – append a `Branch: <name>` trailer with the current branch name, placed above any sign-off; default `false`
330
332
  - `secret_scan` – scan the outgoing diff for likely secrets and ask before sending; default `true`. Bypass once with `-B` / `--allow-secrets`,
331
333
  or disable entirely by setting it to `false`. Skipped for tokenless providers (Ollama), where nothing leaves the machine.
332
334
  Custom providers are always scanned, even with `requires_token: false`, since the diff may leave the machine
@@ -352,6 +354,7 @@ In addition to `git cai`, the following options are available:
352
354
  - `-h`, `--help` – show help and available commands
353
355
  - `-I`, `--init` – interactive setup wizard (writes home config and tokens.yml)
354
356
  - `-i`, `--install-completion` – install shell completion for bash, zsh, or fish. Rerun after upgrading to get custom provider completion
357
+ - `-j`, `--branch-trailer` / `--no-branch-trailer` – append a `Branch: <name>` trailer with the current branch name (above any sign-off; skipped on a detached HEAD); applies to commit, amend, and squash modes
355
358
  - `-K`, `--no-subscription` – use the API for this invocation even when the config has `subscription: true` (error for `copilot`)
356
359
  - `-k`, `--check` – run configuration diagnostics offline (config source, provider, token, prompts, editor, style)
357
360
  - `-l`, `--list` – list available information. Valid types: `config`, `editor`, `language`, `model`, `path`, `provider`, `style`
@@ -506,6 +509,29 @@ is appended to that block without an extra blank line. Re-running with
506
509
  `--signoff` on a message that already carries the same trailer is a
507
510
  no-op.
508
511
 
512
+ ### Branch trailer
513
+
514
+ cai can also record the branch a commit was made on as a `Branch:`
515
+ trailer. It goes at the bottom of the message, directly above the
516
+ `Signed-off-by:` line when sign-off is active:
517
+
518
+ ```sh
519
+ git cai -j # one-off
520
+ git cai -j -o # with sign-off
521
+ git cai -S branch_trailer=true # enable persistently in the repo config
522
+ ```
523
+
524
+ ```text
525
+ feat: add login timeout
526
+
527
+ Body.
528
+
529
+ Branch: feature/login-timeout
530
+ Signed-off-by: Alice <alice@example.com>
531
+ ```
532
+
533
+ On a detached HEAD there is no branch name, so nothing is added.
534
+
509
535
  ### Print-only output (no commit)
510
536
 
511
537
  `--print` generates the commit message and writes it to stdout instead
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.18.1",
3
+ "distance": 0,
4
+ "node": "g6372aafbf1aac8ce8a0a7645a7463ce3ce906817",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-12-01"
8
+ }
@@ -63,6 +63,7 @@ def test_zsh_script_has_all_flags():
63
63
  "--list",
64
64
  "--model",
65
65
  "--signoff",
66
+ "--branch-trailer",
66
67
  "--generate-prompts",
67
68
  "--print",
68
69
  "--sql",
@@ -109,6 +110,7 @@ def test_bash_script_has_all_flags():
109
110
  "--list",
110
111
  "--model",
111
112
  "--signoff",
113
+ "--branch-trailer",
112
114
  "--generate-prompts",
113
115
  "--print",
114
116
  "--sql",
@@ -161,6 +163,7 @@ def test_fish_script_has_all_flags():
161
163
  "list",
162
164
  "model",
163
165
  "signoff",
166
+ "branch-trailer",
164
167
  "generate-prompts",
165
168
  "print",
166
169
  "sql",
@@ -8,7 +8,7 @@ Covers ``get_git_identity`` and ``append_signoff`` in
8
8
  from unittest.mock import MagicMock
9
9
 
10
10
  import pytest
11
- from git_cai_cli.core.gitutils import append_signoff, get_git_identity
11
+ from git_cai_cli.core.gitutils import append_branch, append_signoff, get_git_identity
12
12
 
13
13
 
14
14
  def _identity_runner(name: str, email: str):
@@ -146,3 +146,26 @@ def test_append_signoff_calls_get_git_identity_when_no_identity_passed(monkeypat
146
146
  out = append_signoff("Fix typo")
147
147
  assert called
148
148
  assert "Signed-off-by: Alice <alice@example.com>" in out
149
+
150
+
151
+ def test_append_branch_goes_above_signoff():
152
+ msg = append_branch("feat: add x\n\nBody.", branch="feature/x")
153
+ msg = append_signoff(msg, identity=("Alice", "alice@example.com"))
154
+ assert msg == (
155
+ "feat: add x\n\nBody.\n\n"
156
+ "Branch: feature/x\nSigned-off-by: Alice <alice@example.com>"
157
+ )
158
+
159
+
160
+ def test_append_branch_without_signoff_is_last_line():
161
+ assert append_branch("feat: add x", branch="main") == "feat: add x\n\nBranch: main"
162
+
163
+
164
+ def test_append_branch_idempotent():
165
+ msg = append_branch("feat: add x", branch="main")
166
+ assert append_branch(msg, branch="main") == msg
167
+
168
+
169
+ def test_append_branch_detached_head_leaves_message(monkeypatch):
170
+ monkeypatch.setattr("git_cai_cli.core.gitutils.get_current_branch", lambda: None)
171
+ assert append_branch("feat: add x") == "feat: add x"
@@ -1,8 +0,0 @@
1
- {
2
- "tag": "0.18.0",
3
- "distance": 0,
4
- "node": "ga3de86a5e2b5aebd50c249c03a420989715a320c",
5
- "dirty": false,
6
- "branch": "HEAD",
7
- "node_date": "2026-11-26"
8
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes