UNPKG

@noanswer/context-compose

Version:

Orchestrate complex AI interactions with Context Compose. A powerful CLI and server for building, validating, and managing context for large language models using the Model Context Protocol (MCP).

79 lines β€’ 2.75 kB
import { Command } from 'commander'; import { EnvLoader } from '../../core/env.js'; /** * Create environment variable command */ export function createEnvCommand() { const envCommand = new Command('env'); envCommand .description('Check environment variable configuration status') .option('-s, --setup', 'Show .env file setup guide') .action(async (options) => { try { if (options.setup) { showEnvSetupGuide(); } else { // Display overall environment variable status EnvLoader.printStatus(); } } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); console.error(`❌ Error checking environment variables: ${errorMessage}`); process.exit(1); } }); // Improve help envCommand.on('--help', () => { console.log(''); console.log('Usage examples:'); console.log(' $ mcp-tool env'); console.log(' $ mcp-tool env --setup'); console.log(''); console.log('Description:'); console.log(' This command checks .env file and environment variable configuration status.'); }); return envCommand; } /** * Show .env file setup guide */ function showEnvSetupGuide() { console.log('πŸ”§ .env File Setup Guide'); console.log(''); console.log('1. Create .env file in project root:'); console.log(' $ touch .env'); console.log(''); console.log('2. Add the following content to .env file:'); console.log(''); console.log('# OpenWeather API Key'); console.log('OPENWEATHER_API_KEY=your_api_key_here'); console.log(''); console.log('# GitHub Token'); console.log('GITHUB_TOKEN=your_github_token_here'); console.log(''); console.log('3. Verify configuration:'); console.log(' $ mcp-tool env'); console.log(''); console.log('πŸ’‘ You can set other environment variables by referring to .env.example file.'); } /** * ν™˜κ²½λ³€μˆ˜ λͺ…λ Ή μ‚¬μš© μ˜ˆμ‹œ ν‘œμ‹œ */ export function showEnvExamples() { console.log('πŸ”§ ν™˜κ²½λ³€μˆ˜ λͺ…λ Ή μ‚¬μš© μ˜ˆμ‹œ:'); console.log(''); console.log('κΈ°λ³Έ μ‚¬μš©λ²•:'); console.log(' $ mcp-tool env'); console.log(' β†’ 전체 ν™˜κ²½λ³€μˆ˜ μƒνƒœ 확인'); console.log(''); console.log('μ„€μ • κ°€μ΄λ“œ:'); console.log(' $ mcp-tool env --setup'); console.log(' β†’ .env 파일 μ„€μ • 방법 μ•ˆλ‚΄'); console.log(''); console.log('ν™˜κ²½λ³€μˆ˜ 파일:'); console.log(' πŸ“ .env (μ‹€μ œ μ„€μ • 파일)'); console.log(' πŸ“ .env.example (μ˜ˆμ‹œ 파일)'); } //# sourceMappingURL=env.js.map