Repository navigation
Generic Volta-style shims - #726
Closed
linghengqian wants to merge 1 commit into
Closed
linghengqian wants to merge 1 commit into
linghengqian wants to merge 1 commit into
Conversation
linghengqian
force-pushed
the
nodejs-some
branch
from
October 15, 2026 15:39
fac799c to
7995209
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #726 +/- ##
==========================================
+ Coverage 34.99% 38.97% +3.97%
==========================================
Files 95 96 +1
Lines 6704 6815 +111
==========================================
+ Hits 2346 2656 +310
+ Misses 4045 3797 -248
- Partials 313 362 +49 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
linghengqian
marked this pull request as ready for review
October 15, 2026 15:42
linghengqian
commented
Oct 15, 2026
linghengqian
left a comment
Member
Author
There was a problem hiding this comment.
- CC @aooohan @bytemain @Chance-fyi . Could you help review this?
linghengqian
force-pushed
the
nodejs-some
branch
from
October 15, 2026 15:57
7995209 to
2c3f76f
Compare
This was referenced Oct 15, 2026
Member
|
-1 Thanks for working on this. I see what you're trying to solve, but I don't think this is something we should support in vfox.
|
This was referenced Oct 17, 2026
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.
RFC: generic Volta-style shims for #725 (core stays language-agnostic)
What #725 actually asks for
Two layers, per the original report:
npm install -g rimrafstays onPATHaftervfox useswitches Node.pnpm add --globalonly fixes layer 1. Verified inubuntu:26.04with vfox 1.0.12:which playwright-clistays at~/.local/share/pnpm/bin/playwright-cliacross theswitch, but a probe CLI printing
process.versionflips fromv26.10.0tov24.21.0.The shim resolves
nodefrom the currentPATH, so runtime pinning is still missing.Why
vfox-nodejsalone cannot fix layer 2Current core behavior (this repo):
EnvKeysonly puts the currently selected version'sbinonPATH(
internal/sdk/sdk.goEnvKeys/EnvKeysForScope). Switching versions drops theold
bin, sonpm -gbinaries disappear.PostInstallruns once atvfox install nodejs@X(internal/sdk/sdk.go).It never sees later
npm install -g Y, so it can't create per-package shims.PreUsecan only return a version string (internal/plugin/model.go). There is nopost-switch hook, no stable shim dir on
PATH, and no generic way to interceptglobal installs.
So a Lua-only fix maxes out at asdf-style
default-packages(reinstall on new Nodewith the new runtime). That solves "available" but not "pinned to install-time
runtime", and wastes time/bandwidth.
Principle: no Node.js specifics in core
vfoxcore must not learnnpm -g,npm root -g, Node ABI, or JS shim bodies.nodejs is one plugin among many (
pip/cargo/go install/deno/bunwould allwant the same). Core owns where shims live, when plugins run, and PATH order.
Plugins own what a shim executes.
What this PR implements (generic)
PATH(internal/pathmeta/path_meta.go,internal/env/context.go,cmd/commands/env.go,cmd/commands/activate.go):~/.vfox/shims,<project>/.vfox/shims,<session>/shims, merged asprefix > shims (Project, Session, Global) > version bins > clean.They survive
useswitches. Core never reads shim contents.PostUsehook (internal/plugin/plugin.go,model.go,lua_plugin.go,internal/sdk/sdk.go):PLUGIN:PostUse(ctx)withcwd/scope/version/previousVersion/main/sdkInfo/shimDir,fired after scope links update in
useInHook, and manually viavfox reshim.Old plugins without it keep working (
HookFuncMapoptional,HasFunctionguard).vfox reshim(cmd/commands/reshim.go): re-links current selections andre-fires
PostUse. This is the manual sync point fornpm -g/pip installthat happens between two
usecalls (same role asasdf reshim).How
vfox-nodejswould use it (future, other repo)