Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/powershell/create-new-feature.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +353 to +354
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows PowerShell 5.1, Get-Content without -Encoding will treat UTF-8 without BOM as the system ANSI code page, which can corrupt non-ASCII characters in templates. Since you're normalizing output to UTF-8 no BOM, please also read the template using an explicit UTF-8 encoding (e.g., Get-Content -Raw -Encoding UTF8 or .NET ReadAllText).

This issue also appears on line 355 of the same file.

Suggested change
# Read the template content and write it to the spec file with UTF-8 encoding without BOM
$content = Get-Content -Raw -Path $template
# Read the template content as UTF-8 and write it to the spec file with UTF-8 encoding without BOM
$content = Get-Content -Raw -Encoding UTF8 -Path $template

Copilot uses AI. Check for mistakes.
$Utf8NoBom = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::WriteAllText($specFile, $content, $Utf8NoBom)
} else {
New-Item -ItemType File -Path $specFile -Force | Out-Null
}
Expand Down
5 changes: 4 additions & 1 deletion scripts/powershell/setup-plan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Comment on lines +37 to +40
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows PowerShell 5.1, Get-Content without -Encoding will treat UTF-8 without BOM as the system ANSI code page, which can corrupt non-ASCII characters in templates (especially now that templates are expected to be UTF-8 no BOM). Read with an explicit UTF-8 encoding (e.g., Get-Content -Raw -Encoding UTF8 or a .NET ReadAllText overload) before writing.

This issue also appears on line 39 of the same file.

Suggested change
# 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)

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[System.IO.File]::WriteAllText(...) is not indented like the rest of the if block, which makes the block harder to read and looks accidental. Please align its indentation with the surrounding statements.

Suggested change
[System.IO.File]::WriteAllText($paths.IMPL_PLAN, $content, $Utf8NoBom)
[System.IO.File]::WriteAllText($paths.IMPL_PLAN, $content, $Utf8NoBom)

Copilot uses AI. Check for mistakes.
Write-Output "Copied plan template to $($paths.IMPL_PLAN)"
} else {
Write-Warning "Plan template not found"
Expand Down