11param (
2- [string ]$RepoRoot = (Resolve-Path (Join-Path $PSScriptRoot " ..\\ .." )).Path
2+ [string ]$RepoRoot = (Resolve-Path (Join-Path ( Join-Path $PSScriptRoot " .." ) " .." )).Path
33)
44
55$ErrorActionPreference = " Stop"
@@ -22,7 +22,29 @@ function Add-Finding {
2222 Rule = $Rule
2323 File = $File
2424 Message = $Message
25- })
25+ })
26+ }
27+
28+ function Resolve-RepoPath {
29+ param ([string ]$RelativePath )
30+
31+ $normalized = $RelativePath -replace ' [\\/]' , [IO.Path ]::DirectorySeparatorChar
32+ $candidate = Join-Path $RepoRoot $normalized
33+
34+ if (Test-Path - LiteralPath $candidate ) {
35+ return (Resolve-Path - LiteralPath $candidate ).Path
36+ }
37+
38+ # Compatibility fallback for legacy and alternate layouts.
39+ if ($RelativePath -like " lib/McpServer/*" ) {
40+ $altRelative = $RelativePath -replace ' ^lib[\\/]' , ' '
41+ $altCandidate = Join-Path $RepoRoot $altRelative
42+ if (Test-Path - LiteralPath $altCandidate ) {
43+ return (Resolve-Path - LiteralPath $altCandidate ).Path
44+ }
45+ }
46+
47+ return $null
2648}
2749
2850function Get-XmlPackageVersion {
@@ -61,8 +83,8 @@ function Assert-PackageVersion {
6183 [string ]$ExpectedVersion
6284 )
6385
64- $fullPath = Join-Path $RepoRoot $ProjectRelativePath
65- if (-not (Test-Path - LiteralPath $fullPath )) {
86+ $fullPath = Resolve-RepoPath - RelativePath $ProjectRelativePath
87+ if (-not $fullPath -or -not (Test-Path - LiteralPath $fullPath )) {
6688 Add-Finding - Rule $Rule - File $ProjectRelativePath - Message " Required file not found."
6789 return
6890 }
0 commit comments