Skip to content

experiment: migrate clap to usage-rs - #36

Draft
Blankeos wants to merge 2 commits into
mainfrom
perf/cpu-optimizations-usage-rs
Draft

experiment: migrate clap to usage-rs#36
Blankeos wants to merge 2 commits into
mainfrom
perf/cpu-optimizations-usage-rs

Conversation

@Blankeos

@Blankeos Blankeos commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Summary

Migrate CLI parsing from clap + clap_complete to usage-rs (v6, completions feature), following that guide.

Nested jobs / maintenance (landed on main after the original commit) are now usage subcommands too. Completions stay opt-in (completions + #[usage(completion)]); we still only print a script via crabcode completion.

Perf (release, clap 6d32b00 vs this branch)

Host Carlos-MacBook-Pro.local · macOS 26.4.1 · Apple M3 Max (14 cores, 36 GB) · rustc 1.98.0 · hyperfine 1.20.0

Verdict: noise. --version slightly faster, --help slightly slower, TUI first frame unchanged. Startup/idle is dominated by the TUI, not argv.

clap usage-rs
--version 9.7 ms ± 1.6 8.7 ms ± 2.2 (~1.12×)
--help 8.6 ms ± 1.1 9.3 ms ± 2.2
TUI first frame 53.5 ms (best 50.2) 54.3 ms (best 53.1)
binary 52 MB 52 MB

Did not write PERF.md.

--version ~7.1ms -> ~7-9ms (slightly worse)
TUI first frame (best) ~102-104 -> 104ms (same)
Idle CPU ~0% ~0%
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploying crabcode with  Cloudflare Pages  Cloudflare Pages

Latest commit: f91a491
Status: ✅  Deploy successful!
Preview URL: https://5ab00dae.crabcode.pages.dev
Branch Preview URL: https://perf-cpu-optimizations-usage.crabcode.pages.dev

View logs

@Blankeos
Blankeos force-pushed the perf/cpu-optimizations-usage-rs branch from 29bf54e to 7580be1 Compare August 29, 2026 04:03
`crabcode completion --install` writes `_crabcode` and upserts a 3-line
block that sources it after other tools call `compinit`. Registers
aliases like `cc`. Does not call `compinit` or edit `$fpath`.
@Blankeos
Blankeos force-pushed the perf/cpu-optimizations-usage-rs branch from 2b0ddd7 to f91a491 Compare August 29, 2026 04:52
@Blankeos Blankeos changed the title feat: migrate clap to usage-rs experiment: migrate clap to usage-rs Aug 29, 2026
@Blankeos
Blankeos marked this pull request as draft August 29, 2026 18:50
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