Three files with 3 stars each -> selective. cmd/lib.nu: utils/init.nu [get-workspace-path get-provisioning-infra-path] (kept) sops/lib.nu [find-sops-key on_sops] config/accessor DROPPED (dead) utils/ui.nu DROPPED (dead) config/loader/core.nu: All 3 star-imports (interpolators, context_manager, sops_handler) were dead — NONE of their exports are used in the file body. All dropped. config/encryption.nu: sops/lib.nu [3 symbols — get-sops-age-key-file is_sops_file on_sops] kms/lib.nu [on_kms] plugins/kms.nu [3 symbols] (already selective; kept) config/accessor DROPPED (dead) Deferred from this batch: cmd/environment.nu. It calls 7+ functions that are not defined anywhere in the codebase (list-available-environments, get-current-environment, switch-environment, init-environment-config, show-config, compare-environments, etc.). Converting its star-imports to selective would surface those as undefined symbol errors. Needs the Blocker-1 style treatment (stubs or elimination) in a dedicated commit. Tracked as follow-up. Validation: all 3 nu --ide-check 50 -> 0 errors. Refs: ADR-025
73 lines
2.1 KiB
Text
73 lines
2.1 KiB
Text
|
|
# Made for prepare and postrun
|
|
# Selective imports (ADR-025 Phase 3 Layer 2).
|
|
# config/accessor and utils/ui star-imports were dead — dropped.
|
|
use lib_provisioning/utils/init.nu [get-workspace-path get-provisioning-infra-path]
|
|
use lib_provisioning/sops/lib.nu [find-sops-key on_sops]
|
|
|
|
export def log_debug [
|
|
msg: string
|
|
] {
|
|
use std
|
|
std log debug $msg
|
|
# std assert (1 == 1)
|
|
}
|
|
export def check_env [
|
|
] {
|
|
let vars_path = (get-provisioning-vars)
|
|
if ($vars_path | is-empty) {
|
|
_print $"🛑 Error no values found for (_ansi red_bold)PROVISIONING_VARS(_ansi reset)"
|
|
exit 1
|
|
}
|
|
if not ($vars_path | path exists) {
|
|
_print $"🛑 Error file (_ansi red_bold)($vars_path)(_ansi reset) not found"
|
|
exit 1
|
|
}
|
|
let workspace_path = (get-workspace-path)
|
|
if ($workspace_path | is-empty) {
|
|
_print $"🛑 Error no values found for (_ansi red_bold)PROVISIONING_WORKSPACE_PATH(_ansi reset)"
|
|
exit 1
|
|
}
|
|
if not ($workspace_path | path exists) {
|
|
_print $"🛑 Error file (_ansi red_bold)($workspace_path)(_ansi reset) not found"
|
|
exit 1
|
|
}
|
|
let wk_env_path = (get-provisioning-wk-env-path)
|
|
if ($wk_env_path | is-empty) {
|
|
_print $"🛑 Error no values found for (_ansi red_bold)PROVISIONING_WK_ENV_PATH(_ansi reset)"
|
|
exit 1
|
|
}
|
|
if not ($wk_env_path | path exists) {
|
|
_print $"🛑 Error file (_ansi red_bold)($wk_env_path)(_ansi reset) not found"
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
export def sops_cmd [
|
|
task: string
|
|
source: string
|
|
target?: string
|
|
--error_exit # error on exit
|
|
] {
|
|
let sops_key = (find-sops-key)
|
|
if ($sops_key | is-empty) {
|
|
$env.CURRENT_INFRA_PATH = ((get-provisioning-infra-path) | path join (get-workspace-path | path basename))
|
|
use ../../sops_env.nu
|
|
}
|
|
#use sops/lib.nu on_sops
|
|
if $error_exit {
|
|
on_sops $task $source $target --error_exit
|
|
} else {
|
|
on_sops $task $source $target
|
|
}
|
|
}
|
|
|
|
export def load_defs [
|
|
] {
|
|
let vars_path = (get-provisioning-vars)
|
|
if not ($vars_path | path exists) {
|
|
_print $"🛑 Error file (_ansi red_bold)($vars_path)(_ansi reset) not found"
|
|
exit 1
|
|
}
|
|
(open $vars_path)
|
|
}
|