feat(cloudflare): support wrangler preview command in varlock-wrangler - #1018
feat(cloudflare): support wrangler preview command in varlock-wrangler#1018theoephraim wants to merge 3 commits into
Conversation
|
The changes in this PR will be included in the next version bump.
|
There was a problem hiding this comment.
Important
Preview routing misclassifies valid non-deploying invocations, and the feature currently depends on Wrangler flags that have not landed upstream.
Reviewed changes in 5792ed90, covering the new preview command routing, deploy argument construction, release entry, and Cloudflare integration documentation.
- Preview deployment routing: Bare
previewand script-path invocations now reuse the deploy handler to inject resolved vars, secrets, and the serialized env graph. - Management command passthrough: Four preview management command groups are intended to bypass varlock injection.
- Deploy flag scoping:
--keep-vars=falseis now restricted to plaindeployrather than all deploy-like commands. - User-facing guidance: CLI help, integration docs, and the minor release entry describe preview support.
⚠️ Preview support depends on unreleased Wrangler flags
Current Wrangler main does not declare --var or --secrets-file for preview, and its parser is strict, so the enhanced command cannot run against any currently released compatible Wrangler version. The upstream change needs to land and release before this package ships, with the resulting minimum Wrangler version reflected in compatibility metadata or documentation.
Technical details
# Coordinate the Wrangler dependency before release
## Affected sites
- `packages/integrations/cloudflare/src/varlock-wrangler.ts:456` - the shared handler appends `--var` and `--secrets-file` to preview invocations
- `packages/integrations/cloudflare/package.json:64` - the peer range currently permits every Wrangler version from 3 onward
- `packages/varlock-website/src/content/docs/integrations/cloudflare.mdx:211` - the docs state that preview deployment works without a version or release caveat
- [Wrangler `preview.ts` at current main](https://github.com/cloudflare/workers-sdk/blob/59872c41d4417d9b8c2efddb4b35662453efcaae/packages/wrangler/src/preview/preview.ts) - the command does not yet define either injected option
## Required outcome
- Ensure the integration release cannot precede a Wrangler release that accepts both injected options.
- State or enforce the minimum compatible Wrangler version once it is known.azure/gpt-5.6-sol | 𝕏
varlock
@varlock/cloudflare-integration
@varlock/native-helper-darwin
@varlock/native-helper-linux-arm64
@varlock/native-helper-linux-x64
@varlock/native-helper-win32-x64
commit: |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| 🔵 In progress View logs |
varlock-website | b3619a2 | Aug 18 2026, 06:38 PM |
|
Pushed commit Task list (4/4 completed)
|



Wrangler is adding a
previewcommand for deploying branch previews (private beta). This teachesvarlock-wranglerto handle it like the other deploy-style commands.Important
Blocked on cloudflare/workers-sdk#15256, which adds
--varand--secrets-filetowrangler preview. Until that ships,wrangler previewrejects both flags (Unknown arguments: var, secrets-file), so merging this early would turn a working passthrough into a hard failure for anyone on the preview beta. Hold until the upstream PR is released.varlock-wrangler previewnow routes through the deploy handler: non-sensitive values are passed as--varflags, sensitive values via--secrets-file(served over the existing FIFO), plus the__VARLOCK_ENVblob.preview delete,preview settings,preview secret, ...) are passed through to wrangler unchanged.--keep-vars=falseis now only added for plaindeploy; it was previously added for everything exceptversions upload, which would have leaked ontopreview(which has no such flag).preview.Deciding what counts as a preview deployment
Telling a preview deployment apart from a preview management subcommand needs two things wrangler owns and changes between releases: which options take a value (
preview --name deletedeploys a preview named "delete") and which subcommands exist. Options may also appear before the subcommand (preview -c wrangler.jsonc delete).Rather than mirroring those tables,
varlock-wranglerasks wrangler: appending--helpmakes yargs print the resolved command path as the first line of its output and exit without running anything. The probe is skipped when the args contain no positional at all (barepreview,preview --json), since a subcommand is always a bare word. If wrangler can't be reached or the output isn't a usage banner, the command passes through unchanged and wrangler reports its own error.