# git-hooks/pre-commit.ps1 Write-Host "πŸ” Pre-commit: Validating game data..." -ForegroundColor Cyan # λ³€κ²½λœ CSV 파일 확인 $changedFiles = git diff --cached --name-only --diff-filter=ACM $CSVFiles = $changedFiles | Where-Object { $_ -match "GameData/.*\.csv$" } if ($CSVFiles.Count -eq 0) { Write-Host "ℹ️ λ³€κ²½λœ CSV 파일이 μ—†μŠ΅λ‹ˆλ‹€." -ForegroundColor Gray exit 0 } Write-Host "πŸ“Š 검증할 파일:" -ForegroundColor Yellow $CSVFiles | ForEach-Object { Write-Host " - $_" } Write-Host "" # Python μ„€μΉ˜ 확인 $pythonCmd = Get-Command python -ErrorAction SilentlyContinue if (-not $pythonCmd) { Write-Host "❌ Python이 μ„€μΉ˜λ˜μ–΄ μžˆμ§€ μ•ŠμŠ΅λ‹ˆλ‹€." -ForegroundColor Red Write-Host "πŸ’‘ https://www.python.org/downloads/ μ—μ„œ Python을 μ„€μΉ˜ν•˜μ„Έμš”." -ForegroundColor Yellow exit 1 } # 검증 슀크립트 μ‹€ν–‰ Push-Location DataTools try { python validate_data.py $exitCode = $LASTEXITCODE Pop-Location if ($exitCode -ne 0) { Write-Host "" Write-Host "❌ 데이터 검증 μ‹€νŒ¨!" -ForegroundColor Red Write-Host "πŸ’‘ CSV νŒŒμΌμ„ μˆ˜μ • ν›„ λ‹€μ‹œ μ»€λ°‹ν•΄μ£Όμ„Έμš”." -ForegroundColor Yellow exit 1 } Write-Host "βœ… 데이터 검증 톡과!" -ForegroundColor Green exit 0 } catch { Pop-Location Write-Host "❌ 검증 쀑 였λ₯˜ λ°œμƒ: $_" -ForegroundColor Red exit 1 }