Skip to content

Conversation

@imliam
Copy link
Contributor

@imliam imliam commented Aug 16, 2025

This PR adds a helper that determines which NPM package manager should be used to run any given script out of npm, pnpm, yarn and bun. This should help AI use the correct CLI tools to use when running npm commands based on the project's existing dependencies.

Copilot AI review requested due to automatic review settings August 16, 2025 12:03
Copy link

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 adds functionality to dynamically detect which NPM package manager (npm, pnpm, yarn, or bun) should be used in a Laravel project by checking for the presence of their respective lock files. The implementation includes a new method in the GuidelineAssist class and updates AI guidance templates to use the detected package manager instead of hardcoded "npm" commands.

  • Added nodePackageManager() method to detect package manager from lock files
  • Created comprehensive test coverage for all supported package managers
  • Updated AI guidance templates to dynamically reference the correct package manager

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Install/GuidelineAssist.php Added nodePackageManager() method with file-based detection logic
tests/Feature/Install/GuidelineAssistTest.php Added test suite covering all package managers and edge cases
.ai/laravel/core.blade.php Updated Vite error guidance to use dynamic package manager
.ai/foundation.blade.php Updated frontend bundling guidance to use dynamic package manager

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@ashleyhindle
Copy link
Collaborator

Great thinking @imliam 💪 Think it'd be best to compute it only once rather than on each call 👌

@imliam
Copy link
Contributor Author

imliam commented Aug 16, 2025

Great thinking @imliam 💪 Think it'd be best to compute it only once rather than on each call 👌

Consider it done @ashleyhindle!

@pushpak1300
Copy link
Member

@imliam Thanks.

@ashleyhindle I think the node detection should be part of the https://github.com/laravel/roster and then we can easily use it here ? something like $roster->nodePackageManager()

@taylorotwell
Copy link
Member

This one has some merge conflicts.

@imliam
Copy link
Contributor Author

imliam commented Oct 15, 2025

@taylorotwell - This one has some merge conflicts.

Conflicts resolved, but I do agree with @pushpak1300 that laravel/roster#24 is a better/more consistent solution. If that gets merged I'll update this branch to use it.

@pushpak1300
Copy link
Member

@imliam the laravel/roster#24 has been merged and tagged. Thanks

@imliam
Copy link
Contributor Author

imliam commented Oct 20, 2025

Doesn't look like it's been tagged yet - I'll keep an eye and update this MR when it has

@pushpak1300
Copy link
Member

@imliam
Copy link
Contributor Author

imliam commented Oct 20, 2025

All updated 👍

pushpak1300 and others added 2 commits October 23, 2025 16:42
…kage manager guideline tests

Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
Signed-off-by: Pushpak Chhajed <pushpak1300@gmail.com>
@pushpak1300 pushpak1300 merged commit 20486fa into laravel:main Oct 24, 2025
17 checks passed
@pushpak1300
Copy link
Member

Thanks @imliam !

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.

5 participants