prvng_core/nulib/provisioning complete
Jesús Pérez 316622a78f
merge(refactor/lazy-loading): ADR-025 lazy-loading complete
557 files merged. Conflicts resolved:
  - CHANGELOG.md: took refactor/lazy-loading (session changelog)
  - versions.ncl: took refactor/lazy-loading (adds typedialog entries)
2026-04-17 23:09:56 +01:00

115 lines
3 KiB
Text
Executable file
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env nu
# Provisioning Completer - Infrastructure Declaration Completion
use lib_provisioning *
def main [
path?: string # Project path
--out (-o): string = "text" # Output format: text, json, yaml
--check (-c) # Check mode (report only, no changes)
--pretty # Pretty-print JSON/YAML output
--debug (-x) # Enable debug output
] {
let project_path = ($path | default ".")
# Validate path exists
if not ($project_path | path exists) {
print -e $"❌ Path not found: ($project_path)"
return
}
# Get detector binary
let detector_bin = (detect-binary-path)
if not ($detector_bin | path exists) {
print -e $"❌ Detector binary not found at: ($detector_bin)"
print -e "Install: cargo build --release --bin provisioning-detector"
return
}
# Build command arguments
let detector_args = [
"complete"
$project_path
"--format" $out
]
let detector_args = (
if $check {
$detector_args | append "--check"
} else {
$detector_args
}
)
let detector_args = (
if $pretty {
$detector_args | append "--pretty"
} else {
$detector_args
}
)
# Run detector
if $debug {
print $"🔍 Running: ($detector_bin) ($detector_args | str join ' ')"
}
let result = (^$detector_bin ...$detector_args | complete)
if $result.exit_code != 0 {
print -e "❌ Completion failed"
if $debug {
print -e $"Output: ($result.stdout)"
}
return
}
print $result.stdout
if $check {
print ""
print " Check mode - no changes applied to your declaration"
print "Run without --check flag to apply recommended completions"
}
}
# Helper: Locate the provisioning-detector binary
def detect-binary-path [] {
let env_prov = ($env.PROVISIONING? | default "")
let possible_paths = if ($env_prov | is-not-empty) {
[
($env_prov | path join "platform" "target" "debug" "provisioning-detector")
($env_prov | path join "platform" "target" "release" "provisioning-detector")
"/usr/local/bin/provisioning-detector"
"/usr/bin/provisioning-detector"
]
} else {
[
"/Users/Akasha/project-provisioning/provisioning/platform/target/debug/provisioning-detector"
"/Users/Akasha/project-provisioning/provisioning/platform/target/release/provisioning-detector"
"/usr/local/bin/provisioning-detector"
"/usr/bin/provisioning-detector"
]
}
let existing = ($possible_paths | where { |p|
(($p | is-not-empty) and ($p | path exists))
})
if ($existing | length) > 0 {
$existing | first
} else {
if ($env_prov | is-not-empty) {
$env_prov | path join "platform" "target" "release" "provisioning-detector"
} else {
"/Users/Akasha/project-provisioning/provisioning/platform/target/release/provisioning-detector"
}
}
}
export def "main complete info" [
] {
print "Provisioning Completer - Infrastructure Declaration Completion"
}