#!/usr/bin/env nu # start-orchestrator.nu — Start the stratum orchestrator with full pre-flight checks. def main [ --config: string = "config/orchestrator-config.ncl", --skip-typecheck = false, ]: nothing -> nothing { print "Starting orchestrator..." # 1. Typecheck all .ncl files if (not $skip_typecheck) { print "Running Nickel typecheck..." let tc = (do { ^nu scripts/nu/typecheck-all-ncl.nu } | complete) if ($tc.exit_code != 0) { error make { msg: $"Nickel typecheck failed — fix errors before starting orchestrator:\n($tc.stderr)" } } print "Nickel typecheck passed" } # 2. Verify config file exists and typechecks if (not ($config | path exists)) { error make { msg: $"Config file not found: [$config]" } } let cfg_check = (do { ^nickel typecheck $config } | complete) if ($cfg_check.exit_code != 0) { error make { msg: $"Orchestrator config failed typecheck:\n($cfg_check.stderr)" } } print $"Config typechecked: [$config]" # 3. Exec orchestrator binary print "Launching orchestrator..." ^./target/debug/orchestrator --config $config }