#!/usr/bin/env nu
# Standalone bootstrap runner — bypasses the dispatcher.
# Loads only the modules needed for L1 Hetzner resource provisioning.
#
# Usage (from provisioning/ dir):
#   nu core/nulib/scripts/prov-bootstrap.nu -w librecloud_renew --dry-run
#   nu core/nulib/scripts/prov-bootstrap.nu -w librecloud_renew

use ../main_provisioning/bootstrap.nu *
use ../lib_provisioning/user/config.nu [get-workspace-path, get-active-workspace-details]
use ../lib_provisioning/workspace *

def main [
    --workspace (-w): string   # Workspace name (default: active workspace)
    --dry-run (-n)             # Print what would be created without calling the API
] {
    if ($workspace | is-not-empty) and $dry_run {
        main bootstrap --workspace $workspace --dry-run
    } else if ($workspace | is-not-empty) {
        main bootstrap --workspace $workspace
    } else if $dry_run {
        main bootstrap --dry-run
    } else {
        main bootstrap
    }
}
