Skip to content

Conversation

@pyramation
Copy link
Contributor

Summary

Adds a new password question type to inquirerer that masks user input with asterisks (or a custom mask character) while typing. The actual input value is captured and returned on Enter.

Changes:

  • New PasswordQuestion interface with optional mask property (defaults to *)
  • New password() method in Inquirerer class following the same pattern as other interactive prompts
  • Updated Question union type to include PasswordQuestion

Usage:

const answer = await prompter.prompt(argv, [
  {
    type: 'password',
    name: 'token',
    message: 'API Token',
    mask: '*', // optional, defaults to '*'
  },
]);

Review & Testing Checklist for Human

  • Test interactive password entry - Run a prompt with type: 'password' and verify asterisks display while typing, and the actual value is returned
  • Test backspace handling - Verify backspace removes characters correctly and updates the masked display
  • Test special characters - The character set includes common symbols but may miss some edge cases (unicode, etc.)
  • Verify non-interactive behavior - In noTty mode, the method returns null rather than reading from stdin

Recommended Test Plan:

  1. Create a simple test script that prompts for a password
  2. Type various characters including letters, numbers, and symbols
  3. Use backspace to edit
  4. Press Enter and verify the returned value matches what was typed

Notes

  • No escape key handling is implemented - users cannot cancel the prompt mid-entry
  • The character set is hardcoded and may not cover all possible input characters

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

- Add PasswordQuestion type with optional mask character (default: '*')
- Add password() method to Inquirerer class
- Displays asterisks while typing, submits actual value on Enter
- Supports backspace for editing
- Requires interactive terminal (returns null in noTty mode)
@devin-ai-integration
Copy link

🤖 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 acb814b into main Jan 24, 2026
36 checks passed
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