issue-branch-agent โ ์ด์์ฉ ์์
๊ฐ์ง ๋ง๋ค๊ธฐ #
ํ๋ง๋๋ก #
์ด์(ํ ์ผ ์นด๋) ํ๋๋ฅผ ๋ฐ์, ๊ทธ ์์
๋ง ๋ฐ๋ก ์งํํ ์ ์ฉ ์์
๊ณต๊ฐ(๋ธ๋์น) ์ ์๋์ผ๋ก ๋ง๋ค์ด ์ฃผ๋ ๋๊ตฌ์
๋๋ค.
๊ณต๋ ๋ฌธ์์์ ๋ฐ๋ก ๊ณ ์น์ง ์๊ณ , "๋ด ์ฌ๋ณธ"์ ๋ ์ ์์
ํ๋ค๊ฐ ๋์ค์ ํฉ์น๋ ๊ฒ๊ณผ ๊ฐ์์.
๋๊ฐยท์ธ์ ์ฐ๋์ #
๊ฐ๋ฐ์(๋๋ ์๋ํ ์์ด์ ํธ)๊ฐ ZenHub/GitHub ์ด์ ํ๋๋ฅผ ๋ณธ๊ฒฉ์ ์ผ๋ก ์์
ํ๊ธฐ ์์ํ ๋
๋ณดํต /dev:issue ์๋ ํ๋ฆ ์์์ ์ฒซ ๋จ๊ณ๋ก ํธ์ถ๋ฉ๋๋ค. ์ด์ ์ ๋ณด๋ฅผ ์กฐํํ ๋ค, ์ฝ๋๋ฅผ ์ง๊ธฐ(implementation) ์ง์ ์ ์ด ๋๊ตฌ๊ฐ ์์
๊ฐ์ง๋ฅผ ๋จผ์ ๋ง๋ค์ด ๋ก๋๋ค.
๋ฌด์์ ํด์ฃผ๋์ #
์ด์ ๋ฒํธ์ ์ ๋ชฉ์ผ๋ก ์ผ๊ด๋ ๊ท์น์ ๋ธ๋์น ์ด๋ฆ ์ ์๋ ์์ฑํฉ๋๋ค.์: feature/25-community-list, bugfix/30-login-error, epic/10-author-management
์์
์ข
๋ฅ์ ๋ฐ๋ผ ์๋จธ๋ฆฌ(prefix)๋ฅผ ๋ถ์ฌ ์ค๋๋ค. ๊ธฐ๋ฅ์ feature/, ๋ฒ๊ทธ๋ bugfix/, ๊ธด๊ธ ์์ ์ hotfix/, ํฐ ๋ฌถ์์
epic/.
ํ๊ธ ์ ๋ชฉ์ ์๋์ผ๋ก ๋ก๋ง์(์๋ฌธ)๋ก ์ฎ๊ฒจ ๊น๋ํ ์ด๋ฆ์ผ๋ก ๋ณํํฉ๋๋ค. ํ๊ธ๋ง ์๋ ์ ๋ชฉ๋ ๋น ์ด๋ฆ์ด ๋์ง ์์ต๋๋ค. (์: [Story] Community ์ํฐํฐ ์ ์
โ feature/28-story-community-entity, ์ปค๋ฎค๋ํฐ ๋ชฉ๋ก โ feature/25-keomyuniti-moklog)
์ ๊ฐ์ง๋ฅผ ๋ง๋ค๊ธฐ ์ ์ ํ๋ ์์
์ด ๋ ์๊ฐ์ง ์๋๋ก ์์ ํ๊ฒ ์์ ๋ณด๊ด(stash)ํ๊ณ , ์ต์ ๊ธฐ์ค ๋ธ๋์น์์ ์ถ๋ฐํฉ๋๋ค.
์ด๋ป๊ฒ ์ฐ๋์ #
# ๊ธฐ๋ณธ: ๊ธฐ๋ฅ ์ด์
/ dev: issue- branch 25 " Community list screen "
# ๊ฒฐ๊ณผ โ feature/ 25 - community- list
# ๋ฒ๊ทธ ์์ : -- type bugfix ๋ก ์ข
๋ฅ ์ง์
/ dev: issue- branch 30 " Fix login error " -- type bugfix
# ๊ฒฐ๊ณผ โ bugfix/ 30 - login- error
# ํ๊ธ ์ ๋ชฉ: ์๋์ผ๋ก ๋ก๋ง์( ์๋ฌธ) ๋ก ๋ณํ โ ํ๊ธ๋ง ์์ด๋ ๋น ์ด๋ฆ์ด ๋์ง ์์ต๋๋ค
/ dev: issue- branch 28 " [Story] Community ์ํฐํฐ ์ ์ "
# ๊ฒฐ๊ณผ โ feature/ 28 - story- community- entity
/ dev: issue- branch 25 " ์ปค๋ฎค๋ํฐ ๋ชฉ๋ก "
# ๊ฒฐ๊ณผ โ feature/ 25 - keomyuniti- moklog ( ์์ ์ feature / 25 - ๋ก ๊นจ์ก์)
--type ์ผ๋ก ์์
์ข
๋ฅ(feature / bugfix / hotfix)๋ฅผ ์ ํ ์ ์์ต๋๋ค. ์๋ตํ๋ฉด
feature ์
๋๋ค.
--base ๋ก ์ด๋ ๋ธ๋์น์์ ๊ฐ์ง๋ฅผ ์น ์ง ์ ํ ์ ์์ต๋๋ค. ์๋ตํ๋ฉด development ์์ ์ถ๋ฐํฉ๋๋ค.
์์์ ๋ฌด์จ ์ผ์ด ๋ฒ์ด์ง๋์ #
์ง๊ธ ์ํ ํ์ธ โ ์ ์ฅํ์ง ์์ ๋ณ๊ฒฝ์ด ์๋์ง ์ดํด๋ด
๋๋ค.
ํ๋ ์ผ ์์ ๋ณด๊ด โ ๋ณ๊ฒฝ์ด ์์ผ๋ฉด ์์ ํ๊ฒ ๋ฐ๋ก ์ฑ๊ฒจ ๋ก๋๋ค(stash). ์์
์ด ์ฌ๋ผ์ง์ง ์์ต๋๋ค.
๊ธฐ์ค ๋ธ๋์น ์ต์ ํ โ ์ถ๋ฐ์ ์ด ๋ ๋ธ๋์น๋ก ์ฎ๊ฒจ ์ต์ ์ํ๋ก ๋ง์ถฅ๋๋ค. ์์ ์ด์๊ฐ ์์ผ๋ฉด ๊ทธ ๋ถ๋ชจ ๋ธ๋์น์์, ์์ผ๋ฉด development
์์ ์ถ๋ฐํฉ๋๋ค.
์ ์์
๊ฐ์ง ์์ฑยท์ด๋ โ ์ ํด์ง ๊ท์น์ ์ด๋ฆ์ผ๋ก ๋ธ๋์น๋ฅผ ๋ง๋ค๊ณ ๊ทธ ์๋ก ์ฎ๊น๋๋ค. ๊ฐ์ ์ด๋ฆ์ด ์ด๋ฏธ ์์ผ๋ฉด ์๋ก ๋ง๋ค์ง ์๊ณ ๊ทธ ๋ธ๋์น๋ก ์ด๋๋ง ํฉ๋๋ค.
๊ฒฐ๊ณผ ํ์ธ โ ์ง๊ธ ์ฌ๋ฐ๋ฅธ ๋ธ๋์น์ ์๋์ง ์ ๊ฒํ๊ณ , ์ด๋ ๊ธฐ์ค์์ ์ถ๋ฐํ๋์ง ์ ๋ณด๋ฅผ ๋๋ ค์ค๋๋ค.
โ๏ธ ์์ธ ์ต์
ยท์คํ ๋ช
์ธ (๊ฐ๋ฐ์ / AI ์์ด์ ํธ์ฉ) Role and Responsibilities # This agent creates and checks out Git branches based on ZenHub/GitHub issues.
Branch Name Generation : Auto-generate branch name from issue number and titleSafe Checkout : Check current working state before safely switching branchesBase Branch Sync : Sync and branch from the latest development branchParameter Required Type Description issue_numberโ
number GitHub issue number issue_titleโ
string Issue title issue_typeโ string feature | bugfix | hotfix (default: feature)base_branchโ string Base branch (default: development)
Output # interface BranchResult {
success : boolean;
branch_name: string;
base_branch: string;
error?: string;
} Branch Naming Rules # { type} / { issue_number} - { slug} Prefix by Type # Issue Type Branch Type Example Epic epicepic/10-author-managementFeature/Story featurefeature/25-community-listBug bugfixbugfix/30-fix-login-errorHotfix hotfixhotfix/35-critical-security-fixTask featurefeature/28-entity-definitionSub-task featurefeature/29-usecase-implementation
Slug Generation Rules # Romanize non-ASCII (do NOT delete) : Transliterate Korean/CJK/other scripts to ASCII before slugging โ e.g. ์ปค๋ฎค๋ํฐ ๋ชฉ๋ก โ keomyuniti-moklog. Never strip non-ASCII to nothing: a Korean-only title that is deleted yields an empty slug and a degenerate branch like feature/25-.Lowercase : Convert all characters to lowercaseRemove Special Characters : Keep only letters/numbers (Unicode-aware), drop punctuation/symbolsSpaces โ Hyphens : Separate words with hyphensMax Length : 50 character limitNever empty : If the slug ends up empty, fall back to the issue-type word (e.g. feature/25-story) โ never emit a number-only branch (feature/25-).// IMPORTANT: if `title` contains non-ASCII (e.g. Korean), romanize it to ASCII FIRST (Rule 1),
// then pass the romanized string here. createSlug NEVER returns an empty string.
function createSlug ( title: string, issueTypeWord: string = ' work ' ) : string {
const slug = title
. toLowerCase ( )
. replace ( / [ ^ \p{ L } \p{ N } \s- ] / gu, ' ' ) // strip punctuation/symbols; keep Unicode letters/numbers
. replace ( / [ \s_] +/ g, ' - ' ) // spaces/underscores โ hyphens
. replace ( /-+/ g, ' - ' ) // collapse consecutive hyphens
. substring ( 0 , 50 ) // length limit
. replace ( / ^ - | - $/ g, ' ' ) ; // trim leading/trailing hyphens
// Empty-slug guard (LANG-04): a non-romanized Korean-only title must NOT yield ' ' .
return slug || issueTypeWord;
} Execution Flow # โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 1 : Check Current State โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ git status โ
โ - Check for uncommitted changes โ
โ - Determine if stash is needed โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 2 : Handle Changes โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ IF changes exist: โ
โ $ git stash push - m " WIP: before #{issue_number} " โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 3 : Sync Base Branch ( hierarchical branch support) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ git checkout { base_branch} โ
โ $ git pull origin { base_branch} โ
โ โ
โ base_branch determination : โ
โ โโโ -- base option specified โ use that branch โ
โ โโโ Sub - task โ parent Story branch โ
โ โโโ Story โ parent Epic branch โ
โ โโโ Epic โ development โ
โ โโโ Independent issue โ development ( default ) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 4 : Create and Checkout Branch โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ git checkout - b { branch_name} โ
โ - If branch exists โ checkout only โ
โ - Epic issue โ epic/ { number} - { slug} โ
โ - Others โ feature/ { number} - { slug} โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Step 5 : Verify Result โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ $ git branch -- show- current โ
โ - Verify branch creation success โ
โ - Return base_branch info โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Command Details # Step 1: Status Check # # Check current state
git status -- porcelain
# If output is not empty, changes exist Step 2: Stash Handling # # Temporarily save changes
git stash push - m " WIP: before issue #{issue_number} "
# Check stash list
git stash list Step 3: Base Branch Sync (hierarchical branch support) # # Move to base_branch ( default : development, hierarchical: parent branch)
git checkout ${ base_branch}
# Update to latest
git pull origin ${ base_branch} -- rebase Step 4: Branch Creation # # Check if branch exists
git rev- parse -- verify { branch_name} 2 > / dev/ null
# Create if it doesn ' t exist
git checkout -b {branch_name}
# Checkout only if it exists
git checkout {branch_name} Step 5: Result Verification # # Check current branch
git branch -- show- current
# Verify it matches the expected branch Error Handling # Common Errors # Error Cause Resolution uncommitted changesUncommitted changes Stash handling branch already existsSame branch exists Checkout existing branch merge conflictConflict on pull Notify that conflict resolution is needed not a git repositoryNot a git repo Return error
Recovery Strategy # # Recover stash ( after work is done)
git stash pop
# Recover specific item from stash list
git stash apply stash@{ 0 } Usage Examples # Basic Usage # # Feature issue
/ dev: issue- branch 25 " Community list screen "
# Result
branch_name: feature/ 25 - community- list Bug Fix # # Bug issue
/ dev: issue- branch 30 " Fix login error " -- type bugfix
# Result
branch_name: bugfix/ 30 - login- error Korean Title Handling # # Mixed Korean / English title โ Korean romanized, special chars removed
/ dev: issue- branch 28 " [Story] Community ์ํฐํฐ ์ ์ "
# Result
branch_name: feature/ 28 - story- community- entity
# Korean - ONLY title โ romanized to ASCII , NEVER empty ( was the LANG - 04 bug: " feature/25- " )
/ dev: issue- branch 25 " ์ปค๋ฎค๋ํฐ ๋ชฉ๋ก "
# Result
branch_name: feature/ 25 - keomyuniti- moklog Integration Scenario # Called from /dev:issue # 1 . issue- cycle queries issue info
โ
2 . issue- branch- agent called
- issue_number: 25
- issue_title: " Community list screen "
- issue_type: feature
โ
3 . Branch creation complete
- branch_name: feature/ 25 - community- list
โ
4 . Passed to implementation- agentKey Rules # Safety First : Always check current state before startingUse Stash : Preserve changes via stash when they existHierarchical Base : Branch from base_branch parameter (parent branch or development)Consistent Naming : epic/ prefix for Epics, feature/ for othersIdempotency : Safe to call again with the same issueASCII-safe, never empty : Romanize non-ASCII (Korean/CJK) to ASCII rather than deleting it; if the slug would be empty, fall back to the issue-type word (feature/25-story). Never emit a number-only branch (feature/25-).Parent Branch Priority : When a parent issue exists, always branch from the parent branch