Skip to content

fix(pgpm): cascade --no-tty through init template scaffolding - #1477

Merged
pyramation merged 1 commit into
mainfrom
feat/no-tty-cascade-init
Jul 28, 2026
Merged

pyramation merged 1 commit into
mainfrom
feat/no-tty-cascade-init

Conversation

@pyramation

Copy link
Copy Markdown
Contributor

Summary

pgpm init workspace --no-tty ... crashed with Error [ERR_USE_AFTER_CLOSE]: readline was closed whenever any boilerplate question (fullName/email/repoName/username/license) was left to be prompted, because --no-tty never reached the prompter that asks the template questions:

  1. inquirerer's CLI builds the shared prompter with noTty: options.noTty (default false) and never reads --no-tty from argv.
  2. init computed its own noTty flag and passed it to scaffoldTemplate, but also passed the shared prompter — and genomic's promptUser does existingPrompter ?? new Inquirerer({ noTty }), so the flag was ignored and template questions went down the interactive TTY path (crashing on non-TTY/EOF stdin).

Fixes:

  • pgpm/cli/src/index.ts: new CLI(commands, { ...options, noTty: detectNoTtyFromProcess() }) — --no-tty/CI=true now makes the CLI's own prompter non-interactive.
  • @pgpmjs/core scaffoldTemplate: prompter: noTty ? undefined : prompter — in noTty mode the templatizer builds its own noTty prompter, guaranteeing the flag cascades to genomic/inquirerer.
  • New isNoTtyRequested(argv) / detectNoTtyFromProcess() helpers in pgpm/cli/src/utils/tty.ts replace the three duplicated inline checks in init.
  • Doc: starter-kits.md now documents the non-interactive workspace flags and their resolver defaults (git config, npm whoami, workspace dirname).

Behavior after fix (verified locally against built dist):

  • missing answers → clean "Missing required arguments" error instead of readline crash
  • all flags supplied → scaffolds successfully
  • --fullName/--email/--repoName omitted with git identity present → resolved from defaults

Follow-ups deferred (per discussion): enumerating the missing flags in the error message lives in inquirerer/genomic.

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

@pyramation pyramation self-assigned this Jul 27, 2026
@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, CI, and merge conflict monitoring

@pyramation
pyramation merged commit 6b29a3a into main Jul 28, 2026
15 checks passed
@pyramation
pyramation deleted the feat/no-tty-cascade-init branch July 28, 2026 00:21
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