# 依赖安全审计脚本 (Windows PowerShell)
# 用法: .\scripts\audit.ps1

Write-Host "Running npm audit..."
$exitCode = 0
try {
    npm audit --audit-level=moderate
    $exitCode = $LASTEXITCODE
} catch {
    $exitCode = 1
}

if ($exitCode -ne 0) {
    Write-Host "Security vulnerabilities found!"
    npm audit --json | Out-File -FilePath audit-report.json -Encoding utf8
    exit $exitCode
}

Write-Host "No vulnerabilities found."
