cloudflare / cloudflare/workers-sdk
PowerShell completion script hardcodes `wrangler` and does not support local `npx wrangler` workflow
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 187
Description
### What versions & operating system are you using?
```
$ npx envinfo --system --npmPackages '{wrangler,create-cloudflare,miniflare,@cloudflare/*}' --binaries
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600K
Memory: 3.04 GB / 31.75 GB
Binaries:
Node: 22.21.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.4 - C:\Program Files\nodejs\npm.CMD
npmPackages:
wrangler: ^4.83.0 => 4.83.0
```
### Please provide a link to a minimal reproduction
N/A
### Describe the Bug
Wrangler PowerShell completions are functionally tied to a `wrangler` command name, which does not match the documented local-install workflow using `npx wrangler`.
I installed Wrangler locally in the project, following the recommended usage pattern where Wrangler is invoked through `npx wrangler`.
Then I generated PowerShell completions with:
npx wrangler complete powershell > Wrangler.Completion.ps1
The generated completion script only works when the command being completed is `wrangler`, not `npx wrangler`.
It also internally invokes `wrangler complete ...` rather than `npx wrangler complete ...`.
Because of that, the generated script is effectively coupled to having a `wrangler` command directly available in PATH, even though the local-install workflow uses `npx wrangler`.
## Steps to reproduce
1. Install Wrangler locally in a project.
2. Use it via `npx wrangler`.
3. Generate PowerShell completions with:
npx wrangler complete powershell > Wrangler.Completion.ps1
4. Load the completion script in PowerShell profile.
5. Try tab completion for:
npx wrangler
6. Try tab completion for:
wrangler
## Observed behavior
- Completion is registered for `wrangler`.
- The generated script internally calls `wrangler complete ...`.
- Completion does not correctly support the `npx wrangler` workflow.
- Completion only works if there is a `wrangler` command directly resolvable by PowerShell, such as a global install or a wrapper function/alias/script.
## Expected behavior
One of the following should happen:
- PowerShell completions should support the local-install workflow using `npx wrangler`; or
- the generated completion script should be configurable to call `npx wrangler`; or
- the documentation should clearly state that completions require a `wrangler` command directly available in PATH.
Right now this is not just a documentation mismatch: the generated completion script itself hardcodes the `wrangler` command model.
### Please provide any relevant error logs
No explicit runtime error is shown, but the generated PowerShell completion script registers completion for `wrangler` and internally invokes:
& wrangler complete '--' $QuotedArgs
This is the key issue, because my actual invocation method is `npx wrangler`.
Contributor guide
Assessment
This issue has not been assessed yet.