fix(review): use merge-base for PR review prompts to avoid reviewing unrelated changes (#412)
This commit is contained in:
@@ -219,7 +219,10 @@ func (r *sqliteRepository) builtinCodeReviewPrompt(now time.Time) *models.Prompt
|
||||
STEP 1: Determine what to review
|
||||
- First, check if there are any uncommitted changes (dirty working directory)
|
||||
- If there are uncommitted/staged changes: review those files
|
||||
- If the working directory is clean: review the commits that have diverged from the master/main branch
|
||||
- If the working directory is clean: review ONLY the commits from this branch
|
||||
- Use: git log --oneline $(git merge-base origin/main HEAD)..HEAD to list the branch commits
|
||||
- Use: git diff $(git merge-base origin/main HEAD) to see the cumulative changes
|
||||
- Do NOT diff directly against origin/main or master — that would include unrelated changes if the branch is outdated
|
||||
|
||||
STEP 2: Review the changes, then output your findings in EXACTLY 4 sections: BUG, IMPROVEMENT, NITPICK, PERFORMANCE.
|
||||
|
||||
|
||||
@@ -444,7 +444,7 @@ func (r *Repository) getPRReviewTemplate(now time.Time) *models.WorkflowTemplate
|
||||
Position: 1,
|
||||
Color: "bg-yellow-500",
|
||||
ShowInCommandPanel: true,
|
||||
Prompt: "Please review the changed files in the current git worktree.\n\nSTEP 1: Determine what to review\n- First, check if there are any uncommitted changes (dirty working directory)\n- If there are uncommitted/staged changes: review those files\n- If the working directory is clean: review the commits that have diverged from the master/main branch\n\nSTEP 2: Review the changes, then output your findings in EXACTLY 4 sections: BUG, IMPROVEMENT, NITPICK, PERFORMANCE.\n\nRules:\n- Each section is OPTIONAL — only include it if you have findings for that category\n- If a section has no findings, omit it entirely\n- Format each finding as: filename:line_number - Description\n- Be specific and reference exact line numbers\n- Keep descriptions concise but actionable\n\n{{task_prompt}}",
|
||||
Prompt: "Please review the changed files in the current git worktree.\n\nSTEP 1: Determine what to review\n- First, check if there are any uncommitted changes (dirty working directory)\n- If there are uncommitted/staged changes: review those files\n- If the working directory is clean: review ONLY the commits from this branch\n - Use: git log --oneline $(git merge-base origin/main HEAD)..HEAD to list the branch commits\n - Use: git diff $(git merge-base origin/main HEAD) to see the cumulative changes\n - Do NOT diff directly against origin/main or master — that would include unrelated changes if the branch is outdated\n\nSTEP 2: Review the changes, then output your findings in EXACTLY 4 sections: BUG, IMPROVEMENT, NITPICK, PERFORMANCE.\n\nRules:\n- Each section is OPTIONAL — only include it if you have findings for that category\n- If a section has no findings, omit it entirely\n- Format each finding as: filename:line_number - Description\n- Be specific and reference exact line numbers\n- Keep descriptions concise but actionable\n\n{{task_prompt}}",
|
||||
Events: models.StepEvents{
|
||||
OnEnter: []models.OnEnterAction{
|
||||
{Type: models.OnEnterAutoStartAgent},
|
||||
|
||||
Reference in New Issue
Block a user