prvng_core/nulib/provisioning workflow
Jesús Pérez 85ce530733
feat: update provisioning core CLI, libraries, and plugins
Update core components including CLI, Nushell libraries, plugins system,
and utility scripts for the provisioning system.

CLI Updates:
- Command implementations
- CLI utilities and dispatching
- Help system improvements
- Command validation

Library Updates:
- Configuration management system
- Infrastructure validation
- Extension system improvements
- Secrets management
- Workspace operations
- Cache management system

Plugin System:
- Interactive form plugin (inquire)
- KCL integration plugin
- Performance optimization plugins
- Plugin registration system

Utilities:
- Build and distribution scripts
- Installation procedures
- Testing utilities
- Development tools

Documentation:
- Library module documentation
- Extension API guides
- Plugin usage guides
- Service management documentation

All changes are backward compatible. No breaking changes.
2025-12-11 21:57:05 +00:00

118 lines
3.9 KiB
Plaintext
Executable File

#!/usr/bin/env nu
# Provisioning Workflow - Infrastructure-from-Code Pipeline
def main [
path?: string # Project path
--org: string = "default" # Organization name
--out (-o): string = "text" # Output format
--apply # Apply recommendations
--verbose (-v) # Enable verbose output
--pretty # Pretty-print 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
}
if $debug {
print $"🔍 Starting Infrastructure-from-Code workflow"
print $" Project: ($project_path)"
print ""
}
# Run detection
print ""
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print "🔄 Infrastructure-from-Code Workflow"
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
print ""
print "STEP 1: Technology Detection"
print "────────────────────────────"
let detector_bin = (detect-binary-path)
if not ($detector_bin | path exists) {
print -e "❌ Detector binary not found"
return
}
let detect_result = (^$detector_bin detect $project_path --format json | complete)
if $detect_result.exit_code != 0 {
print -e "❌ Detection failed"
return
}
let detection = ($detect_result.stdout | from json)
if (try { $detection.detections | is-not-empty } catch { false }) {
print $"✓ Detected ($detection.detections | length) technologies"
}
print ""
# Run completion
print "STEP 2: Infrastructure Completion"
print "─────────────────────────────────"
let complete_result = (^$detector_bin complete $project_path --format json | complete)
if $complete_result.exit_code != 0 {
print -e "❌ Completion failed"
return
}
let completion = ($complete_result.stdout | from json)
if (try { $completion.completeness | is-not-empty } catch { false }) {
let pct = ($completion.completeness | into float | math round -p 1 | into int)
print $"✓ Completeness: ($pct)%"
}
print ""
# Summary
print "✅ Workflow Complete"
print ""
}
# 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 workflow info" [] {
print "Provisioning Workflow - Infrastructure-from-Code Pipeline"
}