Skip to content

Changeset release master - #185

Merged
Dargon789 merged 3 commits into
mainfrom
changeset-release-master
Mar 14, 2026
Merged

Changeset release master#185
Dargon789 merged 3 commits into
mainfrom
changeset-release-master

Conversation

@Dargon789

@Dargon789 Dargon789 commented Mar 14, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Release fnm 1.39.1 with improved env/use-on-cd behavior, expanded architecture support, and more robust installer and shell integration.

New Features:

  • Add support for the x64-glibc-217 architecture via a new --arch x64-glibc-217 option.

Bug Fixes:

  • Ensure Windows cmd use-on-cd works correctly with paths containing spaces and drive changes.
  • Prevent duplicate zsh use-on-cd hooks when the env output is sourced multiple times.
  • Reduce noise from internal fnm use calls by routing informational messages to stderr only when requested.

Enhancements:

  • Apply the appropriate Node version immediately during fnm env --use-on-cd to avoid an extra fnm use subprocess on shell startup.
  • Allow FnmConfig and Directories to be cloned and pass multishell paths through config helpers.
  • Refine interactive missing-version messaging to clearly attribute the prompt to fnm.

Build:

  • Bump the Rust toolchain to 1.88 in the project metadata.

CI:

  • Adjust the installation script CI to test ARM images using explicit Docker platforms and clean up YAML formatting and quoting.

Documentation:

  • Update README, CLI help, and command docs to recommend explicit --shell usage with fnm env and correct minor formatting issues.
  • Refresh the changelog for versions 1.39.0 and 1.39.1 to document recent changes.

Tests:

  • Extend end-to-end tests for use-on-cd to cover immediate version application and repeated env sourcing across shells.
  • Add unit tests validating zsh hook de-duplication and Windows cmd macro quoting for use-on-cd.

Chores:

  • Remove processed changeset files from the repository and bump crate and package versions to 1.39.1.

@vercel

vercel Bot commented Mar 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fnm Canceled Canceled Mar 14, 2026 2:06am

@sourcery-ai

sourcery-ai Bot commented Mar 14, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements performance and robustness improvements for fnm env --use-on-cd, adds support for the x64-glibc-217 architecture, fixes several shell-specific behaviors (zsh, fish, PowerShell, Windows CMD), adjusts installer CI for ARM platforms, and updates docs, changelog, and versioning for the 1.39.1 release.

Sequence diagram for fnm env --use-on-cd initial version application

sequenceDiagram
    actor User
    participant Shell
    participant FnM as FnmEnvCommand
    participant Config as FnmConfig
    participant UseCmd as UseCommand

    User->>Shell: run fnm env --use-on-cd --shell <S>
    Shell->>FnM: execute Env::apply(config)
    FnM->>Config: clone()
    FnM->>FnM: compute multishell_path
    FnM->>FnM: set_path_for_multishell(multishell_path)
    FnM->>Config: with_multishell_path(multishell_path)
    FnM->>UseCmd: construct Use { version: None, install_if_missing: false, silent_if_unchanged: true, info_to_stderr: true }
    FnM->>UseCmd: apply(&config_with_multishell)
    UseCmd->>UseCmd: detect current directory version
    UseCmd->>UseCmd: maybe install version
    UseCmd->>UseCmd: maybe switch multishell to directory version
    UseCmd-->>FnM: Result (ignored)
    FnM-->>Shell: print shell.use_on_cd(config)
    Shell-->>User: evaluates hook for future cd events
Loading

Sequence diagram for Windows CMD cd hook with quoted macro path

sequenceDiagram
    actor User
    participant Cmd as WindowsCmdShell
    participant FnM as WindowsCmdImpl
    participant Config as FnmConfig

    User->>Cmd: run fnm env --use-on-cd --shell cmd
    Cmd->>FnM: WindowsCmd.use_on_cd(&config)
    FnM->>Config: get_base_dir()
    FnM->>FnM: create_cd_file_at(base_dir/cd.cmd)
    FnM-->>Cmd: doskey cd="<path_to_cd.cmd>" $*
    Cmd-->>User: future cd uses quoted macro (supports paths with spaces)

    User->>Cmd: cd C:\Path With Spaces
    Cmd->>Cmd: executes cd.cmd with /d %*
    Cmd->>FnM: fnm use --silent-if-unchanged
    FnM-->>Cmd: adjusts Node version for directory
Loading

Class diagram for updated Use command and configuration types

