Environment
- OS: macOS
- Node Version:
22.5.1
- Package:
@clack/promts
- Package Version: 0.11.0
Describe the bug
When calling the text's validate function without user input but with a default value defined, it should use the default value instead of relying solely on user input.
To Reproduce
Steps to reproduce the behavior:
- Open repro link
- Run
node index.js
- Don't type anything, just press
[Enter]
- See behavior described on terminal
Expected behavior
Clear use case example:

CLI dev creates a text step for user to enter a path as input. There's some predefined value that CLI dev established to be the default use case for most users, but still allowing for that value to be changed.
Currently, the user would have to type/copy that entire path, causing a terrible user experience.
Fix Recommendation (starting a convo)
I see 2 possible ways to fix this:
- Keep
validate as is and add a check to the value on core/prompts/text - link to draft PR
- Add a second optional argument, which would be the default value to
validate. That way, Devs would have another quick option when using the validate function, without adding extra checks to the core library.
My goal with this section is to start a conversation and introduce my ideas about this issue, not a way for me to impose how I think things should be.
This would be my first contribution, so I'm pretty new here. Let me know what you think and hopefully let's get this fixed!
Environment
22.5.1@clack/promtsDescribe the bug
When calling the
text'svalidatefunction without user input but with a default value defined, it should use the default value instead of relying solely on user input.To Reproduce
Steps to reproduce the behavior:
node index.js[Enter]Expected behavior

Clear use case example:
CLI dev creates a text step for user to enter a path as input. There's some predefined value that CLI dev established to be the default use case for most users, but still allowing for that value to be changed.
Currently, the user would have to type/copy that entire path, causing a terrible user experience.
Fix Recommendation (starting a convo)
I see 2 possible ways to fix this:
validateas is and add a check to the value oncore/prompts/text- link to draft PRvalidate. That way, Devs would have another quick option when using thevalidatefunction, without adding extra checks to thecorelibrary.My goal with this section is to start a conversation and introduce my ideas about this issue, not a way for me to impose how I think things should be.
This would be my first contribution, so I'm pretty new here. Let me know what you think and hopefully let's get this fixed!