prvng_core/nulib/scripts
Jesús Pérez 205402e990
refactor(wrapper): delete 5 remaining fast-paths — single-route complete (ADR-025 Phase 4)
Removed the final 5 fast-path intercepts and their scripts. All list/query
commands now route through a single semantic path.

Bash wrapper — removed intercept blocks:
  - `workspace list/active/info` (was: _nu_minimal + query-workspace-info.nu)
  - `env/allenv`                 (was: _nu_minimal "env-quick | table")
  - `provider/providers list`    (was: scripts/query-providers.nu)
  - `infra list/info`            (was: scripts/query-infra.nu + query-infra-detail.nu)
  - `validate config`            (was: scripts/validate-config.nu)

Preserved in wrapper:
  - workspace `--help` intercept (avoids full load for help)
  - infra with no args → `provisioning help infrastructure` (help menu)

Fast-path scripts deleted:
  - nulib/scripts/query-providers.nu
  - nulib/scripts/query-workspace-info.nu
  - nulib/scripts/query-infra.nu
  - nulib/scripts/query-infra-detail.nu
  - nulib/scripts/validate-config.nu

Remaining scripts/ files (all legitimate, not fast-paths):
  - get-help-category.nu       (help category parsing)
  - prov-bootstrap.nu          (bootstrap logic, not a data query)
  - prov-cluster-deploy.nu     (deploy execution, not a list)
  - validate-command.nu        (registry validation used by _validate_command)
  - README.md

Transitional note:
  These commands temporarily route through the main dispatch `*)` default case
  which still uses $RUNNER (the 492-line Nu runner). Cold-start for them is
  currently slow (~70s in fat-path). Phase 4.3/4.4 will empty root mod.nu and
  delete the Nu runner — restoring <1s cold-start for all commands.

Single-route invariant achieved:
  - No command has two implementations with different semantics
  - Daemon and cache become purely orthogonal concerns (transport + read
    optimization), toggleable without changing what the command returns

Refs: ADR-025 Phase 4, workspaces/libre-daoshi/.coder/2026-04-17-server-list-daemon-middleware.info.md
2026-04-17 17:43:18 +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
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

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.