CI/CD ve Otomasyon Basit
İnceleme İçin Git Diff Aktarma
Otomatik kod incelemesi için hazırlanmış veya hazırlanmamış değişiklikleri Claude'a gönderin
Komut
"color:#9CA3AF;font-style:italic"># Review staged changes (what you're about to commit) $ "color:#7C5CFC">git diff "color:#d97757">--staged | "color:#7C5CFC">claude -p "Review these changes" "color:#d97757">--output-format text "color:#9CA3AF;font-style:italic"># Review only TypeScript changes $ "color:#7C5CFC">git diff "color:#d97757">--staged -- '*.ts' '*.tsx' | \ "color:#7C5CFC">claude -p "Review ">for type safety issues" "color:#9CA3AF;font-style:italic"># Compare against main branch $ "color:#7C5CFC">git diff main...HEAD | "color:#7C5CFC">claude -p "Summarize all changes ">for PR description"
Yanıt
## Code Review: Staged Changes ### auth.ts - Good: Added input validation for email format - Issue: Missing null check on `user.role` (line +24) ### api.ts - Good: Rate limiting added to /api/users endpoint - Suggestion: Consider adding retry-after header
Ayrıştırma Kodu
059669">">const { execSync } = require(059669059669">">'child_process'); 059669">">// Review staged changes before committing 059669">">const diff = execSync(059669059669">">'git diff --staged', { encoding: 059669059669">">'utf-8' }); 059669">">if (diff.trim()) { 059669">">const review = execSync( 059669">`git diff --staged | claude -p "Review these changes059669">" --output-format text`, { encoding: 059669059669">">'utf-8', env: { ...process.env, CLAUDECODE: 059669059669">">'' } } ); console.log(review); }
Tuzaklar
! Tüm commit edilmemiş değişiklikleri değil, commit etmek üzere olduğunuz değişiklikleri incelemek için --staged kullanın
! Büyük diff'lerde token maliyetini azaltmak için -- '*.ts' ile kapsamı sınırlayın
! Büyük diff'ler (1000+ satır) bağlam sınırlarına takılabilir — belirli dizinlerle filtreleyin