prvng_core/nulib/help_minimal.nu
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

445 lines
24 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env nu
# Minimal Help System - Fast Path without Config Loading
# This bypasses the full config system for instant help display
# Uses Nushell's built-in ansi function for ANSI color codes
# Main help dispatcher - no config needed
def provisioning-help [category?: string = ""]: nothing -> string {
# If no category provided, show main help
if ($category == "") {
return (help-main)
}
# Try to match the category
let cat_lower = ($category | str downcase)
let result = (match $cat_lower {
"infrastructure" | "infra" => "infrastructure"
"orchestration" | "orch" => "orchestration"
"development" | "dev" => "development"
"workspace" | "ws" => "workspace"
"setup" | "st" => "setup"
"platform" | "plat" => "platform"
"authentication" | "auth" => "authentication"
"mfa" => "mfa"
"plugins" | "plugin" => "plugins"
"utilities" | "utils" | "cache" => "utilities"
"tools" => "tools"
"vm" => "vm"
"diagnostics" | "diag" | "status" | "health" => "diagnostics"
"concepts" | "concept" => "concepts"
"guides" | "guide" | "howto" => "guides"
"integrations" | "integration" | "int" => "integrations"
_ => "unknown"
})
# If unknown category, show error
if $result == "unknown" {
print $"❌ Unknown help category: \"($category)\"\n"
print "Available help categories: infrastructure, orchestration, development, workspace, setup, platform,"
print "authentication, mfa, plugins, utilities, tools, vm, diagnostics, concepts, guides, integrations"
return ""
}
# Match valid category
match $result {
"infrastructure" => (help-infrastructure)
"orchestration" => (help-orchestration)
"development" => (help-development)
"workspace" => (help-workspace)
"setup" => (help-setup)
"platform" => (help-platform)
"authentication" => (help-authentication)
"mfa" => (help-mfa)
"plugins" => (help-plugins)
"utilities" => (help-utilities)
"tools" => (help-tools)
"vm" => (help-vm)
"diagnostics" => (help-diagnostics)
"concepts" => (help-concepts)
"guides" => (help-guides)
"integrations" => (help-integrations)
_ => (help-main)
}
}
# Main help overview
def help-main []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "╔════════════════════════════════════════════════════════════════╗" + (ansi rst) + "\n" +
(ansi yellow) + (ansi bo) + "║" + (ansi rst) + " " + (ansi cyan) + (ansi bo) + "PROVISIONING SYSTEM" + (ansi rst) + " - Layered Infrastructure Automation " + (ansi yellow) + (ansi bo) + " ║" + (ansi rst) + "\n" +
(ansi yellow) + (ansi bo) + "╚════════════════════════════════════════════════════════════════╝" + (ansi rst) + "\n\n" +
(ansi green) + (ansi bo) + "📚 COMMAND CATEGORIES" + (ansi rst) + " " + (ansi d) + "- Use 'provisioning help <category>' for details" + (ansi rst) + "\n\n" +
" " + (ansi cyan) + "🏗️ infrastructure" + (ansi rst) + " " + (ansi d) + "[infra]" + (ansi rst) + "\t\t Server, taskserv, cluster, VM, and infra management\n" +
" " + (ansi magenta) + "⚡ orchestration" + (ansi rst) + " " + (ansi d) + "[orch]" + (ansi rst) + "\t\t Workflow, batch operations, and orchestrator control\n" +
" " + (ansi blue) + "🧩 development" + (ansi rst) + " " + (ansi d) + "[dev]" + (ansi rst) + "\t\t\t Module discovery, layers, versions, and packaging\n" +
" " + (ansi green) + "📁 workspace" + (ansi rst) + " " + (ansi d) + "[ws]" + (ansi rst) + "\t\t\t Workspace and template management\n" +
" " + (ansi magenta) + "⚙️ setup" + (ansi rst) + " " + (ansi d) + "[st]" + (ansi rst) + "\t\t\t\t System setup, configuration, and initialization\n" +
" " + (ansi red) + "🖥️ platform" + (ansi rst) + " " + (ansi d) + "[plat]" + (ansi rst) + "\t\t\t Orchestrator, Control Center UI, MCP Server\n" +
" " + (ansi yellow) + "🔐 authentication" + (ansi rst) + " " + (ansi d) + "[auth]" + (ansi rst) + "\t\t JWT authentication, MFA, and sessions\n" +
" " + (ansi cyan) + "🔌 plugins" + (ansi rst) + " " + (ansi d) + "[plugin]" + (ansi rst) + "\t\t\t Plugin management and integration\n" +
" " + (ansi green) + "🛠️ utilities" + (ansi rst) + " " + (ansi d) + "[utils]" + (ansi rst) + "\t\t\t Cache, SOPS editing, providers, plugins, SSH\n" +
" " + (ansi yellow) + "🌉 integrations" + (ansi rst) + " " + (ansi d) + "[int]" + (ansi rst) + "\t\t\t Prov-ecosystem and provctl bridge\n" +
" " + (ansi green) + "🔍 diagnostics" + (ansi rst) + " " + (ansi d) + "[diag]" + (ansi rst) + "\t\t\t System status, health checks, and next steps\n" +
" " + (ansi magenta) + "📚 guides" + (ansi rst) + " " + (ansi d) + "[guide]" + (ansi rst) + "\t\t\t Quick guides and cheatsheets\n" +
" " + (ansi yellow) + "💡 concepts" + (ansi rst) + " " + (ansi d) + "[concept]" + (ansi rst) + "\t\t\t Understanding layers, modules, and architecture\n\n" +
(ansi green) + (ansi bo) + "🚀 QUICK START" + (ansi rst) + "\n\n" +
" 1. " + (ansi cyan) + "Understand the system" + (ansi rst) + ": provisioning help concepts\n" +
" 2. " + (ansi cyan) + "Create workspace" + (ansi rst) + ": provisioning workspace init my-infra --activate\n" +
" " + (ansi cyan) + "Or use interactive:" + (ansi rst) + " provisioning workspace init --interactive\n" +
" 3. " + (ansi cyan) + "Discover modules" + (ansi rst) + ": provisioning module discover taskservs\n" +
" 4. " + (ansi cyan) + "Create servers" + (ansi rst) + ": provisioning server create --infra my-infra\n" +
" 5. " + (ansi cyan) + "Deploy services" + (ansi rst) + ": provisioning taskserv create kubernetes\n\n" +
(ansi green) + (ansi bo) + "🔧 COMMON COMMANDS" + (ansi rst) + "\n\n" +
" provisioning server list - List all servers\n" +
" provisioning workflow list - List workflows\n" +
" provisioning module discover taskservs - Discover available taskservs\n" +
" provisioning layer show <workspace> - Show layer resolution\n" +
" provisioning config validate - Validate configuration\n" +
" provisioning help <category> - Get help on a topic\n\n" +
(ansi green) + (ansi bo) + " HELP TOPICS" + (ansi rst) + "\n\n" +
" provisioning help infrastructure " + (ansi d) + "[or: infra]" + (ansi rst) + " - Server/cluster lifecycle\n" +
" provisioning help orchestration " + (ansi d) + "[or: orch]" + (ansi rst) + " - Workflows and batch operations\n" +
" provisioning help development " + (ansi d) + "[or: dev]" + (ansi rst) + " - Module system and tools\n" +
" provisioning help workspace " + (ansi d) + "[or: ws]" + (ansi rst) + " - Workspace management\n" +
" provisioning help setup " + (ansi d) + "[or: st]" + (ansi rst) + " - System setup and configuration\n" +
" provisioning help platform " + (ansi d) + "[or: plat]" + (ansi rst) + " - Platform services\n" +
" provisioning help authentication " + (ansi d) + "[or: auth]" + (ansi rst) + " - Authentication system\n" +
" provisioning help utilities " + (ansi d) + "[or: utils]" + (ansi rst) + " - Cache, SOPS, providers, utilities\n" +
" provisioning help guides " + (ansi d) + "[or: guide]" + (ansi rst) + " - Step-by-step guides\n"
)
}
# Infrastructure help
def help-infrastructure []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "INFRASTRUCTURE MANAGEMENT" + (ansi rst) + "\n\n" +
"Manage servers, taskservs, clusters, and VMs across your infrastructure.\n\n" +
(ansi green) + (ansi bo) + "SERVER COMMANDS" + (ansi rst) + "\n" +
" provisioning server create --infra <name> - Create new server\n" +
" provisioning server list - List all servers\n" +
" provisioning server delete <server> - Delete a server\n" +
" provisioning server ssh <server> - SSH into server\n" +
" provisioning server price - Show server pricing\n\n" +
(ansi green) + (ansi bo) + "TASKSERV COMMANDS" + (ansi rst) + "\n" +
" provisioning taskserv create <type> - Create taskserv\n" +
" provisioning taskserv delete <type> - Delete taskserv\n" +
" provisioning taskserv list - List taskservs\n" +
" provisioning taskserv generate <type> - Generate taskserv config\n" +
" provisioning taskserv check-updates - Check for updates\n\n" +
(ansi green) + (ansi bo) + "CLUSTER COMMANDS" + (ansi rst) + "\n" +
" provisioning cluster create <name> - Create cluster\n" +
" provisioning cluster delete <name> - Delete cluster\n" +
" provisioning cluster list - List clusters\n"
)
}
# Orchestration help
def help-orchestration []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "ORCHESTRATION AND WORKFLOWS" + (ansi rst) + "\n\n" +
"Manage workflows, batch operations, and orchestrator services.\n\n" +
(ansi green) + (ansi bo) + "WORKFLOW COMMANDS" + (ansi rst) + "\n" +
" provisioning workflow list - List workflows\n" +
" provisioning workflow status <id> - Get workflow status\n" +
" provisioning workflow monitor <id> - Monitor workflow progress\n" +
" provisioning workflow stats - Show workflow statistics\n\n" +
(ansi green) + (ansi bo) + "BATCH COMMANDS" + (ansi rst) + "\n" +
" provisioning batch submit <file> - Submit batch workflow\n" +
" provisioning batch list - List batches\n" +
" provisioning batch status <id> - Get batch status\n\n" +
(ansi green) + (ansi bo) + "ORCHESTRATOR COMMANDS" + (ansi rst) + "\n" +
" provisioning orchestrator start - Start orchestrator\n" +
" provisioning orchestrator stop - Stop orchestrator\n"
)
}
# Development help
def help-development []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "DEVELOPMENT AND MODULES" + (ansi rst) + "\n\n" +
"Manage modules, layers, versions, and packaging.\n\n" +
(ansi green) + (ansi bo) + "MODULE COMMANDS" + (ansi rst) + "\n" +
" provisioning module discover <type> - Discover available modules\n" +
" provisioning module load <name> - Load a module\n" +
" provisioning module list - List loaded modules\n\n" +
(ansi green) + (ansi bo) + "LAYER COMMANDS" + (ansi rst) + "\n" +
" provisioning layer show <workspace> - Show layer resolution\n" +
" provisioning layer test <layer> - Test a layer\n"
)
}
# Workspace help
def help-workspace []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "WORKSPACE MANAGEMENT" + (ansi rst) + "\n\n" +
"Initialize, switch, and manage workspaces.\n\n" +
(ansi green) + (ansi bo) + "WORKSPACE COMMANDS" + (ansi rst) + "\n" +
" provisioning workspace init [name] - Initialize new workspace\n" +
" provisioning workspace list - List all workspaces\n" +
" provisioning workspace active - Show active workspace\n" +
" provisioning workspace activate <name> - Activate workspace\n"
)
}
# Platform help
def help-platform []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "PLATFORM SERVICES" + (ansi rst) + "\n\n" +
"Manage orchestrator, control center, and MCP services.\n\n" +
(ansi green) + (ansi bo) + "ORCHESTRATOR SERVICE" + (ansi rst) + "\n" +
" provisioning orchestrator start - Start orchestrator\n" +
" provisioning orchestrator status - Check status\n"
)
}
# Setup help
def help-setup []: nothing -> string {
(
(ansi magenta) + (ansi bo) + "SYSTEM SETUP & CONFIGURATION" + (ansi rst) + "\n\n" +
"Initialize and configure the provisioning system.\n\n" +
(ansi green) + (ansi bo) + "INITIAL SETUP" + (ansi rst) + "\n" +
" provisioning setup system - Complete system setup wizard\n" +
" Interactive TUI mode (default), auto-detect OS, setup platform services\n\n" +
(ansi green) + (ansi bo) + "WORKSPACE SETUP" + (ansi rst) + "\n" +
" provisioning setup workspace <name> - Create new workspace\n" +
" Initialize workspace structure, set active providers\n\n" +
(ansi green) + (ansi bo) + "PROVIDER SETUP" + (ansi rst) + "\n" +
" provisioning setup provider <name> - Configure cloud provider\n" +
" Supported: upcloud, aws, hetzner, local\n\n" +
(ansi green) + (ansi bo) + "PLATFORM SETUP" + (ansi rst) + "\n" +
" provisioning setup platform - Setup platform services\n" +
" Orchestrator, Control Center, KMS Service, MCP Server\n\n" +
(ansi green) + (ansi bo) + "SETUP MODES" + (ansi rst) + "\n" +
" --interactive - Beautiful TUI wizard (default)\n" +
" --config <file> - Load settings from TOML/YAML file\n" +
" --defaults - Auto-detect and use sensible defaults\n\n" +
(ansi cyan) + "SETUP PHASES:" + (ansi rst) + "\n" +
" 1. System Setup - Initialize OS-appropriate paths and services\n" +
" 2. Workspace - Create infrastructure project workspace\n" +
" 3. Providers - Register cloud providers with credentials\n" +
" 4. Platform - Launch orchestration and control services\n" +
" 5. Validation - Verify all components working\n\n" +
(ansi cyan) + "SECURITY:" + (ansi rst) + "\n" +
" • RustyVault: Primary credentials storage (encrypt/decrypt at rest)\n" +
" • SOPS/Age: Bootstrap encryption for RustyVault key only\n" +
" • Cedar: Fine-grained access policies\n\n" +
(ansi green) + (ansi bo) + "QUICK START EXAMPLES" + (ansi rst) + "\n" +
" provisioning setup system --interactive # TUI setup (recommended)\n" +
" provisioning setup workspace myproject # Create workspace\n" +
" provisioning setup provider upcloud # Configure provider\n" +
" provisioning setup platform --mode solo # Setup services\n"
)
}
# Authentication help
def help-authentication []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "AUTHENTICATION AND SECURITY" + (ansi rst) + "\n\n" +
"Manage user authentication, MFA, and security.\n\n" +
(ansi green) + (ansi bo) + "LOGIN AND SESSIONS" + (ansi rst) + "\n" +
" provisioning login - Login to system\n" +
" provisioning logout - Logout from system\n"
)
}
# MFA help
def help-mfa []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "MULTI-FACTOR AUTHENTICATION" + (ansi rst) + "\n\n" +
"Setup and manage MFA methods.\n\n" +
(ansi green) + (ansi bo) + "TOTP (Time-based One-Time Password)" + (ansi rst) + "\n" +
" provisioning mfa totp enroll - Enroll in TOTP\n" +
" provisioning mfa totp verify <code> - Verify TOTP code\n"
)
}
# Plugins help
def help-plugins []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "PLUGIN MANAGEMENT" + (ansi rst) + "\n\n" +
"Install, configure, and manage Nushell plugins.\n\n" +
(ansi green) + (ansi bo) + "PLUGIN COMMANDS" + (ansi rst) + "\n" +
" provisioning plugin list - List installed plugins\n" +
" provisioning plugin install <name> - Install plugin\n"
)
}
# Utilities help
def help-utilities []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "UTILITIES & TOOLS" + (ansi rst) + "\n\n" +
"Cache management, secrets, providers, and miscellaneous tools.\n\n" +
(ansi green) + (ansi bo) + "CACHE COMMANDS" + (ansi rst) + "\n" +
" provisioning cache status - Show cache status and statistics\n" +
" provisioning cache config show - Display all cache settings\n" +
" provisioning cache config get <setting> - Get specific cache setting\n" +
" provisioning cache config set <setting> <val> - Set cache setting\n" +
" provisioning cache list [--type TYPE] - List cached items\n" +
" provisioning cache clear [--type TYPE] - Clear cache\n\n" +
(ansi green) + (ansi bo) + "OTHER UTILITIES" + (ansi rst) + "\n" +
" provisioning sops <file> - Edit encrypted file\n" +
" provisioning encrypt <file> - Encrypt configuration\n" +
" provisioning decrypt <file> - Decrypt configuration\n" +
" provisioning providers list - List available providers\n" +
" provisioning plugin list - List installed plugins\n" +
" provisioning ssh <host> - Connect to server\n\n" +
(ansi cyan) + "Cache Features:" + (ansi rst) + "\n" +
" • Intelligent TTL management (KCL: 30m, SOPS: 15m, Final: 5m)\n" +
" • 95-98% faster config loading\n" +
" • SOPS cache with 0600 permissions\n" +
" • Works without active workspace\n\n" +
(ansi cyan) + "Cache Configuration:" + (ansi rst) + "\n" +
" provisioning cache config set ttl_kcl 3000 # Set KCL TTL\n" +
" provisioning cache config set enabled false # Disable cache\n"
)
}
# Tools help
def help-tools []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "TOOLS & DEPENDENCIES" + (ansi rst) + "\n\n" +
"Tool and dependency management for provisioning system.\n\n" +
(ansi green) + (ansi bo) + "INSTALLATION" + (ansi rst) + "\n" +
" provisioning tools install - Install all tools\n" +
" provisioning tools install <tool> - Install specific tool\n" +
" provisioning tools install --update - Force reinstall all tools\n\n" +
(ansi green) + (ansi bo) + "VERSION MANAGEMENT" + (ansi rst) + "\n" +
" provisioning tools check - Check all tool versions\n" +
" provisioning tools versions - Show configured versions\n" +
" provisioning tools check-updates - Check for available updates\n" +
" provisioning tools apply-updates - Apply configuration updates\n\n" +
(ansi green) + (ansi bo) + "TOOL INFORMATION" + (ansi rst) + "\n" +
" provisioning tools show - Display tool information\n" +
" provisioning tools show all - Show all tools\n" +
" provisioning tools show provider - Show provider information\n\n" +
(ansi green) + (ansi bo) + "PINNING" + (ansi rst) + "\n" +
" provisioning tools pin <tool> - Pin tool to current version\n" +
" provisioning tools unpin <tool> - Unpin tool\n\n" +
(ansi cyan) + "Examples:" + (ansi rst) + "\n" +
" provisioning tools check # Check all versions\n" +
" provisioning tools check hcloud # Check hcloud status\n" +
" provisioning tools check-updates # Check for updates\n" +
" provisioning tools install # Install all tools\n"
)
}
# VM help
def help-vm []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "VIRTUAL MACHINE OPERATIONS" + (ansi rst) + "\n\n" +
"Manage virtual machines and hypervisors.\n\n" +
(ansi green) + (ansi bo) + "VM COMMANDS" + (ansi rst) + "\n" +
" provisioning vm create <name> - Create VM\n" +
" provisioning vm delete <name> - Delete VM\n"
)
}
# Diagnostics help
def help-diagnostics []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "DIAGNOSTICS AND HEALTH CHECKS" + (ansi rst) + "\n\n" +
"Check system status and diagnose issues.\n\n" +
(ansi green) + (ansi bo) + "STATUS COMMANDS" + (ansi rst) + "\n" +
" provisioning status - Overall system status\n" +
" provisioning health - Health check\n"
)
}
# Concepts help
def help-concepts []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "PROVISIONING CONCEPTS" + (ansi rst) + "\n\n" +
"Learn about the core concepts of the provisioning system.\n\n" +
(ansi green) + (ansi bo) + "FUNDAMENTAL CONCEPTS" + (ansi rst) + "\n" +
" workspace - A logical grouping of infrastructure\n" +
" infrastructure - Configuration for a specific deployment\n" +
" layer - Composable configuration units\n" +
" taskserv - Infrastructure services (Kubernetes, etc.)\n"
)
}
# Guides help
def help-guides []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "QUICK GUIDES AND CHEATSHEETS" + (ansi rst) + "\n\n" +
"Step-by-step guides for common tasks.\n\n" +
(ansi green) + (ansi bo) + "GETTING STARTED" + (ansi rst) + "\n" +
" provisioning guide from-scratch - Deploy from scratch\n" +
" provisioning guide quickstart - Quick reference\n" +
" provisioning guide setup-system - Complete system setup guide\n\n" +
(ansi green) + (ansi bo) + "SETUP GUIDES" + (ansi rst) + "\n" +
" provisioning guide setup-workspace - Create and configure workspaces\n" +
" provisioning guide setup-providers - Configure cloud providers\n" +
" provisioning guide setup-platform - Setup platform services\n\n" +
(ansi green) + (ansi bo) + "INFRASTRUCTURE MANAGEMENT" + (ansi rst) + "\n" +
" provisioning guide update - Update existing infrastructure safely\n" +
" provisioning guide customize - Customize with layers and templates\n\n" +
(ansi green) + (ansi bo) + "QUICK COMMANDS" + (ansi rst) + "\n" +
" provisioning sc - Quick command reference (fastest)\n" +
" provisioning guide list - Show all available guides\n"
)
}
# Integrations help
def help-integrations []: nothing -> string {
(
(ansi yellow) + (ansi bo) + "ECOSYSTEM AND INTEGRATIONS" + (ansi rst) + "\n\n" +
"Integration with external systems and tools.\n\n" +
(ansi green) + (ansi bo) + "ECOSYSTEM COMPONENTS" + (ansi rst) + "\n" +
" ProvCtl - Provisioning Control tool\n" +
" Orchestrator - Workflow engine\n"
)
}
# Main entry point
def main [...args: string] {
let category = if ($args | length) > 0 { ($args | get 0) } else { "" }
let help_text = (provisioning-help $category)
print $help_text
}
# NOTE: No entry point needed - functions are called directly from bash script