Skip to content

refactor: 동기 I/O 제거 + 거대 함수 분해 #194

@justn-hyeok

Description

@justn-hyeok

Summary

동기 I/O가 UI를 프리징하고, 500줄+ 함수가 유지보수를 어렵게 함.

동기 I/O (async 전환 필요)

위치 함수 영향
core/config/credentials.ts readFileSync, writeFileSync, statSync, mkdirSync CLI에서는 괜찮으나 웹/MCP에서 블로킹
tui/ModelSelector.tsx:56 readFileSync TUI 프리징
tui/ConfigScreen.tsx:110 writeFileSync TUI 프리징
github/action.ts:76,103 diff 파일 2회 중복 읽기 불필요 I/O

거대 함수 분해

위치 함수 줄수 권장 분해
core/pipeline/orchestrator.ts:108-608 runPipeline 500+ L1 실행, L2 토론, L3 판결, 캐시, 텔레메트리 단위로 분리
cli/index.ts:93-404 review 커맨드 액션 310+ 옵션 파싱, 파이프라인 실행, 결과 포맷팅 분리
cli/commands/init.ts 전체 파일 1098 wizard UI, config 빌드, 파일 I/O, GitHub workflow 분리
github/mapper.ts:221-416 buildSummaryBody 180+ 섹션별 빌더 함수로 분리

수정 방향

  1. credentials: readFile/writeFile async 버전으로 전환, TUI도 동일
  2. orchestrator: 각 계층 실행을 private 함수로 추출
    • executeL1Reviews(), executeL2Discussions(), executeL3Verdict()
    • checkCache(), recordTelemetry()
  3. init.ts: wizard, config builder, file writer 3개 모듈로 분리

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions