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
JavaScript
/**
* 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!'
}
}
};