# CodeGraph AST 실제 통합 구현 — 미구현 3건 수정

## 배경
task-1873 검증 결과: ast_dependency_map.py 자체는 47/47 PASS이나 다른 시스템과의 통합 코드 3건 미구현.

## 미구현 항목

### 1. dispatch.py → AST 호출 (affected_files 자동 제안)
- dispatch.py에 `ast_dependency_map.py`를 subprocess 또는 import로 호출하는 로직 추가
- task 파일의 변경 대상 파일 → AST blast radius 계산 → affected_files 자동 제안
- 기존 `_parse_affected_files()`와 연동: AST 결과를 affected_files에 병합
- 위치: `delegate_to_team()` 또는 `_check_affected_files_overlap()` 부근

### 2. worktree_manager.py → PR blast radius 삽입
- `cmd_finish()` 함수에서 PR body 생성 시 AST blast radius 요약 삽입
- 형식: "## Blast Radius\n- N개 파일 영향, 주요: file1, file2..."
- AST 스크립트 경로: `/home/jay/workspace/scripts/ast_dependency_map.py`

### 3. codex_gate_check.py → callers 연동
- `codex_gate_check()` 함수에 `callers` 정보 추가
- AST의 `--function` 옵션으로 변경 함수의 caller 조회
- Codex 프롬프트에 "이 함수는 N곳에서 호출됨: caller1, caller2..." 컨텍스트 삽입

## AST 스크립트 호출 방법
```python
import subprocess, json
result = subprocess.run(
    ["python3", "scripts/ast_dependency_map.py", "--root", "dashboard/", "--files", "data_loader.py", "--json"],
    capture_output=True, text=True, timeout=30
)
data = json.loads(result.stdout)
# data["direct_importers"], data["test_files"], data["callers"]
```

## 검증 시나리오 (스모크테스트 = 실제 사용)
1. `--level critical` dispatch 시 affected_files에 AST blast radius 포함
2. worktree finish --action pr 시 PR description에 blast radius 섹션 포함
3. codex_gate_check.py 실행 시 callers 정보가 Codex 프롬프트에 포함
4. 기존 pytest 회귀 없음

## 주의
- dispatch.py, worktree_manager.py 대용량 — offset/limit
- AST 스크립트 실패 시 graceful fallback (기존 동작 유지)
- 수정 후 즉시 커밋
