Skip to content

fix(pgpm): use correct relative path in cd hint after init#1042

Merged
pyramation merged 1 commit intomainfrom
feat/fix-pgpm-init-cd-path
Apr 30, 2026
Merged

fix(pgpm): use correct relative path in cd hint after init#1042
pyramation merged 1 commit intomainfrom
feat/fix-pgpm-init-cd-path

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

After pgpm init creates a module, it prints a cd ./<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 three cd hints:

  • handleWorkspaceInit in index.ts (line 332)
  • handleModuleInit in index.ts (line 622)
  • runWorkspaceSetup in workspace.ts (line 77)

Review & Testing Checklist for Human

  • Run pgpm init from a workspace root and confirm the hint says cd ./packages/<name>
  • Run pgpm init from inside packages/ and confirm it says cd ./<name>
  • Run pgpm init workspace and confirm it says cd ./<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 --cwd differs from process.cwd().

Link to Devin session: https://app.devin.ai/sessions/95ae737fc0464b04b83a1cb7af4c65dc
Requested by: @pyramation

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().
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit 75f160c into main Apr 30, 2026
52 checks passed
@pyramation pyramation deleted the feat/fix-pgpm-init-cd-path branch April 30, 2026 20:30
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.

1 participant