Skip to content

Conversation

@pyramation
Copy link
Contributor

Summary

Fixes two issues with pgpm init --dir <variant>:

  1. Workspace prompt for non-pgpm templates: When running pgpm init --dir pnpm outside a workspace, the command would throw NOT_IN_WORKSPACE without offering to create a workspace. Now it prompts the user to create a workspace (same as pgpm templates do) when --dir is specified.

  2. Module placement in packages/ folder: Modules with requiresWorkspace: 'pnpm' (or lerna/npm) were being placed in the current directory instead of packages/ when at workspace root. Added a new code path for non-pgpm workspaces that mirrors the pgpm workspace behavior.

Review & Testing Checklist for Human

  • Verify the prompt condition logic: The change extends workspace creation prompts to trigger when ctx.dir is specified (workspaceType === 'pgpm' || ctx.dir). Confirm this is the intended behavior and doesn't cause unwanted prompts.
  • Test pgpm init --dir pnpm outside a workspace: Should now prompt to create a workspace instead of throwing an error
  • Test module creation in a pnpm workspace at root: Run pgpm init module --dir pnpm from workspace root and verify module is created in packages/<name> not ./<name>
  • Test module creation from packages/ subdirectory: Verify module is created in packages/<name> (current directory behavior)

Notes

Requested by @pyramation

Link to Devin run: https://app.devin.ai/sessions/86fc90000ad24b2cacf3b750dc077be3

…acement

- When --dir is specified without a positional arg, offer to create a workspace
  for non-pgpm workspace types (pnpm, lerna, npm) in addition to pgpm templates
- Fix module placement for non-pgpm workspace types to use packages/ directory
  when at workspace root, matching the behavior of pgpm workspaces

Fixes issues where:
1. 'pgpm init --dir pnpm' would throw NOT_IN_WORKSPACE without offering to
   create a workspace (now prompts user to create workspace)
2. Modules with requiresWorkspace: 'pnpm' were being placed in current directory
   instead of packages/ folder when at workspace root
@devin-ai-integration
Copy link
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 dbd766a into main Jan 28, 2026
52 checks passed
@pyramation pyramation deleted the devin/1769579064-fix-pgpm-init-dir-flag branch January 28, 2026 06:17
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