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

159 lines
4.9 KiB
Plaintext

#!/usr/bin/env nu
# Dashboard Management Commands
# Interactive dashboards and data visualization
use ../dashboard/marimo_integration.nu *
# Main dashboard command
export def main [
subcommand?: string
...args: string
]: [string, ...string] -> nothing {
if ($subcommand | is-empty) {
print "📊 Systems Provisioning Dashboard"
print ""
print "Interactive dashboards for infrastructure monitoring and analytics"
print ""
print "Usage: provisioning dashboard <subcommand> [args...]"
print ""
print "Subcommands:"
print " create [template] [name] - Create interactive dashboard"
print " start <name> [port] - Start dashboard server"
print " list - List available dashboards"
print " export <name> [output] - Export dashboard to HTML"
print " demo - Create and start demo dashboard"
print " status - Show dashboard system status"
print ""
print "Templates:"
print " monitoring - Real-time logs and metrics"
print " infrastructure - Server and cluster overview"
print " full - Complete observability dashboard"
print " ai-insights - AI-powered analytics and predictions"
print ""
print "Examples:"
print " provisioning dashboard demo"
print " provisioning dashboard create monitoring my-dashboard"
print " provisioning dashboard start my-dashboard 8080"
print ""
return
}
match $subcommand {
"create" => {
marimo_integration create ...$args
}
"start" => {
marimo_integration start ...$args
}
"list" => {
marimo_integration list
}
"export" => {
marimo_integration export ...$args
}
"demo" => {
create_demo_dashboard
}
"status" => {
show_dashboard_status
}
_ => {
print $"❌ Unknown subcommand: ($subcommand)"
print "Run 'provisioning dashboard' for help"
}
}
}
# Create and start a demo dashboard
def create_demo_dashboard []: nothing -> nothing {
print "🚀 Creating demo dashboard with live data..."
# Check if API server is running
let api_status = check_api_server_status
if not $api_status {
print "⚠️ API server not running. Starting API server..."
start_api_server --port 3000 --background
sleep 3sec
}
# Create AI insights dashboard
marimo_integration create ai-insights demo-dashboard
print ""
print "🎉 Demo dashboard created and started!"
print "📊 Open your browser to: http://localhost:8080"
print ""
print "Features available:"
print " 🔍 Real-time log analysis"
print " 📈 System metrics visualization"
print " 🏗️ Infrastructure topology"
print " 🤖 AI-powered insights and predictions"
print " 📊 Interactive charts and tables"
print ""
}
# Check API server status
def check_api_server_status []: nothing -> bool {
let result = (do { http get "http://localhost:3000/health" | get status } | complete)
if $result.exit_code != 0 {
false
} else {
$result.stdout == "healthy"
}
}
# Start API server in background
def start_api_server [--port: int = 3000, --background = false]: nothing -> nothing {
if $background {
nu -c "use ../api/server.nu *; start_api_server --port $port" &
} else {
use ../api/server.nu *
start_api_server --port $port
}
}
# Show dashboard system status
def show_dashboard_status []: nothing -> nothing {
print "📊 Dashboard System Status"
print ""
# Check Marimo installation
let marimo_available = check_marimo_available
let marimo_status = if $marimo_available { "✅ Installed" } else { "❌ Not installed" }
print $"Marimo: ($marimo_status)"
# Check API server
let api_status = check_api_server_status
let api_display = if $api_status { "✅ Running" } else { "❌ Stopped" }
print $"API Server: ($api_display)"
# List dashboards
let dashboards = list_dashboards
print $"Dashboards: ($dashboards | length) available"
if ($dashboards | length) > 0 {
print ""
print "Available dashboards:"
$dashboards | select name modified | table
}
# System resources
print ""
print "System Resources:"
let mem_info = (sys mem)
print $"Memory: ($mem_info.used | into string) / ($mem_info.total | into string) used"
print ""
print "Quick start:"
if not $marimo_available {
print "1. Install Marimo: provisioning dashboard create install"
}
if not $api_status {
print "2. Start API: provisioning api start"
}
print "3. Create dashboard: provisioning dashboard demo"
}