Open
Conversation
d025764 to
d57bfcc
Compare
Add layered ccusage runner fallback with bunx ahead of pnpm dlx, yarn dlx, and npx, and remove the interactive npx help probe. Signed-off-by: Denis Usanov <denis@usanov.info>
Author
|
@pszymkowiak could you please take a look at this small PR? |
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes
rtk cc-economicswhen ccusage is not installed as a direct binary but is available through Bun. RTK previously hardcoded a direct ccusage binary first and npx second, which caused it to miss valid bunx ccusage setups and, in practice, select older or less capable ccusage builds (at least on my machine) than the user’s normal workflow. Separately,bunxis significantly faster thannpxfor one-off package execution. Users with Bun installed should get it as the first fallback before npx.The improvement:
The change introduces layered runner selection for ccusage with this priority:
direct binary → bunx → pnpm dlx → yarn dlx → npx. It also removes the interactive npx ccusage --help probe, which could add latency or hang-like behavior before the real command even ran.How It Works
ccusageexecution is now selected through a dedicated runner policy instead of ad hoc probing.The new selection order is:
This is important for RTK because cc-economics depends on ccusage features and output shape, and different runners can resolve different installed versions in real user environments. In my local
investigation, bunx ccusage resolved a newer build than npx ccusage, and the older npx path did not support commands that RTK expects, such as weekly reporting.
Test plan
cargo fmt --all --check— cleancargo clippy --all-targets— no new warningscargo test ccusage— 14/14 passNonecase tested when no runner is available