Some checks failed
CI / Lint (bash) (push) Has been cancelled
CI / Lint (markdown) (push) Has been cancelled
CI / Lint (nickel) (push) Has been cancelled
CI / Lint (nushell) (push) Has been cancelled
CI / Lint (rust) (push) Has been cancelled
CI / Benchmark (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
CI / License Compliance (push) Has been cancelled
CI / Code Coverage (push) Has been cancelled
CI / Test (macos-latest) (push) Has been cancelled
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Build (macos-latest) (push) Has been cancelled
CI / Build (ubuntu-latest) (push) Has been cancelled
CI / Build (windows-latest) (push) Has been cancelled
Replace all TOML form definitions in examples/ and config/ with type-checked Nickel equivalents. Update cli_loader to prefer .ncl (via nickel export) over .toml in config search order. TOML support retained as fallback — no breaking change. - El loader usa nickel export --format json + serde_json como puente — evita reimplementar un parser Nickel en Rust y aprovecha el binario ya existente. - El orden de búsqueda .ncl > .toml permite migración incremental: cualquier config vieja sigue funcionando sin tocarla. - Los contratos Nickel (| default, | String) en los configs sustituyen la validación que antes era implícita en el parsing TOML — el error llega antes (en nickel export) con mensajes más descriptivos.
85 lines
4.5 KiB
Plaintext
85 lines
4.5 KiB
Plaintext
let env_setup = import "./fragments/environment-setup.ncl" in
|
|
{
|
|
name = "conditional_demo",
|
|
description = "Complete demonstration of conditional field visibility",
|
|
elements =
|
|
[
|
|
# COMPARISON OPERATORS
|
|
{ type = "select", name = "database_driver", prompt = "Select database driver", required = true, options = [
|
|
{ value = "sqlite", label = "SQLite (embedded)" },
|
|
{ value = "mysql", label = "MySQL" },
|
|
{ value = "postgresql", label = "PostgreSQL" },
|
|
]
|
|
},
|
|
|
|
# Equality (==)
|
|
{ type = "text", name = "mysql_config", prompt = "MySQL connection string", placeholder = "mysql://localhost:3306/db", when = "database_driver == mysql" },
|
|
|
|
# Inequality (!=)
|
|
{ type = "section", name = "server_warning", content = "⚠️ You selected a server-based database. Ensure the server is running.", when = "database_driver != sqlite" },
|
|
|
|
# NUMERIC COMPARISONS
|
|
{ type = "text", name = "server_port", prompt = "Server port", required = true, default = "8080" },
|
|
|
|
# Greater than (>)
|
|
{ type = "section", name = "high_port_warning", content = "⚠️ Port > 10000 is uncommon. Double-check your configuration.", when = "server_port > 10000" },
|
|
|
|
# Less than (<)
|
|
{ type = "section", name = "privileged_port_warning", content = "⚠️ Port < 1024 requires root/admin privileges.", when = "server_port < 1024" },
|
|
|
|
# Greater than or equal (>=)
|
|
{ type = "section", name = "standard_port_notice", content = "✓ Using standard user port range (>= 1024)", when = "server_port >= 1024" },
|
|
|
|
# Less than or equal (<=)
|
|
{ type = "section", name = "low_port_range", content = "Using low port range (<= 5000)", when = "server_port <= 5000" },
|
|
|
|
# STRING OPERATORS
|
|
{ type = "text", name = "project_url", prompt = "Project repository URL", placeholder = "https://github.com/user/repo" },
|
|
|
|
# startswith
|
|
{ type = "section", name = "https_notice", content = "✓ Secure HTTPS URL detected", when = "project_url startswith https" },
|
|
|
|
# endswith
|
|
{ type = "text", name = "github_specific", prompt = "GitHub Actions enabled?", when = "project_url endswith github.com" },
|
|
|
|
# contains
|
|
{ type = "confirm", name = "gitlab_ci", prompt = "Enable GitLab CI integration?", when = "project_url contains gitlab" },
|
|
|
|
# ARRAY MEMBERSHIP (in)
|
|
{ type = "multiselect", name = "detected_languages", prompt = "Which languages are used in your project?", display_mode = "grid", options = [
|
|
{ value = "rust", label = "🦀 Rust" },
|
|
{ value = "python", label = "🐍 Python" },
|
|
{ value = "javascript", label = "📜 JavaScript" },
|
|
{ value = "go", label = "🐹 Go" },
|
|
]
|
|
},
|
|
|
|
# Array membership check
|
|
{ type = "select", name = "rust_toolchain", prompt = "Rust toolchain version", when = "rust in detected_languages", options = [
|
|
{ value = "stable", label = "Stable" },
|
|
{ value = "nightly", label = "Nightly" },
|
|
{ value = "beta", label = "Beta" },
|
|
]
|
|
},
|
|
{ type = "confirm", name = "python_venv", prompt = "Use Python virtual environment?", default = true, when = "python in detected_languages" },
|
|
{ type = "select", name = "nodejs_version", 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" },
|
|
]
|
|
},
|
|
|
|
# FILE SYSTEM CONDITIONS
|
|
{ type = "section", name = "dockerfile_exists_notice", content = "✓ Dockerfile found in current directory", when = "file_exists(Dockerfile)" },
|
|
{ type = "confirm", name = "create_dockerfile", prompt = "No Dockerfile found. Create one?", default = true, when = "!file_exists(Dockerfile)" },
|
|
{ type = "confirm", name = "use_existing_config", prompt = "Existing .env file found. Use existing configuration?", when = "file_exists(.env)" },
|
|
]
|
|
# env_setup group when = "!file_exists(.env)" — fragment has per-element conditions, inline as-is
|
|
@ env_setup.elements
|
|
@ [
|
|
# COMBINED CONDITIONS
|
|
{ type = "section", name = "rust_docker_setup", content = "🦀 Rust + Docker detected. Consider using rust:alpine base image.", when = "rust in detected_languages" },
|
|
{ type = "section", name = "production_ready_check", content = "✅ Production-ready configuration detected (HTTPS + standard port)", when = "server_port >= 1024" },
|
|
],
|
|
}
|