From f084937c70f7ad05f176439e85a1bffac9cce101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Pe=CC=81rez?= Date: Sun, 28 Dec 2025 20:39:36 +0000 Subject: [PATCH] chore: add taplo and check all toml files --- .cargo/audit.toml | 22 +- .cargo/config.toml | 2 +- .taplo.toml | 49 +++ Cargo.toml | 195 +++++---- config/ag/default.toml | 56 +-- config/ag/dev.toml | 46 +-- config/ag/production.toml | 52 +-- config/ai/default.toml | 14 +- config/ai/dev.toml | 22 +- config/ai/production.toml | 28 +- config/cli/default.toml | 8 +- config/cli/dev.toml | 20 +- config/cli/production.toml | 16 +- config/prov-gen/default.toml | 56 +-- config/prov-gen/dev.toml | 44 +- config/prov-gen/production.toml | 58 +-- config/tui/default.toml | 12 +- config/tui/dev.toml | 22 +- config/tui/production.toml | 24 +- config/web/default.toml | 10 +- config/web/dev.toml | 22 +- config/web/production.toml | 20 +- .../typedialog-ag-core/Cargo.toml | 38 +- .../typedialog-agent/typedialog-ag/Cargo.toml | 26 +- crates/typedialog-ai/Cargo.toml | 48 +-- crates/typedialog-core/Cargo.toml | 70 ++-- crates/typedialog-prov-gen/Cargo.toml | 42 +- .../fragments/database-mysql-section.toml | 97 ++--- .../fragments/database-sqlite-section.toml | 25 +- .../fragments/environment-section.toml | 36 +- .../templates/fragments/grafana-section.toml | 30 +- .../fragments/prometheus-section.toml | 34 +- .../fragments/provider-aws-section.toml | 190 ++++----- .../fragments/provider-azure-section.toml | 391 ++++++++---------- .../fragments/provider-gcp-section.toml | 337 +++++++-------- .../fragments/provider-hetzner-section.toml | 118 +++--- .../fragments/provider-lxd-section.toml | 308 ++++++-------- .../fragments/provider-upcloud-section.toml | 191 ++++----- .../templates/fragments/ssh-section.toml | 66 ++- crates/typedialog-tui/Cargo.toml | 26 +- crates/typedialog-web/Cargo.toml | 26 +- crates/typedialog/Cargo.toml | 26 +- deny.toml | 118 +++--- examples/01-basic/base_from.toml | 48 +-- examples/01-basic/debug_simple.toml | 10 +- examples/01-basic/form.toml | 56 +-- .../01-basic/form_with_grouped_items.toml | 158 +++---- examples/01-basic/form_with_sections.toml | 116 +++--- examples/02-advanced/conditional_form.toml | 90 ++-- .../02-advanced/conditional_sections.toml | 150 +++---- examples/02-advanced/display_items_demo.toml | 64 +-- .../02-multiselect-display-modes/form.toml | 98 ++--- examples/03-styling/custom_border_form.toml | 42 +- examples/03-styling/fancy_borders_form.toml | 70 ++-- examples/04-backends/tui/tui_survey_form.toml | 290 ++++++------- .../web/web_registration_form.toml | 290 ++++++------- examples/05-fragments/agreement_section.toml | 42 +- examples/05-fragments/array-trackers.toml | 92 ++--- examples/05-fragments/constraints.toml | 4 +- .../05-fragments/custom_border_section.toml | 20 +- .../05-fragments/employee_info_section.toml | 48 +-- examples/05-fragments/enterprise_section.toml | 30 +- .../05-fragments/fancy_border_section.toml | 46 +-- .../form_with_groups_includes.toml | 48 +-- .../fragments/tracker-http-item.toml | 44 +- .../fragments/tracker-udp-item.toml | 22 +- examples/05-fragments/header.toml | 18 +- examples/05-fragments/premium_section.toml | 28 +- examples/05-fragments/support_section.toml | 32 +- examples/06-i18n/en-US.toml | 34 +- examples/06-i18n/es-ES.toml | 34 +- .../i18n/registration_i18n.toml | 56 +-- .../06-integrations/i18n/test_i18n_form.toml | 26 +- .../07-nickel-generation/arrays-form.toml | 178 ++++---- .../fragments/api-endpoint-item.toml | 26 +- .../fragments/user-item.toml | 54 +-- examples/08-encryption/credentials.toml | 46 +-- .../08-encryption/multi-backend-sops.toml | 70 ++-- examples/08-encryption/simple-login.toml | 6 +- examples/08-nickel-roundtrip/ci-form.toml | 198 ++++----- .../employee_onboarding_form.toml | 26 +- .../09-templates/onboarding_template.toml | 48 +-- .../user_registration/registration_form.toml | 48 +-- .../user_registration_form.toml | 70 ++-- examples/11-prov-gen/mode-a-cargo/Cargo.toml | 12 +- .../mode-b-config/project-spec.toml | 226 +++++----- .../conditional-demo.toml | 110 ++--- .../fragments/environment-setup.toml | 68 +-- justfiles/dev.just | 40 +- 89 files changed, 3086 insertions(+), 3287 deletions(-) create mode 100644 .taplo.toml diff --git a/.cargo/audit.toml b/.cargo/audit.toml index 0c0c667..c601e46 100644 --- a/.cargo/audit.toml +++ b/.cargo/audit.toml @@ -4,21 +4,21 @@ [advisories] # Ignore advisories for unmaintained crates that have no alternatives ignore = [ - # atty - unmaintained but widely used, replacement (is-terminal) requires code changes - "RUSTSEC-2021-0145", - "RUSTSEC-2024-0375", + # atty - unmaintained but widely used, replacement (is-terminal) requires code changes + "RUSTSEC-2021-0145", + "RUSTSEC-2024-0375", - # atomic-polyfill - unmaintained, comes from surrealdb dependency - "RUSTSEC-2023-0089", + # atomic-polyfill - unmaintained, comes from surrealdb dependency + "RUSTSEC-2023-0089", - # paste - unmaintained, comes from multiple dependencies (ratatui, nickel) - "RUSTSEC-2024-0436", + # paste - unmaintained, comes from multiple dependencies (ratatui, nickel) + "RUSTSEC-2024-0436", - # rustls-pemfile - FIXED by updating reqwest to v0.12.28 - # "RUSTSEC-2025-0134", + # rustls-pemfile - FIXED by updating reqwest to v0.12.28 + # "RUSTSEC-2025-0134", - # yaml-rust - unmaintained, comes from nickel-lang-core - "RUSTSEC-2024-0320", + # yaml-rust - unmaintained, comes from nickel-lang-core + "RUSTSEC-2024-0320", ] [database] diff --git a/.cargo/config.toml b/.cargo/config.toml index da831e8..579de0a 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,6 @@ [alias] -lint = "clippy --all-targets --all-features -- -D warnings" fmt-all = "fmt --all" +lint = "clippy --all-targets --all-features -- -D warnings" [build] rustflags = [ diff --git a/.taplo.toml b/.taplo.toml new file mode 100644 index 0000000..afb6ef3 --- /dev/null +++ b/.taplo.toml @@ -0,0 +1,49 @@ +# Taplo configuration for TOML formatting and linting +# https://taplo.tamasfe.dev/configuration/ + +[formatting] +# Indent tables with 2 spaces +indent_string = " " +indent_tables = true + +# Reorder keys alphabetically within tables +reorder_keys = true + +# Reorder arrays to be more readable +reorder_arrays = false + +# Align entries vertically in inline tables +align_entries = false + +# Allow compact inline tables +allowed_blank_lines = 1 + +# Trailing newline +trailing_newline = true + +# Column width for wrapping +column_width = 100 + +# Compact arrays +compact_arrays = true + +# Compact inline tables +compact_inline_tables = false + +# === INCLUDE/EXCLUDE PATTERNS === + +include = ["Cargo.toml", "*/Cargo.toml", "config/**/*.toml", "**/*.toml"] + +exclude = ["target/**", "node_modules/**", ".git/**"] + +# === SCHEMA VALIDATION === + +# Cargo.toml schema validation +[[rule]] +include = ["**/Cargo.toml"] +# Taplo includes built-in Cargo.toml schema + +# Form definition TOML files (custom schema could be added) +[[rule]] +include = ["config/**/forms/*.toml", "tests/fixtures/**/*.toml"] +keys = ["name", "description", "fields", "items", "elements"] diff --git a/Cargo.toml b/Cargo.toml index ef9bf3b..894e00d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,121 +1,120 @@ [workspace] members = [ - "crates/typedialog-core", - "crates/typedialog", - "crates/typedialog-tui", - "crates/typedialog-web", - "crates/typedialog-ai", - "crates/typedialog-prov-gen", - "crates/typedialog-agent/typedialog-ag-core", - "crates/typedialog-agent/typedialog-ag", + "crates/typedialog-core", + "crates/typedialog", + "crates/typedialog-tui", + "crates/typedialog-web", + "crates/typedialog-ai", + "crates/typedialog-prov-gen", + "crates/typedialog-agent/typedialog-ag-core", + "crates/typedialog-agent/typedialog-ag", ] resolver = "2" -[workspace.package] -version = "0.1.0" -authors = ["Jesús Pérez "] -edition = "2021" -rust-version = "1.75" -repository = "https://github.com/jesusperezlorenzo/typedialog" -license = "MIT" -keywords = ["forms", "cli", "tui", "web", "ai"] -categories = ["command-line-utilities", "web-programming"] + [workspace.package] + authors = ["Jesús Pérez "] + categories = ["command-line-utilities", "web-programming"] + edition = "2021" + keywords = ["forms", "cli", "tui", "web", "ai"] + license = "MIT" + repository = "https://github.com/jesusperezlorenzo/typedialog" + rust-version = "1.75" + version = "0.1.0" -[workspace.dependencies] -# Internal crates -typedialog-ag-core = { path = "crates/typedialog-agent/typedialog-ag-core" } -typedialog-core = { path = "crates/typedialog-core" } + [workspace.dependencies] + # Internal crates + typedialog-ag-core = { path = "crates/typedialog-agent/typedialog-ag-core" } + typedialog-core = { path = "crates/typedialog-core" } -# Core serialization -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -serde_yaml = "0.9" -toml = "0.9" + # Core serialization + serde = { version = "1.0", features = ["derive"] } + serde_json = "1.0" + serde_yaml = "0.9" + toml = "0.9" -# Utility -chrono = { version = "0.4", features = ["serde"] } -anyhow = "1.0" -thiserror = "2.0" -clap = { version = "4.5", features = ["derive", "cargo"] } -async-trait = "0.1" + # Utility + anyhow = "1.0" + async-trait = "0.1" + chrono = { version = "0.4", features = ["serde"] } + clap = { version = "4.5", features = ["derive", "cargo"] } + thiserror = "2.0" -# Async -tokio = { version = "1", features = ["full"] } -futures = "0.3" + # Async + futures = "0.3" + tokio = { version = "1", features = ["full"] } -# Templates -tera = "1.20" + # Templates + tera = "1.20" -# i18n -fluent = "0.17" -fluent-bundle = "0.16" -unic-langid = "0.9" -sys-locale = "0.3" -dirs = "6.0" + # i18n + dirs = "6.0" + fluent = "0.17" + fluent-bundle = "0.16" + sys-locale = "0.3" + unic-langid = "0.9" -# Nushell integration -nu-protocol = "0.109.1" -nu-plugin = "0.109.1" + # Nushell integration + nu-plugin = "0.109.1" + nu-protocol = "0.109.1" -# CLI Backend (inquire) -inquire = { version = "0.9", features = ["editor", "date"] } -dialoguer = "0.12" -colored = "3" -rpassword = "7.4" + # CLI Backend (inquire) + colored = "3" + dialoguer = "0.12" + inquire = { version = "0.9", features = ["editor", "date"] } + rpassword = "7.4" -# TUI Backend (ratatui) -ratatui = "0.30" -crossterm = "0.29" -atty = "0.2" + # TUI Backend (ratatui) + atty = "0.2" + crossterm = "0.29" + ratatui = "0.30" -# Web Backend (axum) -axum = { version = "0.8.8", features = ["multipart", "ws"] } -tower = "0.5.2" -tower-http = { version = "0.6.8", features = ["fs", "cors", "trace"] } -tracing = "0.1" -tracing-subscriber = { version = "0.3", features = ["env-filter"] } + # Web Backend (axum) + axum = { version = "0.8.8", features = ["multipart", "ws"] } + tower = "0.5.2" + tower-http = { version = "0.6.8", features = ["fs", "cors", "trace"] } + tracing = "0.1" + tracing-subscriber = { version = "0.3", features = ["env-filter"] } -# AI/ML Backend -instant-distance = "0.6" -tantivy = "0.25" -# this bincode can not be updated - Wait for tantivy/syntect to support 2.0 -# and Migrate 8 code locations to new API with explicit config -bincode = "=1.3" -serde_bytes = "0.11" -rand = "0.9" -petgraph = "0.8" -surrealdb = { version = "2.4", features = ["kv-mem"] } + # AI/ML Backend + instant-distance = "0.6" + tantivy = "0.25" + # this bincode can not be updated - Wait for tantivy/syntect to support 2.0 + # and Migrate 8 code locations to new API with explicit config + bincode = "=1.3" + petgraph = "0.8" + rand = "0.9" + serde_bytes = "0.11" + surrealdb = { version = "2.4", features = ["kv-mem"] } -# Misc -tempfile = "3.24" + # Misc + tempfile = "3.24" -# Testing & Benchmarking -criterion = { version = "0.8", features = ["html_reports"] } -proptest = "1.9" + # Testing & Benchmarking + criterion = { version = "0.8", features = ["html_reports"] } + proptest = "1.9" -# TypeAgent dependencies -nickel-lang-core = "0.16" -nom = "8" -lru = "0.16" -reqwest = { version = "0.12", features = ["json", "rustls-tls", "stream"] } -globset = "0.4" -ignore = "0.4" -notify = "8" -sha2 = "0.10" -hex = "0.4" -uuid = { version = "1.19", features = ["v4", "serde"] } -console = "0.16" -indicatif = "0.18" + # TypeAgent dependencies + console = "0.16" + globset = "0.4" + hex = "0.4" + ignore = "0.4" + indicatif = "0.18" + lru = "0.16" + nickel-lang-core = "0.16" + nom = "8" + notify = "8" + reqwest = { version = "0.12", features = ["json", "rustls-tls", "stream"] } + sha2 = "0.10" + uuid = { version = "1.19", features = ["v4", "serde"] } -cargo_toml = "0.22" -regex = "1.12" -strum = { version = "0.27", features = ["derive"] } -strum_macros = "0.27" + cargo_toml = "0.22" + regex = "1.12" + strum = { version = "0.27", features = ["derive"] } + strum_macros = "0.27" + [workspace.lints.rust] + unsafe_code = "forbid" -[workspace.lints.rust] -unsafe_code = "forbid" - -[workspace.lints.clippy] -all = "warn" + [workspace.lints.clippy] + all = "warn" diff --git a/config/ag/default.toml b/config/ag/default.toml index abf65eb..604aef6 100644 --- a/config/ag/default.toml +++ b/config/ag/default.toml @@ -4,36 +4,36 @@ # Default LLM provider (claude, openai, gemini, ollama) default_provider = "claude" -# Default model per provider -[agent.models] -claude = "claude-3-5-haiku-20241022" -openai = "gpt-4o-mini" -gemini = "gemini-2.0-flash-exp" -ollama = "llama2" + # Default model per provider + [agent.models] + claude = "claude-3-5-haiku-20241022" + gemini = "gemini-2.0-flash-exp" + ollama = "llama2" + openai = "gpt-4o-mini" -# Default settings -[agent.defaults] -max_tokens = 4096 -temperature = 0.7 -streaming = true + # Default settings + [agent.defaults] + max_tokens = 4096 + streaming = true + temperature = 0.7 -# Template settings -[agent.template] -engine = "tera" # Jinja2-compatible -strict_variables = false + # Template settings + [agent.template] + engine = "tera" # Jinja2-compatible + strict_variables = false -# Validation settings -[agent.validation] -enabled = true -strict = false + # Validation settings + [agent.validation] + enabled = true + strict = false -# Output settings -[agent.output] -format = "markdown" -color = true -timestamp = false + # Output settings + [agent.output] + color = true + format = "markdown" + timestamp = false -# Logging -[agent.logging] -level = "info" -file = false + # Logging + [agent.logging] + file = false + level = "info" diff --git a/config/ag/dev.toml b/config/ag/dev.toml index 91eb09a..5e5f7c0 100644 --- a/config/ag/dev.toml +++ b/config/ag/dev.toml @@ -1,32 +1,32 @@ # TypeDialog Agent - Development Configuration [agent] -default_provider = "ollama" # Use local for dev +default_provider = "ollama" # Use local for dev -[agent.models] -claude = "claude-3-5-haiku-20241022" -openai = "gpt-4o-mini" -gemini = "gemini-2.0-flash-exp" -ollama = "llama2" + [agent.models] + claude = "claude-3-5-haiku-20241022" + gemini = "gemini-2.0-flash-exp" + ollama = "llama2" + openai = "gpt-4o-mini" -[agent.defaults] -max_tokens = 2048 # Lower for dev -temperature = 0.7 -streaming = true + [agent.defaults] + max_tokens = 2048 # Lower for dev + streaming = true + temperature = 0.7 -[agent.template] -engine = "tera" -strict_variables = true # Catch template errors in dev + [agent.template] + engine = "tera" + strict_variables = true # Catch template errors in dev -[agent.validation] -enabled = true -strict = true # Strict validation in dev + [agent.validation] + enabled = true + strict = true # Strict validation in dev -[agent.output] -format = "markdown" -color = true -timestamp = true + [agent.output] + color = true + format = "markdown" + timestamp = true -[agent.logging] -level = "debug" # Verbose in dev -file = true + [agent.logging] + file = true + level = "debug" # Verbose in dev diff --git a/config/ag/production.toml b/config/ag/production.toml index 95c8603..e7c0ce3 100644 --- a/config/ag/production.toml +++ b/config/ag/production.toml @@ -3,35 +3,35 @@ [agent] default_provider = "claude" -[agent.models] -claude = "claude-3-5-sonnet-20241022" # Higher quality for production -openai = "gpt-4o" -gemini = "gemini-1.5-pro" -ollama = "llama2" + [agent.models] + claude = "claude-3-5-sonnet-20241022" # Higher quality for production + gemini = "gemini-1.5-pro" + ollama = "llama2" + openai = "gpt-4o" -[agent.defaults] -max_tokens = 8192 -temperature = 0.3 # More consistent -streaming = true + [agent.defaults] + max_tokens = 8192 + streaming = true + temperature = 0.3 # More consistent -[agent.template] -engine = "tera" -strict_variables = true + [agent.template] + engine = "tera" + strict_variables = true -[agent.validation] -enabled = true -strict = true + [agent.validation] + enabled = true + strict = true -[agent.output] -format = "markdown" -color = false # No color in production logs -timestamp = true + [agent.output] + color = false # No color in production logs + format = "markdown" + timestamp = true -[agent.logging] -level = "warn" # Less verbose in production -file = true + [agent.logging] + file = true + level = "warn" # Less verbose in production -# Rate limiting (production) -[agent.rate_limit] -enabled = true -max_requests_per_minute = 60 + # Rate limiting (production) + [agent.rate_limit] + enabled = true + max_requests_per_minute = 60 diff --git a/config/ai/default.toml b/config/ai/default.toml index 1a11b87..e6da7a5 100644 --- a/config/ai/default.toml +++ b/config/ai/default.toml @@ -17,15 +17,15 @@ model = "gpt-3.5-turbo" # Ollama: http://localhost:11434/api api_endpoint = "" -[llm.generation] -# Temperature: 0.0-2.0, higher = more creative, lower = more focused -temperature = 0.7 + [llm.generation] + # Temperature: 0.0-2.0, higher = more creative, lower = more focused + temperature = 0.7 -# Maximum tokens in response -max_tokens = 2048 + # Maximum tokens in response + max_tokens = 2048 -# Top-p (nucleus) sampling: 0.0-1.0 -top_p = 0.9 + # Top-p (nucleus) sampling: 0.0-1.0 + top_p = 0.9 [rag] # Enable RAG (Retrieval-Augmented Generation) system diff --git a/config/ai/dev.toml b/config/ai/dev.toml index 4a25379..a6284d9 100644 --- a/config/ai/dev.toml +++ b/config/ai/dev.toml @@ -3,29 +3,29 @@ [llm] # Use ollama for local development (requires local Ollama instance) -provider = "ollama" -model = "llama2" # Or whatever model you have installed locally api_endpoint = "http://localhost:11434/api" +model = "llama2" # Or whatever model you have installed locally +provider = "ollama" -[llm.generation] -# Faster responses for iteration -temperature = 0.5 -max_tokens = 1024 + [llm.generation] + # Faster responses for iteration + max_tokens = 1024 + temperature = 0.5 [rag] # Enable RAG for development +cache_size = 500 +embedding_dims = 384 enabled = true index_path = "~/.config/typedialog/ai/rag-index-dev" -embedding_dims = 384 -cache_size = 500 [microservice] +enable_cors = true # Allow localhost:3000, localhost:5173, etc. +enable_websocket = true host = "127.0.0.1" port = 3001 -enable_cors = true # Allow localhost:3000, localhost:5173, etc. -enable_websocket = true [appearance] interaction_mode = "interactive" show_suggestions = true -suggestion_confidence_threshold = 0.3 # Lower threshold for dev feedback +suggestion_confidence_threshold = 0.3 # Lower threshold for dev feedback diff --git a/config/ai/production.toml b/config/ai/production.toml index 0272dbd..b2cc6f8 100644 --- a/config/ai/production.toml +++ b/config/ai/production.toml @@ -3,32 +3,32 @@ [llm] # Production uses high-quality, stable models -provider = "anthropic" +api_endpoint = "" # Uses provider defaults (api.anthropic.com) model = "claude-3-sonnet-20240229" -api_endpoint = "" # Uses provider defaults (api.anthropic.com) +provider = "anthropic" -[llm.generation] -# Conservative settings for production -temperature = 0.3 # More focused, less random -max_tokens = 1024 # Reasonable limit for cost control -top_p = 0.95 + [llm.generation] + # Conservative settings for production + max_tokens = 1024 # Reasonable limit for cost control + temperature = 0.3 # More focused, less random + top_p = 0.95 [rag] # Production RAG system with larger cache +cache_size = 10000 # Larger cache for frequently accessed data +embedding_dims = 768 # Higher quality embeddings enabled = true -index_path = "/var/lib/typedialog/ai/rag-index" # System-wide index path -embedding_dims = 768 # Higher quality embeddings -cache_size = 10000 # Larger cache for frequently accessed data +index_path = "/var/lib/typedialog/ai/rag-index" # System-wide index path [microservice] # Listen on all interfaces for container deployments +enable_cors = false # Restrict CORS for security +enable_websocket = true host = "0.0.0.0" port = 3001 -enable_cors = false # Restrict CORS for security -enable_websocket = true [appearance] # Production uses validation mode interaction_mode = "validate_only" -show_suggestions = false # Don't show raw LLM output to users -suggestion_confidence_threshold = 0.8 # Only very confident suggestions +show_suggestions = false # Don't show raw LLM output to users +suggestion_confidence_threshold = 0.8 # Only very confident suggestions diff --git a/config/cli/default.toml b/config/cli/default.toml index 24891f5..1d32f2f 100644 --- a/config/cli/default.toml +++ b/config/cli/default.toml @@ -2,12 +2,12 @@ # Used for standard command-line form rendering [form] -title = "CLI Form" description = "Standard command-line interface form" +title = "CLI Form" -[form.validation] -validate_on_change = true -show_errors_inline = true + [form.validation] + show_errors_inline = true + validate_on_change = true [output] format = "json" diff --git a/config/cli/dev.toml b/config/cli/dev.toml index 2d6e544..7b52edc 100644 --- a/config/cli/dev.toml +++ b/config/cli/dev.toml @@ -2,31 +2,31 @@ # Extended configuration for development and testing [form] -title = "CLI Form (Dev)" description = "Development CLI form with debugging enabled" +title = "CLI Form (Dev)" -[form.validation] -validate_on_change = true -show_errors_inline = true -strict_validation = true + [form.validation] + show_errors_inline = true + strict_validation = true + validate_on_change = true [output] +debug_output = true format = "json" pretty_print = true -debug_output = true [terminal] -use_raw_mode = true enable_mouse = true use_color = true +use_raw_mode = true [appearance] -theme = "default" +show_field_types = true show_help = true show_placeholders = true -show_field_types = true +theme = "default" [debug] enabled = true -trace_execution = false log_level = "info" +trace_execution = false diff --git a/config/cli/production.toml b/config/cli/production.toml index 17c732e..330ee7b 100644 --- a/config/cli/production.toml +++ b/config/cli/production.toml @@ -2,13 +2,13 @@ # Optimized for production deployment [form] -title = "Form" description = "" +title = "Form" -[form.validation] -validate_on_change = true -show_errors_inline = true -strict_validation = true + [form.validation] + show_errors_inline = true + strict_validation = true + validate_on_change = true [output] format = "json" @@ -17,18 +17,18 @@ pretty_print = false debug_output = false [terminal] -use_raw_mode = true enable_mouse = false use_color = true +use_raw_mode = true [appearance] -theme = "default" show_help = false show_placeholders = false +theme = "default" [logging] -level = "error" file = "/var/log/typedialog/cli.log" +level = "error" [timeout] # Maximum form completion time (seconds) diff --git a/config/prov-gen/default.toml b/config/prov-gen/default.toml index fc271cf..9474496 100644 --- a/config/prov-gen/default.toml +++ b/config/prov-gen/default.toml @@ -7,36 +7,36 @@ output_dir = "./provisioning" # Default providers to include default_providers = ["aws", "hetzner"] -# Generation settings -[provisioning.generation] -overwrite = false -dry_run = false -verbose = false + # Generation settings + [provisioning.generation] + dry_run = false + overwrite = false + verbose = false -# Template settings -[provisioning.templates] -# Use local path in development; installed binaries use ~/.config/typedialog/prov-gen/templates -base_path = "crates/typedialog-prov-gen/templates" -# custom_path = "path/to/custom/templates" # Uncomment to override + # Template settings + [provisioning.templates] + # Use local path in development; installed binaries use ~/.config/typedialog/prov-gen/templates + base_path = "crates/typedialog-prov-gen/templates" + # custom_path = "path/to/custom/templates" # Uncomment to override -# Infrastructure defaults -[provisioning.infrastructure] -environment = "development" -region = "us-east-1" + # Infrastructure defaults + [provisioning.infrastructure] + environment = "development" + region = "us-east-1" -# Nickel integration -[provisioning.nickel] -validate_schemas = true -generate_defaults = true -use_constraints = true + # Nickel integration + [provisioning.nickel] + generate_defaults = true + use_constraints = true + validate_schemas = true -# AI assistance -[provisioning.ai] -enabled = false -provider = "claude" -model = "claude-3-5-sonnet-20241022" + # AI assistance + [provisioning.ai] + enabled = false + model = "claude-3-5-sonnet-20241022" + provider = "claude" -# Logging -[provisioning.logging] -level = "info" -file = false + # Logging + [provisioning.logging] + file = false + level = "info" diff --git a/config/prov-gen/dev.toml b/config/prov-gen/dev.toml index 1a4d004..5ce3fcb 100644 --- a/config/prov-gen/dev.toml +++ b/config/prov-gen/dev.toml @@ -1,32 +1,32 @@ # TypeDialog Provisioning Generator - Development Configuration [provisioning] +default_providers = ["hetzner", "lxd"] # Cheaper for dev output_dir = "./provisioning" -default_providers = ["hetzner", "lxd"] # Cheaper for dev -[provisioning.generation] -overwrite = true # Allow overwrite in dev -dry_run = false -verbose = true # Verbose in dev + [provisioning.generation] + dry_run = false + overwrite = true # Allow overwrite in dev + verbose = true # Verbose in dev -[provisioning.templates] -base_path = "templates" -custom_path = "./custom-templates" + [provisioning.templates] + base_path = "templates" + custom_path = "./custom-templates" -[provisioning.infrastructure] -environment = "development" -region = "eu-central-1" + [provisioning.infrastructure] + environment = "development" + region = "eu-central-1" -[provisioning.nickel] -validate_schemas = true -generate_defaults = true -use_constraints = true + [provisioning.nickel] + generate_defaults = true + use_constraints = true + validate_schemas = true -[provisioning.ai] -enabled = true # Enable AI in dev -provider = "ollama" # Use local for dev -model = "llama2" + [provisioning.ai] + enabled = true # Enable AI in dev + model = "llama2" + provider = "ollama" # Use local for dev -[provisioning.logging] -level = "debug" -file = true + [provisioning.logging] + file = true + level = "debug" diff --git a/config/prov-gen/production.toml b/config/prov-gen/production.toml index edfeffd..0d9673f 100644 --- a/config/prov-gen/production.toml +++ b/config/prov-gen/production.toml @@ -1,41 +1,41 @@ # TypeDialog Provisioning Generator - Production Configuration [provisioning] -output_dir = "./provisioning" default_providers = ["aws", "gcp"] +output_dir = "./provisioning" -[provisioning.generation] -overwrite = false # Require explicit --force -dry_run = false -verbose = false + [provisioning.generation] + dry_run = false + overwrite = false # Require explicit --force + verbose = false -[provisioning.templates] -base_path = "templates" -# custom_path = "" # Optional: set custom templates path + [provisioning.templates] + base_path = "templates" + # custom_path = "" # Optional: set custom templates path -[provisioning.infrastructure] -environment = "production" -region = "us-east-1" + [provisioning.infrastructure] + environment = "production" + region = "us-east-1" -[provisioning.nickel] -validate_schemas = true -generate_defaults = true -use_constraints = true + [provisioning.nickel] + generate_defaults = true + use_constraints = true + validate_schemas = true -[provisioning.ai] -enabled = true -provider = "claude" -model = "claude-3-5-sonnet-20241022" + [provisioning.ai] + enabled = true + model = "claude-3-5-sonnet-20241022" + provider = "claude" -[provisioning.logging] -level = "warn" -file = true + [provisioning.logging] + file = true + level = "warn" -# Production-specific settings -[provisioning.validation] -strict = true -require_tests = true + # Production-specific settings + [provisioning.validation] + require_tests = true + strict = true -[provisioning.security] -require_encryption = true -scan_templates = true + [provisioning.security] + require_encryption = true + scan_templates = true diff --git a/config/tui/default.toml b/config/tui/default.toml index 9e9dccc..431df1c 100644 --- a/config/tui/default.toml +++ b/config/tui/default.toml @@ -2,12 +2,12 @@ # Terminal User Interface rendering [form] -title = "TUI Form" description = "Interactive terminal user interface form" +title = "TUI Form" -[form.validation] -validate_on_change = true -show_errors_inline = true + [form.validation] + show_errors_inline = true + validate_on_change = true [output] format = "json" @@ -15,9 +15,9 @@ pretty_print = true [terminal] # Full TUI features -use_raw_mode = true enable_mouse = true enable_scrolling = true +use_raw_mode = true # Fixed height (-1 = auto) height = -1 # Fixed width (-1 = auto) @@ -34,8 +34,8 @@ highlight_on_hover = true enable_animations = true [appearance] -theme = "default" border_style = "rounded" +theme = "default" # Color scheme: default, dark, light, high_contrast color_scheme = "default" diff --git a/config/tui/dev.toml b/config/tui/dev.toml index 631aaef..a32b59b 100644 --- a/config/tui/dev.toml +++ b/config/tui/dev.toml @@ -2,42 +2,42 @@ # Extended TUI features for development [form] -title = "TUI Form (Dev)" description = "Development TUI form with all features enabled" +title = "TUI Form (Dev)" -[form.validation] -validate_on_change = true -show_errors_inline = true -strict_validation = true + [form.validation] + show_errors_inline = true + strict_validation = true + validate_on_change = true [output] +debug_output = true format = "json" pretty_print = true -debug_output = true [terminal] -use_raw_mode = true enable_mouse = true enable_scrolling = true height = -1 +use_raw_mode = true width = -1 [ui] +enable_animations = true +highlight_on_hover = true show_borders = true show_focus = true -highlight_on_hover = true -enable_animations = true # Show field indices for debugging show_field_indices = true [appearance] -theme = "default" border_style = "double" color_scheme = "default" +theme = "default" [keyboard] -vi_mode = false emacs_mode = false +vi_mode = false [debug] enabled = true diff --git a/config/tui/production.toml b/config/tui/production.toml index f3a5e12..8a427b3 100644 --- a/config/tui/production.toml +++ b/config/tui/production.toml @@ -2,44 +2,44 @@ # Optimized TUI for production deployment [form] -title = "" description = "" +title = "" -[form.validation] -validate_on_change = true -show_errors_inline = true -strict_validation = true + [form.validation] + show_errors_inline = true + strict_validation = true + validate_on_change = true [output] +debug_output = false format = "json" pretty_print = false -debug_output = false [terminal] -use_raw_mode = true enable_mouse = true enable_scrolling = true height = -1 +use_raw_mode = true width = -1 [ui] +enable_animations = false +highlight_on_hover = true show_borders = true show_focus = true -highlight_on_hover = true -enable_animations = false [appearance] -theme = "default" border_style = "rounded" color_scheme = "default" +theme = "default" [keyboard] -vi_mode = false emacs_mode = false +vi_mode = false [logging] -level = "error" file = "/var/log/typedialog/tui.log" +level = "error" [performance] # Render throttle (milliseconds) diff --git a/config/web/default.toml b/config/web/default.toml index d81fd1d..809624d 100644 --- a/config/web/default.toml +++ b/config/web/default.toml @@ -9,13 +9,13 @@ cors_enabled = true cors_origins = ["localhost", "127.0.0.1"] [form] -title = "Web Form" description = "Interactive web form" +title = "Web Form" -[form.validation] -validate_on_change = true -show_errors_inline = true -client_validation = true + [form.validation] + client_validation = true + show_errors_inline = true + validate_on_change = true [output] format = "json" diff --git a/config/web/dev.toml b/config/web/dev.toml index be7e51d..4971589 100644 --- a/config/web/dev.toml +++ b/config/web/dev.toml @@ -10,30 +10,30 @@ hot_reload = true debug = true [form] -title = "Web Form (Dev)" description = "Development web form" +title = "Web Form (Dev)" -[form.validation] -validate_on_change = true -show_errors_inline = true -client_validation = true + [form.validation] + client_validation = true + show_errors_inline = true + validate_on_change = true [output] format = "json" [html] css_framework = "none" +dark_mode = true inline_styles = true responsive = true -dark_mode = true # Show field metadata show_field_metadata = true [submission] -method = "post" -webhook_url = "http://localhost:8000/webhook" -redirect_on_success = false log_submissions = true +method = "post" +redirect_on_success = false +webhook_url = "http://localhost:8000/webhook" [security] csrf_enabled = true @@ -41,10 +41,10 @@ rate_limit = 0 require_https = false [logging] -level = "debug" file = "/tmp/typedialog-web.log" +level = "debug" [api] # API documentation enabled -enable_docs = true docs_path = "/docs" +enable_docs = true diff --git a/config/web/production.toml b/config/web/production.toml index df7a059..71df1f9 100644 --- a/config/web/production.toml +++ b/config/web/production.toml @@ -5,35 +5,35 @@ host = "0.0.0.0" port = 8080 # Disable development features -hot_reload = false debug = false +hot_reload = false # Worker threads workers = 4 [form] -title = "" description = "" +title = "" -[form.validation] -validate_on_change = true -show_errors_inline = true -client_validation = true + [form.validation] + client_validation = true + show_errors_inline = true + validate_on_change = true [output] format = "json" [html] css_framework = "none" +dark_mode = true inline_styles = false responsive = true -dark_mode = true [submission] method = "post" # Required: webhook for production submissions -webhook_url = "https://api.example.com/forms" redirect_on_success = true redirect_url = "https://example.com/thank-you" +webhook_url = "https://api.example.com/forms" [security] # Strict CSRF protection @@ -46,8 +46,8 @@ require_https = true add_security_headers = true [logging] -level = "error" file = "/var/log/typedialog/web.log" +level = "error" [performance] # Cache static assets @@ -60,6 +60,6 @@ compression_threshold = 1024 [tls] # Optional TLS configuration -enabled = false cert_path = "/etc/typedialog/cert.pem" +enabled = false key_path = "/etc/typedialog/key.pem" diff --git a/crates/typedialog-agent/typedialog-ag-core/Cargo.toml b/crates/typedialog-agent/typedialog-ag-core/Cargo.toml index 3a00834..c2ce398 100644 --- a/crates/typedialog-agent/typedialog-ag-core/Cargo.toml +++ b/crates/typedialog-agent/typedialog-ag-core/Cargo.toml @@ -1,20 +1,20 @@ [package] -name = "typedialog-ag-core" -version.workspace = true -edition.workspace = true -rust-version.workspace = true authors.workspace = true -license.workspace = true -repository.workspace = true -description = "Core library for type-safe AI agent execution with MDX → Nickel → MD pipeline" -keywords.workspace = true categories.workspace = true +description = "Core library for type-safe AI agent execution with MDX → Nickel → MD pipeline" +edition.workspace = true +keywords.workspace = true +license.workspace = true +name = "typedialog-ag-core" +repository.workspace = true +rust-version.workspace = true +version.workspace = true [dependencies] # Async -tokio = { workspace = true } -futures = { workspace = true } async-trait = { workspace = true } +futures = { workspace = true } +tokio = { workspace = true } # Nickel nickel-lang-core = { workspace = true } @@ -36,36 +36,36 @@ globset = { workspace = true } ignore = { workspace = true } # Cache +bincode = { workspace = true } +hex = { workspace = true } lru = { workspace = true } sha2 = { workspace = true } -hex = { workspace = true } -bincode = { workspace = true } # Parsing nom = { workspace = true } # Error handling -thiserror = { workspace = true } anyhow = { workspace = true } +thiserror = { workspace = true } # Logging tracing = { workspace = true } # Utilities -uuid = { workspace = true } chrono = { workspace = true } dirs = { workspace = true } +uuid = { workspace = true } [dev-dependencies] -proptest.workspace = true criterion.workspace = true +proptest.workspace = true [features] +cache = [] # Cache layer default = ["markup", "nickel", "cache"] -markup = [] # MDX parsing + transpiler -nickel = [] # Nickel evaluation -markdown = [] # Legacy .agent.md support -cache = [] # Cache layer +markdown = [] # Legacy .agent.md support +markup = [] # MDX parsing + transpiler +nickel = [] # Nickel evaluation [lib] name = "typedialog_ag_core" diff --git a/crates/typedialog-agent/typedialog-ag/Cargo.toml b/crates/typedialog-agent/typedialog-ag/Cargo.toml index d2d612f..90bb32d 100644 --- a/crates/typedialog-agent/typedialog-ag/Cargo.toml +++ b/crates/typedialog-agent/typedialog-ag/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "typedialog-ag" -version.workspace = true -edition.workspace = true -rust-version.workspace = true authors.workspace = true -license.workspace = true -repository.workspace = true -description = "CLI for executing type-safe AI agents" -keywords.workspace = true categories.workspace = true +description = "CLI for executing type-safe AI agents" +edition.workspace = true +keywords.workspace = true +license.workspace = true +name = "typedialog-ag" +repository.workspace = true +rust-version.workspace = true +version.workspace = true [dependencies] # Internal @@ -23,17 +23,17 @@ tower-http = { workspace = true } # CLI clap = { workspace = true } -inquire = { workspace = true } console = { workspace = true } indicatif = { workspace = true } +inquire = { workspace = true } # Serialization serde = { workspace = true } serde_json = { workspace = true } # Error handling -thiserror = { workspace = true } anyhow = { workspace = true } +thiserror = { workspace = true } # Logging tracing = { workspace = true } @@ -47,6 +47,6 @@ toml = { workspace = true } default = [] watch = ["dep:notify"] -[dependencies.notify] -workspace = true -optional = true + [dependencies.notify] + optional = true + workspace = true diff --git a/crates/typedialog-ai/Cargo.toml b/crates/typedialog-ai/Cargo.toml index 0c9071a..1adf77c 100644 --- a/crates/typedialog-ai/Cargo.toml +++ b/crates/typedialog-ai/Cargo.toml @@ -1,52 +1,52 @@ [package] -name = "typedialog-ai" -version.workspace = true -edition.workspace = true authors.workspace = true -repository.workspace = true -license.workspace = true description = "AI-powered configuration assistant backend and microservice for TypeDialog" +edition.workspace = true +license.workspace = true +name = "typedialog-ai" +repository.workspace = true +version.workspace = true [dependencies] # Internal typedialog-core = { path = "../typedialog-core", features = ["ai_backend"] } # Workspace dependencies (shared with other crates) -tokio = { workspace = true } +anyhow = { workspace = true } async-trait = { workspace = true } +chrono = { workspace = true } +clap = { workspace = true } +colored = { workspace = true } +dialoguer = { workspace = true } +dirs = { workspace = true } futures = { workspace = true } -surrealdb = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } +surrealdb = { workspace = true } +thiserror = { workspace = true } +tokio = { workspace = true } toml = { workspace = true } -clap = { workspace = true } -dialoguer = { workspace = true } -colored = { workspace = true } -uuid = { workspace = true } -chrono = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } -thiserror = { workspace = true } -anyhow = { workspace = true } -dirs = { workspace = true } +uuid = { workspace = true } # Web and HTTP dependencies (now aligned with workspace versions) # Code migrated to support workspace versions: # - axum: Upgraded from 0.7 to 0.8.8 (WebSocket Message::Text now uses Utf8Bytes) # - reqwest: Using workspace 0.12 (streaming API compatible) # - tower/tower-http: Aligned with axum 0.8.8 -reqwest = { workspace = true, features = ["json", "stream"] } axum = { workspace = true, features = ["ws"] } +reqwest = { workspace = true, features = ["json", "stream"] } tower = { workspace = true } tower-http = { workspace = true, features = ["cors", "trace"] } [features] -default = ["openai"] -openai = [] -anthropic = [] -ollama = [] all-providers = ["openai", "anthropic", "ollama"] +anthropic = [] +default = ["openai"] +ollama = [] +openai = [] [lib] name = "typedialog_ai" @@ -56,7 +56,7 @@ path = "src/lib.rs" name = "typedialog-ai" path = "src/main.rs" -[package.metadata.binstall] -pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" -bin-dir = "bin/{ bin }" -pkg-fmt = "tgz" + [package.metadata.binstall] + bin-dir = "bin/{ bin }" + pkg-fmt = "tgz" + pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" diff --git a/crates/typedialog-core/Cargo.toml b/crates/typedialog-core/Cargo.toml index 2279e74..fa4cd94 100644 --- a/crates/typedialog-core/Cargo.toml +++ b/crates/typedialog-core/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "typedialog-core" -version.workspace = true authors.workspace = true -edition.workspace = true -repository.workspace = true -license.workspace = true description = "Core library for TypeDialog - form handling and multiple rendering backends" +edition.workspace = true +license.workspace = true +name = "typedialog-core" +repository.workspace = true +version.workspace = true [lib] name = "typedialog_core" @@ -13,81 +13,81 @@ path = "src/lib.rs" [dependencies] # Core dependencies +anyhow.workspace = true +async-trait.workspace = true +chrono.workspace = true +dirs.workspace = true # For config path resolution serde = { workspace = true } serde_json.workspace = true serde_yaml.workspace = true -toml.workspace = true -chrono.workspace = true -anyhow.workspace = true -thiserror.workspace = true -async-trait.workspace = true -tera = { workspace = true, optional = true } tempfile.workspace = true -dirs.workspace = true # For config path resolution -tracing.workspace = true # Logging framework +tera = { workspace = true, optional = true } +thiserror.workspace = true +toml.workspace = true +tracing.workspace = true # Logging framework # i18n (optional) fluent = { workspace = true, optional = true } fluent-bundle = { workspace = true, optional = true } -unic-langid = { workspace = true, optional = true } sys-locale = { workspace = true, optional = true } +unic-langid = { workspace = true, optional = true } # Nushell integration (optional) -nu-protocol = { workspace = true, optional = true } nu-plugin = { workspace = true, optional = true } +nu-protocol = { workspace = true, optional = true } # CLI Backend (inquire) - optional -inquire = { workspace = true, optional = true } dialoguer = { workspace = true, optional = true } +inquire = { workspace = true, optional = true } rpassword = { workspace = true, optional = true } # TUI Backend (ratatui) - optional -ratatui = { workspace = true, optional = true } -crossterm = { workspace = true, optional = true } atty = { workspace = true, optional = true } +crossterm = { workspace = true, optional = true } +ratatui = { workspace = true, optional = true } # Web Backend (axum) - optional axum = { workspace = true, optional = true } +futures = { workspace = true, optional = true } tokio = { workspace = true, optional = true } tower = { workspace = true, optional = true } tower-http = { workspace = true, optional = true } tracing-subscriber = { workspace = true, optional = true } -futures = { workspace = true, optional = true } # Encryption - optional (prov-ecosystem integration) encrypt = { path = "../../../prov-ecosystem/crates/encrypt", optional = true } # AI Backend - optional -instant-distance = { workspace = true, optional = true } -tantivy = { workspace = true, optional = true } bincode = { workspace = true, optional = true } -serde_bytes = { workspace = true, optional = true } -rand = { workspace = true, optional = true } +instant-distance = { workspace = true, optional = true } petgraph = { workspace = true, optional = true } +rand = { workspace = true, optional = true } +serde_bytes = { workspace = true, optional = true } +tantivy = { workspace = true, optional = true } [dev-dependencies] +age = "0.11" +criterion.workspace = true +proptest.workspace = true serde_json.workspace = true tokio = { workspace = true, features = ["full"] } -age = "0.11" -proptest.workspace = true -criterion.workspace = true [features] -default = ["cli", "i18n", "templates"] -cli = ["inquire", "dialoguer", "rpassword"] -tui = ["ratatui", "crossterm", "atty"] -web = ["axum", "tokio", "tower", "tower-http", "tracing-subscriber", "futures"] -i18n = ["fluent", "fluent-bundle", "unic-langid", "sys-locale"] -templates = ["tera"] -nushell = ["nu-protocol", "nu-plugin"] -encryption = ["encrypt"] ai_backend = ["instant-distance", "tantivy", "bincode", "serde_bytes", "rand", "petgraph"] all-backends = ["cli", "tui", "web"] +cli = ["inquire", "dialoguer", "rpassword"] +default = ["cli", "i18n", "templates"] +encryption = ["encrypt"] full = ["i18n", "templates", "nushell", "encryption", "ai_backend", "all-backends"] +i18n = ["fluent", "fluent-bundle", "unic-langid", "sys-locale"] +nushell = ["nu-protocol", "nu-plugin"] +templates = ["tera"] +tui = ["ratatui", "crossterm", "atty"] +web = ["axum", "tokio", "tower", "tower-http", "tracing-subscriber", "futures"] [[bench]] -name = "parsing_benchmarks" harness = false +name = "parsing_benchmarks" [lints] workspace = true diff --git a/crates/typedialog-prov-gen/Cargo.toml b/crates/typedialog-prov-gen/Cargo.toml index 6c10935..e96c533 100644 --- a/crates/typedialog-prov-gen/Cargo.toml +++ b/crates/typedialog-prov-gen/Cargo.toml @@ -1,41 +1,41 @@ [package] -name = "typedialog-prov-gen" -version.workspace = true -edition.workspace = true authors.workspace = true -repository.workspace = true +edition.workspace = true license.workspace = true +name = "typedialog-prov-gen" +repository.workspace = true +version.workspace = true [dependencies] # Workspace dependencies +anyhow = { workspace = true } +async-trait = { workspace = true } +chrono = { workspace = true } +clap = { workspace = true } +dirs = { workspace = true } +futures = { workspace = true } +rand = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } -toml = { workspace = true } -anyhow = { workspace = true } -thiserror = { workspace = true } -clap = { workspace = true } -async-trait = { workspace = true } -tokio = { workspace = true } -futures = { workspace = true } -tera = { workspace = true } -chrono = { workspace = true } -rand = { workspace = true } tempfile = { workspace = true } -dirs = { workspace = true } +tera = { workspace = true } +thiserror = { workspace = true } +tokio = { workspace = true } +toml = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true } # Internal dependencies (workspace path) -typedialog-core = { path = "../typedialog-core", features = ["ai_backend"] } typedialog-ai = { path = "../typedialog-ai" } +typedialog-core = { path = "../typedialog-core", features = ["ai_backend"] } # Additional workspace dependencies cargo_toml = { workspace = true } -uuid = { workspace = true } regex = { workspace = true } strum = { workspace = true } strum_macros = { workspace = true } +uuid = { workspace = true } [dev-dependencies] tempfile = { workspace = true } @@ -44,10 +44,10 @@ tempfile = { workspace = true } name = "typedialog-prov-gen" path = "src/main.rs" -[package.metadata.binstall] -pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" -bin-dir = "bin/{ bin }" -pkg-fmt = "tgz" + [package.metadata.binstall] + bin-dir = "bin/{ bin }" + pkg-fmt = "tgz" + pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" [lib] name = "typedialog_prov_gen" diff --git a/crates/typedialog-prov-gen/templates/fragments/database-mysql-section.toml b/crates/typedialog-prov-gen/templates/fragments/database-mysql-section.toml index e30df53..14ec8f6 100644 --- a/crates/typedialog-prov-gen/templates/fragments/database-mysql-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/database-mysql-section.toml @@ -1,86 +1,61 @@ name = "mysql_fragment" [[elements]] -name = "mysql_header" -type = "section_header" -title = "💾 MySQL Database Configuration" -border_top = true border_bottom = true +border_top = true +name = "mysql_header" +title = "💾 MySQL Database Configuration" +type = "section_header" [[elements]] -name = "mysql_host" -type = "text" -prompt = "MySQL host" -placeholder = "localhost" default = "localhost" -required = true help = "MySQL server hostname or IP address" -nickel_path = [ - "tracker", - "core", - "database", - "mysql_host", -] +name = "mysql_host" nickel_alias = "mysql_host" +nickel_path = ["tracker", "core", "database", "mysql_host"] +placeholder = "localhost" +prompt = "MySQL host" +required = true +type = "text" [[elements]] -name = "mysql_port" -type = "text" -prompt = "MySQL port" -placeholder = "3306" default = "3306" -required = true help = "MySQL server port (default 3306). Must be between 1-65535." -nickel_path = [ - "tracker", - "core", - "database", - "mysql_port", -] +name = "mysql_port" nickel_alias = "mysql_port" +nickel_path = ["tracker", "core", "database", "mysql_port"] +placeholder = "3306" +prompt = "MySQL port" +required = true +type = "text" [[elements]] -name = "mysql_database_name" -type = "text" -prompt = "Database name" -placeholder = "torrust_tracker" default = "torrust_tracker" -required = true help = "Name of the MySQL database" -nickel_path = [ - "tracker", - "core", - "database", - "database_name", -] +name = "mysql_database_name" nickel_alias = "mysql_database_name" - -[[elements]] -name = "mysql_username" -type = "text" -prompt = "Database username" -placeholder = "tracker_user" -default = "tracker_user" +nickel_path = ["tracker", "core", "database", "database_name"] +placeholder = "torrust_tracker" +prompt = "Database name" required = true -help = "MySQL username for authentication" -nickel_path = [ - "tracker", - "core", - "database", - "mysql_username", -] -nickel_alias = "mysql_username" +type = "text" [[elements]] +default = "tracker_user" +help = "MySQL username for authentication" +name = "mysql_username" +nickel_alias = "mysql_username" +nickel_path = ["tracker", "core", "database", "mysql_username"] +placeholder = "tracker_user" +prompt = "Database username" +required = true +type = "text" + +[[elements]] +help = "MySQL password for authentication" name = "mysql_password" -type = "password" +nickel_alias = "mysql_password" +nickel_path = ["tracker", "core", "database", "mysql_password"] prompt = "Database password" required = true -help = "MySQL password for authentication" -nickel_path = [ - "tracker", - "core", - "database", - "mysql_password", -] -nickel_alias = "mysql_password" +type = "password" diff --git a/crates/typedialog-prov-gen/templates/fragments/database-sqlite-section.toml b/crates/typedialog-prov-gen/templates/fragments/database-sqlite-section.toml index 8d7ce81..240122f 100644 --- a/crates/typedialog-prov-gen/templates/fragments/database-sqlite-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/database-sqlite-section.toml @@ -1,24 +1,19 @@ name = "sqlite_fragment" [[elements]] -name = "sqlite_header" -type = "section_header" -title = "💾 SQLite Database Configuration" -border_top = true border_bottom = true +border_top = true +name = "sqlite_header" +title = "💾 SQLite Database Configuration" +type = "section_header" [[elements]] -name = "sqlite_database_name" -type = "text" -prompt = "Database filename" -placeholder = "tracker.db" default = "tracker.db" -required = true help = "Name of the SQLite database file (will be created in the tracker data directory)" -nickel_path = [ - "tracker", - "core", - "database", - "database_name", -] +name = "sqlite_database_name" nickel_alias = "sqlite_database_name" +nickel_path = ["tracker", "core", "database", "database_name"] +placeholder = "tracker.db" +prompt = "Database filename" +required = true +type = "text" diff --git a/crates/typedialog-prov-gen/templates/fragments/environment-section.toml b/crates/typedialog-prov-gen/templates/fragments/environment-section.toml index 8dd3f8c..e30e59a 100644 --- a/crates/typedialog-prov-gen/templates/fragments/environment-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/environment-section.toml @@ -1,31 +1,25 @@ name = "environment_fragment" [[elements]] -name = "environment_header" -type = "section_header" -title = "🏗️ Environment Identification" -border_top = true border_bottom = true +border_top = true +name = "environment_header" +title = "🏗️ Environment Identification" +type = "section_header" [[elements]] -name = "environment_name" -type = "text" -prompt = "Environment name" -placeholder = "dev, staging, production, e2e-test" -required = true help = "Lowercase letters, numbers, dashes. Cannot start with number or dash. Examples: dev, staging, e2e-config" -nickel_path = [ - "environment", - "name", -] +name = "environment_name" +nickel_path = ["environment", "name"] +placeholder = "dev, staging, production, e2e-test" +prompt = "Environment name" +required = true +type = "text" [[elements]] -name = "instance_name" -type = "text" -prompt = "Instance/VM name (optional)" -placeholder = "Leave empty for auto-generation: torrust-tracker-vm-{env-name}" help = "1-63 chars, ASCII letters/numbers/dashes, no leading digit/dash, no trailing dash. Will be auto-generated if omitted." -nickel_path = [ - "environment", - "instance_name", -] +name = "instance_name" +nickel_path = ["environment", "instance_name"] +placeholder = "Leave empty for auto-generation: torrust-tracker-vm-{env-name}" +prompt = "Instance/VM name (optional)" +type = "text" diff --git a/crates/typedialog-prov-gen/templates/fragments/grafana-section.toml b/crates/typedialog-prov-gen/templates/fragments/grafana-section.toml index 66f19fc..0feaa6e 100644 --- a/crates/typedialog-prov-gen/templates/fragments/grafana-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/grafana-section.toml @@ -1,31 +1,25 @@ name = "grafana_fragment" [[elements]] -name = "grafana_header" -type = "section_header" -title = "📈 Grafana Configuration" -border_top = true border_bottom = true +border_top = true +name = "grafana_header" +title = "📈 Grafana Configuration" +type = "section_header" [[elements]] -name = "grafana_bind_address" -type = "text" -prompt = "Grafana bind address" -placeholder = "0.0.0.0:3000" default = "0.0.0.0:3000" help = "Address and port for Grafana. Format: IP:PORT (e.g., 0.0.0.0:3000)" -nickel_path = [ - "grafana", - "bind_address", -] +name = "grafana_bind_address" +nickel_path = ["grafana", "bind_address"] +placeholder = "0.0.0.0:3000" +prompt = "Grafana bind address" +type = "text" [[elements]] +help = "Admin password for Grafana access. Keep this secure!" name = "grafana_admin_password" -type = "password" +nickel_path = ["grafana", "admin_password"] prompt = "Grafana admin password" required = true -help = "Admin password for Grafana access. Keep this secure!" -nickel_path = [ - "grafana", - "admin_password", -] +type = "password" diff --git a/crates/typedialog-prov-gen/templates/fragments/prometheus-section.toml b/crates/typedialog-prov-gen/templates/fragments/prometheus-section.toml index 2c6e1ad..e61d756 100644 --- a/crates/typedialog-prov-gen/templates/fragments/prometheus-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/prometheus-section.toml @@ -1,32 +1,26 @@ name = "prometheus_fragment" [[elements]] -name = "prometheus_header" -type = "section_header" -title = "📊 Prometheus Configuration" -border_top = true border_bottom = true +border_top = true +name = "prometheus_header" +title = "📊 Prometheus Configuration" +type = "section_header" [[elements]] -name = "prometheus_bind_address" -type = "text" -prompt = "Prometheus bind address" -placeholder = "0.0.0.0:9090" default = "0.0.0.0:9090" help = "Address and port for Prometheus. Format: IP:PORT (e.g., 0.0.0.0:9090)" -nickel_path = [ - "prometheus", - "bind_address", -] +name = "prometheus_bind_address" +nickel_path = ["prometheus", "bind_address"] +placeholder = "0.0.0.0:9090" +prompt = "Prometheus bind address" +type = "text" [[elements]] -name = "prometheus_scrape_interval" -type = "text" -prompt = "Scrape interval (seconds)" -placeholder = "15" default = "15" help = "How often Prometheus should scrape metrics (in seconds). Default: 15 seconds." -nickel_path = [ - "prometheus", - "scrape_interval", -] +name = "prometheus_scrape_interval" +nickel_path = ["prometheus", "scrape_interval"] +placeholder = "15" +prompt = "Scrape interval (seconds)" +type = "text" diff --git a/crates/typedialog-prov-gen/templates/fragments/provider-aws-section.toml b/crates/typedialog-prov-gen/templates/fragments/provider-aws-section.toml index ac70507..bf2073e 100644 --- a/crates/typedialog-prov-gen/templates/fragments/provider-aws-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/provider-aws-section.toml @@ -1,145 +1,121 @@ name = "aws_provider_fragment" [[elements]] -name = "aws_header" -type = "section_header" -title = "☁️ AWS Cloud Configuration" -border_top = true border_bottom = true +border_top = true +name = "aws_header" +title = "☁️ AWS Cloud Configuration" +type = "section_header" [[elements]] +help = "Your AWS IAM Access Key ID for authentication" name = "aws_access_key_id" -type = "text" +nickel_path = ["provider", "aws_access_key_id"] prompt = "AWS Access Key ID" required = true -help = "Your AWS IAM Access Key ID for authentication" -nickel_path = [ - "provider", - "aws_access_key_id", -] +type = "text" [[elements]] +help = "Your AWS IAM Secret Access Key (will be masked)" name = "aws_secret_access_key" -type = "password" +nickel_path = ["provider", "aws_secret_access_key"] prompt = "AWS Secret Access Key" required = true -help = "Your AWS IAM Secret Access Key (will be masked)" -nickel_path = [ - "provider", - "aws_secret_access_key", -] +type = "password" [[elements]] -name = "aws_region" -type = "select" -prompt = "AWS Region" -options = [ - { value = "us-east-1", label = "US East (N. Virginia)" }, - { value = "us-east-2", label = "US East (Ohio)" }, - { value = "us-west-1", label = "US West (N. California)" }, - { value = "us-west-2", label = "US West (Oregon)" }, - { value = "eu-west-1", label = "Europe (Ireland)" }, - { value = "eu-west-2", label = "Europe (London)" }, - { value = "eu-west-3", label = "Europe (Paris)" }, - { value = "eu-central-1", label = "Europe (Frankfurt)" }, - { value = "eu-north-1", label = "Europe (Stockholm)" }, - { value = "ap-northeast-1", label = "Asia Pacific (Tokyo)" }, - { value = "ap-northeast-2", label = "Asia Pacific (Seoul)" }, - { value = "ap-northeast-3", label = "Asia Pacific (Osaka)" }, - { value = "ap-southeast-1", label = "Asia Pacific (Singapore)" }, - { value = "ap-southeast-2", label = "Asia Pacific (Sydney)" }, - { value = "ap-south-1", label = "Asia Pacific (Mumbai)" }, - { value = "sa-east-1", label = "South America (São Paulo)" }, - { value = "ca-central-1", label = "Canada (Central)" }, -] default = "us-east-1" -required = true help = "AWS region where resources will be deployed" -nickel_path = [ - "provider", - "aws_region", +name = "aws_region" +nickel_path = ["provider", "aws_region"] +options = [ + { value = "us-east-1", label = "US East (N. Virginia)" }, + { value = "us-east-2", label = "US East (Ohio)" }, + { value = "us-west-1", label = "US West (N. California)" }, + { value = "us-west-2", label = "US West (Oregon)" }, + { value = "eu-west-1", label = "Europe (Ireland)" }, + { value = "eu-west-2", label = "Europe (London)" }, + { value = "eu-west-3", label = "Europe (Paris)" }, + { value = "eu-central-1", label = "Europe (Frankfurt)" }, + { value = "eu-north-1", label = "Europe (Stockholm)" }, + { value = "ap-northeast-1", label = "Asia Pacific (Tokyo)" }, + { value = "ap-northeast-2", label = "Asia Pacific (Seoul)" }, + { value = "ap-northeast-3", label = "Asia Pacific (Osaka)" }, + { value = "ap-southeast-1", label = "Asia Pacific (Singapore)" }, + { value = "ap-southeast-2", label = "Asia Pacific (Sydney)" }, + { value = "ap-south-1", label = "Asia Pacific (Mumbai)" }, + { value = "sa-east-1", label = "South America (São Paulo)" }, + { value = "ca-central-1", label = "Canada (Central)" }, ] +prompt = "AWS Region" +required = true +type = "select" [[elements]] -name = "aws_instance_type" -type = "select" -prompt = "EC2 Instance Type" -options = [ - { value = "t3.micro", label = "t3.micro - 2 vCPU, 1 GB RAM (Free tier)" }, - { value = "t3.small", label = "t3.small - 2 vCPU, 2 GB RAM" }, - { value = "t3.medium", label = "t3.medium - 2 vCPU, 4 GB RAM" }, - { value = "t3.large", label = "t3.large - 2 vCPU, 8 GB RAM" }, - { value = "t3.xlarge", label = "t3.xlarge - 4 vCPU, 16 GB RAM" }, - { value = "t3.2xlarge", label = "t3.2xlarge - 8 vCPU, 32 GB RAM" }, - { value = "m5.large", label = "m5.large - 2 vCPU, 8 GB RAM" }, - { value = "m5.xlarge", label = "m5.xlarge - 4 vCPU, 16 GB RAM" }, - { value = "m5.2xlarge", label = "m5.2xlarge - 8 vCPU, 32 GB RAM" }, - { value = "m5.4xlarge", label = "m5.4xlarge - 16 vCPU, 64 GB RAM" }, - { value = "c5.large", label = "c5.large - 2 vCPU, 4 GB RAM (compute optimized)" }, - { value = "c5.xlarge", label = "c5.xlarge - 4 vCPU, 8 GB RAM (compute optimized)" }, - { value = "r5.large", label = "r5.large - 2 vCPU, 16 GB RAM (memory optimized)" }, - { value = "r5.xlarge", label = "r5.xlarge - 4 vCPU, 32 GB RAM (memory optimized)" }, -] default = "t3.medium" -required = true help = "EC2 instance type (determines CPU, RAM, and pricing)" -nickel_path = [ - "provider", - "aws_instance_type", -] - -[[elements]] -name = "aws_ami" -type = "select" -prompt = "Amazon Machine Image (AMI)" +name = "aws_instance_type" +nickel_path = ["provider", "aws_instance_type"] options = [ - { value = "ami-ubuntu-24-04", label = "Ubuntu 24.04 LTS (Latest)" }, - { value = "ami-ubuntu-22-04", label = "Ubuntu 22.04 LTS" }, - { value = "ami-ubuntu-20-04", label = "Ubuntu 20.04 LTS" }, - { value = "ami-debian-12", label = "Debian 12 (Bookworm)" }, - { value = "ami-debian-11", label = "Debian 11 (Bullseye)" }, - { value = "ami-amazon-linux-2", label = "Amazon Linux 2" }, - { value = "ami-amazon-linux-2023", label = "Amazon Linux 2023" }, + { value = "t3.micro", label = "t3.micro - 2 vCPU, 1 GB RAM (Free tier)" }, + { value = "t3.small", label = "t3.small - 2 vCPU, 2 GB RAM" }, + { value = "t3.medium", label = "t3.medium - 2 vCPU, 4 GB RAM" }, + { value = "t3.large", label = "t3.large - 2 vCPU, 8 GB RAM" }, + { value = "t3.xlarge", label = "t3.xlarge - 4 vCPU, 16 GB RAM" }, + { value = "t3.2xlarge", label = "t3.2xlarge - 8 vCPU, 32 GB RAM" }, + { value = "m5.large", label = "m5.large - 2 vCPU, 8 GB RAM" }, + { value = "m5.xlarge", label = "m5.xlarge - 4 vCPU, 16 GB RAM" }, + { value = "m5.2xlarge", label = "m5.2xlarge - 8 vCPU, 32 GB RAM" }, + { value = "m5.4xlarge", label = "m5.4xlarge - 16 vCPU, 64 GB RAM" }, + { value = "c5.large", label = "c5.large - 2 vCPU, 4 GB RAM (compute optimized)" }, + { value = "c5.xlarge", label = "c5.xlarge - 4 vCPU, 8 GB RAM (compute optimized)" }, + { value = "r5.large", label = "r5.large - 2 vCPU, 16 GB RAM (memory optimized)" }, + { value = "r5.xlarge", label = "r5.xlarge - 4 vCPU, 32 GB RAM (memory optimized)" }, ] +prompt = "EC2 Instance Type" +required = true +type = "select" + +[[elements]] default = "ami-ubuntu-24-04" -required = true help = "Operating system image for EC2 instances" -nickel_path = [ - "provider", - "aws_ami", +name = "aws_ami" +nickel_path = ["provider", "aws_ami"] +options = [ + { value = "ami-ubuntu-24-04", label = "Ubuntu 24.04 LTS (Latest)" }, + { value = "ami-ubuntu-22-04", label = "Ubuntu 22.04 LTS" }, + { value = "ami-ubuntu-20-04", label = "Ubuntu 20.04 LTS" }, + { value = "ami-debian-12", label = "Debian 12 (Bookworm)" }, + { value = "ami-debian-11", label = "Debian 11 (Bullseye)" }, + { value = "ami-amazon-linux-2", label = "Amazon Linux 2" }, + { value = "ami-amazon-linux-2023", label = "Amazon Linux 2023" }, ] +prompt = "Amazon Machine Image (AMI)" +required = true +type = "select" [[elements]] -name = "aws_vpc_cidr" -type = "text" -prompt = "VPC CIDR Block" default = "10.0.0.0/16" -required = true help = "CIDR block for the VPC (e.g., 10.0.0.0/16)" -nickel_path = [ - "provider", - "aws_vpc_cidr", -] - -[[elements]] -name = "aws_subnet_cidr" -type = "text" -prompt = "Subnet CIDR Block" -default = "10.0.1.0/24" +name = "aws_vpc_cidr" +nickel_path = ["provider", "aws_vpc_cidr"] +prompt = "VPC CIDR Block" required = true -help = "CIDR block for the subnet (e.g., 10.0.1.0/24)" -nickel_path = [ - "provider", - "aws_subnet_cidr", -] +type = "text" [[elements]] -name = "aws_ssh_key_name" +default = "10.0.1.0/24" +help = "CIDR block for the subnet (e.g., 10.0.1.0/24)" +name = "aws_subnet_cidr" +nickel_path = ["provider", "aws_subnet_cidr"] +prompt = "Subnet CIDR Block" +required = true type = "text" + +[[elements]] +help = "Name of the EC2 SSH key pair for instance access" +name = "aws_ssh_key_name" +nickel_path = ["provider", "aws_ssh_key_name"] prompt = "SSH Key Pair Name" required = true -help = "Name of the EC2 SSH key pair for instance access" -nickel_path = [ - "provider", - "aws_ssh_key_name", -] +type = "text" diff --git a/crates/typedialog-prov-gen/templates/fragments/provider-azure-section.toml b/crates/typedialog-prov-gen/templates/fragments/provider-azure-section.toml index a949d6c..6bcdf76 100644 --- a/crates/typedialog-prov-gen/templates/fragments/provider-azure-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/provider-azure-section.toml @@ -1,305 +1,248 @@ name = "azure_provider_fragment" [[elements]] -name = "azure_header" -type = "section_header" -title = "☁️ Microsoft Azure Configuration" -border_top = true border_bottom = true +border_top = true +name = "azure_header" +title = "☁️ Microsoft Azure Configuration" +type = "section_header" [[elements]] +help = "Your Azure subscription ID (GUID format)" name = "azure_subscription_id" -type = "text" +nickel_path = ["provider", "azure_subscription_id"] prompt = "Azure Subscription ID" required = true -help = "Your Azure subscription ID (GUID format)" -nickel_path = [ - "provider", - "azure_subscription_id", -] +type = "text" [[elements]] +help = "Your Azure Active Directory tenant ID" name = "azure_tenant_id" -type = "text" +nickel_path = ["provider", "azure_tenant_id"] prompt = "Azure Tenant ID" required = true -help = "Your Azure Active Directory tenant ID" -nickel_path = [ - "provider", - "azure_tenant_id", -] +type = "text" [[elements]] +help = "Client ID of the service principal (app registration)" name = "azure_client_id" -type = "text" +nickel_path = ["provider", "azure_client_id"] prompt = "Service Principal Client ID" required = true -help = "Client ID of the service principal (app registration)" -nickel_path = [ - "provider", - "azure_client_id", -] +type = "text" [[elements]] +help = "Client secret for authentication (will be masked)" name = "azure_client_secret" -type = "password" +nickel_path = ["provider", "azure_client_secret"] prompt = "Service Principal Client Secret" required = true -help = "Client secret for authentication (will be masked)" -nickel_path = [ - "provider", - "azure_client_secret", -] +type = "password" [[elements]] -name = "azure_location" -type = "select" -prompt = "Azure Region" -options = [ - { value = "eastus", label = "East US - Virginia, USA" }, - { value = "eastus2", label = "East US 2 - Virginia, USA" }, - { value = "westus", label = "West US - California, USA" }, - { value = "westus2", label = "West US 2 - Washington, USA" }, - { value = "westus3", label = "West US 3 - Arizona, USA" }, - { value = "centralus", label = "Central US - Iowa, USA" }, - { value = "northcentralus", label = "North Central US - Illinois, USA" }, - { value = "southcentralus", label = "South Central US - Texas, USA" }, - { value = "northeurope", label = "North Europe - Ireland" }, - { value = "westeurope", label = "West Europe - Netherlands" }, - { value = "francecentral", label = "France Central - Paris" }, - { value = "germanywestcentral", label = "Germany West Central - Frankfurt" }, - { value = "switzerlandnorth", label = "Switzerland North - Zurich" }, - { value = "uksouth", label = "UK South - London" }, - { value = "ukwest", label = "UK West - Cardiff" }, - { value = "norwayeast", label = "Norway East - Oslo" }, - { value = "swedencentral", label = "Sweden Central - Gävle" }, - { value = "eastasia", label = "East Asia - Hong Kong" }, - { value = "southeastasia", label = "Southeast Asia - Singapore" }, - { value = "japaneast", label = "Japan East - Tokyo" }, - { value = "japanwest", label = "Japan West - Osaka" }, - { value = "koreacentral", label = "Korea Central - Seoul" }, - { value = "australiaeast", label = "Australia East - Sydney" }, - { value = "australiasoutheast", label = "Australia Southeast - Melbourne" }, - { value = "canadacentral", label = "Canada Central - Toronto" }, - { value = "canadaeast", label = "Canada East - Quebec" }, - { value = "brazilsouth", label = "Brazil South - São Paulo" }, - { value = "southafricanorth", label = "South Africa North - Johannesburg" }, - { value = "uaenorth", label = "UAE North - Dubai" }, - { value = "centralindia", label = "Central India - Pune" }, - { value = "southindia", label = "South India - Chennai" }, -] default = "westeurope" -required = true help = "Azure region where resources will be deployed" -nickel_path = [ - "provider", - "azure_location", +name = "azure_location" +nickel_path = ["provider", "azure_location"] +options = [ + { value = "eastus", label = "East US - Virginia, USA" }, + { value = "eastus2", label = "East US 2 - Virginia, USA" }, + { value = "westus", label = "West US - California, USA" }, + { value = "westus2", label = "West US 2 - Washington, USA" }, + { value = "westus3", label = "West US 3 - Arizona, USA" }, + { value = "centralus", label = "Central US - Iowa, USA" }, + { value = "northcentralus", label = "North Central US - Illinois, USA" }, + { value = "southcentralus", label = "South Central US - Texas, USA" }, + { value = "northeurope", label = "North Europe - Ireland" }, + { value = "westeurope", label = "West Europe - Netherlands" }, + { value = "francecentral", label = "France Central - Paris" }, + { value = "germanywestcentral", label = "Germany West Central - Frankfurt" }, + { value = "switzerlandnorth", label = "Switzerland North - Zurich" }, + { value = "uksouth", label = "UK South - London" }, + { value = "ukwest", label = "UK West - Cardiff" }, + { value = "norwayeast", label = "Norway East - Oslo" }, + { value = "swedencentral", label = "Sweden Central - Gävle" }, + { value = "eastasia", label = "East Asia - Hong Kong" }, + { value = "southeastasia", label = "Southeast Asia - Singapore" }, + { value = "japaneast", label = "Japan East - Tokyo" }, + { value = "japanwest", label = "Japan West - Osaka" }, + { value = "koreacentral", label = "Korea Central - Seoul" }, + { value = "australiaeast", label = "Australia East - Sydney" }, + { value = "australiasoutheast", label = "Australia Southeast - Melbourne" }, + { value = "canadacentral", label = "Canada Central - Toronto" }, + { value = "canadaeast", label = "Canada East - Quebec" }, + { value = "brazilsouth", label = "Brazil South - São Paulo" }, + { value = "southafricanorth", label = "South Africa North - Johannesburg" }, + { value = "uaenorth", label = "UAE North - Dubai" }, + { value = "centralindia", label = "Central India - Pune" }, + { value = "southindia", label = "South India - Chennai" }, ] +prompt = "Azure Region" +required = true +type = "select" [[elements]] +help = "Name of the Azure Resource Group (will be created if doesn't exist)" name = "azure_resource_group_name" -type = "text" +nickel_path = ["provider", "azure_resource_group_name"] prompt = "Resource Group name" required = true -help = "Name of the Azure Resource Group (will be created if doesn't exist)" -nickel_path = [ - "provider", - "azure_resource_group_name", -] +type = "text" [[elements]] -name = "azure_vm_size" -type = "select" -prompt = "Virtual Machine Size" -options = [ - { value = "Standard_B1s", label = "Standard_B1s - 1 vCPU, 1 GB RAM (burstable)" }, - { value = "Standard_B1ms", label = "Standard_B1ms - 1 vCPU, 2 GB RAM (burstable)" }, - { value = "Standard_B2s", label = "Standard_B2s - 2 vCPU, 4 GB RAM (burstable)" }, - { value = "Standard_B2ms", label = "Standard_B2ms - 2 vCPU, 8 GB RAM (burstable)" }, - { value = "Standard_B4ms", label = "Standard_B4ms - 4 vCPU, 16 GB RAM (burstable)" }, - { value = "Standard_D2s_v3", label = "Standard_D2s_v3 - 2 vCPU, 8 GB RAM (general purpose)" }, - { value = "Standard_D4s_v3", label = "Standard_D4s_v3 - 4 vCPU, 16 GB RAM (general purpose)" }, - { value = "Standard_D8s_v3", label = "Standard_D8s_v3 - 8 vCPU, 32 GB RAM (general purpose)" }, - { value = "Standard_E2s_v3", label = "Standard_E2s_v3 - 2 vCPU, 16 GB RAM (memory optimized)" }, - { value = "Standard_E4s_v3", label = "Standard_E4s_v3 - 4 vCPU, 32 GB RAM (memory optimized)" }, - { value = "Standard_F2s_v2", label = "Standard_F2s_v2 - 2 vCPU, 4 GB RAM (compute optimized)" }, - { value = "Standard_F4s_v2", label = "Standard_F4s_v2 - 4 vCPU, 8 GB RAM (compute optimized)" }, -] default = "Standard_B2s" -required = true help = "Azure VM size (determines CPU, RAM, and pricing)" -nickel_path = [ - "provider", - "azure_vm_size", +name = "azure_vm_size" +nickel_path = ["provider", "azure_vm_size"] +options = [ + { value = "Standard_B1s", label = "Standard_B1s - 1 vCPU, 1 GB RAM (burstable)" }, + { value = "Standard_B1ms", label = "Standard_B1ms - 1 vCPU, 2 GB RAM (burstable)" }, + { value = "Standard_B2s", label = "Standard_B2s - 2 vCPU, 4 GB RAM (burstable)" }, + { value = "Standard_B2ms", label = "Standard_B2ms - 2 vCPU, 8 GB RAM (burstable)" }, + { value = "Standard_B4ms", label = "Standard_B4ms - 4 vCPU, 16 GB RAM (burstable)" }, + { value = "Standard_D2s_v3", label = "Standard_D2s_v3 - 2 vCPU, 8 GB RAM (general purpose)" }, + { value = "Standard_D4s_v3", label = "Standard_D4s_v3 - 4 vCPU, 16 GB RAM (general purpose)" }, + { value = "Standard_D8s_v3", label = "Standard_D8s_v3 - 8 vCPU, 32 GB RAM (general purpose)" }, + { value = "Standard_E2s_v3", label = "Standard_E2s_v3 - 2 vCPU, 16 GB RAM (memory optimized)" }, + { value = "Standard_E4s_v3", label = "Standard_E4s_v3 - 4 vCPU, 32 GB RAM (memory optimized)" }, + { value = "Standard_F2s_v2", label = "Standard_F2s_v2 - 2 vCPU, 4 GB RAM (compute optimized)" }, + { value = "Standard_F4s_v2", label = "Standard_F4s_v2 - 4 vCPU, 8 GB RAM (compute optimized)" }, ] +prompt = "Virtual Machine Size" +required = true +type = "select" [[elements]] -name = "azure_image_publisher" -type = "select" -prompt = "Image Publisher" -options = [ - { value = "Canonical", label = "Canonical (Ubuntu)" }, - { value = "Debian", label = "Debian (Debian Linux)" }, - { value = "RedHat", label = "Red Hat (RHEL)" }, - { value = "OpenLogic", label = "OpenLogic (CentOS)" }, - { value = "AlmaLinux", label = "AlmaLinux Foundation" }, - { value = "MicrosoftWindowsServer", label = "Microsoft (Windows Server)" }, -] default = "Canonical" -required = true help = "Publisher of the VM image" -nickel_path = [ - "provider", - "azure_image_publisher", +name = "azure_image_publisher" +nickel_path = ["provider", "azure_image_publisher"] +options = [ + { value = "Canonical", label = "Canonical (Ubuntu)" }, + { value = "Debian", label = "Debian (Debian Linux)" }, + { value = "RedHat", label = "Red Hat (RHEL)" }, + { value = "OpenLogic", label = "OpenLogic (CentOS)" }, + { value = "AlmaLinux", label = "AlmaLinux Foundation" }, + { value = "MicrosoftWindowsServer", label = "Microsoft (Windows Server)" }, ] +prompt = "Image Publisher" +required = true +type = "select" [[elements]] -name = "azure_image_offer" -type = "select" -prompt = "Image Offer" -options = [ - { value = "0001-com-ubuntu-server-jammy", label = "Ubuntu Server 22.04 LTS" }, - { value = "0001-com-ubuntu-server-focal", label = "Ubuntu Server 20.04 LTS" }, - { value = "debian-11", label = "Debian 11" }, - { value = "debian-12", label = "Debian 12" }, - { value = "RHEL", label = "Red Hat Enterprise Linux" }, - { value = "CentOS", label = "CentOS" }, - { value = "almalinux", label = "AlmaLinux" }, -] default = "0001-com-ubuntu-server-jammy" -required = true help = "Specific offer from the publisher (must match publisher)" -nickel_path = [ - "provider", - "azure_image_offer", +name = "azure_image_offer" +nickel_path = ["provider", "azure_image_offer"] +options = [ + { value = "0001-com-ubuntu-server-jammy", label = "Ubuntu Server 22.04 LTS" }, + { value = "0001-com-ubuntu-server-focal", label = "Ubuntu Server 20.04 LTS" }, + { value = "debian-11", label = "Debian 11" }, + { value = "debian-12", label = "Debian 12" }, + { value = "RHEL", label = "Red Hat Enterprise Linux" }, + { value = "CentOS", label = "CentOS" }, + { value = "almalinux", label = "AlmaLinux" }, ] +prompt = "Image Offer" +required = true +type = "select" [[elements]] -name = "azure_image_sku" -type = "select" -prompt = "Image SKU" -options = [ - { value = "22_04-lts-gen2", label = "Ubuntu 22.04 LTS Gen2" }, - { value = "20_04-lts-gen2", label = "Ubuntu 20.04 LTS Gen2" }, - { value = "11-gen2", label = "Debian 11 Gen2" }, - { value = "12-gen2", label = "Debian 12 Gen2" }, - { value = "9-lvm-gen2", label = "RHEL 9 Gen2" }, - { value = "8-lvm-gen2", label = "RHEL 8 Gen2" }, -] default = "22_04-lts-gen2" -required = true help = "SKU (version) of the image (must match offer)" -nickel_path = [ - "provider", - "azure_image_sku", -] - -[[elements]] -name = "azure_os_disk_size_gb" -type = "text" -prompt = "OS Disk size (GB)" -default = "30" -required = true -help = "Size of the OS disk in GB (minimum 30 GB)" -nickel_path = [ - "provider", - "azure_os_disk_size_gb", -] - -[[elements]] -name = "azure_os_disk_type" -type = "select" -prompt = "OS Disk type" +name = "azure_image_sku" +nickel_path = ["provider", "azure_image_sku"] options = [ - { value = "Standard_LRS", label = "Standard_LRS - Standard HDD (locally redundant)" }, - { value = "StandardSSD_LRS", label = "StandardSSD_LRS - Standard SSD (locally redundant)" }, - { value = "Premium_LRS", label = "Premium_LRS - Premium SSD (locally redundant)" }, - { value = "UltraSSD_LRS", label = "UltraSSD_LRS - Ultra SSD (highest performance)" }, + { value = "22_04-lts-gen2", label = "Ubuntu 22.04 LTS Gen2" }, + { value = "20_04-lts-gen2", label = "Ubuntu 20.04 LTS Gen2" }, + { value = "11-gen2", label = "Debian 11 Gen2" }, + { value = "12-gen2", label = "Debian 12 Gen2" }, + { value = "9-lvm-gen2", label = "RHEL 9 Gen2" }, + { value = "8-lvm-gen2", label = "RHEL 8 Gen2" }, ] +prompt = "Image SKU" +required = true +type = "select" + +[[elements]] +default = "30" +help = "Size of the OS disk in GB (minimum 30 GB)" +name = "azure_os_disk_size_gb" +nickel_path = ["provider", "azure_os_disk_size_gb"] +prompt = "OS Disk size (GB)" +required = true +type = "text" + +[[elements]] default = "StandardSSD_LRS" -required = true help = "Type of managed disk for OS volume" -nickel_path = [ - "provider", - "azure_os_disk_type", +name = "azure_os_disk_type" +nickel_path = ["provider", "azure_os_disk_type"] +options = [ + { value = "Standard_LRS", label = "Standard_LRS - Standard HDD (locally redundant)" }, + { value = "StandardSSD_LRS", label = "StandardSSD_LRS - Standard SSD (locally redundant)" }, + { value = "Premium_LRS", label = "Premium_LRS - Premium SSD (locally redundant)" }, + { value = "UltraSSD_LRS", label = "UltraSSD_LRS - Ultra SSD (highest performance)" }, ] - -[[elements]] -name = "azure_admin_username" -type = "text" -prompt = "Admin username" -default = "azureuser" +prompt = "OS Disk type" required = true -help = "Administrator username for the VM" -nickel_path = [ - "provider", - "azure_admin_username", -] +type = "select" [[elements]] -name = "azure_ssh_public_key" +default = "azureuser" +help = "Administrator username for the VM" +name = "azure_admin_username" +nickel_path = ["provider", "azure_admin_username"] +prompt = "Admin username" +required = true type = "text" + +[[elements]] +help = "SSH public key for authentication (e.g., ~/.ssh/id_rsa.pub content)" +name = "azure_ssh_public_key" +nickel_path = ["provider", "azure_ssh_public_key"] prompt = "SSH public key" required = true -help = "SSH public key for authentication (e.g., ~/.ssh/id_rsa.pub content)" -nickel_path = [ - "provider", - "azure_ssh_public_key", -] +type = "text" [[elements]] -name = "azure_vnet_address_space" -type = "text" -prompt = "Virtual Network address space" default = "10.0.0.0/16" -required = true help = "Address space for the Virtual Network (CIDR notation)" -nickel_path = [ - "provider", - "azure_vnet_address_space", -] - -[[elements]] -name = "azure_subnet_address_prefix" -type = "text" -prompt = "Subnet address prefix" -default = "10.0.1.0/24" +name = "azure_vnet_address_space" +nickel_path = ["provider", "azure_vnet_address_space"] +prompt = "Virtual Network address space" required = true -help = "Address prefix for the subnet (CIDR notation)" -nickel_path = [ - "provider", - "azure_subnet_address_prefix", -] +type = "text" + +[[elements]] +default = "10.0.1.0/24" +help = "Address prefix for the subnet (CIDR notation)" +name = "azure_subnet_address_prefix" +nickel_path = ["provider", "azure_subnet_address_prefix"] +prompt = "Subnet address prefix" +required = true +type = "text" [[elements]] -name = "azure_enable_public_ip" -type = "confirm" -prompt = "Assign public IP address?" default = true help = "Assign a public IP to the VM for external access" -nickel_path = [ - "provider", - "azure_enable_public_ip", -] +name = "azure_enable_public_ip" +nickel_path = ["provider", "azure_enable_public_ip"] +prompt = "Assign public IP address?" +type = "confirm" [[elements]] -name = "azure_enable_accelerated_networking" -type = "confirm" -prompt = "Enable accelerated networking?" default = false help = "Enable SR-IOV for better network performance (requires compatible VM size)" -nickel_path = [ - "provider", - "azure_enable_accelerated_networking", -] +name = "azure_enable_accelerated_networking" +nickel_path = ["provider", "azure_enable_accelerated_networking"] +prompt = "Enable accelerated networking?" +type = "confirm" [[elements]] -name = "azure_enable_boot_diagnostics" -type = "confirm" -prompt = "Enable boot diagnostics?" default = true help = "Enable boot diagnostics for troubleshooting" -nickel_path = [ - "provider", - "azure_enable_boot_diagnostics", -] +name = "azure_enable_boot_diagnostics" +nickel_path = ["provider", "azure_enable_boot_diagnostics"] +prompt = "Enable boot diagnostics?" +type = "confirm" diff --git a/crates/typedialog-prov-gen/templates/fragments/provider-gcp-section.toml b/crates/typedialog-prov-gen/templates/fragments/provider-gcp-section.toml index 361c23a..691caa0 100644 --- a/crates/typedialog-prov-gen/templates/fragments/provider-gcp-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/provider-gcp-section.toml @@ -1,256 +1,211 @@ name = "gcp_provider_fragment" [[elements]] -name = "gcp_header" -type = "section_header" -title = "☁️ Google Cloud Platform (GCP) Configuration" -border_top = true border_bottom = true +border_top = true +name = "gcp_header" +title = "☁️ Google Cloud Platform (GCP) Configuration" +type = "section_header" [[elements]] +help = "Your Google Cloud Project ID (e.g., my-project-123456)" name = "gcp_project_id" -type = "text" +nickel_path = ["provider", "gcp_project_id"] prompt = "GCP Project ID" required = true -help = "Your Google Cloud Project ID (e.g., my-project-123456)" -nickel_path = [ - "provider", - "gcp_project_id", -] +type = "text" [[elements]] +help = "Path to service account JSON key file (e.g., ~/.gcp/credentials.json)" name = "gcp_credentials_file" -type = "text" +nickel_path = ["provider", "gcp_credentials_file"] prompt = "Service Account credentials file path" required = true -help = "Path to service account JSON key file (e.g., ~/.gcp/credentials.json)" -nickel_path = [ - "provider", - "gcp_credentials_file", -] +type = "text" [[elements]] -name = "gcp_region" -type = "select" -prompt = "GCP Region" -options = [ - { value = "us-central1", label = "US-CENTRAL1 - Iowa, USA" }, - { value = "us-east1", label = "US-EAST1 - South Carolina, USA" }, - { value = "us-east4", label = "US-EAST4 - Northern Virginia, USA" }, - { value = "us-west1", label = "US-WEST1 - Oregon, USA" }, - { value = "us-west2", label = "US-WEST2 - Los Angeles, USA" }, - { value = "us-west3", label = "US-WEST3 - Salt Lake City, USA" }, - { value = "us-west4", label = "US-WEST4 - Las Vegas, USA" }, - { value = "europe-west1", label = "EUROPE-WEST1 - Belgium" }, - { value = "europe-west2", label = "EUROPE-WEST2 - London, UK" }, - { value = "europe-west3", label = "EUROPE-WEST3 - Frankfurt, Germany" }, - { value = "europe-west4", label = "EUROPE-WEST4 - Netherlands" }, - { value = "europe-west6", label = "EUROPE-WEST6 - Zurich, Switzerland" }, - { value = "europe-north1", label = "EUROPE-NORTH1 - Finland" }, - { value = "asia-east1", label = "ASIA-EAST1 - Taiwan" }, - { value = "asia-east2", label = "ASIA-EAST2 - Hong Kong" }, - { value = "asia-northeast1", label = "ASIA-NORTHEAST1 - Tokyo, Japan" }, - { value = "asia-northeast2", label = "ASIA-NORTHEAST2 - Osaka, Japan" }, - { value = "asia-northeast3", label = "ASIA-NORTHEAST3 - Seoul, South Korea" }, - { value = "asia-south1", label = "ASIA-SOUTH1 - Mumbai, India" }, - { value = "asia-southeast1", label = "ASIA-SOUTHEAST1 - Singapore" }, - { value = "asia-southeast2", label = "ASIA-SOUTHEAST2 - Jakarta, Indonesia" }, - { value = "australia-southeast1", label = "AUSTRALIA-SOUTHEAST1 - Sydney, Australia" }, - { value = "southamerica-east1", label = "SOUTHAMERICA-EAST1 - São Paulo, Brazil" }, -] default = "europe-west3" -required = true help = "GCP region where resources will be deployed" -nickel_path = [ - "provider", - "gcp_region", +name = "gcp_region" +nickel_path = ["provider", "gcp_region"] +options = [ + { value = "us-central1", label = "US-CENTRAL1 - Iowa, USA" }, + { value = "us-east1", label = "US-EAST1 - South Carolina, USA" }, + { value = "us-east4", label = "US-EAST4 - Northern Virginia, USA" }, + { value = "us-west1", label = "US-WEST1 - Oregon, USA" }, + { value = "us-west2", label = "US-WEST2 - Los Angeles, USA" }, + { value = "us-west3", label = "US-WEST3 - Salt Lake City, USA" }, + { value = "us-west4", label = "US-WEST4 - Las Vegas, USA" }, + { value = "europe-west1", label = "EUROPE-WEST1 - Belgium" }, + { value = "europe-west2", label = "EUROPE-WEST2 - London, UK" }, + { value = "europe-west3", label = "EUROPE-WEST3 - Frankfurt, Germany" }, + { value = "europe-west4", label = "EUROPE-WEST4 - Netherlands" }, + { value = "europe-west6", label = "EUROPE-WEST6 - Zurich, Switzerland" }, + { value = "europe-north1", label = "EUROPE-NORTH1 - Finland" }, + { value = "asia-east1", label = "ASIA-EAST1 - Taiwan" }, + { value = "asia-east2", label = "ASIA-EAST2 - Hong Kong" }, + { value = "asia-northeast1", label = "ASIA-NORTHEAST1 - Tokyo, Japan" }, + { value = "asia-northeast2", label = "ASIA-NORTHEAST2 - Osaka, Japan" }, + { value = "asia-northeast3", label = "ASIA-NORTHEAST3 - Seoul, South Korea" }, + { value = "asia-south1", label = "ASIA-SOUTH1 - Mumbai, India" }, + { value = "asia-southeast1", label = "ASIA-SOUTHEAST1 - Singapore" }, + { value = "asia-southeast2", label = "ASIA-SOUTHEAST2 - Jakarta, Indonesia" }, + { value = "australia-southeast1", label = "AUSTRALIA-SOUTHEAST1 - Sydney, Australia" }, + { value = "southamerica-east1", label = "SOUTHAMERICA-EAST1 - São Paulo, Brazil" }, ] +prompt = "GCP Region" +required = true +type = "select" [[elements]] -name = "gcp_zone" -type = "select" -prompt = "Availability Zone" -options = [ - { value = "a", label = "Zone A (primary)" }, - { value = "b", label = "Zone B" }, - { value = "c", label = "Zone C" }, - { value = "d", label = "Zone D (if available)" }, -] default = "a" -required = true help = "Zone within the selected region (e.g., 'a' for europe-west3-a)" -nickel_path = [ - "provider", - "gcp_zone", +name = "gcp_zone" +nickel_path = ["provider", "gcp_zone"] +options = [ + { value = "a", label = "Zone A (primary)" }, + { value = "b", label = "Zone B" }, + { value = "c", label = "Zone C" }, + { value = "d", label = "Zone D (if available)" }, ] +prompt = "Availability Zone" +required = true +type = "select" [[elements]] -name = "gcp_machine_type" -type = "select" -prompt = "Machine Type" -options = [ - { value = "e2-micro", label = "e2-micro - 2 vCPU (shared), 1 GB RAM (Free tier)" }, - { value = "e2-small", label = "e2-small - 2 vCPU (shared), 2 GB RAM" }, - { value = "e2-medium", label = "e2-medium - 2 vCPU (shared), 4 GB RAM" }, - { value = "e2-standard-2", label = "e2-standard-2 - 2 vCPU, 8 GB RAM" }, - { value = "e2-standard-4", label = "e2-standard-4 - 4 vCPU, 16 GB RAM" }, - { value = "e2-standard-8", label = "e2-standard-8 - 8 vCPU, 32 GB RAM" }, - { value = "n1-standard-1", label = "n1-standard-1 - 1 vCPU, 3.75 GB RAM" }, - { value = "n1-standard-2", label = "n1-standard-2 - 2 vCPU, 7.5 GB RAM" }, - { value = "n1-standard-4", label = "n1-standard-4 - 4 vCPU, 15 GB RAM" }, - { value = "n2-standard-2", label = "n2-standard-2 - 2 vCPU, 8 GB RAM (newer generation)" }, - { value = "n2-standard-4", label = "n2-standard-4 - 4 vCPU, 16 GB RAM (newer generation)" }, - { value = "n2-standard-8", label = "n2-standard-8 - 8 vCPU, 32 GB RAM (newer generation)" }, - { value = "n2-highmem-2", label = "n2-highmem-2 - 2 vCPU, 16 GB RAM (memory optimized)" }, - { value = "n2-highmem-4", label = "n2-highmem-4 - 4 vCPU, 32 GB RAM (memory optimized)" }, - { value = "c2-standard-4", label = "c2-standard-4 - 4 vCPU, 16 GB RAM (compute optimized)" }, - { value = "c2-standard-8", label = "c2-standard-8 - 8 vCPU, 32 GB RAM (compute optimized)" }, -] default = "e2-medium" -required = true help = "GCP Compute Engine machine type (determines CPU, RAM, and pricing)" -nickel_path = [ - "provider", - "gcp_machine_type", +name = "gcp_machine_type" +nickel_path = ["provider", "gcp_machine_type"] +options = [ + { value = "e2-micro", label = "e2-micro - 2 vCPU (shared), 1 GB RAM (Free tier)" }, + { value = "e2-small", label = "e2-small - 2 vCPU (shared), 2 GB RAM" }, + { value = "e2-medium", label = "e2-medium - 2 vCPU (shared), 4 GB RAM" }, + { value = "e2-standard-2", label = "e2-standard-2 - 2 vCPU, 8 GB RAM" }, + { value = "e2-standard-4", label = "e2-standard-4 - 4 vCPU, 16 GB RAM" }, + { value = "e2-standard-8", label = "e2-standard-8 - 8 vCPU, 32 GB RAM" }, + { value = "n1-standard-1", label = "n1-standard-1 - 1 vCPU, 3.75 GB RAM" }, + { value = "n1-standard-2", label = "n1-standard-2 - 2 vCPU, 7.5 GB RAM" }, + { value = "n1-standard-4", label = "n1-standard-4 - 4 vCPU, 15 GB RAM" }, + { value = "n2-standard-2", label = "n2-standard-2 - 2 vCPU, 8 GB RAM (newer generation)" }, + { value = "n2-standard-4", label = "n2-standard-4 - 4 vCPU, 16 GB RAM (newer generation)" }, + { value = "n2-standard-8", label = "n2-standard-8 - 8 vCPU, 32 GB RAM (newer generation)" }, + { value = "n2-highmem-2", label = "n2-highmem-2 - 2 vCPU, 16 GB RAM (memory optimized)" }, + { value = "n2-highmem-4", label = "n2-highmem-4 - 4 vCPU, 32 GB RAM (memory optimized)" }, + { value = "c2-standard-4", label = "c2-standard-4 - 4 vCPU, 16 GB RAM (compute optimized)" }, + { value = "c2-standard-8", label = "c2-standard-8 - 8 vCPU, 32 GB RAM (compute optimized)" }, ] +prompt = "Machine Type" +required = true +type = "select" [[elements]] -name = "gcp_image_family" -type = "select" -prompt = "Image Family" -options = [ - { value = "ubuntu-2404-lts", label = "Ubuntu 24.04 LTS (Latest)" }, - { value = "ubuntu-2204-lts", label = "Ubuntu 22.04 LTS" }, - { value = "ubuntu-2004-lts", label = "Ubuntu 20.04 LTS" }, - { value = "debian-12", label = "Debian 12 (Bookworm)" }, - { value = "debian-11", label = "Debian 11 (Bullseye)" }, - { value = "rocky-linux-9", label = "Rocky Linux 9" }, - { value = "rocky-linux-8", label = "Rocky Linux 8" }, - { value = "rhel-9", label = "Red Hat Enterprise Linux 9" }, - { value = "rhel-8", label = "Red Hat Enterprise Linux 8" }, - { value = "centos-stream-9", label = "CentOS Stream 9" }, -] default = "ubuntu-2404-lts" -required = true help = "Operating system image family for the instance" -nickel_path = [ - "provider", - "gcp_image_family", +name = "gcp_image_family" +nickel_path = ["provider", "gcp_image_family"] +options = [ + { value = "ubuntu-2404-lts", label = "Ubuntu 24.04 LTS (Latest)" }, + { value = "ubuntu-2204-lts", label = "Ubuntu 22.04 LTS" }, + { value = "ubuntu-2004-lts", label = "Ubuntu 20.04 LTS" }, + { value = "debian-12", label = "Debian 12 (Bookworm)" }, + { value = "debian-11", label = "Debian 11 (Bullseye)" }, + { value = "rocky-linux-9", label = "Rocky Linux 9" }, + { value = "rocky-linux-8", label = "Rocky Linux 8" }, + { value = "rhel-9", label = "Red Hat Enterprise Linux 9" }, + { value = "rhel-8", label = "Red Hat Enterprise Linux 8" }, + { value = "centos-stream-9", label = "CentOS Stream 9" }, ] +prompt = "Image Family" +required = true +type = "select" [[elements]] -name = "gcp_image_project" -type = "select" -prompt = "Image Project" -options = [ - { value = "ubuntu-os-cloud", label = "ubuntu-os-cloud (Ubuntu images)" }, - { value = "debian-cloud", label = "debian-cloud (Debian images)" }, - { value = "rocky-linux-cloud", label = "rocky-linux-cloud (Rocky Linux)" }, - { value = "rhel-cloud", label = "rhel-cloud (Red Hat)" }, - { value = "centos-cloud", label = "centos-cloud (CentOS)" }, -] default = "ubuntu-os-cloud" -required = true help = "GCP project that provides the image" -nickel_path = [ - "provider", - "gcp_image_project", -] - -[[elements]] -name = "gcp_disk_size_gb" -type = "text" -prompt = "Boot disk size (GB)" -default = "20" -required = true -help = "Boot disk size in GB (minimum 10 GB)" -nickel_path = [ - "provider", - "gcp_disk_size_gb", -] - -[[elements]] -name = "gcp_disk_type" -type = "select" -prompt = "Disk type" +name = "gcp_image_project" +nickel_path = ["provider", "gcp_image_project"] options = [ - { value = "pd-standard", label = "pd-standard - Standard persistent disk (HDD)" }, - { value = "pd-balanced", label = "pd-balanced - Balanced persistent disk (SSD, recommended)" }, - { value = "pd-ssd", label = "pd-ssd - SSD persistent disk (high performance)" }, - { value = "pd-extreme", label = "pd-extreme - Extreme persistent disk (highest IOPS)" }, + { value = "ubuntu-os-cloud", label = "ubuntu-os-cloud (Ubuntu images)" }, + { value = "debian-cloud", label = "debian-cloud (Debian images)" }, + { value = "rocky-linux-cloud", label = "rocky-linux-cloud (Rocky Linux)" }, + { value = "rhel-cloud", label = "rhel-cloud (Red Hat)" }, + { value = "centos-cloud", label = "centos-cloud (CentOS)" }, ] +prompt = "Image Project" +required = true +type = "select" + +[[elements]] +default = "20" +help = "Boot disk size in GB (minimum 10 GB)" +name = "gcp_disk_size_gb" +nickel_path = ["provider", "gcp_disk_size_gb"] +prompt = "Boot disk size (GB)" +required = true +type = "text" + +[[elements]] default = "pd-balanced" -required = true help = "Type of persistent disk for boot volume" -nickel_path = [ - "provider", - "gcp_disk_type", +name = "gcp_disk_type" +nickel_path = ["provider", "gcp_disk_type"] +options = [ + { value = "pd-standard", label = "pd-standard - Standard persistent disk (HDD)" }, + { value = "pd-balanced", label = "pd-balanced - Balanced persistent disk (SSD, recommended)" }, + { value = "pd-ssd", label = "pd-ssd - SSD persistent disk (high performance)" }, + { value = "pd-extreme", label = "pd-extreme - Extreme persistent disk (highest IOPS)" }, ] +prompt = "Disk type" +required = true +type = "select" [[elements]] -name = "gcp_network_name" -type = "text" -prompt = "VPC Network name" default = "default" -required = true help = "Name of the VPC network (use 'default' for default network)" -nickel_path = [ - "provider", - "gcp_network_name", -] - -[[elements]] -name = "gcp_subnetwork_name" -type = "text" -prompt = "Subnetwork name" -default = "default" +name = "gcp_network_name" +nickel_path = ["provider", "gcp_network_name"] +prompt = "VPC Network name" required = true -help = "Name of the subnetwork within the VPC" -nickel_path = [ - "provider", - "gcp_subnetwork_name", -] +type = "text" + +[[elements]] +default = "default" +help = "Name of the subnetwork within the VPC" +name = "gcp_subnetwork_name" +nickel_path = ["provider", "gcp_subnetwork_name"] +prompt = "Subnetwork name" +required = true +type = "text" [[elements]] -name = "gcp_enable_external_ip" -type = "confirm" -prompt = "Enable external IP address?" default = true help = "Assign a public IP address to the instance" -nickel_path = [ - "provider", - "gcp_enable_external_ip", -] +name = "gcp_enable_external_ip" +nickel_path = ["provider", "gcp_enable_external_ip"] +prompt = "Enable external IP address?" +type = "confirm" [[elements]] -name = "gcp_preemptible" -type = "confirm" -prompt = "Use preemptible instance?" default = false help = "Preemptible instances are cheaper but can be stopped by GCP (not for production)" -nickel_path = [ - "provider", - "gcp_preemptible", -] +name = "gcp_preemptible" +nickel_path = ["provider", "gcp_preemptible"] +prompt = "Use preemptible instance?" +type = "confirm" [[elements]] -name = "gcp_enable_deletion_protection" -type = "confirm" -prompt = "Enable deletion protection?" default = false help = "Prevent accidental deletion of the instance" -nickel_path = [ - "provider", - "gcp_enable_deletion_protection", -] +name = "gcp_enable_deletion_protection" +nickel_path = ["provider", "gcp_enable_deletion_protection"] +prompt = "Enable deletion protection?" +type = "confirm" [[elements]] +help = "SSH public key for instance access (leave empty to skip)" name = "gcp_ssh_keys" -type = "text" +nickel_path = ["provider", "gcp_ssh_keys"] prompt = "SSH public key (optional)" required = false -help = "SSH public key for instance access (leave empty to skip)" -nickel_path = [ - "provider", - "gcp_ssh_keys", -] +type = "text" diff --git a/crates/typedialog-prov-gen/templates/fragments/provider-hetzner-section.toml b/crates/typedialog-prov-gen/templates/fragments/provider-hetzner-section.toml index b800a13..85be2dc 100644 --- a/crates/typedialog-prov-gen/templates/fragments/provider-hetzner-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/provider-hetzner-section.toml @@ -1,89 +1,77 @@ name = "hetzner_provider_fragment" [[elements]] -name = "hetzner_header" -type = "section_header" -title = "☁️ Hetzner Cloud Configuration" -border_top = true border_bottom = true +border_top = true +name = "hetzner_header" +title = "☁️ Hetzner Cloud Configuration" +type = "section_header" [[elements]] +help = "Your Hetzner Cloud API token for authentication" name = "hetzner_api_token" -type = "password" +nickel_path = ["provider", "hetzner_api_token"] prompt = "Hetzner API token" required = true -help = "Your Hetzner Cloud API token for authentication" -nickel_path = [ - "provider", - "hetzner_api_token", -] +type = "password" [[elements]] -name = "hetzner_server_type" -type = "select" -prompt = "Server type" -options = [ - { value = "cx11", label = "CX11 - 1 vCPU, 1 GB RAM" }, - { value = "cx21", label = "CX21 - 2 vCPU, 4 GB RAM" }, - { value = "cx31", label = "CX31 - 2 vCPU, 8 GB RAM" }, - { value = "cx41", label = "CX41 - 4 vCPU, 16 GB RAM" }, - { value = "cx51", label = "CX51 - 8 vCPU, 32 GB RAM" }, - { value = "cpx11", label = "CPX11 - 2 vCPU (dedicated), 4 GB RAM" }, - { value = "cpx21", label = "CPX21 - 4 vCPU (dedicated), 8 GB RAM" }, - { value = "cpx31", label = "CPX31 - 8 vCPU (dedicated), 16 GB RAM" }, - { value = "cx22", label = "CX22 - 2 vCPU, 4 GB RAM" }, - { value = "cx32", label = "CX32 - 2 vCPU, 8 GB RAM" }, - { value = "cx42", label = "CX42 - 4 vCPU, 16 GB RAM" }, - { value = "cx52", label = "CX52 - 8 vCPU, 32 GB RAM" }, -] default = "cx22" -required = true help = "Hetzner Cloud server instance type" -nickel_path = [ - "provider", - "hetzner_server_type", +name = "hetzner_server_type" +nickel_path = ["provider", "hetzner_server_type"] +options = [ + { value = "cx11", label = "CX11 - 1 vCPU, 1 GB RAM" }, + { value = "cx21", label = "CX21 - 2 vCPU, 4 GB RAM" }, + { value = "cx31", label = "CX31 - 2 vCPU, 8 GB RAM" }, + { value = "cx41", label = "CX41 - 4 vCPU, 16 GB RAM" }, + { value = "cx51", label = "CX51 - 8 vCPU, 32 GB RAM" }, + { value = "cpx11", label = "CPX11 - 2 vCPU (dedicated), 4 GB RAM" }, + { value = "cpx21", label = "CPX21 - 4 vCPU (dedicated), 8 GB RAM" }, + { value = "cpx31", label = "CPX31 - 8 vCPU (dedicated), 16 GB RAM" }, + { value = "cx22", label = "CX22 - 2 vCPU, 4 GB RAM" }, + { value = "cx32", label = "CX32 - 2 vCPU, 8 GB RAM" }, + { value = "cx42", label = "CX42 - 4 vCPU, 16 GB RAM" }, + { value = "cx52", label = "CX52 - 8 vCPU, 32 GB RAM" }, ] +prompt = "Server type" +required = true +type = "select" [[elements]] -name = "hetzner_location" -type = "select" -prompt = "Datacenter location" -options = [ - { value = "fsn1", label = "FSN1 - Frankfurt, Germany" }, - { value = "fsn1-dc14", label = "FSN1-DC14 - Frankfurt 14, Germany" }, - { value = "nbg1", label = "NBG1 - Nuremberg, Germany" }, - { value = "nbg1-dc3", label = "NBG1-DC3 - Nuremberg 3, Germany" }, - { value = "hel1", label = "HEL1 - Helsinki, Finland" }, - { value = "hel1-dc8", label = "HEL1-DC8 - Helsinki 8, Finland" }, - { value = "ash", label = "ASH - Ashburn, Virginia USA" }, - { value = "ash-dc1", label = "ASH-DC1 - Ashburn 1, Virginia USA" }, - { value = "hil", label = "HIL - Hildesheim, Germany" }, - { value = "hil-dc1", label = "HIL-DC1 - Hildesheim 1, Germany" }, -] default = "nbg1" -required = true help = "Hetzner datacenter location" -nickel_path = [ - "provider", - "hetzner_location", +name = "hetzner_location" +nickel_path = ["provider", "hetzner_location"] +options = [ + { value = "fsn1", label = "FSN1 - Frankfurt, Germany" }, + { value = "fsn1-dc14", label = "FSN1-DC14 - Frankfurt 14, Germany" }, + { value = "nbg1", label = "NBG1 - Nuremberg, Germany" }, + { value = "nbg1-dc3", label = "NBG1-DC3 - Nuremberg 3, Germany" }, + { value = "hel1", label = "HEL1 - Helsinki, Finland" }, + { value = "hel1-dc8", label = "HEL1-DC8 - Helsinki 8, Finland" }, + { value = "ash", label = "ASH - Ashburn, Virginia USA" }, + { value = "ash-dc1", label = "ASH-DC1 - Ashburn 1, Virginia USA" }, + { value = "hil", label = "HIL - Hildesheim, Germany" }, + { value = "hil-dc1", label = "HIL-DC1 - Hildesheim 1, Germany" }, ] +prompt = "Datacenter location" +required = true +type = "select" [[elements]] -name = "hetzner_image" -type = "select" -prompt = "Operating system image" -options = [ - { value = "ubuntu-24.04", label = "Ubuntu 24.04 LTS (Latest)" }, - { value = "ubuntu-22.04", label = "Ubuntu 22.04 LTS" }, - { value = "ubuntu-20.04", label = "Ubuntu 20.04 LTS" }, - { value = "debian-12", label = "Debian 12 (Bookworm)" }, - { value = "debian-11", label = "Debian 11 (Bullseye)" }, - { value = "debian-10", label = "Debian 10 (Buster)" }, -] default = "ubuntu-24.04" -required = true help = "OS image to use for the server" -nickel_path = [ - "provider", - "hetzner_image", +name = "hetzner_image" +nickel_path = ["provider", "hetzner_image"] +options = [ + { value = "ubuntu-24.04", label = "Ubuntu 24.04 LTS (Latest)" }, + { value = "ubuntu-22.04", label = "Ubuntu 22.04 LTS" }, + { value = "ubuntu-20.04", label = "Ubuntu 20.04 LTS" }, + { value = "debian-12", label = "Debian 12 (Bookworm)" }, + { value = "debian-11", label = "Debian 11 (Bullseye)" }, + { value = "debian-10", label = "Debian 10 (Buster)" }, ] +prompt = "Operating system image" +required = true +type = "select" diff --git a/crates/typedialog-prov-gen/templates/fragments/provider-lxd-section.toml b/crates/typedialog-prov-gen/templates/fragments/provider-lxd-section.toml index ff31aa7..4d38f97 100644 --- a/crates/typedialog-prov-gen/templates/fragments/provider-lxd-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/provider-lxd-section.toml @@ -1,247 +1,193 @@ name = "lxd_provider_fragment" [[elements]] -name = "lxd_header" -type = "section_header" -title = "🖥️ LXD Container/VM Configuration" -border_top = true border_bottom = true +border_top = true +name = "lxd_header" +title = "🖥️ LXD Container/VM Configuration" +type = "section_header" [[elements]] -name = "lxd_remote" -type = "select" -prompt = "LXD Remote" -options = [ - { value = "local", label = "local - Local LXD server" }, - { value = "remote", label = "remote - Remote LXD server" }, -] default = "local" -required = true help = "Use local LXD or connect to remote LXD server" -nickel_path = [ - "provider", - "lxd_remote", +name = "lxd_remote" +nickel_path = ["provider", "lxd_remote"] +options = [ + { value = "local", label = "local - Local LXD server" }, + { value = "remote", label = "remote - Remote LXD server" }, ] +prompt = "LXD Remote" +required = true +type = "select" [[elements]] +help = "Address of remote LXD server (e.g., https://lxd.example.com:8443)" name = "lxd_remote_address" -type = "text" +nickel_path = ["provider", "lxd_remote_address"] prompt = "Remote server address (if remote)" required = false -help = "Address of remote LXD server (e.g., https://lxd.example.com:8443)" -nickel_path = [ - "provider", - "lxd_remote_address", -] +type = "text" [[elements]] +help = "Trust password for remote LXD server (will be masked)" name = "lxd_remote_password" -type = "password" +nickel_path = ["provider", "lxd_remote_password"] prompt = "Remote server password (if remote)" required = false -help = "Trust password for remote LXD server (will be masked)" -nickel_path = [ - "provider", - "lxd_remote_password", -] +type = "password" [[elements]] -name = "lxd_instance_type" -type = "select" -prompt = "Instance Type" -options = [ - { value = "container", label = "Container - Lightweight, shared kernel" }, - { value = "virtual-machine", label = "Virtual Machine - Full VM with own kernel" }, -] default = "container" -required = true help = "Run as container (fast, lightweight) or virtual machine (isolated)" -nickel_path = [ - "provider", - "lxd_instance_type", -] - -[[elements]] -name = "lxd_image" -type = "select" -prompt = "Base Image" +name = "lxd_instance_type" +nickel_path = ["provider", "lxd_instance_type"] options = [ - { value = "ubuntu:24.04", label = "Ubuntu 24.04 LTS (Noble)" }, - { value = "ubuntu:22.04", label = "Ubuntu 22.04 LTS (Jammy)" }, - { value = "ubuntu:20.04", label = "Ubuntu 20.04 LTS (Focal)" }, - { value = "debian:12", label = "Debian 12 (Bookworm)" }, - { value = "debian:11", label = "Debian 11 (Bullseye)" }, - { value = "alpine:3.19", label = "Alpine Linux 3.19 (minimal)" }, - { value = "alpine:3.18", label = "Alpine Linux 3.18" }, - { value = "rockylinux:9", label = "Rocky Linux 9" }, - { value = "rockylinux:8", label = "Rocky Linux 8" }, - { value = "archlinux", label = "Arch Linux (rolling release)" }, + { value = "container", label = "Container - Lightweight, shared kernel" }, + { value = "virtual-machine", label = "Virtual Machine - Full VM with own kernel" }, ] -default = "ubuntu:24.04" +prompt = "Instance Type" required = true -help = "Operating system image for the instance" -nickel_path = [ - "provider", - "lxd_image", -] +type = "select" [[elements]] +default = "ubuntu:24.04" +help = "Operating system image for the instance" +name = "lxd_image" +nickel_path = ["provider", "lxd_image"] +options = [ + { value = "ubuntu:24.04", label = "Ubuntu 24.04 LTS (Noble)" }, + { value = "ubuntu:22.04", label = "Ubuntu 22.04 LTS (Jammy)" }, + { value = "ubuntu:20.04", label = "Ubuntu 20.04 LTS (Focal)" }, + { value = "debian:12", label = "Debian 12 (Bookworm)" }, + { value = "debian:11", label = "Debian 11 (Bullseye)" }, + { value = "alpine:3.19", label = "Alpine Linux 3.19 (minimal)" }, + { value = "alpine:3.18", label = "Alpine Linux 3.18" }, + { value = "rockylinux:9", label = "Rocky Linux 9" }, + { value = "rockylinux:8", label = "Rocky Linux 8" }, + { value = "archlinux", label = "Arch Linux (rolling release)" }, +] +prompt = "Base Image" +required = true +type = "select" + +[[elements]] +help = "Unique name for the LXD instance" name = "lxd_instance_name" -type = "text" +nickel_path = ["provider", "lxd_instance_name"] prompt = "Instance name" required = true -help = "Unique name for the LXD instance" -nickel_path = [ - "provider", - "lxd_instance_name", -] +type = "text" [[elements]] -name = "lxd_cpu_limit" -type = "text" -prompt = "CPU limit (cores)" default = "2" -required = false help = "Number of CPU cores (e.g., 2 or leave empty for unlimited)" -nickel_path = [ - "provider", - "lxd_cpu_limit", -] +name = "lxd_cpu_limit" +nickel_path = ["provider", "lxd_cpu_limit"] +prompt = "CPU limit (cores)" +required = false +type = "text" [[elements]] -name = "lxd_memory_limit" -type = "text" -prompt = "Memory limit" default = "2GB" -required = false help = "Memory limit (e.g., 2GB, 4GB, or leave empty for unlimited)" -nickel_path = [ - "provider", - "lxd_memory_limit", -] - -[[elements]] -name = "lxd_disk_size" -type = "text" -prompt = "Root disk size" -default = "10GB" +name = "lxd_memory_limit" +nickel_path = ["provider", "lxd_memory_limit"] +prompt = "Memory limit" required = false -help = "Root disk size (e.g., 10GB, 20GB, or leave empty for default)" -nickel_path = [ - "provider", - "lxd_disk_size", -] - -[[elements]] -name = "lxd_storage_pool" -type = "select" -prompt = "Storage pool" -options = [ - { value = "default", label = "default - Default storage pool" }, - { value = "dir", label = "dir - Directory-backed pool" }, - { value = "zfs", label = "zfs - ZFS pool (best performance)" }, - { value = "btrfs", label = "btrfs - Btrfs pool" }, - { value = "lvm", label = "lvm - LVM pool" }, -] -default = "default" -required = true -help = "Storage pool for the instance root disk" -nickel_path = [ - "provider", - "lxd_storage_pool", -] - -[[elements]] -name = "lxd_network" -type = "select" -prompt = "Network" -options = [ - { value = "lxdbr0", label = "lxdbr0 - Default LXD bridge (NAT)" }, - { value = "host", label = "host - Direct host networking" }, - { value = "macvlan", label = "macvlan - MAC VLAN (bridge to physical)" }, -] -default = "lxdbr0" -required = true -help = "Network configuration for the instance" -nickel_path = [ - "provider", - "lxd_network", -] - -[[elements]] -name = "lxd_ipv4_address" type = "text" + +[[elements]] +default = "10GB" +help = "Root disk size (e.g., 10GB, 20GB, or leave empty for default)" +name = "lxd_disk_size" +nickel_path = ["provider", "lxd_disk_size"] +prompt = "Root disk size" +required = false +type = "text" + +[[elements]] +default = "default" +help = "Storage pool for the instance root disk" +name = "lxd_storage_pool" +nickel_path = ["provider", "lxd_storage_pool"] +options = [ + { value = "default", label = "default - Default storage pool" }, + { value = "dir", label = "dir - Directory-backed pool" }, + { value = "zfs", label = "zfs - ZFS pool (best performance)" }, + { value = "btrfs", label = "btrfs - Btrfs pool" }, + { value = "lvm", label = "lvm - LVM pool" }, +] +prompt = "Storage pool" +required = true +type = "select" + +[[elements]] +default = "lxdbr0" +help = "Network configuration for the instance" +name = "lxd_network" +nickel_path = ["provider", "lxd_network"] +options = [ + { value = "lxdbr0", label = "lxdbr0 - Default LXD bridge (NAT)" }, + { value = "host", label = "host - Direct host networking" }, + { value = "macvlan", label = "macvlan - MAC VLAN (bridge to physical)" }, +] +prompt = "Network" +required = true +type = "select" + +[[elements]] +help = "Assign static IPv4 (e.g., 10.0.0.100) or leave empty for DHCP" +name = "lxd_ipv4_address" +nickel_path = ["provider", "lxd_ipv4_address"] prompt = "Static IPv4 address (optional)" required = false -help = "Assign static IPv4 (e.g., 10.0.0.100) or leave empty for DHCP" -nickel_path = [ - "provider", - "lxd_ipv4_address", -] +type = "text" [[elements]] +help = "Assign static IPv6 or leave empty for auto" name = "lxd_ipv6_address" -type = "text" +nickel_path = ["provider", "lxd_ipv6_address"] prompt = "Static IPv6 address (optional)" required = false -help = "Assign static IPv6 or leave empty for auto" -nickel_path = [ - "provider", - "lxd_ipv6_address", -] - -[[elements]] -name = "lxd_profiles" type = "text" -prompt = "Additional profiles (comma-separated)" -default = "default" -required = false -help = "LXD profiles to apply (e.g., default,docker)" -nickel_path = [ - "provider", - "lxd_profiles", -] [[elements]] -name = "lxd_enable_nesting" -type = "confirm" -prompt = "Enable nesting (for Docker/LXD inside)?" +default = "default" +help = "LXD profiles to apply (e.g., default,docker)" +name = "lxd_profiles" +nickel_path = ["provider", "lxd_profiles"] +prompt = "Additional profiles (comma-separated)" +required = false +type = "text" + +[[elements]] default = false help = "Allow running containers/VMs inside this instance" -nickel_path = [ - "provider", - "lxd_enable_nesting", -] +name = "lxd_enable_nesting" +nickel_path = ["provider", "lxd_enable_nesting"] +prompt = "Enable nesting (for Docker/LXD inside)?" +type = "confirm" [[elements]] -name = "lxd_privileged" -type = "confirm" -prompt = "Run as privileged container?" default = false help = "Run container without user namespace isolation (less secure)" -nickel_path = [ - "provider", - "lxd_privileged", -] +name = "lxd_privileged" +nickel_path = ["provider", "lxd_privileged"] +prompt = "Run as privileged container?" +type = "confirm" [[elements]] -name = "lxd_autostart" -type = "confirm" -prompt = "Auto-start on boot?" default = true help = "Automatically start instance when LXD daemon starts" -nickel_path = [ - "provider", - "lxd_autostart", -] +name = "lxd_autostart" +nickel_path = ["provider", "lxd_autostart"] +prompt = "Auto-start on boot?" +type = "confirm" [[elements]] +help = "Path to cloud-init configuration file (leave empty to skip)" name = "lxd_cloud_init" -type = "text" +nickel_path = ["provider", "lxd_cloud_init"] prompt = "Cloud-init user data (optional)" required = false -help = "Path to cloud-init configuration file (leave empty to skip)" -nickel_path = [ - "provider", - "lxd_cloud_init", -] +type = "text" diff --git a/crates/typedialog-prov-gen/templates/fragments/provider-upcloud-section.toml b/crates/typedialog-prov-gen/templates/fragments/provider-upcloud-section.toml index 6d07bcf..5ba5a71 100644 --- a/crates/typedialog-prov-gen/templates/fragments/provider-upcloud-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/provider-upcloud-section.toml @@ -1,149 +1,122 @@ name = "upcloud_provider_fragment" [[elements]] -name = "upcloud_header" -type = "section_header" -title = "☁️ UpCloud Configuration" -border_top = true border_bottom = true +border_top = true +name = "upcloud_header" +title = "☁️ UpCloud Configuration" +type = "section_header" [[elements]] +help = "Your UpCloud account username for API authentication" name = "upcloud_username" -type = "text" +nickel_path = ["provider", "upcloud_username"] prompt = "UpCloud username" required = true -help = "Your UpCloud account username for API authentication" -nickel_path = [ - "provider", - "upcloud_username", -] +type = "text" [[elements]] +help = "Your UpCloud account password (will be masked)" name = "upcloud_password" -type = "password" +nickel_path = ["provider", "upcloud_password"] prompt = "UpCloud password" required = true -help = "Your UpCloud account password (will be masked)" -nickel_path = [ - "provider", - "upcloud_password", -] +type = "password" [[elements]] -name = "upcloud_zone" -type = "select" -prompt = "Availability zone" -options = [ - { value = "fi-hel1", label = "FI-HEL1 - Helsinki, Finland" }, - { value = "fi-hel2", label = "FI-HEL2 - Helsinki, Finland (Secondary)" }, - { value = "de-fra1", label = "DE-FRA1 - Frankfurt, Germany" }, - { value = "uk-lon1", label = "UK-LON1 - London, United Kingdom" }, - { value = "nl-ams1", label = "NL-AMS1 - Amsterdam, Netherlands" }, - { value = "us-chi1", label = "US-CHI1 - Chicago, USA" }, - { value = "us-nyc1", label = "US-NYC1 - New York, USA" }, - { value = "us-sjo1", label = "US-SJO1 - San Jose, USA" }, - { value = "sg-sin1", label = "SG-SIN1 - Singapore" }, - { value = "au-syd1", label = "AU-SYD1 - Sydney, Australia" }, - { value = "es-mad1", label = "ES-MAD1 - Madrid, Spain" }, - { value = "pl-waw1", label = "PL-WAW1 - Warsaw, Poland" }, -] default = "de-fra1" -required = true help = "UpCloud zone where resources will be deployed" -nickel_path = [ - "provider", - "upcloud_zone", +name = "upcloud_zone" +nickel_path = ["provider", "upcloud_zone"] +options = [ + { value = "fi-hel1", label = "FI-HEL1 - Helsinki, Finland" }, + { value = "fi-hel2", label = "FI-HEL2 - Helsinki, Finland (Secondary)" }, + { value = "de-fra1", label = "DE-FRA1 - Frankfurt, Germany" }, + { value = "uk-lon1", label = "UK-LON1 - London, United Kingdom" }, + { value = "nl-ams1", label = "NL-AMS1 - Amsterdam, Netherlands" }, + { value = "us-chi1", label = "US-CHI1 - Chicago, USA" }, + { value = "us-nyc1", label = "US-NYC1 - New York, USA" }, + { value = "us-sjo1", label = "US-SJO1 - San Jose, USA" }, + { value = "sg-sin1", label = "SG-SIN1 - Singapore" }, + { value = "au-syd1", label = "AU-SYD1 - Sydney, Australia" }, + { value = "es-mad1", label = "ES-MAD1 - Madrid, Spain" }, + { value = "pl-waw1", label = "PL-WAW1 - Warsaw, Poland" }, ] +prompt = "Availability zone" +required = true +type = "select" [[elements]] -name = "upcloud_plan" -type = "select" -prompt = "Server plan" -options = [ - { value = "1xCPU-1GB", label = "1xCPU-1GB - 1 vCPU, 1 GB RAM, 25 GB SSD" }, - { value = "1xCPU-2GB", label = "1xCPU-2GB - 1 vCPU, 2 GB RAM, 50 GB SSD" }, - { value = "2xCPU-4GB", label = "2xCPU-4GB - 2 vCPU, 4 GB RAM, 80 GB SSD" }, - { value = "4xCPU-8GB", label = "4xCPU-8GB - 4 vCPU, 8 GB RAM, 160 GB SSD" }, - { value = "6xCPU-16GB", label = "6xCPU-16GB - 6 vCPU, 16 GB RAM, 320 GB SSD" }, - { value = "8xCPU-32GB", label = "8xCPU-32GB - 8 vCPU, 32 GB RAM, 640 GB SSD" }, - { value = "12xCPU-48GB", label = "12xCPU-48GB - 12 vCPU, 48 GB RAM, 960 GB SSD" }, - { value = "16xCPU-64GB", label = "16xCPU-64GB - 16 vCPU, 64 GB RAM, 1280 GB SSD" }, - { value = "20xCPU-96GB", label = "20xCPU-96GB - 20 vCPU, 96 GB RAM, 1920 GB SSD" }, - { value = "20xCPU-128GB", label = "20xCPU-128GB - 20 vCPU, 128 GB RAM, 2048 GB SSD" }, -] default = "2xCPU-4GB" -required = true help = "UpCloud server plan (determines CPU, RAM, and storage)" -nickel_path = [ - "provider", - "upcloud_plan", -] - -[[elements]] -name = "upcloud_template" -type = "select" -prompt = "Operating system template" +name = "upcloud_plan" +nickel_path = ["provider", "upcloud_plan"] options = [ - { value = "Ubuntu Server 24.04 LTS (Noble Numbat)", label = "Ubuntu 24.04 LTS (Latest)" }, - { value = "Ubuntu Server 22.04 LTS (Jammy Jellyfish)", label = "Ubuntu 22.04 LTS" }, - { value = "Ubuntu Server 20.04 LTS (Focal Fossa)", label = "Ubuntu 20.04 LTS" }, - { value = "Debian 12 (Bookworm)", label = "Debian 12 (Bookworm)" }, - { value = "Debian 11 (Bullseye)", label = "Debian 11 (Bullseye)" }, - { value = "Debian 10 (Buster)", label = "Debian 10 (Buster)" }, - { value = "Rocky Linux 9", label = "Rocky Linux 9" }, - { value = "Rocky Linux 8", label = "Rocky Linux 8" }, - { value = "AlmaLinux 9", label = "AlmaLinux 9" }, - { value = "AlmaLinux 8", label = "AlmaLinux 8" }, + { value = "1xCPU-1GB", label = "1xCPU-1GB - 1 vCPU, 1 GB RAM, 25 GB SSD" }, + { value = "1xCPU-2GB", label = "1xCPU-2GB - 1 vCPU, 2 GB RAM, 50 GB SSD" }, + { value = "2xCPU-4GB", label = "2xCPU-4GB - 2 vCPU, 4 GB RAM, 80 GB SSD" }, + { value = "4xCPU-8GB", label = "4xCPU-8GB - 4 vCPU, 8 GB RAM, 160 GB SSD" }, + { value = "6xCPU-16GB", label = "6xCPU-16GB - 6 vCPU, 16 GB RAM, 320 GB SSD" }, + { value = "8xCPU-32GB", label = "8xCPU-32GB - 8 vCPU, 32 GB RAM, 640 GB SSD" }, + { value = "12xCPU-48GB", label = "12xCPU-48GB - 12 vCPU, 48 GB RAM, 960 GB SSD" }, + { value = "16xCPU-64GB", label = "16xCPU-64GB - 16 vCPU, 64 GB RAM, 1280 GB SSD" }, + { value = "20xCPU-96GB", label = "20xCPU-96GB - 20 vCPU, 96 GB RAM, 1920 GB SSD" }, + { value = "20xCPU-128GB", label = "20xCPU-128GB - 20 vCPU, 128 GB RAM, 2048 GB SSD" }, ] -default = "Ubuntu Server 24.04 LTS (Noble Numbat)" +prompt = "Server plan" required = true -help = "Operating system template for the server" -nickel_path = [ - "provider", - "upcloud_template", -] +type = "select" [[elements]] +default = "Ubuntu Server 24.04 LTS (Noble Numbat)" +help = "Operating system template for the server" +name = "upcloud_template" +nickel_path = ["provider", "upcloud_template"] +options = [ + { value = "Ubuntu Server 24.04 LTS (Noble Numbat)", label = "Ubuntu 24.04 LTS (Latest)" }, + { value = "Ubuntu Server 22.04 LTS (Jammy Jellyfish)", label = "Ubuntu 22.04 LTS" }, + { value = "Ubuntu Server 20.04 LTS (Focal Fossa)", label = "Ubuntu 20.04 LTS" }, + { value = "Debian 12 (Bookworm)", label = "Debian 12 (Bookworm)" }, + { value = "Debian 11 (Bullseye)", label = "Debian 11 (Bullseye)" }, + { value = "Debian 10 (Buster)", label = "Debian 10 (Buster)" }, + { value = "Rocky Linux 9", label = "Rocky Linux 9" }, + { value = "Rocky Linux 8", label = "Rocky Linux 8" }, + { value = "AlmaLinux 9", label = "AlmaLinux 9" }, + { value = "AlmaLinux 8", label = "AlmaLinux 8" }, +] +prompt = "Operating system template" +required = true +type = "select" + +[[elements]] +help = "Hostname for the UpCloud server" name = "upcloud_hostname" -type = "text" +nickel_path = ["provider", "upcloud_hostname"] prompt = "Server hostname" required = true -help = "Hostname for the UpCloud server" -nickel_path = [ - "provider", - "upcloud_hostname", -] - -[[elements]] -name = "upcloud_storage_size" type = "text" -prompt = "Storage size (GB)" -default = "25" -required = true -help = "Additional storage size in GB (beyond plan default)" -nickel_path = [ - "provider", - "upcloud_storage_size", -] [[elements]] -name = "upcloud_private_networking" -type = "confirm" -prompt = "Enable private networking?" +default = "25" +help = "Additional storage size in GB (beyond plan default)" +name = "upcloud_storage_size" +nickel_path = ["provider", "upcloud_storage_size"] +prompt = "Storage size (GB)" +required = true +type = "text" + +[[elements]] default = true help = "Enable UpCloud private networking (SDN) for this server" -nickel_path = [ - "provider", - "upcloud_private_networking", -] +name = "upcloud_private_networking" +nickel_path = ["provider", "upcloud_private_networking"] +prompt = "Enable private networking?" +type = "confirm" [[elements]] -name = "upcloud_backups" -type = "confirm" -prompt = "Enable automated backups?" default = false help = "Enable automated daily backups (additional cost)" -nickel_path = [ - "provider", - "upcloud_backups", -] +name = "upcloud_backups" +nickel_path = ["provider", "upcloud_backups"] +prompt = "Enable automated backups?" +type = "confirm" diff --git a/crates/typedialog-prov-gen/templates/fragments/ssh-section.toml b/crates/typedialog-prov-gen/templates/fragments/ssh-section.toml index ed9354d..eb701db 100644 --- a/crates/typedialog-prov-gen/templates/fragments/ssh-section.toml +++ b/crates/typedialog-prov-gen/templates/fragments/ssh-section.toml @@ -1,56 +1,44 @@ name = "ssh_fragment" [[elements]] -name = "ssh_header" -type = "section_header" -title = "🔐 SSH Credentials" -border_top = true border_bottom = true +border_top = true +name = "ssh_header" +title = "🔐 SSH Credentials" +type = "section_header" [[elements]] -name = "ssh_private_key_path" -type = "text" -prompt = "Private key path" -placeholder = "~/.ssh/id_rsa" -required = true help = "Absolute or relative path to SSH private key file" -nickel_path = [ - "ssh_credentials", - "private_key_path", -] - -[[elements]] -name = "ssh_public_key_path" -type = "text" -prompt = "Public key path" -placeholder = "~/.ssh/id_rsa.pub" +name = "ssh_private_key_path" +nickel_path = ["ssh_credentials", "private_key_path"] +placeholder = "~/.ssh/id_rsa" +prompt = "Private key path" required = true -help = "Absolute or relative path to SSH public key file" -nickel_path = [ - "ssh_credentials", - "public_key_path", -] +type = "text" [[elements]] -name = "ssh_username" +help = "Absolute or relative path to SSH public key file" +name = "ssh_public_key_path" +nickel_path = ["ssh_credentials", "public_key_path"] +placeholder = "~/.ssh/id_rsa.pub" +prompt = "Public key path" +required = true type = "text" -prompt = "SSH username" -placeholder = "torrust" + +[[elements]] default = "torrust" help = "Linux username for SSH access. Defaults to 'torrust'. Must be 1-32 characters, starting with letter or underscore." -nickel_path = [ - "ssh_credentials", - "username", -] +name = "ssh_username" +nickel_path = ["ssh_credentials", "username"] +placeholder = "torrust" +prompt = "SSH username" +type = "text" [[elements]] -name = "ssh_port" -type = "text" -prompt = "SSH port" -placeholder = "22" default = "22" help = "SSH port number (default 22). Must be between 1-65535." -nickel_path = [ - "ssh_credentials", - "port", -] +name = "ssh_port" +nickel_path = ["ssh_credentials", "port"] +placeholder = "22" +prompt = "SSH port" +type = "text" diff --git a/crates/typedialog-tui/Cargo.toml b/crates/typedialog-tui/Cargo.toml index c0c9e1f..8a66ba4 100644 --- a/crates/typedialog-tui/Cargo.toml +++ b/crates/typedialog-tui/Cargo.toml @@ -1,30 +1,30 @@ [package] -name = "typedialog-tui" -version.workspace = true authors.workspace = true -edition.workspace = true -repository.workspace = true -license.workspace = true description = "TypeDialog TUI tool for interactive forms using ratatui" +edition.workspace = true +license.workspace = true +name = "typedialog-tui" +repository.workspace = true +version.workspace = true [[bin]] name = "typedialog-tui" path = "src/main.rs" -[package.metadata.binstall] -pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" -bin-dir = "bin/{ bin }" -pkg-fmt = "tgz" + [package.metadata.binstall] + bin-dir = "bin/{ bin }" + pkg-fmt = "tgz" + pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" [dependencies] -typedialog-core = { path = "../typedialog-core", features = ["tui", "i18n", "encryption"] } -clap = { workspace = true } anyhow = { workspace = true } -tokio = { workspace = true, features = ["rt-multi-thread"] } +clap = { workspace = true } serde_json = { workspace = true } +tokio = { workspace = true, features = ["rt-multi-thread"] } toml = { workspace = true } -unic-langid = { workspace = true } tracing-subscriber = { workspace = true } +typedialog-core = { path = "../typedialog-core", features = ["tui", "i18n", "encryption"] } +unic-langid = { workspace = true } [lints] workspace = true diff --git a/crates/typedialog-web/Cargo.toml b/crates/typedialog-web/Cargo.toml index 1cccc88..9b0f3f2 100644 --- a/crates/typedialog-web/Cargo.toml +++ b/crates/typedialog-web/Cargo.toml @@ -1,30 +1,30 @@ [package] -name = "typedialog-web" -version.workspace = true authors.workspace = true -edition.workspace = true -repository.workspace = true -license.workspace = true description = "TypeDialog Web server for interactive forms using axum" +edition.workspace = true +license.workspace = true +name = "typedialog-web" +repository.workspace = true +version.workspace = true [[bin]] name = "typedialog-web" path = "src/main.rs" -[package.metadata.binstall] -pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" -bin-dir = "bin/{ bin }" -pkg-fmt = "tgz" + [package.metadata.binstall] + bin-dir = "bin/{ bin }" + pkg-fmt = "tgz" + pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" [dependencies] -typedialog-core = { path = "../typedialog-core", features = ["web", "i18n", "encryption"] } -clap = { workspace = true } anyhow = { workspace = true } -tokio = { workspace = true, features = ["rt-multi-thread"] } +clap = { workspace = true } serde_json = { workspace = true } +tokio = { workspace = true, features = ["rt-multi-thread"] } toml = { workspace = true } -unic-langid = { workspace = true } tracing-subscriber = { workspace = true } +typedialog-core = { path = "../typedialog-core", features = ["web", "i18n", "encryption"] } +unic-langid = { workspace = true } [lints] workspace = true diff --git a/crates/typedialog/Cargo.toml b/crates/typedialog/Cargo.toml index 606142c..6601415 100644 --- a/crates/typedialog/Cargo.toml +++ b/crates/typedialog/Cargo.toml @@ -1,30 +1,30 @@ [package] -name = "typedialog" -version.workspace = true authors.workspace = true -edition.workspace = true -repository.workspace = true -license.workspace = true description = "TypeDialog CLI tool for interactive forms and prompts" +edition.workspace = true +license.workspace = true +name = "typedialog" +repository.workspace = true +version.workspace = true [[bin]] name = "typedialog" path = "src/main.rs" -[package.metadata.binstall] -pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" -bin-dir = "bin/{ bin }" -pkg-fmt = "tgz" + [package.metadata.binstall] + bin-dir = "bin/{ bin }" + pkg-fmt = "tgz" + pkg-url = "{ repo }/releases/download/v{ version }/typedialog-{ target }.tar.gz" [dependencies] -typedialog-core = { path = "../typedialog-core", features = ["cli", "i18n", "encryption"] } -clap = { workspace = true } anyhow = { workspace = true } -tokio = { workspace = true, features = ["rt-multi-thread"] } +clap = { workspace = true } serde_json = { workspace = true } +tokio = { workspace = true, features = ["rt-multi-thread"] } toml = { workspace = true } -unic-langid = { workspace = true } tracing-subscriber = { workspace = true } +typedialog-core = { path = "../typedialog-core", features = ["cli", "i18n", "encryption"] } +unic-langid = { workspace = true } [lints] workspace = true diff --git a/deny.toml b/deny.toml index 4982c71..773ea9d 100644 --- a/deny.toml +++ b/deny.toml @@ -23,13 +23,13 @@ # dependencies not shared by any other crates, would be ignored, as the target # list here is effectively saying which targets you are building for. targets = [ - # The triple can be any string, but only the target triples built in to - # rustc (as of 1.40) can be checked against actual config expressions - #"x86_64-unknown-linux-musl", - # You can also specify which target_features you promise are enabled for a - # particular target. target_features are currently not validated against - # the actual valid features supported by the target architecture. - #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, + # The triple can be any string, but only the target triples built in to + # rustc (as of 1.40) can be checked against actual config expressions + #"x86_64-unknown-linux-musl", + # You can also specify which target_features you promise are enabled for a + # particular target. target_features are currently not validated against + # the actual valid features supported by the target architecture. + #{ triple = "wasm32-unknown-unknown", features = ["atomics"] }, ] # When creating the dependency graph used as the source of truth when checks are # executed, this field can be used to prune crates from the graph, removing them @@ -70,10 +70,10 @@ feature-depth = 1 # A list of advisory IDs to ignore. Note that ignored advisories will still # output a note when they are encountered. ignore = [ - #"RUSTSEC-0000-0000", - #{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" }, - #"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish - #{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" }, + #"RUSTSEC-0000-0000", + #{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" }, + #"a-crate-that-is-yanked@0.1.1", # you can also ignore yanked crate versions if you wish + #{ crate = "a-crate-that-is-yanked@0.1.1", reason = "you can specify why you are ignoring the yanked crate" }, ] # If this is true, then cargo deny will use the git executable to fetch advisory database. # If this is false, then it uses a built-in git library. @@ -89,22 +89,22 @@ ignore = [ # See https://spdx.org/licenses/ for list of possible licenses # [possible values: any SPDX 3.11 short identifier (+ optional exception)]. allow = [ - "MIT", - "Apache-2.0", - "Apache-2.0 WITH LLVM-exception", - "BSD-2-Clause", - "BSD-3-Clause", - "ISC", - "Unlicense", - "MPL-2.0", - "BSL-1.0", - "Zlib", - "0BSD", - "Unicode-3.0", - "LGPL-3.0-only", - "BUSL-1.1", - "CC0-1.0", - "CDLA-Permissive-2.0", + "MIT", + "Apache-2.0", + "Apache-2.0 WITH LLVM-exception", + "BSD-2-Clause", + "BSD-3-Clause", + "ISC", + "Unlicense", + "MPL-2.0", + "BSL-1.0", + "Zlib", + "0BSD", + "Unicode-3.0", + "LGPL-3.0-only", + "BUSL-1.1", + "CC0-1.0", + "CDLA-Permissive-2.0", ] # The confidence threshold for detecting a license from license text. # The higher the value, the more closely the license text must be to the @@ -114,9 +114,9 @@ confidence-threshold = 0.8 # Allow 1 or more licenses on a per-crate basis, so that particular licenses # aren't accepted for every possible crate as with the normal allow list exceptions = [ - # Each entry is the crate and version constraint, and its specific allow - # list - #{ allow = ["Zlib"], crate = "adler32" }, + # Each entry is the crate and version constraint, and its specific allow + # list + #{ allow = ["Zlib"], crate = "adler32" }, ] # Some crates don't have (easily) machine readable licensing information, @@ -137,18 +137,18 @@ exceptions = [ #{ path = "LICENSE", hash = 0xbd0eed23 } #] -[licenses.private] -# If true, ignores workspace crates that aren't published, or are only -# published to private registries. -# To see how to mark a crate as unpublished (to the official registry), -# visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field. -ignore = false -# One or more private registries that you might publish crates to, if a crate -# is only published to private registries, and ignore is true, the crate will -# not have its license(s) checked -registries = [ + [licenses.private] + # If true, ignores workspace crates that aren't published, or are only + # published to private registries. + # To see how to mark a crate as unpublished (to the official registry), + # visit https://doc.rust-lang.org/cargo/reference/manifest.html#the-publish-field. + ignore = false + # One or more private registries that you might publish crates to, if a crate + # is only published to private registries, and ignore is true, the crate will + # not have its license(s) checked + registries = [ #"https://sekretz.com/registry -] + ] # This section is considered when running `cargo deny check bans`. # More documentation about the 'bans' section can be found here: @@ -174,16 +174,16 @@ workspace-default-features = "allow" external-default-features = "allow" # List of crates that are allowed. Use with care! allow = [ - #"ansi_term@0.11.0", - #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is allowed" }, + #"ansi_term@0.11.0", + #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is allowed" }, ] # List of crates to deny deny = [ - #"ansi_term@0.11.0", - #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is banned" }, - # Wrapper crates can optionally be specified to allow the crate when it - # is a direct dependency of the otherwise banned crate - #{ crate = "ansi_term@0.11.0", wrappers = ["this-crate-directly-depends-on-ansi_term"] }, + #"ansi_term@0.11.0", + #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason it is banned" }, + # Wrapper crates can optionally be specified to allow the crate when it + # is a direct dependency of the otherwise banned crate + #{ crate = "ansi_term@0.11.0", wrappers = ["this-crate-directly-depends-on-ansi_term"] }, ] # List of features to allow/deny @@ -211,16 +211,16 @@ deny = [ # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ - #"ansi_term@0.11.0", - #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason why it can't be updated/removed" }, + #"ansi_term@0.11.0", + #{ crate = "ansi_term@0.11.0", reason = "you can specify a reason why it can't be updated/removed" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive # dependencies starting at the specified crate, up to a certain depth, which is # by default infinite. skip-tree = [ - #"ansi_term@0.11.0", # will be skipped along with _all_ of its direct and transitive dependencies - #{ crate = "ansi_term@0.11.0", depth = 20 }, + #"ansi_term@0.11.0", # will be skipped along with _all_ of its direct and transitive dependencies + #{ crate = "ansi_term@0.11.0", depth = 20 }, ] # This section is considered when running `cargo deny check sources`. @@ -239,10 +239,10 @@ allow-registry = ["https://github.com/rust-lang/crates.io-index"] # List of URLs for allowed Git repositories allow-git = [] -[sources.allow-org] -# github.com organizations to allow git sources for -github = [] -# gitlab.com organizations to allow git sources for -gitlab = [] -# bitbucket.org organizations to allow git sources for -bitbucket = [] + [sources.allow-org] + # github.com organizations to allow git sources for + github = [] + # gitlab.com organizations to allow git sources for + gitlab = [] + # bitbucket.org organizations to allow git sources for + bitbucket = [] diff --git a/examples/01-basic/base_from.toml b/examples/01-basic/base_from.toml index 86c022d..c37f0e1 100644 --- a/examples/01-basic/base_from.toml +++ b/examples/01-basic/base_from.toml @@ -1,57 +1,57 @@ -name = "Simple Contact Form" description = "A basic contact form with all field types" +name = "Simple Contact Form" [[elements]] name = "name" -type = "text" -prompt = "Your name" placeholder = "John Doe" +prompt = "Your name" required = true +type = "text" [[elements]] name = "email" -type = "text" -prompt = "Your email" placeholder = "john@example.com" +prompt = "Your email" required = true +type = "text" [[elements]] name = "subject" -type = "text" prompt = "Subject" required = true +type = "text" [[elements]] -name = "message" -type = "editor" -prompt = "Your message" file_extension = "txt" +name = "message" +prompt = "Your message" +type = "editor" [[elements]] name = "priority" -type = "select" -prompt = "Priority level" options = [ - { value = "Low", label = "Low Priority - Can wait" }, - { value = "Medium", label = "Medium Priority - Normal schedule" }, - { value = "High", label = "High Priority - Urgent attention" }, - { value = "Urgent", label = "Urgent - Critical issue" }, + { value = "Low", label = "Low Priority - Can wait" }, + { value = "Medium", label = "Medium Priority - Normal schedule" }, + { value = "High", label = "High Priority - Urgent attention" }, + { value = "Urgent", label = "Urgent - Critical issue" }, ] +prompt = "Priority level" required = true +type = "select" [[elements]] name = "category" -type = "multiselect" -prompt = "Message categories" options = [ - { value = "Bug Report", label = "🐛 Bug Report" }, - { value = "Feature Request", label = "✨ Feature Request" }, - { value = "Documentation", label = "📚 Documentation" }, - { value = "Other", label = "❓ Other" }, + { value = "Bug Report", label = "🐛 Bug Report" }, + { value = "Feature Request", label = "✨ Feature Request" }, + { value = "Documentation", label = "📚 Documentation" }, + { value = "Other", label = "❓ Other" }, ] +prompt = "Message categories" +type = "multiselect" [[elements]] -name = "newsletter" -type = "confirm" -prompt = "Subscribe to updates?" default = false +name = "newsletter" +prompt = "Subscribe to updates?" +type = "confirm" diff --git a/examples/01-basic/debug_simple.toml b/examples/01-basic/debug_simple.toml index ab853f1..a102c48 100644 --- a/examples/01-basic/debug_simple.toml +++ b/examples/01-basic/debug_simple.toml @@ -1,17 +1,17 @@ -name = "Simple Debug Form" description = "Two fields to test form execution flow" locale = "en-US" +name = "Simple Debug Form" [[elements]] name = "first_name" -type = "text" +order = 1 prompt = "First Name" required = true -order = 1 +type = "text" [[elements]] name = "last_name" -type = "text" +order = 2 prompt = "Last Name" required = true -order = 2 +type = "text" diff --git a/examples/01-basic/form.toml b/examples/01-basic/form.toml index 44a35b5..3343cc2 100644 --- a/examples/01-basic/form.toml +++ b/examples/01-basic/form.toml @@ -1,60 +1,60 @@ -name = "Simple Contact Form" description = "A basic contact form with all field types" +name = "Simple Contact Form" [[elements]] name = "name" -type = "text" -prompt = "Your name" placeholder = "John Doe" +prompt = "Your name" required = true +type = "text" [[elements]] name = "email" -type = "text" -prompt = "Your email" placeholder = "john@example.com" +prompt = "Your email" required = true +type = "text" [[elements]] name = "subject" -type = "text" prompt = "Subject" required = true +type = "text" [[elements]] -name = "message" -type = "editor" -prompt = "Your message" file_extension = "txt" +name = "message" +prompt = "Your message" +type = "editor" [[elements]] name = "priority" -type = "select" +options = [ + { value = "Low", label = "Low Priority - Can wait" }, + { value = "Medium", label = "Medium Priority - Normal schedule" }, + { value = "High", label = "High Priority - Urgent attention" }, + { value = "Urgent", label = "Urgent - Critical issue" }, +] prompt = "Priority level" -options = [ - { value = "Low", label = "Low Priority - Can wait" }, - { value = "Medium", label = "Medium Priority - Normal schedule" }, - { value = "High", label = "High Priority - Urgent attention" }, - { value = "Urgent", label = "Urgent - Critical issue" }, -] required = true +type = "select" [[elements]] -name = "category" -type = "multiselect" -prompt = "Message categories" -display_mode = "grid" -searchable = true default = "Bug Report" +display_mode = "grid" +name = "category" options = [ - { value = "Bug Report", label = "🐛 Bug Report" }, - { value = "Feature Request", label = "✨ Feature Request" }, - { value = "Documentation", label = "📚 Documentation" }, - { value = "Other", label = "❓ Other" }, + { value = "Bug Report", label = "🐛 Bug Report" }, + { value = "Feature Request", label = "✨ Feature Request" }, + { value = "Documentation", label = "📚 Documentation" }, + { value = "Other", label = "❓ Other" }, ] +prompt = "Message categories" +searchable = true +type = "multiselect" [[elements]] -name = "newsletter" -type = "confirm" -prompt = "Subscribe to updates?" default = "false" +name = "newsletter" +prompt = "Subscribe to updates?" +type = "confirm" diff --git a/examples/01-basic/form_with_grouped_items.toml b/examples/01-basic/form_with_grouped_items.toml index 859aaab..bdb78b1 100644 --- a/examples/01-basic/form_with_grouped_items.toml +++ b/examples/01-basic/form_with_grouped_items.toml @@ -1,155 +1,155 @@ -name = "Form with Grouped Display Items" description = "Demonstrates grouping related display items together" +name = "Form with Grouped Display Items" # Main header (no group - always shown) [[elements]] -name = "main_header" -type = "header" -title = "✨ Grouped Items Example" -border_top = true -border_bottom = true align = "center" +border_bottom = true +border_top = true +name = "main_header" +title = "✨ Grouped Items Example" +type = "header" # Account selection [[elements]] name = "account_type" -type = "select" -prompt = "Select account type" options = [ - { value = "Personal", label = "Personal - Individual Users" }, - { value = "Premium", label = "Premium - Growing Teams" }, - { value = "Enterprise", label = "Enterprise - Large Organizations" }, + { value = "Personal", label = "Personal - Individual Users" }, + { value = "Premium", label = "Premium - Growing Teams" }, + { value = "Enterprise", label = "Enterprise - Large Organizations" }, ] +prompt = "Select account type" required = true +type = "select" # PREMIUM GROUP - All these items are grouped together [[elements]] -name = "premium_header" -type = "section" -title = "🌟 Premium Features" -group = "premium" -when = "account_type == Premium" border_top = true +group = "premium" +name = "premium_header" +title = "🌟 Premium Features" +type = "section" +when = "account_type == Premium" [[elements]] -name = "premium_features" -type = "section" content = "✓ Unlimited storage\n✓ Advanced analytics\n✓ Priority support\n✓ Custom branding" group = "premium" +name = "premium_features" +type = "section" when = "account_type == Premium" [[elements]] -name = "premium_price" -type = "section" +border_bottom = true content = "Pricing: $29/month" group = "premium" +name = "premium_price" +type = "section" when = "account_type == Premium" -border_bottom = true [[elements]] name = "premium_payment" -type = "select" -prompt = "Payment method" options = [ - { value = "Credit Card", label = "💳 Credit Card" }, - { value = "Bank Transfer", label = "🏦 Bank Transfer" }, - { value = "PayPal", label = "🅿️ PayPal" }, + { value = "Credit Card", label = "💳 Credit Card" }, + { value = "Bank Transfer", label = "🏦 Bank Transfer" }, + { value = "PayPal", label = "🅿️ PayPal" }, ] -when = "account_type == Premium" +prompt = "Payment method" required = true +type = "select" +when = "account_type == Premium" # ENTERPRISE GROUP - All these items grouped together [[elements]] -name = "enterprise_header" -type = "section" -title = "🏛️ Enterprise Solution" -group = "enterprise" -when = "account_type == Enterprise" border_top = true +group = "enterprise" +name = "enterprise_header" +title = "🏛️ Enterprise Solution" +type = "section" +when = "account_type == Enterprise" [[elements]] -name = "enterprise_features" -type = "section" content = "✓ Unlimited everything\n✓ Dedicated support\n✓ Custom integration\n✓ SLA guarantee\n✓ On-premise option" group = "enterprise" +name = "enterprise_features" +type = "section" when = "account_type == Enterprise" [[elements]] -name = "enterprise_note" -type = "section" content = "⚠️ Requires enterprise agreement" group = "enterprise" +name = "enterprise_note" +type = "section" when = "account_type == Enterprise" [[elements]] -name = "enterprise_contact_info" -type = "section" +border_bottom = true content = "Contact our sales team for pricing" group = "enterprise" +name = "enterprise_contact_info" +type = "section" when = "account_type == Enterprise" -border_bottom = true [[elements]] name = "enterprise_contact_email" -type = "text" prompt = "Your email" -when = "account_type == Enterprise" required = true +type = "text" +when = "account_type == Enterprise" # SUPPORT GROUP - Organized support options [[elements]] -name = "support_section_header" -type = "section" -title = "📞 Support Options" -group = "support" border_top = true +group = "support" +name = "support_section_header" +title = "📞 Support Options" +type = "section" [[elements]] -name = "support_info" -type = "section" content = "Choose your preferred support level" group = "support" - -[[elements]] -name = "support_level" -type = "select" -prompt = "Support Level" -options = [ - { value = "Basic", label = "Basic - Email only" }, - { value = "Standard", label = "Standard - Email & chat" }, - { value = "Premium", label = "Premium - Phone & live support" }, -] -group = "support" -required = true - -[[elements]] -name = "support_footer" +name = "support_info" type = "section" + +[[elements]] +group = "support" +name = "support_level" +options = [ + { value = "Basic", label = "Basic - Email only" }, + { value = "Standard", label = "Standard - Email & chat" }, + { value = "Premium", label = "Premium - Phone & live support" }, +] +prompt = "Support Level" +required = true +type = "select" + +[[elements]] +border_bottom = true content = "Support is available 24/7" group = "support" -border_bottom = true +name = "support_footer" +type = "section" # FINAL GROUP - Completion items [[elements]] -name = "final_header" -type = "section" -title = "✅ Complete Registration" -group = "final" border_top = true - -[[elements]] -name = "agree_terms" -type = "confirm" -prompt = "I agree to the terms and conditions" group = "final" -required = true +name = "final_header" +title = "✅ Complete Registration" +type = "section" [[elements]] -name = "final_cta" -type = "cta" -title = "Ready?" +group = "final" +name = "agree_terms" +prompt = "I agree to the terms and conditions" +required = true +type = "confirm" + +[[elements]] +align = "center" +border_bottom = true +border_top = true content = "Click submit to complete your registration" group = "final" -align = "center" -border_top = true -border_bottom = true +name = "final_cta" +title = "Ready?" +type = "cta" diff --git a/examples/01-basic/form_with_sections.toml b/examples/01-basic/form_with_sections.toml index 197f8cd..65e2017 100644 --- a/examples/01-basic/form_with_sections.toml +++ b/examples/01-basic/form_with_sections.toml @@ -1,142 +1,142 @@ -name = "Professional Service Registration" description = "Multi-section registration form with headers and CTAs" +name = "Professional Service Registration" # Header section [[elements]] -name = "main_header" -type = "header" -title = "🎯 Professional Services Registration" -border_top = true -border_bottom = true align = "center" +border_bottom = true +border_top = true +name = "main_header" +title = "🎯 Professional Services Registration" +type = "header" # Welcome section [[elements]] +content = "Welcome to our professional services platform. Please fill in your information to get started." name = "welcome" type = "section" -content = "Welcome to our professional services platform. Please fill in your information to get started." # Contact information section header [[elements]] -name = "contact_header" -type = "section_header" -title = "📋 Contact Information" border_top = true margin_left = 0 +name = "contact_header" +title = "📋 Contact Information" +type = "section_header" # Contact fields [[elements]] name = "full_name" -type = "text" prompt = "Full Name" required = true +type = "text" [[elements]] name = "email" -type = "text" prompt = "Email Address" required = true +type = "text" [[elements]] name = "phone" -type = "text" prompt = "Phone Number" required = false +type = "text" # Services section [[elements]] -name = "services_header" -type = "section_header" -title = "🔧 Services Selection" border_top = true margin_left = 0 +name = "services_header" +title = "🔧 Services Selection" +type = "section_header" [[elements]] name = "primary_service" -type = "select" -prompt = "Primary Service Needed" options = [ - { value = "Consulting", label = "💼 Consulting & Strategy" }, - { value = "Development", label = "🚀 Development & Engineering" }, - { value = "Design", label = "🎨 Design & UX" }, - { value = "Support", label = "🛠️ Support & Maintenance" }, + { value = "Consulting", label = "💼 Consulting & Strategy" }, + { value = "Development", label = "🚀 Development & Engineering" }, + { value = "Design", label = "🎨 Design & UX" }, + { value = "Support", label = "🛠️ Support & Maintenance" }, ] +prompt = "Primary Service Needed" required = true +type = "select" [[elements]] name = "additional_services" -type = "multiselect" -prompt = "Additional Services" options = [ - { value = "Training", label = "📚 Training Programs" }, - { value = "Documentation", label = "📖 Documentation" }, - { value = "Maintenance", label = "🔧 Maintenance & Support" }, - { value = "Security Audit", label = "🔐 Security Audit" }, + { value = "Training", label = "📚 Training Programs" }, + { value = "Documentation", label = "📖 Documentation" }, + { value = "Maintenance", label = "🔧 Maintenance & Support" }, + { value = "Security Audit", label = "🔐 Security Audit" }, ] +prompt = "Additional Services" +type = "multiselect" # Preferences section [[elements]] -name = "prefs_header" -type = "section_header" -title = "⚙️ Preferences" border_top = true margin_left = 0 +name = "prefs_header" +title = "⚙️ Preferences" +type = "section_header" [[elements]] name = "experience_level" -type = "select" -prompt = "Your Experience Level" options = [ - { value = "Beginner", label = "Beginner - Just getting started" }, - { value = "Intermediate", label = "Intermediate - Some experience" }, - { value = "Advanced", label = "Advanced - Deep knowledge" }, - { value = "Expert", label = "Expert - Full mastery" }, + { value = "Beginner", label = "Beginner - Just getting started" }, + { value = "Intermediate", label = "Intermediate - Some experience" }, + { value = "Advanced", label = "Advanced - Deep knowledge" }, + { value = "Expert", label = "Expert - Full mastery" }, ] +prompt = "Your Experience Level" +type = "select" [[elements]] name = "preferred_contact" -type = "select" -prompt = "Preferred Contact Method" options = [ - { value = "Email", label = "📧 Email" }, - { value = "Phone", label = "📞 Phone" }, - { value = "Video Call", label = "🎥 Video Call" }, + { value = "Email", label = "📧 Email" }, + { value = "Phone", label = "📞 Phone" }, + { value = "Video Call", label = "🎥 Video Call" }, ] +prompt = "Preferred Contact Method" +type = "select" # Agreement section [[elements]] -name = "agreement_header" -type = "section_header" -title = "📜 Agreement" border_top = true margin_left = 0 +name = "agreement_header" +title = "📜 Agreement" +type = "section_header" [[elements]] +default = false name = "agree_terms" -type = "confirm" prompt = "I agree to the terms and conditions" -default = false required = true +type = "confirm" [[elements]] +default = false name = "agree_privacy" -type = "confirm" prompt = "I agree to the privacy policy" -default = false required = true +type = "confirm" [[elements]] -name = "marketing_consent" -type = "confirm" -prompt = "I consent to receive marketing communications" default = false +name = "marketing_consent" +prompt = "I consent to receive marketing communications" +type = "confirm" # Footer with CTA [[elements]] -name = "final_cta" -type = "cta" -title = "Thank you for your information!" -content = "Click submit to complete your registration." -border_top = true -border_bottom = true align = "center" +border_bottom = true +border_top = true +content = "Click submit to complete your registration." +name = "final_cta" +title = "Thank you for your information!" +type = "cta" diff --git a/examples/02-advanced/conditional_form.toml b/examples/02-advanced/conditional_form.toml index af7b5ef..3b6f186 100644 --- a/examples/02-advanced/conditional_form.toml +++ b/examples/02-advanced/conditional_form.toml @@ -1,117 +1,117 @@ -name = "User Account Setup" description = "Setup account with conditional fields based on user type" +name = "User Account Setup" # First, select account type [[elements]] name = "account_type" -type = "select" -prompt = "What type of account do you want?" options = [ - { value = "Personal", label = "Personal - Individual use" }, - { value = "Business", label = "Business - Company account" }, - { value = "Developer", label = "Developer - Technical team" }, + { value = "Personal", label = "Personal - Individual use" }, + { value = "Business", label = "Business - Company account" }, + { value = "Developer", label = "Developer - Technical team" }, ] +prompt = "What type of account do you want?" required = true +type = "select" # Business name is only shown if account_type == Business [[elements]] name = "business_name" -type = "text" -prompt = "Enter your business name" placeholder = "Acme Corporation" -when = "account_type == Business" +prompt = "Enter your business name" required = true +type = "text" +when = "account_type == Business" # Business registration is only needed for Business [[elements]] name = "business_registration" -type = "text" -prompt = "Business registration number" placeholder = "123-456-789" +prompt = "Business registration number" +type = "text" when = "account_type == Business" # Developer specific fields [[elements]] name = "github_username" -type = "text" prompt = "GitHub username (optional)" +type = "text" when = "account_type == Developer" [[elements]] name = "preferred_language" -type = "select" -prompt = "Preferred programming language" options = [ - { value = "Rust", label = "🦀 Rust - Systems programming" }, - { value = "Python", label = "🐍 Python - Data & scripting" }, - { value = "Go", label = "🐹 Go - Cloud native" }, - { value = "Java", label = "☕ Java - Enterprise" }, - { value = "JavaScript", label = "🟨 JavaScript - Web development" }, + { value = "Rust", label = "🦀 Rust - Systems programming" }, + { value = "Python", label = "🐍 Python - Data & scripting" }, + { value = "Go", label = "🐹 Go - Cloud native" }, + { value = "Java", label = "☕ Java - Enterprise" }, + { value = "JavaScript", label = "🟨 JavaScript - Web development" }, ] +prompt = "Preferred programming language" +type = "select" when = "account_type == Developer" # Email (required for all) [[elements]] name = "email" -type = "text" -prompt = "Email address" placeholder = "user@example.com" +prompt = "Email address" required = true +type = "text" # Enable 2FA [[elements]] -name = "enable_2fa" -type = "confirm" -prompt = "Enable two-factor authentication?" default = true +name = "enable_2fa" +prompt = "Enable two-factor authentication?" required = true +type = "confirm" # 2FA method only if enabled [[elements]] name = "2fa_method" -type = "select" -prompt = "Choose 2FA method" options = [ - { value = "TOTP", label = "🔐 TOTP - Authenticator app" }, - { value = "SMS", label = "📱 SMS - Text message" }, - { value = "Email", label = "📧 Email" }, + { value = "TOTP", label = "🔐 TOTP - Authenticator app" }, + { value = "SMS", label = "📱 SMS - Text message" }, + { value = "Email", label = "📧 Email" }, ] -when = "enable_2fa == true" +prompt = "Choose 2FA method" required = true +type = "select" +when = "enable_2fa == true" # Phone number for SMS 2FA [[elements]] name = "phone_number" -type = "text" -prompt = "Phone number (for SMS 2FA)" placeholder = "+1234567890" -when = "2fa_method == SMS" +prompt = "Phone number (for SMS 2FA)" required = true +type = "text" +when = "2fa_method == SMS" # Newsletter subscription [[elements]] -name = "subscribe_newsletter" -type = "confirm" -prompt = "Subscribe to our newsletter?" default = false +name = "subscribe_newsletter" +prompt = "Subscribe to our newsletter?" +type = "confirm" # Newsletter frequency (only if subscribed) [[elements]] name = "newsletter_frequency" -type = "select" -prompt = "How often would you like to receive newsletters?" options = [ - { value = "Weekly", label = "📬 Weekly - Every 7 days" }, - { value = "Monthly", label = "📅 Monthly - Once per month" }, - { value = "Quarterly", label = "📊 Quarterly - Every 3 months" }, + { value = "Weekly", label = "📬 Weekly - Every 7 days" }, + { value = "Monthly", label = "📅 Monthly - Once per month" }, + { value = "Quarterly", label = "📊 Quarterly - Every 3 months" }, ] -when = "subscribe_newsletter == true" +prompt = "How often would you like to receive newsletters?" required = true +type = "select" +when = "subscribe_newsletter == true" # Terms and conditions (always required) [[elements]] -name = "agree_terms" -type = "confirm" -prompt = "I agree to the terms and conditions *" default = false +name = "agree_terms" +prompt = "I agree to the terms and conditions *" required = true +type = "confirm" diff --git a/examples/02-advanced/conditional_sections.toml b/examples/02-advanced/conditional_sections.toml index 87b05c0..b7f1f82 100644 --- a/examples/02-advanced/conditional_sections.toml +++ b/examples/02-advanced/conditional_sections.toml @@ -1,184 +1,184 @@ -name = "Dynamic Section Management" description = "Form with sections that appear/disappear based on selections" +name = "Dynamic Section Management" # Main header (always visible) [[elements]] -name = "main_header" -type = "header" -title = "✨ Dynamic Form with Conditional Sections" -border_top = true -border_bottom = true align = "center" +border_bottom = true +border_top = true +name = "main_header" +title = "✨ Dynamic Form with Conditional Sections" +type = "header" # Instructions (always visible) [[elements]] -name = "instructions" -type = "section" content = "Select your preferences below. Additional sections will appear based on your choices." margin_left = 2 +name = "instructions" +type = "section" # Account type selection [[elements]] name = "account_type" -type = "select" -prompt = "What type of account do you need?" options = [ - { value = "Personal", label = "Personal - Individual use" }, - { value = "Business", label = "Business - Small to medium teams" }, - { value = "Enterprise", label = "Enterprise - Large organizations" }, + { value = "Personal", label = "Personal - Individual use" }, + { value = "Business", label = "Business - Small to medium teams" }, + { value = "Enterprise", label = "Enterprise - Large organizations" }, ] +prompt = "What type of account do you need?" required = true +type = "select" # Business section (only if account_type == Business) [[elements]] -name = "business_section_header" -type = "section" -title = "🏢 Business Information" border_top = true +name = "business_section_header" +title = "🏢 Business Information" +type = "section" when = "account_type == Business" [[elements]] name = "company_name" -type = "text" prompt = "Company Name" -when = "account_type == Business" required = true +type = "text" +when = "account_type == Business" [[elements]] name = "company_size" -type = "select" -prompt = "Company Size" options = [ - { value = "1-10", label = "1-10 - Startup" }, - { value = "11-50", label = "11-50 - Small business" }, - { value = "51-200", label = "51-200 - Growth stage" }, - { value = "200+", label = "200+ - Enterprise scale" }, + { value = "1-10", label = "1-10 - Startup" }, + { value = "11-50", label = "11-50 - Small business" }, + { value = "51-200", label = "51-200 - Growth stage" }, + { value = "200+", label = "200+ - Enterprise scale" }, ] +prompt = "Company Size" +type = "select" when = "account_type == Business" # Enterprise section (only if account_type == Enterprise) [[elements]] -name = "enterprise_section_header" -type = "section" -title = "🏛️ Enterprise Setup" border_top = true +name = "enterprise_section_header" +title = "🏛️ Enterprise Setup" +type = "section" when = "account_type == Enterprise" [[elements]] +content = "⚠️ Enterprise accounts require additional verification and support setup." name = "enterprise_warning" type = "section" -content = "⚠️ Enterprise accounts require additional verification and support setup." when = "account_type == Enterprise" [[elements]] name = "enterprise_contact" -type = "text" prompt = "Enterprise Account Manager Email" -when = "account_type == Enterprise" required = true +type = "text" +when = "account_type == Enterprise" # Infrastructure selection (visible for Business & Enterprise) [[elements]] -name = "infrastructure_header" -type = "section" -title = "🔧 Infrastructure Preferences" border_top = true +name = "infrastructure_header" +title = "🔧 Infrastructure Preferences" +type = "section" when = "account_type == Business" [[elements]] -name = "infrastructure_header_enterprise" -type = "section" -title = "🔧 Infrastructure Preferences" border_top = true +name = "infrastructure_header_enterprise" +title = "🔧 Infrastructure Preferences" +type = "section" when = "account_type == Enterprise" [[elements]] name = "hosting_preference" -type = "select" -prompt = "Preferred Hosting" options = [ - { value = "Cloud", label = "☁️ Cloud - AWS/Azure/GCP" }, - { value = "On-Premise", label = "🏢 On-Premise - Your data center" }, - { value = "Hybrid", label = "🔀 Hybrid - Mix of both" }, + { value = "Cloud", label = "☁️ Cloud - AWS/Azure/GCP" }, + { value = "On-Premise", label = "🏢 On-Premise - Your data center" }, + { value = "Hybrid", label = "🔀 Hybrid - Mix of both" }, ] +prompt = "Preferred Hosting" +type = "select" when = "account_type == Business" [[elements]] name = "hosting_preference_enterprise" -type = "select" -prompt = "Preferred Hosting" options = [ - { value = "Cloud", label = "☁️ Cloud - AWS/Azure/GCP" }, - { value = "On-Premise", label = "🏢 On-Premise - Your data center" }, - { value = "Hybrid", label = "🔀 Hybrid - Mix of both" }, - { value = "Multi-Cloud", label = "🌐 Multi-Cloud - Multiple providers" }, + { value = "Cloud", label = "☁️ Cloud - AWS/Azure/GCP" }, + { value = "On-Premise", label = "🏢 On-Premise - Your data center" }, + { value = "Hybrid", label = "🔀 Hybrid - Mix of both" }, + { value = "Multi-Cloud", label = "🌐 Multi-Cloud - Multiple providers" }, ] +prompt = "Preferred Hosting" +type = "select" when = "account_type == Enterprise" # Support level selection [[elements]] -name = "support_header" -type = "section" -title = "💬 Support Options" border_top = true margin_left = 0 +name = "support_header" +title = "💬 Support Options" +type = "section" [[elements]] name = "support_level" -type = "select" -prompt = "Support Level" options = [ - { value = "Community", label = "👥 Community - Free community support" }, - { value = "Basic", label = "🛠️ Basic - Email support" }, - { value = "Premium", label = "⭐ Premium - 24/7 phone & email" }, - { value = "Enterprise", label = "🏛️ Enterprise - Dedicated team" }, + { value = "Community", label = "👥 Community - Free community support" }, + { value = "Basic", label = "🛠️ Basic - Email support" }, + { value = "Premium", label = "⭐ Premium - 24/7 phone & email" }, + { value = "Enterprise", label = "🏛️ Enterprise - Dedicated team" }, ] +prompt = "Support Level" required = true +type = "select" # Premium support details (only if support_level == Premium) [[elements]] -name = "premium_support_info" -type = "section" -title = "⭐ Premium Support Includes" -content = "✓ 24/7 Phone Support\n✓ Dedicated Account Manager\n✓ Priority Queue\n✓ SLA Guarantees" border_top = true +content = "✓ 24/7 Phone Support\n✓ Dedicated Account Manager\n✓ Priority Queue\n✓ SLA Guarantees" +name = "premium_support_info" +title = "⭐ Premium Support Includes" +type = "section" when = "support_level == Premium" # Enterprise support details (only if support_level == Enterprise) [[elements]] -name = "enterprise_support_info" -type = "section" -title = "⭐⭐ Enterprise Support Includes" -content = "✓ 24/7 Dedicated Support Line\n✓ Dedicated Technical Team\n✓ Custom SLA\n✓ Onsite Support Available" border_top = true +content = "✓ 24/7 Dedicated Support Line\n✓ Dedicated Technical Team\n✓ Custom SLA\n✓ Onsite Support Available" +name = "enterprise_support_info" +title = "⭐⭐ Enterprise Support Includes" +type = "section" when = "support_level == Enterprise" [[elements]] name = "support_email" -type = "text" prompt = "Support Contact Email" -when = "support_level == Premium" required = true +type = "text" +when = "support_level == Premium" [[elements]] name = "support_email_enterprise" -type = "text" prompt = "Support Contact Email" -when = "support_level == Enterprise" required = true +type = "text" +when = "support_level == Enterprise" # Final section [[elements]] -name = "final_section" -type = "section" -title = "✅ Ready to Complete" -content = "Review your selections above and click submit to create your account." -border_top = true -border_bottom = true align = "center" +border_bottom = true +border_top = true +content = "Review your selections above and click submit to create your account." +name = "final_section" +title = "✅ Ready to Complete" +type = "section" [[elements]] name = "agree_terms" -type = "confirm" prompt = "I agree to the terms and conditions" required = true +type = "confirm" diff --git a/examples/02-advanced/display_items_demo.toml b/examples/02-advanced/display_items_demo.toml index aae825f..7326b85 100644 --- a/examples/02-advanced/display_items_demo.toml +++ b/examples/02-advanced/display_items_demo.toml @@ -1,78 +1,78 @@ -name = "Display Items Showcase" description = "Demonstrates all display item types and attributes" +name = "Display Items Showcase" # Basic Header [[elements]] name = "header_basic" -type = "header" title = "Basic Header" +type = "header" # Header with borders [[elements]] -name = "header_bordered" -type = "header" -title = "Header with Borders" -border_top = true border_bottom = true +border_top = true +name = "header_bordered" +title = "Header with Borders" +type = "header" # Header centered [[elements]] -name = "header_centered" -type = "header" -title = "Centered Header" -border_top = true -border_bottom = true align = "center" +border_bottom = true +border_top = true +name = "header_centered" +title = "Centered Header" +type = "header" # Simple section with content [[elements]] +content = "This is a simple information section. It contains text that guides the user." name = "info_section" type = "section" -content = "This is a simple information section. It contains text that guides the user." # Section with borders [[elements]] -name = "important_info" -type = "section" -title = "Important Information" -content = "This section has both title and content with a border on top." border_top = true +content = "This section has both title and content with a border on top." +name = "important_info" +title = "Important Information" +type = "section" # Multi-line content section [[elements]] -name = "multiline_section" -type = "section" -title = "Features" -content = "✓ Feature One\n✓ Feature Two\n✓ Feature Three\n✓ Feature Four" border_bottom = true +content = "✓ Feature One\n✓ Feature Two\n✓ Feature Three\n✓ Feature Four" +name = "multiline_section" +title = "Features" +type = "section" # Example field [[elements]] name = "example_field" -type = "text" prompt = "Enter something" +type = "text" # Left-aligned section [[elements]] -name = "instructions" -type = "section" content = "Please follow the instructions above." margin_left = 2 +name = "instructions" +type = "section" # Call To Action [[elements]] -name = "cta_submit" -type = "cta" -title = "Ready?" -content = "Click submit when you're done!" -border_top = true -border_bottom = true align = "center" +border_bottom = true +border_top = true +content = "Click submit when you're done!" +name = "cta_submit" +title = "Ready?" +type = "cta" # Right-aligned footer [[elements]] +align = "right" +content = "© 2024 Your Company. All rights reserved." +margin_left = 0 name = "footer" type = "footer" -content = "© 2024 Your Company. All rights reserved." -align = "right" -margin_left = 0 diff --git a/examples/02-multiselect-display-modes/form.toml b/examples/02-multiselect-display-modes/form.toml index 69aa232..e60944c 100644 --- a/examples/02-multiselect-display-modes/form.toml +++ b/examples/02-multiselect-display-modes/form.toml @@ -1,75 +1,75 @@ -name = "MultiSelect Display Modes Demo" description = "Demonstrates different display modes and features for multiselect fields" +name = "MultiSelect Display Modes Demo" # List mode (default) - vertical checkboxes [[elements]] -name = "features_list" -type = "multiselect" -prompt = "Features (List mode - default)" -help = "Vertical checkbox list" default = "logging" +help = "Vertical checkbox list" +name = "features_list" options = [ - { value = "logging", label = "📝 Logging" }, - { value = "metrics", label = "📊 Metrics" }, - { value = "tracing", label = "🔍 Tracing" }, - { value = "profiling", label = "⚡ Profiling" }, + { value = "logging", label = "📝 Logging" }, + { value = "metrics", label = "📊 Metrics" }, + { value = "tracing", label = "🔍 Tracing" }, + { value = "profiling", label = "⚡ Profiling" }, ] +prompt = "Features (List mode - default)" +type = "multiselect" # Grid mode - responsive grid layout [[elements]] -name = "languages_grid" -type = "multiselect" -prompt = "Programming Languages (Grid mode)" -help = "Responsive grid with icons" -display_mode = "grid" -searchable = true default = "rust,python" +display_mode = "grid" +help = "Responsive grid with icons" +name = "languages_grid" options = [ - { value = "rust", label = "🦀 Rust" }, - { value = "python", label = "🐍 Python" }, - { value = "javascript", label = "📜 JavaScript" }, - { value = "go", label = "🐹 Go" }, - { value = "java", label = "☕ Java" }, - { value = "csharp", label = "🔵 C#" }, + { value = "rust", label = "🦀 Rust" }, + { value = "python", label = "🐍 Python" }, + { value = "javascript", label = "📜 JavaScript" }, + { value = "go", label = "🐹 Go" }, + { value = "java", label = "☕ Java" }, + { value = "csharp", label = "🔵 C#" }, ] +prompt = "Programming Languages (Grid mode)" +searchable = true +type = "multiselect" # Dropdown mode - native select multiple with search [[elements]] -name = "frameworks" -type = "multiselect" -prompt = "Web Frameworks" -help = "Use dropdown mode for 10+ options" display_mode = "dropdown" -searchable = true -min_selected = 1 +help = "Use dropdown mode for 10+ options" max_selected = 3 -required = true +min_selected = 1 +name = "frameworks" options = [ - { value = "react", label = "React" }, - { value = "vue", label = "Vue" }, - { value = "angular", label = "Angular" }, - { value = "svelte", label = "Svelte" }, - { value = "nextjs", label = "Next.js" }, - { value = "nuxt", label = "Nuxt" }, - { value = "astro", label = "Astro" }, - { value = "remix", label = "Remix" }, - { value = "gatsby", label = "Gatsby" }, - { value = "qwik", label = "Qwik" }, + { value = "react", label = "React" }, + { value = "vue", label = "Vue" }, + { value = "angular", label = "Angular" }, + { value = "svelte", label = "Svelte" }, + { value = "nextjs", label = "Next.js" }, + { value = "nuxt", label = "Nuxt" }, + { value = "astro", label = "Astro" }, + { value = "remix", label = "Remix" }, + { value = "gatsby", label = "Gatsby" }, + { value = "qwik", label = "Qwik" }, ] +prompt = "Web Frameworks" +required = true +searchable = true +type = "multiselect" # Example with min/max validation [[elements]] -name = "permissions" -type = "multiselect" -prompt = "User Permissions" -help = "Select between 1 and 3 permissions" -display_mode = "grid" -min_selected = 1 -max_selected = 3 default = "read" +display_mode = "grid" +help = "Select between 1 and 3 permissions" +max_selected = 3 +min_selected = 1 +name = "permissions" options = [ - { value = "read", label = "📖 Read" }, - { value = "write", label = "✏️ Write" }, - { value = "delete", label = "🗑️ Delete" }, - { value = "admin", label = "🔑 Admin" }, + { value = "read", label = "📖 Read" }, + { value = "write", label = "✏️ Write" }, + { value = "delete", label = "🗑️ Delete" }, + { value = "admin", label = "🔑 Admin" }, ] +prompt = "User Permissions" +type = "multiselect" diff --git a/examples/03-styling/custom_border_form.toml b/examples/03-styling/custom_border_form.toml index f2c95e7..11be7e0 100644 --- a/examples/03-styling/custom_border_form.toml +++ b/examples/03-styling/custom_border_form.toml @@ -1,43 +1,43 @@ -name = "Custom Border Demo Form" description = "Demonstrates custom border_top_char, border_top_len, border_bottom_char, border_bottom_len" +name = "Custom Border Demo Form" # Standard border with default ═ [[elements]] -name = "header_group" -type = "group" -order = 1 includes = ["fragments/header.toml"] +name = "header_group" +order = 1 +type = "group" # Custom border with different top and bottom styles [[elements]] -name = "custom_group" -type = "group" -order = 2 includes = ["fragments/custom_border_section.toml"] +name = "custom_group" +order = 2 +type = "group" # Simple field [[elements]] name = "project_name" -type = "text" +order = 3 prompt = "Project name" required = true -order = 3 +type = "text" # Different border styles with corners and margin [[elements]] -name = "footer" -type = "section" -title = "✓ Complete!" -content = "Thank you for filling out this form" -border_top = true border_bottom = true -order = 4 -margin_left = 2 -border_top_l = "┌" -border_top_char = "─" -border_top_len = 40 -border_top_r = "┐" -border_bottom_l = "└" border_bottom_char = "─" +border_bottom_l = "└" border_bottom_len = 40 border_bottom_r = "┘" +border_top = true +border_top_char = "─" +border_top_l = "┌" +border_top_len = 40 +border_top_r = "┐" +content = "Thank you for filling out this form" +margin_left = 2 +name = "footer" +order = 4 +title = "✓ Complete!" +type = "section" diff --git a/examples/03-styling/fancy_borders_form.toml b/examples/03-styling/fancy_borders_form.toml index ad423e9..c4d375f 100644 --- a/examples/03-styling/fancy_borders_form.toml +++ b/examples/03-styling/fancy_borders_form.toml @@ -1,61 +1,61 @@ -name = "Fancy Borders Demo" description = "Demonstrates custom corner characters with fancy Unicode borders" +name = "Fancy Borders Demo" # Fancy bordered header - border at margin 0, content at margin 2 [[elements]] -name = "fancy_header" -type = "section" -title = "✨ Welcome to Fancy Forms ✨" -border_top = true border_bottom = true -order = 1 -border_margin_left = 0 -content_margin_left = 2 -border_top_l = "╭" -border_top_char = "─" -border_top_len = 35 -border_top_r = "╮" -border_bottom_l = "╰" border_bottom_char = "─" +border_bottom_l = "╰" border_bottom_len = 35 border_bottom_r = "╯" +border_margin_left = 0 +border_top = true +border_top_char = "─" +border_top_l = "╭" +border_top_len = 35 +border_top_r = "╮" +content_margin_left = 2 +name = "fancy_header" +order = 1 +title = "✨ Welcome to Fancy Forms ✨" +type = "section" # Include fancy border fragment - margin settings are in the fragment items [[elements]] -name = "fancy_group" -type = "group" -order = 2 includes = ["fragments/fancy_border_section.toml"] +name = "fancy_group" +order = 2 +type = "group" # Simple field [[elements]] name = "favorite_style" -type = "select" -prompt = "Your favorite border style" options = [ - { value = "Fancy Unicode", label = "✨ Fancy Unicode - Modern look" }, - { value = "Simple ASCII", label = "📝 Simple ASCII - Classic style" }, - { value = "Mixed Styles", label = "🎨 Mixed Styles - Custom borders" }, + { value = "Fancy Unicode", label = "✨ Fancy Unicode - Modern look" }, + { value = "Simple ASCII", label = "📝 Simple ASCII - Classic style" }, + { value = "Mixed Styles", label = "🎨 Mixed Styles - Custom borders" }, ] -required = true order = 3 +prompt = "Your favorite border style" +required = true +type = "select" # Box border for footer - border at 0, content at 2 [[elements]] -name = "box_footer" -type = "section" -title = "✓ All Done!" -content = "Thanks for exploring fancy borders!" -border_top = true border_bottom = true -order = 4 -border_margin_left = 0 -content_margin_left = 2 -border_top_l = "┌" -border_top_char = "─" -border_top_len = 40 -border_top_r = "┐" -border_bottom_l = "└" border_bottom_char = "─" +border_bottom_l = "└" border_bottom_len = 40 border_bottom_r = "┘" +border_margin_left = 0 +border_top = true +border_top_char = "─" +border_top_l = "┌" +border_top_len = 40 +border_top_r = "┐" +content = "Thanks for exploring fancy borders!" +content_margin_left = 2 +name = "box_footer" +order = 4 +title = "✓ All Done!" +type = "section" diff --git a/examples/04-backends/tui/tui_survey_form.toml b/examples/04-backends/tui/tui_survey_form.toml index 36ce881..f720e3f 100644 --- a/examples/04-backends/tui/tui_survey_form.toml +++ b/examples/04-backends/tui/tui_survey_form.toml @@ -1,226 +1,226 @@ -name = "User Experience Survey" description = "Comprehensive TUI survey with visual elements and grouped sections" locale = "en-US" +name = "User Experience Survey" # Welcome header with fancy Unicode borders [[items]] -name = "welcome_header" -type = "section" -title = "📋 User Experience Survey" -content = "Help us improve by sharing your feedback" -border_top = true border_bottom = true -order = 1 -border_margin_left = 0 -content_margin_left = 2 -border_top_l = "╭" -border_top_char = "─" -border_top_len = 45 -border_top_r = "╮" -border_bottom_l = "╰" border_bottom_char = "─" +border_bottom_l = "╰" border_bottom_len = 45 border_bottom_r = "╯" +border_margin_left = 0 +border_top = true +border_top_char = "─" +border_top_l = "╭" +border_top_len = 45 +border_top_r = "╮" +content = "Help us improve by sharing your feedback" +content_margin_left = 2 +name = "welcome_header" +order = 1 +title = "📋 User Experience Survey" +type = "section" # Personal Information section header [[items]] -name = "personal_info_header" -type = "section_header" -title = "👤 Personal Information" -order = 2 margin_left = 2 +name = "personal_info_header" +order = 2 +title = "👤 Personal Information" +type = "section_header" # Personal information fields [[fields]] +group = "personal_info" name = "full_name" -type = "text" -prompt = "Full name" -placeholder = "Jane Smith" -required = true -group = "personal_info" order = 3 - -[[fields]] -name = "email" -type = "text" -prompt = "Email address" -placeholder = "jane@example.com" +placeholder = "Jane Smith" +prompt = "Full name" required = true -group = "personal_info" -order = 4 +type = "text" [[fields]] -name = "phone" -type = "text" -prompt = "Phone number (optional)" -placeholder = "+1-555-0123" group = "personal_info" +name = "email" +order = 4 +placeholder = "jane@example.com" +prompt = "Email address" +required = true +type = "text" + +[[fields]] +group = "personal_info" +name = "phone" order = 5 +placeholder = "+1-555-0123" +prompt = "Phone number (optional)" +type = "text" # Product experience section [[items]] -name = "product_header" -type = "section_header" -title = "⭐ Product Experience" -order = 6 margin_left = 2 +name = "product_header" +order = 6 +title = "⭐ Product Experience" +type = "section_header" [[fields]] +group = "product" name = "overall_satisfaction" -type = "select" -prompt = "Overall satisfaction with product" options = [ - { value = "Very Unsatisfied", label = "😢 Very Unsatisfied" }, - { value = "Unsatisfied", label = "😟 Unsatisfied" }, - { value = "Neutral", label = "😐 Neutral" }, - { value = "Satisfied", label = "😊 Satisfied" }, - { value = "Very Satisfied", label = "😍 Very Satisfied" }, + { value = "Very Unsatisfied", label = "😢 Very Unsatisfied" }, + { value = "Unsatisfied", label = "😟 Unsatisfied" }, + { value = "Neutral", label = "😐 Neutral" }, + { value = "Satisfied", label = "😊 Satisfied" }, + { value = "Very Satisfied", label = "😍 Very Satisfied" }, ] -required = true -group = "product" order = 7 - -[[fields]] -name = "usage_frequency" -type = "select" -prompt = "How often do you use this product?" -options = [ - { value = "Daily", label = "📅 Daily" }, - { value = "Weekly", label = "📊 Weekly" }, - { value = "Monthly", label = "📆 Monthly" }, - { value = "Occasionally", label = "📝 Occasionally" }, - { value = "Never", label = "🚫 Never" }, -] +prompt = "Overall satisfaction with product" required = true -group = "product" -order = 8 +type = "select" [[fields]] -name = "features_used" -type = "multiselect" -prompt = "Which features do you use? (select all that apply)" -options = [ - { value = "Dashboard", label = "📊 Dashboard" }, - { value = "Analytics", label = "📈 Analytics" }, - { value = "Reporting", label = "📑 Reporting" }, - { value = "API Integration", label = "🔌 API Integration" }, - { value = "Mobile App", label = "📱 Mobile App" }, - { value = "Notifications", label = "🔔 Notifications" }, - { value = "Collaboration Tools", label = "👥 Collaboration Tools" }, -] -page_size = 5 -vim_mode = true group = "product" +name = "usage_frequency" +options = [ + { value = "Daily", label = "📅 Daily" }, + { value = "Weekly", label = "📊 Weekly" }, + { value = "Monthly", label = "📆 Monthly" }, + { value = "Occasionally", label = "📝 Occasionally" }, + { value = "Never", label = "🚫 Never" }, +] +order = 8 +prompt = "How often do you use this product?" +required = true +type = "select" + +[[fields]] +group = "product" +name = "features_used" +options = [ + { value = "Dashboard", label = "📊 Dashboard" }, + { value = "Analytics", label = "📈 Analytics" }, + { value = "Reporting", label = "📑 Reporting" }, + { value = "API Integration", label = "🔌 API Integration" }, + { value = "Mobile App", label = "📱 Mobile App" }, + { value = "Notifications", label = "🔔 Notifications" }, + { value = "Collaboration Tools", label = "👥 Collaboration Tools" }, +] order = 9 +page_size = 5 +prompt = "Which features do you use? (select all that apply)" +type = "multiselect" +vim_mode = true # Feedback section [[items]] -name = "feedback_header" -type = "section_header" -title = "💬 Feedback" -order = 10 margin_left = 2 +name = "feedback_header" +order = 10 +title = "💬 Feedback" +type = "section_header" [[fields]] -name = "improvements" -type = "editor" -prompt = "What improvements would you suggest?" file_extension = "txt" -prefix_text = "# Please describe desired improvements\n" group = "feedback" +name = "improvements" order = 11 +prefix_text = "# Please describe desired improvements\n" +prompt = "What improvements would you suggest?" +type = "editor" [[fields]] -name = "biggest_pain_point" -type = "select" -prompt = "What's your biggest pain point?" -options = [ - { value = "Performance issues", label = "⚡ Performance issues" }, - { value = "Confusing UI/UX", label = "🎨 Confusing UI/UX" }, - { value = "Missing features", label = "❌ Missing features" }, - { value = "Documentation", label = "📖 Documentation" }, - { value = "Customer support", label = "🆘 Customer support" }, - { value = "Pricing", label = "💰 Pricing" }, - { value = "Other", label = "❓ Other" }, -] -required = true group = "feedback" +name = "biggest_pain_point" +options = [ + { value = "Performance issues", label = "⚡ Performance issues" }, + { value = "Confusing UI/UX", label = "🎨 Confusing UI/UX" }, + { value = "Missing features", label = "❌ Missing features" }, + { value = "Documentation", label = "📖 Documentation" }, + { value = "Customer support", label = "🆘 Customer support" }, + { value = "Pricing", label = "💰 Pricing" }, + { value = "Other", label = "❓ Other" }, +] order = 12 +prompt = "What's your biggest pain point?" +required = true +type = "select" # Preferences section [[items]] -name = "preferences_header" -type = "section_header" -title = "⚙️ Preferences" -order = 13 margin_left = 2 +name = "preferences_header" +order = 13 +title = "⚙️ Preferences" +type = "section_header" [[fields]] -name = "contact_preference" -type = "select" -prompt = "Preferred contact method" -options = [ - { value = "Email", label = "📧 Email" }, - { value = "Phone", label = "📞 Phone" }, - { value = "SMS", label = "💬 SMS" }, - { value = "In-app notification", label = "🔔 In-app notification" }, - { value = "No contact", label = "🚫 No contact" }, -] default = "Email" -required = true group = "preferences" +name = "contact_preference" +options = [ + { value = "Email", label = "📧 Email" }, + { value = "Phone", label = "📞 Phone" }, + { value = "SMS", label = "💬 SMS" }, + { value = "In-app notification", label = "🔔 In-app notification" }, + { value = "No contact", label = "🚫 No contact" }, +] order = 14 +prompt = "Preferred contact method" +required = true +type = "select" [[fields]] +default = "false" +group = "preferences" name = "newsletter_opt_in" -type = "confirm" -prompt = "Subscribe to our newsletter for updates?" -default = "false" -group = "preferences" order = 15 +prompt = "Subscribe to our newsletter for updates?" +type = "confirm" [[fields]] -name = "beta_features" -type = "confirm" -prompt = "Interested in testing beta features?" default = "false" group = "preferences" +name = "beta_features" order = 16 +prompt = "Interested in testing beta features?" +type = "confirm" # Advanced options (conditional) [[fields]] -name = "device_types" -type = "multiselect" -prompt = "Which devices do you use? (optional)" -options = [ - { value = "Desktop", label = "🖥️ Desktop" }, - { value = "Laptop", label = "💻 Laptop" }, - { value = "Tablet", label = "📱 Tablet" }, - { value = "Mobile", label = "📲 Mobile Phone" }, - { value = "Smartwatch", label = "⌚ Smartwatch" }, -] -when = "beta_features == true" -page_size = 4 -vim_mode = true group = "preferences" +name = "device_types" +options = [ + { value = "Desktop", label = "🖥️ Desktop" }, + { value = "Laptop", label = "💻 Laptop" }, + { value = "Tablet", label = "📱 Tablet" }, + { value = "Mobile", label = "📲 Mobile Phone" }, + { value = "Smartwatch", label = "⌚ Smartwatch" }, +] order = 17 +page_size = 4 +prompt = "Which devices do you use? (optional)" +type = "multiselect" +vim_mode = true +when = "beta_features == true" # Closing footer [[items]] -name = "closing_footer" -type = "section" -title = "✓ Thank You!" -content = "Your feedback helps us build better products" -border_top = true border_bottom = true -order = 100 -border_margin_left = 0 -content_margin_left = 2 -border_top_l = "┌" -border_top_char = "─" -border_top_len = 50 -border_top_r = "┐" -border_bottom_l = "└" border_bottom_char = "─" +border_bottom_l = "└" border_bottom_len = 50 border_bottom_r = "┘" +border_margin_left = 0 +border_top = true +border_top_char = "─" +border_top_l = "┌" +border_top_len = 50 +border_top_r = "┐" +content = "Your feedback helps us build better products" +content_margin_left = 2 +name = "closing_footer" +order = 100 +title = "✓ Thank You!" +type = "section" diff --git a/examples/04-backends/web/web_registration_form.toml b/examples/04-backends/web/web_registration_form.toml index b0b585e..d088248 100644 --- a/examples/04-backends/web/web_registration_form.toml +++ b/examples/04-backends/web/web_registration_form.toml @@ -1,283 +1,283 @@ -name = "User Registration" description = "Web-optimized registration form with account setup and preferences" locale = "en-US" +name = "User Registration" # Account Credentials Section [[items]] name = "account_section" -type = "section_header" -title = "Create Your Account" order = 1 +title = "Create Your Account" +type = "section_header" [[fields]] +group = "account" name = "username" -type = "text" -prompt = "Username" -placeholder = "Choose a unique username" -required = true -group = "account" order = 2 - -[[fields]] -name = "email" -type = "text" -prompt = "Email Address" -placeholder = "your.email@example.com" +placeholder = "Choose a unique username" +prompt = "Username" required = true -group = "account" -order = 3 +type = "text" [[fields]] +group = "account" +name = "email" +order = 3 +placeholder = "your.email@example.com" +prompt = "Email Address" +required = true +type = "text" + +[[fields]] +group = "account" name = "password" -type = "password" +order = 4 prompt = "Password" required = true -group = "account" -order = 4 +type = "password" [[fields]] +group = "account" name = "confirm_password" -type = "password" +order = 5 prompt = "Confirm Password" required = true -group = "account" -order = 5 +type = "password" # Profile Information Section [[items]] name = "profile_section" -type = "section_header" -title = "Profile Information" order = 10 +title = "Profile Information" +type = "section_header" [[fields]] +group = "profile" name = "first_name" -type = "text" -prompt = "First Name" -placeholder = "Jane" -required = true -group = "profile" order = 11 - -[[fields]] -name = "last_name" -type = "text" -prompt = "Last Name" -placeholder = "Smith" +placeholder = "Jane" +prompt = "First Name" required = true -group = "profile" -order = 12 - -[[fields]] -name = "display_name" type = "text" -prompt = "Display Name (optional)" -placeholder = "How you'll appear to other users" + +[[fields]] group = "profile" +name = "last_name" +order = 12 +placeholder = "Smith" +prompt = "Last Name" +required = true +type = "text" + +[[fields]] +group = "profile" +name = "display_name" order = 13 +placeholder = "How you'll appear to other users" +prompt = "Display Name (optional)" +type = "text" [[fields]] -name = "birth_date" -type = "date" -prompt = "Date of Birth" -min_date = "1950-01-01" -max_date = "2006-12-31" -week_start = "Sun" group = "profile" +max_date = "2006-12-31" +min_date = "1950-01-01" +name = "birth_date" order = 14 +prompt = "Date of Birth" +type = "date" +week_start = "Sun" [[fields]] -name = "bio" -type = "editor" -prompt = "About Me" file_extension = "md" group = "profile" +name = "bio" order = 15 +prompt = "About Me" +type = "editor" # Account Settings Section [[items]] name = "settings_section" -type = "section_header" -title = "Account Settings" order = 20 +title = "Account Settings" +type = "section_header" [[fields]] -name = "account_type" -type = "select" -prompt = "Account Type" -options = [ - { value = "Personal", label = "👤 Personal - Individual use" }, - { value = "Business", label = "💼 Business - Small team" }, - { value = "Organization", label = "🏢 Organization - Large team" }, -] default = "Personal" -required = true group = "settings" +name = "account_type" +options = [ + { value = "Personal", label = "👤 Personal - Individual use" }, + { value = "Business", label = "💼 Business - Small team" }, + { value = "Organization", label = "🏢 Organization - Large team" }, +] order = 21 +prompt = "Account Type" +required = true +type = "select" [[fields]] -name = "subscription_plan" -type = "select" -prompt = "Subscription Plan" -options = [ - { value = "Free", label = "🆓 Free - Essential features" }, - { value = "Pro", label = "⭐ Pro - Advanced features" }, - { value = "Enterprise", label = "🏛️ Enterprise - Full suite" }, -] default = "Free" -required = true group = "settings" +name = "subscription_plan" +options = [ + { value = "Free", label = "🆓 Free - Essential features" }, + { value = "Pro", label = "⭐ Pro - Advanced features" }, + { value = "Enterprise", label = "🏛️ Enterprise - Full suite" }, +] order = 22 +prompt = "Subscription Plan" +required = true +type = "select" # Conditional fields for Business/Organization accounts [[fields]] -name = "company_name" -type = "text" -prompt = "Company Name" -placeholder = "Your Organization" -when = "account_type != Personal" -required = true group = "settings" +name = "company_name" order = 23 +placeholder = "Your Organization" +prompt = "Company Name" +required = true +type = "text" +when = "account_type != Personal" [[fields]] -name = "company_url" -type = "text" -prompt = "Company Website" -placeholder = "https://example.com" -when = "account_type != Personal" group = "settings" +name = "company_url" order = 24 +placeholder = "https://example.com" +prompt = "Company Website" +type = "text" +when = "account_type != Personal" # Premium features (conditional on subscription) [[fields]] -name = "api_access" -type = "confirm" -prompt = "Enable API Access?" -when = "subscription_plan != Free" default = "false" group = "settings" +name = "api_access" order = 25 +prompt = "Enable API Access?" +type = "confirm" +when = "subscription_plan != Free" [[fields]] -name = "team_members_count" -type = "custom" -prompt = "How many team members?" custom_type = "i32" default = "1" -when = "subscription_plan == Enterprise" group = "settings" +name = "team_members_count" order = 26 +prompt = "How many team members?" +type = "custom" +when = "subscription_plan == Enterprise" # Preferences Section [[items]] name = "preferences_section" -type = "section_header" -title = "Communication Preferences" order = 30 +title = "Communication Preferences" +type = "section_header" [[fields]] -name = "notifications_email" -type = "confirm" -prompt = "Send me email notifications?" default = "true" group = "preferences" +name = "notifications_email" order = 31 +prompt = "Send me email notifications?" +type = "confirm" [[fields]] -name = "marketing_emails" -type = "confirm" -prompt = "Subscribe to marketing emails and updates?" default = "false" group = "preferences" +name = "marketing_emails" order = 32 +prompt = "Subscribe to marketing emails and updates?" +type = "confirm" [[fields]] -name = "notification_frequency" -type = "select" -prompt = "Email notification frequency" -options = [ - { value = "Immediate", label = "⚡ Immediate" }, - { value = "Daily Digest", label = "📅 Daily Digest" }, - { value = "Weekly Summary", label = "📊 Weekly Summary" }, - { value = "Monthly Summary", label = "📈 Monthly Summary" }, - { value = "Never", label = "🚫 Never" }, -] -when = "notifications_email == true" default = "Daily Digest" group = "preferences" +name = "notification_frequency" +options = [ + { value = "Immediate", label = "⚡ Immediate" }, + { value = "Daily Digest", label = "📅 Daily Digest" }, + { value = "Weekly Summary", label = "📊 Weekly Summary" }, + { value = "Monthly Summary", label = "📈 Monthly Summary" }, + { value = "Never", label = "🚫 Never" }, +] order = 33 +prompt = "Email notification frequency" +type = "select" +when = "notifications_email == true" [[fields]] -name = "interests" -type = "multiselect" -prompt = "Topics you're interested in:" -options = [ - { value = "Product Updates", label = "🚀 Product Updates" }, - { value = "Security Alerts", label = "🔒 Security Alerts" }, - { value = "Performance Tips", label = "⚡ Performance Tips" }, - { value = "Community News", label = "👥 Community News" }, - { value = "Educational Content", label = "📚 Educational Content" }, - { value = "Exclusive Offers", label = "🎁 Exclusive Offers" }, -] -page_size = 4 group = "preferences" +name = "interests" +options = [ + { value = "Product Updates", label = "🚀 Product Updates" }, + { value = "Security Alerts", label = "🔒 Security Alerts" }, + { value = "Performance Tips", label = "⚡ Performance Tips" }, + { value = "Community News", label = "👥 Community News" }, + { value = "Educational Content", label = "📚 Educational Content" }, + { value = "Exclusive Offers", label = "🎁 Exclusive Offers" }, +] order = 34 +page_size = 4 +prompt = "Topics you're interested in:" +type = "multiselect" # Privacy & Legal Section [[items]] name = "legal_section" -type = "section_header" -title = "Privacy & Legal" order = 40 +title = "Privacy & Legal" +type = "section_header" [[fields]] +group = "legal" name = "terms_accepted" -type = "confirm" +order = 41 prompt = "I agree to the Terms of Service" required = true -group = "legal" -order = 41 +type = "confirm" [[fields]] +group = "legal" name = "privacy_policy_accepted" -type = "confirm" +order = 42 prompt = "I have read and accept the Privacy Policy" required = true -group = "legal" -order = 42 +type = "confirm" [[fields]] +group = "legal" name = "data_processing" -type = "confirm" +order = 43 prompt = "I consent to data processing as described" required = true -group = "legal" -order = 43 +type = "confirm" # Optional secondary contact [[fields]] -name = "enable_secondary_contact" -type = "confirm" -prompt = "Add secondary contact information?" default = "false" group = "legal" +name = "enable_secondary_contact" order = 44 +prompt = "Add secondary contact information?" +type = "confirm" [[fields]] +group = "legal" name = "secondary_email" -type = "text" -prompt = "Secondary Email Address" -placeholder = "alternative@example.com" -when = "enable_secondary_contact == true" -group = "legal" order = 45 +placeholder = "alternative@example.com" +prompt = "Secondary Email Address" +type = "text" +when = "enable_secondary_contact == true" [[fields]] -name = "recovery_phone" -type = "text" -prompt = "Recovery Phone Number" -placeholder = "+1-555-0123" -when = "enable_secondary_contact == true" group = "legal" +name = "recovery_phone" order = 46 +placeholder = "+1-555-0123" +prompt = "Recovery Phone Number" +type = "text" +when = "enable_secondary_contact == true" diff --git a/examples/05-fragments/agreement_section.toml b/examples/05-fragments/agreement_section.toml index fd3dddd..ba46381 100644 --- a/examples/05-fragments/agreement_section.toml +++ b/examples/05-fragments/agreement_section.toml @@ -1,45 +1,45 @@ name = "agreement_fragment" [[elements]] -name = "agreement_header" -type = "section" -title = "✅ Terms & Conditions" border_top = true -order = 1 margin_left = 2 +name = "agreement_header" +order = 1 +title = "✅ Terms & Conditions" +type = "section" [[elements]] -name = "agreement_info" -type = "section" content = "Please review and agree to our terms before proceeding" -order = 2 margin_left = 2 +name = "agreement_info" +order = 2 +type = "section" [[elements]] name = "agree_terms" -type = "confirm" +order = 3 prompt = "I agree to the terms and conditions" required = true -order = 3 +type = "confirm" [[elements]] name = "agree_privacy" -type = "confirm" +order = 4 prompt = "I agree to the privacy policy" required = true -order = 4 - -[[elements]] -name = "agree_marketing" type = "confirm" -prompt = "I consent to receive marketing communications" -default = "false" -order = 5 [[elements]] -name = "agreement_footer" -type = "section" -content = "Click submit to complete your registration" -border_bottom = true +default = "false" +name = "agree_marketing" +order = 5 +prompt = "I consent to receive marketing communications" +type = "confirm" + +[[elements]] align = "center" +border_bottom = true +content = "Click submit to complete your registration" +name = "agreement_footer" order = 6 +type = "section" diff --git a/examples/05-fragments/array-trackers.toml b/examples/05-fragments/array-trackers.toml index bff3bee..5da9800 100644 --- a/examples/05-fragments/array-trackers.toml +++ b/examples/05-fragments/array-trackers.toml @@ -1,102 +1,102 @@ -name = "Tracker Configuration with Arrays" description = "Example showing RepeatingGroup arrays for multiple trackers" display_mode = "complete" +name = "Tracker Configuration with Arrays" # Header [[elements]] -name = "main_header" -type = "section_header" -title = "🎯 Tracker Configuration" -border_top = true border_bottom = true +border_top = true +name = "main_header" +title = "🎯 Tracker Configuration" +type = "section_header" # Introduction [[elements]] +content = "Configure multiple UDP and HTTP tracker listeners. You can add, edit, or delete trackers as needed." name = "intro" type = "section" -content = "Configure multiple UDP and HTTP tracker listeners. You can add, edit, or delete trackers as needed." # Tracker mode selection [[elements]] +default = "public" name = "tracker_mode" -type = "select" +options = [ + { value = "public", label = "Public Tracker" }, + { value = "private", label = "Private Tracker" }, +] +order = 1 prompt = "Tracker Mode" required = true -options = [ - { value = "public", label = "Public Tracker" }, - { value = "private", label = "Private Tracker" }, -] -default = "public" -order = 1 +type = "select" # UDP Trackers array # max_items loaded from constraints.toml via constraint interpolation # See constraints.toml to change max_items (default: 4) [[elements]] -name = "udp_trackers" -type = "repeatinggroup" -prompt = "UDP Tracker Listeners" -fragment = "fragments/tracker-udp-item.toml" -min_items = 0 -max_items = "${constraint.tracker.udp.max_items}" default_items = 1 -unique = true -required = false +fragment = "fragments/tracker-udp-item.toml" help = "Add UDP tracker listener addresses (must be unique). Standard BitTorrent port is 6969." +max_items = "${constraint.tracker.udp.max_items}" +min_items = 0 +name = "udp_trackers" order = 2 +prompt = "UDP Tracker Listeners" +required = false +type = "repeatinggroup" +unique = true # HTTP Trackers array # max_items loaded from constraints.toml via constraint interpolation # See constraints.toml to change max_items (default: 4) [[elements]] -name = "http_trackers" -type = "repeatinggroup" -prompt = "HTTP Tracker Listeners" -fragment = "fragments/tracker-http-item.toml" -min_items = 0 -max_items = "${constraint.tracker.http.max_items}" default_items = 1 -unique = true -required = false +fragment = "fragments/tracker-http-item.toml" help = "Add HTTP tracker listener addresses (must be unique). Standard HTTP port is 80, HTTPS is 443." +max_items = "${constraint.tracker.http.max_items}" +min_items = 0 +name = "http_trackers" order = 3 +prompt = "HTTP Tracker Listeners" +required = false +type = "repeatinggroup" +unique = true # API Configuration section [[elements]] -name = "api_header" -type = "section_header" -title = "📡 API Configuration" -border_top = true border_bottom = true +border_top = true +name = "api_header" +title = "📡 API Configuration" +type = "section_header" # API Token [[elements]] +help = "Secure token for API authentication" name = "api_token" -type = "password" +order = 4 prompt = "Admin API Token" required = true -help = "Secure token for API authentication" -order = 4 +type = "password" # API Port [[elements]] -name = "api_port" -type = "text" -prompt = "API Port" -placeholder = "1212" default = "1212" -required = true +name = "api_port" order = 5 +placeholder = "1212" +prompt = "API Port" +required = true +type = "text" # Summary [[elements]] -name = "summary_header" -type = "section_header" -title = "✅ Configuration Summary" border_top = true +name = "summary_header" +title = "✅ Configuration Summary" +type = "section_header" [[elements]] -name = "summary" -type = "section" content = "Review your tracker configuration above. Click submit to save settings." +name = "summary" order = 6 +type = "section" diff --git a/examples/05-fragments/constraints.toml b/examples/05-fragments/constraints.toml index a72ec73..7ecdce4 100644 --- a/examples/05-fragments/constraints.toml +++ b/examples/05-fragments/constraints.toml @@ -9,12 +9,12 @@ [tracker.udp] # UDP tracker listeners - BitTorrent standard port 6969 -min_items = 0 max_items = 4 +min_items = 0 unique = true [tracker.http] # HTTP tracker listeners - Standard HTTP/HTTPS ports 80/443 -min_items = 0 max_items = 4 +min_items = 0 unique = true diff --git a/examples/05-fragments/custom_border_section.toml b/examples/05-fragments/custom_border_section.toml index 4c721ee..5b217f0 100644 --- a/examples/05-fragments/custom_border_section.toml +++ b/examples/05-fragments/custom_border_section.toml @@ -1,25 +1,25 @@ name = "custom_border_fragment" [[elements]] -name = "custom_section_header" -type = "section" -title = "🎨 Custom Border Styles" border_top = true -order = 1 border_top_char = "-" border_top_len = 50 +name = "custom_section_header" +order = 1 +title = "🎨 Custom Border Styles" +type = "section" [[elements]] -name = "custom_info" -type = "section" content = "Top border uses '-' (50 chars), bottom border uses '*' (40 chars)" +name = "custom_info" order = 2 +type = "section" [[elements]] -name = "custom_section_footer" -type = "section" -content = "You can have different styles for top and bottom borders!" border_bottom = true -order = 3 border_bottom_char = "*" border_bottom_len = 40 +content = "You can have different styles for top and bottom borders!" +name = "custom_section_footer" +order = 3 +type = "section" diff --git a/examples/05-fragments/employee_info_section.toml b/examples/05-fragments/employee_info_section.toml index 1df8194..1105e3b 100644 --- a/examples/05-fragments/employee_info_section.toml +++ b/examples/05-fragments/employee_info_section.toml @@ -1,58 +1,58 @@ name = "employee_fragment" [[elements]] -name = "employee_header" -type = "section" -title = "👤 Employee Information" border_top = true -order = 1 margin_left = 2 +name = "employee_header" +order = 1 +title = "👤 Employee Information" +type = "section" [[elements]] -name = "employee_info" -type = "section" content = "Please provide your employment details" -order = 2 margin_left = 2 +name = "employee_info" +order = 2 +type = "section" [[elements]] name = "employee_name" -type = "text" +order = 3 prompt = "Full Name" required = true -order = 3 +type = "text" [[elements]] name = "employee_email" -type = "text" +order = 4 prompt = "Work Email" required = true -order = 4 +type = "text" [[elements]] name = "employee_department" -type = "select" -prompt = "Department" options = [ - { value = "Engineering", label = "💻 Engineering" }, - { value = "Sales", label = "💼 Sales" }, - { value = "Marketing", label = "📢 Marketing" }, - { value = "HR", label = "👥 Human Resources" }, - { value = "Finance", label = "💰 Finance" }, + { value = "Engineering", label = "💻 Engineering" }, + { value = "Sales", label = "💼 Sales" }, + { value = "Marketing", label = "📢 Marketing" }, + { value = "HR", label = "👥 Human Resources" }, + { value = "Finance", label = "💰 Finance" }, ] -required = true order = 5 +prompt = "Department" +required = true +type = "select" [[elements]] name = "employee_start_date" -type = "date" +order = 6 prompt = "Start Date" required = true -order = 6 +type = "date" [[elements]] -name = "employee_footer" -type = "section" -content = "Please ensure all information is accurate" border_bottom = true +content = "Please ensure all information is accurate" +name = "employee_footer" order = 7 +type = "section" diff --git a/examples/05-fragments/enterprise_section.toml b/examples/05-fragments/enterprise_section.toml index c330cfe..b40d534 100644 --- a/examples/05-fragments/enterprise_section.toml +++ b/examples/05-fragments/enterprise_section.toml @@ -1,38 +1,38 @@ name = "enterprise_fragment" [[elements]] -name = "enterprise_header" -type = "section" -title = "🏛️ Enterprise Solution" border_top = true +margin_left = 2 +name = "enterprise_header" order = 1 -margin_left = 2 +title = "🏛️ Enterprise Solution" +type = "section" [[elements]] -name = "enterprise_warning" -type = "section" content = "⚠️ Requires enterprise agreement and custom setup" -order = 2 margin_left = 2 +name = "enterprise_warning" +order = 2 +type = "section" [[elements]] -name = "enterprise_features" -type = "section" -content = "✓ Unlimited everything\n✓ Dedicated support team\n✓ Custom integration\n✓ SLA guarantee\n✓ On-premise option\n✓ 24/7 phone support" border_bottom = true -order = 3 +content = "✓ Unlimited everything\n✓ Dedicated support team\n✓ Custom integration\n✓ SLA guarantee\n✓ On-premise option\n✓ 24/7 phone support" margin_left = 2 +name = "enterprise_features" +order = 3 +type = "section" [[elements]] name = "enterprise_contact_name" -type = "text" +order = 4 prompt = "Enterprise contact person" required = true -order = 4 +type = "text" [[elements]] name = "enterprise_contact_email" -type = "text" +order = 5 prompt = "Contact email" required = true -order = 5 +type = "text" diff --git a/examples/05-fragments/fancy_border_section.toml b/examples/05-fragments/fancy_border_section.toml index 8143efe..60a0ed4 100644 --- a/examples/05-fragments/fancy_border_section.toml +++ b/examples/05-fragments/fancy_border_section.toml @@ -1,34 +1,34 @@ name = "fancy_border_fragment" [[elements]] -name = "fancy_header" -type = "section" -title = "╔════════ FANCY BORDER ════════╗" -border_top = true -order = 1 border_margin_left = 0 -content_margin_left = 4 -border_top_l = "╔" +border_top = true border_top_char = "═" +border_top_l = "╔" border_top_len = 35 border_top_r = "╗" - -[[elements]] -name = "fancy_content" -type = "section" -content = "This demonstrates fancy corner characters and borders" -order = 2 -margin_left = 4 - -[[elements]] -name = "fancy_footer" -type = "section" -content = "You can create beautiful box designs with Unicode!" -border_bottom = true -order = 3 -border_margin_left = 0 content_margin_left = 4 -border_bottom_l = "╚" +name = "fancy_header" +order = 1 +title = "╔════════ FANCY BORDER ════════╗" +type = "section" + +[[elements]] +content = "This demonstrates fancy corner characters and borders" +margin_left = 4 +name = "fancy_content" +order = 2 +type = "section" + +[[elements]] +border_bottom = true border_bottom_char = "═" +border_bottom_l = "╚" border_bottom_len = 35 border_bottom_r = "╝" +border_margin_left = 0 +content = "You can create beautiful box designs with Unicode!" +content_margin_left = 4 +name = "fancy_footer" +order = 3 +type = "section" diff --git a/examples/05-fragments/form_with_groups_includes.toml b/examples/05-fragments/form_with_groups_includes.toml index 6ca05ed..990b7bd 100644 --- a/examples/05-fragments/form_with_groups_includes.toml +++ b/examples/05-fragments/form_with_groups_includes.toml @@ -1,52 +1,52 @@ -name = "Modular Form with Groups & Includes" description = "Compose form from reusable fragment files" +name = "Modular Form with Groups & Includes" # Include main header from fragment (paths relative to this file) [[elements]] -name = "main_group" -type = "group" -order = 1 includes = ["fragments/header.toml"] +name = "main_group" +order = 1 +type = "group" # Account type selection [[elements]] name = "account_plan" -type = "select" -prompt = "Select your plan" options = [ - { value = "Personal", label = "Personal - Individual Users" }, - { value = "Premium", label = "Premium - Growing Teams" }, - { value = "Enterprise", label = "Enterprise - Large Organizations" }, + { value = "Personal", label = "Personal - Individual Users" }, + { value = "Premium", label = "Premium - Growing Teams" }, + { value = "Enterprise", label = "Enterprise - Large Organizations" }, ] -required = true order = 2 +prompt = "Select your plan" +required = true +type = "select" # Premium section - conditionally loaded from fragment [[elements]] -name = "premium_group" -type = "group" -order = 3 -when = "account_plan == Premium" includes = ["fragments/premium_section.toml"] +name = "premium_group" +order = 3 +type = "group" +when = "account_plan == Premium" # Enterprise section - conditionally loaded from fragment [[elements]] -name = "enterprise_group" -type = "group" -order = 4 -when = "account_plan == Enterprise" includes = ["fragments/enterprise_section.toml"] +name = "enterprise_group" +order = 4 +type = "group" +when = "account_plan == Enterprise" # Support section - always included from fragment [[elements]] -name = "support_group" -type = "group" -order = 5 includes = ["fragments/support_section.toml"] +name = "support_group" +order = 5 +type = "group" # Agreement section - always included from fragment [[elements]] -name = "agreement_group" -type = "group" -order = 6 includes = ["fragments/agreement_section.toml"] +name = "agreement_group" +order = 6 +type = "group" diff --git a/examples/05-fragments/fragments/tracker-http-item.toml b/examples/05-fragments/fragments/tracker-http-item.toml index 98bc95a..d36ef28 100644 --- a/examples/05-fragments/fragments/tracker-http-item.toml +++ b/examples/05-fragments/fragments/tracker-http-item.toml @@ -1,35 +1,35 @@ -name = "tracker_http_item" description = "HTTP Tracker listener configuration" display_mode = "complete" +name = "tracker_http_item" [[elements]] -name = "bind_address" -type = "text" -prompt = "HTTP Bind Address" -placeholder = "0.0.0.0:7070" default = "0.0.0.0:7070" help = "Format: :. Standard port is 80 for HTTP, 443 for HTTPS" -required = true +name = "bind_address" order = 1 - -[[elements]] -name = "protocol" -type = "select" -prompt = "Protocol" -default = "http" -options = [ - { value = "http", label = "HTTP (unencrypted)" }, - { value = "https", label = "HTTPS (encrypted)" }, -] +placeholder = "0.0.0.0:7070" +prompt = "HTTP Bind Address" required = true -order = 2 +type = "text" + +[[elements]] +default = "http" +name = "protocol" +options = [ + { value = "http", label = "HTTP (unencrypted)" }, + { value = "https", label = "HTTPS (encrypted)" }, +] +order = 2 +prompt = "Protocol" +required = true +type = "select" [[elements]] -name = "workers" -type = "text" -prompt = "Worker Threads" -placeholder = "8" default = "8" help = "Number of concurrent worker threads" -required = false +name = "workers" order = 3 +placeholder = "8" +prompt = "Worker Threads" +required = false +type = "text" diff --git a/examples/05-fragments/fragments/tracker-udp-item.toml b/examples/05-fragments/fragments/tracker-udp-item.toml index 15ec3da..29910b9 100644 --- a/examples/05-fragments/fragments/tracker-udp-item.toml +++ b/examples/05-fragments/fragments/tracker-udp-item.toml @@ -1,23 +1,23 @@ -name = "tracker_udp_item" description = "UDP Tracker listener configuration" display_mode = "complete" +name = "tracker_udp_item" [[elements]] -name = "bind_address" -type = "text" -prompt = "UDP Bind Address" -placeholder = "0.0.0.0:6969" default = "0.0.0.0:6969" help = "Format: :. Use 0.0.0.0 to listen on all interfaces" -required = true +name = "bind_address" order = 1 +placeholder = "0.0.0.0:6969" +prompt = "UDP Bind Address" +required = true +type = "text" [[elements]] -name = "workers" -type = "text" -prompt = "Worker Threads" -placeholder = "4" default = "4" help = "Number of concurrent worker threads" -required = false +name = "workers" order = 2 +placeholder = "4" +prompt = "Worker Threads" +required = false +type = "text" diff --git a/examples/05-fragments/header.toml b/examples/05-fragments/header.toml index 31b807f..6afbb86 100644 --- a/examples/05-fragments/header.toml +++ b/examples/05-fragments/header.toml @@ -1,15 +1,15 @@ name = "header_fragment" [[elements]] -name = "main_header" -type = "header" -title = "✨ Form with Modular Sections" -border_top = true -border_bottom = true align = "center" -order = 1 -margin_left = 0 -border_top_char = "═" -border_top_len = 60 +border_bottom = true border_bottom_char = "═" border_bottom_len = 60 +border_top = true +border_top_char = "═" +border_top_len = 60 +margin_left = 0 +name = "main_header" +order = 1 +title = "✨ Form with Modular Sections" +type = "header" diff --git a/examples/05-fragments/premium_section.toml b/examples/05-fragments/premium_section.toml index f123460..d7b671d 100644 --- a/examples/05-fragments/premium_section.toml +++ b/examples/05-fragments/premium_section.toml @@ -1,29 +1,29 @@ name = "premium_fragment" [[elements]] -name = "premium_header" -type = "section" -title = "🌟 Premium Features" border_top = true -order = 1 margin_left = 2 +name = "premium_header" +order = 1 +title = "🌟 Premium Features" +type = "section" [[elements]] -name = "premium_features" -type = "section" -content = "✓ Unlimited storage\n✓ Advanced analytics\n✓ Priority support\n✓ Custom branding\n✓ API access" border_bottom = true -order = 2 +content = "✓ Unlimited storage\n✓ Advanced analytics\n✓ Priority support\n✓ Custom branding\n✓ API access" margin_left = 2 +name = "premium_features" +order = 2 +type = "section" [[elements]] name = "premium_payment_method" -type = "select" -prompt = "Payment method" options = [ - { value = "Credit Card", label = "💳 Credit Card" }, - { value = "Bank Transfer", label = "🏦 Bank Transfer" }, - { value = "PayPal", label = "🅿️ PayPal" }, + { value = "Credit Card", label = "💳 Credit Card" }, + { value = "Bank Transfer", label = "🏦 Bank Transfer" }, + { value = "PayPal", label = "🅿️ PayPal" }, ] -required = true order = 3 +prompt = "Payment method" +required = true +type = "select" diff --git a/examples/05-fragments/support_section.toml b/examples/05-fragments/support_section.toml index 62e9145..a43fff7 100644 --- a/examples/05-fragments/support_section.toml +++ b/examples/05-fragments/support_section.toml @@ -1,35 +1,35 @@ name = "support_fragment" [[elements]] -name = "support_header" -type = "section" -title = "📞 Support Options" border_top = true -order = 1 margin_left = 2 +name = "support_header" +order = 1 +title = "📞 Support Options" +type = "section" [[elements]] -name = "support_info" -type = "section" content = "Choose your preferred support level" -order = 2 margin_left = 2 +name = "support_info" +order = 2 +type = "section" [[elements]] name = "support_level" -type = "select" -prompt = "Support Level" options = [ - { value = "Basic", label = "Basic - Email only" }, - { value = "Standard", label = "Standard - Email & chat" }, - { value = "Premium", label = "Premium - Phone & live support" }, + { value = "Basic", label = "Basic - Email only" }, + { value = "Standard", label = "Standard - Email & chat" }, + { value = "Premium", label = "Premium - Phone & live support" }, ] -required = true order = 3 +prompt = "Support Level" +required = true +type = "select" [[elements]] -name = "support_footer" -type = "section" -content = "Support is available 24/7 for Premium plans" border_bottom = true +content = "Support is available 24/7 for Premium plans" +name = "support_footer" order = 4 +type = "section" diff --git a/examples/06-i18n/en-US.toml b/examples/06-i18n/en-US.toml index 61bf405..34e7846 100644 --- a/examples/06-i18n/en-US.toml +++ b/examples/06-i18n/en-US.toml @@ -1,31 +1,31 @@ # English translations (alternative TOML format) [forms.registration] -title = "User Registration" description = "Create a new user account" -username-label = "Username" -username-prompt = "Please enter a username" -username-placeholder = "user123" email-label = "Email Address" -email-prompt = "Please enter your email address" email-placeholder = "user@example.com" +email-prompt = "Please enter your email address" +title = "User Registration" +username-label = "Username" +username-placeholder = "user123" +username-prompt = "Please enter a username" -[forms.registration.roles] -admin = "Administrator" -user = "Regular User" -guest = "Guest" -developer = "Developer" + [forms.registration.roles] + admin = "Administrator" + developer = "Developer" + guest = "Guest" + user = "Regular User" [forms.employee-onboarding] -title = "Employee Onboarding" -description = "Complete your onboarding process" -welcome = "Welcome to the team!" -full-name-prompt = "What is your full name?" department-prompt = "Which department are you joining?" +description = "Complete your onboarding process" +full-name-prompt = "What is your full name?" start-date-prompt = "What is your start date?" +title = "Employee Onboarding" +welcome = "Welcome to the team!" [forms.feedback] -title = "Feedback Form" -overall-satisfaction-prompt = "How satisfied are you with our service?" -improvement-prompt = "What could we improve?" contact-prompt = "Can we contact you with follow-up questions?" +improvement-prompt = "What could we improve?" +overall-satisfaction-prompt = "How satisfied are you with our service?" +title = "Feedback Form" diff --git a/examples/06-i18n/es-ES.toml b/examples/06-i18n/es-ES.toml index 79fd0ab..17e7940 100644 --- a/examples/06-i18n/es-ES.toml +++ b/examples/06-i18n/es-ES.toml @@ -1,31 +1,31 @@ # Traducciones al español (formato TOML alternativo) [forms.registration] -title = "Registro de Usuario" description = "Crear una nueva cuenta de usuario" -username-label = "Nombre de usuario" -username-prompt = "Por favor, ingrese su nombre de usuario" -username-placeholder = "usuario123" email-label = "Correo electrónico" -email-prompt = "Por favor, ingrese su correo electrónico" email-placeholder = "usuario@ejemplo.com" +email-prompt = "Por favor, ingrese su correo electrónico" +title = "Registro de Usuario" +username-label = "Nombre de usuario" +username-placeholder = "usuario123" +username-prompt = "Por favor, ingrese su nombre de usuario" -[forms.registration.roles] -admin = "Administrador" -user = "Usuario Regular" -guest = "Invitado" -developer = "Desarrollador" + [forms.registration.roles] + admin = "Administrador" + developer = "Desarrollador" + guest = "Invitado" + user = "Usuario Regular" [forms.employee-onboarding] -title = "Incorporación de Empleado" -description = "Complete su proceso de incorporación" -welcome = "¡Bienvenido al equipo!" -full-name-prompt = "¿Cuál es su nombre completo?" department-prompt = "¿A cuál departamento se está uniendo?" +description = "Complete su proceso de incorporación" +full-name-prompt = "¿Cuál es su nombre completo?" start-date-prompt = "¿Cuál es su fecha de inicio?" +title = "Incorporación de Empleado" +welcome = "¡Bienvenido al equipo!" [forms.feedback] -title = "Formulario de Retroalimentación" -overall-satisfaction-prompt = "¿Cuán satisfecho está con nuestro servicio?" -improvement-prompt = "¿Qué podríamos mejorar?" contact-prompt = "¿Podemos contactarlo con preguntas de seguimiento?" +improvement-prompt = "¿Qué podríamos mejorar?" +overall-satisfaction-prompt = "¿Cuán satisfecho está con nuestro servicio?" +title = "Formulario de Retroalimentación" diff --git a/examples/06-integrations/i18n/registration_i18n.toml b/examples/06-integrations/i18n/registration_i18n.toml index 475e815..14a8ac7 100644 --- a/examples/06-integrations/i18n/registration_i18n.toml +++ b/examples/06-integrations/i18n/registration_i18n.toml @@ -1,58 +1,58 @@ -name = "user_registration" description = "Register a new user account with multi-language support" locale = "es-ES" +name = "user_registration" [[items]] -name = "header" -type = "header" -title = "forms.registration.title" -i18n = true -border_top = true border_bottom = true +border_top = true +i18n = true +name = "header" +title = "forms.registration.title" +type = "header" [[items]] +content = "Complete the form to create your account" name = "description" type = "section" -content = "Complete the form to create your account" [[fields]] +i18n = true name = "username" -type = "text" -prompt = "forms.registration.username-prompt" placeholder = "forms.registration.username-placeholder" -i18n = true +prompt = "forms.registration.username-prompt" required = true - -[[fields]] -name = "email" type = "text" -prompt = "forms.registration.email-prompt" + +[[fields]] +i18n = true +name = "email" placeholder = "forms.registration.email-placeholder" -i18n = true +prompt = "forms.registration.email-prompt" required = true +type = "text" [[fields]] +i18n = true name = "role" -type = "select" -prompt = "forms.registration.role-prompt" options = [ - { value = "admin", label = "forms.registration.roles.admin" }, - { value = "user", label = "forms.registration.roles.user" }, - { value = "guest", label = "forms.registration.roles.guest" }, + { value = "admin", label = "forms.registration.roles.admin" }, + { value = "user", label = "forms.registration.roles.user" }, + { value = "guest", label = "forms.registration.roles.guest" }, ] -i18n = true +prompt = "forms.registration.role-prompt" required = true +type = "select" [[fields]] -name = "agree_terms" -type = "confirm" -prompt = "forms.registration.registration-confirm-prompt" -i18n = true -required = true default = false +i18n = true +name = "agree_terms" +prompt = "forms.registration.registration-confirm-prompt" +required = true +type = "confirm" [[items]] +border_top = true +content = "Your data will be securely stored and protected." name = "footer" type = "footer" -content = "Your data will be securely stored and protected." -border_top = true diff --git a/examples/06-integrations/i18n/test_i18n_form.toml b/examples/06-integrations/i18n/test_i18n_form.toml index 35e9452..2a34ef9 100644 --- a/examples/06-integrations/i18n/test_i18n_form.toml +++ b/examples/06-integrations/i18n/test_i18n_form.toml @@ -1,22 +1,22 @@ -name = "test_i18n" description = "Test i18n form" locale = "es-ES" +name = "test_i18n" [[fields]] +i18n = true name = "username" -type = "text" -prompt = "registration-username-prompt" placeholder = "registration-username-placeholder" -i18n = true +prompt = "registration-username-prompt" +type = "text" [[fields]] -name = "role" -type = "select" -prompt = "role-prompt" -options = [ - { value = "admin", label = "role-admin" }, - { value = "user", label = "role-user" }, - { value = "guest", label = "role-guest" }, -] -i18n = true default = "user" +i18n = true +name = "role" +options = [ + { value = "admin", label = "role-admin" }, + { value = "user", label = "role-user" }, + { value = "guest", label = "role-guest" }, +] +prompt = "role-prompt" +type = "select" diff --git a/examples/07-nickel-generation/arrays-form.toml b/examples/07-nickel-generation/arrays-form.toml index a5ad568..2d24ad7 100644 --- a/examples/07-nickel-generation/arrays-form.toml +++ b/examples/07-nickel-generation/arrays-form.toml @@ -1,198 +1,198 @@ -name = "Tracker Configuration with Arrays" description = "Complete example showing RepeatingGroup arrays in action with Nickel schema integration" display_mode = "complete" +name = "Tracker Configuration with Arrays" # Header [[elements]] -name = "main_header" -type = "section_header" -title = "🎯 Tracker & API Configuration" -border_top = true border_bottom = true +border_top = true +name = "main_header" +title = "🎯 Tracker & API Configuration" +type = "section_header" [[elements]] +content = "Configure tracker listeners and API endpoints. You can add multiple UDP/HTTP listeners and manage users and API endpoints dynamically." name = "intro" type = "section" -content = "Configure tracker listeners and API endpoints. You can add multiple UDP/HTTP listeners and manage users and API endpoints dynamically." # ======================================================== # TRACKER CONFIGURATION # ======================================================== [[elements]] -name = "tracker_section_header" -type = "section_header" -title = "📡 Tracker Configuration" border_top = true +name = "tracker_section_header" +title = "📡 Tracker Configuration" +type = "section_header" [[elements]] +default = "public" name = "tracker_mode" -type = "select" +options = [ + { value = "public", label = "Public Tracker (anyone can use)" }, + { value = "private", label = "Private Tracker (registered users only)" }, +] +order = 1 prompt = "Tracker Mode" required = true -options = [ - { value = "public", label = "Public Tracker (anyone can use)" }, - { value = "private", label = "Private Tracker (registered users only)" }, -] -default = "public" -order = 1 +type = "select" # UDP Trackers - Array of listeners [[elements]] -name = "udp_trackers" -type = "repeatinggroup" -prompt = "UDP Tracker Listeners" -fragment = "fragments/tracker-udp-item.toml" -min_items = 0 -max_items = 10 default_items = 1 -unique = true -required = false +fragment = "fragments/tracker-udp-item.toml" help = "Add UDP tracker listener addresses (must be unique). Standard BitTorrent port is 6969." +max_items = 10 +min_items = 0 +name = "udp_trackers" nickel_path = ["udp_trackers"] order = 2 +prompt = "UDP Tracker Listeners" +required = false +type = "repeatinggroup" +unique = true # HTTP Trackers - Array of listeners [[elements]] -name = "http_trackers" -type = "repeatinggroup" -prompt = "HTTP Tracker Listeners" -fragment = "fragments/tracker-http-item.toml" -min_items = 0 -max_items = 10 default_items = 1 -unique = true -required = false +fragment = "fragments/tracker-http-item.toml" help = "Add HTTP tracker listener addresses (must be unique). Standard ports: 80 (HTTP), 443 (HTTPS)" +max_items = 10 +min_items = 0 +name = "http_trackers" nickel_path = ["http_trackers"] order = 3 +prompt = "HTTP Tracker Listeners" +required = false +type = "repeatinggroup" +unique = true # ======================================================== # API CONFIGURATION # ======================================================== [[elements]] -name = "api_section_header" -type = "section_header" -title = "📡 API Configuration" -border_top = true border_bottom = true +border_top = true +name = "api_section_header" +title = "📡 API Configuration" +type = "section_header" [[elements]] -name = "api_token" -type = "password" -prompt = "Admin API Token" -required = true help = "Secure token for API authentication and access control" +name = "api_token" nickel_path = ["api_token"] order = 4 +prompt = "Admin API Token" +required = true +type = "password" [[elements]] -name = "api_port" -type = "text" -prompt = "API Port" -placeholder = "1212" default = "1212" -required = true help = "Port number for API server (1024-65535). Standard: 1212" +name = "api_port" nickel_path = ["api_port"] order = 5 +placeholder = "1212" +prompt = "API Port" +required = true +type = "text" # API Endpoints - Array of exposed endpoints [[elements]] -name = "api_endpoints" -type = "repeatinggroup" -prompt = "API Endpoints" -fragment = "fragments/api-endpoint-item.toml" -min_items = 0 -max_items = 20 default_items = 0 -unique = true -required = false +fragment = "fragments/api-endpoint-item.toml" help = "Define custom API endpoints (must be unique). Each endpoint path must be different." +max_items = 20 +min_items = 0 +name = "api_endpoints" nickel_path = ["api_endpoints"] order = 6 +prompt = "API Endpoints" +required = false +type = "repeatinggroup" +unique = true # ======================================================== # USER MANAGEMENT # ======================================================== [[elements]] -name = "users_section_header" -type = "section_header" -title = "👥 User Management" -border_top = true border_bottom = true +border_top = true +name = "users_section_header" +title = "👥 User Management" +type = "section_header" [[elements]] -name = "users" -type = "repeatinggroup" -prompt = "User Accounts" -fragment = "fragments/user-item.toml" -min_items = 0 -max_items = 100 default_items = 0 -unique = true -required = false +fragment = "fragments/user-item.toml" help = "Add user accounts (must be unique). Each username must be different." +max_items = 100 +min_items = 0 +name = "users" nickel_path = ["users"] order = 7 +prompt = "User Accounts" +required = false +type = "repeatinggroup" +unique = true # ======================================================== # OPTIONAL FEATURES # ======================================================== [[elements]] -name = "features_section_header" -type = "section_header" -title = "⚙️ Optional Features" -border_top = true border_bottom = true +border_top = true +name = "features_section_header" +title = "⚙️ Optional Features" +type = "section_header" [[elements]] -name = "enable_metrics" -type = "confirm" -prompt = "Enable metrics collection" default = false help = "Track performance metrics and statistics" +name = "enable_metrics" nickel_path = ["enable_metrics"] order = 8 +prompt = "Enable metrics collection" +type = "confirm" [[elements]] -name = "enable_logging" -type = "confirm" -prompt = "Enable logging" default = true help = "Log application events and errors" +name = "enable_logging" nickel_path = ["enable_logging"] order = 9 +prompt = "Enable logging" +type = "confirm" [[elements]] -name = "log_level" -type = "select" -prompt = "Log Level" -when = "enable_logging == true" default = "info" -options = [ - { value = "debug", label = "Debug - All events" }, - { value = "info", label = "Info - Important events" }, - { value = "warn", label = "Warn - Warnings and errors" }, - { value = "error", label = "Error - Errors only" }, -] +name = "log_level" nickel_path = ["log_level"] +options = [ + { value = "debug", label = "Debug - All events" }, + { value = "info", label = "Info - Important events" }, + { value = "warn", label = "Warn - Warnings and errors" }, + { value = "error", label = "Error - Errors only" }, +] order = 10 +prompt = "Log Level" +type = "select" +when = "enable_logging == true" # ======================================================== # SUMMARY # ======================================================== [[elements]] -name = "summary_header" -type = "section_header" -title = "✅ Configuration Summary" border_top = true +name = "summary_header" +title = "✅ Configuration Summary" +type = "section_header" [[elements]] +content = "Review your configuration above. All settings will be validated against the Nickel schema before saving." name = "summary" type = "section" -content = "Review your configuration above. All settings will be validated against the Nickel schema before saving." diff --git a/examples/07-nickel-generation/fragments/api-endpoint-item.toml b/examples/07-nickel-generation/fragments/api-endpoint-item.toml index 43f8afa..2a8e8ac 100644 --- a/examples/07-nickel-generation/fragments/api-endpoint-item.toml +++ b/examples/07-nickel-generation/fragments/api-endpoint-item.toml @@ -1,29 +1,29 @@ -name = "api_endpoint_item" description = "API Endpoint configuration" display_mode = "complete" +name = "api_endpoint_item" [[elements]] -name = "path" -type = "text" -prompt = "Endpoint Path" -placeholder = "/api/v1/stats" help = "API endpoint path (e.g., /api/v1/stats, /api/v2/submit)" -required = true +name = "path" order = 1 +placeholder = "/api/v1/stats" +prompt = "Endpoint Path" +required = true +type = "text" [[elements]] -name = "require_auth" -type = "confirm" -prompt = "Require Authentication" default = true help = "Require admin token for this endpoint" +name = "require_auth" order = 2 +prompt = "Require Authentication" +type = "confirm" [[elements]] -name = "rate_limit" -type = "text" -prompt = "Rate Limit (req/min)" -placeholder = "100" default = "100" help = "Maximum requests per minute (0 = unlimited)" +name = "rate_limit" order = 3 +placeholder = "100" +prompt = "Rate Limit (req/min)" +type = "text" diff --git a/examples/07-nickel-generation/fragments/user-item.toml b/examples/07-nickel-generation/fragments/user-item.toml index 9412011..5f903d6 100644 --- a/examples/07-nickel-generation/fragments/user-item.toml +++ b/examples/07-nickel-generation/fragments/user-item.toml @@ -1,42 +1,42 @@ -name = "user_item" description = "User account configuration" display_mode = "complete" +name = "user_item" [[elements]] -name = "username" -type = "text" -prompt = "Username" -placeholder = "john_doe" help = "Unique username (alphanumeric and underscores)" -required = true +name = "username" order = 1 - -[[elements]] -name = "email" +placeholder = "john_doe" +prompt = "Username" +required = true type = "text" -prompt = "Email Address" -placeholder = "user@example.com" + +[[elements]] help = "User email address" -required = true +name = "email" order = 2 - -[[elements]] -name = "role" -type = "select" -prompt = "User Role" -default = "user" -options = [ - { value = "admin", label = "Admin (full access)" }, - { value = "moderator", label = "Moderator (moderation only)" }, - { value = "user", label = "User (basic access)" }, -] +placeholder = "user@example.com" +prompt = "Email Address" required = true -order = 3 +type = "text" + +[[elements]] +default = "user" +name = "role" +options = [ + { value = "admin", label = "Admin (full access)" }, + { value = "moderator", label = "Moderator (moderation only)" }, + { value = "user", label = "User (basic access)" }, +] +order = 3 +prompt = "User Role" +required = true +type = "select" [[elements]] -name = "active" -type = "confirm" -prompt = "Active" default = true help = "Enable or disable user account" +name = "active" order = 4 +prompt = "Active" +type = "confirm" diff --git a/examples/08-encryption/credentials.toml b/examples/08-encryption/credentials.toml index ee91889..092acd1 100644 --- a/examples/08-encryption/credentials.toml +++ b/examples/08-encryption/credentials.toml @@ -24,9 +24,9 @@ # typedialog form examples/08-encryption/credentials.toml \ # --encrypt --backend secretumvault --format json -name = "user_credentials" description = "User credentials with encryption support" display_mode = "complete" +name = "user_credentials" # ============================================================================ # Non-sensitive fields (will be output as plaintext) @@ -34,24 +34,24 @@ display_mode = "complete" [[fields]] name = "username" -type = "text" prompt = "Username" required = true sensitive = false +type = "text" [[fields]] name = "email" -type = "text" prompt = "Email address" required = true sensitive = false +type = "text" [[fields]] name = "company" -type = "text" prompt = "Company (optional)" required = false sensitive = false +type = "text" # ============================================================================ # Sensitive fields - Auto-detected (FieldType::Password = sensitive by default) @@ -59,16 +59,16 @@ sensitive = false [[fields]] name = "password" -type = "password" prompt = "Password" required = true +type = "password" # sensitive not specified - auto-detected as true from FieldType::Password [[fields]] name = "confirm_password" -type = "password" prompt = "Confirm password" required = true +type = "password" # ============================================================================ # Sensitive fields - Explicit (sensitive = true) @@ -76,26 +76,26 @@ required = true # ============================================================================ [[fields]] +encryption_backend = "age" name = "api_token" -type = "text" prompt = "API Token" required = false sensitive = true -encryption_backend = "age" +type = "text" [[fields]] name = "ssh_key" -type = "editor" prompt = "SSH Private Key (multiline)" required = false sensitive = true +type = "editor" [[fields]] name = "database_url" -type = "text" prompt = "Database Connection String" required = false sensitive = true +type = "text" # ============================================================================ # Encryption configuration per field (optional) @@ -103,36 +103,36 @@ sensitive = true # ============================================================================ [[fields]] +encryption_backend = "sops" name = "vault_token" -type = "text" prompt = "Vault Token (encrypted with SOPS)" required = false sensitive = true -encryption_backend = "sops" +type = "text" # Note: SOPS reads configuration from .sops.yaml in current directory or parent # No additional config needed - SOPS uses .sops.yaml for KMS setup [[fields]] +encryption_backend = "awskms" name = "kms_key_id" -type = "text" prompt = "AWS KMS Key ID (encrypted with AWS KMS)" required = false sensitive = true -encryption_backend = "awskms" +type = "text" -[fields.encryption_config] -region = "us-east-1" -key_id = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" + [fields.encryption_config] + key_id = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" + region = "us-east-1" -# ============================================================================ -# Non-sensitive field (explicit override) -# Note: This field is type=password but marked as NOT sensitive -# Will be output as plaintext (useful for test/demo passwords) -# ============================================================================ + # ============================================================================ + # Non-sensitive field (explicit override) + # Note: This field is type=password but marked as NOT sensitive + # Will be output as plaintext (useful for test/demo passwords) + # ============================================================================ [[fields]] name = "demo_password" -type = "password" prompt = "Demo password (shown in plaintext)" required = false sensitive = false +type = "password" diff --git a/examples/08-encryption/multi-backend-sops.toml b/examples/08-encryption/multi-backend-sops.toml index 5f8496a..6c17a04 100644 --- a/examples/08-encryption/multi-backend-sops.toml +++ b/examples/08-encryption/multi-backend-sops.toml @@ -31,9 +31,9 @@ # --encrypt --backend secretumvault --format json # -name = "multi_backend_config" description = "Configuration with multiple encryption backends for different environments" display_mode = "complete" +name = "multi_backend_config" # ============================================================================ # Application Configuration (Non-sensitive) @@ -41,26 +41,26 @@ display_mode = "complete" [[fields]] name = "app_name" -type = "text" prompt = "Application name" required = true sensitive = false +type = "text" [[fields]] name = "environment" -type = "select" +options = ["development", "staging", "production"] prompt = "Environment" required = true sensitive = false -options = ["development", "staging", "production"] +type = "select" [[fields]] name = "log_level" -type = "select" +options = ["debug", "info", "warn", "error"] prompt = "Log level" required = false sensitive = false -options = ["debug", "info", "warn", "error"] +type = "select" # ============================================================================ # Database Configuration @@ -69,33 +69,33 @@ options = ["debug", "info", "warn", "error"] [[fields]] name = "db_host" -type = "text" prompt = "Database hostname" required = true sensitive = false +type = "text" [[fields]] +default = "5432" name = "db_port" -type = "text" prompt = "Database port" required = false sensitive = false -default = "5432" +type = "text" [[fields]] name = "db_username" -type = "text" prompt = "Database username" required = true sensitive = false +type = "text" [[fields]] +encryption_backend = "sops" name = "db_password" -type = "password" prompt = "Database password (encrypted with SOPS)" required = true sensitive = true -encryption_backend = "sops" +type = "password" # Note: SOPS configuration comes from .sops.yaml # Supports AWS KMS, GCP KMS, Azure Key Vault via that config @@ -106,20 +106,20 @@ encryption_backend = "sops" # ============================================================================ [[fields]] +encryption_backend = "age" name = "api_key" -type = "text" prompt = "API Key (encrypted with Age)" required = false sensitive = true -encryption_backend = "age" +type = "text" [[fields]] +encryption_backend = "age" name = "api_secret" -type = "password" prompt = "API Secret (encrypted with Age)" required = false sensitive = true -encryption_backend = "age" +type = "password" # ============================================================================ # Enterprise/Production Secrets @@ -128,50 +128,50 @@ encryption_backend = "age" # ============================================================================ [[fields]] +encryption_backend = "awskms" name = "master_key" -type = "password" prompt = "Master encryption key (AWS KMS protected)" required = false sensitive = true -encryption_backend = "awskms" +type = "password" -[fields.encryption_config] -region = "us-east-1" -key_id = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" + [fields.encryption_config] + key_id = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" + region = "us-east-1" [[fields]] +encryption_backend = "awskms" name = "root_token" -type = "password" prompt = "Root access token (AWS KMS protected)" required = false sensitive = true -encryption_backend = "awskms" +type = "password" -[fields.encryption_config] -region = "us-east-1" -key_id = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" + [fields.encryption_config] + key_id = "arn:aws:kms:us-east-1:123456789012:key/12345678-1234-1234-1234-123456789012" + region = "us-east-1" -# ============================================================================ -# Certificate and Key Material -# Field-level backend: SecretumVault (post-quantum, enterprise) -# Uses Transit Engine for encryption with PQC support -# ============================================================================ + # ============================================================================ + # Certificate and Key Material + # Field-level backend: SecretumVault (post-quantum, enterprise) + # Uses Transit Engine for encryption with PQC support + # ============================================================================ [[fields]] +encryption_backend = "secretumvault" name = "tls_cert" -type = "editor" prompt = "TLS Certificate (SecretumVault with PQC)" required = false sensitive = true -encryption_backend = "secretumvault" +type = "editor" [[fields]] +encryption_backend = "secretumvault" name = "tls_key" -type = "editor" prompt = "TLS Private Key (SecretumVault with PQC)" required = false sensitive = true -encryption_backend = "secretumvault" +type = "editor" # ============================================================================ # Configuration Summary diff --git a/examples/08-encryption/simple-login.toml b/examples/08-encryption/simple-login.toml index df42796..0b7f459 100644 --- a/examples/08-encryption/simple-login.toml +++ b/examples/08-encryption/simple-login.toml @@ -21,20 +21,20 @@ # --encrypt --backend secretumvault --format json # -name = "login" description = "Simple login form with password encryption" display_mode = "complete" +name = "login" [[fields]] name = "username" -type = "text" prompt = "Username" required = true sensitive = false +type = "text" [[fields]] name = "password" -type = "password" prompt = "Password" required = true +type = "password" # sensitive: auto-detected as true from FieldType::Password diff --git a/examples/08-nickel-roundtrip/ci-form.toml b/examples/08-nickel-roundtrip/ci-form.toml index 909f8a0..0123081 100644 --- a/examples/08-nickel-roundtrip/ci-form.toml +++ b/examples/08-nickel-roundtrip/ci-form.toml @@ -1,237 +1,237 @@ -name = "CI Configuration Editor" description = "Interactive form for editing CI/CD configuration" display_mode = "complete" +name = "CI Configuration Editor" # ============================================================================= # PROJECT INFORMATION # ============================================================================= [[elements]] -name = "project_header" -type = "section_header" -title = "📦 Project Information" -border_top = true border_bottom = true +border_top = true +name = "project_header" +title = "📦 Project Information" +type = "section_header" [[elements]] +default = "my-rust-project" name = "project_name" -type = "text" +nickel_path = ["project", "name"] prompt = "Project Name" required = true -default = "my-rust-project" -nickel_path = ["project", "name"] +type = "text" [[elements]] +default = "A Rust project with CI/CD" name = "project_description" -type = "text" +nickel_path = ["project", "description"] prompt = "Project Description" required = true -default = "A Rust project with CI/CD" -nickel_path = ["project", "description"] +type = "text" [[elements]] +default = "https://github.com/example/my-rust-project" name = "project_repository" -type = "text" +nickel_path = ["project", "repository"] prompt = "Repository URL" required = true -default = "https://github.com/example/my-rust-project" -nickel_path = ["project", "repository"] +type = "text" # ============================================================================= # GITHUB ACTIONS CONFIGURATION # ============================================================================= [[elements]] -name = "github_header" -type = "section_header" -title = "🚀 GitHub Actions Configuration" -border_top = true border_bottom = true +border_top = true +name = "github_header" +title = "🚀 GitHub Actions Configuration" +type = "section_header" [[elements]] -name = "enable_github_actions" -type = "confirm" -prompt = "Enable GitHub Actions CI?" default = true +name = "enable_github_actions" nickel_path = ["ci", "github_actions", "enabled"] +prompt = "Enable GitHub Actions CI?" +type = "confirm" [[elements]] -name = "parallel_jobs" -type = "text" -prompt = "Parallel Jobs" default = "4" -when = "enable_github_actions == true" help = "Number of parallel CI jobs (1-20)" +name = "parallel_jobs" nickel_path = ["ci", "github_actions", "parallel_jobs"] +prompt = "Parallel Jobs" +type = "text" +when = "enable_github_actions == true" [[elements]] -name = "timeout_minutes" -type = "text" -prompt = "Job Timeout (minutes)" default = "60" -when = "enable_github_actions == true" help = "Maximum duration for each job" +name = "timeout_minutes" nickel_path = ["ci", "github_actions", "timeout_minutes"] +prompt = "Job Timeout (minutes)" +type = "text" +when = "enable_github_actions == true" # ============================================================================= # RUST CONFIGURATION # ============================================================================= [[elements]] -name = "rust_header" -type = "section_header" -title = "🦀 Rust Configuration" -border_top = true border_bottom = true +border_top = true +name = "rust_header" +title = "🦀 Rust Configuration" +type = "section_header" when = "enable_github_actions == true" [[elements]] -name = "rust_version" -type = "select" -prompt = "Rust Version" default = "stable" -when = "enable_github_actions == true" +name = "rust_version" +nickel_path = ["ci", "github_actions", "rust", "version"] options = [ { value = "stable", label = "Stable - Latest stable release" }, { value = "nightly", label = "Nightly - Cutting edge features" }, { value = "1.70.0", label = "1.70.0 - Specific version" }, ] -nickel_path = ["ci", "github_actions", "rust", "version"] +prompt = "Rust Version" +type = "select" +when = "enable_github_actions == true" # ============================================================================= # CACHING # ============================================================================= [[elements]] -name = "cache_header" -type = "section_header" -title = "💾 Build Cache" -border_top = true border_bottom = true +border_top = true +name = "cache_header" +title = "💾 Build Cache" +type = "section_header" when = "enable_github_actions == true" [[elements]] -name = "enable_cache" -type = "confirm" -prompt = "Enable dependency caching?" default = false -when = "enable_github_actions == true" help = "Cache Cargo dependencies to speed up builds" +name = "enable_cache" nickel_path = ["ci", "github_actions", "cache", "enabled"] +prompt = "Enable dependency caching?" +type = "confirm" +when = "enable_github_actions == true" # ============================================================================= # TOOLS CONFIGURATION # ============================================================================= [[elements]] -name = "tools_header" -type = "section_header" -title = "🔧 CI Tools" -border_top = true border_bottom = true +border_top = true +name = "tools_header" +title = "🔧 CI Tools" +type = "section_header" when = "enable_github_actions == true" [[elements]] -name = "enable_clippy" -type = "confirm" -prompt = "Enable cargo clippy (linter)?" default = true -when = "enable_github_actions == true" help = "Run Rust linter on code" +name = "enable_clippy" nickel_path = ["ci", "github_actions", "tools", "clippy", "enabled"] - -[[elements]] -name = "clippy_args" -type = "text" -prompt = "Clippy Arguments" -default = "-D warnings" -when = "enable_github_actions == true && enable_clippy == true" -help = "Command-line arguments for clippy" -nickel_path = ["ci", "github_actions", "tools", "clippy", "args"] - -[[elements]] -name = "enable_rustfmt" +prompt = "Enable cargo clippy (linter)?" +type = "confirm" +when = "enable_github_actions == true" + +[[elements]] +default = "-D warnings" +help = "Command-line arguments for clippy" +name = "clippy_args" +nickel_path = ["ci", "github_actions", "tools", "clippy", "args"] +prompt = "Clippy Arguments" +type = "text" +when = "enable_github_actions == true && enable_clippy == true" + +[[elements]] +default = true +help = "Check code formatting" +name = "enable_rustfmt" +nickel_path = ["ci", "github_actions", "tools", "rustfmt", "enabled"] +prompt = "Enable rustfmt (formatter)?" type = "confirm" -prompt = "Enable rustfmt (formatter)?" -default = true when = "enable_github_actions == true" -help = "Check code formatting" -nickel_path = ["ci", "github_actions", "tools", "rustfmt", "enabled"] [[elements]] -name = "rustfmt_edition" -type = "select" -prompt = "Rust Edition for rustfmt" default = "2021" -when = "enable_github_actions == true && enable_rustfmt == true" +name = "rustfmt_edition" +nickel_path = ["ci", "github_actions", "tools", "rustfmt", "edition"] options = [ { value = "2015", label = "2015" }, { value = "2018", label = "2018" }, { value = "2021", label = "2021" }, ] -nickel_path = ["ci", "github_actions", "tools", "rustfmt", "edition"] +prompt = "Rust Edition for rustfmt" +type = "select" +when = "enable_github_actions == true && enable_rustfmt == true" [[elements]] -name = "enable_cargo_audit" -type = "confirm" -prompt = "Enable cargo-audit (security)?" default = false -when = "enable_github_actions == true" help = "Scan for security vulnerabilities" +name = "enable_cargo_audit" nickel_path = ["ci", "github_actions", "tools", "cargo_audit", "enabled"] +prompt = "Enable cargo-audit (security)?" +type = "confirm" +when = "enable_github_actions == true" # ============================================================================= # DEPLOYMENT # ============================================================================= [[elements]] -name = "deployment_header" -type = "section_header" -title = "🚢 Deployment" -border_top = true border_bottom = true +border_top = true +name = "deployment_header" +title = "🚢 Deployment" +type = "section_header" [[elements]] -name = "enable_deployment" -type = "confirm" -prompt = "Enable deployment?" default = false help = "Automatically deploy on successful builds" +name = "enable_deployment" nickel_path = ["deployment", "enabled"] +prompt = "Enable deployment?" +type = "confirm" [[elements]] -name = "deployment_environment" -type = "select" -prompt = "Deployment Environment" default = "production" -when = "enable_deployment == true" +name = "deployment_environment" +nickel_path = ["deployment", "environment"] options = [ { value = "development", label = "Development" }, { value = "staging", label = "Staging" }, { value = "production", label = "Production" }, ] -nickel_path = ["deployment", "environment"] +prompt = "Deployment Environment" +type = "select" +when = "enable_deployment == true" [[elements]] -name = "auto_deploy" -type = "confirm" -prompt = "Auto-deploy on main branch?" default = false -when = "enable_deployment == true" help = "Automatically deploy when main branch is updated" +name = "auto_deploy" nickel_path = ["deployment", "auto_deploy"] +prompt = "Auto-deploy on main branch?" +type = "confirm" +when = "enable_deployment == true" # ============================================================================= # SUMMARY # ============================================================================= [[elements]] -name = "summary_header" -type = "section_header" -title = "✅ Review & Save" border_top = true +name = "summary_header" +title = "✅ Review & Save" +type = "section_header" [[elements]] +content = "Review your configuration above. Click Submit to save and see what changed." name = "summary" type = "section" -content = "Review your configuration above. Click Submit to save and see what changed." diff --git a/examples/09-templates/employee_onboarding/employee_onboarding_form.toml b/examples/09-templates/employee_onboarding/employee_onboarding_form.toml index a698542..d9bc932 100644 --- a/examples/09-templates/employee_onboarding/employee_onboarding_form.toml +++ b/examples/09-templates/employee_onboarding/employee_onboarding_form.toml @@ -1,30 +1,30 @@ -name = "Employee Onboarding Form" description = "Compose employee form from reusable fragments" +name = "Employee Onboarding Form" # Include main header (path relative to this file's directory) [[items]] -name = "header_group" -type = "group" -order = 1 includes = ["fragments/header.toml"] +name = "header_group" +order = 1 +type = "group" # Employee information section with fields [[items]] -name = "employee_group" -type = "group" -order = 2 includes = ["fragments/employee_info_section.toml"] +name = "employee_group" +order = 2 +type = "group" # Reuse support section from previous form [[items]] -name = "support_group" -type = "group" -order = 3 includes = ["fragments/support_section.toml"] +name = "support_group" +order = 3 +type = "group" # Reuse agreement section from previous form [[items]] -name = "agreement_group" -type = "group" -order = 4 includes = ["fragments/agreement_section.toml"] +name = "agreement_group" +order = 4 +type = "group" diff --git a/examples/09-templates/onboarding_template.toml b/examples/09-templates/onboarding_template.toml index efc643b..71af253 100644 --- a/examples/09-templates/onboarding_template.toml +++ b/examples/09-templates/onboarding_template.toml @@ -1,68 +1,68 @@ -name = "employee_onboarding" description = "Employee onboarding with dynamic templates" +name = "employee_onboarding" [[elements]] name = "welcome" -type = "section" template = "Welcome to the team, {{ env.USER }}!" +type = "section" [[elements]] +content = "Please complete the following information to get started." name = "instructions" type = "section" -content = "Please complete the following information to get started." [[elements]] name = "full_name" -type = "text" prompt = "What is your full name?" required = true +type = "text" [[elements]] -name = "email" -type = "text" -prompt = "Enter your work email address" default = "{{ env.USER }}@company.com" +name = "email" +prompt = "Enter your work email address" required = true +type = "text" [[elements]] name = "department" -type = "select" -prompt = "Which department are you joining?" options = [ - { value = "Engineering", label = "💻 Engineering" }, - { value = "Marketing", label = "📢 Marketing" }, - { value = "Sales", label = "💼 Sales" }, - { value = "Support", label = "🛠️ Support" }, - { value = "HR", label = "👥 Human Resources" }, + { value = "Engineering", label = "💻 Engineering" }, + { value = "Marketing", label = "📢 Marketing" }, + { value = "Sales", label = "💼 Sales" }, + { value = "Support", label = "🛠️ Support" }, + { value = "HR", label = "👥 Human Resources" }, ] +prompt = "Which department are you joining?" required = true +type = "select" [[elements]] name = "start_date" -type = "date" prompt = "What is your start date?" required = true +type = "date" [[elements]] name = "manager_name" -type = "text" prompt = "Who is your manager?" required = true +type = "text" [[elements]] name = "office_location" -type = "select" -prompt = "Which office location?" options = [ - { value = "New York", label = "🗽 New York" }, - { value = "San Francisco", label = "🌉 San Francisco" }, - { value = "London", label = "🇬🇧 London" }, - { value = "Remote", label = "🏠 Remote" }, + { value = "New York", label = "🗽 New York" }, + { value = "San Francisco", label = "🌉 San Francisco" }, + { value = "London", label = "🇬🇧 London" }, + { value = "Remote", label = "🏠 Remote" }, ] +prompt = "Which office location?" required = true +type = "select" [[elements]] +border_top = true +content = "Thank you for completing your onboarding! Welcome aboard!" name = "closing" type = "footer" -content = "Thank you for completing your onboarding! Welcome aboard!" -border_top = true diff --git a/examples/09-templates/user_registration/registration_form.toml b/examples/09-templates/user_registration/registration_form.toml index c264fc8..d23e1cb 100644 --- a/examples/09-templates/user_registration/registration_form.toml +++ b/examples/09-templates/user_registration/registration_form.toml @@ -1,57 +1,57 @@ -name = "user_registration" description = "Simple user registration form" +name = "user_registration" [[fields]] name = "username" -type = "text" -prompt = "Enter username" placeholder = "john_doe" +prompt = "Enter username" +type = "text" [[fields]] name = "email" -type = "text" -prompt = "Enter email" placeholder = "user@example.com" +prompt = "Enter email" +type = "text" [[fields]] name = "password" -type = "password" prompt = "Enter password" +type = "password" [[fields]] name = "confirm_password" -type = "password" prompt = "Confirm password" +type = "password" [[fields]] -name = "agree_terms" -type = "confirm" -prompt = "Do you agree to the terms and conditions?" default = "false" +name = "agree_terms" +prompt = "Do you agree to the terms and conditions?" +type = "confirm" [[fields]] -name = "newsletter" -type = "confirm" -prompt = "Subscribe to our newsletter?" default = "true" +name = "newsletter" +prompt = "Subscribe to our newsletter?" +type = "confirm" [[fields]] name = "role" -type = "select" -prompt = "Select your role" options = [ - { value = "Admin", label = "👑 Administrator" }, - { value = "User", label = "👤 Regular User" }, - { value = "Guest", label = "👁️ Guest" }, + { value = "Admin", label = "👑 Administrator" }, + { value = "User", label = "👤 Regular User" }, + { value = "Guest", label = "👁️ Guest" }, ] +prompt = "Select your role" +type = "select" [[fields]] name = "interests" -type = "multiselect" -prompt = "Select your interests" options = [ - { value = "Technology", label = "💻 Technology" }, - { value = "Design", label = "🎨 Design" }, - { value = "Business", label = "💼 Business" }, - { value = "Marketing", label = "📢 Marketing" }, + { value = "Technology", label = "💻 Technology" }, + { value = "Design", label = "🎨 Design" }, + { value = "Business", label = "💼 Business" }, + { value = "Marketing", label = "📢 Marketing" }, ] +prompt = "Select your interests" +type = "multiselect" diff --git a/examples/09-templates/user_registration/user_registration_form.toml b/examples/09-templates/user_registration/user_registration_form.toml index d6c845d..79424be 100644 --- a/examples/09-templates/user_registration/user_registration_form.toml +++ b/examples/09-templates/user_registration/user_registration_form.toml @@ -1,80 +1,80 @@ -name = "user_registration" description = "User registration form with autocompletion examples" +name = "user_registration" [[fields]] name = "username" -type = "text" prompt = "Enter username" required = true +type = "text" [[fields]] name = "email" -type = "text" -prompt = "Enter your email address" placeholder = "user@example.com" +prompt = "Enter your email address" required = true +type = "text" [[fields]] name = "password" -type = "password" prompt = "Enter password" required = true +type = "password" [[fields]] name = "confirm_password" -type = "password" prompt = "Confirm password" required = true +type = "password" [[fields]] name = "country" -type = "select" -prompt = "Select your country" options = [ - { value = "United States", label = "🇺🇸 United States" }, - { value = "Canada", label = "🇨🇦 Canada" }, - { value = "Mexico", label = "🇲🇽 Mexico" }, - { value = "United Kingdom", label = "🇬🇧 United Kingdom" }, - { value = "Germany", label = "🇩🇪 Germany" }, - { value = "France", label = "🇫🇷 France" }, - { value = "Spain", label = "🇪🇸 Spain" }, - { value = "Italy", label = "🇮🇹 Italy" }, - { value = "Other", label = "🌍 Other" }, + { value = "United States", label = "🇺🇸 United States" }, + { value = "Canada", label = "🇨🇦 Canada" }, + { value = "Mexico", label = "🇲🇽 Mexico" }, + { value = "United Kingdom", label = "🇬🇧 United Kingdom" }, + { value = "Germany", label = "🇩🇪 Germany" }, + { value = "France", label = "🇫🇷 France" }, + { value = "Spain", label = "🇪🇸 Spain" }, + { value = "Italy", label = "🇮🇹 Italy" }, + { value = "Other", label = "🌍 Other" }, ] +prompt = "Select your country" +type = "select" [[fields]] name = "company" -type = "text" -prompt = "Enter company name" placeholder = "Acme Corporation" +prompt = "Enter company name" +type = "text" [[fields]] name = "website" -type = "text" -prompt = "Enter company website" placeholder = "https://example.com" +prompt = "Enter company website" +type = "text" [[fields]] -name = "subscribe" -type = "confirm" -prompt = "Subscribe to newsletter?" default = true +name = "subscribe" +prompt = "Subscribe to newsletter?" +type = "confirm" [[fields]] name = "interests" -type = "multiselect" -prompt = "Select your interests" options = [ - { value = "Technology", label = "💻 Technology" }, - { value = "Design", label = "🎨 Design" }, - { value = "Marketing", label = "📢 Marketing" }, - { value = "Business", label = "💼 Business" }, - { value = "Development", label = "🔧 Development" }, - { value = "Data Science", label = "📊 Data Science" }, + { value = "Technology", label = "💻 Technology" }, + { value = "Design", label = "🎨 Design" }, + { value = "Marketing", label = "📢 Marketing" }, + { value = "Business", label = "💼 Business" }, + { value = "Development", label = "🔧 Development" }, + { value = "Data Science", label = "📊 Data Science" }, ] +prompt = "Select your interests" +type = "multiselect" [[fields]] -name = "agreed_terms" -type = "confirm" -prompt = "Do you agree to the terms and conditions?" default = false +name = "agreed_terms" +prompt = "Do you agree to the terms and conditions?" +type = "confirm" diff --git a/examples/11-prov-gen/mode-a-cargo/Cargo.toml b/examples/11-prov-gen/mode-a-cargo/Cargo.toml index 9959ae3..33d9935 100644 --- a/examples/11-prov-gen/mode-a-cargo/Cargo.toml +++ b/examples/11-prov-gen/mode-a-cargo/Cargo.toml @@ -1,18 +1,18 @@ [package] +description = "Example web service with HTTP API and database" +edition = "2021" name = "web-service-example" version = "0.1.0" -edition = "2021" -description = "Example web service with HTTP API and database" [dependencies] axum = "0.7" -tokio = { version = "1", features = ["full"] } +jsonwebtoken = "9.0" +prometheus = "0.13" +redis = "0.24" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sqlx = { version = "0.7", features = ["postgres", "uuid", "chrono"] } -jsonwebtoken = "9.0" -redis = "0.24" -prometheus = "0.13" +tokio = { version = "1", features = ["full"] } tracing = "0.1" tracing-subscriber = "0.3" diff --git a/examples/11-prov-gen/mode-b-config/project-spec.toml b/examples/11-prov-gen/mode-b-config/project-spec.toml index da81949..7fc29fa 100644 --- a/examples/11-prov-gen/mode-b-config/project-spec.toml +++ b/examples/11-prov-gen/mode-b-config/project-spec.toml @@ -2,180 +2,180 @@ # This file defines a provisioning configuration without relying on Cargo.toml [project] -name = "microservice-platform" description = "Distributed microservice platform with event streaming" +name = "microservice-platform" type = "Microservice" [infrastructure] # SSH configuration for remote deployments ssh = true -# Database configuration -[[infrastructure.databases]] -type = "postgres" -required = true + # Database configuration + [[infrastructure.databases]] + required = true + type = "postgres" -# Monitoring stack -monitoring = ["prometheus", "grafana"] + # Monitoring stack + monitoring = ["prometheus", "grafana"] -# Cloud provider options -cloud_providers = ["aws", "gcp"] + # Cloud provider options + cloud_providers = ["aws", "gcp"] -# Optional services -cache_enabled = true + # Optional services + cache_enabled = true -# Domain Features - define what your service actually does + # Domain Features - define what your service actually does [features.api_gateway] description = "REST API gateway with rate limiting" enabled = true -[[features.api_gateway.fields]] -name = "bind_address" -type = "Text" -prompt = "API Gateway bind address" -default = "0.0.0.0:8080" -help = "Interface and port for API requests" -required = true + [[features.api_gateway.fields]] + default = "0.0.0.0:8080" + help = "Interface and port for API requests" + name = "bind_address" + prompt = "API Gateway bind address" + required = true + type = "Text" -[[features.api_gateway.fields]] -name = "rate_limit" -type = "Number" -prompt = "Rate limit (requests/second)" -default = 100 -min = 1 -max = 10000 -help = "Maximum requests per second per client" + [[features.api_gateway.fields]] + default = 100 + help = "Maximum requests per second per client" + max = 10000 + min = 1 + name = "rate_limit" + prompt = "Rate limit (requests/second)" + type = "Number" -[[features.api_gateway.fields]] -name = "timeout_seconds" -type = "Number" -prompt = "Request timeout" -default = 30 -min = 5 -max = 300 + [[features.api_gateway.fields]] + default = 30 + max = 300 + min = 5 + name = "timeout_seconds" + prompt = "Request timeout" + type = "Number" [features.event_streaming] description = "Event-driven architecture with message queue" enabled = true -[[features.event_streaming.fields]] -name = "broker_url" -type = "Text" -prompt = "Message broker URL" -placeholder = "kafka://localhost:9092" -required = true -help = "Connection string for event broker" + [[features.event_streaming.fields]] + help = "Connection string for event broker" + name = "broker_url" + placeholder = "kafka://localhost:9092" + prompt = "Message broker URL" + required = true + type = "Text" -[[features.event_streaming.fields]] -name = "consumer_group" -type = "Text" -prompt = "Consumer group ID" -default = "microservice-platform" -required = true + [[features.event_streaming.fields]] + default = "microservice-platform" + name = "consumer_group" + prompt = "Consumer group ID" + required = true + type = "Text" -[[features.event_streaming.fields]] -name = "max_concurrent_consumers" -type = "Number" -prompt = "Max concurrent consumers" -default = 10 -min = 1 -max = 100 + [[features.event_streaming.fields]] + default = 10 + max = 100 + min = 1 + name = "max_concurrent_consumers" + prompt = "Max concurrent consumers" + type = "Number" [features.authentication] description = "JWT-based authentication with role-based access" enabled = true -[[features.authentication.fields]] -name = "jwt_secret" -type = "Password" -prompt = "JWT signing secret" -sensitive = true -encryption_backend = "age" -required = true -help = "Secret key for JWT token signing and verification" + [[features.authentication.fields]] + encryption_backend = "age" + help = "Secret key for JWT token signing and verification" + name = "jwt_secret" + prompt = "JWT signing secret" + required = true + sensitive = true + type = "Password" -[[features.authentication.fields]] -name = "jwt_expiry_hours" -type = "Number" -prompt = "JWT token expiry (hours)" -default = 24 -min = 1 -max = 720 + [[features.authentication.fields]] + default = 24 + max = 720 + min = 1 + name = "jwt_expiry_hours" + prompt = "JWT token expiry (hours)" + type = "Number" -[[features.authentication.fields]] -name = "allow_refresh_tokens" -type = "Confirm" -prompt = "Allow token refresh?" -default = true -help = "Enable token refresh mechanism" + [[features.authentication.fields]] + default = true + help = "Enable token refresh mechanism" + name = "allow_refresh_tokens" + prompt = "Allow token refresh?" + type = "Confirm" [features.observability] description = "Comprehensive logging and tracing" enabled = true -[[features.observability.fields]] -name = "log_level" -type = "Select" -prompt = "Log level" -default = "info" -options = ["trace", "debug", "info", "warn", "error"] + [[features.observability.fields]] + default = "info" + name = "log_level" + options = ["trace", "debug", "info", "warn", "error"] + prompt = "Log level" + type = "Select" -[[features.observability.fields]] -name = "enable_distributed_tracing" -type = "Confirm" -prompt = "Enable distributed tracing?" -default = true + [[features.observability.fields]] + default = true + name = "enable_distributed_tracing" + prompt = "Enable distributed tracing?" + type = "Confirm" -[[features.observability.fields]] -name = "trace_sample_rate" -type = "Number" -prompt = "Trace sampling rate (0.0-1.0)" -default = 0.1 -min = 0.0 -max = 1.0 -help = "Percentage of requests to trace (0.0-1.0)" + [[features.observability.fields]] + default = 0.1 + help = "Percentage of requests to trace (0.0-1.0)" + max = 1.0 + min = 0.0 + name = "trace_sample_rate" + prompt = "Trace sampling rate (0.0-1.0)" + type = "Number" [features.database_migrations] description = "Database schema and migration management" enabled = true -[[features.database_migrations.fields]] -name = "migration_directory" -type = "Text" -prompt = "Migrations directory" -default = "./migrations" -help = "Path to SQL migration files" + [[features.database_migrations.fields]] + default = "./migrations" + help = "Path to SQL migration files" + name = "migration_directory" + prompt = "Migrations directory" + type = "Text" -[[features.database_migrations.fields]] -name = "auto_migrate_on_startup" -type = "Confirm" -prompt = "Auto-migrate on startup?" -default = false -help = "Automatically run pending migrations when service starts" + [[features.database_migrations.fields]] + default = false + help = "Automatically run pending migrations when service starts" + name = "auto_migrate_on_startup" + prompt = "Auto-migrate on startup?" + type = "Confirm" -# Constraints - single source of truth for validation bounds + # Constraints - single source of truth for validation bounds [constraints.api_gateway.bind_address] -min_length = 3 max_length = 50 +min_length = 3 [constraints.api_gateway.rate_limit] -min = 1 max = 10000 +min = 1 [constraints.event_streaming.consumer_group] -min_length = 1 max_length = 100 +min_length = 1 [constraints.authentication.jwt_secret] -min_length = 32 max_length = 256 +min_length = 32 [constraints.observability.trace_sample_rate] -min = 0.0 max = 1.0 +min = 0.0 [constraints.database_migrations.migration_directory] -min_length = 1 max_length = 255 +min_length = 1 diff --git a/examples/13-conditional-logic/conditional-demo.toml b/examples/13-conditional-logic/conditional-demo.toml index a3da8cb..2ecf798 100644 --- a/examples/13-conditional-logic/conditional-demo.toml +++ b/examples/13-conditional-logic/conditional-demo.toml @@ -1,8 +1,8 @@ # Conditional Logic Demo # Demonstrates all supported conditional operators in TypeDialog -name = "conditional_demo" description = "Complete demonstration of conditional field visibility" +name = "conditional_demo" # ==================== # COMPARISON OPERATORS @@ -10,28 +10,28 @@ description = "Complete demonstration of conditional field visibility" [[elements]] name = "database_driver" -type = "select" +options = [ + { value = "sqlite", label = "SQLite (embedded)" }, + { value = "mysql", label = "MySQL" }, + { value = "postgresql", label = "PostgreSQL" }, +] prompt = "Select database driver" required = true -options = [ - { value = "sqlite", label = "SQLite (embedded)" }, - { value = "mysql", label = "MySQL" }, - { value = "postgresql", label = "PostgreSQL" } -] +type = "select" # Equality (==) [[elements]] name = "mysql_config" -type = "text" -prompt = "MySQL connection string" -when = "database_driver == mysql" placeholder = "mysql://localhost:3306/db" +prompt = "MySQL connection string" +type = "text" +when = "database_driver == mysql" # Inequality (!=) [[elements]] +content = "⚠️ You selected a server-based database. Ensure the server is running." name = "server_warning" type = "section" -content = "⚠️ You selected a server-based database. Ensure the server is running." when = "database_driver != sqlite" # ==================== @@ -39,38 +39,38 @@ when = "database_driver != sqlite" # ==================== [[elements]] -name = "server_port" -type = "text" -prompt = "Server port" default = "8080" +name = "server_port" +prompt = "Server port" required = true +type = "text" # Greater than (>) [[elements]] +content = "⚠️ Port > 10000 is uncommon. Double-check your configuration." name = "high_port_warning" type = "section" -content = "⚠️ Port > 10000 is uncommon. Double-check your configuration." when = "server_port > 10000" # Less than (<) [[elements]] +content = "⚠️ Port < 1024 requires root/admin privileges." name = "privileged_port_warning" type = "section" -content = "⚠️ Port < 1024 requires root/admin privileges." when = "server_port < 1024" # Greater than or equal (>=) [[elements]] +content = "✓ Using standard user port range (>= 1024)" name = "standard_port_notice" type = "section" -content = "✓ Using standard user port range (>= 1024)" when = "server_port >= 1024" # Less than or equal (<=) [[elements]] +content = "Using low port range (<= 5000)" name = "low_port_range" type = "section" -content = "Using low port range (<= 5000)" when = "server_port <= 5000" # ==================== @@ -79,29 +79,29 @@ when = "server_port <= 5000" [[elements]] name = "project_url" -type = "text" -prompt = "Project repository URL" placeholder = "https://github.com/user/repo" +prompt = "Project repository URL" +type = "text" # startswith [[elements]] +content = "✓ Secure HTTPS URL detected" name = "https_notice" type = "section" -content = "✓ Secure HTTPS URL detected" when = "project_url startswith https" # endswith [[elements]] name = "github_specific" -type = "text" prompt = "GitHub Actions enabled?" +type = "text" when = "project_url endswith github.com" # contains [[elements]] name = "gitlab_ci" -type = "confirm" prompt = "Enable GitLab CI integration?" +type = "confirm" when = "project_url contains gitlab" # ==================== @@ -109,46 +109,46 @@ when = "project_url contains gitlab" # ==================== [[elements]] -name = "detected_languages" -type = "multiselect" -prompt = "Which languages are used in your project?" display_mode = "grid" +name = "detected_languages" options = [ - { value = "rust", label = "🦀 Rust" }, - { value = "python", label = "🐍 Python" }, - { value = "javascript", label = "📜 JavaScript" }, - { value = "go", label = "🐹 Go" } + { value = "rust", label = "🦀 Rust" }, + { value = "python", label = "🐍 Python" }, + { value = "javascript", label = "📜 JavaScript" }, + { value = "go", label = "🐹 Go" }, ] +prompt = "Which languages are used in your project?" +type = "multiselect" # Array membership check [[elements]] name = "rust_toolchain" -type = "select" -prompt = "Rust toolchain version" -when = "rust in detected_languages" options = [ - { value = "stable", label = "Stable" }, - { value = "nightly", label = "Nightly" }, - { value = "beta", label = "Beta" } + { value = "stable", label = "Stable" }, + { value = "nightly", label = "Nightly" }, + { value = "beta", label = "Beta" }, ] +prompt = "Rust toolchain version" +type = "select" +when = "rust in detected_languages" [[elements]] -name = "python_venv" -type = "confirm" -prompt = "Use Python virtual environment?" -when = "python in detected_languages" default = true +name = "python_venv" +prompt = "Use Python virtual environment?" +type = "confirm" +when = "python in detected_languages" [[elements]] name = "nodejs_version" -type = "select" -prompt = "Node.js version" -when = "javascript in detected_languages" options = [ - { value = "18", label = "Node.js 18 LTS" }, - { value = "20", label = "Node.js 20 LTS" }, - { value = "latest", label = "Latest" } + { value = "18", label = "Node.js 18 LTS" }, + { value = "20", label = "Node.js 20 LTS" }, + { value = "latest", label = "Latest" }, ] +prompt = "Node.js version" +type = "select" +when = "javascript in detected_languages" # ==================== # FILE SYSTEM CONDITIONS @@ -156,29 +156,29 @@ options = [ # file_exists(path) [[elements]] +content = "✓ Dockerfile found in current directory" name = "dockerfile_exists_notice" type = "section" -content = "✓ Dockerfile found in current directory" when = "file_exists(Dockerfile)" # !file_exists(path) - negation [[elements]] -name = "create_dockerfile" -type = "confirm" -prompt = "No Dockerfile found. Create one?" -when = "!file_exists(Dockerfile)" default = true +name = "create_dockerfile" +prompt = "No Dockerfile found. Create one?" +type = "confirm" +when = "!file_exists(Dockerfile)" [[elements]] name = "use_existing_config" -type = "confirm" prompt = "Existing .env file found. Use existing configuration?" +type = "confirm" when = "file_exists(.env)" [[elements]] +includes = ["fragments/environment-setup.toml"] name = "env_setup" type = "group" -includes = ["fragments/environment-setup.toml"] when = "!file_exists(.env)" # ==================== @@ -186,13 +186,13 @@ when = "!file_exists(.env)" # ==================== [[elements]] +content = "🦀 Rust + Docker detected. Consider using rust:alpine base image." name = "rust_docker_setup" type = "section" -content = "🦀 Rust + Docker detected. Consider using rust:alpine base image." when = "rust in detected_languages" [[elements]] +content = "✅ Production-ready configuration detected (HTTPS + standard port)" name = "production_ready_check" type = "section" -content = "✅ Production-ready configuration detected (HTTPS + standard port)" when = "server_port >= 1024" diff --git a/examples/13-conditional-logic/fragments/environment-setup.toml b/examples/13-conditional-logic/fragments/environment-setup.toml index 220c2ca..1a05418 100644 --- a/examples/13-conditional-logic/fragments/environment-setup.toml +++ b/examples/13-conditional-logic/fragments/environment-setup.toml @@ -1,72 +1,72 @@ # Environment Setup Fragment # Loaded conditionally when .env file doesn't exist -name = "environment_setup" description = "Environment variables configuration" display_mode = "complete" +name = "environment_setup" [[elements]] -name = "env_header" -type = "section_header" -title = "🔧 Environment Configuration" -border_top = true border_bottom = true +border_top = true +name = "env_header" +title = "🔧 Environment Configuration" +type = "section_header" [[elements]] name = "env_mode" -type = "select" +options = [ + { value = "development", label = "Development" }, + { value = "staging", label = "Staging" }, + { value = "production", label = "Production" }, +] prompt = "Environment mode" required = true -options = [ - { value = "development", label = "Development" }, - { value = "staging", label = "Staging" }, - { value = "production", label = "Production" } -] - -[[elements]] -name = "log_level" type = "select" -prompt = "Log level" + +[[elements]] default = "info" +name = "log_level" options = [ - { value = "trace", label = "Trace (verbose)" }, - { value = "debug", label = "Debug" }, - { value = "info", label = "Info" }, - { value = "warn", label = "Warning" }, - { value = "error", label = "Error" } + { value = "trace", label = "Trace (verbose)" }, + { value = "debug", label = "Debug" }, + { value = "info", label = "Info" }, + { value = "warn", label = "Warning" }, + { value = "error", label = "Error" }, ] +prompt = "Log level" +type = "select" [[elements]] -name = "debug_mode" -type = "confirm" -prompt = "Enable debug mode?" -when = "env_mode == development" default = true +name = "debug_mode" +prompt = "Enable debug mode?" +type = "confirm" +when = "env_mode == development" [[elements]] +help = "Your application API key" name = "api_key" -type = "password" prompt = "API Key" required = true -help = "Your application API key" +type = "password" [[elements]] name = "database_url" -type = "text" -prompt = "Database URL" placeholder = "postgresql://localhost:5432/mydb" +prompt = "Database URL" required = true +type = "text" [[elements]] name = "redis_url" -type = "text" -prompt = "Redis URL" placeholder = "redis://localhost:6379" +prompt = "Redis URL" +type = "text" when = "env_mode == production" [[elements]] -name = "sentry_dsn" -type = "text" -prompt = "Sentry DSN (error tracking)" -when = "env_mode == production" help = "Leave empty to disable error tracking" +name = "sentry_dsn" +prompt = "Sentry DSN (error tracking)" +type = "text" +when = "env_mode == production" diff --git a/justfiles/dev.just b/justfiles/dev.just index 66f2a27..71b8b6d 100644 --- a/justfiles/dev.just +++ b/justfiles/dev.just @@ -11,9 +11,11 @@ help: @echo "DEVELOPMENT MODULE" @echo "" @echo "Code quality:" - @echo " just dev::fmt Format code" + @echo " just dev::fmt Format code (Rust + TOML)" + @echo " just dev::fmt-toml Format TOML files only" @echo " just dev::fmt-check Check format (no changes)" @echo " just dev::lint Run clippy linter" + @echo " just dev::lint-toml Lint TOML files" @echo " just dev::audit Audit dependencies" @echo "" @echo "Testing & Coverage:" @@ -40,20 +42,38 @@ help: # === CODE FORMATTING === -# Format all code -[doc("Format code with cargo fmt")] +# Format all code (Rust + TOML) +[doc("Format Rust and TOML code")] fmt: @echo "=== Formatting code ===" cargo fmt --all + just dev::fmt-toml @echo "✓ Formatting complete" -# Check format without modifying +# Format TOML files with taplo +[doc("Format TOML files with taplo")] +fmt-toml: + @echo "=== Formatting TOML files ===" + @command -v taplo >/dev/null || (echo "taplo not installed: cargo install taplo-cli"; exit 1) + taplo format + @echo "✓ TOML formatting complete" + +# Check format without modifying (Rust + TOML) [doc("Check format without changes")] fmt-check: @echo "=== Checking format ===" cargo fmt --all -- --check + just dev::fmt-toml-check @echo "✓ Format check passed" +# Check TOML format without modifying +[doc("Check TOML format without changes")] +fmt-toml-check: + @echo "=== Checking TOML format ===" + @command -v taplo >/dev/null || (echo "taplo not installed: cargo install taplo-cli"; exit 1) + taplo format --check + @echo "✓ TOML format check passed" + # === LINTING === # Run clippy on all targets (alias for lint-rust) @@ -125,6 +145,14 @@ lint-nushell: done @echo "✓ Nushell linting complete" +# Lint TOML files with taplo +[doc("Lint TOML files with taplo")] +lint-toml: + @echo "=== Linting TOML files ===" + @command -v taplo >/dev/null || (echo "taplo not installed: cargo install taplo-cli"; exit 1) + taplo lint + @echo "✓ TOML linting complete" + # Lint Markdown syntax (markdownlint-cli2) # Covers: docs/**/*.md + root *.md (excludes .claude, .coder, CLAUDE.md) [doc("Lint Markdown syntax with markdownlint-cli2")] @@ -165,7 +193,7 @@ lint-markdown-full: just dev::lint-markdown-prose # Lint all languages -[doc("Lint all: Rust + bash + Nickel + Nushell + Markdown")] +[doc("Lint all: Rust + TOML + bash + Nickel + Nushell + Markdown")] lint-all: @echo "╔═══════════════════════════════════════════════════════════╗" @echo "║ MULTI-LANGUAGE LINTING ║" @@ -173,6 +201,8 @@ lint-all: @echo "" just dev::lint-rust @echo "" + just dev::lint-toml + @echo "" just dev::lint-bash @echo "" just dev::lint-nickel