로비에서 /pr 을 부르면 작업 워크트리를 골라 진입한다 - #60
Open
m-a-king wants to merge 2 commits into
Open
Conversation
워크스페이스 루트(piki/)는 repo 여럿을 자식으로 둔 세션 시작 자리일 뿐 어느 repo 에도 서 있지 않은데, 루트도 git repo 라 /pr 0-A 가드가 이걸 못 걸러낸다. 루트 브랜치(workspace)가 base 후보와 달라 "작업 브랜치" 로 통과해, 아무 repo 도 아닌 곳에서 create 모드까지 간다. 0단계 맨 앞에 로비 판별(0-A-0)을 두고, 로비면 자식 repo 를 가로질러 모은 후보 중에서 작업 워크트리를 고르게 한 뒤 EnterWorktree 로 진입해 0단계를 다시 탄다. 후보 열거는 홈에 설치되는 piki-worktrees.sh 가 맡는다 - git worktree list 는 repo 하나만 보기 때문이다. 관련 #56
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
주석은 코드가 이미 말하는 것을 뺐다. 남긴 다섯 줄은 코드만 봐서는 안 보이는 사실이다 - 세션 레지스트리에 죽은 파일이 남는다는 것, 형제 폴더 워크트리가 자식으로도 잡혀 repo 가 두 번 걸린다는 것, 그때 basename 이 repo 가 아니라는 것, base 를 로컬 ref 로만 근사하는 이유, porcelain 첫 레코드를 건너뛰는 이유. 세션이 열린 후보를 선택지에서 빼고 전부 열렸으면 멈추던 것을 경고 표시로 바꿨다. 동시 편집 위험은 알리되 멈출지 말지는 사용자가 정하는 편이 낫다. free 후보를 앞에 두고, 열린 후보는 라벨에 표시해 뒤에 나열한다. 스크립트는 주석만 바뀌어 동작이 같다 (주석 제외 코드 동일, 실행 출력 동일 확인). 관련 #56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Situation
piki/)는 repo 여럿을 자식으로 둔 세션 시작 자리일 뿐 어느 repo 에도 서 있지 않은데, 루트도 git repo 라/pr이 이걸 소비 repo 와 구분하지 못한다.workspace)가 base 후보와 달라 "작업 브랜치" 로 통과하고, 아무 repo 도 아닌 곳에서 create 모드까지 간다. 지금은 루트에 remote 가 없어 그 앞의git fetch가 먼저 터지는데, 안내가 "네트워크 확인" 이라 진짜 원인을 가린다.Task
/pr을 부르면 어느 repo 의 어느 워크트리에서 이어갈지 먼저 고르게 하고, 그 워크트리로 진입한 뒤 정상 경로를 타게 한다.git worktree list는 repo 하나만 보므로 로비에서는 자식 repo 를 가로지르는 열거가 따로 필요하다.Action
설계
/pr0단계 맨 앞에 로비 판별(0-A-0)을 뒀다. 판별은 "toplevel 바로 밑에 origin 이TeamPiKi/*인 repo 가 있는가" 로 한다. 루트 자신의 origin 유무로 보면 아직 remote 를 안 붙인 소비 repo 와 구분되지 않는다.EnterWorktree로 진입한 뒤 0단계를 처음부터 다시 탄다. 이때는 cwd 가 워크트리라 판별이 그냥 통과한다. 후보가 없으면 올릴 작업이 없다는 뜻이라 멈춘다.열거 스크립트
claude/scripts/piki-worktrees.sh를 더하고 홈(~/.claude/scripts)에 설치한다.find-session.sh와 같은 이유다. 로비든 어느 repo 세션이든 같은 한 벌이어야 한다.자식 repo 를 돌 때 git common dir 로 중복을 제거한다. 형제 폴더 워크트리(
piki/extractor-fetch-bound)도 자식으로 잡혀 같은 repo 를 여러 번 세기 때문이다. repo 이름도 common dir 의 부모에서 뽑는다. 형제 폴더의 basename 은 repo 가 아니라 작업 이름이다.후보 판정
origin/dev, 없으면 repo default, 없으면main) 워크트리EnterWorktree path=로 진입할 수 없다 (루트에 등록된 워크트리가 아니라며 거부된다)세션 열림 표시는
~/.claude/sessions/*.json의 cwd 와 대조하되 pid 생존까지 본다. 레지스트리에 죽은 세션 파일이 남아 멀쩡한 후보를 가리기 때문이다.base 는
gh repo view없이 로컬 ref 로만 근사한다. 열거는 선택지를 띄우기 전에 즉답해야 해서 네트워크를 타지 않는다.Result
open표시 4건이 라이브 pid 실측과 정확히 일치했다. extractor 는 자식으로 3개 폴더가 잡히지만 중복 없이 워크트리 한 벌만 나온다.SLUG를 repo + 브랜치로 넓히는 변경은 이 PR 에 넣지 않았다. 로비 세션이 repo 를 오갈 때 브랜치명만으로는 본문 임시파일 격리가 깨지는 문제라 별도로 올린다.연관 이슈