ARCHITECTURE

## What TypeDialog Solves

01

### Per-Backend Code

One Nickel or TOML definition drives CLI, TUI, Web, and AI. No per-backend form code. The schema is the single source of truth.

02

### Fail-Open Validation

Nickel contracts validate every predicate at load time. Unknown predicates cause hard failures, not silent passes. No parallel Rust reimplementation.

03

### Hidden I/O in Execution

Fragment loading happens once at load_form(). The three-phase executor is pure — no filesystem access, no side effects during user interaction.

04

### Manual IaC Assembly

Interactive forms generate validated infrastructure configurations for 6 cloud providers. 7-layer validation pipeline from forms to final JSON.

## How It Works

<>

### Declarative Forms

Define forms in Nickel (.ncl) or TOML (.toml). Nickel provides contracts, imports, and type-safe composition. TOML provides zero-dependency simplicity. Both produce identical FormDefinition structs.

⚙

### Three-Phase Execution

Phase 1: Execute selector fields that control conditionals. Phase 2: Build element list (pure, no I/O). Phase 3: Dispatch to backend with when/when_false evaluation. Complete or field-by-field rendering modes.

🔌

### BackendFactory

Compile-time feature gates (#[cfg(feature)]) eliminate dead backend code. Runtime BackendType match dispatches to Box<dyn FormBackend>. Auto-detection via TYPEDIALOG_BACKEND env var with CLI fallback.

🤖

### AI & Agent Backends

AI backend with RAG, embeddings, and semantic search. Agent backend executes .agent.mdx files with multi-LLM support (Claude, OpenAI, Gemini, Ollama). Template variables, file imports, streaming output.

☁

### Infrastructure Generation

Prov-Gen transforms form answers into IaC configurations. 6 cloud providers (AWS, GCP, Azure, Hetzner, UpCloud, LXD). 7-layer validation: Forms → Constraints → Values → Validators → Schemas → Defaults → JSON.

🔄

### Nickel Roundtrip

Read .ncl schemas, collect user input via any backend, generate validated .ncl output preserving contracts. ContractParser extracts validators. TemplateRenderer preserves formatting. when_false ensures all schema fields have values.

## Technology Stack

Rust (8 crates)Nickel ContractsTOML FormsInquire (CLI)Ratatui (TUI)Axum (Web)Fluent i18nTera TemplatesNushell PluginClaude APIOpenAI APIGemini APIOllama (local)Multi-Cloud IaC

## Backends

CLIinquire — interactive prompts
TUIratatui — terminal UI
Webaxum — HTTP forms
AIRAG & embeddings
AgentMulti-LLM execution
Prov-GenIaC generation

## Type-safe dialogs for every surface

Built with Rust | Open Source | MIT License

Explore on GitHub →