UNPKG

capsule-ai-cli

Version:

The AI Model Orchestrator - Intelligent multi-model workflows with device-locked licensing

47 lines 1.94 kB
import { authService } from '../../services/auth.js'; import { stateService } from '../../services/state.js'; import chalk from 'chalk'; export const activateCommand = { name: 'activate', alias: ['a'], description: 'Activate Capsule with your activation code', execute: async (args) => { if (args.length > 0) { const activationCode = args.join(' ').trim().toUpperCase(); const codePattern = /^CAPS-[A-Z0-9]{4}-[A-Z0-9]{4}-[A-Z0-9]{4}$/; if (!codePattern.test(activationCode)) { return { success: false, message: chalk.red('Invalid activation code format.\n') + chalk.gray('Expected format: CAPS-XXXX-XXXX-XXXX') }; } try { const deviceId = authService.getDeviceId(); console.log(chalk.gray(`Device ID: ${deviceId.substring(0, 8)}...`)); console.log(chalk.yellow('Activating...')); const result = await authService.activate(activationCode); const newStatus = await authService.getStatus(); stateService.setLicenseStatus(newStatus); return { success: true, message: chalk.green('✓ Activation successful!\n') + chalk.gray(`Email: ${result.email}\n`) + chalk.gray(`Tier: ${result.tier.toUpperCase()}\n`) + chalk.cyan('\nYou can now use all Capsule features!') }; } catch (error) { return { success: false, message: chalk.red(`Activation failed: ${error.message}`) }; } } return { success: true, showActivationUI: true }; } }; //# sourceMappingURL=activate.js.map