Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ require("ai_commit_msg").setup({
-- Show notifications
notifications = true,

-- Number of surrounding lines to include in git diff (default: 10)
context_lines = 10,
-- Number of surrounding lines to include in git diff (default: 5)
context_lines = 5,

-- Cost display format ("compact", "verbose", or false to disable)
cost_display = "compact",
Expand Down Expand Up @@ -361,6 +361,10 @@ git config --global core.editor nvim
- If you don't specify `max_tokens`, the model will use its default limit
- For Anthropic models, `max_tokens` is required by the API
(defaults to 1000 if not specified)
- For more predictable messages, keep `context_lines` modest (default `5`;
usually `3-10`) to reduce noisy, unchanged context in large diffs
- If outputs are too verbose, prefer single-line defaults with a custom
`system_prompt` that only allows a body for complex or breaking changes

## License

Expand Down
8 changes: 6 additions & 2 deletions doc/ai-commit-msg.nvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ CONFIGURATION *ai-commit-msg.nvim-ai-commit-msg.nvim-configuration*
-- Show notifications
notifications = true,

-- Number of surrounding lines to include in git diff (default: 10)
context_lines = 10,
-- Number of surrounding lines to include in git diff (default: 5)
context_lines = 5,

-- Cost display format ("compact", "verbose", or false to disable)
cost_display = "compact",
Expand Down Expand Up @@ -421,6 +421,10 @@ TIPS *ai-commit-msg.nvim-ai-commit-msg.nvim-tips*
- If you don’t specify `max_tokens`, the model will use its default limit
- For Anthropic models, `max_tokens` is required by the API
(defaults to 1000 if not specified)
- For more predictable messages, keep `context_lines` modest (default `5`;
usually `3-10`) to reduce noisy, unchanged context in large diffs
- If outputs are too verbose, prefer single-line defaults with a custom
`system_prompt` that only allows a body for complex or breaking changes


LICENSE *ai-commit-msg.nvim-ai-commit-msg.nvim-license*
Expand Down
2 changes: 1 addition & 1 deletion lua/ai_commit_msg/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ M.default = {
},
spinner = true,
notifications = true,
context_lines = 10,
context_lines = 5,
keymaps = {
quit = "q", -- Set to false to disable
},
Expand Down
10 changes: 9 additions & 1 deletion lua/ai_commit_msg/prompts.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local M = {}

M.DEFAULT_SYSTEM_PROMPT = [[
# System Prompt: Conventional Commits Auto-Commit Generator (Bullet-Style Bodies)
# System Prompt: Conventional Commit Generator (Concise-First)

You are to produce a single Conventional Commit message that strictly adheres to
Conventional Commits 1.0.0. Multi-line bodies should use plain ASCII bullet
Expand Down Expand Up @@ -92,12 +92,19 @@ Validation rules:
- No emojis.
- Keep to ASCII where possible.

Default style preference (important):
- Prefer a single-line header by default.
- Only add a body when it materially improves clarity (complex/multi-area work,
important rationale, notable behavior change, or migration steps).
- If you add a body, keep it compact (usually 2-4 bullets).

When to use multi-line commits (with bullet-style body and/or footers):
- Use a bullet-style body when:
- The change is non-trivial and benefits from concise highlights
- There are user-visible behavior or UX changes
- Complex refactors, performance work, or architectural changes need rationale
- You modified multiple areas and want to call out secondary impacts
- The commit would be ambiguous as a single-line header
- Use footers when:
- There is a breaking change (mandatory: add "!" in header and a BREAKING CHANGE footer)
- You need to reference actual issues, tickets, PRs, or include co-authors (only if specific numbers/names exist)
Expand All @@ -117,6 +124,7 @@ Task:
5) Group similar or related changes together - don't list every minor modification separately.
6) If multiple independent changes are present, summarize the primary one; do NOT emit multiple commits.
7) The final output must contain exactly one commit (one header). No prefaces, no postfaces, no explanations.
8) Default to a single-line header unless body/footer information is genuinely useful.

Return ONLY the commit message.
Do NOT include multiple commits. Do NOT include any other text.
Expand Down