- DAG architecture: `dag show/validate/export` (nulib/main_provisioning/dag.nu),
config loader (lib_provisioning/config/loader/dag.nu), taskserv dag-executor.
Backed by schemas/lib/dag/*.ncl; orchestrator emits NATS events via
WorkspaceComposition::into_workflow. See ADR-020, ADR-021.
- Unified Component Architecture: components/mod.nu, main_provisioning/
{components,workflow,extensions,ontoref-queries}.nu. Full workflow engine with
topological sort and NATS subject emission. Blocks A-H complete (libre-daoshi).
- Commands-registry: nulib/commands-registry.ncl (Nickel source, 314 lines) +
JSON cache at ~/.cache/provisioning/commands-registry.json rebuilt on source
change. cli/provisioning fast-path alias expansion avoids cold Nu startup.
ADDING_COMMANDS.md documents new-command workflow.
- Platform service manager: service-manager.nu (+573), startup.nu (+611),
service-check.nu (+255); autostart/bootstrap/health/target refactored.
- Nushell 0.112.2 migration: removed all try/catch and bash redirections;
external commands prefixed with ^; type signatures enforced. Driven by
scripts/refactor-try-catch{,-simplified}.nu.
- TTY stack: removed shlib/*-tty.sh; replaced by cli/tty-dispatch.sh,
tty-filter.sh, tty-commands.conf.
- New domain modules: images/ (golden image lifecycle), workspace/{state,sync}.nu,
main_provisioning/{bootstrap,cluster-deploy,fip,state}.nu, commands/{state,
build,integrations/auth,utilities/alias}.nu, platform.nu expanded (+874).
- Config loader overhaul: loader/core.nu slimmed (-759), cache/core.nu
refactored (-454), removed legacy loaders/file_loader.nu (-330).
- Thirteen new provisioning-<domain>.nu top-level modules for bash dispatcher.
- Tests: test_workspace_state.nu (+351); updates to test_oci_registry,
test_services.
- README + CHANGELOG updated.
3.4 KiB
3.4 KiB
Core Provisioning Scripts
Reusable Nushell scripts for querying system state, validation, and metadata extraction.
Purpose
These scripts provide a clean interface for:
- Querying system resources (providers, servers, clusters, etc.)
- Validating system state (commands, configuration)
- Extracting metadata (help categories, schema info)
Usage Contexts
- Bash wrapper (
provisioning/core/cli/provisioning) - CLI commands (via dispatcher and command handlers)
- Direct invocation (for debugging, testing, CI/CD)
- Other scripts (as utilities)
Scripts
Query Scripts (Read-only resource listing)
| Script | Purpose | Usage |
|---|---|---|
query-providers.nu |
List all available providers | nu query-providers.nu |
query-taskservs.nu |
List all available taskservs | nu query-taskservs.nu |
query-servers.nu |
List servers in active workspace | nu query-servers.nu [infra_filter] |
query-clusters.nu |
List clusters in active workspace | nu query-clusters.nu |
query-infra.nu |
List infrastructures in active workspace | nu query-infra.nu |
Output: Table format (columns: name, type, status, etc.)
Validation Scripts
| Script | Purpose | Usage |
|---|---|---|
validate-command.nu |
Validate if command exists in registry | nu validate-command.nu <command_name> |
validate-config.nu |
Validate configuration structure | nu validate-config.nu |
Output:
validate-command.nu:FOUND|true/falseorNOT_FOUNDvalidate-config.nu: Validation errors or success message
Metadata Scripts
| Script | Purpose | Usage |
|---|---|---|
get-help-category.nu |
Get help category for command | nu get-help-category.nu <schema_file> <command> |
Output: Help category string or empty
Design Principles
- ✅ Single responsibility: Each script does ONE thing
- ✅ Reusable: Can be called from any context
- ✅ Testable: Can run standalone with
nu --ide-check - ✅ Self-contained: Minimal dependencies (lib_minimal.nu when needed)
- ✅ Structured output: Consistent format for bash consumption
Naming Convention
query-*.nu: Read-only resource listingvalidate-*.nu: System state validationget-*.nu: Metadata extraction
Guidelines
- Use
do { } | completepattern for error handling - All scripts should be executable (
chmod +x) - Use
#!/usr/bin/env nushebang - Source
lib_minimal.nuwhen workspace functions needed - Return structured output (table, string, or status code)
- No side effects (read-only operations)
Testing
# Syntax validation
nu --ide-check 50 query-providers.nu
# Functional testing
nu query-providers.nu
nu validate-command.nu platform
nu get-help-category.nu "$PROVISIONING/core/nulib/commands-registry.ncl" guides
Migration from init-wrapper
These scripts were previously in provisioning/core/cli/init-wrapper/ with different names:
provider-list.nu→query-providers.nutaskserv-list.nu→query-taskservs.nuserver-list.nu→query-servers.nucluster-list.nu→query-clusters.nuinfra-list.nu→query-infra.nuvalidate-command.nu→ (same name)validate-config.nu→ (same name)get-help-category.nu→ (same name)
The new location (core/nulib/scripts/) reflects their general-purpose nature beyond just bash wrapper initialization.