ENHACE function Copy-FilesContent { param ( [string]$Directory, [string]$OutputFile )…
- User
ENHACE function Copy-FilesContent { param ( [string]OutputFile )
# Clear output file if it exists if (Test-Path -Path $OutputFile) { try { Remove-Item -Path $OutputFile -Force } catch { Write-Output "Error deleting $($OutputFile): $($_.Exception.Message)" return } } try { New-Item -Path $OutputFile -ItemType File -Force | Out-Null } catch { Write-Output "Error creating $($OutputFile): $($_.Exception.Message)" return } # Include package.json, tsconfig, and eslint files first $packageJsonPath = Join-Path -Path $Directory -ChildPath "package.json" $tsconfigPath = Join-Path -Path $Directory -ChildPath "tsconfig.json" $eslintPath = Join-Path -Path $Directory -ChildPath ".eslintrc.json" if (Test-Path -Path $packageJsonPath) { Add-Content -Path $OutputFile -Value "`n`n// $packageJsonPath" $packageJsonContent = Get-Content -Path $packageJsonPath -Raw Add-Content -Path $OutputFile -Value $packageJsonContent } if (Test-Path -Path $tsconfigPath) { Add-Content -Path $OutputFile -Value "`n`n// $tsconfigPath" $tsconfigContent = Get-Content -Path $tsconfigPath -Raw Add-Content -Path $OutputFile -Value $tsconfigContent } if (Test-Path -Path $eslintPath) { Add-Content -Path $OutputFile -Value "`n`n// $eslintPath" $eslintContent = Get-Content -Path $eslintPath -Raw Add-Content -Path $OutputFile -Value $eslintContent } # Loop through files and directories recursively Get-ChildItem -Path $Directory -Recurse | ForEach-Object { $file = $_.FullName $extension = [System.IO.Path]::GetExtension($file) # Exclude specific file types and directories if ($extension -match "\.(ico|jpg|jpeg|png|svg|bmp|gif|db|gz)" -or $file -like "*node_modules*" -or $file -like "*settings.json" -or $file -like "*.next*" -or $file -like "*ssr*" -or $file -like "*vendor-chunks*" -or $file -like "*next.config.js" -or $file -like "*package-lock.json") { Write-Output "Skipping file: $file" return } # Include text-based file types if ($extension -in @(".tsx", ".js", ".ts", ".config.mjs", ".json", ".alo")) { try { Add-Content -Path $OutputFile -Value "`n`n// $file" $fileContent = Get-Content -Path $file -Raw | Where-Object { $_ -notmatch 'node_modules' -and $_ -notmatch 'webpack' } Add-Content -Path $OutputFile -Value $fileContent } catch { Write-Output "Error writing to $($OutputFile): $($_.Exception.Message)" return } } } - Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.