`cf complete zsh >> .zshrc` fails on vanilla zsh
Maintainers usually reply within 1 day
Nobody has claimed this yet.
- #341 by @couetilc — closed without merging
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- zsh
- Domain
- cli
Research direction
Start with the cf complete zsh command, which prints the completion script, and find where that script is generated. Reproduce with zsh -f -c "$(cf complete zsh)", which should fail with command not found: compdef. Done when the generated script loads in a bare zsh with no .zshrc, for example by initializing the completion system itself before calling compdef, and the reporter's workaround is no longer needed.
Written by the indexing model from the issue text.
Description
Summary of the issue
I use vanilla zsh on my macbook. Nothing in the .zshrc. When I try to install the cf completion script for zsh, I get the following error.
% zsh -f -c "$(cf complete zsh)"
zsh:2: command not found: compdef
%
Current workaround: initialize completions only if compdef is unavailable.
if (( ! $+functions[compdef] )); then
autoload -Uz compinit
compinit
fi
eval "$(cf complete zsh)"
Expected behaviour
I expect the generated completion script to work when sourced in an unconfigured Zsh shell.
Version of cf used
1.0.0-beta.18
System information and package versions
System:
OS: macOS 26.6.2
CPU: (14) arm64 Apple M4 Pro
Memory: 5.64 GB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 26.12.0 - /opt/homebrew/bin/node
npm: 11.20.0 - /opt/homebrew/bin/npm
$ zsh --version
zsh 5.9 (arm64-apple-darwin25.0)
Reproduction (optional)
% cf complete zsh >> .vanilla.zshrc
% RCS=.vanilla.zshrc zsh
Possible Fix
if (( ! $+functions[compdef] )); then
autoload -Uz compinit
compinit
fi
- Dominant language
- TypeScript
- Stars
- 853
- Forks
- 42
- Avg merge
- 17h 59m
- Merged PRs (30d)
- 145
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from cloudflare/cf
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/cf#262 ·
Maintainers usually reply within 1 day
-
`cf dev` rejects `--port` and `--host` for Vite projects, including the `cf init` templatePossibly taken @jamesopstad claimed this 4 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
cloudflare/cf#223 · 2 assignees ·
Maintainers usually reply within 1 day
-
upstream
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
cloudflare/cf#179 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 Half a day Newbie friendliness 45/100
cloudflare/cf#326 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
cloudflare/cf#325 ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
agilepathway/label-checker#739 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
CopilotKit/OpenBot#800 ·
Maintainers usually reply within 1 day
-
Endpoint links in the tag operations list are below the 24px target sizePossibly taken @AdzerKI claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
ehmpathy/rhachet-roles-bhuild#471 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day