The PowerShell completion instruction used bash-style environment variable syntax (`COMPLETE=powershell prek`), which fails in PowerShell with `CommandNotFoundException`. ## Changes - Updated `docs/installation.md` to use PowerShell-native syntax for setting environment variables **Before:** ```powershell Add-Content -Path $PROFILE -Value '(COMPLETE=powershell prek) | Out-String | Invoke-Expression' ``` **After:** ```powershell Add-Content -Path $PROFILE -Value '$env:COMPLETE = "powershell"; prek | Out-String | Invoke-Expression; Remove-Item Env:\COMPLETE' ``` The fix sets `$env:COMPLETE` using PowerShell syntax, invokes `prek` to generate the completion script, and cleans up the temporary environment variable. <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Powershell completion script results in CommandNotFoundException</issue_title> > <issue_description>### Summary > > Following the instructions for enabling Powershell shell completions, I ran `Add-Content -Path $PROFILE -Value '(COMPLETE=powershell prek) | Out-String | Invoke-Expression'`. This did what I expected it to: it added a line to my $PROFILE, `(COMPLETE=powershell prek) | Out-String | Invoke-Expression`. > > However, also as expected, that line results in this error when the profile loads (and, indeed, if one types that string at the prompt: > ``` > COMPLETE=powershell : The term 'COMPLETE=powershell' is not recognized as the name of a cmdlet, function, script file, or operable > program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. > At C:\Users\Patrick\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:357 char:2 > + (COMPLETE=powershell prek) | Out-String | Invoke-Expression > + ~~~~~~~~~~~~~~~~~~~ > + CategoryInfo : ObjectNotFound: (COMPLETE=powershell:String) [], CommandNotFoundException > + FullyQualifiedErrorId : CommandNotFoundException > ``` > > If the problem isn't apparent, perhaps someone can tell me what it's designed to do so I can help? As a user of both Powershell & unix shells, I wasn't able to figure out what the command is that we want Powershell to run after glancing at some of the other completion scripts. > > ### Platform > > Windows 10 x86_64 > > ### Version > > prek 0.3.1 (bc142a25f2026-01-31) > > ### .pre-commit-config.yaml > > not relevant > > ### Log file > > 2026-02-05T03:33:51.720707Z DEBUG prek: 0.3.1 (bc142a25f2026-01-31) > 2026-02-05T03:33:51.720806Z DEBUG Args: ["c:\\users\\username \\.local\\bin\\prek.exe"] > 2026-02-05T03:33:51.803464Z TRACE get_root: close time.busy=82.6ms time.idle=5.10µs</issue_description> > > <agent_instructions>Fix the powershell completion instruction in installation.md: the style of running command with specified env var `COMPLETE=powershell prek` is bash-style, it does not work in powershell. Use something like `$env:COMPLETE = "powershell"; prek | Out-String | Invoke-Expression; Remove-Item Env:\COMPLETE` > </agent_instructions> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@j178</author><body> > Thanks for the report! That instruction isn’t correct. Could you try adding this to your $PROFILE? > > ```pwsh > $env:COMPLETE = "powershell" > prek | Out-String | Invoke-Expression > Remove-Item Env:COMPLETE' > ```</body></comment_new> > </comments> > </details> <!-- START COPILOT CODING AGENT SUFFIX --> - Fixes j178/prek#1566 <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
3.3 KiB
Installation
prek provides multiple installation methods to suit different needs and environments.
Standalone Installer
The standalone installer automatically downloads and installs the correct binary for your platform:
=== "macOS and Linux"
Use `curl` to download the script and execute it with `sh`:
--8<-- "README.md:linux-standalone-install"
=== "Windows"
Use `irm` to download the script and execute it with `iex`:
--8<-- "README.md:windows-standalone-install"
Changing the [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies) allows running a script from the internet.
!!! tip
The installation script may be inspected before use. Alternatively, binaries can be downloaded directly from [GitHub Releases](#github-releases).
Package Managers
PyPI
--8<-- "README.md:pypi-install"
Homebrew (macOS/Linux)
--8<-- "README.md:homebrew-install"
mise
--8<-- "README.md:mise-install"
npm
prek is published as a Node.js package and can be installed with any npm-compatible package manager:
# npm
npm install -g @j178/prek
# pnpm
pnpm add -g @j178/prek
# bun
bun install -g @j178/prek
Or as a project dependency:
npm add -D @j178/prek
Nix
--8<-- "README.md:nix-install"
Conda
--8<-- "README.md:conda-forge-install"
Scoop (Windows)
--8<-- "README.md:scoop-install"
MacPorts
--8<-- "README.md:macports-install"
cargo-binstall
--8<-- "README.md:cargo-binstall"
Docker
prek provides a Docker image at
ghcr.io/j178/prek.
See the guide on using prek in Docker for more details.
GitHub Releases
--8<-- "README.md:pre-built-binaries"
Build from Source
--8<-- "README.md:cargo-install"
Updating
--8<-- "README.md:self-update"
For other installation methods, follow the same installation steps again.
Shell Completion
!!! tip
Run `echo $SHELL` to determine your shell.
To enable shell autocompletion for prek commands, run one of the following:
=== "Bash"
```bash
echo 'eval "$(COMPLETE=bash prek)"' >> ~/.bashrc
```
=== "Zsh"
```bash
echo 'eval "$(COMPLETE=zsh prek)"' >> ~/.zshrc
```
=== "Fish"
```bash
echo 'COMPLETE=fish prek | source' >> ~/.config/fish/config.fish
```
=== "PowerShell"
```powershell
Add-Content -Path $PROFILE -Value '$env:COMPLETE = "powershell"; prek | Out-String | Invoke-Expression; Remove-Item Env:\COMPLETE'
```
Then restart your shell or source the config file.
Artifact Verification
Release artifacts are signed with GitHub Attestations to provide cryptographic proof of their origin. Verify downloads using the GitHub CLI:
$ gh attestation verify prek-x86_64-unknown-linux-gnu.tar.gz --repo j178/prek
Loaded digest sha256:xxxx... for file://prek-x86_64-unknown-linux-gnu.tar.gz
Loaded 1 attestation from GitHub API
✓ Verification succeeded!
- Attestation #1
- Build repo:..... j178/prek
- Build workflow:. .github/workflows/release.yml@refs/tags/vX.Y.Z
This confirms the artifact was built by the official release workflow.