Skip to content

v2.0.0 — PowerShell 7 required, UTF-8 BOMs on all .ps1

Latest

Choose a tag to compare

@aweussom aweussom released this 18 Aug 11:20
· 1 commit to main since this release

Breaking: Windows PowerShell 5.1 is no longer supported

pwsh 7+ only on Windows. Every entry point now carries #Requires -Version 7.0
and refuses to run under 5.1 instead of degrading.

If your statusline currently runs under powershell.exe, it will stop working
after this upgrade.
Fix it by pointing ~/.claude/settings.json at pwsh:

{
  "statusLine": {
    "type": "command",
    "command": "pwsh -NoProfile -NonInteractive -ExecutionPolicy Bypass -File C:/Users/<you>/.claude/statusline.ps1"
  }
}

install.ps1 now writes that automatically, and warns if it finds a
powershell-launched command already in place.

Linux/WSL2 is unaffected.

The bug this started from

install.ps1 failed to parse under 5.1 with four bogus Missing closing '}'
errors, none of them near the real cause:

At install.ps1:168 char:46
+ if (Test-Path $statuslineDst -PathType Leaf) {
Missing closing '}' in statement block or type definition.

The files were UTF-8 without a BOM. 5.1 cannot detect UTF-8 without one, so
it decoded them as ANSI — and an em-dash (E2 80 94) became †plus
U+201D, which PowerShell accepts as a string delimiter. The string closed
early, the parser desynced, and it reported the last good construct before each
desync rather than the actual line.

statusline.ps1.template had the quieter form of the same bug: its markers
are in emitted strings, so 5.1 printed mojibake instead of erroring.

Changes

  • UTF-8 BOM on all PowerShell files. This had to come first — the whole file is
    parsed before #Requires is evaluated, so without a BOM no version gate could
    ever fire.
  • #Requires -Version 7.0 on install.ps1, statusline.ps1.template, and
    _quota-fetch-helper.ps1.
  • install.ps1 exits 1 if not on 7+, and separately if pwsh is missing from
    PATH — Claude Code launches the statusline as pwsh ..., so resolving in
    the installing shell is not enough.
  • Both powershell.exe fallbacks removed. quota-lib.ps1 relaunches its
    background worker via [Environment]::ProcessPath — the pwsh already running
    it — rather than searching PATH. A 5.1 worker would write a mis-encoded cache
    that every other session then reads.
  • New tests/test-quota-lib.ps1: BOMs, #Requires on entry points, absence of
    any powershell.exe fallback, that every file parses, and strict UTF-8
    validity. No network, no fixtures, cannot consume quota.

quota-lib.ps1 deliberately has no #Requires — it is dot-sourced, and the
directive would throw in the caller.

Compatibility

Cache schema_version is unchanged at 3; only lib_version moves. No cache
migration, and older libraries can still read the file.

Full changelog: v1.2.0...v2.0.0