Skip to content

Commit

Permalink
Build: July 01, 2024, 02:08:52 PM
Browse files Browse the repository at this point in the history
  • Loading branch information
SHSharkar committed Jul 1, 2024
1 parent dbafae2 commit 2533c76
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 30 deletions.
8 changes: 4 additions & 4 deletions out/cli.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -39895,8 +39895,8 @@ var configValidators = {
validateConfig("GW_OPENAI_API_KEY" /* GW_OPENAI_API_KEY */, value.startsWith("sk-"), 'Must start with "sk-"');
validateConfig(
"GW_OPENAI_API_KEY" /* GW_OPENAI_API_KEY */,
config8["GW_OPENAI_BASE_PATH" /* GW_OPENAI_BASE_PATH */] || value.length === 51,
"Must be 51 characters long"
config8["GW_OPENAI_BASE_PATH" /* GW_OPENAI_BASE_PATH */] || value.length >= 51,
"Must be at least 51 characters long"
);
return value;
},
Expand Down Expand Up @@ -40349,10 +40349,10 @@ var configureCommitlintIntegration = async (force = false) => {
// src/prompts.ts
var config5 = getConfig();
var translation3 = i18n[config5?.GW_LANGUAGE || "en"];
var IDENTITY = "Focus solely on crafting a git commit message as the author, without deviating to other tasks.";
var IDENTITY = "Focus only on writing a Git commit message as the author. Do not do any other tasks.";
var INIT_MAIN_PROMPT2 = (language) => ({
role: "system",
content: `${IDENTITY} Check the 'git diff --staged' results and write clear, concise commit messages by first understanding the changes (WHAT, WHY, HOW) from the 'git diff --staged' output. Start your commit summary, capped at 50 characters, with a specific descriptor such as 'Removed', 'Bug Fixed', 'Modified', 'Refactored', 'Added', 'Updated', or 'Optimized', reflecting the overall change. Follow this with a detailed description in ${language}, concisely outlining the code modifications, file adjustments, and precise line numbers impacted, ensuring clarity and comprehensive detail. Use markdown formatting to enhance your commit descriptions. This includes Emphasis, Blockquotes, Lists, Code, Code Blocks, and Links where appropriate. For denoting words, phrases, class names, function names, or file changes as code, enclose them in backticks (\`) to enhance readability. Review the code and 'git diff' output for message accuracy. Differentiate between minor and major changes with detailed reasons, and confirm the message's accuracy and completeness against the code changes before finalizing.
content: `${IDENTITY} Act as an expert in Git and writing professional Git commit messages, tailored for users aiming to elevate their commit message quality. Analyze the 'git diff --staged' output to write clear and concise commit messages by understanding the changes (WHAT, WHY, HOW). Start your commit summary with a clear, categorized tag such as 'Removed:', 'Bug Fixed:', 'Modified:', 'Refactored:', 'Added:', 'Updated:', or 'Optimized:', ensuring it is very short but descriptive and falls within the 50-72 character limit. Follow this with a detailed description in ${language}, outlining code modifications, file adjustments, and specific line numbers impacted. Ensure clarity and comprehensive detail without including full code snippets. Use markdown formatting to enhance commit descriptions, including Emphasis, Blockquotes, Lists, Code, Code Blocks, and Links where appropriate. Enclose words, phrases, class names, function names, or file changes in backticks (\`) to enhance readability. Differentiate between minor and major changes with detailed reasons, and confirm the message's accuracy and completeness before finalizing. Review the code and 'git diff' output for accuracy to facilitate better understanding and collaboration among both AI systems and humans, while adhering to standard Git practices.
${config5?.GW_EMOJI ? "Use the GitMoji convention for your commit message." : "Don't start the commit with any preface."}
${config5?.GW_DESCRIPTION ? 'After your commit message, add a concise explanation for the changes. Describe changes directly, without starting with "This commit" or "That commit".' : "Only include the commit message, no descriptions needed."}
`
Expand Down
8 changes: 4 additions & 4 deletions out/github-action.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -55244,8 +55244,8 @@ var configValidators = {
validateConfig("GW_OPENAI_API_KEY" /* GW_OPENAI_API_KEY */, value.startsWith("sk-"), 'Must start with "sk-"');
validateConfig(
"GW_OPENAI_API_KEY" /* GW_OPENAI_API_KEY */,
config7["GW_OPENAI_BASE_PATH" /* GW_OPENAI_BASE_PATH */] || value.length === 51,
"Must be 51 characters long"
config7["GW_OPENAI_BASE_PATH" /* GW_OPENAI_BASE_PATH */] || value.length >= 51,
"Must be at least 51 characters long"
);
return value;
},
Expand Down Expand Up @@ -55689,10 +55689,10 @@ var configureCommitlintIntegration = async (force = false) => {
// src/prompts.ts
var config5 = getConfig();
var translation3 = i18n[config5?.GW_LANGUAGE || "en"];
var IDENTITY = "Focus solely on crafting a git commit message as the author, without deviating to other tasks.";
var IDENTITY = "Focus only on writing a Git commit message as the author. Do not do any other tasks.";
var INIT_MAIN_PROMPT2 = (language) => ({
role: "system",
content: `${IDENTITY} Check the 'git diff --staged' results and write clear, concise commit messages by first understanding the changes (WHAT, WHY, HOW) from the 'git diff --staged' output. Start your commit summary, capped at 50 characters, with a specific descriptor such as 'Removed', 'Bug Fixed', 'Modified', 'Refactored', 'Added', 'Updated', or 'Optimized', reflecting the overall change. Follow this with a detailed description in ${language}, concisely outlining the code modifications, file adjustments, and precise line numbers impacted, ensuring clarity and comprehensive detail. Use markdown formatting to enhance your commit descriptions. This includes Emphasis, Blockquotes, Lists, Code, Code Blocks, and Links where appropriate. For denoting words, phrases, class names, function names, or file changes as code, enclose them in backticks (\`) to enhance readability. Review the code and 'git diff' output for message accuracy. Differentiate between minor and major changes with detailed reasons, and confirm the message's accuracy and completeness against the code changes before finalizing.
content: `${IDENTITY} Act as an expert in Git and writing professional Git commit messages, tailored for users aiming to elevate their commit message quality. Analyze the 'git diff --staged' output to write clear and concise commit messages by understanding the changes (WHAT, WHY, HOW). Start your commit summary with a clear, categorized tag such as 'Removed:', 'Bug Fixed:', 'Modified:', 'Refactored:', 'Added:', 'Updated:', or 'Optimized:', ensuring it is very short but descriptive and falls within the 50-72 character limit. Follow this with a detailed description in ${language}, outlining code modifications, file adjustments, and specific line numbers impacted. Ensure clarity and comprehensive detail without including full code snippets. Use markdown formatting to enhance commit descriptions, including Emphasis, Blockquotes, Lists, Code, Code Blocks, and Links where appropriate. Enclose words, phrases, class names, function names, or file changes in backticks (\`) to enhance readability. Differentiate between minor and major changes with detailed reasons, and confirm the message's accuracy and completeness before finalizing. Review the code and 'git diff' output for accuracy to facilitate better understanding and collaboration among both AI systems and humans, while adhering to standard Git practices.
${config5?.GW_EMOJI ? "Use the GitMoji convention for your commit message." : "Don't start the commit with any preface."}
${config5?.GW_DESCRIPTION ? 'After your commit message, add a concise explanation for the changes. Describe changes directly, without starting with "This commit" or "That commit".' : "Only include the commit message, no descriptions needed."}
`
Expand Down
22 changes: 17 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions reinstall_npm_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ rm -rf node_modules && echo "node_modules removed" || echo "Failed to remove nod
npm cache clean --force && echo "npm cache cleaned" || echo "Failed to clean npm cache"

npm install --legacy-peer-deps && echo "npm install successful" || echo "npm install failed"

npm update --legacy-peer-deps && echo "npm update successful" || echo "npm update failed"
4 changes: 2 additions & 2 deletions src/commands/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export const configValidators = {
validateConfig(CONFIG_KEYS.GW_OPENAI_API_KEY, value.startsWith('sk-'), 'Must start with "sk-"');
validateConfig(
CONFIG_KEYS.GW_OPENAI_API_KEY,
config[CONFIG_KEYS.GW_OPENAI_BASE_PATH] || value.length === 51,
'Must be 51 characters long',
config[CONFIG_KEYS.GW_OPENAI_BASE_PATH] || value.length >= 51,
'Must be at least 51 characters long',
);

return value;
Expand Down
22 changes: 7 additions & 15 deletions src/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ const config = getConfig();
const translation = i18n[(config?.GW_LANGUAGE as I18nLocals) || 'en'];

export const IDENTITY =
'Focus solely on crafting a git commit message as the author, without deviating to other tasks.';
'Focus only on writing a Git commit message as the author. Do not do any other tasks.';
const INIT_MAIN_PROMPT = (language: string): { role: string; content: string } => ({
role: 'system',
content: `${IDENTITY} Check the 'git diff --staged' results and write clear, concise commit messages by first understanding the changes (WHAT, WHY, HOW) from the 'git diff --staged' output. Start your commit summary, capped at 50 characters, with a specific descriptor such as 'Removed', 'Bug Fixed', 'Modified', 'Refactored', 'Added', 'Updated', or 'Optimized', reflecting the overall change. Follow this with a detailed description in ${language}, concisely outlining the code modifications, file adjustments, and precise line numbers impacted, ensuring clarity and comprehensive detail. Use markdown formatting to enhance your commit descriptions. This includes Emphasis, Blockquotes, Lists, Code, Code Blocks, and Links where appropriate. For denoting words, phrases, class names, function names, or file changes as code, enclose them in backticks (\`) to enhance readability. Review the code and 'git diff' output for message accuracy. Differentiate between minor and major changes with detailed reasons, and confirm the message's accuracy and completeness against the code changes before finalizing.
${
config?.GW_EMOJI
? 'Use the GitMoji convention for your commit message.'
: "Don't start the commit with any preface."
}
${
config?.GW_DESCRIPTION
? 'After your commit message, add a concise explanation for the changes. Describe changes directly, without starting with "This commit" or "That commit".'
: 'Only include the commit message, no descriptions needed.'
}
content: `${IDENTITY} Act as an expert in Git and writing professional Git commit messages, tailored for users aiming to elevate their commit message quality. Analyze the 'git diff --staged' output to write clear and concise commit messages by understanding the changes (WHAT, WHY, HOW). Start your commit summary with a clear, categorized tag such as 'Removed:', 'Bug Fixed:', 'Modified:', 'Refactored:', 'Added:', 'Updated:', or 'Optimized:', ensuring it is very short but descriptive and falls within the 50-72 character limit. Follow this with a detailed description in ${language}, outlining code modifications, file adjustments, and specific line numbers impacted. Ensure clarity and comprehensive detail without including full code snippets. Use markdown formatting to enhance commit descriptions, including Emphasis, Blockquotes, Lists, Code, Code Blocks, and Links where appropriate. Enclose words, phrases, class names, function names, or file changes in backticks (\`) to enhance readability. Differentiate between minor and major changes with detailed reasons, and confirm the message's accuracy and completeness before finalizing. Review the code and 'git diff' output for accuracy to facilitate better understanding and collaboration among both AI systems and humans, while adhering to standard Git practices.
${config?.GW_EMOJI ? 'Use the GitMoji convention for your commit message.' : "Don't start the commit with any preface."}
${config?.GW_DESCRIPTION ? 'After your commit message, add a concise explanation for the changes. Describe changes directly, without starting with "This commit" or "That commit".' : 'Only include the commit message, no descriptions needed.'}
`,
});

Expand Down Expand Up @@ -74,9 +66,9 @@ export const getMainCommitPrompt = async (): Promise<
| OpenAI.Chat.ChatCompletionCreateParamsNonStreaming
| OpenAI.Chat.ChatCompletionCreateParamsStreaming
| {
role: string;
content: string;
}
role: string;
content: string;
}
)[]
> => {
switch (config?.GW_PROMPT_MODULE) {
Expand Down

0 comments on commit 2533c76

Please sign in to comment.