Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Dec 25, 2025

Summary

Adds an optional prompter parameter to ScaffoldTemplateOptions that gets passed through to create-gen-app's Templatizer.process(). This allows CLI tools to reuse their existing Inquirerer instance instead of create-gen-app creating a new one internally.

This eliminates the "two instances on stdin" problem that caused double-echoed keystrokes when running pgpm init workspace.

Key changes:

  • Add inquirerer dependency to @pgpmjs/core for the type
  • Add optional prompter field to ScaffoldTemplateOptions interface
  • Pass prompter through to templatizer.process() in both local and remote template code paths
  • Update workspace.ts to pass prompter instead of calling close() before scaffold

Ownership semantics: When a prompter is provided, the caller retains ownership and is responsible for closing it.

Updates since last revision

  • Deleted boilerplate-scanner.ts and boilerplate-types.ts (177 lines of dead code that was exported but never used)
  • Removed corresponding exports from index.ts
  • Inlined the necessary helper functions (readBoilerplatesConfig, readBoilerplateConfig) directly into template-scaffold.ts

Review & Testing Checklist for Human

  • CRITICAL: Verify that constructive-io/dev-utils#33 is merged first - this PR depends on it
  • Test pgpm init workspace end-to-end and verify no double-echoed keystrokes occur
  • Verify nothing else in the codebase was importing from the deleted boilerplate-scanner.ts or boilerplate-types.ts files
  • Review the as any type assertions in template-scaffold.ts - these are temporary until create-gen-app is published with the new prompter parameter

Test plan: After merging dev-utils#33, run pgpm init workspace and verify:

  1. Arrow keys work correctly (no double movement)
  2. Text input doesn't echo twice
  3. The workspace is created successfully

Notes

This is PR 2 of 2 in a two-PR solution. The companion PR (dev-utils#33) adds the prompter parameter to create-gen-app's API.

Link to Devin run: https://app.devin.ai/sessions/48555739db3d4f1b9e9edfa9ea1e559a
Requested by: Dan Lynch (@pyramation)

…nces

Add optional 'prompter' parameter to ScaffoldTemplateOptions that gets passed
through to create-gen-app's Templatizer. This allows CLI tools to reuse their
existing Inquirerer instance instead of create-gen-app creating a new one.

Changes:
- Add 'inquirerer' dependency to @pgpmjs/core for the type
- Add optional 'prompter' field to ScaffoldTemplateOptions interface
- Pass prompter through to templatizer.process() in both code paths
- Update workspace.ts to pass prompter instead of calling close() before scaffold

This eliminates the 'two instances on stdin' problem that caused double-echoed
keystrokes when running 'pgpm init workspace'.

Requires: constructive-io/dev-utils#33
@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

- Remove boilerplate-scanner.ts and boilerplate-types.ts (unused exports)
- Remove exports from index.ts for deleted files
- Inline necessary functions (readBoilerplatesConfig, readBoilerplateConfig)
- Add prompter pass-through to templatizer.process() calls
- Use 'as any' for prompter param until create-gen-app is updated
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