prvng_core/nulib/main_provisioning/sops.nu
Jesús Pérez 894046ef5a
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

71 lines
2.2 KiB
Text

use ../lib_provisioning/sops *
use ../lib_provisioning/config/accessor.nu *
# SOPS encryption management
export def "main sops" [
sourcefile?: string # source file for sops command
targetfile?: string # target file for sops command
--encrypt (-e) # SOPS encrypt file
--decrypt (-d) # SOPS decrypt file
--gen (-g) # SOPS generate encrypted files
--sed # Edit sops encrypted file
--debug (-x) # Use Debug mode
--xm # Debug with PROVISIONING_METADATA
--xc # Debuc for task and services locally PROVISIONING_DEBUG_CHECK
--xr # Debug for remote servers PROVISIONING_DEBUG_REMOTE
--xld # Log level with DEBUG PROVISIONING_LOG_LEVEL=debug
--metadata # Error with metadata (-xm)
--notitles # not tittles
--out: string # Print Output format: json, yaml, text (default)
] {
if ($out | is-not-empty) {
$env.PROVISIONING_OUT = $out
$env.PROVISIONING_NO_TERMINAL = true
}
parse_help_command "sops" --end
if $debug { $env.PROVISIONING_DEBUG = true }
if $sourcefile == "sed" or $sourcefile == "ed" {
on_sops "sed" $targetfile
end_run "sops"
return true
}
if $sed and $sourcefile != null and ($sourcefile | path exists) {
on_sops sed $sourcefile
exit
}
if $encrypt {
if $sourcefile == null or not ($sourcefile | path exists) {
print $"🛑 Error on_sops encrypt 'sourcefile' ($sourcefile) not found "
exit 1
}
if ($targetfile | is-not-empty) {
print $"on_sops encrypt ($sourcefile) ($targetfile)"
on_sops "encrypt" $sourcefile $targetfile
exit
} else {
print $"on_sops encrypt ($sourcefile) "
print (on_sops "encrypt" $sourcefile)
exit
}
}
if $decrypt {
if $sourcefile == null or not ($sourcefile | path exists) {
print $"🛑 Error on_sops decrypt 'sourcefile' ($sourcefile) not found "
return false
}
if ($targetfile | is-not-empty) {
on_sops decrypt $sourcefile $targetfile
exit
} else {
print (on_sops decrypt $sourcefile)
exit
}
}
if $gen and $sourcefile != null {
on_sops generate $sourcefile $targetfile
exit
}
option_undefined "sops" ""
#cleanup $settings.wk_path
end_run "sops"
}