Skip to content

fix: initialize Zsh completions before registering cf - #341

Closed
couetilc wants to merge 1 commit into
cloudflare:mainfrom
couetilc:fix/zsh-completion-init-340
Closed

couetilc wants to merge 1 commit into
cloudflare:mainfrom
couetilc:fix/zsh-completion-init-340

Conversation

@couetilc

Copy link
Copy Markdown

The recommended cf complete zsh >> ~/.zshrc installation fails with command not found: compdef when Zsh's completion system has not been initialized.

Patch the Zsh template in @bomb.sh/tab@0.0.22 to initialize completion only when compdef is unavailable, before registering the cf handler. Preserve #compdef cf as the first line for autoloaded completion files. Include a cf patch changeset.

Validation:

  • Reproduced the original failure with the new regression tests before applying the patch.
  • pnpm test src/__tests__/commands/completions.test.ts from packages/cli: all 6 tests pass. Coverage checks clean-shell initialization, handler registration, repeated sourcing, skipping compinit in initialized shells, and the first-line directive. Shell execution tests use isolated temporary ZDOTDIR directories and skip when Zsh is unavailable; the header test runs on every platform.
  • Root pnpm check: passed generation, builds, workspace type checks, formatting, and linting.
  • Bundled cf complete zsh smoke test: generated output loads in zsh -f, defines _cf, and registers it for cf.

Closes #340.

@couetilc
couetilc requested review from a team, dimitropoulos and srikrsna as code owners October 17, 2026 01:43
@couetilc
couetilc requested a review from edmundhung October 17, 2026 01:43
@github-actions

Copy link
Copy Markdown
Contributor

Hi @couetilc. Thanks for contributing to cf!

During the open beta, we’re being very intentional about the changes we accept so that we can prioritise stability for GA. We’re limiting pull requests to contributions coordinated with the team in advance, so this PR has been automatically closed.

We’d still love to hear about your use case, so please make sure it’s captured in a cf issue. If the proposed change fits our priorities, we’d be happy to take another look at this PR.

@github-actions github-actions Bot closed this Oct 17, 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.

cf complete zsh >> .zshrc fails on vanilla zsh

1 participant