UNPKG

oneie

Version:

šŸ¤ ONE Personal Collaborative Intelligence - Creates personalized AI workspace from your me.md profile. Simple: npx oneie → edit me.md → generate personalized agents, workflows & missions. From students to enterprises, ONE adapts to your context.

420 lines (355 loc) • 14 kB
#!/usr/bin/env node /** * Beautiful CLI Animations and Progress Indicators * Enhanced user experience with context-aware animations */ import chalk from 'chalk'; import ora from 'ora'; export class CLIAnimations { constructor(context) { this.context = context || { type: 'professional-business' }; this.currentSpinner = null; } // Context-aware welcome animations async playWelcomeAnimation() { const animations = { 'elementary-school': this.playSchoolWelcome, 'university-research': this.playResearchWelcome, 'professional-business': this.playBusinessWelcome, 'government-agency': this.playGovernmentWelcome }; const animation = animations[this.context.type] || animations['professional-business']; await animation.call(this); } async playSchoolWelcome() { console.log(chalk.rainbow('\n🌈 Welcome to your AI Study Group! 🌈\n')); const messages = [ 'šŸŽ’ Setting up your learning workspace...', 'šŸ“š Your AI study buddies are getting ready...', 'šŸŽ® Making learning fun and interactive...', '✨ Everything is ready for your learning adventure!' ]; for (const message of messages) { await this.typewriterEffect(chalk.cyan(message), 30); await this.delay(800); } // ASCII art for kids console.log(chalk.yellow(` šŸ« Your Study Space šŸ« ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā” │ šŸ“– Learning Helper │ │ šŸŽØ Creative Friend │ │ šŸ‘« Study Partner │ ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜ `)); } async playResearchWelcome() { console.log(chalk.blue.bold('\nšŸŽ“ Academic Collaboration Environment Initializing šŸŽ“\n')); const messages = [ 'šŸ“Š Configuring research methodology frameworks...', 'šŸ”¬ Activating peer review systems...', 'šŸ“ˆ Establishing data analysis protocols...', 'šŸŽÆ Academic collaboration space ready!' ]; for (const message of messages) { await this.typewriterEffect(chalk.blue(message), 25); await this.delay(1000); } console.log(chalk.blue(` šŸ›ļø Research Collaboration Lab ╔═══════════════════════════╗ ā•‘ šŸŽ“ Research Collaborator ā•‘ ā•‘ šŸ“Š Data Analyst ā•‘ ā•‘ šŸ”¬ Methodology Guide ā•‘ ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• `)); } async playBusinessWelcome() { console.log(chalk.green.bold('\nšŸ’¼ Executive AI Partnership Activated šŸ’¼\n')); const messages = [ 'šŸš€ Initializing strategic planning systems...', 'šŸ“ˆ Activating market intelligence networks...', '⚔ Deploying execution coordination protocols...', 'šŸŽÆ Your AI co-founders are ready to scale!' ]; for (const message of messages) { await this.typewriterEffect(chalk.green(message), 20); await this.delay(900); } console.log(chalk.green(` šŸ¢ Executive Suite ╔═══════════════════════════╗ ā•‘ šŸ’¼ Executive Partner ā•‘ ā•‘ šŸ“Š Strategy Analyst ā•‘ ā•‘ ⚔ Implementation Lead ā•‘ ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• `)); } async playGovernmentWelcome() { console.log(chalk.blue.bold('\nšŸ›ļø Public Service AI Partnership Established šŸ›ļø\n')); const messages = [ 'šŸ“‹ Establishing regulatory compliance frameworks...', 'šŸ”’ Activating transparency and accountability systems...', 'šŸ‘„ Configuring citizen-focused service protocols...', 'āœ… Institutional AI partners ready for public service!' ]; for (const message of messages) { await this.typewriterEffect(chalk.blue(message), 25); await this.delay(1000); } console.log(chalk.blue(` šŸ›ļø Public Service Center ╔═══════════════════════════╗ ā•‘ šŸ“‹ Policy Analyst ā•‘ ā•‘ šŸ”’ Compliance Partner ā•‘ ā•‘ šŸ‘„ Public Service Guide ā•‘ ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā• `)); } // Context-aware progress spinners createContextSpinner(message) { const spinnerTypes = { 'elementary-school': { spinner: 'rainbow', color: 'cyan', prefix: '🌟' }, 'university-research': { spinner: 'dots12', color: 'blue', prefix: 'šŸ”¬' }, 'professional-business': { spinner: 'arrow3', color: 'green', prefix: 'šŸš€' }, 'government-agency': { spinner: 'clock', color: 'blue', prefix: 'šŸ›ļø' } }; const config = spinnerTypes[this.context.type] || spinnerTypes['professional-business']; return ora({ text: `${config.prefix} ${message}`, spinner: config.spinner, color: config.color }); } // Enhanced success celebrations async celebrateSuccess() { const celebrations = { 'elementary-school': this.celebrateSchoolSuccess, 'university-research': this.celebrateResearchSuccess, 'professional-business': this.celebrateBusinessSuccess, 'government-agency': this.celebrateGovernmentSuccess }; const celebration = celebrations[this.context.type] || celebrations['professional-business']; await celebration.call(this); } async celebrateSchoolSuccess() { console.log(chalk.rainbow('\nšŸŽ‰ AWESOME! Your AI Study Group is Ready! šŸŽ‰\n')); const messages = [ 'šŸ† You did great setting this up!', 'šŸ¤ Your AI friends are excited to help!', 'šŸ“š Ready to make learning super fun!', '⭐ Let\'s learn amazing things together!' ]; for (const message of messages) { console.log(chalk.yellow(` ${message}`)); await this.delay(500); } console.log(chalk.rainbow('\n✨ Time to start your first learning mission! ✨\n')); } async celebrateResearchSuccess() { console.log(chalk.blue.bold('\nšŸŽ“ Academic Collaboration Framework Established! šŸŽ“\n')); const messages = [ 'šŸ“Š Methodology frameworks configured', 'šŸ”¬ Peer review systems operational', 'šŸ“ˆ Data analysis protocols active', 'šŸ¤ Ready for rigorous academic collaboration' ]; for (const message of messages) { console.log(chalk.blue(` āœ“ ${message}`)); await this.delay(400); } console.log(chalk.blue.bold('\n🌟 Begin your research mission with confidence! 🌟\n')); } async celebrateBusinessSuccess() { console.log(chalk.green.bold('\nšŸš€ AI Co-Founders Successfully Onboarded! šŸš€\n')); const messages = [ 'šŸ’¼ Executive partnership established', 'šŸ“Š Strategic intelligence systems online', '⚔ Implementation protocols activated', 'šŸŽÆ Ready to scale your business exponentially' ]; for (const message of messages) { console.log(chalk.green(` āœ“ ${message}`)); await this.delay(400); } console.log(chalk.green.bold('\nšŸ’Ž Time to launch your next strategic mission! šŸ’Ž\n')); } async celebrateGovernmentSuccess() { console.log(chalk.blue.bold('\nšŸ›ļø Public Service AI Partnership Operational! šŸ›ļø\n')); const messages = [ 'šŸ“‹ Regulatory compliance frameworks established', 'šŸ”’ Transparency protocols activated', 'šŸ‘„ Citizen-focused systems operational', 'āœ… Ready to serve the public with excellence' ]; for (const message of messages) { console.log(chalk.blue(` āœ“ ${message}`)); await this.delay(400); } console.log(chalk.blue.bold('\n🌟 Begin your public service mission! 🌟\n')); } // Progress tracking animations async showProgress(total, current, task) { const percentage = Math.round((current / total) * 100); const progressBar = this.createProgressBar(percentage); const progressDisplay = { 'elementary-school': `🌟 ${progressBar} ${percentage}% - ${task}`, 'university-research': `šŸ”¬ ${progressBar} ${percentage}% - ${task}`, 'professional-business': `šŸš€ ${progressBar} ${percentage}% - ${task}`, 'government-agency': `šŸ›ļø ${progressBar} ${percentage}% - ${task}` }; const display = progressDisplay[this.context.type] || progressDisplay['professional-business']; process.stdout.write(`\r${display}`); if (current === total) { process.stdout.write('\n'); } } createProgressBar(percentage) { const width = 20; const filled = Math.round((percentage / 100) * width); const empty = width - filled; const filledChar = this.context.type === 'elementary-school' ? '🌟' : 'ā–ˆ'; const emptyChar = this.context.type === 'elementary-school' ? '⭐' : 'ā–‘'; return `[${'ā–ˆ'.repeat(filled)}${'ā–‘'.repeat(empty)}]`; } // Typewriter effect for messages async typewriterEffect(message, speed = 30) { process.stdout.write('\r' + ' '.repeat(process.stdout.columns || 80) + '\r'); for (let i = 0; i <= message.length; i++) { process.stdout.write('\r' + message.slice(0, i)); await this.delay(speed); } process.stdout.write('\n'); } // Interactive dialogue animations async showDialogue(speaker, message, delay = 1500) { const speakerStyles = { 'human': chalk.cyan('šŸ‘¤ Human User:'), 'installation-agent': chalk.magenta('šŸ¤– Installation Agent:'), 'integration-specialist': chalk.cyan('šŸ¤– Integration Specialist:'), 'system': chalk.gray('šŸ’» System:') }; const styledSpeaker = speakerStyles[speaker] || chalk.white(`šŸ¤– ${speaker}:`); console.log(styledSpeaker, chalk.white(`"${message}"`)); await this.delay(delay); } // Context-aware next steps animation async showNextSteps() { const nextStepsConfig = { 'elementary-school': { title: 'šŸŽ® Fun Next Steps:', color: 'yellow', icon: '✨' }, 'university-research': { title: 'šŸ“š Research Next Steps:', color: 'blue', icon: 'šŸŽÆ' }, 'professional-business': { title: 'šŸš€ Strategic Next Steps:', color: 'green', icon: 'šŸ’Ž' }, 'government-agency': { title: 'šŸ›ļø Public Service Next Steps:', color: 'blue', icon: '🌟' } }; const config = nextStepsConfig[this.context.type] || nextStepsConfig['professional-business']; console.log(chalk[config.color](config.title)); const contextSteps = this.getContextSpecificSteps(); for (let i = 0; i < contextSteps.length; i++) { await this.delay(300); console.log(chalk.white(` ${i + 1}. ${config.icon} ${contextSteps[i]}`)); } } getContextSpecificSteps() { const steps = { 'elementary-school': [ 'Create your first learning mission', 'Chat with your AI study partners', 'Get help with homework and projects', 'Celebrate your learning wins!' ], 'university-research': [ 'Start: Collaborative research project', 'Work with AI research partners', 'Develop academic methodology together', 'Prepare for peer review and publication' ], 'professional-business': [ 'Launch: Strategic business mission', 'Collaborate with AI executive partners', 'Scale your business with AI intelligence', 'Monitor and optimize performance' ], 'government-agency': [ 'Begin: Public service mission', 'Partner with compliant AI agents', 'Develop policy with full transparency', 'Measure citizen impact and satisfaction' ] }; return steps[this.context.type] || steps['professional-business']; } // Utility methods delay(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } cleanup() { if (this.currentSpinner) { this.currentSpinner.stop(); this.currentSpinner = null; } } } // Predefined animation sequences for different phases export const AnimationSequences = { INSTALLATION_PHASES: [ { phase: 'analysis', message: 'Analyzing your project architecture', duration: 2000 }, { phase: 'context', message: 'Detecting context and adapting intelligence', duration: 1500 }, { phase: 'framework', message: 'Creating collaborative framework', duration: 2500 }, { phase: 'integration', message: 'Integrating lifecycle workflows', duration: 2000 }, { phase: 'validation', message: 'Validating collaborative setup', duration: 1500 } ], CONTEXT_MESSAGES: { 'elementary-school': { welcome: 'šŸŽ® Hey! Let\'s build something awesome with AI friends!', success: '🌟 Your AI study group is ready to help with homework!', encouragement: 'You\'re going to learn so many cool things together!' }, 'university-research': { welcome: 'šŸŽ“ Initializing academic collaboration environment...', success: 'šŸ“š Your academic collaboration partners are initialized!', encouragement: 'Ready to advance knowledge through rigorous research!' }, 'professional-business': { welcome: 'šŸ’¼ Deploying executive AI partnership systems...', success: 'šŸš€ Your AI co-founders are ready to scale your business!', encouragement: 'Time to achieve exponential business growth!' }, 'government-agency': { welcome: 'šŸ›ļø Establishing institutional AI governance framework...', success: 'āœ… Your institutional AI partners are compliant and ready!', encouragement: 'Ready to serve citizens with enhanced capabilities!' } } };