[wrangler] Fix wrangler complete printing AI skills prompt into shell completion output#14041
Conversation
…ll completion output Add `skipSkillsPrompt` behaviour flag and set it on the `complete` command so `eval "$(wrangler complete zsh)"` no longer injects the interactive prompt into the completion script, causing shell errors on eval.
🦋 Changeset detectedLatest commit: 9e7bf5d The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a command-level switch to suppress the AI skills installation prompt so wrangler complete output remains clean for shell evaluation.
Changes:
- Introduces
skipSkillsPromptin commandbehaviourmetadata. - Skips the skills installation flow when the flag is enabled (used by
wrangler complete). - Adds a regression test and a changeset entry documenting the fix.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/wrangler/src/core/types.ts | Adds skipSkillsPrompt to command behaviour typing/docs. |
| packages/wrangler/src/core/register-yargs-command.ts | Conditionally bypasses skills install/prompt flow based on command behaviour. |
| packages/wrangler/src/complete.ts | Enables skipSkillsPrompt for wrangler complete. |
| packages/wrangler/src/tests/register-yargs-command-skills.test.ts | Adds regression test ensuring complete doesn’t invoke skills install flow. |
| .changeset/fix-complete-skip-skills-prompt.md | Records patch change and rationale for release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
@cloudflare/wrangler-bundler
commit: |
There was a problem hiding this comment.
Thanks for the fix @matingathani 🙏
The fix looks correct to me, however the two comments copilot made are both valid, could you have a look? 🙏
- Still call `maybeInstallCloudflareSkillsGlobally` when the user explicitly
passes `--install-skills`, even on commands with `skipSkillsPrompt: true`.
Only the unprompted/automatic detection is suppressed for `complete`.
- Remove `.catch(() => {})` swallowing all failures in the test; assert
`runWrangler("complete zsh")` resolves cleanly.
- Add a test confirming `--install-skills` is honoured on `complete`.
|
@dario-piotrowicz do we need a test to prevent breaking this in the future? (I now see this contains a test...) |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Fixes #14033.
`eval "$(wrangler complete zsh)"` was broken by the skills installation prompt introduced in #13897. The `complete` command's stdout is captured by the shell to be sourced as commands — the interactive AI agent detection prompt appeared in that output, causing:
```
zsh: command not found: --install-skills
zsh: command not found: Cloudflare
```
Root cause
`maybeInstallCloudflareSkillsGlobally` is called unconditionally in `register-yargs-command.ts` for every command, including `complete`.
Fix
Added `skipSkillsPrompt?: boolean` to the shared `behaviour` type and set it to `true` on the `complete` command. The skills prompt is skipped when this flag is set.