prvng_core/nulib/scripts
Jesús Pérez bea0477b25
refactor(18 files): selective imports — drive to 94.6% elimination (ADR-025 L2/L3)
Final mega-batch of single-star conversions combined in one commit.

=== Orchestrator facades (Layer 3, expanded to explicit symbol lists) ===
  config/accessor.nu            18 symbols (bridges accessor/mod)
  config/accessor_generated.nu  18 symbols (consumer of accessor)
  utils/version.nu              35 symbols (bridges version/mod)
  dependencies/mod.nu            7 symbols from resolver.nu
  oci_registry/mod.nu           12 multi-word "oci-registry X" subcommands
  oci/commands.nu               12 symbols from oci/client.nu
                                + removed redundant `use ./client.nu *` that
                                  was duplicated below the selective import

=== Selective imports (Layer 2) ===
  platform/discovery.nu         target.nu [5 symbols]
  platform/health.nu            target.nu [2 symbols]
  platform/connection.nu        user/config [get-active-workspace]
  vm/preparer.nu                vm/detector [check-vm-capability]
  vm/backend_libvirt.nu         result.nu [7 symbols]
  extensions/tests/test_versions.nu  versions [5 symbols]
  utils/version/loader.nu       nickel_processor [ncl-eval ncl-eval-soft]

=== Dead imports dropped ===
  platform/credentials.nu       user/config
  platform/activation.nu        target
  config/cache/core.nu          cache/metadata
  config/interpolation/core.nu  helpers/environment
  utils/version/loader.nu       version/core (kept nickel_processor)

=== Also included (pre-existing edits from earlier session) ===
  utils/settings.nu             pilot selective imports — reformatted
                                (file was modified externally during session)

Validation: all 18 files match pre-existing baselines (0 errors for clean
ones; 4/18/24/45/50/50 for pre-existing transitive noise).

MILESTONE: 94.6% of star-imports eliminated (370 → 20).

Remaining 20 star-lines in 5 files are intentional:
- lib_provisioning/mod.nu      (13 stars — root facade; empties in ADR-025 Phase 4)
- integrations/mod.nu          (2 stars — re-exports already-selective children)
- cmd/environment.nu           (3 stars — contains ~7 undefined function calls;
                                needs Blocker-1 style cleanup follow-up)
- providers/loader.nu          (1 dynamic `use ($entry_point) *` — runtime dispatch)
- vm/cleanup_scheduler.nu      (1 in string template — not a real import)

Refs: ADR-025
2026-04-17 17:10:47 +01:00
..
get-help-category.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
prov-bootstrap.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
prov-cluster-deploy.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
query-clusters.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
query-infra-detail.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
query-infra.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
query-providers.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
query-servers.nu refactor(18 files): selective imports — drive to 94.6% elimination (ADR-025 L2/L3) 2026-04-17 17:10:47 +01:00
query-taskservs.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
query-workspace-info.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
README.md feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
validate-command.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00
validate-config.nu feat(core): three-layer DAG, unified component arch, commands-registry cache, Nushell 0.112.2 migration 2026-04-17 04:27:33 +01:00

Core Provisioning Scripts

Reusable Nushell scripts for querying system state, validation, and metadata extraction.

Purpose

These scripts provide a clean interface for:

  • Querying system resources (providers, servers, clusters, etc.)
  • Validating system state (commands, configuration)
  • Extracting metadata (help categories, schema info)

Usage Contexts

  1. Bash wrapper (provisioning/core/cli/provisioning)
  2. CLI commands (via dispatcher and command handlers)
  3. Direct invocation (for debugging, testing, CI/CD)
  4. Other scripts (as utilities)

Scripts

Query Scripts (Read-only resource listing)

Script Purpose Usage
query-providers.nu List all available providers nu query-providers.nu
query-taskservs.nu List all available taskservs nu query-taskservs.nu
query-servers.nu List servers in active workspace nu query-servers.nu [infra_filter]
query-clusters.nu List clusters in active workspace nu query-clusters.nu
query-infra.nu List infrastructures in active workspace nu query-infra.nu

Output: Table format (columns: name, type, status, etc.)

Validation Scripts

Script Purpose Usage
validate-command.nu Validate if command exists in registry nu validate-command.nu <command_name>
validate-config.nu Validate configuration structure nu validate-config.nu

Output:

  • validate-command.nu: FOUND|true/false or NOT_FOUND
  • validate-config.nu: Validation errors or success message

Metadata Scripts

Script Purpose Usage
get-help-category.nu Get help category for command nu get-help-category.nu <schema_file> <command>

Output: Help category string or empty

Design Principles

  1. Single responsibility: Each script does ONE thing
  2. Reusable: Can be called from any context
  3. Testable: Can run standalone with nu --ide-check
  4. Self-contained: Minimal dependencies (lib_minimal.nu when needed)
  5. Structured output: Consistent format for bash consumption

Naming Convention

  • query-*.nu: Read-only resource listing
  • validate-*.nu: System state validation
  • get-*.nu: Metadata extraction

Guidelines

  • Use do { } | complete pattern for error handling
  • All scripts should be executable (chmod +x)
  • Use #!/usr/bin/env nu shebang
  • Source lib_minimal.nu when workspace functions needed
  • Return structured output (table, string, or status code)
  • No side effects (read-only operations)

Testing

# Syntax validation
nu --ide-check 50 query-providers.nu

# Functional testing
nu query-providers.nu
nu validate-command.nu platform
nu get-help-category.nu "$PROVISIONING/core/nulib/commands-registry.ncl" guides

Migration from init-wrapper

These scripts were previously in provisioning/core/cli/init-wrapper/ with different names:

  • provider-list.nuquery-providers.nu
  • taskserv-list.nuquery-taskservs.nu
  • server-list.nuquery-servers.nu
  • cluster-list.nuquery-clusters.nu
  • infra-list.nuquery-infra.nu
  • validate-command.nu → (same name)
  • validate-config.nu → (same name)
  • get-help-category.nu → (same name)

The new location (core/nulib/scripts/) reflects their general-purpose nature beyond just bash wrapper initialization.