From rkit
GitLab MR 전체 라이프사이클을 관리합니다. 생성, 리뷰, 피드백, 검증, 상태 확인, 승인, 머지를 지원합니다. 개발자와 리뷰어 모두 사용할 수 있습니다. Triggers: mr, merge request, MR 생성, MR 리뷰, MR 피드백, MR 머지, 리뷰 확인, 피드백 확인, draft MR, MR 승인, MR 상태
npx claudepluginhub solitasroh/rkit --plugin rkitThis skill uses the workspace's default tool permissions.
MR 전체 라이프사이클을 관리하는 통합 스킬. `glab` CLI + GitLab API 사용.
Creates isolated Git worktrees for feature branches with prioritized directory selection, gitignore safety checks, auto project setup for Node/Python/Rust/Go, and baseline verification.
Executes implementation plans in current session by dispatching fresh subagents per independent task, with two-stage reviews: spec compliance then code quality.
Dispatches parallel agents to independently tackle 2+ tasks like separate test failures or subsystems without shared state or dependencies.
MR 전체 라이프사이클을 관리하는 통합 스킬. glab CLI + GitLab API 사용.
glab CLI 설치 및 인증 (glab auth login)| Argument | 역할 | 사용자 | 예시 |
|---|---|---|---|
create [feature] | Draft MR 생성 + 리뷰어 지정 | 개발자 | /mr create uart-dma |
review [MR-IID] | AI 코드 리뷰 + discussion 생성 | 리뷰어 | /mr review 42 |
feedback [MR-IID] | 리뷰 comment 조회 + 수정 + reply | 개발자 | /mr feedback 42 |
verify [MR-IID] | 수정 확인 + resolve | 리뷰어 | /mr verify 42 |
status [MR-IID] | MR 상태 확인 | 공통 | /mr status |
approve [MR-IID] | 승인 | 리뷰어 | /mr approve 42 |
merge [MR-IID] | Squash merge + 브랜치 삭제 | 공통 | /mr merge 42 |
Draft MR 생성. AI가 description을 자동 생성하고 리뷰어를 지정한다.
feature/* 또는 bugfix/*인지 확인한다.feature/op-{N}-{description} 또는 bugfix/op-{N}-{description}feature/{description} 또는 bugfix/{description}git checkout -b {branch} 실행.git status + git diff --stat으로 변경 범위 확인한다.[OP#N] type: description 형식 적용 (mr-conventions 참조).templates/mr-description.template.md를 로드한다.
AI가 자동 채움:
| 필드 | 소스 | 자동화 수준 |
|---|---|---|
| Summary | PDCA Plan Executive Summary / diff 분석 | AI 생성 |
| Type of Change | 브랜치명에서 추론 | 완전 자동 |
| Related (OP) | 브랜치명 op-{N} 추출 | 완전 자동 |
| Related (PDCA) | Plan 문서 경로 | 완전 자동 |
| PDCA Report | gap-detector 결과 | 완전 자동 |
| Domain Impact | 도메인 감지 → 해당 섹션만 포함 | 완전 자동 |
| Test Evidence | — | 사용자 수동 |
| Breaking Changes | diff 분석 | AI 제안 |
생성된 description을 사용자에게 보여주고 확인/수정 요청한다.
glab api "projects/:id/members"로 프로젝트 멤버를 조회한다.git push -u origin {branch}[OP#N] type: descriptionglab mr create \
--draft \
--title "{title}" \
--description "{description}" \
--reviewer "{reviewer}" \
--target-branch main
glab auth login으로 인증하세요."git pull --rebase 후 재시도하세요."AI 1차 코드 리뷰 + 도메인별 체크리스트 + Conventional Comments discussion 생성.
glab mr view {iid}로 MR 메타데이터를 조회한다.glab mr diff {iid}로 diff를 조회한다.diff를 분석하여:
{x:Bind} 금지, ObservableProperty, async/await, IDisposabletemplates/mr-review-comment.template.md 형식으로 분류.praise: comment 최소 1건.AI 분석 결과를 리뷰어에게 요약 테이블로 제시한다:
| # | Label | Blocking | File:Line | 내용 |
|---|---|---|---|---|
| 1 | issue | Yes | src/uart.c:42 | ISR 내 HAL_Delay 사용 |
| 2 | suggestion | No | src/dma.c:87 | const 선언으로 RAM 절약 |
| 3 | praise | — | src/ring_buffer.c:15 | 깔끔한 구현 |
"AI가 N건의 comment를 생성했습니다. 검토 후 수정/삭제/추가하세요."
리뷰어가 확인/수정한 comment를 GitLab discussion으로 생성한다. 파일:라인 정보가 있는 comment는 line comment로 생성하여 Changes 탭에 표시한다.
배경:
glab api -f는 nested JSON field를 지원하지 않아positionobject가 무시된다. line comment 생성에는curl+ JSON body를 사용한다. (solitasroh/rkit#3)
glab config에서 host, token, project ID를 추출한다:
# glab config 파일 경로 (OS별)
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then
GLAB_CONFIG="$APPDATA/glab-cli/config.yml"
else
GLAB_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/glab-cli/config.yml"
fi
# host, token, protocol 추출
GITLAB_HOST=$(grep -A1 'hosts:' "$GLAB_CONFIG" | tail -1 | sed 's/[: ]//g')
GITLAB_TOKEN=$(grep -A5 "$GITLAB_HOST:" "$GLAB_CONFIG" | grep 'token:' | awk '{print $2}')
API_PROTOCOL=$(grep -A5 "$GITLAB_HOST:" "$GLAB_CONFIG" | grep 'api_protocol:' | awk '{print $2}')
GITLAB_URL="${API_PROTOCOL:-https}://${GITLAB_HOST}"
# project ID 추출
PROJECT_PATH=$(git remote get-url origin | sed -E 's|.*[:/]([^/]+/[^/]+)(\.git)?$|\1|')
PROJECT_ID=$(curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"${GITLAB_URL}/api/v4/projects/$(echo $PROJECT_PATH | sed 's|/|%2F|g')" | jq -r '.id')
인증 추출 실패 시: "glab auth login으로 인증하세요" 안내.
MR versions API에서 position에 필요한 3개 SHA를 추출한다:
VERSIONS=$(curl -s -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
"${GITLAB_URL}/api/v4/projects/${PROJECT_ID}/merge_requests/${MR_IID}/versions")
BASE_SHA=$(echo "$VERSIONS" | jq -r '.[0].base_commit_sha')
HEAD_SHA=$(echo "$VERSIONS" | jq -r '.[0].head_commit_sha')
START_SHA=$(echo "$VERSIONS" | jq -r '.[0].start_commit_sha')
versions API 빈 배열 시: "diff version이 없습니다" 안내, fallback으로 일반 discussion 생성.
glab mr diff ${MR_IID}의 diff hunk header(@@ -a,b +c,d @@)를 파싱하여
각 comment의 new_line이 유효 범위 내에 있는지 검증한다:
is_valid_line(file, new_line):
hunks = parse_diff_hunks(file) # @@ -a,b +c,d @@ 에서 c~c+d-1 범위 추출
for each hunk in hunks:
if hunk.new_start <= new_line <= hunk.new_end:
return true
return false
범위 밖이면: body에 [file:line] prefix를 추가하여 일반 discussion으로 fallback.
파일:라인 정보가 있는 comment → curl + JSON body (line comment):
curl -s -w "\n%{http_code}" -X POST \
"${GITLAB_URL}/api/v4/projects/${PROJECT_ID}/merge_requests/${MR_IID}/discussions" \
-H "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"body": "issue (blocking, safety): ISR 내 HAL_Delay() 사용 금지...",
"position": {
"base_sha": "'$BASE_SHA'",
"start_sha": "'$START_SHA'",
"head_sha": "'$HEAD_SHA'",
"position_type": "text",
"old_path": "src/uart.c",
"new_path": "src/uart.c",
"new_line": 42
}
}'
파일:라인 정보가 없는 comment → 기존 glab api (일반 discussion):
glab api --method POST \
"projects/:id/merge_requests/:iid/discussions" \
--field body="praise: DMA 더블 버퍼링 구현이 교과서적입니다."
1차: curl + JSON body (line comment)
│ 실패 (HTTP != 201)
▼
2차: glab api --field body="[file:line] comment..." (일반 discussion, 위치 명시)
│ 실패
▼
3차: 에러 메시지 출력 + 수동 생성 안내
glab auth login으로 인증하세요."리뷰 comment 조회 + AI 수정 제안 + 커밋 + thread reply.
glab api "projects/:id/merge_requests/:iid/discussions"로 discussion 목록을 조회한다.| # | Label | Blocking | File | 내용 | 상태 |
|---|---|---|---|---|---|
| 1 | issue (blocking) | Yes | src/uart.c:42 | ISR 내 HAL_Delay | 미해결 |
| 2 | todo | Yes | src/main.c:15 | null check 추가 | 미해결 |
| 3 | suggestion (non-blocking) | No | src/dma.c:87 | const 선언 | 미해결 |
blocking discussion부터 순서대로:
[OP#N] fix: {discussion 내용 요약}glab api --method POST \
"projects/:id/merge_requests/:iid/discussions/:discussion_id/notes" \
--field body="Fixed in {commit-hash}. {수정 설명}"
non-blocking discussion은 목록만 표시하고 선택적으로 대응한다.
모든 blocking discussion 처리 후:
git pushReply vs diff 비교 → resolve 대상 식별 → 리뷰어 resolve.
discussion 목록에서 reply가 있는 unresolved discussion을 필터링한다.
각 discussion에 대해:
| # | Label | Comment 요약 | Reply | 수정 상태 | Resolve 권장 |
|---|---|---|---|---|---|
| 1 | issue | ISR HAL_Delay | Fixed abc123 | 수정됨 | 권장 |
| 2 | todo | null check | Fixed def456 | 수정됨 | 권장 |
| 3 | suggestion | const 선언 | 다음 버전 | 스킵 | 리뷰어 판단 |
glab api --method PUT \
"projects/:id/merge_requests/:iid/discussions/:discussion_id" \
--field resolved=true
내 MR 목록 또는 특정 MR 상세 상태.
glab mr list --author=@me로 내 MR 목록을 조회한다.| MR | 제목 | 리뷰어 | 승인 | CI | Unresolved | Draft |
|---|---|---|---|---|---|---|
| !42 | [OP#123] feat: ... | @user | ⏳ | ✅ | 3건 | Yes |
glab mr view {iid}로 상세를 조회한다.glab ci status.사전 확인 후 승인.
사전 확인:
모든 조건 충족:
glab mr approve {iid}조건 미충족:
Squash merge + 브랜치 삭제 + PDCA/OP 연동 제안.
사전 확인:
모든 조건 충족:
glab mr merge {iid} --squash --remove-source-branchPDCA 연동 제안 (PDCA feature 활성화 시):
OP 연동 제안 (OP 태스크 연결 시):
조건 미충족:
/pdca analyze에서 match rate ≥ 90% 달성 시:
/mr create {feature}"/mr merge 완료 시:
# 개발자: MR 생성
/mr create uart-dma
# 리뷰어: AI 코드 리뷰
/mr review 42
# 개발자: 리뷰 피드백 대응
/mr feedback 42
# 리뷰어: 수정 확인 + resolve
/mr verify 42
# MR 상태 확인
/mr status
/mr status 42
# 리뷰어: 승인
/mr approve 42
# 머지
/mr merge 42