Skip to content

Commit 5e596da

Browse files
Misc. prompt improvements
1 parent 23d9ba6 commit 5e596da

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

src/watcher.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,21 @@ ${fileDiff}`;
8484
const model = await vscode.lm.selectChatModels({ family: config.aiModel });
8585
if (!model || model.length === 0) return null;
8686

87-
const prompt = `# Base Instructions
87+
const prompt = `# Instructions
8888
89-
* Summarize the following source code diffs into a single concise sentence that describes the essence of the changes that were made, and can be used as a commit message.
90-
* Always start the commit message with a present tense verb such as "Update", "Fix", "Modify", "Add", "Improve", "Organize", "Arrange", etc.
89+
You are a developer working on a project that uses Git for version control. You have made some changes to the codebase and are preparing to commit them to the repository. Your task is to summarize the changes that you have made into a concise commit message that describes the essence of the changes that were made.
90+
91+
* Always start the commit message with a present tense verb such as "Update", "Fix", "Modify", "Add", "Improve", "Organize", "Arrange", "Mark", etc.
9192
* Respond in plain text, with no markdown formatting, and without any extra content. Simply respond with the commit message, and without a trailing period.
92-
* Don't reference the file paths that were changed, but make sure summarize all significant changes.
93-
${config.aiUseEmojis ? "* Prepend an emoji to the message that best expresses the nature of the changes, and is as specific to the subject and action of the changes as possible.\n" : ""}
93+
* Don't reference the file paths that were changed, but make sure summarize all significant changes (using your best judgement).
94+
* When multiple files have been changed, give priority to edited files, followed by added files, and then renamed/deleted files.
95+
* When a change includes adding an emoji to a list item in markdown, then interpret a runner emoji as marking it as in progress, a checkmark emoji as meaning its completed, and a muscle emoji as meaning its a stretch goal.
96+
${config.aiUseEmojis ? "* Prepend an emoji to the message that expresses the nature of the changes, and is as specific/relevant to the subject and/or action of the changes as possible.\n" : ""}
9497
# Code change diffs
9598
9699
${diffs.join("\n\n")}
97100
98-
${config.aiCustomInstructions ? `# User-Provided Instructions (Important!)
101+
${config.aiCustomInstructions ? `# Additional Instructions (Important!)
99102
100103
${config.aiCustomInstructions}
101104
` : ""}
@@ -118,6 +121,10 @@ ${config.aiCustomInstructions}
118121
}
119122

120123
export async function commit(repository: Repository, message?: string) {
124+
// This function shouldn't ever be called when GitDoc
125+
// is disabled, but we're checking it just in case.
126+
if (store.enabled === false) return;
127+
121128
const changes = [
122129
...repository.state.workingTreeChanges,
123130
...repository.state.mergeChanges,
@@ -192,6 +199,7 @@ export async function commit(repository: Repository, message?: string) {
192199
}
193200
}
194201

202+
// TODO: Clear the timeout when GitDoc is disabled.
195203
function debounce(fn: Function, delay: number) {
196204
let timeout: NodeJS.Timeout | null = null;
197205

0 commit comments

Comments
 (0)