263 lines
6.4 KiB
Markdown
263 lines
6.4 KiB
Markdown
|
|
<div align="center">
|
||
|
|
<img src="imgs/typedialog_logo_h_s.svg" alt="TypeDialog Logo" width="600" />
|
||
|
|
</div>
|
||
|
|
|
||
|
|
# TypeDialog
|
||
|
|
|
||
|
|
A powerful, standalone library and CLI tool for creating interactive forms and prompts using the `inquire` crate.
|
||
|
|
|
||
|
|
## Features
|
||
|
|
|
||
|
|
- **3 Backends**: CLI, TUI (Terminal UI), Web (HTTP)
|
||
|
|
- **8 Prompt Types**: text, confirm, select, multi-select, password, custom, editor, date
|
||
|
|
- **TOML-based Forms**: Declarative UI definitions
|
||
|
|
- **Dynamic Logic**: Conditional fields, smart defaults, real-time updates
|
||
|
|
- **Multi-language**: Fluent (.ftl) and TOML translations
|
||
|
|
- **Multiple Outputs**: JSON, YAML, TOML, text formats
|
||
|
|
- **Zero Dependencies**: Works everywhere, no Nushell required
|
||
|
|
|
||
|
|
## Quick Start
|
||
|
|
|
||
|
|
### Installation
|
||
|
|
|
||
|
|
See [docs/INSTALLATION.md](docs/INSTALLATION.md) for detailed setup.
|
||
|
|
|
||
|
|
Requirements:
|
||
|
|
- **Rust 1.70+** - [Install](https://rustup.rs/)
|
||
|
|
- **just** - `cargo install just` (or `brew install just`)
|
||
|
|
|
||
|
|
### Build & Run
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Clone
|
||
|
|
git clone https://github.com/anthropics/typedialog.git
|
||
|
|
cd typedialog
|
||
|
|
|
||
|
|
# Build
|
||
|
|
just build::default
|
||
|
|
|
||
|
|
# Test
|
||
|
|
just test::all
|
||
|
|
|
||
|
|
# Run example
|
||
|
|
cargo run --example form
|
||
|
|
```
|
||
|
|
|
||
|
|
### CLI Example
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Simple prompt
|
||
|
|
typedialog text "Enter your name"
|
||
|
|
|
||
|
|
# With options
|
||
|
|
typedialog select "Choose role" Admin User Guest
|
||
|
|
|
||
|
|
# Output as JSON
|
||
|
|
typedialog text "Email" --format json
|
||
|
|
```
|
||
|
|
|
||
|
|
### TUI Example
|
||
|
|
|
||
|
|
Interactive multi-panel form:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cargo run -p typedialog-tui --example form_with_autocompletion
|
||
|
|
```
|
||
|
|
|
||
|
|
### Web Example
|
||
|
|
|
||
|
|
Start HTTP server:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
cargo run -p typedialog-web -- --config config/web/dev.toml
|
||
|
|
# Open http://localhost:3000
|
||
|
|
```
|
||
|
|
|
||
|
|
## Documentation
|
||
|
|
|
||
|
|
Complete documentation in [`docs/`](docs/):
|
||
|
|
|
||
|
|
| Document | Purpose |
|
||
|
|
|----------|---------|
|
||
|
|
| [**INSTALLATION.md**](docs/INSTALLATION.md) | Prerequisites & setup |
|
||
|
|
| [**DEVELOPMENT.md**](docs/DEVELOPMENT.md) | Development workflows |
|
||
|
|
| [**BUILD.md**](docs/BUILD.md) | Building & cross-compilation |
|
||
|
|
| [**RELEASE.md**](docs/RELEASE.md) | Release process |
|
||
|
|
| [**CONFIGURATION.md**](docs/CONFIGURATION.md) | Backend configuration |
|
||
|
|
|
||
|
|
## Examples
|
||
|
|
|
||
|
|
Complete working examples in [`examples/`](examples/):
|
||
|
|
|
||
|
|
- [**01-basic**](examples/01-basic/) - Getting started
|
||
|
|
- [**02-advanced**](examples/02-advanced/) - Conditional logic
|
||
|
|
- [**03-styling**](examples/03-styling/) - Custom appearance
|
||
|
|
- [**04-backends**](examples/04-backends/) - Backend-specific examples
|
||
|
|
- [**05-fragments**](examples/05-fragments/) - Reusable components
|
||
|
|
- [**06-integrations**](examples/06-integrations/) - Nickel & i18n
|
||
|
|
- [**09-templates**](examples/09-templates/) - Production templates
|
||
|
|
|
||
|
|
See [examples/README.md](examples/README.md) for complete guide.
|
||
|
|
|
||
|
|
## Development
|
||
|
|
|
||
|
|
Use `just` for all development tasks:
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Show available commands
|
||
|
|
just --list
|
||
|
|
|
||
|
|
# Format, lint, test
|
||
|
|
just check-all
|
||
|
|
|
||
|
|
# Build & package
|
||
|
|
just distro::build-release
|
||
|
|
just distro::create-package
|
||
|
|
|
||
|
|
# Full CI/CD
|
||
|
|
just ci::full
|
||
|
|
```
|
||
|
|
|
||
|
|
See [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) for details.
|
||
|
|
|
||
|
|
## Building & Distribution
|
||
|
|
|
||
|
|
### Build from Source
|
||
|
|
|
||
|
|
```bash
|
||
|
|
just build::release
|
||
|
|
```
|
||
|
|
|
||
|
|
Binaries in `target/release/`
|
||
|
|
|
||
|
|
### Create Distribution Package
|
||
|
|
|
||
|
|
```bash
|
||
|
|
just distro::build-release
|
||
|
|
just distro::create-package
|
||
|
|
just distro::create-checksums
|
||
|
|
```
|
||
|
|
|
||
|
|
Package includes binaries, configs, and installers.
|
||
|
|
|
||
|
|
See [docs/BUILD.md](docs/BUILD.md) for complete guide.
|
||
|
|
|
||
|
|
### Install Distributed Release
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Linux/macOS
|
||
|
|
curl -fsSL https://github.com/anthropics/typedialog/releases/download/latest/install.sh | bash
|
||
|
|
|
||
|
|
# Windows PowerShell
|
||
|
|
irm https://github.com/anthropics/typedialog/releases/download/latest/install.ps1 | iex
|
||
|
|
```
|
||
|
|
|
||
|
|
See [docs/RELEASE.md](docs/RELEASE.md) for release workflow.
|
||
|
|
|
||
|
|
## Configuration
|
||
|
|
|
||
|
|
Pre-configured settings for each backend and environment:
|
||
|
|
|
||
|
|
```
|
||
|
|
config/
|
||
|
|
├── cli/ # default, dev, production
|
||
|
|
├── tui/ # default, dev, production
|
||
|
|
└── web/ # default, dev, production
|
||
|
|
```
|
||
|
|
|
||
|
|
See [docs/CONFIGURATION.md](docs/CONFIGURATION.md) for all options.
|
||
|
|
|
||
|
|
## Project Structure
|
||
|
|
|
||
|
|
```
|
||
|
|
typedialog/
|
||
|
|
├── crates/
|
||
|
|
│ ├── typedialog-core/ # Core library
|
||
|
|
│ ├── typedialog/ # CLI binary
|
||
|
|
│ ├── typedialog-tui/ # TUI binary
|
||
|
|
│ └── typedialog-web/ # Web binary
|
||
|
|
├── config/ # Configuration files
|
||
|
|
├── examples/ # Working examples
|
||
|
|
├── scripts/ # Build automation
|
||
|
|
├── installers/ # Installation scripts
|
||
|
|
├── docs/ # Documentation
|
||
|
|
├── justfile # Command orchestration
|
||
|
|
└── Cargo.toml # Workspace manifest
|
||
|
|
```
|
||
|
|
|
||
|
|
## Key Technologies
|
||
|
|
|
||
|
|
- **Rust** - Type-safe systems language
|
||
|
|
- **inquire** - Interactive prompt library
|
||
|
|
- **Ratatui** - TUI framework
|
||
|
|
- **Actix-web** - Web framework
|
||
|
|
- **TOML** - Configuration language
|
||
|
|
- **just** - Command orchestration
|
||
|
|
|
||
|
|
## Commands at a Glance
|
||
|
|
|
||
|
|
```bash
|
||
|
|
# Development
|
||
|
|
just fmt # Format code
|
||
|
|
just lint # Lint code
|
||
|
|
just test::all # Run tests
|
||
|
|
just dev::watch # Watch & rebuild
|
||
|
|
just dev::docs # Generate docs
|
||
|
|
|
||
|
|
# Building
|
||
|
|
just build::default # Debug build
|
||
|
|
just build::release # Release build
|
||
|
|
just distro::cross # Cross-compile
|
||
|
|
|
||
|
|
# CI/CD
|
||
|
|
just ci::full # Complete pipeline
|
||
|
|
just check-all # Format + lint + test
|
||
|
|
|
||
|
|
# Distribution
|
||
|
|
just distro::build-release # Release build
|
||
|
|
just distro::create-package # Package
|
||
|
|
just distro::create-checksums # Checksums
|
||
|
|
just distro::package-release # Prepare release
|
||
|
|
```
|
||
|
|
|
||
|
|
## System Requirements
|
||
|
|
|
||
|
|
### Minimum
|
||
|
|
- Rust 1.70+
|
||
|
|
- 4GB RAM
|
||
|
|
- 2GB disk space
|
||
|
|
|
||
|
|
### For Cross-Compilation
|
||
|
|
- Docker (or cargo-cross)
|
||
|
|
|
||
|
|
### Optional Tools
|
||
|
|
- **Nickel CLI** - For type-safe schemas
|
||
|
|
- **cargo-watch** - For hot-reload
|
||
|
|
- **cargo-cross** - For cross-compilation
|
||
|
|
|
||
|
|
See [docs/INSTALLATION.md](docs/INSTALLATION.md) for setup.
|
||
|
|
|
||
|
|
## License & Compliance
|
||
|
|
|
||
|
|
- **Project License**: [MIT](LICENSE)
|
||
|
|
- **Dependency Licenses**: [LICENSE.md](LICENSE.md)
|
||
|
|
- **Dependency List**: [DEPENDENCIES.md](DEPENDENCIES.md)
|
||
|
|
- **SBOM (SPDX)**: [SBOM.spdx.json](SBOM.spdx.json)
|
||
|
|
- **SBOM (CycloneDX)**: [SBOM.cyclonedx.json](SBOM.cyclonedx.json)
|
||
|
|
|
||
|
|
All dependencies are compatible with MIT license.
|
||
|
|
|
||
|
|
## Getting Help
|
||
|
|
|
||
|
|
1. **Documentation** - Start with [docs/README.md](docs/)
|
||
|
|
2. **Examples** - Check [examples/README.md](examples/)
|
||
|
|
3. **Issues** - Open on [GitHub](https://github.com/anthropics/typedialog/issues)
|
||
|
|
|
||
|
|
## Contributing
|
||
|
|
|
||
|
|
Contributions welcome! See documentation for setup and guidelines.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Ready to get started?** → [docs/INSTALLATION.md](docs/INSTALLATION.md)
|