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.
152 lines
5.0 KiB
Plaintext
152 lines
5.0 KiB
Plaintext
# Test Intelligent Hints System
|
|
# Tests for CLI hints, guide system, and next-step suggestions
|
|
|
|
use ../lib_provisioning/utils/hints.nu *
|
|
|
|
# Test hint utilities
|
|
export def test_show_next_step [] {
|
|
print "\n=== Testing show-next-step ==="
|
|
|
|
print "\n--- Server Create Hint ---"
|
|
show-next-step "server_create" {infra: "test-infra"}
|
|
|
|
print "\n--- Taskserv Create Hint ---"
|
|
show-next-step "taskserv_create" {name: "kubernetes"}
|
|
|
|
print "\n--- Workspace Init Hint ---"
|
|
show-next-step "workspace_init" {name: "my-project"}
|
|
|
|
print "\n--- Cluster Create Hint ---"
|
|
show-next-step "cluster_create" {name: "buildkit"}
|
|
|
|
print "\n--- Workspace Activate Hint ---"
|
|
show-next-step "workspace_activate" {name: "production"}
|
|
}
|
|
|
|
# Test documentation links
|
|
export def test_doc_links [] {
|
|
print "\n=== Testing show-doc-link ==="
|
|
|
|
print "\n--- Infrastructure Topic ---"
|
|
show-doc-link "infrastructure"
|
|
|
|
print "\n--- Workspace Topic (compact) ---"
|
|
show-doc-link "workspace" --compact
|
|
|
|
print "\n--- Quick Start Topic ---"
|
|
show-doc-link "from-scratch"
|
|
}
|
|
|
|
# Test examples
|
|
export def test_examples [] {
|
|
print "\n=== Testing show-example ==="
|
|
|
|
print "\n--- Server Create Examples ---"
|
|
show-example "server_create"
|
|
|
|
print "\n--- Taskserv Create Examples ---"
|
|
show-example "taskserv_create"
|
|
|
|
print "\n--- Workspace Init Examples ---"
|
|
show-example "workspace_init"
|
|
|
|
print "\n--- Module Discover Examples ---"
|
|
show-example "module_discover"
|
|
}
|
|
|
|
# Test error messages
|
|
export def test_errors [] {
|
|
print "\n=== Testing show-error ==="
|
|
|
|
print "\n--- Workspace Not Found Error ---"
|
|
show-error "workspace_not_found" "Workspace 'my-project' not found" "Initialize workspace first" "workspace"
|
|
|
|
print "\n--- No Servers Error ---"
|
|
show-error "no_servers" "No servers found in infrastructure" "Create servers to continue" "infrastructure"
|
|
|
|
print "\n--- Taskserv Not Found Error ---"
|
|
show-error "taskserv_not_found" "Taskserv 'unknown' not available" "Check available taskservs" "infrastructure"
|
|
|
|
print "\n--- Invalid Config Error ---"
|
|
show-error "invalid_config" "Configuration validation failed" "Review and fix configuration errors" "workspace"
|
|
|
|
print "\n--- Orchestrator Not Running Error ---"
|
|
show-error "orchestrator_not_running" "Orchestrator service not available" "Start orchestrator service" "orchestration"
|
|
}
|
|
|
|
# Test message formatting
|
|
export def test_messages [] {
|
|
print "\n=== Testing Message Formatting ==="
|
|
|
|
print "\n--- Success Messages ---"
|
|
success-message "Servers created successfully"
|
|
success-message "Custom icon test" --icon "🎉"
|
|
|
|
print "\n--- Warning Messages ---"
|
|
warning-message "Some optional services are not configured"
|
|
warning-message "Custom warning icon" --icon "⚡"
|
|
|
|
print "\n--- Info Messages ---"
|
|
info-message "Using default configuration values"
|
|
info-message "Custom info icon" --icon "📝"
|
|
}
|
|
|
|
# Test progress indicators
|
|
export def test_progress [] {
|
|
print "\n=== Testing Progress Indicators ==="
|
|
|
|
for step in 1..5 {
|
|
show-progress $step 5 $"Processing step ($step)"
|
|
}
|
|
}
|
|
|
|
# Test tips
|
|
export def test_tips [] {
|
|
print "\n=== Testing Tips ==="
|
|
|
|
print "\n--- Normal Tip ---"
|
|
show-tip "Use --check flag to preview changes without applying them"
|
|
|
|
print "\n--- Compact Tip ---"
|
|
show-tip "Compact tip format" --compact
|
|
}
|
|
|
|
# Test contextual hints
|
|
export def test_contextual_hints [] {
|
|
print "\n=== Testing Contextual Hints ==="
|
|
|
|
print "\n--- No Workspace ---"
|
|
show-contextual-hint {workspace: null, servers: [], taskservs: []}
|
|
|
|
print "\n--- Workspace but No Servers ---"
|
|
show-contextual-hint {workspace: "test", servers: [], taskservs: []}
|
|
|
|
print "\n--- Workspace and Servers but No Taskservs ---"
|
|
show-contextual-hint {workspace: "test", servers: ["server1"], taskservs: []}
|
|
}
|
|
|
|
# Run all tests
|
|
export def run_all_tests [] {
|
|
print "╔═══════════════════════════════════════════════════════╗"
|
|
print "║ INTELLIGENT HINTS SYSTEM - COMPREHENSIVE TEST SUITE ║"
|
|
print "╚═══════════════════════════════════════════════════════╝"
|
|
|
|
test_show_next_step
|
|
test_doc_links
|
|
test_examples
|
|
test_errors
|
|
test_messages
|
|
test_progress
|
|
test_tips
|
|
test_contextual_hints
|
|
|
|
print "\n╔═══════════════════════════════════════════════════════╗"
|
|
print "║ ALL TESTS COMPLETED ║"
|
|
print "╚═══════════════════════════════════════════════════════╝\n"
|
|
}
|
|
|
|
# Quick test command
|
|
export def main [] {
|
|
run_all_tests
|
|
}
|