Update Context Generator to Add Suppot for Dest Folder Recieving ...

This commit is contained in:
2026-08-07 20:32:31 +03:30
parent d3721d02ce
commit 2728c08eb1
2 changed files with 75 additions and 9 deletions
+40 -4
View File
@@ -1,9 +1,45 @@
Get-ChildItem -Recurse -File -Include Dockerfile,docker-compose.yaml,*.cs |
param(
[Parameter(Position = 0)]
[string]$Path
)
$timestamp = Get-Date -Format 'yyyyMMdd_HHmmss'
if ([string]::IsNullOrWhiteSpace($Path)) {
# If no path is provided, use current path
$searchPath = (Get-Location).Path
$outputFile = ".\xDashboard-$timestamp.txt"
}
else {
if (-not (Test-Path -LiteralPath $Path -PathType Container)) {
throw "Path '$Path' is not a directory."
}
# Resolve path
$searchPath = (Resolve-Path -LiteralPath $Path).Path
# Get last folder of the path
$lastFolder = Split-Path -Path $searchPath -Leaf
# Make folder name safe for file name
$safeLastFolder = $lastFolder -replace '[\\/:*?"<>|]', '_'
$outputFile = ".\xDashboard-$safeLastFolder-$timestamp.txt"
}
Get-ChildItem -LiteralPath $searchPath -Recurse -File |
Where-Object {
$_.DirectoryName -notmatch '\\(bin|obj)(\\|$)'
$_.Name -eq 'Dockerfile' -or
$_.Name -eq 'docker-compose.yaml' -or
$_.Extension -eq '.cs'
} |
Where-Object {
$_.FullName -notmatch '[\\/](bin|obj)([\\/]|$)'
} |
ForEach-Object {
"`n### FILE: $($_.FullName)`n"
Get-Content $_.FullName
Get-Content -LiteralPath $_.FullName
} |
Out-File ".\xDashboard-$(Get-Date -Format 'yyyyMMdd_HHmmss').txt" -Encoding utf8
Out-File -FilePath $outputFile -Encoding utf8
Write-Host "Context generated: $outputFile"