Skip to content

feat(backend): add npm package-manager install options#9109

Merged
jdx merged 9 commits intojdx:mainfrom
risu729:copilot/npm-pnpm-bun-args
Apr 29, 2026
Merged

feat(backend): add npm package-manager install options#9109
jdx merged 9 commits intojdx:mainfrom
risu729:copilot/npm-pnpm-bun-args

Conversation

@risu729
Copy link
Copy Markdown
Contributor

@risu729 risu729 commented Apr 15, 2026

Summary

  • add npm backend tool options for manager-specific install arguments: npm_args, pnpm_args, bun_args, and aube_args
  • resolve the active npm package manager at install time, reusing the upstream auto/aube flow and applying args inline in each manager branch, matching the pipx backend style
  • include npm install-argument options in lockfile option resolution and install-time option filtering
  • document the npm backend tool options and add e2e assertions that each package manager receives its configured args, including aube
  • remove the unnecessary install_env / env alias support from the original version of this PR

Tests

  • cargo fmt --check
  • cargo test --quiet test_resolve_lockfile_options_includes_install_args_only

Not run locally:

  • mise run test:e2e e2e/backend/test_npm_package_manager e2e/backend/test_npm_aube - local task discovery reported no tasks defined in ~/.ghr/github.com/risu729/mise, so I did not run the e2e scripts directly.

Copy link
Copy Markdown
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 introduces support for package-manager-specific arguments (npm_args, pnpm_args, bun_args) and adds env as an alias for install_env within the npm backend. The changes include documentation updates, configuration parsing for the new alias, and logic to apply these options during tool installation. A review comment suggests refactoring resolve_install_lockfile_options to use the install_time_option_keys function to avoid duplicating the list of supported argument keys.

Comment thread src/backend/npm.rs Outdated
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 15, 2026

Greptile Summary

This PR adds npm_args, pnpm_args, bun_args, and aube_args tool options to the npm backend, using shell_words::split to inject user-supplied arguments at the end of each package manager's install command, and wires them into resolve_lockfile_options so they are tracked in the lockfile. The implementation mirrors the pipx backend style and the documentation is correct. The only new finding is that the unit test omits pnpm_args from its coverage, leaving one of the four declared install_time_option_keys untested.

Confidence Score: 4/5

Safe to merge once previously flagged e2e fragilities (--before assertion on modern npm, aube path after .mise.toml overwrite) are resolved.

Core Rust implementation is correct and consistent across all four manager branches. Score is capped at 4 due to pre-existing P1 findings in the e2e test (--before assertion breakage on npm >= 11.10.0, aube availability after heredoc overwrite) that remain unaddressed in this revision.

e2e/backend/test_npm_package_manager — the npm --before assertion and aube path availability after .mise.toml overwrite need attention before CI on modern npm/aube environments.

Important Files Changed

Filename Overview
src/backend/npm.rs Adds npm_args, pnpm_args, bun_args, aube_args tool options with shell_words::split injection into each manager branch; implements resolve_lockfile_options and install_time_option_keys; unit test coverage is missing pnpm_args.
src/backend/mod.rs Registers BackendType::Npm in install_time_option_keys_for_type; straightforward one-line addition consistent with other backends.
e2e/backend/test_npm_package_manager Adds per-manager *_args assertions; the npm test still asserts --before which fails on npm >= 11.10.0, and mise use aube@latest (no -g) is immediately overwritten by the .mise.toml heredoc, risking aube not being in PATH during the aube test.
docs/dev-tools/backends/npm.md Documents all four *_args tool options with a correct aube example; no misleading content remains.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[install_version_] --> B{package_manager_for_install}
    B -->|Aube| C[write_aube_npmrc\naube add --global pkg@ver\n+ aube_args]
    B -->|Bun| D[bun install pkg@ver --global\n--trust --linker hoisted\n+ install_before_args\n+ bun_args]
    B -->|Pnpm| E[pnpm add --global pkg@ver\n--global-dir --global-bin-dir\n+ install_before_args\n+ pnpm_args]
    B -->|Npm / other| F[npm install -g pkg@ver\n--prefix\n+ install_before_args\n+ npm_args]
    G[resolve_lockfile_options] --> H{iterate install_time_option_keys}
    H -->|npm_args / pnpm_args\nbun_args / aube_args| I[include in lockfile BTreeMap]
    H -->|other keys| J[excluded]
Loading

Reviews (12): Last reviewed commit: "test(npm): pin pnpm setup version" | Re-trigger Greptile

Comment thread src/backend/npm.rs Outdated
Comment thread src/backend/npm.rs Outdated
Comment thread src/config/config_file/mise_toml.rs Outdated
@risu729 risu729 force-pushed the copilot/npm-pnpm-bun-args branch 2 times, most recently from 7294be8 to 6010a94 Compare April 19, 2026 04:57
Comment thread src/backend/npm.rs Outdated
@risu729 risu729 force-pushed the copilot/npm-pnpm-bun-args branch from 6010a94 to cca2578 Compare April 19, 2026 05:02
Comment thread e2e/backend/test_npm_package_manager
@risu729 risu729 force-pushed the copilot/npm-pnpm-bun-args branch from 57bc245 to c3d5581 Compare April 19, 2026 20:17
@risu729 risu729 marked this pull request as ready for review April 19, 2026 20:29
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@risu729 risu729 marked this pull request as draft April 19, 2026 20:29
@risu729 risu729 marked this pull request as ready for review April 20, 2026 17:51
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Comment thread docs/dev-tools/backends/npm.md Outdated
@risu729 risu729 marked this pull request as draft April 22, 2026 18:59
@risu729 risu729 marked this pull request as ready for review April 22, 2026 22:42
Comment thread e2e/backend/test_npm_package_manager
@jdx
Copy link
Copy Markdown
Owner

jdx commented Apr 26, 2026

I think this is ok @risu729 but it has merge conflicts

@risu729
Copy link
Copy Markdown
Contributor Author

risu729 commented Apr 29, 2026

Sorry, I was busy. It should work now.

@jdx jdx merged commit 16d20cf into jdx:main Apr 29, 2026
35 checks passed
@risu729 risu729 deleted the copilot/npm-pnpm-bun-args branch April 29, 2026 13:01
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