# Fix project references in src/__Tests/** that point to wrong relative paths # Pattern: ../..//... should be ../../..//... $ErrorActionPreference = "Stop" $testsPath = "E:\dev\git.stella-ops.org\src\__Tests" # Known module prefixes that exist at src// $modules = @("Signals", "Scanner", "Concelier", "Scheduler", "Authority", "Attestor", "BinaryIndex", "EvidenceLocker", "Excititor", "ExportCenter", "Gateway", "Graph", "IssuerDirectory", "Notify", "Orchestrator", "Policy", "AirGap", "Provenance", "Replay", "RiskEngine", "SbomService", "Signer", "TaskRunner", "Telemetry", "TimelineIndexer", "Unknowns", "VexHub", "VexLens", "VulnExplorer", "Zastava", "Cli", "Aoc", "Web", "Bench", "Cryptography", "PacksRegistry", "Notifier", "Findings") $fixedCount = 0 Get-ChildItem -Path $testsPath -Recurse -Filter "*.csproj" | ForEach-Object { $proj = $_ $content = Get-Content $proj.FullName -Raw $originalContent = $content foreach ($module in $modules) { # Fix ../..// to ../../..// # But not ../../../ (already correct) $pattern = "Include=`"../../$module/" $replacement = "Include=`"../../../$module/" if ($content -match [regex]::Escape($pattern) -and $content -notmatch [regex]::Escape("Include=`"../../../$module/")) { $content = $content -replace [regex]::Escape($pattern), $replacement } } # Fix __Libraries references that are one level short $content = $content -replace 'Include="../../__Libraries/', 'Include="../../../__Libraries/' if ($content -ne $originalContent) { Set-Content -Path $proj.FullName -Value $content -NoNewline Write-Host "Fixed: $($proj.Name)" -ForegroundColor Green $fixedCount++ } } Write-Host "`nFixed $fixedCount projects" -ForegroundColor Cyan