Skip to content

Comments

refactor: use enum for npm.pacakge_manager#8180

Merged
jdx merged 3 commits intojdx:mainfrom
risu729:npm-pm-enum
Feb 16, 2026
Merged

refactor: use enum for npm.pacakge_manager#8180
jdx merged 3 commits intojdx:mainfrom
risu729:npm-pm-enum

Conversation

@risu729
Copy link
Contributor

@risu729 risu729 commented Feb 16, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 16, 2026 12:46
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @risu729, 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 significantly improves the robustness and maintainability of the npm.package_manager configuration by converting it from a free-form string to a strongly typed enum. This change ensures that only predefined and valid package managers can be specified, reducing potential errors and making the codebase more explicit. The necessary adjustments have been made across the configuration schema, settings file, and the core backend logic to fully integrate this new enum-based approach.

Highlights

  • Type Safety Improvement: The npm.package_manager setting has been refactored from a string to a Rust enum, enhancing type safety and preventing invalid package manager configurations.
  • Schema and Configuration Updates: The schema/mise.json and settings.toml files were updated to reflect the new enum structure, explicitly listing 'npm', 'bun', and 'pnpm' as valid options.
  • Backend Logic Adaptation: The src/backend/npm.rs file was modified to utilize the new NpmPackageManager enum for all package manager comparisons and installation logic.
  • Build System Integration: A rerun-if-changed directive was added to build.rs to ensure the build script is re-executed when settings.toml is modified.
Changelog
  • build.rs
    • Added a println! macro to trigger a rerun of the build script if settings.toml changes.
  • schema/mise.json
    • Restricted the package_manager property to an enumerated list of 'npm', 'bun', and 'pnpm'.
  • settings.toml
    • Added enum and rust_type fields to the npm.package_manager definition, specifying allowed values and the corresponding Rust enum type.
  • src/backend/npm.rs
    • Imported the new NpmPackageManager enum.
    • Updated package_manager comparisons and assignments to use the NpmPackageManager enum variants instead of string literals.
    • Modified string comparison for tool_name to use package_manager.to_string().
  • src/config/settings.rs
    • Defined a new NpmPackageManager enum with Npm, Bun, and Pnpm variants, including necessary traits for serialization, deserialization, and string conversion.
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.

Copy link
Contributor

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

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 is a nice refactoring that replaces the string-based npm.package_manager setting with a strongly-typed enum, NpmPackageManager. This improves type safety and code clarity across the board, from settings definition and parsing to the logic within the NPMBackend. The changes in settings.toml, schema/mise.json, and the build script are all correct and support this refactoring.

I've added a few suggestions in src/backend/npm.rs to make the match statements on the new enum exhaustive by replacing wildcard _ patterns with explicit enum variants. This will improve maintainability and leverage compiler checks for future changes.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the npm package manager configuration from using a plain string to using a proper enum type (NpmPackageManager). This change improves type safety and ensures only valid package managers (npm, bun, pnpm) can be configured.

Changes:

  • Introduced NpmPackageManager enum with three variants: Npm, Bun, and Pnpm
  • Updated all references to npm.package_manager throughout the codebase to use the enum type
  • Added enum constraints to the JSON schema and settings.toml configuration

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/config/settings.rs Defines the new NpmPackageManager enum with proper derives and serialization attributes
src/backend/npm.rs Updates all package manager logic to use the enum instead of string comparisons
settings.toml Adds enum constraint and rust_type specification for the package_manager setting
schema/mise.json Adds JSON schema enum constraint for package_manager field
build.rs Adds cargo rerun directive for settings.toml changes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

risu729 and others added 2 commits February 16, 2026 23:55
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@jdx jdx merged commit f659f13 into jdx:main Feb 16, 2026
33 checks passed
@risu729 risu729 deleted the npm-pm-enum branch February 16, 2026 13:54
mise-en-dev added a commit that referenced this pull request Feb 17, 2026
### 🚀 Features

