Skip to content
CI/CD ve Otomasyon Orta

Toplu Dosya İşleme

Dosya başına bütçe sınırları ve maliyet takibi ile birden fazla dosyayı bağımsız olarak işleyin

Komut

$ "color:#7C5CFC">for file in src/**/*.ts; "color:#7C5CFC">do
    "color:#7C5CFC">claude -p "Add JSDoc comments to $file" \
      "color:#d97757">--output-format json \
      "color:#d97757">--max-budget-usd 0.10 \
      "color:#d97757">--no-session-persistence \
      "color:#d97757">--permission-mode bypassPermissions
  "color:#7C5CFC">done

Yanıt

Processing: src/auth.ts
  Cost: $0.045 (Running total: $0.045)
Processing: src/api.ts
  Cost: $0.038 (Running total: $0.083)
=== Batch complete. Total: $0.083 ===

Ayrıştırma Kodu

059669">">let totalCost = 0;
059669">">for (059669">">const file 059669">">of files) {
  059669">">const data = JSON.parse(execFileSync(059669059669">">'claude', [
    059669059669">">'-p', 059669">`Add JSDoc to ${file}`,
    059669059669">">'--output-format', 059669059669">">'json', 059669059669">">'--max-budget-usd', 059669059669">">'0.10',
    059669059669">">'--no-session-persistence', 059669059669">">'--permission-mode', 059669059669">">'bypassPermissions'
  ], opts));
  totalCost += data.total_cost_usd;
  console.log(059669">`${file}: $${data.total_cost_usd}`);
}

Tuzaklar

! Her çağrı izole edilmiştir — dosyalar arasında oturum durumu sızıntısı olmaz
! Oturum deposunu binlerce tek seferlik çalıştırmayla kirletmemek için --no-session-persistence kullanın

İlgili Tarifler