#!/usr/bin/env nu
# Standalone cluster-deploy runner — bypasses the dispatcher.
# Loads only the modules needed for L3/L4 cluster extension deployment.
#
# Usage (from provisioning/ dir):
#   nu core/nulib/scripts/prov-cluster-deploy.nu platform sgoyol -w librecloud_renew --dry-run
#   nu core/nulib/scripts/prov-cluster-deploy.nu apps    sgoyol -w librecloud_renew

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

def main [
    layer: string              # Deployment layer: platform | apps
    cluster: string            # Cluster name (e.g. sgoyol)
    --workspace (-w): string   # Workspace name (default: active workspace)
    --dry-run (-n)             # Print plan without executing install scripts
    --kubeconfig (-k): string  # Override KUBECONFIG path
    --secrets-file (-s): string # SOPS-encrypted dotenv file with install secrets
] {
    let ws = ($workspace | default "")
    let kc = ($kubeconfig | default "")
    let sf = ($secrets_file | default "")
    main cluster deploy $layer $cluster --workspace $ws --dry-run=$dry_run --kubeconfig $kc --secrets-file $sf
}
