You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements immediate application of the current directory Node version during fnm env --use-on-cd, improves shell hooks (especially zsh and Windows CMD), prefers explicit shell selection in installer-generated env setup, adds support for the x64-glibc-217 architecture, and updates tests, docs, CI, and versioning metadata for the 1.39.0 release.
Sequence diagram for fnm env --use-on-cd applying current directory version
sequenceDiagram
actor User
participant Shell
participant FnmEnv as Env_command
participant SetPath as set_path_for_multishell
participant UseCmd as Use_command
User->>Shell: runs startup script
Shell->>FnmEnv: fnm env --use-on-cd --shell <shell>
FnmEnv->>SetPath: set_path_for_multishell(multishell_path)
SetPath-->>FnmEnv: PATH updated with multishell_path
FnmEnv->>FnmEnv: config_with_multishell = config.clone().with_multishell_path(multishell_path)
FnmEnv->>UseCmd: construct Use { version: None, install_if_missing: false, silent_if_unchanged: true, info_to_stderr: true }
FnmEnv->>UseCmd: apply(config_with_multishell)
UseCmd-->>FnmEnv: apply result (ignored on error)
FnmEnv-->>Shell: shell.use_on_cd(config) script
Shell-->>User: environment ready, current directory version already active
Loading
Class diagram for updated Use, FnmConfig, Arch, and Directories types
classDiagram
class Use {
+UserVersion~Option~ version
+bool install_if_missing
+bool silent_if_unchanged
+bool info_to_stderr
+apply(config: FnmConfig) Result
}
class FnmConfig {
+Url node_dist_mirror
+Url node_rc_mirror
+Option~PathBuf~ base_dir
+Option~PathBuf~ multishell_path
+with_base_dir(base_dir: Option~PathBuf~) FnmConfig
+with_multishell_path(multishell_path: PathBuf) FnmConfig
}
class Directories {
<<struct>>
}
class Arch {
<<enum>>
X86
X64
X64Musl
X64Glibc217
Arm64
Armv7l
Ppc64le
Aarch64AppleDarwin
+as_str() &str
+from_str(s: &str) Result~Arch~
}
FnmConfig --> Directories : uses
FnmConfig --> Arch : configured_with
Use --> FnmConfig : apply(config)
class WindowsCmd {
+use_on_cd(config: FnmConfig) Result~String~
}
class Zsh {
+use_on_cd(config: FnmConfig) Result~String~
}
WindowsCmd ..> FnmConfig : generates cd macro
Zsh ..> FnmConfig : generates chpwd hook
Loading
File-Level Changes
Change
Details
Files
Apply current directory version eagerly when running fnm env --use-on-cd and route its informational output to stderr when used internally.
Introduce set_path_for_multishell to prepend the multishell path (or its bin subdir) to PATH before running Use during env setup.
Clone and extend FnmConfig with a new with_multishell_path helper and use it to configure the internal Use command inside Env when use_on_cd is enabled.
Add an info_to_stderr flag to the Use command and route messages to stderr when invoked internally from fnm env, while keeping stdout clean for shell evaluation.
Update all internal Use invocations (install, install_new_version, etc.) to set info_to_stderr appropriately and tweak the interactive missing-version error prefix to include fnm.
Add end-to-end tests to verify that use-on-cd applies the version immediately after env setup and remains correct when env is sourced multiple times.
Harden and test shell hooks for --use-on-cd, particularly for zsh and Windows CMD, and slightly simplify other shell hooks.
Change the zsh use_on_cd hook to remove any existing _fnm_autoload_hook before adding it again via add-zsh-hook -D chpwd _fnm_autoload_hook, and add a unit test asserting this behavior.
Wrap the Windows CMD doskey macro path in quotes to safely handle paths with spaces and add a test that exercises a base directory containing spaces.
Update cd.cmd to call cd /d so drive changes work correctly on Windows, while still running the fnm use logic based on FNM_VERSION_FILE_STRATEGY.
Remove redundant initial autoload invocations from the Fish, Bash, and PowerShell use_on_cd hooks so that version switching is driven purely by the cd alias or hook logic.
Prefer explicit shell flags in installer-generated setup, document this guidance, and tweak CLI/docs examples.
Update .ci/install.sh to call fnm env with explicit --shell flags for zsh, fish, and bash in the generated shell configuration blocks.
Adjust CLI help text and docs (README.md, docs/commands.md) to show examples that pass explicit --shell values instead of relying on runtime shell inference.
Add a tip to the README recommending explicit shell selection to reduce startup overhead and avoid process tree detection.
Prepare and document the 1.39.0 release, including behavior tweaks already implemented in code.
Bump crate and package versions from 1.38.1 to 1.39.0 in Rust and npm metadata.
Add a 1.39.0 section to the changelog describing the new env --use-on-cd behavior, use flag on install, zsh/CMD hook robustness, default-version behavior, and Rust toolchain bump.
Perform minor doc and SVG touchups associated with the release branding.
CHANGELOG.md Cargo.toml package.json docs/fnm.svg
Possibly linked issues
Version Packages (Schniz#1444) #178: They both target env --use-on-cd: applying the initial version via use, refining shell hooks, and CMD behavior.
Tips and commands
Interacting with Sourcery
Trigger a new review: Comment @sourcery-ai review on the pull request.
Continue discussions: Reply directly to Sourcery's review comments.
Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with @sourcery-ai issue to create an issue from it.
Generate a pull request title: Write @sourcery-ai anywhere in the pull
request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
Generate a pull request summary: Write @sourcery-ai summary anywhere in
the pull request body to generate a PR summary at any time exactly where you
want it. You can also comment @sourcery-ai summary on the pull request to
(re-)generate the summary at any time.
Generate reviewer's guide: Comment @sourcery-ai guide on the pull
request to (re-)generate the reviewer's guide at any time.
Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
pull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
request to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!
Reviewer's Guide
Implements immediate application of the current directory Node version during
fnm env --use-on-cd, improves shell hooks (especially zsh and Windows CMD), prefers explicit shell selection in installer-generated env setup, adds support for thex64-glibc-217architecture, and updates tests, docs, CI, and versioning metadata for the 1.39.0 release.Sequence diagram for fnm env --use-on-cd applying current directory version
sequenceDiagram actor User participant Shell participant FnmEnv as Env_command participant SetPath as set_path_for_multishell participant UseCmd as Use_command User->>Shell: runs startup script Shell->>FnmEnv: fnm env --use-on-cd --shell <shell> FnmEnv->>SetPath: set_path_for_multishell(multishell_path) SetPath-->>FnmEnv: PATH updated with multishell_path FnmEnv->>FnmEnv: config_with_multishell = config.clone().with_multishell_path(multishell_path) FnmEnv->>UseCmd: construct Use { version: None, install_if_missing: false, silent_if_unchanged: true, info_to_stderr: true } FnmEnv->>UseCmd: apply(config_with_multishell) UseCmd-->>FnmEnv: apply result (ignored on error) FnmEnv-->>Shell: shell.use_on_cd(config) script Shell-->>User: environment ready, current directory version already activeClass diagram for updated Use, FnmConfig, Arch, and Directories types
classDiagram class Use { +UserVersion~Option~ version +bool install_if_missing +bool silent_if_unchanged +bool info_to_stderr +apply(config: FnmConfig) Result } class FnmConfig { +Url node_dist_mirror +Url node_rc_mirror +Option~PathBuf~ base_dir +Option~PathBuf~ multishell_path +with_base_dir(base_dir: Option~PathBuf~) FnmConfig +with_multishell_path(multishell_path: PathBuf) FnmConfig } class Directories { <<struct>> } class Arch { <<enum>> X86 X64 X64Musl X64Glibc217 Arm64 Armv7l Ppc64le Aarch64AppleDarwin +as_str() &str +from_str(s: &str) Result~Arch~ } FnmConfig --> Directories : uses FnmConfig --> Arch : configured_with Use --> FnmConfig : apply(config) class WindowsCmd { +use_on_cd(config: FnmConfig) Result~String~ } class Zsh { +use_on_cd(config: FnmConfig) Result~String~ } WindowsCmd ..> FnmConfig : generates cd macro Zsh ..> FnmConfig : generates chpwd hookFile-Level Changes
fnm env --use-on-cdand route its informational output to stderr when used internally.set_path_for_multishellto prepend the multishell path (or its bin subdir) to PATH before runningUseduring env setup.FnmConfigwith a newwith_multishell_pathhelper and use it to configure the internalUsecommand insideEnvwhenuse_on_cdis enabled.info_to_stderrflag to theUsecommand and route messages to stderr when invoked internally fromfnm env, while keeping stdout clean for shell evaluation.Useinvocations (install,install_new_version, etc.) to setinfo_to_stderrappropriately and tweak the interactive missing-version error prefix to includefnm.use-on-cdapplies the version immediately after env setup and remains correct when env is sourced multiple times.src/commands/env.rssrc/commands/use.rssrc/commands/install.rssrc/config.rssrc/directories.rse2e/use-on-cd.test.ts--use-on-cd, particularly for zsh and Windows CMD, and slightly simplify other shell hooks.use_on_cdhook to remove any existing_fnm_autoload_hookbefore adding it again viaadd-zsh-hook -D chpwd _fnm_autoload_hook, and add a unit test asserting this behavior.doskeymacro path in quotes to safely handle paths with spaces and add a test that exercises a base directory containing spaces.cd.cmdto callcd /dso drive changes work correctly on Windows, while still running thefnm uselogic based onFNM_VERSION_FILE_STRATEGY.use_on_cdhooks so that version switching is driven purely by the cd alias or hook logic.src/shell/zsh.rssrc/shell/windows_cmd/mod.rssrc/shell/windows_cmd/cd.cmdsrc/shell/fish.rssrc/shell/bash.rssrc/shell/powershell.rs.ci/install.shto callfnm envwith explicit--shellflags for zsh, fish, and bash in the generated shell configuration blocks.README.md,docs/commands.md) to show examples that pass explicit--shellvalues instead of relying on runtime shell inference..ci/install.shsrc/cli.rsREADME.mddocs/commands.mdx64-glibc-217and wire it through parsing, display, and release notes.X64Glibc217variant to theArchenum plus corresponding display string mapping andFromStrparsing forx64-glibc-217.--arch x64-glibc-217support forfnm env.src/arch.rs.changeset/brave-timers-move.mdCHANGELOG.mdCargo.tomlpackage.jsondocker_platformso ARM Docker runs specify the correct--platformflag per image..github/workflows/installation_script.yml.changeset/cuddly-cars-ring.md.changeset/fair-carrots-greet.md.changeset/grumpy-dingos-turn.md.changeset/odd-mayflies-poke.md.changeset/twelve-badgers-happen.mdenv --use-on-cdbehavior,useflag oninstall, zsh/CMD hook robustness, default-version behavior, and Rust toolchain bump.CHANGELOG.mdCargo.tomlpackage.jsondocs/fnm.svgPossibly linked issues
Tips and commands
Interacting with Sourcery
@sourcery-ai reviewon the pull request.issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it.@sourcery-aianywhere in the pullrequest title to generate a title at any time. You can also comment
@sourcery-ai titleon the pull request to (re-)generate the title at any time.@sourcery-ai summaryanywhere inthe pull request body to generate a PR summary at any time exactly where you
want it. You can also comment
@sourcery-ai summaryon the pull request to(re-)generate the summary at any time.
@sourcery-ai guideon the pullrequest to (re-)generate the reviewer's guide at any time.
@sourcery-ai resolveon thepull request to resolve all Sourcery comments. Useful if you've already
addressed all the comments and don't want to see them anymore.
@sourcery-ai dismisson the pullrequest to dismiss all existing Sourcery reviews. Especially useful if you
want to start fresh with a new review - don't forget to comment
@sourcery-ai reviewto trigger a new review!Customizing Your Experience
Access your dashboard to:
summary, the reviewer's guide, and others.
Getting Help
Originally posted by @sourcery-ai[bot] in #199 (comment)