Skip to content

install: documented Windows PowerShell command cannot parse install.ps1 #133

Closed

Description

@hossainzarif23

What happens

The documented Windows one-flow installation command fails on a fresh clone when run with Windows PowerShell 5.1:

powershell -ExecutionPolicy Bypass -File scripts\install.ps1

Windows PowerShell rejects scripts/install.ps1 during parsing:

At scripts\install.ps1:142 char:75
+ ...  restart Claude Code / Cursor so hooks load." -ForegroundColor Yellow
+                                                 ~~~~~~~~~~~~~~~~~~~~~~~~~
The string is missing the terminator: ".

At scripts\install.ps1:138 char:37
+ if ($ToolPolicyBlock -or $DlpBlock) {
+                                     ~
Missing closing '}' in statement block or type definition.

    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

Because this is a parser error, the installer body never begins executing.

Reproduce

From Windows PowerShell 5.1:

git clone https://github.com/blitzcrieg1/agentmetry.git
cd agentmetry
powershell -ExecutionPolicy Bypass -File scripts\install.ps1

Reproduced on commit:

a56ca49e49675f16ccbfaa3d81f623fe093edf49

Environment

OS:             Microsoft Windows 11 Pro, 64-bit
OS version:     10.0.26200
PowerShell:     5.1.26100.9278
PSEdition:      Desktop
BuildVersion:   10.0.26100.9278

PowerShell 7 control

The same file parses without errors under PowerShell 7.6.5:

pwsh -NoProfile -Command '
$tokens = $null
$errors = $null

[System.Management.Automation.Language.Parser]::ParseFile(
    (Resolve-Path ".\scripts\install.ps1"),
    [ref]$tokens,
    [ref]$errors
) | Out-Null

"Parser error count: $($errors.Count)"
$errors | ForEach-Object { $_.Message }
'

Result:

Parser error count: 0

This indicates that the script is accepted by PowerShell 7 but not by the Windows PowerShell version invoked by the command currently shown in the README.

Likely cause

The behavior is consistent with Windows PowerShell 5.1 interpreting a BOM-less UTF-8 script through its legacy encoding rules. The script contains non-ASCII punctuation, while PowerShell 7 treats UTF-8 as the default.

This is an inference from the parser comparison; the preferred compatibility strategy is left to the maintainer.

Expected behavior

The Windows installation command documented in the README should parse and start the installer on a supported fresh Windows 11 environment.

Either:

  1. install.ps1 and the scripts it invokes should remain compatible with the documented powershell/Windows PowerShell invocation; or
  2. PowerShell 7 should be made an explicit prerequisite and the documented command should use pwsh, with a clear message when it is unavailable.

Why this matters

Windows PowerShell 5.1 is included with Windows 11, and powershell resolves to that executable. A user following the Windows quick-start exactly therefore cannot complete the installation procedure.

Done when

  • The documented Windows one-flow command works from a fresh clone on the declared supported PowerShell version.
  • The README names the required PowerShell executable and version explicitly.
  • A Windows CI check catches parser regressions in scripts/install.ps1, ideally using the same executable named in the README.

I would be happy to work on a focused fix once the preferred compatibility direction—Windows PowerShell 5.1 support or an explicit PowerShell 7 requirement—is confirmed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions