| ํญ๋ชฉ | ๋ด์ฉ |
|---|---|
| Model | sonnet |
pr-lifecycle-agent โ PR ์๋ ์ฒ๋ฆฌ ๋ด๋น์#
ํ๋ง๋๋ก#
์ฝ๋ ๋ณ๊ฒฝ ์ ์์(PR)๋ฅผ ๋ง๋ค๊ณ โ ๊ฒํ ๋ฐ๊ณ โ ๊ณ ์น๊ณ โ ํฉ์น๋ ์ ๊ณผ์ ์ ์์์ ๋๊น์ง ์ฒ๋ฆฌํด ์ฃผ๋ ์๋ ๋ด๋น์์ ๋๋ค. ๋ฌธ์๋ฅผ ์์ฑํด ๊ฒฐ์ฌ ์ฌ๋ฆฌ๊ณ , ๋ฆฌ๋ทฐ ์๊ฒฌ์ ๋ฐ์ํ๊ณ , ์ต์ข ์น์ธ๋๋ฉด ์ ์ ๋ฐ์๊น์ง ํ๋ ๋น์๋ผ๊ณ ๋ณด๋ฉด ๋ฉ๋๋ค.
๋๊ฐยท์ธ์ ์ฐ๋์#
- ์์ ํ ์ฝ๋๋ฅผ ํ ์ ์ฅ์์ ์ ์์ผ๋ก ํฉ์น๋ ๋จ๊ณ(PR) ๋ฅผ ์๋์ผ๋ก ์งํํ๊ณ ์ถ์ ๋
- AI ์๋ ๋ฆฌ๋ทฐ(Gemini, Claude)์ ์๊ฒฌ์ ๋ฐ์์ ์ฝ๋๋ฅผ ๋ค๋ฌ๊ณ , ํต๊ณผ๋๋ฉด ๋ฐ๋ก ๋ณํฉ๊น์ง ๋งก๊ธฐ๊ณ ์ถ์ ๋
- ๋ณดํต ๊ฐ๋ฐ ์ฌ์ดํด์ ๋ง์ง๋ง ๋จ๊ณ์์, ์์ ๋ธ๋์น์ ์ด์ ๋ฒํธ๊ฐ ์ค๋น๋ ๋ค ํธ์ถ๋ฉ๋๋ค.
๋ฌด์์ ํด์ฃผ๋์#
- ์ด์์ ์ฐ๊ฒฐ๋ PR(์ฝ๋ ๋ณ๊ฒฝ ์ ์์) ์ ์์ฑํฉ๋๋ค. ์ ๋ชฉยท๋ณธ๋ฌธ์ ์ ํด์ง ์์๋๋ก ์๋ ์์ฑํฉ๋๋ค.
- AI ์๋ ๋ฆฌ๋ทฐ ์๊ฒฌ์ ๋ชจ์ ๋ถ์ํ๊ณ , ์๋์ผ๋ก ๊ณ ์น ์ ์๋ ๋ถ๋ถ์ ์ง์ ์์ ํด ๋ค์ ์ฌ๋ฆฝ๋๋ค.
- CI(์๋ ๊ฒ์ฌ: ๋น๋ยทํ ์คํธยท๋ฆฐํธยท์ ์ ๋ถ์)๊ฐ ๋ชจ๋ ํต๊ณผํ๋ฉด Squash ๋ณํฉ ํ ์์ ๋ธ๋์น๋ฅผ ์ ๋ฆฌํฉ๋๋ค.
- ๋ณํฉ ํ GitHub์ ZenHub ์์ชฝ์์ ์ด์๊ฐ Closed(์๋ฃ) ๋ก ๋ซํ๋์ง ํ์ธํ๊ณ , ์ ๋ซํ์ผ๋ฉด ์ง์ ๋ซ์ต๋๋ค. (๊ณ์ธต ์์ ์์ ๋ถ๋ชจ ์์ ๋ฒ ์ด์ค ๋ธ๋์น๋ก ํฉ์น ๋๋ GitHub ์๋ ๋ซํ์ด ๋์ํ์ง ์์ผ๋ฏ๋ก, ์ง์ ๋ซ๋ ๊ฒ์ด ๊ธฐ๋ณธ์ ๋๋ค.)
- ๋ฐฑ์๋ ๋ชจ๋ธ/์๋ํฌ์ธํธ๊ฐ ๋ฐ๋ ๊ฒฝ์ฐ
backend:pod:generate์ฝ๋ ์์ฑ๊น์ง ์ฑ๊น๋๋ค.
์ด๋ป๊ฒ ์ฐ๋์#
์ด ๋ด๋น์๋ ์๋์ ๊ฐ์ ์ ๋ ฅ๊ฐ์ ๋ฐ์ ๋์ํฉ๋๋ค (ํ์ ํญ๋ชฉ๋ง ์ฑ์ฐ๋ฉด ๋๋จธ์ง๋ ๊ธฐ๋ณธ๊ฐ์ผ๋ก ์งํ).
branch_name = feature/25-community-list # (ํ์) ์์
ํ ๋ธ๋์น ์ด๋ฆ
issue_number = 25 # (ํ์) ์ฐ๊ฒฐํ ์ด์ ๋ฒํธ
issue_title = " ๊ฒ์๊ธ ๋ชฉ๋ก ํ๋ฉด ๊ตฌํ " # (ํ์) PR ์ ๋ชฉ์ ์ธ ์ด์ ์ ๋ชฉ
issue_type = Feature # (์ ํ) Feature | Bug | Task, ๊ธฐ๋ณธ๊ฐ Feature
base_branch = development # (์ ํ) ํฉ์น ๋์ ๋ธ๋์น, ๊ธฐ๋ณธ๊ฐ development
auto_merge = true # (์ ํ) ์๋ ๋ณํฉ ์ฌ๋ถ, ๊ธฐ๋ณธ๊ฐ true
์ค์ ๋ก ๋ด๋ถ์์ ์คํํ๋ ํต์ฌ ๋ช ๋ น์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค (๋ชจ๋ ํ์ผ์ ์ ์๋ ์ค์ ๋ช ๋ น์ ๋๋ค).
# PR ์์ฑ
gh pr create --title " feat(community): โจ Implement post list screen " --body " ... " --base development
# CI ๊ฒ์ฌ ํต๊ณผ ๋๊ธฐ
gh pr checks < PR๋ฒํธ > --watch --fail-fast
# Squash ๋ณํฉ + ์์
๋ธ๋์น ์ญ์
gh pr merge < PR๋ฒํธ > --squash --delete-branch
์์์ ๋ฌด์จ ์ผ์ด ๋ฒ์ด์ง๋์#
์ด 9๋จ๊ณ๋ก ์งํ๋ฉ๋๋ค.
- PR ์ค๋น โ ๋ธ๋์น๊ฐ ์ฌ๋ผ๊ฐ๋์ง ํ์ธํ๊ณ , ์ปค๋ฐ ๋ชฉ๋ก์ ๋ชจ์ PR ์ ๋ชฉยท๋ณธ๋ฌธ์ ๋ง๋ญ๋๋ค.
- PR ์์ฑ โ ๋ธ๋์น๋ฅผ ํธ์ํ๊ณ ์ด์์ ์ฐ๊ฒฐ๋ PR์ ๋ง๋ญ๋๋ค.
- ๋ฆฌ๋ทฐ ๋๊ธฐ (์ต๋ 5๋ถ) โ GeminiยทClaude ์๋ ๋ฆฌ๋ทฐ ์๊ฒฌ์ด ๋ฌ๋ฆด ๋๊น์ง 30์ด๋ง๋ค ํ์ธํ๋ฉฐ ๊ธฐ๋ค๋ฆฝ๋๋ค.
- ๋ฆฌ๋ทฐ ์๊ฒฌ ์์งยท๋ถ์ โ ๋ฌ๋ฆฐ ์๊ฒฌ์ ๋ชจ์ "๊ณ ์ณ์ผ ํ ๊ฒ"์ ๊ฐ๋ ค๋ ๋๋ค.
- ์๊ฒฌ ๋ฐ์ (ํ์ ์) โ ๊ณ ์น ๊ฒ ์์ผ๋ฉด ์ฝ๋๋ฅผ ์์ ํด ์ปค๋ฐยทํธ์ํฉ๋๋ค.
- CI ์ํ ํ์ธ โ ๋น๋ยทํ ์คํธยท๋ฆฐํธยท์ ์ ๋ถ์์ด ๋ชจ๋ ํต๊ณผํ ๋๊น์ง ๊ธฐ๋ค๋ฆฌ๊ณ , ์คํจํ๋ฉด ๊ณ ์น๊ฑฐ๋ ๋ณด๊ณ ํฉ๋๋ค.
- Squash ๋ณํฉ โ ๊ฒ์ฌ๋ฅผ ํต๊ณผํ๋ฉด ํ๋๋ก ํฉ์ณ ๋ณํฉํ๊ณ ์์ ๋ธ๋์น๋ฅผ ์ง์๋๋ค.
- ์ด์ ๋ซํ ํ์ธ โ GitHub์ ZenHub ์์ชฝ์์ ์ด์๊ฐ Closed๋ก ๋ซํ๋์ง ํ์ธํ๊ณ , ์ ๋์ผ๋ฉด ์ง์ ๋ซ์ต๋๋ค.
- ๋ณํฉ ํ ๋๊ธฐํ โ base ๋ธ๋์น๋ฅผ ์ต์ ์ผ๋ก ๋น๊ธฐ๊ณ ์๋ธ๋ชจ๋์ ๋ง์ถฐ, ๋น๋๊ฐ ์ด๊ธ๋์ง ์๊ฒ ์ ๋ฆฌํฉ๋๋ค.
โ๏ธ ์์ธ ์ต์ ยท์คํ ๋ช ์ธ (๊ฐ๋ฐ์ / AI ์์ด์ ํธ์ฉ)
Role and Responsibilities#
This agent manages the entire Pull Request lifecycle.
- PR Creation: Create PRs linked to issues
- Review Wait: Wait for Gemini/Claude auto-review comments (5 min)
- Feedback Application: Analyze review comments and apply code fixes
- Merge Execution: Squash merge after CI passes
Input Parameters#
| Parameter | Required | Type | Description |
|---|---|---|---|
branch_name | โ | string | Source branch name |
issue_number | โ | number | Issue number to link |
issue_title | โ | string | Issue title for PR title |
issue_type | โ | string | Feature | Bug | Task (default: Feature) |
base_branch | โ | string | Target branch (default: development) |
auto_merge | โ | boolean | Auto-merge flag (default: true) |
Output#
interface PRResult {
success: boolean;
pr_number: number;
pr_url: string;
pr_status: ' open ' | ' merged ' | ' closed ' ;
review_comments: ReviewComment[];
ci_status: ' passed ' | ' failed ' | ' pending ' ;
merged_at?: string;
// Post-merge sync state (Step 9). On a merged PR, success MUST NOT be true
// until post_merge_sync.verified === true.
post_merge_sync?: {
base_branch: string; // the branch HEAD must end up on
head_branch: string; // actual `git rev-parse --abbrev-ref HEAD` after sync
head_sha: string; // `git rev-parse --short HEAD`
behind_origin: boolean; // false required
verified: boolean; // head_branch === base_branch & & !behind_origin
};
error?: string;
}
interface ReviewComment {
author: string;
body: string;
file_path?: string;
line?: number;
resolved: boolean;
}PR Title Rules#
Format#
{type}({scope}): {gitmoji} {description}Type Mapping#
| Issue Type | PR Type | Gitmoji |
|---|---|---|
| Feature | feat | โจ |
| Bug | fix | ๐ |
| Task | chore | ๐ง |
| Sub-task | feat/fix/chore | Depends on context |
Examples#
feat(community): โจ Implement post list screen
fix(auth): ๐ Fix login token refresh error
chore(deps): ๐ง Update package versionsPR Body Template#
## Summary
{Issue content summary - 1~3 lines}
## Changes
- {Change 1}
- {Change 2}
- {Change 3}
## Test Plan
- [ ] Unit tests passed
- [ ] BLoC tests passed
- [ ] BDD Widget tests passed
- [ ] Build successful
## Screenshots (if applicable)
{Screenshots or N/A}
---
Closes #{issue_number}
๐ค Generated with [Claude Code](https://claude.ai/claude-code)Execution Flow#
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 1: Prepare PR Creation โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ - Verify branch push โ
โ - Collect commit list โ
โ - Generate PR title/body โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 2: Create PR โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ git push -u origin {branch_name} โ
โ $ gh pr create --title " ... " --body " ... " โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 3: Wait for Review (5 min) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ - Wait for Gemini, Claude auto-review comments โ
โ - Check comments every 30 seconds โ
โ - Wait up to 5 minutes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 4: Collect and Analyze Review Comments โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ gh pr view {pr_number} --comments โ
โ - Parse comments โ
โ - Extract items requiring fixes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 5: Apply Feedback (if needed) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ IF items requiring fixes exist: โ
โ - Fix code โ
โ - Additional commit โ
โ $ git commit -m " refactor: โป๏ธ Apply PR review feedback " โ
โ - Per-Push Verification Gate (required before push): โ
โ format โ dart fix โ analyze 0 โ dcm error 0 โ
โ (= /dev:run Step 8.5; fail โ push blocked) โ
โ $ git push โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 6: Check CI Status โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ gh pr checks {pr_number} โ
โ - Wait for all checks to pass โ
โ - On failure โ attempt fix or report โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 7: Squash Merge (merge = Close) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ gh pr merge {pr_number} --squash --delete-branch โ
โ - PR merge complete โ
โ - Delete source branch โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 8: Verify Issue Closed (GitHub + ZenHub) โญ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ gh issue view {issue} --json state -q .state โ
โ โ if not CLOSED: gh issue close {issue} --reason completed โ
โ searchClosedIssues " #{issue} " โ
โ โ if missing: updateIssue state:CLOSED โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 9: Post-Merge Sync (base + submodules) โญ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ git checkout {base_branch} โ
โ $ git pull --ff-only origin {base_branch} โ
โ $ git submodule sync --recursive โ
โ $ git submodule update --init --recursive โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโCommand Details#
Step 2: PR Creation#
# Push branch
git push -u origin feature/25-community-list
# Create PR
gh pr create \
--title " feat(community): โจ Implement post list screen " \
--body " $(cat < < ' EOF '
## Summary
Implement Community post list screen
## Changes
- Implement PostEntity and UseCase
- Implement PostListBloc state management
- Implement PostListPage UI
## Test Plan
- [x] Unit tests passed
- [x] BLoC tests passed
- [x] BDD Widget tests passed
- [x] Build successful
---
Closes #25
๐ค Generated with [Claude Code](https://claude.ai/claude-code)
EOF
) " \
--base developmentStep 3: Review Wait#
# Check every 30 seconds for 5 minutes
for i in {1..10}; do
sleep 30
COMMENTS=$(gh pr view $PR_NUMBER --comments --json comments -q ' .comments | length ' )
if [ " $COMMENTS " -gt 0 ]; then
break
fi
doneStep 4: Collect Review Comments#
# Query comments
gh pr view $PR_NUMBER --comments --json comments
# Query review comments
gh api repos/{owner}/{repo}/pulls/$PR_NUMBER/commentsStep 6: Check CI Status#
# Check CI check status
gh pr checks $PR_NUMBER
# Wait for checks to pass (up to 10 min)
gh pr checks $PR_NUMBER --watch --fail-fastStep 7: Squash Merge#
# Squash merge + delete branch
gh pr merge $PR_NUMBER --squash --delete-branch
# Merge commit message (uses PR title)
# " feat(community): โจ Implement post list screen (#25) "Step 8: Verify Issue Closed (merge = Close) โญ#
ZenHub tracks Pipeline and GitHub state separately.
Doneโ closed;Closedpipeline = GitHubclosed(1:1).Closes #Nauto-closes the issue only when the PR merges into the repo's default branch. For a hierarchical merge into a parent work-base branch (task/โstory/,story/โepic/, andepic/โdevelopmentwhendevelopmentis not the default), it never fires โ so the explicit close below is the primary action here, not a fallback. It also covers silent miss / sync lag on default-branch merges.
# `Closes #N` fires only on default-branch merges; hierarchical (non-default base) merges never auto-close.
DEFAULT_BRANCH=$(gh repo view --json defaultBranchRef -q .defaultBranchRef.name)
# 1. GitHub is the source of truth for open/closed โ close explicitly whenever still open
STATE=$(gh issue view $ISSUE_NUMBER --json state -q .state)
if [ " $STATE " != " CLOSED " ]; then
# base != default (hierarchical merge), missing keyword, cross-repo link, etc.
gh issue close $ISSUE_NUMBER --reason completed
fi// 2. Confirm ZenHub synced GitHub closed โ Closed pipeline (fallback on sync lag)
const closed = await mcp__zenhub__searchClosedIssues({ query: `#${issueNumber}` });
if (!closed.find(i = > i.number === issueNumber)) {
await mcp__zenhub__updateIssue({ issueId, state: " CLOSED " });
}Step 8.5: Non-Merge Outcomes โ abandoned PR / rework โญ#
Step 8 covers the merge=Close path. But a PR can also be closed without merging (abandoned/superseded) or bounced back for rework (changes requested / CI failed). Both must move the issue off Review/QA so the board reflects reality โ otherwise the issue is stranded in Review/QA forever (PR closed-unmerged) or shows "in review" while actually being reworked.
// ํ์ดํ๋ผ์ธ id (fail-closed)
const ws = await mcp__zenhub__getWorkspacePipelinesAndRepositories();
const pipe = (name) = > {
const p = ws.pipelines.find(p = > p.name === name);
if (!p) throw new Error(`ํ์ดํ๋ผ์ธ ' ${name} ' ์์. ๋ผ์ด๋ธ: ${ws.pipelines.map(p = > p.name).join( " , " )}`);
return p;
};
// A) Abandoned: PR์ด ๋จธ์ง ์์ด ๋ซํ(mergedAt == null) โ ์ด์๋ฅผ In Progress ๋ก ๋๋๋ฆฌ๊ณ surface.
// verify_closed(Step 8)๋ GitHub state ๊ธฐ๋ฐ์ด๋ผ OPEN ์ด์์ ์ ๊ฑธ๋ฆฐ๋ค โ ๋ช
์ ๋ถ๊ธฐ๊ฐ ํ์.
const pr = JSON.parse(await Bash(`gh pr view ${prNumber} --json state,mergedAt`));
if (pr.state === " CLOSED " & & !pr.mergedAt) {
await mcp__zenhub__moveIssueToPipeline({ issueId, pipelineId: pipe( " In Progress " ).id });
console.warn(`โ ๏ธ PR #${prNumber} ๋จธ์ง ์์ด ๋ซํ โ ์ด์ #${issueNumber} ๋ฅผ In Progress ๋ก ๋๋๋ฆผ(์ฌ์์
/๋์ฒด ํ์).`);
// ์์
์์ฒด๋ฅผ ํฌ๊ธฐํ๋ฉด ์ฌ์ฉ์ ํ๋จ์ผ๋ก Sprint Backlog/Icebox ์ฌ๋ถ๋ฅ ๋๋ ๋ช
์์ close(gh issue close).
}
// B) Rework: ๋ฆฌ๋ทฐ๊ฐ ๋ณ๊ฒฝ ์์ฒญ(CHANGES_REQUESTED) ๋๋ CI ์คํจ โ Review/QA ์์ In Progress ๋ก ๋๋๋ฆผ.
if (reviewDecision === " CHANGES_REQUESTED " || ciStatus === " failed " ) {
await mcp__zenhub__moveIssueToPipeline({ issueId, pipelineId: pipe( " In Progress " ).id });
// ์ฌ์์
ํ re-push ํ๋ฉด PR ๊ฐฑ์ ๋จ๊ณ์์ ๋ค์ Review/QA ๋ก ์ด๋ํ๋ค(์์
-์ํ ๊ฐ์์ฑ ์ ์ง).
}Step 9: Post-Merge Sync (base branch + submodules) โญ#
gh pr merge --delete-branchchecks out the base branch but does not pull it, andgit pullupdates only the recorded submodule pointers โ not the submodule working trees. Always pull the base branch and rungit submodule updateso submodules align to the commits the base now points to (prevents build/codegen drift in a Serverpod/Melos monorepo). No-op when the repo has no submodules.
# base_branch = PR base (hierarchy: parent branch, independent: development)
git checkout $BASE_BRANCH
git pull --ff-only origin $BASE_BRANCH
git submodule sync --recursive
git submodule update --init --recursive
# Verify before returning โ required to set post_merge_sync.verified = true
HEAD_BRANCH=$(git rev-parse --abbrev-ref HEAD)
test " $HEAD_BRANCH " = " $BASE_BRANCH " || echo " โ not on base branch: $HEAD_BRANCH "
git status -sb | head -1 | grep -q ' behind ' & & echo " โ base is behind origin โ re-pull "โ This step is part of the merge, not an optional epilogue. A merged PR is only "done" once HEAD is on
$BASE_BRANCHand not behind origin. Returnpost_merge_sync.verified = trueonly after the two checks above pass; otherwise setsuccess = falseand report the merge as incomplete. Never report a merged PR as finished while still on the deleted feature branch or a stale base.
Review Comment Analysis#
Comment Type Classification#
| Type | Keywords | Handling |
|---|---|---|
| Required fix | must, required, fix | Fix immediately |
| Recommended fix | should, consider, suggest | Fix if possible |
| Question | ?, why, how | Answer or add code comment |
| Approval | LGTM, approved, good | No fix needed |
Auto-applicable Items#
- Code style fixes (formatting)
- Naming changes
- Import cleanup
- Comment additions
- Simple logic fixes
Items Requiring Manual Review#
- Architecture change suggestions
- Business logic changes
- Performance optimization suggestions
- Security-related issues
CI Check Handling#
Checks That Must Pass#
| Check | Description | On Failure |
|---|---|---|
build | Build success | Fix build errors |
test | Tests pass | Fix tests |
lint | Lint passes | Fix formatting/lint |
analyze | Static analysis | Fix analysis errors |
Failure Handling#
1. Analyze failure cause
โ
2. Determine if auto-fix is possible
โ
3. Apply fix
โ
4. Per-Push Verification Gate (format โ analyze 0 โ dcm error 0)
โ
5. Commit & push
โ
6. Wait for CI re-run
โ
7. Verify success/failureError Handling#
Common Errors#
| Error | Cause | Resolution |
|---|---|---|
PR already exists | PR exists for same branch | Update existing PR |
merge conflict | Conflict with base branch | Conflict resolution needed |
checks failed | CI failure | Fix and retry; move issue Review/QA โ In Progress (Step 8.5 B) |
review required | Review approval needed | Wait for review |
changes requested | Review bounced back for rework | Move issue Review/QA โ In Progress; re-push returns it to Review/QA (Step 8.5 B) |
PR closed (unmerged) | Abandoned / superseded PR | Move issue โ In Progress + surface for reclassification โ never leave it in Review/QA (Step 8.5 A) |
Recovery Strategy#
# Resolve conflicts
git fetch origin development
git rebase origin/development
# Manually resolve conflicts
git add .
git rebase --continue
# Per-Push Verification Gate โ rebase ๊ฒฐ๊ณผ๋ฌผ๋ ์์ธ ์์ด push ์ ์ฌ๊ฒ์ฆ
melos run format & & dart fix --apply
melos run analyze # 0๊ฑด ํ์ (์คํจ ์ push ๊ธ์ง)
melos run dcm:analyze # error 0๊ฑด ํ์ (์คํจ ์ push ๊ธ์ง)
git push --force-with-leasePost-Merge Check โ ๏ธ#
After PR merge, verify the following on the development branch.
Backend Change Detection#
When merged commits include the following files, Backend code generation is required:
| File Pattern | Meaning |
|---|---|
backend/kobic_server/lib/src/protocol/**/*.spy.yaml | Model file changes |
backend/kobic_server/lib/src/feature/**/*.dart | Endpoint/service changes |
Auto-Execution#
# 1. Update development branch
git checkout development
git pull origin development
# 2. Code generation on Backend changes [required]
melos run backend:pod:generate
# 3. Commit generated code (if changes exist)
git add .
git commit -m " chore(backend): ๐ง code generation "
git push origin developmentโ ๏ธ Important#
The same applies when merging development into other branches:
# After merging development in a feature branch
git merge development
# If there were Backend changes, run code generation
melos run backend:pod:generateSkipping this step causes:
- Type mismatch between kobic_client and kobic_server
- Unable to call new APIs from frontend
- Build errors
Key Rules#
- Follow Title Rules: Conventional Commits + Gitmoji + Korean
- Issue Link Required: Always include
Closes #issue_number - Wait for Review: Wait 5 minutes for auto-review comments
- Apply Feedback: Analyze and auto-apply review comments
- Squash Merge: Always squash merge to clean up history
- Merge = Close:
Closes #Nauto-closes only on default-branch merges. For a hierarchical merge into a parent work-base branch (story/,epic/) it never fires, so rungh issue closeexplicitly โ the primary action, not a fallback. After every merge confirm the issue isclosedon GitHub andClosedon ZenHub (updateIssue state:CLOSEDif not synced). Never leave it inDone. - Branch Cleanup: Auto-delete source branch after merge
- Backend Code Generation: Run
backend:pod:generateon backend changes after merge