Complete the workflow by merging the PR, cleaning up branches, and closing the Linear issue.
Merges pull requests, cleans up branches, and closes Linear issues.
/plugin marketplace add wuyuxiangX/yux-claude-hub/plugin install yux-linear-workflow@yux-claude-hubComplete the workflow by merging the PR, cleaning up branches, and closing the Linear issue.
Usage: /yux-linear-merge [--squash|--rebase|--merge]
Merge strategy from: $ARGUMENTS (optional, default: squash)
Options:
--squash (default): Squash all commits into one--rebase: Rebase and merge--merge: Create merge commit.claude/linear-config.jsonLinear configuration not found. Please run `/yux-linear-start` first to set up team/project.
LINEAR_TEAM for Linear API state updatesVerify PR exists:
gh pr view --json number,state,mergeable
Check CI status:
gh pr checks --json state,conclusion
Check merge eligibility:
Get PR details:
gh pr view --json number,title,state,mergeable,mergeStateStatus,headRefName
Verify all CI checks passed:
gh pr checks --json name,state,conclusion
Check for blocking conditions:
mergeable: false → "Merge conflicts detected"mergeStateStatus: BLOCKED → "Branch protection rules not satisfied"Display merge summary:
=== Ready to Merge ===
PR: #78 - [LIN-456] Implement user authentication
Commits: 5
CI: All checks passed
Merge strategy: squash (default)
This will:
1. Merge PR #78 into main
2. Delete branch feat/LIN-456-user-auth
3. Close Linear issue LIN-456
Proceed with merge? [Y/n]
Merge the PR:
gh pr merge <number> --squash --delete-branch
Or with other strategies:
gh pr merge <number> --rebase --delete-branch
gh pr merge <number> --merge --delete-branch
Verify merge success:
gh pr view <number> --json state,mergedAt,mergeCommit
Switch to main:
git checkout main
Pull latest changes:
git pull origin main
Delete local branch:
git branch -d <branch-name>
Update status to "Done":
mcp__linear__update_issue(
id: "LIN-456",
state: "Done"
)
Add completion comment:
mcp__linear__create_comment(
issueId: "LIN-456",
body: "Task completed!\n\nPR #78 merged to main.\nMerge commit: <sha>"
)
Success output:
╔══════════════════════════════════════════════════════════════╗
║ Task Completed! ║
╠══════════════════════════════════════════════════════════════╣
║ ║
║ Issue ║
║ ────────────────────────────────────────────────────────── ║
║ LIN-456: Implement user authentication ║
║ Status: ✓ Done ║
║ ║
║ Pull Request ║
║ ────────────────────────────────────────────────────────── ║
║ PR #78: Merged to main ║
║ Commit: abc1234 ║
║ Method: Squash merge ║
║ ║
║ Cleanup ║
║ ────────────────────────────────────────────────────────── ║
║ ✓ Remote branch deleted ║
║ ✓ Local branch deleted ║
║ ✓ Switched to main branch ║
║ ║
║ Summary ║
║ ────────────────────────────────────────────────────────── ║
║ Started: 2024-01-15 10:30 ║
║ Completed: 2024-01-15 15:45 ║
║ Duration: 5h 15m ║
║ Commits: 5 (squashed to 1) ║
║ ║
╚══════════════════════════════════════════════════════════════╝
---
📋 Next Steps:
\`\`\`
/yux-linear-backlog
\`\`\`
View backlog and start the next task
Cannot merge: CI checks not passed
Failed checks:
├── ✗ test - 3 tests failed
└── ✗ e2e - Timeout error
Fix the issues and push again, or use /yux-linear-status to check details.
Cannot merge: Merge conflicts detected
Conflicting files:
- src/auth/login.ts
- src/components/LoginForm.tsx
To resolve:
1. git pull origin main
2. Resolve conflicts
3. git add . && git commit
4. git push
5. Run /yux-linear-merge again
Cannot merge: Required reviews not approved
Review status:
- @reviewer1: Pending
- @reviewer2: Pending
Required: 2 approvals
Current: 0 approvals
Please wait for reviews or request reviews from your team.
Cannot merge: Branch protection rules not satisfied
Missing requirements:
- Status checks must pass
- Required reviewers must approve
Contact repository admin if you believe this is an error.
Chinese completion message:
╔══════════════════════════════════════════════════════════════╗
║ 任务完成! ║
╠══════════════════════════════════════════════════════════════╣
║ ║
║ Issue: LIN-456 - 实现用户认证 ║
║ 状态: ✓ 已完成 ║
║ ║
║ PR #78 已合并到 main 分支 ║
║ 分支已清理完毕 ║
║ ║
║ 用时: 5小时15分钟 ║
║ ║
╚══════════════════════════════════════════════════════════════╝
---
📋 下一步 / Next Steps:
\`\`\`
/yux-linear-backlog
\`\`\`
查看待办列表,开始下一个任务
User: /yux-linear-merge
Claude: Checking merge readiness...
PR #78: [LIN-456] Implement user authentication
CI Status: All 5 checks passed
Reviews: 2/2 approved
Conflicts: None
=== Ready to Merge ===
This will:
1. Squash merge PR #78 into main
2. Delete branch feat/LIN-456-user-auth
3. Mark LIN-456 as Done
Proceed? [Y/n]
User: Y
Claude: Merging...
✓ PR #78 merged to main
✓ Remote branch deleted
✓ Local branch deleted
✓ Linear LIN-456 marked as Done
=== Task Completed! ===
LIN-456: Implement user authentication
Status: Done
Duration: 5h 15m
---
📋 Next Steps:
\`\`\`
/yux-linear-backlog
\`\`\`
View backlog and start the next task