Skip to content

fix: expose additional binary multipart fields as file flags - #272

Open
petebacondarwin wants to merge 1 commit into
mainfrom
codex/fix-177-multipart-files
Open

petebacondarwin wants to merge 1 commit into
mainfrom
codex/fix-177-multipart-files

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Multipart commands previously exposed only the primary binary field through --file, leaving other binary fields inaccessible. Add path-valued flags for those fields and upload their bytes under the original multipart names. Pages deployment creation now exposes --worker-js, --routes-json, --redirects, --worker-bundle, and --functions-filepath-routing-config-json; Cloudforce One asset uploads expose --source.

Keep the primary --file behavior, prevent collisions with existing flags and aliases, and include the new fields in command metadata and dry-run previews. Implemented in the current Forge generator plugin, with regression coverage for uploaded bytes, original field names, paths with spaces and Unicode, invalid files, primary-file coexistence, and mixed multipart/octet-stream selection. Includes a minor changeset for the new flags. Based on the contributor patch linked in the issue, with nahwan-kim's authorship preserved.

Validation:

  • pnpm check passed, including regeneration, formatting, lint, builds, and workspace type checks.
  • pnpm --filter cf test: 1,622 tests passed, 6 skipped.
  • pnpm --filter @cloudflare/wrangler-tests test: 637 tests passed; existing skipped/todo cases remain.
  • Three compiled CLI smoke checks passed for Pages help, Pages multipart dry-run, and Cloudforce One multipart dry-run.

Fixes #177.

@petebacondarwin
petebacondarwin requested a review from a team as a code owner October 12, 2026 14:03
@pkg-pr-new

pkg-pr-new Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
npm i https://pkg.pr.new/cf@272

commit: ab4adcf

@ask-bonk

ask-bonk Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

cf --help startup

mean stddev min max
PR 214.1 ms 3.7 ms 207.7 ms 221.6 ms
base 213.5 ms 4.5 ms 207.0 ms 226.4 ms

Δ (PR vs base): — +0.6 ms (+0.3%)

Measured with hyperfine on ubuntu-latest (3 warmup runs, 20 timed runs). CI numbers carry ±a few ms of runner jitter; treat small deltas as noise.

@edmundhung edmundhung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this needs a rebase to resolve the conflict introduced from the recent refactor. I will move this back to draft first. Just ping me when it is ready 🙏🏼

@edmundhung
edmundhung marked this pull request as draft October 14, 2026 11:37
Fixes #177.

Co-authored-by: Pete Bacon Darwin <pbacondarwin@cloudflare.com>
@petebacondarwin
petebacondarwin force-pushed the codex/fix-177-multipart-files branch from 4d0f0d0 to ab4adcf Compare October 14, 2026 12:04
@petebacondarwin
petebacondarwin marked this pull request as ready for review October 14, 2026 12:05
@ask-bonk

ask-bonk Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@edmundhung edmundhung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if it's worth reusing the @ syntax for multipart fields here.

As I understand, every string-typed body flag in cf already accepts an '@path/to/file' token, following curl's '-d @file' convention:

cf mtls-certificates create --certificates @./cert.pem \
   --private-key @./key.pem --ca
cf origin-ca-certificates create --csr @./csr.pem ...
cf d1 database query <id> --sql @./query.sql

What if we follow the same pattern so the behavior here could be:

--worker-js @./worker.js                 # Read the file
--worker-js 'export default { ... }'     # Send literal source

@petebacondarwin
petebacondarwin requested review from a team and dario-piotrowicz and removed request for a team October 23, 2026 13:00
@dario-piotrowicz
dario-piotrowicz removed their request for review October 23, 2026 14:11
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.

Generated multipart commands cannot upload binary fields other than the payload (e.g. pages deployments create _worker.js)

3 participants