Skip to content

feat(cli): add package manager bin to PATH during auto-install#361

Merged
fengmk2 merged 2 commits intomainfrom
12-23-fix_cli_auto_add_package_manager_bin_to_path_env
Dec 23, 2025
Merged

feat(cli): add package manager bin to PATH during auto-install#361
fengmk2 merged 2 commits intomainfrom
12-23-fix_cli_auto_add_package_manager_bin_to_path_env

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Dec 23, 2025

TL;DR

Updates the auto-install process to add the package manager's bin directory to the PATH environment variable, allowing tasks to access the package manager directly.

What changed?

  • Made format_path_env function public in the vite_install crate
  • Modified auto_install to return the package manager's bin prefix
  • Updated the CLI to set the PATH environment variable to include the package manager's bin directory
  • Added a new snap test to verify that tasks can access the package manager directly
  • Refactored InstallCommand to accept a pre-built package manager

How to test?

Run the new snap test which verifies that a task can execute yarn --version directly:

cd packages/cli/snap-tests/vite-task-path-env-include-pm
vite run check-yarn-version

Why make this change?

This change ensures that tasks can directly access the package manager without needing to specify its full path. This is particularly useful for scripts that rely on package manager commands (like yarn, npm, pnpm) being available in the PATH. Previously, tasks would fail if they tried to execute package manager commands directly.

Copy link
Copy Markdown
Member Author

fengmk2 commented Dec 23, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 changed the title fix(cli): auto add package manager bin to PATH env feat(cli): add package manager bin to PATH during auto-install Dec 23, 2025
@fengmk2 fengmk2 self-assigned this Dec 23, 2025
- Export format_path_env from vite_install crate
- Modify auto_install to return package manager bin_prefix
- Add execute_with_package_manager method to avoid building PM twice
- Update PATH environment before task execution

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@fengmk2 fengmk2 force-pushed the 12-23-fix_cli_auto_add_package_manager_bin_to_path_env branch from dc6657b to 42e71d1 Compare December 23, 2025 06:54
@fengmk2 fengmk2 marked this pull request as ready for review December 23, 2025 06:55
@fengmk2 fengmk2 requested review from Brooooooklyn, branchseer and Copilot and removed request for Copilot December 23, 2025 06:55
@fengmk2 fengmk2 merged commit 8b5d146 into main Dec 23, 2025
18 checks passed
Copy link
Copy Markdown
Member Author

fengmk2 commented Dec 23, 2025

Merge activity

@fengmk2 fengmk2 deleted the 12-23-fix_cli_auto_add_package_manager_bin_to_path_env branch December 23, 2025 08:24
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