UNPKG

alnilam-cli

Version:

Git-native AI career coach that converts multi-year ambitions into weekly execution

198 lines (197 loc) β€’ 9.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.achievementsCommand = exports.celebrateCommand = void 0; const commander_1 = require("commander"); const api_js_1 = require("../lib/api.js"); const celebrateCommand = new commander_1.Command('celebrate'); exports.celebrateCommand = celebrateCommand; celebrateCommand .description('Celebrate goal completion with ceremony') .argument('<goal-id>', 'ID of the goal to celebrate') .option('--milestone', 'Mark as milestone achievement') .option('--quiet', 'Skip celebration animation') .action(async (goalId, options) => { try { // Fetch the goal details const response = await api_js_1.restClient.get(`/goals?id=eq.${goalId}`, { params: { select: '*' } }); const goals = response.data || []; if (goals.length === 0) { console.error('❌ Goal not found'); process.exit(1); } const goal = goals[0]; if (!options.quiet) { // Celebration animation console.log('\nπŸŽ‰ GOAL COMPLETION CEREMONY πŸŽ‰'); console.log('═'.repeat(60)); // ASCII celebration console.log(` ╔════════════════════════════════════════════════════════╗ β•‘ 🌟 Β‘OBJETIVO COMPLETADO! GOAL ACCOMPLISHED! 🌟 β•‘ β•‘ β•‘ β•‘ ${goal.title.substring(0, 50).padEnd(50)} β•‘ β•‘ β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• `); // Milestone celebration if (options.milestone) { console.log(` β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ β–“ β–“ β–“ πŸ”οΈ MILESTONE ACHIEVED πŸ”οΈ β–“ β–“ β–“ β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“β–“ `); } // Goal details console.log('🎯 Achievement Details:'); console.log('─'.repeat(30)); console.log(`πŸ“‹ Title: ${goal.title}`); console.log(`πŸ”­ Horizon: ${goal.horizon}`); if (goal.description) { console.log(`πŸ“ Description: ${goal.description}`); } if (goal.target_date) { const targetDate = new Date(goal.target_date); const now = new Date(); const diffDays = Math.ceil((now.getTime() - targetDate.getTime()) / (1000 * 60 * 60 * 24)); if (diffDays <= 0) { console.log(`πŸ“… Completed ON TIME! (target: ${targetDate.toLocaleDateString()})`); } else { console.log(`πŸ“… Completed ${diffDays} days after target (${targetDate.toLocaleDateString()})`); } } const createdDate = new Date(goal.created_at); const completedDate = new Date(); const durationDays = Math.ceil((completedDate.getTime() - createdDate.getTime()) / (1000 * 60 * 60 * 24)); console.log(`⏱️ Duration: ${durationDays} days from creation to completion`); // Motivational message console.log('\nπŸ’ͺ Motivational Impact:'); console.log('─'.repeat(30)); const messages = [ "Every completed goal is a step closer to your bigger vision! 🌟", "Consistency beats intensity - you're building unstoppable momentum! πŸš€", "Small wins compound into major victories! Keep going! πŸ’ͺ", "You're not just completing tasks, you're becoming who you want to be! ✨", "Progress, not perfection. You're doing amazing! 🎯" ]; const randomMessage = messages[Math.floor(Math.random() * messages.length)]; console.log(`✨ ${randomMessage}`); // Progress stats console.log('\nπŸ“Š Progress Impact:'); console.log('─'.repeat(30)); // Get related evidence count try { const evidenceResponse = await api_js_1.restClient.get('/evidence', { params: { select: 'id', 'goal_id': `eq.${goalId}` } }); const evidenceCount = evidenceResponse.data?.length || 0; console.log(`πŸ“ˆ Evidence collected: ${evidenceCount} items`); } catch (e) { // Ignore error } // Horizon-specific celebration const horizonCelebration = { 'weekly': 'πŸ—“οΈ Weekly goal completed - building consistent habits!', 'quarterly': 'πŸ“Š Quarterly milestone achieved - major progress made!', 'annual': '🎊 Annual goal completed - incredible dedication!', 'multi-year': 'πŸ† Multi-year vision realized - legendary achievement!' }; console.log(`πŸŽ–οΈ ${horizonCelebration[goal.horizon] || 'Great achievement!'}`); console.log('\n' + '═'.repeat(60)); console.log('🌈 Share your success! Update your goal status with: alnl goal list'); console.log('🎯 Ready for the next challenge? Create a new goal: alnl goal add'); console.log('═'.repeat(60) + '\n'); } else { console.log(`βœ… Goal "${goal.title}" celebration complete!`); } } catch (error) { console.error('❌ Celebration error:', error.message); process.exit(1); } }); // Add achievement stats command const achievementsCommand = new commander_1.Command('achievements'); exports.achievementsCommand = achievementsCommand; achievementsCommand .description('View achievement statistics and milestones') .option('--summary', 'Show summary statistics only') .action(async (options) => { try { console.log('πŸ† Achievement Dashboard'); console.log('═'.repeat(50)); // Fetch goals const response = await api_js_1.restClient.get('/goals', { params: { select: '*', order: 'created_at.desc' } }); const goals = response.data || []; if (goals.length === 0) { console.log('🎯 No goals yet - start your achievement journey!'); console.log('πŸ’‘ Create your first goal: alnl goal add'); return; } // Calculate statistics const stats = { total: goals.length, completed: goals.filter(g => g.status === 'completed').length, active: goals.filter(g => g.status === 'active').length, paused: goals.filter(g => g.status === 'paused').length }; const completionRate = Math.round((stats.completed / stats.total) * 100); console.log('πŸ“Š Achievement Statistics:'); console.log('─'.repeat(30)); console.log(`🎯 Total Goals: ${stats.total}`); console.log(`βœ… Completed: ${stats.completed} (${completionRate}%)`); console.log(`πŸ”„ Active: ${stats.active}`); console.log(`⏸️ Paused: ${stats.paused}`); // Progress bar for completion rate const barLength = 30; const filled = Math.round((completionRate / 100) * barLength); const progressBar = 'β–ˆ'.repeat(filled) + 'β–‘'.repeat(barLength - filled); console.log(`πŸ“ˆ Progress: [${progressBar}] ${completionRate}%`); if (!options.summary) { // Show completed goals const completedGoals = goals.filter(g => g.status === 'completed'); if (completedGoals.length > 0) { console.log('\nπŸ… Recent Achievements:'); console.log('─'.repeat(30)); completedGoals.slice(0, 5).forEach((goal, index) => { const horizon = goal.horizon === 'weekly' ? 'πŸ“…' : goal.horizon === 'quarterly' ? 'πŸ“Š' : goal.horizon === 'annual' ? 'πŸ—“οΈ' : 'πŸ”­'; console.log(`${index + 1}. ${horizon} ${goal.title}`); }); if (completedGoals.length > 5) { console.log(` ... and ${completedGoals.length - 5} more achievements!`); } } // Horizon breakdown console.log('\n🎯 Goals by Horizon:'); console.log('─'.repeat(30)); ['weekly', 'quarterly', 'annual', 'multi-year'].forEach(horizon => { const horizonGoals = goals.filter(g => g.horizon === horizon); const completed = horizonGoals.filter(g => g.status === 'completed').length; const emoji = horizon === 'weekly' ? 'πŸ“…' : horizon === 'quarterly' ? 'πŸ“Š' : horizon === 'annual' ? 'πŸ—“οΈ' : 'πŸ”­'; if (horizonGoals.length > 0) { console.log(`${emoji} ${horizon}: ${completed}/${horizonGoals.length} completed`); } }); } console.log('\nπŸ’‘ Celebrate a goal: alnl celebrate <goal-id>'); } catch (error) { console.error('❌ Achievements error:', error.message); process.exit(1); } });