Skip to content

fix: Modify command to support variadic positional args - #2317

Merged
aklinker1 merged 2 commits into
wxt-dev:mainfrom
laplace-anon:patch-1
Apr 30, 2026
Merged

fix: Modify command to support variadic positional args#2317
aklinker1 merged 2 commits into
wxt-dev:mainfrom
laplace-anon:patch-1

Conversation

@laplace-anon

Copy link
Copy Markdown
Contributor

Updated command registration to allow variadic positional arguments for subcommands.

Overview

wxt submit <subcommand> (e.g. wxt submit init) currently fails with:

CACError: Unused args: init at Command.checkUnusedArgs (node_modules/cac/dist/index.js:394:54) at CAC.runMatchedCommand (node_modules/cac/dist/index.js:619:11) at file:.../node_modules/wxt/dist/cli/index.mjs:11:11

Ref: #2286

createAliasedCommand registers the alias as cli.command(name) (no positional arg spec) and then forwards process.argv to the underlying CLI. .allowUnknownOptions() only relaxes flag checks, not positional args. This worked by accident on cac@6, but wxt's declared range ^6.7.14 || ^7.0.0 now resolves to cac@7.0.0, which added a strict checkUnusedArgs (cacjs/cac#135) that throws before the action ever runs.

The fix is one line: declare the alias as `${name} [...args]` so cac treats positional args as variadic and forwards them through.

Manual Testing

Before:

$ bun wxt submit init
CACError: Unused args: `init`

After:

$ pnpm wxt submit init
publish-extension/4.0.5
Usage: $ publish-extension init
...

Related Issue

This PR closes:

╰─>$ bun why publish-browser-extension
publish-browser-extension@4.0.5
  └─ wxt@0.20.25 (requires ^2.3.0 || ^3.0.2 || ^4.0.4)
     ├─ dev wxt-react-starter (requires ^0.20.25)
     ├─ peer @wxt-dev/auto-icons@1.1.1 (requires >=0.19.0)
     │  └─ dev wxt-react-starter (requires ^1.1.1)
     └─ peer @wxt-dev/module-react@1.2.2 (requires >=0.19.16)
        └─ dev wxt-react-starter (requires ^1.2.2)

Updated command registration to allow variadic positional arguments for subcommands.
@laplace-anon
laplace-anon requested a review from aklinker1 as a code owner April 30, 2026 05:38
@netlify

netlify Bot commented Apr 30, 2026

Copy link
Copy Markdown

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 23a9bdf
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/69f3d34fd08212000833a1cc
😎 Deploy Preview https://deploy-preview-2317--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added the pkg/wxt Includes changes to the `packages/wxt` directory label Apr 30, 2026
@pkg-pr-new

pkg-pr-new Bot commented Apr 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@wxt-dev/analytics

npm i https://pkg.pr.new/@wxt-dev/analytics@2317

@wxt-dev/auto-icons

npm i https://pkg.pr.new/@wxt-dev/auto-icons@2317

@wxt-dev/browser

npm i https://pkg.pr.new/@wxt-dev/browser@2317

@wxt-dev/i18n

npm i https://pkg.pr.new/@wxt-dev/i18n@2317

@wxt-dev/is-background

npm i https://pkg.pr.new/@wxt-dev/is-background@2317

@wxt-dev/module-react

npm i https://pkg.pr.new/@wxt-dev/module-react@2317

@wxt-dev/module-solid

npm i https://pkg.pr.new/@wxt-dev/module-solid@2317

@wxt-dev/module-svelte

npm i https://pkg.pr.new/@wxt-dev/module-svelte@2317

@wxt-dev/module-vue

npm i https://pkg.pr.new/@wxt-dev/module-vue@2317

@wxt-dev/runner

npm i https://pkg.pr.new/@wxt-dev/runner@2317

@wxt-dev/storage

npm i https://pkg.pr.new/@wxt-dev/storage@2317

@wxt-dev/unocss

npm i https://pkg.pr.new/@wxt-dev/unocss@2317

@wxt-dev/webextension-polyfill

npm i https://pkg.pr.new/@wxt-dev/webextension-polyfill@2317

wxt

npm i https://pkg.pr.new/wxt@2317

commit: 23a9bdf

@codecov

codecov Bot commented Apr 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.81%. Comparing base (e75e534) to head (23a9bdf).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2317      +/-   ##
==========================================
+ Coverage   79.73%   79.81%   +0.07%     
==========================================
  Files         131      131              
  Lines        3804     3804              
  Branches      861      861              
==========================================
+ Hits         3033     3036       +3     
+ Misses        686      684       -2     
+ Partials       85       84       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aklinker1 aklinker1 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.

Thanks, good find

@aklinker1
aklinker1 enabled auto-merge (squash) April 30, 2026 22:07
@aklinker1
aklinker1 merged commit c15167c into wxt-dev:main Apr 30, 2026
26 of 28 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for helping make WXT better!

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

Labels

pkg/wxt Includes changes to the `packages/wxt` directory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants