From e3e47bd5659be22401728053a35ec43d7a3cf95a Mon Sep 17 00:00:00 2001 From: Nimraakram22 Date: Mon, 20 Apr 2026 22:28:59 +0500 Subject: [PATCH 1/3] fix(powershell): strip BOM from templates and ensure No-BOM output --- scripts/powershell/create-new-feature.ps1 | 5 ++++- scripts/powershell/setup-plan.ps1 | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/powershell/create-new-feature.ps1 b/scripts/powershell/create-new-feature.ps1 index 2f23283fc4..11441a34ca 100644 --- a/scripts/powershell/create-new-feature.ps1 +++ b/scripts/powershell/create-new-feature.ps1 @@ -350,7 +350,10 @@ if (-not $DryRun) { if (-not (Test-Path -PathType Leaf $specFile)) { $template = Resolve-Template -TemplateName 'spec-template' -RepoRoot $repoRoot if ($template -and (Test-Path $template)) { - Copy-Item $template $specFile -Force + # Read the template content and write it to the spec file with UTF-8 encoding without BOM + $content = Get-Content -Raw -Path $template + $Utf8NoBom = New-Object System.Text.UTF8Encoding($false) + [System.IO.File]::WriteAllText($specFile, $content, $Utf8NoBom) } else { New-Item -ItemType File -Path $specFile -Force | Out-Null } diff --git a/scripts/powershell/setup-plan.ps1 b/scripts/powershell/setup-plan.ps1 index ee09094bf7..1c57612cd4 100644 --- a/scripts/powershell/setup-plan.ps1 +++ b/scripts/powershell/setup-plan.ps1 @@ -34,7 +34,10 @@ New-Item -ItemType Directory -Path $paths.FEATURE_DIR -Force | Out-Null # Copy plan template if it exists, otherwise note it or create empty file $template = Resolve-Template -TemplateName 'plan-template' -RepoRoot $paths.REPO_ROOT if ($template -and (Test-Path $template)) { - Copy-Item $template $paths.IMPL_PLAN -Force + # Read the template content and write it to the implementation plan file with UTF-8 encoding without BOM + $content = Get-Content -Raw -Path $template + $Utf8NoBom = New-Object System.Text.UTF8Encoding($false) +[System.IO.File]::WriteAllText($paths.IMPL_PLAN, $content, $Utf8NoBom) Write-Output "Copied plan template to $($paths.IMPL_PLAN)" } else { Write-Warning "Plan template not found" From a6cbcad4fb63718661ee97c769b36112397f7738 Mon Sep 17 00:00:00 2001 From: Nimraakram22 Date: Tue, 21 Apr 2026 22:51:40 +0500 Subject: [PATCH 2/3] fix: address review feedback on encoding and naming for all ps scripts --- scripts/powershell/create-new-feature.ps1 | 6 +++--- scripts/powershell/setup-plan.ps1 | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/powershell/create-new-feature.ps1 b/scripts/powershell/create-new-feature.ps1 index 11441a34ca..bf2c9ffdc7 100644 --- a/scripts/powershell/create-new-feature.ps1 +++ b/scripts/powershell/create-new-feature.ps1 @@ -351,9 +351,9 @@ if (-not $DryRun) { $template = Resolve-Template -TemplateName 'spec-template' -RepoRoot $repoRoot if ($template -and (Test-Path $template)) { # Read the template content and write it to the spec file with UTF-8 encoding without BOM - $content = Get-Content -Raw -Path $template - $Utf8NoBom = New-Object System.Text.UTF8Encoding($false) - [System.IO.File]::WriteAllText($specFile, $content, $Utf8NoBom) + $content = Get-Content -Raw -Encoding UTF8 -Path $template + $utf8NoBom = New-Object System.Text.UTF8Encoding($false) + [System.IO.File]::WriteAllText($targetPath, $content, $utf8NoBom) } else { New-Item -ItemType File -Path $specFile -Force | Out-Null } diff --git a/scripts/powershell/setup-plan.ps1 b/scripts/powershell/setup-plan.ps1 index 1c57612cd4..913fd2a9e9 100644 --- a/scripts/powershell/setup-plan.ps1 +++ b/scripts/powershell/setup-plan.ps1 @@ -35,9 +35,10 @@ New-Item -ItemType Directory -Path $paths.FEATURE_DIR -Force | Out-Null $template = Resolve-Template -TemplateName 'plan-template' -RepoRoot $paths.REPO_ROOT if ($template -and (Test-Path $template)) { # Read the template content and write it to the implementation plan file with UTF-8 encoding without BOM - $content = Get-Content -Raw -Path $template - $Utf8NoBom = New-Object System.Text.UTF8Encoding($false) -[System.IO.File]::WriteAllText($paths.IMPL_PLAN, $content, $Utf8NoBom) + # Read the template content as UTF-8 and write it to the implementation plan file with UTF-8 encoding without BOM + $content = Get-Content -Raw -Encoding UTF8 -Path $template + $utf8NoBom = New-Object System.Text.UTF8Encoding($false) + [System.IO.File]::WriteAllText($paths.IMPL_PLAN, $content, $utf8NoBom) Write-Output "Copied plan template to $($paths.IMPL_PLAN)" } else { Write-Warning "Plan template not found" From 059adbc404670d3d6ac96d4dbc2393d9aecfc34e Mon Sep 17 00:00:00 2001 From: Nimraakram22 Date: Wed, 22 Apr 2026 00:00:36 +0500 Subject: [PATCH 3/3] fix: address copilot feedback (encoding detection and variable naming) --- scripts/powershell/create-new-feature.ps1 | 4 ++-- scripts/powershell/setup-plan.ps1 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/powershell/create-new-feature.ps1 b/scripts/powershell/create-new-feature.ps1 index bf2c9ffdc7..2835c3ee4e 100644 --- a/scripts/powershell/create-new-feature.ps1 +++ b/scripts/powershell/create-new-feature.ps1 @@ -351,9 +351,9 @@ if (-not $DryRun) { $template = Resolve-Template -TemplateName 'spec-template' -RepoRoot $repoRoot if ($template -and (Test-Path $template)) { # Read the template content and write it to the spec file with UTF-8 encoding without BOM - $content = Get-Content -Raw -Encoding UTF8 -Path $template + $content = [System.IO.File]::ReadAllText($template) $utf8NoBom = New-Object System.Text.UTF8Encoding($false) - [System.IO.File]::WriteAllText($targetPath, $content, $utf8NoBom) + [System.IO.File]::WriteAllText($specFile, $content, $utf8NoBom) } else { New-Item -ItemType File -Path $specFile -Force | Out-Null } diff --git a/scripts/powershell/setup-plan.ps1 b/scripts/powershell/setup-plan.ps1 index 913fd2a9e9..0dcb4f81e1 100644 --- a/scripts/powershell/setup-plan.ps1 +++ b/scripts/powershell/setup-plan.ps1 @@ -36,10 +36,10 @@ $template = Resolve-Template -TemplateName 'plan-template' -RepoRoot $paths.REPO if ($template -and (Test-Path $template)) { # Read the template content and write it to the implementation plan file with UTF-8 encoding without BOM # Read the template content as UTF-8 and write it to the implementation plan file with UTF-8 encoding without BOM - $content = Get-Content -Raw -Encoding UTF8 -Path $template + # Read the template content and write it to the implementation plan file with UTF-8 encoding without BOM + $content = [System.IO.File]::ReadAllText($template) $utf8NoBom = New-Object System.Text.UTF8Encoding($false) [System.IO.File]::WriteAllText($paths.IMPL_PLAN, $content, $utf8NoBom) - Write-Output "Copied plan template to $($paths.IMPL_PLAN)" } else { Write-Warning "Plan template not found" # Create a basic plan file if template doesn't exist