prvng_core/nulib/provisioning detect
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

115 lines
3.0 KiB
Plaintext
Executable File

#!/usr/bin/env nu
# Provisioning Detector - Technology Detection and Requirement Inference
use lib_provisioning *
def main [
path?: string # Project path
--out (-o): string = "text" # Output format: text, json, yaml
--high-confidence-only (-C) # Show only high-confidence detections
--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
}
# Build detector command
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 = [
"detect"
$project_path
"--format" $out
]
let detector_args = (
if $high_confidence_only {
$detector_args | append "--high-confidence-only"
} 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 "❌ Detection failed"
if $debug {
print -e $"Output: ($result.stdout)"
}
return
}
if $out == "json" or $out == "yaml" {
print $result.stdout
} else {
# Text output with formatting
print $result.stdout
}
}
# 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 detect info" [
] {
print "Provisioning Detector - Technology Detection & Requirement Inference"
}