Skip to content

Conversation

@dmmulroy
Copy link
Contributor

@dmmulroy dmmulroy commented Dec 14, 2025

Fixes #53

Summary

Adds wrangler completions command generating shell completion scripts for bash, zsh, fish.

Approach

Uses dynamic completions via a hidden wrangler __complete command which is the same pattern used by kubectl, docker, and cobra-based CLIs. Shell scripts call wrangler __complete at runtime, which outputs tab-separated completions.

Completions derive from the same registry as --help, so new commands/flags are automatically included.

Installation

# Bash
wrangler completions bash >> ~/.bashrc

# Zsh  
wrangler completions zsh >> ~/.zshrc

# Fish
wrangler completions fish > ~/.config/fish/completions/wrangler.fish

  • Tests
    • Tests included/updated
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: feature is self-documenting via wrangler completions --help
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because: new feature (minor version bump)

@dmmulroy dmmulroy requested a review from a team as a code owner December 14, 2025 03:13
@changeset-bot
Copy link

changeset-bot bot commented Dec 14, 2025

🦋 Changeset detected

Latest commit: 9bb2d3e

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Dec 14, 2025
@dmmulroy dmmulroy force-pushed the dmmulroy/wrangler-shell-completions branch 3 times, most recently from 2b1ea6e to b1462b4 Compare December 14, 2025 03:33
@dmmulroy dmmulroy marked this pull request as draft December 14, 2025 03:35
@dmmulroy dmmulroy force-pushed the dmmulroy/wrangler-shell-completions branch 2 times, most recently from 3f2cbc1 to 2bfe024 Compare December 14, 2025 04:33
@dmmulroy dmmulroy marked this pull request as ready for review December 14, 2025 04:42
@dmmulroy dmmulroy force-pushed the dmmulroy/wrangler-shell-completions branch from 2bfe024 to 49397a1 Compare December 14, 2025 05:08
@kiritocode1
Copy link

Crazy work @dmmulroy

@elithrar
Copy link
Contributor

@claude review this. Focus on bugs and gaps in testing, if any.

@claude
Copy link
Contributor

claude bot commented Dec 14, 2025

Claude encountered an error —— View job

Failed with exit code 128

I'll analyze this and get back to you.

@ascorbic
Copy link
Contributor

The reason the PR description workflow is failing is because it relies on the specific format of the PR template checklist, so you'll need to add that for it to pass.

@NuroDev
Copy link
Contributor

NuroDev commented Dec 15, 2025

The reason the PR description workflow is failing is because it relies on the specific format of the PR template checklist, so you'll need to add that for it to pass.

Yeah, if you copy this template @dmmulroy it should fix that PR description CI.

@dmmulroy dmmulroy force-pushed the dmmulroy/wrangler-shell-completions branch from 24de860 to 5d6390e Compare December 15, 2025 17:38
@dmmulroy dmmulroy force-pushed the dmmulroy/wrangler-shell-completions branch from 5d6390e to f352e34 Compare December 15, 2025 17:42
@dmmulroy dmmulroy requested a review from NuroDev December 15, 2025 17:42
@dmmulroy
Copy link
Contributor Author

The reason the PR description workflow is failing is because it relies on the specific format of the PR template checklist, so you'll need to add that for it to pass.

Yeah, if you copy this template @dmmulroy it should fix that PR description CI.

Thanks for the review - I missed the tree params when I was reviewing claudes changes/impl 🤦‍♂️ . Addressed all feedback 🫡

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 17, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@11637

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@11637

miniflare

npm i https://pkg.pr.new/miniflare@11637

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@11637

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@11637

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@11637

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@11637

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@11637

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@11637

wrangler

npm i https://pkg.pr.new/wrangler@11637

commit: 9bb2d3e

@dmmulroy dmmulroy force-pushed the dmmulroy/wrangler-shell-completions branch from 516a020 to 5b6f040 Compare December 18, 2025 00:53
@ascorbic
Copy link
Contributor

There is an existing PR open that does the same thing, but using @bomb-sh/tab. I'm not sure what the best approach is. The other one is simpler because it uses the library, but this one has comprehensive tests.

@NuroDev
Copy link
Contributor

NuroDev commented Dec 19, 2025

There is an existing PR open that does the same thing, but using @bomb-sh/tab. I'm not sure what the best approach is. The other one is simpler because it uses the library, but this one has comprehensive tests.

I've tested both this and the other PR and this PR seems to be slightly better in terms of (slightly) better DX, full control of the completions logic (Should we ever want to make tweaks it'll be easier) and also more comprehensive tests to cover this new feature.

@dmmulroy dmmulroy requested a review from NuroDev December 21, 2025 01:08
@dmmulroy
Copy link
Contributor Author

dmmulroy commented Jan 5, 2026

chatted internally we're going to reopen #11113 and take that approach

@dmmulroy dmmulroy closed this Jan 5, 2026
@github-project-automation github-project-automation bot moved this from Untriaged to Done in workers-sdk Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bash/zsh completions

5 participants