Skip to content

bug(cli): squad.ps1 blocked by PowerShell execution policy on Windows #758

Closed

Description

@diberry

Bug Report

Command: squad nap (affects all squad CLI commands on Windows)

Error:

File C:\Users\diberry\AppData\Roaming\npm\squad.ps1 cannot be loaded.
The file C:\Users\diberry\AppData\Roaming\npm\squad.ps1 is not digitally signed.
You cannot run this script on the current system.
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Environment:

  • OS: Windows 11
  • Shell: PowerShell (default execution policy: Restricted or AllSigned)
  • Node: v22.14.0
  • Install: npm install -g @bradygaster/squad-cli

Root Cause

When npm installs a global package on Windows, it creates a .ps1 shim script alongside the .cmd shim in %APPDATA%\npm\. PowerShell prefers .ps1 over .cmd, so it tries to run squad.ps1 — which is unsigned and blocked by default execution policy.

This affects any user who hasn't explicitly relaxed their PowerShell execution policy (Set-ExecutionPolicy RemoteSigned).

Workarounds (for users right now)

  1. Use cmd.exe instead of PowerShell — the .cmd shim works fine
  2. Relax execution policy: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
  3. Delete the .ps1 shim: Remove-Item \C:\Users\diberry\AppData\Roaming\npm\squad.ps1 — PowerShell falls back to .cmd
  4. Use npx: npx @bradygaster/squad-cli nap bypasses the shim entirely

Possible Fixes

  1. Post-install script that removes the .ps1 shim on Windows (npm creates it automatically, can't prevent it)
  2. Document the workaround in README/installation guide
  3. Sign the .ps1 script with a code signing certificate (overkill for a CLI tool)
  4. Recommend npx usage in docs as the primary invocation method on Windows

Impact

  • Severity: Blocks ALL squad CLI usage on default Windows PowerShell
  • Scope: Any Windows user with default execution policy
  • First-run experience: Completely broken — user sees a security error on their first command

Reproduction

  1. Fresh Windows machine with default PowerShell execution policy
  2. npm install -g @bradygaster/squad-cli
  3. Open PowerShell
  4. Run squad nap (or any squad command)
  5. Observe: PSSecurityException: UnauthorizedAccess

Activity

  1. diberry commented on Apr 2, 2026

    @diberry
    ContributorAuthor

    Quick Fix (verified)

    Run this once in PowerShell:

    Set-ExecutionPolicy -Scope CurrentUser RemoteSigned

    Then squad nap (and all other squad commands) work normally. This is a one-time setting — it tells PowerShell to allow locally-installed scripts while still blocking random downloaded scripts.

    Alternative if you don't want to change execution policy:

    # Use npx instead (bypasses the .ps1 shim entirely)
    npx @bradygaster/squad-cli nap
  2. added 4 commits that reference this issue on Apr 2, 2026
    56579e4
    27b79b9
    1eda099
    ee865b9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions