fix(pgpm): use correct relative path in cd hint after init#1042
Merged
pyramation merged 1 commit intomainfrom Apr 30, 2026
Merged
fix(pgpm): use correct relative path in cd hint after init#1042pyramation merged 1 commit intomainfrom
pyramation merged 1 commit intomainfrom
Conversation
The 'cd ./<name>' message printed after 'pgpm init' only used the bare module name, which was wrong when the module was created in a subdirectory (e.g. packages/). Now we compute the actual relative path from process.cwd() to the created folder using path.relative().
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
After
pgpm initcreates a module, it prints acd ./<name>hint for the user. When the module is created inside a subdirectory (e.g.packages/), the hint was wrong — it only printed the bare module name (cd ./cards) instead of the actual relative path (cd ./packages/cards).This fix uses
path.relative(process.cwd(), modulePath)to compute the correct relative path from the user's current working directory to wherever the folder was actually created. Applied to all threecdhints:handleWorkspaceInitinindex.ts(line 332)handleModuleInitinindex.ts(line 622)runWorkspaceSetupinworkspace.ts(line 77)Review & Testing Checklist for Human
pgpm initfrom a workspace root and confirm the hint sayscd ./packages/<name>pgpm initfrom insidepackages/and confirm it sayscd ./<name>pgpm init workspaceand confirm it sayscd ./<workspace-name>Notes
The workspace cases were already correct in practice (workspace is always created directly in cwd), but updated for consistency and robustness when
--cwddiffers fromprocess.cwd().Link to Devin session: https://app.devin.ai/sessions/95ae737fc0464b04b83a1cb7af4c65dc
Requested by: @pyramation