classDiagram
    class FnmConfig {
        <<struct>>
        +Url node_dist_mirror
        +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>>
        +Directories(basedirs BaseStrategy)
    }

    class Use {
        <<struct>>
        +Option~UserVersion~ version
        +bool install_if_missing
        +bool silent_if_unchanged
        +bool info_to_stderr
        +apply(config FnmConfig) Result~(), Error~
    }

    class EnvCommand {
        <<struct>>
        +bool use_on_cd
        +apply(config FnmConfig) Result~(), Error~
        -set_path_for_multishell(multishell_path Path)
    }

    class Command {
        <<trait>>
        +apply(config FnmConfig) Result~(), Error~
    }

    FnmConfig "1" <-- "1" Directories : uses
    Command <|.. Use
    Command <|.. EnvCommand

    class install_new_version_fn {
        <<function>>
        +install_new_version(requested_version UserVersion, config FnmConfig) Result~(), Error~
    }

    class use_installed_version_fn {
        <<function>>
        +use_installed_version(version Version, config FnmConfig) Result~(), Error~
    }

    install_new_version_fn ..> Use : constructs
    use_installed_version_fn ..> Use : constructs
    EnvCommand ..> Use : constructs
    EnvCommand ..> FnmConfig : with_multishell_path
    EnvCommand ..> Directories : uses
Loading

Class diagram for updated Arch enum

classDiagram
    class Arch {
        <<enum>>
        X86
        X64
        X64Musl
        X64Glibc217
        Arm64
        Armv7l
        Ppc64le
        Aarch64AppleDarwin
        fn as_str() str
        fn from_str(s str) Result~Arch, Error~
    }
Loading

Class diagram for shell-specific use-on-cd behavior (Zsh and WindowsCmd)

classDiagram
    class Shell {
        <<trait>>
        +env(config FnmConfig) Result~String, Error~
        +use_on_cd(config FnmConfig) Result~String, Error~
    }

    class Zsh {
        <<struct>>
        +use_on_cd(config FnmConfig) Result~String, Error~
    }

    class WindowsCmd {
        <<struct>>
        +env(config FnmConfig) Result~String, Error~
        +use_on_cd(config FnmConfig) Result~String, Error~
    }

    Shell <|.. Zsh
    Shell <|.. WindowsCmd
Loading

File-Level Changes

Change Details Files
Apply the initial Node version during fnm env --use-on-cd instead of requiring an immediate fnm use subprocess.
  • Introduce set_path_for_multishell to prepend the multishell bin directory to PATH at runtime, with OS-specific handling for Windows vs. Unix-like platforms.
  • Clone FnmConfig and add a with_multishell_path builder method so Env can construct a config that includes the multishell path for internal Use execution.
  • Invoke a Use command from within Env when use_on_cd is enabled, with silent_if_unchanged, info_to_stderr, and conditional forced color handling, and ignore errors if no version file is present.
  • Update FnmConfig and Directories to derive Clone so they can be safely reused in this new flow.
src/commands/env.rs
src/config.rs
src/directories.rs
Improve fnm use messaging/output behavior and extend Use with an internal-only stderr info flag.
  • Add an info_to_stderr field to Use, excluded from CLI via #[clap(skip)], to redirect informational output when used internally.
  • Change Use::apply to print messages to stderr (Error level) when info_to_stderr is true, otherwise keep existing Info-to-stdout behavior.
  • Ensure all call sites constructing Use (e.g., install path helpers) explicitly set info_to_stderr to false to preserve existing behavior.
  • Clarify the interactive missing-version message by prefixing it with fnm in should_install_interactively.
  • Update install_new_version and use_installed_version helpers to initialize info_to_stderr to false.
src/commands/use.rs
src/commands/install.rs
Harden --use-on-cd shell hooks across shells and ensure they behave correctly on re-source and Windows path edge cases.
  • For zsh, ensure the _fnm_autoload_hook is de-duplicated by first removing it via add-zsh-hook -D chpwd _fnm_autoload_hook before re-adding, and add a unit test that asserts this behavior.
  • For fish, remove the eager _fnm_autoload_hook call from the hook template so use-on-cd is only triggered on directory changes, not immediately upon env evaluation.
  • For Bash and PowerShell, drop the immediate invocation (__fnm_use_if_file_found / Set-FnmOnLoad) so hooks run only on cd rather than during initial env setup.
  • For Windows CMD, fix cd to handle drive changes and paths with spaces by updating cd.cmd to use cd /d %*, and quote the doskey macro expansion path; add a unit test for quoting and path-with-spaces behavior.
  • Extend e2e tests for use-on-cd to cover immediate use of the current directory version after env setup and correct behavior after sourcing env twice.
