@whyuds/ask-user
v1.0.3
Published
A cross-platform command-line tool and MCP server to show dialog windows and get user input for AI code editors
Maintainers
Readme
AskUser
A cross-platform command-line tool that shows a dialog window to get user input. Works on Windows, macOS, and Linux.
Features
- 🖥️ Cross-platform support (Windows, macOS, Linux)
- 💬 Simple dialog window interface
- ⌨️ Keyboard shortcuts (Enter to submit, ESC to cancel)
- 🎨 Clean and modern UI
- 📦 Easy to install via npm
- 📝 Multi-line text input support
- 🪟 Minimalist UI with no menu bar or window frame
- 🖱️ Draggable title bar
- ⚡ Ctrl+Enter shortcut for submitting input
Installation
Global Installation (Recommended)
npm install -g @whyuds/ask-userMCP Server Support
AskUser can be used as an MCP (Model Context Protocol) server for AI code editors like Cursor, Windsurf, and Trae. This allows AI assistants to interact with users during code generation.
Quick MCP Setup
Add to your AI editor's MCP configuration:
{
"mcpServers": {
"ask-user": {
"command": "npx",
"args": ["-y", "ask-user-mcp"],
"env": {}
}
}
}For detailed MCP usage instructions, see MCP-USAGE.md.
Local Installation
npm install ask-userUsage
Command Line
# Basic usage
ask --title "Question" --message "What is 1+1?"
# Short form
ask -t "Question" -m "What is 1+1?"
# Only title
ask --title "Please enter your name"
# Only message
ask --message "Enter your response:"
# No parameters (default dialog)
ask
# Multi-line input example
ask --title "Feedback" --message "Please provide your detailed feedback:"User Interface
- Multi-line input: The dialog supports multi-line text input in a resizable textarea
- Submit: Click the "Submit" button or press
Ctrl+Enterto submit your input - Cancel: Click the "Cancel" button, press
Escape, or click the × button to cancel - Drag: Use the blue title bar to drag the window around
Programmatic Usage
const AskUser = require('ask-user');
const { app } = require('electron');
async function example() {
const askUser = new AskUser();
const result = await askUser.showDialog('Question', 'What is your name?');
console.log('User input:', result);
app.quit();
}
app.whenReady().then(example);Options
| Option | Short | Description | Default |
|--------|-------|-------------|---------|
| --title | -t | Dialog window title | "Please provide your input" |
| --message | -m | Message to display | "Enter your response below:" |
| --help | -h | Show help information | - |
| --version | -V | Show version number | - |
Examples
Example 1: Simple Question
ask --title "Math Question" --message "What is 1+1?"Example 2: User Information
ask --title "User Info" --message "Please enter your email address:"Example 3: Confirmation
ask --title "Confirmation" --message "Are you sure you want to continue? (yes/no)"Keyboard Shortcuts
- Enter: Submit the input
- ESC: Cancel and close the dialog
- Tab: Navigate between elements
Output
The tool outputs the user's input to stdout. If the user cancels or closes the dialog, an empty string is returned.
$ ask -t "Name" -m "Enter your name:"
John Doe
$ ask -t "Cancelled" -m "This will be cancelled"
# User presses ESC or closes window
# (empty output)Requirements
- Node.js 14.0.0 or higher
- npm or yarn
Platform Support
- ✅ Windows 10/11
- ✅ macOS 10.14+
- ✅ Linux (Ubuntu, Debian, CentOS, etc.)
Development
Clone and Install
git clone https://github.com/whyuds/AskUser.git
cd AskUser
npm installTest Locally
node bin/ask.js --title "Test" --message "Testing locally"Publish to npm
# Login to npm (if not already logged in)
npm login
# Publish the package
npm publishTest the Package
# Run the test script
node test.jsLicense
MIT License - see LICENSE file for details.
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Issues
If you encounter any issues, please report them on the GitHub Issues page.
Changelog
v1.0.0
- Initial release
- Cross-platform dialog support
- Command-line interface
- Keyboard shortcuts
- Modern UI design
