feat(vcs): project conventions for Generate Commit Message with Agent (#4014)

Settings › Version Control › Commit gets a Commit Message Generation section with a multi-line field (vcs.commit.agentInstructions, global or per project). Its text is added to the agent's prompt as the conventions to follow, ahead of the style taken from recent commit subjects.

Closes #3934
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-11-17 21:53:38 +08:00
1 джерело 55e778897f
коміт 6ab7627fc4
10 files changed
+106 -4

No files matched your search

+9
Переглянути файл
@@ -112,6 +112,15 @@ describe("commitMessagePrompt", () => {
it("leaves out the style hint without earlier commits", () => {
expect(commitMessagePrompt(PATCH, 72, [])).not.toContain("latest commits");
});
it("adds the project's commit conventions before the recent subjects", () => {
const prompt = commitMessagePrompt(PATCH, 72, ["fix: y"], " Use Conventional Commits.\nPrefix the issue key. ");
const conventions = prompt.indexOf("Follow these conventions for commit messages here:\nUse Conventional Commits.");
expect(conventions).toBeGreaterThan(0);
expect(prompt).toContain("Prefix the issue key.\n");
expect(conventions).toBeLessThan(prompt.indexOf("latest commits"));
expect(commitMessagePrompt(PATCH, 72, [], " \n ")).not.toContain("conventions");
});
});
describe("commitMessageOf", () => {