- **(task)** stream keep-order output in real-time per task by @jdx in
[#8164](#8164)

### 🐛 Bug Fixes

- **(aqua)** resolve lockfile artifacts for target platform (fix
discussion #7479) by @mackwic in
[#8183](#8183)
- **(exec)** strip shims from PATH to prevent recursive shim execution
by @jdx in [#8189](#8189)
- **(hook-env)** preserve PATH reordering done after activation by @jdx
in [#8190](#8190)
- **(lockfile)** resolve version aliases before lockfile lookup by @jdx
in [#8194](#8194)
- **(registry)** set helm-diff archive bin name to diff by @jean-humann
in [#8173](#8173)
- **(task)** improve source freshness checks with dynamic task dirs by
@rooperuu in [#8169](#8169)
- **(task)** resolve global tasks when running from monorepo root by
@jdx in [#8192](#8192)
- **(task)** prevent wildcard glob `test:*` from matching parent task
`test` by @jdx in [#8165](#8165)
- **(task)** resolve task_config.includes relative to config root by
@jdx in [#8193](#8193)
- **(upgrade)** skip untrusted tracked configs during upgrade by @jdx in
[#8195](#8195)

### 🚜 Refactor

- use enum for npm.pacakge_manager by @risu729 in
[#8180](#8180)

### 📚 Documentation

- **(plugins)** replace node/asdf-nodejs examples with vfox plugins by
@jdx in [#8191](#8191)

### ⚡ Performance

- call npm view only once by @risu729 in
[#8181](#8181)

### New Contributors

- @jean-humann made their first contribution in
[#8173](#8173)
- @mackwic made their first contribution in
[#8183](#8183)
- @rooperuu made their first contribution in
[#8169](#8169)

## 📦 Aqua Registry Updates

#### New Packages (2)

- [`BetterDiscord/cli`](https://github.com/BetterDiscord/cli)
- [`glossia.ai/cli`](https://github.com/glossia.ai/cli)
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
lucasew pushed a commit to lucasew/CONTRIB-mise that referenced this pull request Feb 18, 2026
### 🚀 Features

- **(task)** stream keep-order output in real-time per task by @jdx in
[jdx#8164](jdx#8164)

### 🐛 Bug Fixes

- **(aqua)** resolve lockfile artifacts for target platform (fix
discussion jdx#7479) by @mackwic in
[jdx#8183](jdx#8183)
- **(exec)** strip shims from PATH to prevent recursive shim execution
by @jdx in [jdx#8189](jdx#8189)
- **(hook-env)** preserve PATH reordering done after activation by @jdx
in [jdx#8190](jdx#8190)
- **(lockfile)** resolve version aliases before lockfile lookup by @jdx
in [jdx#8194](jdx#8194)
- **(registry)** set helm-diff archive bin name to diff by @jean-humann
in [jdx#8173](jdx#8173)
- **(task)** improve source freshness checks with dynamic task dirs by
@rooperuu in [jdx#8169](jdx#8169)
- **(task)** resolve global tasks when running from monorepo root by
@jdx in [jdx#8192](jdx#8192)
- **(task)** prevent wildcard glob `test:*` from matching parent task
`test` by @jdx in [jdx#8165](jdx#8165)
- **(task)** resolve task_config.includes relative to config root by
@jdx in [jdx#8193](jdx#8193)
- **(upgrade)** skip untrusted tracked configs during upgrade by @jdx in
[jdx#8195](jdx#8195)

### 🚜 Refactor

- use enum for npm.pacakge_manager by @risu729 in
[jdx#8180](jdx#8180)

### 📚 Documentation

- **(plugins)** replace node/asdf-nodejs examples with vfox plugins by
@jdx in [jdx#8191](jdx#8191)

### ⚡ Performance

- call npm view only once by @risu729 in
[jdx#8181](jdx#8181)

### New Contributors

- @jean-humann made their first contribution in
[jdx#8173](jdx#8173)
- @mackwic made their first contribution in
[jdx#8183](jdx#8183)
- @rooperuu made their first contribution in
[jdx#8169](jdx#8169)

## 📦 Aqua Registry Updates

#### New Packages (2)

- [`BetterDiscord/cli`](https://github.com/BetterDiscord/cli)
- [`glossia.ai/cli`](https://github.com/glossia.ai/cli)
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.

2 participants