Skip to content

fix: Modify command to support variadic positional args#2317

Open
laplace-anon wants to merge 1 commit intowxt-dev:mainfrom
laplace-anon:patch-1
Open

fix: Modify command to support variadic positional args#2317
laplace-anon wants to merge 1 commit intowxt-dev:mainfrom
laplace-anon:patch-1

Conversation

@laplace-anon
Copy link
Copy Markdown

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
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit c366ca2
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/69f2eac84c3f720008d77aec
😎 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
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 30, 2026

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: c366ca2

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.73%. Comparing base (e75e534) to head (c366ca2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2317   +/-   ##
=======================================
  Coverage   79.73%   79.73%           
=======================================
  Files         131      131           
  Lines        3804     3804           
  Branches      861      861           
=======================================
  Hits         3033     3033           
- Misses        686      687    +1     
+ 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.

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.

1 participant