UNPKG

@sigyl-dev/cli

Version:

Official Sigyl CLI for installing and managing MCP packages. Zero-config installation for public packages, secure API-based authentication.

123 lines 5.2 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.configCommand = void 0; const commander_1 = require("commander"); const inquirer_1 = __importDefault(require("inquirer")); const chalk_1 = __importDefault(require("chalk")); const config_1 = require("../lib/config"); exports.configCommand = new commander_1.Command("config") .description("Configure Sigyl CLI settings") .action(async () => { console.log(chalk_1.default.blue.bold("🔧 Sigyl CLI Configuration")); console.log(); const currentConfig = (0, config_1.loadConfig)(); if (currentConfig) { console.log(chalk_1.default.green("✅ Current configuration found:")); console.log(` Registry URL: ${chalk_1.default.blue(currentConfig.registryUrl || 'https://api.sigyl.dev')}`); console.log(` API Key: ${chalk_1.default.blue(currentConfig.apiKey ? currentConfig.apiKey.substring(0, 20) + '...' : 'Not set (public access only)')}`); console.log(); const { reconfigure } = await inquirer_1.default.prompt([ { type: 'confirm', name: 'reconfigure', message: 'Do you want to update the configuration?', default: false } ]); if (!reconfigure) { console.log(chalk_1.default.yellow("Configuration unchanged.")); return; } } console.log(chalk_1.default.yellow("📋 Configure your Sigyl CLI:")); console.log(chalk_1.default.gray("You can get your API key from https://sigyl.dev/dashboard")); console.log(chalk_1.default.gray("Note: API key is optional for installing public packages")); console.log(); const answers = await inquirer_1.default.prompt([ { type: 'input', name: 'registryUrl', message: 'Registry URL:', default: currentConfig?.registryUrl || 'https://api.sigyl.dev', validate: (input) => { if (!input) return 'Registry URL is required'; if (!input.startsWith('https://') && !input.startsWith('http://')) return 'URL must start with https:// or http://'; return true; } }, { type: 'password', name: 'apiKey', message: 'Sigyl API Key (optional - leave blank for public access):', default: currentConfig?.apiKey || '', validate: (input) => { if (!input) return true; // API key is optional if (!input.startsWith('sk_')) return 'API key must start with sk_'; if (input.length < 20) return 'API key seems too short, please check it'; return true; } } ]); try { const config = { registryUrl: answers.registryUrl, ...(answers.apiKey && { apiKey: answers.apiKey }) }; (0, config_1.saveConfig)(config); console.log(); console.log(chalk_1.default.green.bold("🎉 Configuration saved successfully!")); console.log(); console.log(chalk_1.default.blue("You can now use the Sigyl CLI to install MCP packages.")); console.log(chalk_1.default.gray("Run 'sigyl install <package-name>' to get started.")); } catch (error) { console.error(chalk_1.default.red("❌ Failed to save configuration:"), error); process.exit(1); } }); // Add subcommands exports.configCommand .command("show") .description("Show current configuration") .action(() => { const config = (0, config_1.getRegistryConfig)(); console.log(chalk_1.default.blue.bold("📋 Current Sigyl CLI Configuration:")); console.log(); console.log(` Registry URL: ${chalk_1.default.green(config.registryUrl)}`); console.log(` API Key: ${chalk_1.default.green(config.apiKey ? config.apiKey.substring(0, 20) + '...' : 'Not set (public access)')}`); console.log(); console.log(chalk_1.default.gray(`Configuration file: ~/.sigyl/config.json`)); console.log(chalk_1.default.gray(`Get your API key at: https://sigyl.dev/dashboard`)); }); exports.configCommand .command("reset") .description("Reset configuration to defaults") .action(async () => { const { confirm } = await inquirer_1.default.prompt([ { type: 'confirm', name: 'confirm', message: 'Are you sure you want to reset the configuration?', default: false } ]); if (confirm) { (0, config_1.saveConfig)({ registryUrl: 'https://api.sigyl.dev' }); console.log(chalk_1.default.green("✅ Configuration reset to defaults.")); console.log(chalk_1.default.yellow("💡 You can add your API key with 'sigyl config' for private packages.")); } else { console.log(chalk_1.default.yellow("Configuration unchanged.")); } }); //# sourceMappingURL=config.js.map