# Askr CLI Tool - Project Overview
## Project Description
A command-line tool for interactively prompting users for input with real-time validation feedback. Designed to be used within shell scripts to gather validated user input with rich error messaging and multiple output formats.
## Goals
### Primary Goals
- **Interactive Input**: Provide a user-friendly interactive prompt interface
- **Real-time Validation**: Validate input as the user types with immediate visual feedback
- **Shell Script Integration**: Work seamlessly within shell scripts with proper exit codes and output handling
- **Flexible Validation**: Support multiple validation types (regex, length, format, choices, etc.)
- **Cross-platform**: Work on Linux, macOS, and Windows
### Secondary Goals
- **Rich Error Messages**: Clear, helpful validation error messages with priority-based display
- **Multiple Output Modes**: Support different output formats for various use cases
- **Non-interactive Mode**: Support batch/quiet validation for automated scenarios
- **Extensible Architecture**: Easy to add new validation types and output formats
## Target Use Cases
### Shell Script Integration
```bash
# Interactive hostname collection
# Form-like data collection
name=$(askr "Full name:" --required --max-length 100)
email=$(askr "Email:" --validate-email --required)
```
### Batch Validation
```bash
# Validate list of inputs
done
```
### Complex Form Workflows
```bash
# Multi-step configuration with validation
config_file=$(askr "Config file:" --file-exists --required)
port=$(askr "Port:" --number --range 1024-65535)
ssl=$(askr "Enable SSL:" --choices "yes,no" --default "yes")
```
## Key Features
### Validation System
- **Built-in Validators**: Email, hostname, number, date, file path validation
- **Custom Patterns**: Regex-based validation with custom error messages
- **Constraint Validation**: Length limits, number ranges, character restrictions
- **Choice Lists**: Single and multiple selection from predefined options with custom separators
- **Shell Integration**: Command substitution with flexible input/output formatting
- **Priority-based Display**: Critical, High, Medium, Low priority error messages
### User Interface
- **Real-time Feedback**: Validation as user types
- **Color-coded Input**: Red text for invalid portions, normal for valid
- **Dynamic Error Display**: Growing/shrinking error message area
- **Progress Indicators**: ✅❌ symbols for individual validation rules
### Output Modes
- **Default**: Value to stdout + exit codes (Unix-style)
- **JSON**: Structured output with validation metadata
- **Quiet**: Non-interactive stdin validation
- **Raw**: Debug mode showing exact user input
## Success Criteria
1. **Usability**: Non-technical users can easily understand validation errors
2. **Performance**: Real-time validation doesn't noticeably lag on typical input
3. **Reliability**: Handles edge cases (terminal resize, interruption, etc.)
4. **Integration**: Works seamlessly in shell scripts without surprises
5. **Portability**: Consistent behavior across different terminals and platforms
## Non-Goals
- **GUI Interface**: This is strictly a command-line tool
- **Configuration Files**: All configuration via command-line arguments
- **Complex Workflows**: No multi-step wizards or complex state management
- **Database Integration**: No built-in database validation or storage
- **Networking**: No network-based validation (though custom validators could add this)