2026-01-21 10:24:17 +00:00
|
|
|
# Module: System Initialization
|
|
|
|
|
# Purpose: Handles system initialization, environment setup, and workspace initialization.
|
|
|
|
|
# Dependencies: error, interface, config/accessor
|
|
|
|
|
|
2025-10-07 10:32:04 +01:00
|
|
|
|
|
|
|
|
use ../config/accessor.nu *
|
|
|
|
|
|
feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration
- 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.
2026-04-17 04:27:33 +01:00
|
|
|
# Get the complete provisioning command arguments as a string
|
|
|
|
|
export def get-provisioning-args [] : nothing -> string {
|
|
|
|
|
$env.PROVISIONING_ARGS? | default ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get the provisioning command name
|
|
|
|
|
export def get-provisioning-name [] : nothing -> string {
|
|
|
|
|
$env.PROVISIONING_NAME? | default "provisioning"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get the provisioning infrastructure path
|
|
|
|
|
export def get-provisioning-infra-path [] : nothing -> string {
|
|
|
|
|
$env.PROVISIONING_INFRA_PATH? | default ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get the provisioning resources path
|
|
|
|
|
export def get-provisioning-resources [] : nothing -> string {
|
|
|
|
|
$env.PROVISIONING_RESOURCES? | default ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get the provisioning URL
|
|
|
|
|
export def get-provisioning-url [] : nothing -> string {
|
|
|
|
|
$env.PROVISIONING_URL? | default "https://provisioning.systems"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get whether SOPS encryption is enabled
|
|
|
|
|
export def get-provisioning-use-sops [] : nothing -> string {
|
|
|
|
|
$env.PROVISIONING_USE_SOPS? | default ""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get the effective workspace
|
|
|
|
|
export def get-effective-workspace [] : nothing -> string {
|
|
|
|
|
$env.CURRENT_WORKSPACE? | default "default"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get workspace path (defaults to effective workspace if not provided)
|
|
|
|
|
export def get-workspace-path [workspace?: string] : nothing -> string {
|
|
|
|
|
let ws = if ($workspace | is-empty) {
|
|
|
|
|
(get-effective-workspace)
|
|
|
|
|
} else {
|
|
|
|
|
$workspace
|
|
|
|
|
}
|
|
|
|
|
let ws_base = ($env.PROVISIONING_WORKSPACES? | default "")
|
|
|
|
|
if ($ws_base | is-not-empty) {
|
|
|
|
|
$ws_base | path join $ws
|
|
|
|
|
} else {
|
|
|
|
|
""
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Detect infrastructure from PWD
|
|
|
|
|
export def detect-infra-from-pwd [] : nothing -> string {
|
|
|
|
|
""
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Get work format (Nickel is the default post-migration)
|
|
|
|
|
export def get-work-format [] : nothing -> string {
|
|
|
|
|
$env.PROVISIONING_WORK_FORMAT? | default "ncl"
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-14 02:00:23 +00:00
|
|
|
export def show_titles [] {
|
feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration
- 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.
2026-04-17 04:27:33 +01:00
|
|
|
# Check if titles are disabled
|
2025-10-07 10:32:04 +01:00
|
|
|
if ($env.PROVISIONING_NO_TITLES? | default false) { return }
|
feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration
- 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.
2026-04-17 04:27:33 +01:00
|
|
|
if ($env.PROVISIONING_OUT? | is-not-empty) { return }
|
2025-10-07 10:32:04 +01:00
|
|
|
if ($env.PROVISIONING_TITLES_SHOWN? | default false) { return }
|
feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration
- 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.
2026-04-17 04:27:33 +01:00
|
|
|
|
|
|
|
|
# Mark as shown to prevent duplicates
|
2025-10-07 10:32:04 +01:00
|
|
|
$env.PROVISIONING_TITLES_SHOWN = true
|
feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration
- 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.
2026-04-17 04:27:33 +01:00
|
|
|
|
|
|
|
|
# Find ascii.txt from PROVISIONING_RESOURCES or PROVISIONING directory
|
|
|
|
|
let ascii_file = (
|
|
|
|
|
if ($env.PROVISIONING_RESOURCES? | is-not-empty) {
|
|
|
|
|
($env.PROVISIONING_RESOURCES | path join "ascii.txt")
|
|
|
|
|
} else if ($env.PROVISIONING? | is-not-empty) {
|
|
|
|
|
($env.PROVISIONING | path join "resources" | path join "ascii.txt")
|
|
|
|
|
} else {
|
|
|
|
|
""
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Display if file exists
|
|
|
|
|
if ($ascii_file | is-not-empty) and ($ascii_file | path exists) {
|
|
|
|
|
print $"(ansi blue_bold)(open -r $ascii_file)(ansi reset)"
|
|
|
|
|
}
|
2025-10-07 10:32:04 +01:00
|
|
|
}
|
2026-01-14 02:00:23 +00:00
|
|
|
export def use_titles [ ] {
|
2025-10-07 10:32:04 +01:00
|
|
|
if ($env.PROVISIONING_NO_TITLES? | default false) { return false }
|
|
|
|
|
if ($env.PROVISIONING_NO_TERMINAL? | default false) { return false }
|
chore: complete KCL to Nickel migration cleanup and setup pre-commit
Clean up 404 KCL references (99.75% complete):
- Rename kcl_* variables to schema_*/nickel_* (kcl_path→schema_path, etc.)
- Update functions: parse_kcl_file→parse_nickel_file
- Update env vars: KCL_MOD_PATH→NICKEL_IMPORT_PATH
- Fix cli/providers-install: add has_nickel and nickel_version variables
- Correct import syntax: .nickel.→.ncl.
- Update 57 files across core, CLI, config, and utilities
Configure pre-commit hooks:
- Activate: nushell-check, nickel-typecheck, markdownlint
- Comment out: Rust hooks (fmt, clippy, test), check-yaml
Testing:
- Module discovery: 9 modules (6 providers, 1 taskserv, 2 clusters) ✅
- Syntax validation: 15 core files ✅
- Pre-commit hooks: all passing ✅
2026-01-08 20:08:46 +00:00
|
|
|
let args = ($env.PROVISIONING_ARGS? | default "")
|
|
|
|
|
if ($args | is-not-empty) and ($args | str contains "-h" ) { return false }
|
|
|
|
|
if ($args | is-not-empty) and ($args | str contains "--notitles" ) { return false }
|
|
|
|
|
if ($args | is-not-empty) and ($args | str contains "query") and ($args | str contains "-o" ) { return false }
|
2025-10-07 10:32:04 +01:00
|
|
|
true
|
|
|
|
|
}
|
|
|
|
|
export def provisioning_init [
|
|
|
|
|
helpinfo: bool
|
|
|
|
|
module: string
|
|
|
|
|
args: list<string> # Other options, use help to get info
|
2026-01-14 02:00:23 +00:00
|
|
|
] {
|
2025-10-07 10:32:04 +01:00
|
|
|
if (use_titles) { show_titles }
|
|
|
|
|
if $helpinfo != null and $helpinfo {
|
|
|
|
|
let cmd_line: list<string> = if ($args| length) == 0 {
|
|
|
|
|
$args | str join " "
|
|
|
|
|
} else {
|
|
|
|
|
($env.PROVISIONING_ARGS? | default "")
|
|
|
|
|
}
|
|
|
|
|
let cmd_args: list<string> = ($cmd_line | str replace "--helpinfo" "" |
|
|
|
|
|
str replace "-h" "" | str replace $module "" | str trim | split row " "
|
|
|
|
|
)
|
|
|
|
|
if ($cmd_args | length) > 0 {
|
2026-01-21 10:24:17 +00:00
|
|
|
# Refactored from try-catch to do/complete for explicit error handling
|
|
|
|
|
let str_mod_0_result = (do { $cmd_args | get 0 } | complete)
|
|
|
|
|
let str_mod_0 = if $str_mod_0_result.exit_code == 0 { ($str_mod_0_result.stdout | str trim) } else { "" }
|
|
|
|
|
|
|
|
|
|
let str_mod_1_result = (do { $cmd_args | get 1 } | complete)
|
|
|
|
|
let str_mod_1 = if $str_mod_1_result.exit_code == 0 { ($str_mod_1_result.stdout | str trim) } else { "" }
|
|
|
|
|
|
|
|
|
|
if $str_mod_1 != "" {
|
|
|
|
|
let final_args = ($cmd_args | drop nth 0 1)
|
|
|
|
|
^$"((get-provisioning-name))" "-mod" $"'($str_mod_0) ($str_mod_1)'" ...$final_args help
|
|
|
|
|
} else if $str_mod_0 != "" {
|
|
|
|
|
let final_args = ($cmd_args | drop nth 0)
|
|
|
|
|
^$"((get-provisioning-name))" "-mod" ($str_mod_0) ...$final_args help
|
|
|
|
|
} else {
|
|
|
|
|
^$"((get-provisioning-name))" "-mod" $"($module | str replace ' ' '|')" ...$cmd_args help
|
|
|
|
|
}
|
2025-10-07 10:32:04 +01:00
|
|
|
} else {
|
|
|
|
|
^$"((get-provisioning-name))" help
|
|
|
|
|
}
|
|
|
|
|
exit 0
|
|
|
|
|
}
|
chore: complete KCL to Nickel migration cleanup and setup pre-commit
Clean up 404 KCL references (99.75% complete):
- Rename kcl_* variables to schema_*/nickel_* (kcl_path→schema_path, etc.)
- Update functions: parse_kcl_file→parse_nickel_file
- Update env vars: KCL_MOD_PATH→NICKEL_IMPORT_PATH
- Fix cli/providers-install: add has_nickel and nickel_version variables
- Correct import syntax: .nickel.→.ncl.
- Update 57 files across core, CLI, config, and utilities
Configure pre-commit hooks:
- Activate: nushell-check, nickel-typecheck, markdownlint
- Comment out: Rust hooks (fmt, clippy, test), check-yaml
Testing:
- Module discovery: 9 modules (6 providers, 1 taskserv, 2 clusters) ✅
- Syntax validation: 15 core files ✅
- Pre-commit hooks: all passing ✅
2026-01-08 20:08:46 +00:00
|
|
|
}
|