Skip to content

fix(cli): complete after a -C directory named like a subcommand - #3609

Open
voidzero-bot[bot] wants to merge 2 commits into
mainfrom
triagebot/fix-3608
Open

voidzero-bot[bot] wants to merge 2 commits into
mainfrom
triagebot/fix-3608

Conversation

@voidzero-bot

@voidzero-bot voidzero-bot Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

vp -C dev run <TAB> offered no tasks. clap_complete's engine looks up subcommand names before it gives a word to a pending option, so it routed the completion into vp dev. The parser consumes dev as the -C value, so the command itself ran in dev. The -C ./dev case from the issue already works on main since #3190.

Completion now spells a leading -C value that names a subcommand or alias as ./<dir> before the engine reads the request. The word count stays the same, so the cursor index from every shell stays valid. The -C peek that changes the directory runs before this rewrite. The rewrite can go once clap_complete gives the value to the option first, as its parser does: clap-rs/clap#6590.

When -C names a directory that does not exist, task completion offers nothing. Before, it listed the tasks of the invocation directory, where the command never runs.

Closes #3608

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

CLI artifact sizes (efe4c7e)

Final release artifacts built by the canonical build-upstream and build-windows-cli actions.
The dist rows use the Linux build. The core total excludes .node files to match the release artifact.

Artifact Format Base PR Change
packages/cli/dist Directory total 2.55 MiB 2.55 MiB 0 B (0.00%)
packages/core/dist Directory total 4.29 MiB 4.29 MiB 0 B (0.00%)
Combined package dist Directory total 6.84 MiB 6.84 MiB 0 B (0.00%)
vp (Linux x64) Binary 9.32 MiB 9.32 MiB 0 B (0.00%)
vp (Linux x64) gzip -9 4.26 MiB 4.26 MiB +289 B (+0.01%)
NAPI (Linux x64) Binary 38.00 MiB 38.00 MiB 0 B (0.00%)
NAPI (Linux x64) gzip -9 15.33 MiB 15.33 MiB 0 B (0.00%)
vp (macOS ARM64) Binary 6.12 MiB 6.12 MiB +16 B (+0.00%)
vp (macOS ARM64) gzip -9 3.65 MiB 3.65 MiB +657 B (+0.02%)
NAPI (macOS ARM64) Binary 44.39 MiB 44.39 MiB 0 B (0.00%)
NAPI (macOS ARM64) gzip -9 19.42 MiB 19.42 MiB 0 B (0.00%)
vp (Windows x64) Binary 7.28 MiB 7.28 MiB +1.00 KiB (+0.01%)
vp (Windows x64) gzip -9 3.34 MiB 3.34 MiB +1.48 KiB (+0.04%)
NAPI (Windows x64) Binary 33.88 MiB 33.88 MiB 0 B (0.00%)
NAPI (Windows x64) gzip -9 14.04 MiB 14.04 MiB -4 B (-0.00%)
Trampoline (Windows x64) Binary 13.50 KiB 13.50 KiB 0 B (0.00%)
Trampoline (Windows x64) gzip -9 7.09 KiB 7.09 KiB 0 B (0.00%)
Installer (Windows x64) Binary 4.70 MiB 4.70 MiB 0 B (0.00%)
Installer (Windows x64) gzip -9 2.25 MiB 2.25 MiB +1 B (+0.00%)

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Cloudflare builds and deploys previews for this pull request. Learn more about Cloudflare previews.

Worker Status Deployment Commit
viteplus-dev Deployed Preview efe4c7e

Updated: Dec 6, 2026, 09:15 UTC | Dashboard

clap_complete's engine looks up subcommand names before it gives a word
to a pending option, so `vp -C dev run <TAB>` completed inside `vp dev`
and offered no tasks. The parser consumes `dev` as the `-C` value, so
the command itself ran in `dev`.

Completion now spells a leading `-C` value that names a subcommand or
alias as `./<dir>` before the engine reads the request. The word count
stays the same, so the cursor index from every shell stays valid. The
`-C` peek that changes the directory runs before this rewrite.

Closes #3608
@fengmk2
fengmk2 force-pushed the triagebot/fix-3608 branch from 8d1c317 to 6793350 Compare December 6, 2026 08:47
@fengmk2 fengmk2 changed the title fix(cli): complete tasks from the -C target directory fix(cli): complete after a -C directory named like a subcommand Dec 6, 2026
When `-C` named a directory that does not exist, task completion listed
the tasks of the invocation directory, where the command never runs.
Accepting one then failed with `directory not found`. The completion
command for a missing `-C` directory now offers no tasks.

This branch has not been deployed

No deployments
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.

vp -C dev run gives no Bash task completions when the directory is named dev

1 participant