#!/usr/bin/env node
// Demo script showing the API key management TUI functionality
// This simulates the TUI flow for demonstration purposes
import { getCurrentEnvValues, maskApiKey } from './build/core/envManager.js';
console.log('π§ Agent-MCP TUI - API Key Management Demo\n');
// Show current environment status
const currentEnv = getCurrentEnvValues();
console.log('π Current API Key Status:');
const keysToCheck = ['OPENAI_API_KEY', 'ANTHROPIC_API_KEY', 'HUGGINGFACE_API_KEY', 'GEMINI_API_KEY'];
for (const key of keysToCheck) {
const value = currentEnv.get(key);
if (value) {
console.log(` β
${key}: Set (${maskApiKey(value)})`);
} else {
console.log(` β ${key}: Not set`);
}
}
console.log('\nπ― TUI Features Added:');
console.log(' β’ π Direct API key configuration through TUI');
console.log(' β’ π‘οΈ Secure input with password masking');
console.log(' β’ β
Real-time validation of API key formats');
console.log(' β’ πΎ Automatic .env file management');
console.log(' β’ π Immediate environment variable reloading');
console.log(' β’ π€ SwarmCode CLI now has MCP support');
console.log('\nπ How It Works:');
console.log(' 1. Select embedding provider (OpenAI, Ollama, etc.)');
console.log(' 2. TUI automatically detects required API keys');
console.log(' 3. Secure password input with validation');
console.log(' 4. Keys saved to .env and loaded immediately');
console.log(' 5. No server restart needed - works instantly');
console.log('\nπ Ready to use! Run: npm run server');