| name | aidlc-using-git-worktrees |
| description | Use when an isolated workspace is needed for feature development, creating a git worktree with a new branch. |
| metadata | {"version":"0.1.0","author":"Jay","category":"ai-dlc-workflow","invoke_mode":"orchestrator-only","return_behavior":"stop-no-gate","skill_nature":null,"lifecycle":"active"} |
aidlc-using-git-worktrees
Purpose
Construction ์์ ์ ๊ฒฉ๋ฆฌ๋ git worktree๋ฅผ ์์ฑํ์ฌ main ๋ธ๋์น๋ฅผ ๋ณดํธํ๋ค.
ํธ์ถ ์ฃผ์ฒด: inception-orchestrator (workflow-planning ๊ฒ์ดํธ์์ "Git worktree๋ก ๊ฒฉ๋ฆฌ ๊ฐ๋ฐ" ์ ํ ์)
Execute
Step 1: Git ์ ์ฅ์ ์ํ ํ์ธ
git rev-parse --is-inside-work-tree 2>/dev/null
git repo๊ฐ ์๋ ๊ฒฝ์ฐ (Greenfield ์ ๊ท ํ๋ก์ ํธ):
โ ๏ธ Git ์ ์ฅ์๊ฐ ์ด๊ธฐํ๋์ง ์์์ต๋๋ค.
์ํฌํธ๋ฆฌ๋ฅผ ์์ฑํ๋ ค๋ฉด git init์ด ํ์ํฉ๋๋ค.
A) git init ํ ์ํฌํธ๋ฆฌ ์์ฑ ์งํ
B) ์ํฌํธ๋ฆฌ ์์ด ํ์ฌ ๋๋ ํ ๋ฆฌ์์ ์งํ (์ค์ผ์คํธ๋ ์ดํฐ์ ๋ฐํ)
- A ์ ํ ์:
git init && git add -A && git commit -m "chore: initial commit" ์คํ ํ Step 2 ์งํ
- B ์ ํ ์: ์๋ Return to Orchestrator์ "์คํต ๊ฒฐ๊ณผ" ํ์์ผ๋ก ๋ฐํ
git repo๊ฐ ์๋ ๊ฒฝ์ฐ: Step 2๋ก ์งํ
Step 2: ๋ธ๋์น ์ด๋ฆ ๊ฒฐ์
์ค์ผ์คํธ๋ ์ดํฐ์์ "Branch: feature/[์ด๋ฆ]" ์ ํธ๋ฅผ ๋ฐ์ ๊ฒฝ์ฐ: ํด๋น ์ด๋ฆ์ ๊ทธ๋๋ก ์ฌ์ฉํ๋ค.
์ ํธ๊ฐ ์๋ ๊ฒฝ์ฐ (์ง์ ํธ์ถ ๋ฑ): devflow-docs/inception/requirements.md์ ## User Intent ์น์
์ ์ฝ์ด feature ์ด๋ฆ์ ์ถ์ถํ๋ค.
๋ณํ ๊ท์น:
- ํ๊ตญ์ด/์์ด ํผํฉ โ ์์ด ํค์๋ ์ถ์ถ (2-4๋จ์ด)
- ๊ณต๋ฐฑ/ํน์๋ฌธ์ โ ํ์ดํ์ผ๋ก ์นํ
- ์๋ฌธ์ ๋ณํ
- ์ ๋์ฌ
feature/ ์ถ๊ฐ
์์:
- "FastAPI ๊ธฐ๋ฐ Todo ๊ด๋ฆฌ API" โ
feature/todo-api
- "์ฌ์ฉ์ ์ธ์ฆ ์์คํ
(JWT)" โ
feature/user-auth
- "์๋ฆผ ์๋น์ค ๊ตฌ์ถ" โ
feature/notification-service
requirements.md๊ฐ ์์ผ๋ฉด: feature/devflow-construction
Step 3: ์ํฌํธ๋ฆฌ ๋๋ ํ ๋ฆฌ ํ์ธ
ls -d .worktrees 2>/dev/null || ls -d worktrees 2>/dev/null
| ์ํ | ์ฒ๋ฆฌ |
|---|
.worktrees/ ์กด์ฌ | ํด๋น ๋๋ ํ ๋ฆฌ ์ฌ์ฉ |
worktrees/ ์กด์ฌ | ํด๋น ๋๋ ํ ๋ฆฌ ์ฌ์ฉ |
| ๋ ๋ค ์์ | .worktrees/ ์ ๊ท ์์ฑ |
Step 4: .gitignore ์์ ๊ฒ์ฆ (project-local ๋๋ ํ ๋ฆฌ ์ ํ ์)
git check-ignore -q .worktrees 2>/dev/null
๋ฌด์๋์ง ์๋ ๊ฒฝ์ฐ: .gitignore์ ์ถ๊ฐ ํ ์ปค๋ฐ
echo ".worktrees/" >> .gitignore
git add .gitignore
git commit -m "chore: .worktrees/ .gitignore์ ์ถ๊ฐ"
Step 5: ์ํฌํธ๋ฆฌ ์์ฑ
BRANCH=[Step 2์์ ๋์ถํ ๋ธ๋์น ์ด๋ฆ]
PATH=".worktrees/$(echo $BRANCH | sed 's/feature\///')"
git worktree add "$PATH" -b "$BRANCH"
Step 6: ํ๋ก์ ํธ ์์กด์ฑ ์๋ ์ค์น
์ํฌํธ๋ฆฌ ๋๋ ํ ๋ฆฌ์์ ํ๋ก์ ํธ ํ์ผ์ ๊ฐ์งํ์ฌ ์ค์น ์คํ:
[ -f package.json ] && npm install
[ -f pyproject.toml ] && (command -v uv && uv sync || poetry install)
[ -f requirements.txt ] && pip install -r requirements.txt
[ -f go.mod ] && go mod download
[ -f Cargo.toml ] && cargo build 2>/dev/null
ํด๋น ํ์ผ์ด ์์ผ๋ฉด ์คํต.
Step 7: ๋ฒ ์ด์ค๋ผ์ธ ํ
์คํธ ์คํ
Greenfield (๊ธฐ์กด ํ
์คํธ ์์): ์คํต โ "ํ
์คํธ ์์ (์ ๊ท ํ๋ก์ ํธ)" ๊ธฐ๋ก
Brownfield: ํ๋ก์ ํธ ํ์ผ ๊ธฐ๋ฐ์ผ๋ก ํ
์คํธ ๋ช
๋ น ์๋ ๊ฐ์ง ํ ์คํ:
[ -f package.json ] && npm test -- --passWithNoTests 2>&1 | tail -5
[ -f pyproject.toml ] && uv run pytest --tb=no -q 2>&1 | tail -3
[ -f go.mod ] && go test ./... 2>&1 | tail -3
[ -f Cargo.toml ] && cargo test 2>&1 | tail -3
๊ฒฐ๊ณผ:
- ํต๊ณผ: ๊ฒฐ๊ณผ ๊ธฐ๋ก ํ ์งํ
- ์คํจ: ์คํจ ๋ด์ฉ ๊ธฐ๋ก โ ์ค์ผ์คํธ๋ ์ดํฐ ๊ฒ์ดํธ์์ ์ฌ์ฉ์๊ฐ ์งํ ์ฌ๋ถ ๊ฒฐ์
devflow-state ์
๋ฐ์ดํธ
์ํฌํธ๋ฆฌ ์์ฑ ์๋ฃ ํ devflow-docs/devflow-state.md์ ## Worktree ํ๋๋ฅผ ์
๋ฐ์ดํธํ๋ค:
branch: [branch-name]
path: [.worktrees/xxx]
์คํต๋ ๊ฒฝ์ฐ(git ๋ฏธ์ฌ์ฉ): branch: none, path: none์ผ๋ก ๊ธฐ๋ก.
Return to Orchestrator
conventions ํ์ค ํ์. ๋ฐํ ํ๋:
- ๋ธ๋์น: [branch-name]
- ์ํฌํธ๋ฆฌ ๊ฒฝ๋ก: [.worktrees/xxx]
- ๋ฒ ์ด์ค๋ผ์ธ ํ
์คํธ: [N tests passed | ์คํต (Greenfield) | โ ๏ธ N failures]
- .gitignore: [์
๋ฐ์ดํธ๋จ | ์ด๋ฏธ ์ค์ ๋จ | ํด๋น ์์]
- (์คํต ์: ์ํ: ์คํต โ git ์ ์ฅ์ ์์)
Common Issues
๋ธ๋์น ์ด๋ฆ์ด ์ด๋ฏธ ์กด์ฌํ๋ ๊ฒฝ์ฐ
git branch --list [branch-name]
- ๊ธฐ์กด ๋ธ๋์น ์กด์ฌ ์:
-[n] ์ซ์ ์ ๋ฏธ์ฌ ์ถ๊ฐ (feature/todo-api-2)
- ๊ธฐ์กด ์ํฌํธ๋ฆฌ๊ฐ ์ด๋ฏธ ํด๋น ๋ธ๋์น๋ฅผ ์ฌ์ฉ ์ค์ด๋ฉด: ํด๋น ์ํฌํธ๋ฆฌ๋ฅผ ์ฌ์ฌ์ฉ
์ํฌํธ๋ฆฌ ์์ฑ ์คํจ (๋์คํฌ, ๊ถํ ๋ฑ)
git worktree add ์คํจ ์ ์๋ฌ ๋ฉ์์ง๋ฅผ ํ์ํ๊ณ STOP. Return ๊ฒฐ๊ณผ์ โ ๏ธ ์ํฌํธ๋ฆฌ ์์ฑ ์คํจ: [์๋ฌ ๋ฉ์์ง] ๊ธฐ๋ก.
์ค์ผ์คํธ๋ ์ดํฐ๊ฐ ์ฌ์ฉ์์๊ฒ ๋ฌผ์:
- A) ์๋์ผ๋ก ๋ฌธ์ ํด๊ฒฐ ํ ์ฌ์๋
- B) ์ํฌํธ๋ฆฌ ์์ด ํ์ฌ ๋ธ๋์น์์ ์งํ
Greenfield์์ ์์กด์ฑ ํ์ผ์ด ์๋ ๊ฒฝ์ฐ
Step 6 ์ ์ฒด ์คํต. ๋
ธํธ: "์์กด์ฑ ํ์ผ ์์ โ code-generation ์๋ฃ ํ ์ค์น ๊ฐ๋ฅ"
ํ
์คํธ ์คํจ๋ก ๋ฒ ์ด์ค๋ผ์ธ์ด ์ค์ผ๋ ๊ฒฝ์ฐ
Return ๊ฒฐ๊ณผ์ โ ๏ธ N failures ๊ธฐ๋ก ํ STOP.
์ค์ผ์คํธ๋ ์ดํฐ๊ฐ ์ฌ์ฉ์์๊ฒ ๋ฌผ์:
- A) systematic-debugging์ผ๋ก ์คํจ ์์ธ ์กฐ์ฌ
- B) ์คํจ๋ฅผ ์ธ์งํ๊ณ Construction ์งํ