Skip to content

fix(cli): detect and warn about unsigned .ps1 shim on Windows#760

Closed
diberry wants to merge 3 commits intodevfrom
squad/758-fix-ps-execution-policy
Closed

fix(cli): detect and warn about unsigned .ps1 shim on Windows#760
diberry wants to merge 3 commits intodevfrom
squad/758-fix-ps-execution-policy

Conversation

@diberry
Copy link
Copy Markdown
Collaborator

@diberry diberry commented Apr 2, 2026

Closes #758

What

  • Adds doctor check for unsigned .ps1 shim on Windows
  • Includes helper removal script for manual use
  • Documents workaround in README

Why

npm global install creates unsigned .ps1 shim that PowerShell blocks with default execution policy. This breaks ALL squad CLI commands on default Windows.

Changes

  • doctor.ts: New checkWindowsPs1Shim() returns warn when squad.ps1 exists in npm prefix
  • test/cli/doctor.test.ts: 4 new unit tests (non-Windows, .ps1 exists, .ps1 missing, APPDATA fallback)
  • README.md: Windows PowerShell note under Install section
  • remove-ps1-shim.mjs: Optional helper script for manual removal
  • Changeset: patch for @bradygaster/squad-cli

Working as Network (Distribution)

Closes #758

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry diberry marked this pull request as ready for review April 2, 2026 21:46
Copilot AI review requested due to automatic review settings April 2, 2026 21:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Windows-specific diagnostic to squad doctor to detect the unsigned squad.ps1 shim created by npm global installs (which PowerShell may block), plus documentation and an optional removal helper script.

Changes:

  • Add checkWindowsPs1Shim() to doctor and surface it as a warning when squad.ps1 is found.
  • Add unit tests for the new Windows shim detection logic.
  • Document the PowerShell workaround and ship an optional script to remove the .ps1 shim.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/squad-cli/src/cli/commands/doctor.ts Adds checkWindowsPs1Shim() and wires it into runDoctor() results.
test/cli/doctor.test.ts Adds unit tests for Windows .ps1 shim detection and adjusts an existing count assertion.
README.md Documents the PowerShell execution policy symptom and the Remove-Item workaround.
packages/squad-cli/scripts/remove-ps1-shim.mjs Adds an optional script to delete squad.ps1 so PowerShell falls back to squad.cmd.
.changeset/fix-ps-execution-policy.md Publishes a patch changeset for the CLI.

Comment thread packages/squad-cli/src/cli/commands/doctor.ts Outdated
Comment thread packages/squad-cli/scripts/remove-ps1-shim.mjs Outdated
Ensures that both doctor.ts and remove-ps1-shim.mjs guard against relative paths when npm_config_prefix and APPDATA environment variables are not set. This prevents unintended file operations on relative paths.

Closes #758

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
diberry added a commit that referenced this pull request Apr 2, 2026
Captures the full Copilot PR reviewer comment pipeline learned across
PRs #756, #760, #762: reading reviews, critical evaluation, lockout-aware
routing, GraphQL thread resolution, and CI verification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@diberry diberry closed this Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants