Skip to content

refactor(cli): replace clap with usage-rs - #694

Closed
fengmk2 wants to merge 2 commits into
mainfrom
refactor/usage-rs-cli-parser
Closed

refactor(cli): replace clap with usage-rs#694
fengmk2 wants to merge 2 commits into
mainfrom
refactor/usage-rs-cli-parser

Conversation

@fengmk2

@fengmk2 fengmk2 commented Aug 23, 2026

Copy link
Copy Markdown
Member

Vite+ PR #2534 must remove clap from its NAPI binary. Vite Task exports parser types to Vite+. Thus, its production crates must also remove clap.

This change replaces the Vite Task clap parsers with usage-rs. It pins an exact reviewed revision from the experiment fork. One typed grammar now supplies parsing, help, diagnostics, and completion data.

The change keeps task argument forwarding, the vpr view, package filters, cache flags, log modes, and the internal tool command. Completion includes command options, value choices, task names, package names, and package filters.

Direct unit tests cover strict errors, help, short options, --, completion candidates, and completion scripts. Existing end-to-end tests cover task forwarding and cache commands.

The production dependency graph has no clap path. libtest-mimic still supplies clap to test code. This PR increases the minimum Rust version from 1.89 to 1.91.

fengmk2 commented Aug 23, 2026

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@socket-security

socket-security Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcargo/​syn@​3.0.3100100100100100

View full report

@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  -0.21%  [-10.32% ..  +9.55%]  overhead  +232.24%
dynamic/access             change  +0.00%  [ -0.74% ..  +0.75%]  overhead    +6.45%
dynamic/access-relative    change  +0.00%  [ -0.60% ..  +0.99%]  overhead   +53.86%
dynamic/access-contended   change  +0.41%  [ -1.36% ..  +2.10%]  overhead    +8.80%
static/launch              change  +1.94%  [ -6.54% .. +11.20%]  overhead  +706.56%
static/access              change  -0.04%  [ -1.12% ..  +0.84%]  overhead  +731.94%
static/access-relative     change  +0.20%  [ -0.87% ..  +1.45%]  overhead +1170.93%
static/access-contended    change  -0.74%  [ -2.89% ..  +1.14%]  overhead +3195.70%

macos

dynamic/launch             change  -0.19%  [ -5.28% ..  +5.13%]  overhead  +239.17%
dynamic/access             change  +0.00%  [-22.54% .. +17.83%]  overhead    +4.04%
dynamic/access-relative    change  +1.86%  [ -4.25% .. +16.43%]  overhead  +259.65%
dynamic/access-contended   change  +1.85%  [-18.81% .. +16.61%]  overhead    +1.42%

windows

dynamic/launch             change  -1.55%  [ -7.22% ..  +5.26%]  overhead   +23.55%
dynamic/access             change  +0.00%  [ -7.13% ..  +1.64%]  overhead    +2.23%
dynamic/access-relative    change  -0.71%  [ -3.65% ..  +1.44%]  overhead    +1.46%
dynamic/access-contended   change  -0.21%  [ -5.82% ..  +1.51%]  overhead    +3.74%

Co-authored-by: GPT-5 Codex <codex@openai.com>
@fengmk2
fengmk2 force-pushed the refactor/usage-rs-cli-parser branch from 95765ec to f216f9a Compare August 23, 2026 07:32
@fengmk2 fengmk2 self-assigned this Aug 23, 2026
@fengmk2

fengmk2 commented Aug 23, 2026

Copy link
Copy Markdown
Member Author

Closing this supporting experiment for now. The Vite+ evaluation found little difference in the final NAPI binary size. Replacing clap requires a major refactor, so we will not consider this migration now.

@fengmk2 fengmk2 closed this Aug 23, 2026
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.

1 participant