prvng_core/nulib/provisioning workflow
Jesús Pérez c62e967ce3
chore: complete KCL to Nickel migration cleanup and setup pre-commit
Clean up 404 KCL references (99.75% complete):
   - Rename kcl_* variables to schema_*/nickel_* (kcl_path→schema_path, etc.)
   - Update functions: parse_kcl_file→parse_nickel_file
   - Update env vars: KCL_MOD_PATH→NICKEL_IMPORT_PATH
   - Fix cli/providers-install: add has_nickel and nickel_version variables
   - Correct import syntax: .nickel.→.ncl.
   - Update 57 files across core, CLI, config, and utilities

   Configure pre-commit hooks:
   - Activate: nushell-check, nickel-typecheck, markdownlint
   - Comment out: Rust hooks (fmt, clippy, test), check-yaml

   Testing:
   - Module discovery: 9 modules (6 providers, 1 taskserv, 2 clusters) 
   - Syntax validation: 15 core files 
   - Pre-commit hooks: all passing 
2026-01-08 20:08:46 +00:00

118 lines
3.8 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"
}