fix: pass prompter through to initModule to prevent duplicate stdin listeners#770
Merged
pyramation merged 3 commits intomainfrom Mar 3, 2026
Merged
Conversation
…isteners When using pgpm init -w, the module scaffolding via initModule() was calling scaffoldTemplate() without passing the existing prompter. This caused a new Inquirerer instance to be created on process.stdin while the original was still active, resulting in double-echoed keystrokes and input conflicts. - Add optional prompter field to InitModuleOptions - Pass prompter through initModule() to scaffoldTemplate() - Pass prompter from handleModuleInit() to project.initModule()
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:
|
…c to latest versions - inquirerer: ^4.5.2 - @inquirerer/utils: ^3.3.1 - @inquirerer/test: ^1.3.3 - genomic: ^5.3.5
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.
fix: pass prompter through initModule to prevent duplicate stdin listeners
Summary
When using
pgpm init -w(workspace + module in one command),initModule()callsscaffoldTemplate()without the existingInquirererprompter. If the module template has unanswered variables,promptUser()in genomic creates a secondInquirererinstance onprocess.stdinwhile the original is still active. Two readline interfaces and twoTerminalKeypressdata handlers on the same stdin causes double-echoed keystrokes and input conflicts.This PR adds an optional
prompterfield toInitModuleOptionsand threads it throughinitModule()→scaffoldTemplate(), so the existing instance is reused instead of creating a duplicate.Companion PR: dev-utils #67 (merged & published) fixes
TerminalKeypress.pause()to reset raw mode after interactive prompts, andInquirerer.close()to nullify references for safe double-close detection.Updates since last revision
Bumped all
inquirerer-related dependencies to the newly published versions that include the companion fix:inquirerer^4.4.0/^4.5.0^4.5.2@inquirerer/utils^3.2.3/^3.3.0^3.3.1@inquirerer/test^1.3.0^1.3.3genomic^5.3.0^5.3.5Updated in:
graphql/codegen,packages/cli,packages/csv-to-pg,pgpm/cli,pgpm/core.Review & Testing Checklist for Human
pgpm init -winteractively in a real terminal: This is a TTY-only bug — CI cannot catch regressions. Confirm no double-echoed keystrokes during workspace name, module name, and extensions prompts.pgpm init(without-w): Theprompterfield is optional so existing callers are unaffected, but worth a smoke test.import('inquirerer').Inquirerertype inInitModuleOptionsis acceptable vs a top-level import. Build passes but this is a style choice.Notes
if (project.workspacePath)inhandleModuleInit) goes throughinitModule(). The other twoscaffoldTemplatecall sites already passprompterdirectly.Link to Devin Session: https://app.devin.ai/sessions/178a5957a56e4141bd3fd4d0a5e4a508
Requested by: @pyramation