You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(commitlint): enhance prompt templates for commit message generation
The commit message generation process has been improved by introducing
new prompt templates that provide clearer guidelines and structure for
creating commit messages. This includes a more detailed system prompt
that outlines the requirements and conventions, as well as user prompts
that specify the expected output format. These changes aim to enhance
the accuracy and consistency of generated commit messages, ensuring
they adhere to the specified commitlint rules and conventions.
content: `${IDENTITY} Your mission is to create a clean and comprehensive commit message that follows both the commitlint rules and maintains the style of the reference message.
237
-
238
-
Here are the specific requirements and conventions that should be strictly followed:
239
-
240
-
Commit Message Conventions:
241
-
- The commit message consists of three parts: Header, Body, and Footer.
content: `${IDENTITY} Your mission is to create clean and comprehensive commit messages in the given @commitlint convention and explain WHAT were the changes ${config.OCO_WHY ? 'and WHY the changes were done' : ''
279
-
}. I'll send you an output of 'git diff --staged' command, and you convert it into a commit message.
280
-
${config.OCO_EMOJI
281
-
? 'Use GitMoji convention to preface the commit.'
282
-
: 'Do not preface the commit with anything.'
283
-
}
284
-
${config.OCO_DESCRIPTION
285
-
? 'Add a short description of WHY the changes are done after the commit message. Don\'t start it with "This commit", just describe the changes.'
286
-
: "Don't add any descriptions to the commit, only commit message."
287
-
}
288
-
Use the present tense. Use ${language} to answer.
289
-
${config.OCO_ONE_LINE_COMMIT
290
-
? 'Craft a concise commit message that encapsulates all changes made, with an emphasis on the primary updates. If the modifications share a common theme or scope, mention it succinctly; otherwise, leave the scope out to maintain focus. The goal is to provide a clear and unified overview of the changes in a one single message, without diverging into a list of commit per file change.'
291
-
: ''
292
-
}
293
-
${config.OCO_OMIT_SCOPE
294
-
? 'Do not include a scope in the commit message format. Use the format: <type>: <subject>'
295
-
: ''
296
-
}
297
-
You will strictly follow the following conventions to generate the content of the commit message:
'Do not preface the commit with anything, except for the conventional commit keywords: fix, feat, build, chore, ci, docs, style, refactor, perf, test.';
? 'Do not include a scope in the commit message format. Use the format: <type>: <subject>'
117
125
: '';
118
126
119
-
/**
120
-
* Get the context of the user input
121
-
* @param extraArgs - The arguments passed to the command line
122
-
* @example
123
-
* $ oco -- This is a context used to generate the commit message
124
-
* @returns - The context of the user input
125
-
*/
126
127
constuserInputCodeContext=(context: string)=>{
127
128
if(context!==''&&context!==' '){
128
129
return`Additional context provided by the user: <context>${context}</context>\nConsider this context when generating the commit message, incorporating relevant information when appropriate.`;
129
130
}
130
131
return'';
131
132
};
132
133
134
+
constIDENTITY='You are to act as an author of a commit message in git.';
`${IDENTITY} Your mission is to create clean and comprehensive commit messages as per the ${commitConvention}${includeWhy ? ' and explain WHAT were the changes and mainly WHY the changes were done' : ''}.`;
138
+
139
+
constgetGeneralGuidelines=(language: string)=>
140
+
`Use the present tense. Lines must not be longer than 74 characters. Use ${language} for the commit message.`;
constmissionStatement=`${IDENTITY} Your mission is to create clean and comprehensive commit messages as per the ${commitConvention} and explain WHAT were the changes and mainly WHY the changes were done.`;
144
-
constdiffInstruction=
145
-
"I'll send you an output of 'git diff --staged' command, and you are to convert it into a commit message.";
0 commit comments