From c15167ca86ac954d03bdd70be14515379f237072 Mon Sep 17 00:00:00 2001 From: laplace-anon <150580554+laplace-anon@users.noreply.github.com> Date: Fri, 1 May 2026 06:27:12 +0800 Subject: [PATCH] fix: Modify command to support variadic positional args (#2317) --- cspell.yml | 2 ++ packages/wxt/src/cli/cli-utils.ts | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cspell.yml b/cspell.yml index c390c372..92fa18b5 100644 --- a/cspell.yml +++ b/cspell.yml @@ -11,6 +11,7 @@ ignorePaths: - patches/** - '**/*.snap' - docs/assets/extension-showcase.yml + - packages/*/stats.html words: - Aabid - aabidk @@ -21,6 +22,7 @@ words: - buildc - bunx - cachable + - cacjs - charmbracelet - chromedriver - Cira diff --git a/packages/wxt/src/cli/cli-utils.ts b/packages/wxt/src/cli/cli-utils.ts index 01565273..f7c849ff 100644 --- a/packages/wxt/src/cli/cli-utils.ts +++ b/packages/wxt/src/cli/cli-utils.ts @@ -82,8 +82,12 @@ export function createAliasedCommand( bin: string, docsUrl: string, ) { + // Declare a variadic positional arg so cac forwards subcommands like `wxt + // submit init` instead of rejecting them as unused args. `.allowUnknownOptions` + // only relaxes flag checks, not positional args. Required since cac@7, which + // throws on unused positional args (see cacjs/cac#135). const aliasedCommand = base - .command(name, `Alias for ${alias} (${docsUrl})`) + .command(`${name} [...args]`, `Alias for ${alias} (${docsUrl})`) .allowUnknownOptions() .action(async () => { try {