refactor: SlayDeckController 관심사별 모듈 분리 + 코드 규칙 3종 #94
Reference in New Issue
Block a user
Delete Branch "refactor/cb-concern-modules"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
배경
SlayDeckController(단일 codeblock)의 범위가 너무 커서, 화면 전환·NPC·포지션 관심사가
state.mjs·render.mjs·runend.mjs에 흩어져 있었다. MSW codeblock 컴포넌트는self를 공유하지 않아 진짜 런타임 컴포넌트 분리는 고위험 → 소스 모듈 재정리로 응집도를 높였다(런타임은 단일 codeblock 유지).변경 (커밋 3개)
① 관심사 모듈 분리 (이동·본문 무변경)
state.mjs→screens.mjs개명 (화면 라우팅·버튼 바인딩)npc.mjs신규:OnLobbyNpcInteractnavigation.mjs신규:GoLobbyMap·TeleportToActMap(월드 텔레포트)layout.mjs신규:PositionMonsterSlot(UI 슬롯 배치)Show*(Shop·Rest·Map·Job 등)는 각 기능 모듈 유지 — 코어 라우터ShowState를 호출하는 계층 구조라 분리 시 응집도 저하② 단일문자 지역변수 의미명 개명 (손댄 모듈만)
grp/n/g→enableGroup/name/group,s→soulPoints,e/fn→entity/handler,lp/go→localPlayer/tryTeleport,m/tr/wp/e→monster/transform/worldPos/slotEntity③ RULES.md 규칙 3종
검증
tools/verify/cbset.mjs(순서 무관 집합 비교): 커밋 ① 후 189/189 무손실(본문/exec/params 변경 0), 커밋 ② 후 개명한 6개 메서드만 변경(추가/삭제 0)cbgapGAP 0 (UI 경로 무손상)node --test93/93 통과메서드 이동으로 codeblock 메서드 순서가 바뀌어 산출물 바이트는 main과 다르지만, cbset로 본문 무손실을 증명했다.