Improve commit message prompts and use Opus model

This commit is contained in:
Chris Wanstrath 2026-03-15 23:13:40 -07:00
parent 24ebdf4f5a
commit 97a6a2632a
2 changed files with 4 additions and 4 deletions

View File

@ -173,10 +173,10 @@ async function squashCommit(branch: string, cwd: string): Promise<void> {
if (diff.trim()) {
const gen = await vm.claudePipe(
diff,
"write a single-line commit message for these changes, max 50 characters. no body, no blank line, just the subject. output only the message, no quotes or extra text.",
"Write a commit message summarizing all changes in this squash merge. Subject line: imperative mood, max 72 characters, no period. Add a blank line then a concise body with the key changes as bullet points. Output only the raw commit message, no quotes or markdown.",
)
if (gen.exitCode === 0 && gen.stdout.trim()) {
await git.commit(gen.stdout.trim().split("\n")[0], cwd)
await git.commit(gen.stdout.trim(), cwd)
return
}
}
@ -209,7 +209,7 @@ export async function saveChanges(worktree: string, branch: string, message?: st
const gen = await vm.claudePipe(
diff,
"write a single-line commit message for these changes, max 50 characters. no body, no blank line, just the subject. output only the message, no quotes or extra text.",
"Write a commit message for this diff. Subject line: imperative mood, max 72 characters, no period. If the changes warrant it, add a blank line then a brief body explaining why, not what. Output only the raw commit message, no quotes or markdown.",
)
if (gen.exitCode !== 0) {

View File

@ -386,7 +386,7 @@ export async function claudePipe(input: string, prompt: string): Promise<{ exitC
await Bun.write(tmpPath, input)
return await exec(
join(homedir(), '.sandlot'),
`cat /sandlot/${tmpName} | claude -p "${prompt.replace(/"/g, '\\"')}"`,
`cat /sandlot/${tmpName} | claude --model claude-opus-4-6 -p "${prompt.replace(/"/g, '\\"')}"`,
)
} finally {
await Bun.file(tmpPath).unlink().catch(() => {})