complete route (inline reconcile — do NOT delegate; gsd-phase has no complete mode).
4a. Resolve the phase number. If REMAINDER contains a number, use it. Otherwise Read .planning/STATE.md and extract the Phase: value from the ## Current Position section / YAML frontmatter (mirror sg-ship Step 1 resolution). If still unresolved, print and exit:
Could not resolve phase. Pass it explicitly: /super-gsd:sg-phase complete <N>
PHASE_NUM=$(printf '%s' "$REMAINDER" | grep -oE '[0-9]+(\.[0-9]+)?' | head -1)
4b. Locate the phase directory (zero-padded two-digit support):
PHASE_PAD=$(printf "%02d" "$PHASE_NUM" 2>/dev/null || echo "$PHASE_NUM")
PHASE_DIR=$(ls -d .planning/phases/${PHASE_PAD}-* 2>/dev/null | head -1)
[ -z "$PHASE_DIR" ] && PHASE_DIR=$(ls -d .planning/phases/${PHASE_NUM}-* 2>/dev/null | head -1)
PHASE_SLUG=$(printf '%s' "$PHASE_DIR" | xargs basename 2>/dev/null || echo "${PHASE_PAD}")
4c. Recompute Plans-complete. If the directory exists, count SUMMARY vs PLAN files; otherwise use the ad-hoc sentinel:
if [ -n "$PHASE_DIR" ] && [ -d "$PHASE_DIR" ]; then
SUMS=$(ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null | wc -l | tr -d ' ')
PLANS=$(ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null | wc -l | tr -d ' ')
PLANS_COMPLETE="${SUMS}/${PLANS}"
else
PLANS_COMPLETE="— (ad-hoc)"
fi
TODAY=$(date +%Y-%m-%d)
echo "phase=$PHASE_NUM slug=${PHASE_SLUG} plans_complete=$PLANS_COMPLETE date=$TODAY"
4d. Update the ROADMAP ## Progress table row. Use the Read tool to load .planning/ROADMAP.md and find the ## Progress table (columns | Phase | Milestone | Plans Complete | Status | Completed |). Table rows are NOT zero-padded — match the row whose Phase cell begins with <PHASE_NUM>. (e.g. | 36. ...). Use the Edit tool to set that row's Plans-complete = $PLANS_COMPLETE, Status = Complete, Completed = $TODAY. Do NOT parse the pipe table with awk -F'|' field-splitting or grep -P (CLAUDE.md macOS portability) — Read + interpret + Edit only.
4e. Flip the ## Phases checkbox. In the same file's ## Phases section, find the line for the target phase (e.g. - [ ] **Phase 36: ...** or - [ ] Phase 36: ..., matched on the phase number) and use the Edit tool to change - [ ] → - [x].
4f. Update STATE.md. Use the Read tool on .planning/STATE.md, then Edit surgically to reflect the phase as complete (e.g. ## Current Position Phase/Status lines, and if progress.completed_phases/percent are present and the flip changed the count, update them). Touch only position/progress lines.
4g. Optionally append a HANDOFF.md complete row (append-only — never modify existing rows). Reuse the sg-ship Step 1.5 header guard + FROM_STAGE extraction (read the To column of the last data row, default review), then:
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
GIT_USER=$(git config user.name 2>/dev/null || echo "-")
[ -z "$GIT_USER" ] && GIT_USER="-"
echo "| $TS | $PHASE_SLUG | $FROM_STAGE | complete | - | $GIT_USER |" >> .planning/HANDOFF.md
4h. Print a confirmation summarizing what changed (phase number, plans-complete, status → Complete, completed date, files touched). Surface the prose in the user's language; keep machine tokens (phase slug, vX.Y, dates, Complete) verbatim.
4i. PR creation guidance (TEAM-04). If on a feature branch (not main/master), check for gh CLI and output the PR creation command or git push guidance.
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
if [ "$CURRENT_BRANCH" != "main" ] && [ "$CURRENT_BRANCH" != "master" ] && [ "$CURRENT_BRANCH" != "unknown" ]; then
if command -v gh >/dev/null 2>&1; then
echo "PR을 생성하려면 (To create a PR):"
echo " gh pr create --base main --title \"phase/${PHASE_SLUG}\""
else
echo "PR을 생성하려면 현재 브랜치를 push한 뒤 GitHub에서 PR을 여세요 (To create a PR, push and open on GitHub):"
echo " git push -u origin HEAD"
fi
fi
- feature 브랜치(main/master 이외)에서만 출력한다. main/master 또는 non-git 환경에서는 이 스텝을 건너뛴다.
- 출력 산문은 사용자 언어로 표면화 (
<language> 지침 준수). 명령어 토큰 (gh pr create, git push -u origin HEAD, phase/${PHASE_SLUG}) 은 영문 그대로.
- PR 자동 실행 없음 — 텍스트 출력만.