Resolve all unresolved PR review comments and CI failures
/plugin marketplace add settlemint/agent-marketplace/plugin install crew@settlemint[PR number, defaults to current branch PR]git/<worktree_status>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/worktree-context.sh 2>&1
</worktree_status>
<stack_context>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/machete-context.sh 2>&1
</stack_context>
<pr_info>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-info.sh 2>&1
</pr_info>
<unresolved_threads>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-threads.sh 2>&1
</unresolved_threads>
<ci_status>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-checks.sh 2>&1
</ci_status>
<available_scripts>
These scripts are available in ${CLAUDE_PLUGIN_ROOT}/scripts/git/:
gh-pr-info.sh [PR] - Get PR metadatagh-pr-threads.sh [PR] - Get unresolved review threadsgh-pr-checks.sh [PR] - Get CI check statusgh-pr-resolve-thread.sh THREAD_ID "message" - Resolve a thread with comment</available_scripts>
<constraints>git machete traverse in worktrees (breaks checkout)# Only run if machete-managed (check stack_context output)
if git machete is-managed "$(git branch --show-current)" 2>/dev/null; then
git fetch origin
git machete update # Rebase onto parent (safe in worktrees)
fi
</phase>
<phase name="validate">
If no PR found in context above:
AskUserQuestion({
questions: [
{
question: "No PR found. What to do?",
header: "PR",
options: [
{ label: "Create PR first", description: "Create new PR" },
{ label: "Specify PR number", description: "Tell me which PR" },
],
},
],
});
</phase>
<phase name="analyze">
Review the prefilled context above and **create a TodoWrite list** tracking each issue:
Use TodoWrite to track all items:
TodoWrite({
todos: [
// For each comment from <unresolved_threads>:
{ content: "Fix: src/auth.ts:42 - add null check (THREAD_ID=PRRT_abc123)", status: "pending", activeForm: "Fixing null check in auth.ts" },
{ content: "Fix: src/api.ts:15 - rename variable (THREAD_ID=PRRT_def456)", status: "pending", activeForm: "Fixing variable name in api.ts" },
// For each CI failure from <ci_status>:
{ content: "Fix CI: lint errors", status: "pending", activeForm: "Fixing lint errors" },
{ content: "Fix CI: type errors", status: "pending", activeForm: "Fixing type errors" },
// Resolution tasks (add after fixing):
{ content: "Resolve thread PRRT_abc123", status: "pending", activeForm: "Resolving thread" },
{ content: "Resolve thread PRRT_def456", status: "pending", activeForm: "Resolving thread" },
// Final tasks:
{ content: "Commit and push fixes", status: "pending", activeForm: "Committing and pushing" },
{ content: "Update PR", status: "pending", activeForm: "Updating PR" },
]
});
Important: Include the THREAD_ID=... in each comment todo - you'll need it to resolve threads later.
If context is stale, refresh with:
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-threads.sh
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-checks.sh
</phase>
<phase name="confirm">
AskUserQuestion({
questions: [
{
question: `Found ${comments} comments, ${failures} CI failures. Proceed?`,
header: "Fix",
options: [
{ label: "Fix all (Recommended)", description: "Comments + CI" },
{ label: "Comments only", description: "Skip CI" },
{ label: "CI only", description: "Skip comments" },
],
},
],
});
</phase>
<phase name="fix">
**Fix each issue, marking todos as in_progress → completed:**
For each fix todo in your list:
in_progresscompletedYou can fix issues directly or launch parallel agents for complex fixes:
// For complex multi-file fixes, use agents
Task({
subagent_type: "crew:workflow:pr-comment-resolver",
prompt: "Fix: [specific comment details]",
run_in_background: true,
});
Keep the todo list updated - this gives the user visibility into progress.
</phase> <phase name="verify">bun run ci
If fails after 3 iterations → escalate to user. </phase>
<phase name="commit-and-push"> **After fixes are complete, commit and push:**git add -A
git commit -m "fix: address PR review comments"
git push
If push is rejected (rebased branch), use:
git push --force-with-lease
</phase>
<phase name="resolve">
**After push, resolve each thread you fixed (mark each "Resolve thread" todo as you go):**
For each "Resolve thread THREAD_ID" todo in your list:
in_progress${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-resolve-thread.sh "THREAD_ID" "Fixed: brief description"
completedExample:
# Resolving PRRT_abc123
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-resolve-thread.sh "PRRT_abc123" "Fixed: added null check"
# → mark "Resolve thread PRRT_abc123" as completed
# Resolving PRRT_def456
${CLAUDE_PLUGIN_ROOT}/scripts/git/gh-pr-resolve-thread.sh "PRRT_def456" "Fixed: renamed variable"
# → mark "Resolve thread PRRT_def456" as completed
Important: Only resolve threads you actually fixed. Leave unaddressed threads unresolved.
</phase> <phase name="update-pr"> **Update PR title and body to reflect fixes:**Skill({ skill: "crew:git:update-pr" });
</phase>
</process>
<success_criteria>
bun run ci passes locallygh-pr-resolve-thread.shcrew:git:update-prWorktree-safe completion message:
git machete update in other worktrees to sync."/crew:git:traverse to sync child branches."</success_criteria>