src/shell/zsh.rs
src/shell/fish.rs
src/shell/bash.rs
src/shell/powershell.rs
src/shell/windows_cmd/mod.rs
src/shell/windows_cmd/cd.cmd
e2e/use-on-cd.test.ts
Add support for the x64-glibc-217 architecture and bump versions/documentation for the 1.39.1 release.
  • Extend the Arch enum with X64Glibc217, wire it into as_str and FromStr to map the new x64-glibc-217 string, enabling CLI usage via --arch x64-glibc-217.
  • Update crate and package versions from 1.38.1 to 1.39.1 in Cargo.toml and package.json.
  • Update CHANGELOG.md with 1.39.0 and 1.39.1 entries summarizing the new features and fixes included in this release.
  • Remove consumed changeset files now represented in the changelog.
src/arch.rs
Cargo.toml
package.json
CHANGELOG.md
.changeset/grumpy-dingos-turn.md
.changeset/odd-mayflies-poke.md
.changeset/twelve-badgers-happen.md
Prefer explicit shell flags in installer scripts and docs, and adjust installation CI for ARM Docker platforms.
  • Update .ci/install.sh to call fnm env with explicit --shell flags for zsh, fish, and bash instead of relying on runtime shell inference, and switch to consistent double-quoted strings in script arguments and step names.
  • Update CLI and docs examples (src/cli.rs, docs/commands.md, README.md) to show fnm env --shell <shell> usage and add a tip recommending explicit shell selection to avoid runtime inference overhead.
  • Tidy README link spacing and markdown formatting.
  • Adjust the installation_script GitHub workflow to use a matrix.include that pairs ARM Docker images with the correct --platform values and minor formatting cleanup (spacing/quoting).
.ci/install.sh
src/cli.rs
docs/commands.md
README.md
.github/workflows/installation_script.yml

Possibly linked issues


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!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@snyk-io

snyk-io Bot commented Mar 14, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a series of enhancements to fnm's shell integration, performance, and overall stability. It refines how fnm interacts with various shell environments by making fnm env more explicit and efficient, particularly for the use-on-cd feature. The changes also broaden fnm's compatibility by adding support for a new architecture and include general project updates.

Highlights

  • Shell Integration Improvements: The installer-generated shell setup now explicitly specifies shell flags (e.g., --shell zsh, --shell bash, --shell fish) for fnm env calls, enhancing reliability and performance across different shell environments.
  • Optimized use-on-cd Performance: The fnm env --use-on-cd command now applies the initial Node.js version immediately during environment setup, eliminating the need for an extra fnm use subprocess and reducing shell startup overhead.
  • Expanded Architecture Support: Added support for the x64-glibc-217 architecture, allowing fnm to manage Node.js versions for this specific environment.
  • Enhanced Shell Hook Robustness: Improved the robustness of the --use-on-cd shell hook, including de-duplicating the Zsh chpwd hook to prevent multiple executions and fixing Windows CMD behavior for paths containing spaces or drive changes.
  • Clarified User Prompts: The interactive prompt for fnm use when a version is missing has been clarified by prefixing the message with 'fnm', making it clearer which tool is requesting Node.js installation.
  • Version Updates and Toolchain Bump: The project version has been updated to 1.39.1, and the Rust toolchain has been bumped to 1.88, reflecting general maintenance and dependency updates.
Changelog
  • CHANGELOG.md
    • Added entries for versions 1.39.1 and 1.39.0, detailing new features, improvements, and bug fixes.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/installation_script.yml
Activity
  • The pull request title 'Changeset release master' and empty description indicate this is likely an automated release PR.
  • The changes reflect a new version release, updating CHANGELOG.md, Cargo.toml, Cargo.lock, and package.json to version 1.39.1.
  • Code modifications across various files align with the features and fixes described in the changelog entries for versions 1.39.0 and 1.39.1.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The new set_path_for_multishell helper wraps std::env::set_var in an unsafe block even though the call is safe; you can drop the unsafe block entirely to avoid suggesting undefined behavior risk where there is none.
  • In Use::apply, routing informational messages to stderr by switching the log level from Info to Error when info_to_stderr is true may confuse downstream consumers that interpret log levels; consider a dedicated macro/flag for stderr output that preserves the semantic log level.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `set_path_for_multishell` helper wraps `std::env::set_var` in an `unsafe` block even though the call is safe; you can drop the `unsafe` block entirely to avoid suggesting undefined behavior risk where there is none.
