Mode C: Interactive Wizard
This example demonstrates the interactive provisioning generator wizard with AI-powered suggestions.
Overview
Mode C guides you through a conversational process to build your provisioning configuration:
- Project Details: Name and type (WebService, CliTool, Microservice, Library)
- Infrastructure: Database, SSH, monitoring, cloud providers
- Domain Features: Application-specific capabilities
- Field Configuration: Details for each feature
- Generation: Creates complete provisioning structure
Running the Wizard
# Interactive wizard with project name
typedialog-provisioning-gen wizard --project my-service
# Or use default name
typedialog-provisioning-gen wizard
Interactive Flow
Step 1: Project Type Selection
What type of project are you building?
1) WebService - REST APIs, web servers
2) Microservice - Distributed services with event streaming
3) CliTool - Command-line utilities
4) Library - Reusable Rust library
5) Other
Select (1-5):
Step 2: Infrastructure Requirements
Infrastructure Configuration
Enable SSH access? (y/n): y
→ SSH access enabled for deployments
Which databases do you need?
1) PostgreSQL
2) MySQL
3) SQLite
4) None
5) Multiple databases
Select (1-5): 1
→ PostgreSQL selected
Enable monitoring? (y/n): y
Which monitoring stack?
1) Prometheus
2) Grafana
3) Both
4) None
Select (1-3): 3
→ Prometheus + Grafana enabled
Cloud deployment target?
1) LXD (local containers)
2) AWS
3) GCP
4) Multiple
Select (1-4): 2
→ AWS selected
Step 3: Domain Features
Domain Features
The wizard suggests features based on your project type.
Suggested features:
✓ http_server (HTTP REST API)
✓ authentication (User authentication)
□ caching (Redis caching)
□ event_streaming (Message queue)
□ file_upload (File handling)
Select features to include:
[✓] http_server
[✓] authentication
[□] caching
[✓] event_streaming
[ ] file_upload
Confirm? (y/n): y
Step 4: Feature Configuration
Configure http_server
1) Bind Address (default: 0.0.0.0:8080)
2) Request Timeout (default: 30 seconds)
3) Rate Limit (default: 100 req/sec)
4) Done
Select field to configure (1-4):
The wizard guides you through each feature's fields with:
- Helpful descriptions
- Validation rules
- Default values
- Examples
Step 5: Review and Generate
Summary
Project: my-service
Type: WebService
Features: http_server, authentication, caching
Database: PostgreSQL
Monitoring: Prometheus, Grafana
Generate to: ./provisioning
Continue? (y/n): y
Generating...
✓ Constraints
✓ Schemas
✓ Validators
✓ Defaults
✓ Fragments
✓ Scripts
Done! Generated to ./provisioning
AI-Powered Suggestions
When Mode C integrates with typedialog-ai, it provides:
1. RAG-Based Feature Suggestions
The wizard retrieves similar project examples:
Projects similar to "WebService" in your domain:
1. E-commerce platform
- Features: product_catalog, shopping_cart, payment_gateway
- Database: PostgreSQL
- Monitoring: Prometheus + Grafana
2. Content delivery service
- Features: media_upload, streaming, analytics
- Database: PostgreSQL
- Caching: Redis
Suggest these features? (y/n):
2. Field Generation Assistance
LLM analyzes domain features and suggests fields:
Configure http_server feature
Based on similar services, recommended fields:
- bind_address (Type: Text)
- max_connections (Type: Number)
- keepalive_timeout (Type: Number)
- compression_enabled (Type: Confirm)
Add recommended fields? (y/n):
3. Constraint Learning
LLM suggests validation bounds from patterns:
For max_connections field:
Learned constraints from similar services:
- Min: 1
- Max: 100000
- Typical: 1000
Apply? (y/n):
Typical Workflow Examples
Example 1: Simple Web Service
typedialog-provisioning-gen wizard --project api-service
# Selections:
# - WebService
# - PostgreSQL
# - Prometheus monitoring
# - Features: http_server, authentication
Generated structure optimized for REST APIs with user management.
Example 2: Microservice Platform
typedialog-provisioning-gen wizard --project order-service
# Selections:
# - Microservice
# - PostgreSQL + Redis
# - Multiple cloud providers (AWS + GCP)
# - Features: http_server, authentication, event_streaming, caching
Generated for distributed event-driven architecture.
Example 3: CLI Tool
typedialog-provisioning-gen wizard --project deployment-tool
# Selections:
# - CliTool
# - No database
# - SSH enabled
# - Features: configuration_management, deployment
Generated for infrastructure automation.
Customizing the Wizard
The wizard can be extended with:
-
Custom feature library (in typedialog-ai):
- Add project types
- Define feature templates
- Set default constraints
-
Custom LLM integration:
- Use your own LLM provider
- Custom prompt engineering
- Domain-specific knowledge base
Fallback Mode
If typedialog-ai is not available, the wizard uses sensible defaults:
// Minimal wizard without AI
fn simple_wizard() {
let name = prompt("Project name? ", "my-project");
let project_type = select(
"Project type?",
vec!["WebService", "CliTool", "Microservice", "Library"]
)?;
let spec = ProjectSpec {
name,
project_type,
infrastructure: InfrastructureSpec::default(),
domain_features: vec![DomainFeature::new("basic_config")],
constraints: vec![],
};
Ok(spec)
}
This ensures the wizard works standalone without dependencies.
Integration with typedialog-ai
For full AI capabilities:
-
Start typedialog-ai service:
typedialog-ai serve --port 3000 -
Configure in .env:
TYPEDIALOG_AI_URL=http://localhost:3000 LLM_API_KEY=sk-... -
Run wizard:
typedialog-provisioning-gen wizard --project my-service
The wizard automatically uses AI for:
- Feature suggestions
- Constraint learning
- Field recommendations
- Example retrieval
What This Demonstrates
✅ Conversational configuration ✅ AI-powered feature suggestions ✅ RAG-based example retrieval ✅ Interactive field configuration ✅ Sensible defaults ✅ Validation and constraints ✅ Graceful fallback without AI ✅ Complete 7-layer generation
Troubleshooting
"typedialog-ai not available"
The wizard falls back to basic mode. Features:
- Manual feature selection
- Default field configurations
- Standard constraints
To use full AI:
- Install typedialog-ai:
cargo build -p typedialog-ai - Start service:
typedialog-ai serve - Run wizard:
typedialog-provisioning-gen wizard
"Generation failed"
Check:
- Output directory is writable
- Templates are installed correctly
- Feature names don't contain special characters
- Run with
--dry-runfirst to validate
"Fields missing after selection"
Some features are added/modified during wizard. Use Mode B to customize:
- Run wizard: generates initial config
- Export to TOML: inspect generated structure
- Modify with Mode B: adjust features and fields
- Regenerate: final structure
Next Steps
- Run the Wizard:
typedialog-provisioning-gen wizard --project my-service - Inspect Output: Check generated provisioning/ structure
- Test Forms: Run TypeDialog with fragments
- Deploy: Use scripts for orchestration
- Iterate: Modify and regenerate as needed
For detailed customization, see Mode B (Config File) examples.