- diag_actualizare.ps1: de ce s-a oprit actualizarea (UPD_ISTORIC, UPD_LOG, script_master.log prin UTL_FILE, versiuni per schema, spatiu tablespace, verdict) - diag_spatiu.ps1: spatiu Oracle la clienti (tablespace, audit, ADR, FRA, disc server) - livrare.ps1: git_sync + curatenie + verificari + commit/push - curatenie.ps1: sterge si docs\propuneri_*.md - docs: depanare-spatiu-oracle.md nou, depanare-pack-update.md completat cu cazul SIGMA Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014sNn6dmAimtyXkDU4frJrh
74 lines
3.3 KiB
PowerShell
74 lines
3.3 KiB
PowerShell
# curatenie.ps1 - sterge artefactele de lucru dinaintea unui commit (regula 1 din COMUN\docs\reguli_lucru.md).
|
|
# Sterge DOAR fisiere neurmarite de git; orice fisier tracked (in proiect sau in COMUN) e sarit.
|
|
# Utilizare:
|
|
# powershell -File COMUN\utile\curatenie.ps1 # curata proiectul si cache-ul text
|
|
# powershell -File COMUN\utile\curatenie.ps1 -DryRun # doar listeaza ce ar sterge
|
|
param(
|
|
[string]$ProjectRoot,
|
|
[string]$CacheRoot,
|
|
[switch]$DryRun
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
if (-not $ProjectRoot) { $ProjectRoot = Split-Path (Split-Path $PSScriptRoot -Parent) -Parent }
|
|
$comun = Join-Path $ProjectRoot 'COMUN'
|
|
if (-not $CacheRoot) {
|
|
$CacheRoot = Join-Path (Split-Path $ProjectRoot -Parent) ('_vfp_textcache\' + (Split-Path $ProjectRoot -Leaf).ToLower())
|
|
}
|
|
|
|
# fisierele urmarite de git (proiect + COMUN) - lista de protectie
|
|
$tracked = New-Object 'System.Collections.Generic.HashSet[string]' ([StringComparer]::OrdinalIgnoreCase)
|
|
foreach ($repo in @($ProjectRoot, $comun)) {
|
|
if (-not (Test-Path (Join-Path $repo '.git'))) { continue }
|
|
foreach ($f in (& git -C $repo ls-files)) {
|
|
[void]$tracked.Add((Join-Path $repo ($f -replace '/', '\')))
|
|
}
|
|
}
|
|
|
|
$tinte = New-Object System.Collections.ArrayList
|
|
|
|
function Adauga($cale, $tipare, $recursiv, $director) {
|
|
if (-not (Test-Path $cale)) { return }
|
|
$p = @{ Include = $tipare; ErrorAction = 'SilentlyContinue' }
|
|
if ($recursiv) { $p['Path'] = $cale; $p['Recurse'] = $true } else { $p['Path'] = (Join-Path $cale '*') }
|
|
foreach ($it in (Get-ChildItem @p)) {
|
|
if ($director -ne $it.PSIsContainer) { continue }
|
|
if ($tracked.Contains($it.FullName)) { continue }
|
|
[void]$tinte.Add($it)
|
|
}
|
|
}
|
|
|
|
$docs = Join-Path $ProjectRoot 'docs'
|
|
$teste = @((Join-Path $comun 'utile\Teste'), (Join-Path $ProjectRoot 'utile\Teste')) | Where-Object { Test-Path $_ }
|
|
|
|
# patch-uri de review, handoff-uri, planuri de runda, propuneri implementate
|
|
Adauga $docs @('diff_runda*.patch', 'handoff*.md', 'plan_runda*.md', 'runda*.md', 'propuneri_*.md') $false $false
|
|
# backup-uri de runda si de cache text
|
|
Adauga $ProjectRoot @('*.pre_runda*.bak') $true $false
|
|
Adauga $CacheRoot @('*.pre_runda*.bak', '*.vc2.bak', '*.sc2.bak') $true $false
|
|
# artefacte din rulari de test
|
|
foreach ($t in $teste) {
|
|
Adauga $t @('screenshots*', 'uisync*') $true $true
|
|
Adauga $t @('*.fxp', '*.err', '*.log', '*_log.txt', 'bash.exe.stackdump') $true $false
|
|
}
|
|
Adauga $ProjectRoot @('bash.exe.stackdump') $false $false
|
|
|
|
# directoarele inglobate in alt director-tinta se sterg oricum odata cu parintele
|
|
$dir = @($tinte | Where-Object { $_.PSIsContainer } | ForEach-Object { $_.FullName + '\' })
|
|
$lista = @($tinte | Where-Object { $f = $_.FullName; -not ($dir | Where-Object { $f.StartsWith($_, 'OrdinalIgnoreCase') }) })
|
|
|
|
if ($lista.Count -eq 0) { Write-Output 'curatenie: nimic de sters'; exit 0 }
|
|
|
|
foreach ($it in ($lista | Sort-Object FullName)) {
|
|
$eticheta = $it.FullName.Replace($ProjectRoot + '\', '').Replace($CacheRoot + '\', 'cache\')
|
|
if ($it.PSIsContainer) { $eticheta = $eticheta + '\' }
|
|
if ($DryRun) {
|
|
Write-Output (' ar sterge ' + $eticheta)
|
|
} else {
|
|
Remove-Item -LiteralPath $it.FullName -Recurse -Force
|
|
Write-Output (' sters ' + $eticheta)
|
|
}
|
|
}
|
|
Write-Output ('curatenie: ' + $lista.Count + ' intrari')
|