# Script de Verificacao de Atualizacoes do Upstream (PowerShell) param ( [string]$UpstreamUrl = "https://github.com/evolution-foundation/evolution-go.git" ) $dateStr = Get-Date -Format "yyyy-MM-dd_HHmmss" $reportFile = "relatorio_atualizacao_$dateStr.md" Write-Host "=== Iniciando Auditoria de Atualizacoes do Upstream ($dateStr) ===" $remotes = git remote if ($remotes -notcontains "upstream") { git remote add upstream $UpstreamUrl } git fetch upstream --tags $localHead = (git rev-parse HEAD).Trim() $upstreamMain = (git rev-parse upstream/main).Trim() $newCommits = git log HEAD..upstream/main --oneline -n 15 $newCommitCount = (git rev-list --count HEAD..upstream/main).Trim() $latestLocalTag = git describe --tags --abbrev=0 2>$null if (-not $latestLocalTag) { $latestLocalTag = "0.7.2" } $latestUpstreamTag = ((git tag -l --sort=-v:refname | Select-Object -First 1) + "").Trim() $localWhatsmeow = ((Get-Content go.mod | Select-String "go.mau.fi/whatsmeow") -replace "^\s*go.mau.fi/whatsmeow\s+", "").Trim() $impactNotice = if ([int]$newCommitCount -gt 0) { "WARNING: Novidades detectadas no upstream ($newCommitCount novos commits). Recomenda-se abrir branch de teste em maintenance/sync-upstream." } else { "OK: Ambiente alinhado. Nao ha novos commits pendentes na branch principal do upstream." } $commitsBlock = if ($newCommits) { $newCommits -join "`r`n" } else { "Nenhum commit novo detectado." } $sb = New-Object System.Text.StringBuilder [void]$sb.AppendLine("# Relatorio de Monitoramento de Atualizacoes — Upstream EvoGO") [void]$sb.AppendLine("") [void]$sb.AppendLine("- Data da Auditoria: $(Get-Date -Format 'dd/MM/yyyy HH:mm:ss')") [void]$sb.AppendLine("- Commit Local Base: $localHead") [void]$sb.AppendLine("- Tag Local Recente: $latestLocalTag") [void]$sb.AppendLine("") [void]$sb.AppendLine("---") [void]$sb.AppendLine("") [void]$sb.AppendLine("## 1. Estado da Branch Principal (Upstream Main)") [void]$sb.AppendLine("") [void]$sb.AppendLine("- Commit Upstream Main: $upstreamMain") [void]$sb.AppendLine("- Commits a frente no upstream: $newCommitCount") [void]$sb.AppendLine("- Ultima Tag Upstream: $latestUpstreamTag") [void]$sb.AppendLine("") [void]$sb.AppendLine("### Commits Recentes no Upstream:") [void]$sb.AppendLine('```') [void]$sb.AppendLine($commitsBlock) [void]$sb.AppendLine('```') [void]$sb.AppendLine("") [void]$sb.AppendLine("---") [void]$sb.AppendLine("") [void]$sb.AppendLine("## 2. Dependencia Central (Whatsmeow)") [void]$sb.AppendLine("") [void]$sb.AppendLine("- Versao Whatsmeow no go.mod local: $localWhatsmeow") [void]$sb.AppendLine("") [void]$sb.AppendLine("---") [void]$sb.AppendLine("") [void]$sb.AppendLine("## 3. Analise de Impacto e Conflitos") [void]$sb.AppendLine("") [void]$sb.AppendLine($impactNotice) [void]$sb.AppendLine("") [void]$sb.AppendLine("---") [void]$sb.AppendLine("*Relatorio gerado pelo script de monitoramento EvoGO.*") [System.IO.File]::WriteAllText((Join-Path (Get-Location) $reportFile), $sb.ToString(), [System.Text.Encoding]::UTF8) Write-Host "Relatorio gerado com sucesso em: $reportFile" Get-Content $reportFile