2025-10-07 10:32:04 +01:00
|
|
|
#!/usr/bin/env nu
|
2025-12-11 21:57:05 +00:00
|
|
|
# Provisioning Workflow - Infrastructure-from-Code Pipeline
|
2025-10-07 10:32:04 +01:00
|
|
|
|
|
|
|
|
def main [
|
2025-12-11 21:57:05 +00:00
|
|
|
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
|
2025-10-07 10:32:04 +01:00
|
|
|
}
|
2025-12-11 21:57:05 +00:00
|
|
|
|
|
|
|
|
if $debug {
|
|
|
|
|
print $"🔍 Starting Infrastructure-from-Code workflow"
|
|
|
|
|
print $" Project: ($project_path)"
|
|
|
|
|
print ""
|
2025-10-07 10:32:04 +01:00
|
|
|
}
|
|
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
# Run detection
|
|
|
|
|
print ""
|
|
|
|
|
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
|
|
|
print "🔄 Infrastructure-from-Code Workflow"
|
|
|
|
|
print "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
|
|
|
print ""
|
|
|
|
|
|
|
|
|
|
print "STEP 1: Technology Detection"
|
|
|
|
|
print "────────────────────────────"
|
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
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
let detector_bin = (detect-binary-path)
|
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
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
if not ($detector_bin | path exists) {
|
|
|
|
|
print -e "❌ Detector binary not found"
|
|
|
|
|
return
|
2025-10-07 10:32:04 +01:00
|
|
|
}
|
|
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
let detect_result = (^$detector_bin detect $project_path --format json | complete)
|
2025-10-07 10:32:04 +01:00
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
if $detect_result.exit_code != 0 {
|
|
|
|
|
print -e "❌ Detection failed"
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let detection = ($detect_result.stdout | from json)
|
2026-01-21 10:24:17 +00:00
|
|
|
if ($detection.detections? | default [] | is-not-empty) {
|
2025-12-11 21:57:05 +00:00
|
|
|
print $"✓ Detected ($detection.detections | length) technologies"
|
|
|
|
|
}
|
|
|
|
|
print ""
|
|
|
|
|
|
|
|
|
|
# Run completion
|
|
|
|
|
print "STEP 2: Infrastructure Completion"
|
|
|
|
|
print "─────────────────────────────────"
|
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
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
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)
|
2026-01-21 10:24:17 +00:00
|
|
|
if ($completion.completeness? | default null | is-not-empty) {
|
2025-12-11 21:57:05 +00:00
|
|
|
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 "")
|
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
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
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"
|
|
|
|
|
]
|
2025-10-07 10:32:04 +01:00
|
|
|
} else {
|
2025-12-11 21:57:05 +00:00
|
|
|
[
|
|
|
|
|
"/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"
|
|
|
|
|
]
|
2025-10-07 10:32:04 +01:00
|
|
|
}
|
|
|
|
|
|
2025-12-11 21:57:05 +00:00
|
|
|
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"
|
2025-10-07 10:32:04 +01:00
|
|
|
}
|
|
|
|
|
}
|
2025-12-11 21:57:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export def "main workflow info" [] {
|
|
|
|
|
print "Provisioning Workflow - Infrastructure-from-Code Pipeline"
|
|
|
|
|
}
|