DeepWiki Open: AI 기반 리포지토리 위키 자동 생성기 - 완전 튜토리얼
⏱️ 예상 읽기 시간: 10분
서론
소프트웨어 개발에서 문서화는 프로젝트의 성공을 좌우하는 핵심 요소입니다. 하지만 개발자들에게 문서 작성은 항상 번거로운 일이죠. DeepWiki Open은 이런 문제를 AI의 힘으로 해결하는 혁신적인 도구입니다.
GitHub에서 9,100개 이상의 스타를 받은 이 오픈소스 프로젝트는 GitHub, GitLab, Bitbucket 리포지토리를 분석하여 자동으로 포괄적인 위키를 생성합니다. OpenAI, Google Gemini, OpenRouter, 심지어 로컬 Ollama까지 다양한 AI 모델을 지원하며, RAG(Retrieval Augmented Generation) 기술을 활용해 정확하고 맥락에 맞는 문서를 생성합니다.
DeepWiki Open의 핵심 특징
1. AI 기반 자동 문서화
DeepWiki Open의 가장 강력한 기능들:
🤖 AI 문서화 특징:
- 코드 자동 분석 및 문서 생성
- RAG 기반 정확한 컨텍스트 이해
- 다이어그램 자동 생성 및 수정
- 다국어 지원 (영어, 스페인어, 프랑스어, 일본어)
2. 다양한 AI 모델 지원
지원되는 AI 서비스
- OpenAI: GPT-4, GPT-3.5-turbo 등
- Google: Gemini Pro, Gemini Flash
- OpenRouter: 수백 개의 AI 모델 접근
- Azure OpenAI: 엔터프라이즈 환경 지원
- Ollama: 로컬 AI 모델 실행
OpenRouter 통합의 장점
✨ OpenRouter 혜택:
- 단일 API로 다양한 모델 접근
- 비용 효율적인 모델 선택
- 지역 제한 없는 모델 사용
- 실시간 모델 성능 비교
3. 고급 기능들
- Ask Feature: RAG 기반 리포지토리 질의응답
- DeepResearch: 다단계 심층 연구 및 분석
- 실시간 스트리밍: 문서 생성 과정 실시간 확인
- Private Repository: 개인 액세스 토큰으로 프라이빗 저장소 지원
설치 및 환경 설정
1. Docker를 이용한 빠른 시작 (권장)
사전 준비 사항
# Docker가 설치되어 있는지 확인
docker --version
# Docker Compose 확인
docker-compose --version
환경변수 설정
# .env 파일 생성
cat << EOF > .env
# OpenAI API (GPT 모델 사용 시)
OPENAI_API_KEY=your_openai_api_key
# Google API (Gemini 모델 사용 시)
GOOGLE_API_KEY=your_google_api_key
# OpenRouter API (다양한 모델 접근 시)
OPENROUTER_API_KEY=your_openrouter_api_key
# Azure OpenAI (엔터프라이즈 환경)
AZURE_OPENAI_API_KEY=your_azure_openai_api_key
AZURE_OPENAI_ENDPOINT=your_azure_openai_endpoint
AZURE_OPENAI_VERSION=your_azure_openai_version
# Ollama (로컬 AI 모델)
OLLAMA_HOST=your_ollama_host
EOF
Docker Compose로 실행
# 프로젝트 클론
git clone https://github.com/AsyncFuncAI/deepwiki-open.git
cd deepwiki-open
# .env 파일 편집
nano .env
# 서비스 실행
docker-compose up
직접 Docker 실행
# 사전 빌드된 이미지 사용
docker run -p 8001:8001 -p 3000:3000 \
--env-file .env \
-v ~/.adalflow:/root/.adalflow \
ghcr.io/asyncfuncai/deepwiki-open:latest
2. 로컬 개발 환경 설정
백엔드 설정 (Python/FastAPI)
# Python 3.8+ 확인
python3 --version
# 가상 환경 생성
python3 -m venv deepwiki-env
source deepwiki-env/bin/activate # macOS/Linux
# deepwiki-env\Scripts\activate # Windows
# 의존성 설치
cd api
pip install -r requirements.txt
# 환경변수 설정
export OPENAI_API_KEY="your_openai_api_key"
export GOOGLE_API_KEY="your_google_api_key"
# API 서버 실행
python main.py
프론트엔드 설정 (Next.js)
# Node.js 16+ 확인
node --version
npm --version
# 의존성 설치
npm install
# 개발 서버 실행
npm run dev
3. Ollama 로컬 모델 설정
로컬에서 AI 모델을 실행하려면:
# Ollama 설치 (macOS)
brew install ollama
# Ollama 설치 (Linux)
curl -fsSL https://ollama.ai/install.sh | sh
# 추천 모델 다운로드
ollama pull llama2
ollama pull codellama
ollama pull mistral
# Ollama 서버 실행
ollama serve
# DeepWiki에서 Ollama 사용 설정
export OLLAMA_HOST=http://localhost:11434
Docker로 Ollama 사용
# Ollama용 특별 Dockerfile 사용
docker build -f Dockerfile-ollama-local -t deepwiki-ollama .
# Ollama와 함께 실행
docker run -p 8001:8001 -p 3000:3000 \
-v ~/.adalflow:/root/.adalflow \
deepwiki-ollama
기본 사용법
1. 첫 번째 위키 생성
웹 인터페이스 접속
# 브라우저에서 접속
open http://localhost:3000
# 또는 curl로 API 확인
curl http://localhost:8001/health
위키 생성 과정
- 리포지토리 URL 입력:
예시 URL: - https://github.com/username/repository - https://gitlab.com/username/project - https://bitbucket.org/username/repo
- AI 모델 선택:
권장 모델: - GPT-4o (최고 품질) - Gemini 2.0 Flash (빠른 속도) - Claude 3.5 Sonnet (균형) - Llama 3.1 (로컬 실행)
- 생성 옵션 설정:
설정 가능한 옵션: - 분석 깊이 (Light/Standard/Deep) - 다이어그램 포함 여부 - 언어 설정 - 출력 형식
2. Private Repository 연동
GitHub Personal Access Token 생성
# GitHub에서 토큰 생성 경로:
# Settings → Developer settings → Personal access tokens → Generate new token
# 필요한 권한:
# - repo (전체 저장소 접근)
# - read:org (조직 정보 읽기)
토큰 사용법
1. DeepWiki 메인 페이지에서 "Private Repository" 체크
2. Personal Access Token 입력 필드에 토큰 붙여넣기
3. 프라이빗 리포지토리 URL 입력
4. 위키 생성 시작
3. 위키 결과 확인
생성된 위키는 다음과 같은 구조로 제공됩니다:
📋 생성되는 문서 구조:
├── 📖 프로젝트 개요
├── 🏗️ 아키텍처 다이어그램
├── 📂 디렉토리 구조
├── 🔧 설치 가이드
├── 🚀 사용법
├── 📊 API 문서
├── 🧪 테스트 가이드
└── 🤝 기여 방법
고급 기능 활용
1. Ask Feature - RAG 기반 질의응답
기본 사용법
질문 예시:
- "이 프로젝트의 주요 아키텍처는 무엇인가요?"
- "인증 시스템은 어떻게 구현되어 있나요?"
- "데이터베이스 연결 설정 방법을 알려주세요."
- "테스트 케이스는 어떻게 작성하나요?"
고급 질의 기법
📝 효과적인 질문 방법:
1. 구체적인 컴포넌트 명시
2. 코드 예시 요청
3. 설정 파일 위치 문의
4. 에러 해결 방법 질문
2. DeepResearch Feature
심층 연구 활성화
DeepResearch 사용 시나리오:
- 복잡한 아키텍처 분석
- 보안 취약점 검토
- 성능 최적화 방안
- 코드 품질 평가
연구 단계별 과정
🔍 DeepResearch 프로세스:
1. Research Plan: 초기 분석 계획 수립
2. Research Updates: 단계별 심화 분석 (최대 5회)
3. Final Conclusion: 종합적인 결론 도출
3. 다중 모델 전략
모델별 최적 사용법
# 모델 선택 가이드
model_recommendations = {
"코드 분석": ["GPT-4o", "Claude 3.5 Sonnet"],
"빠른 문서화": ["Gemini 2.0 Flash", "GPT-3.5 Turbo"],
"비용 효율": ["Llama 3.1", "Mixtral 8x7B"],
"로컬 실행": ["CodeLlama", "DeepSeek Coder"],
"다국어 지원": ["GPT-4o", "Gemini Pro"]
}
OpenRouter 활용 전략
# OpenRouter에서 모델 비교
curl -X GET "https://openrouter.ai/api/v1/models" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
| jq '.data[] | {id: .id, pricing: .pricing}'
# 비용 대비 성능 최적화
models_by_cost = [
"google/gemini-flash-1.5", # 저비용, 빠른 속도
"anthropic/claude-3-sonnet", # 중간 비용, 높은 품질
"openai/gpt-4o", # 높은 비용, 최고 품질
]
실무 활용 시나리오
1. CI/CD 통합
GitHub Actions 자동화
# .github/workflows/deepwiki-update.yml
name: Update Project Wiki
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
update-wiki:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup DeepWiki
run: |
docker pull ghcr.io/asyncfuncai/deepwiki-open:latest
- name: Generate Wiki
env:
OPENAI_API_KEY: $
run: |
docker run --rm \
-e OPENAI_API_KEY="$OPENAI_API_KEY" \
-v $:/workspace \
ghcr.io/asyncfuncai/deepwiki-open:latest \
python api/cli_generate.py \
--repo-path /workspace \
--output /workspace/docs/wiki.md
- name: Commit Wiki Updates
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add docs/wiki.md
git commit -m "Auto-update project wiki" || exit 0
git push
2. 팀 온보딩 가속화
신입 개발자용 자동 문서 생성
#!/bin/bash
# onboarding-docs.sh
# 새 팀원을 위한 포괄적 문서 생성
repositories=(
"company/main-backend"
"company/frontend-app"
"company/mobile-app"
"company/shared-libs"
)
for repo in "${repositories[@]}"; do
echo "📚 $repo 문서 생성 중..."
curl -X POST http://localhost:8001/generate-wiki \
-H "Content-Type: application/json" \
-d "{
\"repo_url\": \"https://github.com/$repo\",
\"model\": \"gpt-4o\",
\"language\": \"korean\",
\"include_diagrams\": true,
\"analysis_depth\": \"deep\"
}" \
-o "docs/${repo##*/}-wiki.json"
echo "✅ $repo 문서 생성 완료"
done
echo "🎉 모든 온보딩 문서 생성 완료!"
3. 코드 리뷰 지원
자동 코드 분석 및 문서화
# code_review_assistant.py
import requests
import json
def analyze_pull_request(pr_url, base_branch="main"):
"""PR에 대한 자동 분석 및 문서 생성"""
# DeepWiki API 호출
response = requests.post("http://localhost:8001/analyze-changes", json={
"pr_url": pr_url,
"base_branch": base_branch,
"analysis_type": "code_review",
"include_suggestions": True
})
if response.status_code == 200:
analysis = response.json()
# 마크다운 리포트 생성
report = f"""
# 🔍 자동 코드 리뷰 리포트
## 📊 변경 사항 요약
- 수정된 파일: {analysis['files_changed']}개
- 추가된 줄: {analysis['lines_added']}줄
- 삭제된 줄: {analysis['lines_deleted']}줄
## 🏗️ 아키텍처 영향도
{analysis['architecture_impact']}
## 💡 개선 제안
{analysis['suggestions']}
## 🧪 테스트 권장사항
{analysis['testing_recommendations']}
"""
return report
return "분석 실패"
# 사용 예시
pr_report = analyze_pull_request(
"https://github.com/company/repo/pull/123"
)
print(pr_report)
4. API 문서 자동 생성
OpenAPI 스펙 통합
// api-docs-generator.js
const axios = require('axios');
const fs = require('fs');
async function generateAPIDocumentation(repoUrl) {
try {
// DeepWiki API 호출
const response = await axios.post('http://localhost:8001/generate-api-docs', {
repo_url: repoUrl,
include_openapi: true,
include_examples: true,
format: 'swagger-ui'
});
const apiDocs = response.data;
// OpenAPI 스펙 저장
fs.writeFileSync(
'docs/openapi.json',
JSON.stringify(apiDocs.openapi_spec, null, 2)
);
// 사용자 친화적 문서 생성
const markdownDocs = `
# 🚀 API 문서
## 개요
${apiDocs.overview}
## 인증
${apiDocs.authentication}
## 엔드포인트
${apiDocs.endpoints.map(endpoint => `
### ${endpoint.method.toUpperCase()} ${endpoint.path}
${endpoint.description}
**요청 예시:**
\`\`\`bash
${endpoint.curl_example}
\`\`\`
**응답 예시:**
\`\`\`json
${JSON.stringify(endpoint.response_example, null, 2)}
\`\`\`
`).join('\n')}
`;
fs.writeFileSync('docs/API.md', markdownDocs);
console.log('✅ API 문서 생성 완료!');
} catch (error) {
console.error('❌ API 문서 생성 실패:', error.message);
}
}
// 실행
generateAPIDocumentation('https://github.com/your-org/api-project');
고급 설정 및 커스터마이징
1. 자체 서명 인증서 지원
기업 환경에서 자체 서명 인증서를 사용하는 경우:
# 인증서 디렉토리 생성
mkdir -p certs
# 인증서 파일 복사
cp /path/to/your/certificate.crt certs/
cp /path/to/your/certificate.pem certs/
# 커스텀 인증서로 Docker 빌드
docker build --build-arg CUSTOM_CERT_DIR=certs .
2. 커스텀 프롬프트 템플릿
# custom_prompts.py
CUSTOM_TEMPLATES = {
"korean_documentation": """
다음 소프트웨어 프로젝트를 분석하여 한국어로 포괄적인 문서를 작성해주세요.
프로젝트 정보:
- 저장소: {repo_url}
- 주요 언어: {primary_language}
- 프레임워크: {frameworks}
작성 가이드라인:
1. 한국 개발자들이 이해하기 쉬운 용어 사용
2. 실무에서 바로 적용 가능한 예시 제공
3. 설치부터 배포까지 전체 생명주기 포함
4. 한국 클라우드 환경 (네이버클라우드, 카카오클라우드) 고려
다음 구조로 문서를 작성해주세요:
- 📋 프로젝트 개요
- 🏗️ 시스템 아키텍처
- ⚙️ 개발 환경 설정
- 🚀 배포 가이드
- 🔧 운영 및 모니터링
- 🤝 팀 협업 방법
""",
"enterprise_security": """
엔터프라이즈 환경에서의 보안 관점으로 프로젝트를 분석해주세요.
중점 분석 영역:
1. 인증 및 권한 관리
2. 데이터 암호화 및 보호
3. API 보안
4. 의존성 취약점
5. 컴플라이언스 요구사항
보고서 형식:
- 🔒 보안 개요
- ⚠️ 식별된 위험 요소
- 🛡️ 권장 보안 조치
- 📋 컴플라이언스 체크리스트
"""
}
3. 성능 최적화 설정
# performance-config.yml
deepwiki:
api:
max_workers: 4
timeout: 300
memory_limit: "2GB"
ai_models:
default_model: "gpt-4o-mini" # 비용 효율적
fallback_model: "gemini-flash-1.5"
caching:
enable_repo_cache: true
cache_ttl: 86400 # 24시간
max_cache_size: "1GB"
analysis:
max_file_size: "10MB"
exclude_patterns:
- "node_modules/"
- ".git/"
- "*.log"
- "dist/"
- "build/"
모니터링 및 디버깅
1. 로그 분석
# Docker 컨테이너 로그 확인
docker logs deepwiki-container
# 실시간 로그 모니터링
docker logs -f deepwiki-container
# 특정 에러 필터링
docker logs deepwiki-container 2>&1 | grep ERROR
2. 성능 메트릭 수집
# metrics_collector.py
import psutil
import time
import json
from datetime import datetime
class DeepWikiMonitor:
def __init__(self):
self.metrics = []
def collect_metrics(self, duration=300): # 5분간 모니터링
start_time = time.time()
while time.time() - start_time < duration:
metric = {
"timestamp": datetime.now().isoformat(),
"cpu_percent": psutil.cpu_percent(),
"memory_percent": psutil.virtual_memory().percent,
"disk_usage": psutil.disk_usage('/').percent,
"api_status": self.check_api_health()
}
self.metrics.append(metric)
time.sleep(30) # 30초마다 수집
def check_api_health(self):
try:
response = requests.get("http://localhost:8001/health")
return response.status_code == 200
except:
return False
def save_report(self):
with open(f"metrics_{datetime.now().strftime('%Y%m%d_%H%M%S')}.json", 'w') as f:
json.dump(self.metrics, f, indent=2)
# 사용
monitor = DeepWikiMonitor()
monitor.collect_metrics(duration=600) # 10분간 모니터링
monitor.save_report()
3. 에러 해결 가이드
일반적인 문제들
- API 키 오류:
```bash
환경변수 확인
echo $OPENAI_API_KEY echo $GOOGLE_API_KEY
.env 파일 검증
cat .env | grep -v ‘^#’ | grep ‘=’
2. **메모리 부족**:
```bash
# Docker 메모리 제한 증가
docker run --memory=4g --memory-swap=4g \
-p 8001:8001 -p 3000:3000 \
ghcr.io/asyncfuncai/deepwiki-open:latest
- 포트 충돌:
```bash
사용 중인 포트 확인
lsof -i :8001 lsof -i :3000
다른 포트로 실행
docker run -p 8002:8001 -p 3001:3000
ghcr.io/asyncfuncai/deepwiki-open:latest
```
결론
DeepWiki Open은 AI 기반 문서화의 새로운 패러다임을 제시하는 혁신적인 도구입니다. 9,100개 이상의 GitHub 스타가 보여주듯, 이미 많은 개발자들이 그 가치를 인정하고 있습니다.
핵심 장점 요약
- 완전 자동화: 리포지토리 분석부터 문서 생성까지 원클릭
- 다양한 AI 지원: OpenAI, Google, OpenRouter, Ollama 등
- RAG 기반 정확성: 실제 코드를 기반으로 한 정확한 문서
- 실시간 질의응답: Ask 기능으로 인터랙티브한 문서화
- 엔터프라이즈 ready: 프라이빗 저장소, 자체 인증서 지원
활용 권장 시나리오
- 스타트업: 빠른 문서화로 초기 개발 속도 향상
- 기업: 레거시 코드의 체계적 문서화
- 오픈소스: 기여자를 위한 포괄적 가이드 생성
- 교육: 코드베이스 이해를 위한 학습 자료
DeepWiki Open은 단순한 문서 생성 도구를 넘어, 지식 관리와 팀 협업을 혁신하는 플랫폼으로 자리잡을 잠재력을 가지고 있습니다. AI 기술의 발전과 함께 더욱 정교하고 강력한 기능들이 추가될 것으로 기대됩니다.
참고 자료