#!/usr/bin/env nu

# Simple AI test script
print "🤖 Testing AI functionality"

# Mock configuration for testing
let ai_config = {
    enabled: false
    provider: "openai"
    max_tokens: 2048
    temperature: 0.3
    timeout: 30
    enable_template_ai: true
    enable_query_ai: true
    enable_webhook_ai: false
}

print $"AI Config: ($ai_config)"

# Check for API keys
let has_openai = ($env.OPENAI_API_KEY? != null)
let has_claude = ($env.ANTHROPIC_API_KEY? != null)
let has_generic = ($env.LLM_API_KEY? != null)

print $"OpenAI API Key: ($has_openai)"
print $"Claude API Key: ($has_claude)"
print $"Generic LLM API Key: ($has_generic)"

let ai_available = $has_openai or $has_claude or $has_generic

print $"AI Available: ($ai_available)"

if $ai_available {
    print "✅ AI can be enabled once configuration is set"
} else {
    print "❌ No API keys found. Set one of:"
    print "   - OPENAI_API_KEY for OpenAI"
    print "   - ANTHROPIC_API_KEY for Claude"
    print "   - LLM_API_KEY for generic LLM"
}

print ""
print "🎯 AI Integration Features Implemented:"
print "   1. ✅ Nickel configuration schema (nickel/settings.ncl:54-79)"
print "   2. ✅ AI library (core/nulib/lib_provisioning/ai/lib.nu)"
print "   3. ✅ Template generation with AI prompts"
print "   4. ✅ Natural language queries (--ai_query flag)"
print "   5. ✅ Webhook integration for chat platforms"
print "   6. ✅ CLI command module (provisioning ai <action>)"
print ""
print "📋 Usage Examples:"
print "   # Generate templates"
print "   ./core/nulib/provisioning ai template --prompt \"3-node K8s cluster\""
print ""
print "   # Natural language queries"
print "   ./core/nulib/provisioning query --ai_query \"show AWS servers with high CPU\""
print ""
print "   # Test configuration"
print "   ./core/nulib/provisioning ai test"
