Improve commit message generation to follow 50/72 rule

This commit is contained in:
Chris Wanstrath 2026-02-23 20:06:41 -08:00
parent 05f1126a65
commit c6ef48384e

View File

@ -97,7 +97,7 @@ async function squashCommit(branch: string, cwd: string): Promise<void> {
if (diff.trim()) {
const gen = await vm.claudePipe(
diff,
"write a short commit message summarizing these changes. output only the message, no quotes or extra text",
"write a commit message for these changes following the 50/72 rule: subject line ≤50 chars, blank line, body wrapped at 72 chars. the body should briefly explain what changed and why. output only the message, no quotes or extra text.",
)
if (gen.exitCode === 0 && gen.stdout.trim()) {
await git.commit(gen.stdout.trim(), cwd)
@ -133,7 +133,7 @@ export async function saveChanges(worktree: string, branch: string, message?: st
const gen = await vm.claudePipe(
diff,
"write a short commit message summarizing these changes. output only the message, no quotes or extra text",
"write a commit message for these changes following the 50/72 rule: subject line ≤50 chars, blank line, body wrapped at 72 chars. the body should briefly explain what changed and why. output only the message, no quotes or extra text.",
)
if (gen.exitCode !== 0) {
@ -152,6 +152,6 @@ export async function saveChanges(worktree: string, branch: string, message?: st
return false
}
spin.succeed(`Saved: ${msg}`)
spin.succeed(`Saved: ${msg.split("\n")[0]}`)
return true
}