[GH-ISSUE #87] bug: check-complete.ps1 fails to parse — UTF-8 em-dash in comment breaks PowerShell #49

Closed
opened 2026-03-03 18:50:16 +03:00 by kerem · 1 comment
Owner

Originally created by @raykuo998 on GitHub (Feb 27, 2026).
Original GitHub issue: https://github.com/OthmanAdi/planning-with-files/issues/87

Description

check-complete.ps1 fails to parse on PowerShell due to a UTF-8 em-dash (, U+2014, bytes E2 80 94) in a comment on line 32:

# Report status (always exit 0 — incomplete task is a normal state)

PowerShell's parser chokes on the em-dash and misinterprets the closing ) in the comment as part of the code, producing:

At check-complete.ps1:9 char:33
+ if (-not (Test-Path $PlanFile)) {
+                                 ~
Missing closing '}' in statement block or type definition.
At check-complete.ps1:32 char:69
+ # Report status (always exit 0 — incomplete task is a normal state)
+                                                                     ~
Unexpected token ')' in expression or statement.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingEndCurlyBrace

The same em-dash exists in check-complete.sh line 34, but bash handles it fine.

Reproduction

powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:/Users/<user>/.claude/skills/planning-with-files/scripts/check-complete.ps1"

Environment

  • Windows 11, PowerShell 5.1 (ships with Windows)
  • check-complete.ps1 is UTF-8 encoded (no BOM)

Fix

Replace the em-dash with a plain ASCII double-hyphen in check-complete.ps1 line 32:

-# Report status (always exit 0 — incomplete task is a normal state)
+# Report status (always exit 0 -- incomplete task is a normal state)

Also worth auditing init-session.ps1 for the same issue.

Context

Found while testing #86. The fallback chain (powershell.exe ... || sh ...) masks this bug since PowerShell fails silently and sh takes over, but check-complete.ps1 is currently non-functional.

Originally created by @raykuo998 on GitHub (Feb 27, 2026). Original GitHub issue: https://github.com/OthmanAdi/planning-with-files/issues/87 ## Description `check-complete.ps1` fails to parse on PowerShell due to a UTF-8 em-dash (`—`, U+2014, bytes `E2 80 94`) in a comment on line 32: ```powershell # Report status (always exit 0 — incomplete task is a normal state) ``` PowerShell's parser chokes on the em-dash and misinterprets the closing `)` in the comment as part of the code, producing: ``` At check-complete.ps1:9 char:33 + if (-not (Test-Path $PlanFile)) { + ~ Missing closing '}' in statement block or type definition. At check-complete.ps1:32 char:69 + # Report status (always exit 0 — incomplete task is a normal state) + ~ Unexpected token ')' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingEndCurlyBrace ``` The same em-dash exists in `check-complete.sh` line 34, but bash handles it fine. ## Reproduction ```powershell powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:/Users/<user>/.claude/skills/planning-with-files/scripts/check-complete.ps1" ``` ## Environment - Windows 11, PowerShell 5.1 (ships with Windows) - `check-complete.ps1` is UTF-8 encoded (no BOM) ## Fix Replace the em-dash with a plain ASCII double-hyphen in `check-complete.ps1` line 32: ```diff -# Report status (always exit 0 — incomplete task is a normal state) +# Report status (always exit 0 -- incomplete task is a normal state) ``` Also worth auditing `init-session.ps1` for the same issue. ## Context Found while testing #86. The fallback chain (`powershell.exe ... || sh ...`) masks this bug since PowerShell fails silently and `sh` takes over, but `check-complete.ps1` is currently non-functional.
kerem closed this issue 2026-03-03 18:50:17 +03:00
Author
Owner

@raykuo998 commented on GitHub (Feb 27, 2026):

Full Fix

The em-dash was just the first parse error. Once fixed, PowerShell hits additional parsing failures from special characters inside double-quoted strings:

  1. [planning-with-files][ is interpreted as array index syntax
  2. ($COMPLETE/$TOTAL phases complete)() is interpreted as a subexpression, then phases is an unexpected token
  3. phase(s) — same subexpression issue

Error after em-dash-only fix

At check-complete.ps1:36 char:18
+     Write-Host "[planning-with-files] Task in progress ($COMPLETE/$TO ...
+                  ~
Array index expression is missing or not valid.
...
    + FullyQualifiedErrorId : MissingArrayIndexExpression

Complete fix

Replace all double-quoted Write-Host strings with single-quoted strings + concatenation:

# Before (broken)
Write-Host "[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL)"
Write-Host "[planning-with-files] Task in progress ($COMPLETE/$TOTAL phases complete)"
Write-Host "[planning-with-files] $IN_PROGRESS phase(s) still in progress."
Write-Host "[planning-with-files] $PENDING phase(s) pending."
Write-Host "[planning-with-files] No task_plan.md found — no active planning session."

# After (working)
Write-Host ('[planning-with-files] ALL PHASES COMPLETE (' + $COMPLETE + '/' + $TOTAL + ')')
Write-Host ('[planning-with-files] Task in progress (' + $COMPLETE + '/' + $TOTAL + ' phases complete)')
Write-Host ('[planning-with-files] ' + $IN_PROGRESS + ' phase(s) still in progress.')
Write-Host ('[planning-with-files] ' + $PENDING + ' phase(s) pending.')
Write-Host '[planning-with-files] No task_plan.md found -- no active planning session.'

Also replaced em-dashes () with -- in comments and output strings.

Verified on Windows 11

All scenarios pass after the full fix:

--- In-progress plan ---
[planning-with-files] Task in progress (1/3 phases complete)
[planning-with-files] 1 phase(s) still in progress.
[planning-with-files] 1 phase(s) pending.
Exit code: 0

--- All-complete plan ---
[planning-with-files] ALL PHASES COMPLETE (3/3)
Exit code: 0

--- No plan file ---
[planning-with-files] No task_plan.md found -- no active planning session.
Exit code: 0

--- Inline [complete] format ---
[planning-with-files] Task in progress (1/2 phases complete)
[planning-with-files] 1 phase(s) still in progress.
Exit code: 0

init-session.ps1 was also checked — it's clean (no special characters in interpolated strings).

<!-- gh-comment-id:3971473622 --> @raykuo998 commented on GitHub (Feb 27, 2026): ## Full Fix The em-dash was just the first parse error. Once fixed, PowerShell hits additional parsing failures from special characters inside double-quoted strings: 1. **`[planning-with-files]`** — `[` is interpreted as array index syntax 2. **`($COMPLETE/$TOTAL phases complete)`** — `()` is interpreted as a subexpression, then `phases` is an unexpected token 3. **`phase(s)`** — same subexpression issue ### Error after em-dash-only fix ``` At check-complete.ps1:36 char:18 + Write-Host "[planning-with-files] Task in progress ($COMPLETE/$TO ... + ~ Array index expression is missing or not valid. ... + FullyQualifiedErrorId : MissingArrayIndexExpression ``` ### Complete fix Replace all double-quoted `Write-Host` strings with single-quoted strings + concatenation: ```powershell # Before (broken) Write-Host "[planning-with-files] ALL PHASES COMPLETE ($COMPLETE/$TOTAL)" Write-Host "[planning-with-files] Task in progress ($COMPLETE/$TOTAL phases complete)" Write-Host "[planning-with-files] $IN_PROGRESS phase(s) still in progress." Write-Host "[planning-with-files] $PENDING phase(s) pending." Write-Host "[planning-with-files] No task_plan.md found — no active planning session." # After (working) Write-Host ('[planning-with-files] ALL PHASES COMPLETE (' + $COMPLETE + '/' + $TOTAL + ')') Write-Host ('[planning-with-files] Task in progress (' + $COMPLETE + '/' + $TOTAL + ' phases complete)') Write-Host ('[planning-with-files] ' + $IN_PROGRESS + ' phase(s) still in progress.') Write-Host ('[planning-with-files] ' + $PENDING + ' phase(s) pending.') Write-Host '[planning-with-files] No task_plan.md found -- no active planning session.' ``` Also replaced em-dashes (`—`) with `--` in comments and output strings. ### Verified on Windows 11 All scenarios pass after the full fix: ``` --- In-progress plan --- [planning-with-files] Task in progress (1/3 phases complete) [planning-with-files] 1 phase(s) still in progress. [planning-with-files] 1 phase(s) pending. Exit code: 0 --- All-complete plan --- [planning-with-files] ALL PHASES COMPLETE (3/3) Exit code: 0 --- No plan file --- [planning-with-files] No task_plan.md found -- no active planning session. Exit code: 0 --- Inline [complete] format --- [planning-with-files] Task in progress (1/2 phases complete) [planning-with-files] 1 phase(s) still in progress. Exit code: 0 ``` `init-session.ps1` was also checked — it's clean (no special characters in interpolated strings).
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/planning-with-files#49
No description provided.