- In `Use::apply`, routing informational messages to stderr by switching the log level from `Info` to `Error` when `info_to_stderr` is true may confuse downstream consumers that interpret log levels; consider a dedicated macro/flag for stderr output that preserves the semantic log level.

## Individual Comments

### Comment 1
<location path="src/commands/env.rs" line_range="62-77" />
<code_context>
     }
 }

+fn set_path_for_multishell(multishell_path: &std::path::Path) {
+    let path_for_node = if cfg!(windows) {
+        multishell_path.to_path_buf()
+    } else {
+        multishell_path.join("bin")
+    };
+
+    let current_path = std::env::var_os("PATH").unwrap_or_default();
+    let mut split_paths: Vec<_> = std::env::split_paths(&current_path).collect();
+    split_paths.insert(0, path_for_node);
+    if let Ok(new_path) = std::env::join_paths(split_paths) {
+        unsafe {
+            std::env::set_var("PATH", new_path);
+        }
</code_context>
<issue_to_address>
**suggestion:** Remove the unnecessary `unsafe` block around `std::env::set_var`.

`std::env::set_var` is safe and does not require an `unsafe` block. Restricting `unsafe` to truly unsafe operations makes it easier to identify real safety boundaries and avoids suggesting extra invariants are needed here.

```suggestion
fn set_path_for_multishell(multishell_path: &std::path::Path) {
    let path_for_node = if cfg!(windows) {
        multishell_path.to_path_buf()
    } else {
        multishell_path.join("bin")
    };

    let current_path = std::env::var_os("PATH").unwrap_or_default();
    let mut split_paths: Vec<_> = std::env::split_paths(&current_path).collect();
    split_paths.insert(0, path_for_node);
    if let Ok(new_path) = std::env::join_paths(split_paths) {
        std::env::set_var("PATH", new_path);
    }
}
```
</issue_to_address>

### Comment 2
<location path="CHANGELOG.md" line_range="23" />
<code_context>
+
+### Patch Changes
+
+- [#1268](https://github.com/Schniz/fnm/pull/1268) [`ddab191`](https://github.com/Schniz/fnm/commit/ddab1911dc33a24aeec9d2b8139df1916c518d64) Thanks [@isaacl](https://github.com/isaacl)! - Make `fnm default` with no trailing positional argument to return the default version
+
+- [#1517](https://github.com/Schniz/fnm/pull/1517) [`d3747af`](https://github.com/Schniz/fnm/commit/d3747affd604223c752171c14944bd5773096b09) Thanks [@Schniz](https://github.com/Schniz)! - Improve `--use-on-cd` shell hook robustness by de-duplicating the zsh hook on re-source and fixing Windows CMD hook behavior for paths with spaces and drive changes.
</code_context>
<issue_to_address>
**suggestion (typo):** Rephrase this sentence to fix slightly awkward grammar.

The phrase "Make `fnm default` with no trailing positional argument to return the default version" is ungrammatical. Please rephrase to something like "Make `fnm default` with no trailing positional argument return the default version."

```suggestion
- [#1268](https://github.com/Schniz/fnm/pull/1268) [`ddab191`](https://github.com/Schniz/fnm/commit/ddab1911dc33a24aeec9d2b8139df1916c518d64) Thanks [@isaacl](https://github.com/isaacl)! - Make `fnm default` with no trailing positional argument return the default version
```
</issue_to_address>

Fix all in Cursor


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread src/commands/env.rs
Comment thread CHANGELOG.md Outdated
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
@vercel

This comment was marked as resolved.

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request bundles a series of features, bug fixes, and enhancements for the fnm 1.39.1 release. The changes are comprehensive, including improved use-on-cd behavior for better performance and robustness, expanded architecture support, and documentation updates. The code quality is high, with new functionality well-tested and integrated. I have one suggestion to improve code safety by removing an unsafe block. Overall, this is an excellent set of changes preparing for the new release.

Comment thread src/commands/env.rs
@Dargon789

Copy link
Copy Markdown
Owner Author

@Mergifyio refresh

@mergify

mergify Bot commented Mar 14, 2026

Copy link
Copy Markdown

refresh

✅ Pull request refreshed

@Dargon789
Dargon789 merged commit b3584f9 into main Mar 14, 2026
10 of 13 checks passed
@Dargon789
Dargon789 deleted the changeset-release-master branch March 14, 2026 03:45
@Dargon789 Dargon789 linked an issue Apr 5, 2026 that may be closed by this pull request
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.

e2e Linux tests using static binary artifact

1 participant