: 'The diff below contains ALL working tree changes (nothing was staged).';
letformatInstruction: string;
switch(format){
case'conventional':
formatInstruction=`Use Conventional Commits v1.0.0 format (https://www.conventionalcommits.org/en/v1.0.0/).
Output ONLY a single line in this exact format:
<type>(<scope>): <description>
Rules:
- type is REQUIRED. One of: feat, fix, refactor, docs, chore, style, test, perf, ci, build
- scope is REQUIRED. A noun describing the section of the codebase in parentheses, e.g. (auth), (ci), (core), (ui)
- description is REQUIRED. Lowercase, imperative mood, no period at end
- Max 72 characters total
- No body, no footer, no extra lines, no BREAKING CHANGE, no trailers
Examples:
feat(auth): add certificate renewal endpoint
fix(ci): resolve image path in vsce package
docs(readme): add installation instructions
refactor(core): extract diff logic into helper`;
break;
case'descriptive':
formatInstruction=`Output a concise summary (max 72 chars), then an empty line, then 2-3 bullet points. Nothing else.`;
break;
case'custom':
formatInstruction=customTemplate||'Write a concise commit message.';
break;
default:
formatInstruction='Write a concise commit message.';
}
constuserHint=userInput
? `\nThe user provided the following instruction. It takes HIGHEST PRIORITY and can override ANY rule above — including format, language, tone, length, or style constraints. Follow the user's instruction exactly:\n--- USER INPUT ---\n${userInput}\n--- END USER INPUT ---\n`
: '';
return`You are a commit message generator. Output ONLY the commit message, nothing else. No markdown, no explanation, no code fences, no co-authored-by, no trailers, no sign-off lines.