@@ -178,6 +178,83 @@ if ($allPresent -and $expectedFiles.Count -gt 0) {
178178 Write-Host " All built files present" - ForegroundColor Green
179179}
180180
181+ # =============================================================================
182+ # Check for unexpected files in output directory
183+ # =============================================================================
184+ Write-Host " [Cleanup] Checking for unexpected files..." - ForegroundColor Yellow
185+
186+ $allowedFiles = @ (
187+ ' PowerShell.MCP.dll' ,
188+ ' PowerShell.MCP.psd1' ,
189+ ' PowerShell.MCP.psm1' ,
190+ ' Ude.NetStandard.dll'
191+ )
192+
193+ $allowedDirs = @ (
194+ ' bin' ,
195+ ' en-US'
196+ )
197+
198+ $unexpectedItems = @ ()
199+
200+ # Check root level files
201+ Get-ChildItem $OutputBase - File | ForEach-Object {
202+ if ($_.Name -notin $allowedFiles ) {
203+ $unexpectedItems += $_.Name
204+ }
205+ }
206+
207+ # Check root level directories
208+ Get-ChildItem $OutputBase - Directory | ForEach-Object {
209+ if ($_.Name -notin $allowedDirs ) {
210+ $unexpectedItems += " $ ( $_.Name ) \"
211+ }
212+ }
213+
214+ # Check bin directory structure
215+ $binPath = Join-Path $OutputBase ' bin'
216+ if (Test-Path $binPath ) {
217+ $allowedPlatforms = @ (' win-x64' , ' linux-x64' , ' osx-x64' , ' osx-arm64' )
218+
219+ Get-ChildItem $binPath - Directory | ForEach-Object {
220+ if ($_.Name -notin $allowedPlatforms ) {
221+ $unexpectedItems += " bin\$ ( $_.Name ) \"
222+ }
223+ }
224+
225+ # Check each platform directory
226+ foreach ($platform in $allowedPlatforms ) {
227+ $platformPath = Join-Path $binPath $platform
228+ if (Test-Path $platformPath ) {
229+ $expectedExe = if ($platform -like ' win-*' ) { ' PowerShell.MCP.Proxy.exe' } else { ' PowerShell.MCP.Proxy' }
230+ Get-ChildItem $platformPath - File | ForEach-Object {
231+ if ($_.Name -ne $expectedExe ) {
232+ $unexpectedItems += " bin\$platform \$ ( $_.Name ) "
233+ }
234+ }
235+ }
236+ }
237+ }
238+
239+ # Check en-US directory
240+ $enUSPath = Join-Path $OutputBase ' en-US'
241+ if (Test-Path $enUSPath ) {
242+ Get-ChildItem $enUSPath - File | ForEach-Object {
243+ if ($_.Name -ne ' PowerShell.MCP.dll-Help.xml' ) {
244+ $unexpectedItems += " en-US\$ ( $_.Name ) "
245+ }
246+ }
247+ }
248+
249+ if ($unexpectedItems.Count -gt 0 ) {
250+ Write-Warning " Unexpected files found in output directory:"
251+ foreach ($item in $unexpectedItems ) {
252+ Write-Warning " - $item "
253+ }
254+ Write-Host " Consider removing these before publishing." - ForegroundColor Yellow
255+ } else {
256+ Write-Host " No unexpected files found" - ForegroundColor Green
257+ }
181258Write-Host " "
182259Write-Host " ========================================" - ForegroundColor Cyan
183260Write-Host " Build completed successfully!" - ForegroundColor Cyan
0 commit comments