alnilam-cli
Version:
Git-native AI career coach that converts multi-year ambitions into weekly execution
198 lines (197 loc) β’ 9.95 kB
JavaScript
;
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);
}
});