Skip to content

feat(cloudflare): support wrangler preview command in varlock-wrangler - #1018

Open
theoephraim wants to merge 3 commits into
mainfrom
wrangler-preview-command
Open

feat(cloudflare): support wrangler preview command in varlock-wrangler#1018
theoephraim wants to merge 3 commits into
mainfrom
wrangler-preview-command

Conversation

@theoephraim

@theoephraim theoephraim commented Aug 18, 2026

Copy link
Copy Markdown
Member

Wrangler is adding a preview command for deploying branch previews (private beta). This teaches varlock-wrangler to handle it like the other deploy-style commands.

Important

Blocked on cloudflare/workers-sdk#15256, which adds --var and --secrets-file to wrangler preview. Until that ships, wrangler preview rejects 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.

  • Bare varlock-wrangler preview now routes through the deploy handler: non-sensitive values are passed as --var flags, sensitive values via --secrets-file (served over the existing FIFO), plus the __VARLOCK_ENV blob.
  • Preview management subcommands (preview delete, preview settings, preview secret, ...) are passed through to wrangler unchanged.
  • --keep-vars=false is now only added for plain deploy; it was previously added for everything except versions upload, which would have leaked onto preview (which has no such flag).
  • Docs: the deploy section of the Cloudflare integration page now covers 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 delete deploys 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-wrangler asks wrangler: appending --help makes 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 (bare preview, 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.

@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

bumpy-frog

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

minor Minor releases

  • @varlock/cloudflare-integration 1.4.0 → 1.5.0

Bump files in this PR

Click here if you want to add another bump file to this PR


This comment is maintained by bumpy.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 preview and 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=false is now restricted to plain deploy rather 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.

Pullfrog  | Fix all ➔Fix 👍s ➔View workflow run | Using azure/gpt-5.6-sol𝕏

Comment thread packages/integrations/cloudflare/src/varlock-wrangler.ts Outdated
@pkg-pr-new

pkg-pr-new Bot commented Aug 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

varlock

npm i https://pkg.pr.new/varlock@1018

@varlock/cloudflare-integration

npm i https://pkg.pr.new/@varlock/cloudflare-integration@1018

@varlock/native-helper-darwin

npm i https://pkg.pr.new/@varlock/native-helper-darwin@1018

@varlock/native-helper-linux-arm64

npm i https://pkg.pr.new/@varlock/native-helper-linux-arm64@1018

@varlock/native-helper-linux-x64

npm i https://pkg.pr.new/@varlock/native-helper-linux-x64@1018

@varlock/native-helper-win32-x64

npm i https://pkg.pr.new/@varlock/native-helper-win32-x64@1018

commit: c604f56

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
🔵 In progress
View logs
varlock-website b3619a2 Aug 18 2026, 06:38 PM

@pullfrog

pullfrog Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Pushed commit c604f563 to PR #1018. Preview help and management commands now pass through unchanged even with interspersed Wrangler global options, while bare and script preview deployments still use varlock; focused tests (18/18), typecheck, and lint pass, and the review thread is resolved.

Task list (4/4 completed)

Pullfrog  | View workflow run | via Pullfrog | Using azure/gpt-5.6-sol𝕏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant