@@ -147,35 +147,30 @@ function M.generate_commit_msg(opts)
147147 end
148148 end
149149
150- local MAX_DIFF_CHARS = 15000 local processed_diff = truncate_diff_simple (diff , MAX_DIFF_CHARS )
151-
152- local prompt = " You are a git commit message generator. Your task is to write a single conventional commit message based on the provided changes.\n\n " ..
153- " RULES:\n " ..
154- " 1. Use conventional commit format: type(scope): description\n " ..
155- " 2. Types: feat, fix, docs, style, refactor, perf, test, chore, build, ci\n " ..
156- " 3. Scope should be ONE WORD component name like 'auth', 'ui', 'config', 'api'\n " ..
157- " 4. Description should be concise and under 50 characters\n " ..
158- " 5. Do NOT use JSON format, markdown, code blocks, or any special formatting\n " ..
159- " 6. Do NOT include explanations or additional text\n " ..
160- " 7. Output ONLY the plain commit message itself\n\n " ..
161- " EXAMPLES OF CORRECT OUTPUT (SINGLE LINE MESSAGES):\n " ..
150+ local MAX_DIFF_CHARS = 15000
151+ local processed_diff = truncate_diff_simple (diff , MAX_DIFF_CHARS )
152+
153+ local prompt = " Task: Generate a conventional commit message based on the provided code changes.\n\n " ..
154+ " Follow the Conventional Commits specification:\n " ..
155+ " Format: <type>[optional scope]: <description>\n\n " ..
156+ " Types: feat, fix, refactor, perf, docs, style, test, build, ci, chore\n " ..
157+ " Rules:\n " ..
158+ " 1. Use lowercase for type and description\n " ..
159+ " 2. Do not capitalize the first letter of description\n " ..
160+ " 3. Do not end description with a period\n " ..
161+ " 4. Use imperative present tense (add, not added)\n " ..
162+ " 5. Keep description under 50 characters\n " ..
163+ " 6. Add scope if relevant: type(scope): description\n " ..
164+ " 7. Output ONLY the commit message, no explanation\n\n " ..
165+ " EXAMPLES:\n " ..
162166 " feat(auth): add login validation\n " ..
163167 " fix(ui): resolve button spacing issue\n " ..
164168 " refactor(config): simplify settings logic\n\n " ..
165- " MULTI-LINE MESSAGES (for complex changes):\n " ..
166- " feat(auth): implement user authentication system\n\n " ..
167- " - Add JWT token validation middleware\n " ..
168- " - Implement password hashing utilities\n " ..
169- " - Create user session management\n " ..
170- " - Add login/logout endpoints\n\n " ..
171- " IMPORTANT: Use EITHER one single-line OR multi-line format, never both. Choose based on complexity.\n " ..
172- " For simple changes: ONE single line only.\n " ..
173- " For complex changes: Multi-line with bullet points.\n\n " ..
174- " CHANGES TO COMMIT:\n " .. processed_diff
169+ " CODE CHANGES:\n " .. processed_diff
175170
176171 vim .system (
177- {' ollama ' , ' run ' , ' qwen3:1.7b ' },
178- {text = true , stdin = prompt },
172+ {' amp ' , ' -x ' , prompt },
173+ {text = true },
179174 function (result )
180175 vim .schedule (function ()
181176
@@ -195,7 +190,6 @@ function M.generate_commit_msg(opts)
195190 end
196191
197192 commit_msg = commit_msg :gsub (' \n $' , ' ' )
198- commit_msg = commit_msg :gsub (' ^Thinking%.%.%..-%.%.%.done thinking%.%s*' , ' ' )
199193
200194 if opts .commit then
201195 local commit_result = vim .system ({' git' , ' commit' , ' -m' , commit_msg }, {
0 commit comments