AI-powered code review CLI tool using Qwen3-Coder-30B model with IP whitelist support
npm install cciwon-code-review-cliAI 기반 코드 리뷰 CLI 도구 (Qwen3-Coder-30B DPO 파인튜닝 모델 사용)
- 🔒 폐쇄망 지원: IP 화이트리스트 기반 (192.168.10.152)
- 📁 폴더 전체 리뷰: 프로젝트 전체를 한 번에 분석
- 📄 파일 단위 리뷰: 개별 파일 심층 분석
- 🛡️ 보안 중심: SQL Injection, XSS 등 보안 취약점 탐지
- ⚡ 빠른 응답: vLLM 기반 고성능 추론
먼저 vLLM 서버를 시작해야 합니다:
``bash필수 패키지 설치
pip install vllm fastapi uvicorn
서버가
192.168.10.152:8000에서 실행됩니다.$3
`bash
cd code-review-cli
npm install
npm link # 전역 설치
`또는 로컬에서 직접 사용:
`bash
node bin/code-review.js
`사용법
$3
`bash
code-review health
`출력 예시:
`
✅ 서버 정상 작동 중서버 정보:
- 상태: healthy
- 모델 로드: 완료
- 서버 URL: http://192.168.10.152:8000
`$3
`bash
code-review folder /path/to/project
`옵션:
-
-i, --include : 포함할 파일 패턴 (기본: .py,.js,.ts,.java,.cpp,.go)
- -e, --exclude : 제외할 패턴 (기본: node_modules,__pycache__,.git,*.pyc)
- -m, --max-files : 최대 파일 수 (기본: 50)예시:
`bash
Python 프로젝트 리뷰
code-review folder ./my-python-project -i ".py" -e "__pycache__,.pyc,venv"JavaScript 프로젝트 리뷰
code-review folder ./my-js-project -i ".js,.jsx" -e "node_modules,dist,build"모든 코드 파일 리뷰 (최대 100개)
code-review folder ./my-project -m 100
`$3
`bash
code-review file /path/to/file.py
`옵션:
-
-l, --language : 프로그래밍 언어 (기본: python)
- -c, --checklist : 체크리스트 파일 경로예시:
`bash
Python 파일 리뷰
code-review file ./app.py -l pythonTypeScript 파일 + 체크리스트
code-review file ./api.ts -l typescript -c ./checklist.txtJava 파일 리뷰
code-review file ./Main.java -l java
`VSCode 통합
$3
.vscode/tasks.json 파일 생성:`json
{
"version": "2.0.0",
"tasks": [
{
"label": "Code Review: Current Folder",
"type": "shell",
"command": "code-review folder ${workspaceFolder}",
"problemMatcher": [],
"presentation": {
"reveal": "always",
"panel": "new"
}
},
{
"label": "Code Review: Current File",
"type": "shell",
"command": "code-review file ${file}",
"problemMatcher": [],
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
`사용법:
1.
Ctrl+Shift+P → Tasks: Run Task
2. Code Review: Current Folder 또는 Code Review: Current File 선택$3
VSCode 내장 터미널에서:
`bash
현재 워크스페이스 리뷰
code-review folder .특정 파일 리뷰
code-review file src/main.py
`환경 변수
서버 URL을 변경하려면 환경 변수 설정:
`bash
export CODE_REVIEW_SERVER=http://192.168.10.152:8000
code-review health
`IP 화이트리스트
현재 허용된 IP:
-
192.168.10.152 (서버 IP)
- 127.0.0.1 (로컬 테스트용)다른 IP에서 접근 시:
`
❌ 허용된 아이피가 아닙니다
현재 IP: 192.168.10.xxx
허용된 IP: 192.168.10.152, 127.0.0.1
`IP 추가하려면
vllm_server.py의 ALLOWED_IPS 수정:`python
ALLOWED_IPS = ["192.168.10.152", "127.0.0.1", "192.168.10.100"] # 새 IP 추가
`트러블슈팅
$3
`
❌ 서버 연결 실패
서버 연결 실패: http://192.168.10.152:8000
서버가 실행 중인지 확인하세요.
`해결:
1. vLLM 서버가 실행 중인지 확인:
ps aux | grep vllm_server
2. 서버 로그 확인: tail -f /path/to/server.log
3. 방화벽 확인: sudo ufw status$3
`
❌ 허용된 아이피가 아닙니다
`해결:
1. 현재 IP 확인:
curl ifconfig.me
2. vllm_server.py의 ALLOWED_IPS에 추가
3. 서버 재시작$3
vLLM 서버가 OOM으로 죽는 경우:
vllm_server.py 수정:
`python
llm = LLM(
model=OUTPUT_DIR,
tensor_parallel_size=2,
gpu_memory_utilization=0.7, # 0.9 → 0.7로 감소
max_model_len=1024, # 2048 → 1024로 감소
)
``- 평균 응답 시간: ~5초 (폴더 리뷰, 10개 파일 기준)
- 동시 처리: vLLM 배치 처리로 여러 요청 동시 처리 가능
- GPU 사용량: 2x RTX 5090 (50-60GB)
MIT