From aecc39ed4a98330818670ebb69588d47b0811c4e Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Thu, 30 Apr 2026 20:24:11 +0000 Subject: [PATCH] fix(pgpm): use correct relative path in cd hint after init The 'cd ./' 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(). --- pgpm/cli/src/commands/init/index.ts | 6 ++++-- pgpm/cli/src/commands/init/workspace.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pgpm/cli/src/commands/init/index.ts b/pgpm/cli/src/commands/init/index.ts index e890a25361..0800782699 100644 --- a/pgpm/cli/src/commands/init/index.ts +++ b/pgpm/cli/src/commands/init/index.ts @@ -329,7 +329,8 @@ async function handleWorkspaceInit( process.stdout.write('\n'); } - process.stdout.write(`\n✨ Enjoy!\n\ncd ./${dirName}\n`); + const relPath = path.relative(process.cwd(), targetPath); + process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`); return { ...argv, ...answers, cwd: targetPath }; } @@ -619,7 +620,8 @@ async function handleModuleInit( process.stdout.write('\n'); } - process.stdout.write(`\n✨ Enjoy!\n\ncd ./${modName}\n`); + const relPath = path.relative(process.cwd(), modulePath); + process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`); return { ...argv, ...answers }; } diff --git a/pgpm/cli/src/commands/init/workspace.ts b/pgpm/cli/src/commands/init/workspace.ts index 5bcfa945da..e876ad380c 100644 --- a/pgpm/cli/src/commands/init/workspace.ts +++ b/pgpm/cli/src/commands/init/workspace.ts @@ -74,7 +74,8 @@ export default async function runWorkspaceSetup( process.stdout.write('\n'); } - process.stdout.write(`\n✨ Enjoy!\n\ncd ./${dirName}\n`); + const relPath = path.relative(process.cwd(), targetPath); + process.stdout.write(`\n✨ Enjoy!\n\ncd ./${relPath}\n`); return { ...argv, ...answers, cwd: targetPath }; }