focus-productivity-cli
Version:
An ADHD-friendly productivity CLI tool built to run inside Warp terminal
64 lines (55 loc) • 2.65 kB
JavaScript
const { execSync } = require('child_process');
const path = require('path');
const fs = require('fs');
const chalk = require('chalk');
console.log(chalk.cyan('🎯 FocusCLI Installation'));
console.log(chalk.gray('Setting up your ADHD-friendly productivity tool...\n'));
try {
// Check if Node.js is installed
console.log(chalk.blue('📦 Checking Node.js installation...'));
const nodeVersion = execSync('node --version', { encoding: 'utf8' }).trim();
console.log(chalk.green(`✅ Node.js ${nodeVersion} found\n`));
// Install dependencies
console.log(chalk.blue('📋 Installing dependencies...'));
execSync('npm install', { stdio: 'inherit' });
console.log(chalk.green('✅ Dependencies installed\n'));
// Create global link
console.log(chalk.blue('🔗 Creating global link...'));
try {
execSync('npm link', { stdio: 'inherit' });
console.log(chalk.green('✅ Global command "focus" created\n'));
} catch (error) {
console.log(chalk.yellow('⚠️ Global link failed. You can run: node src/index.js instead\n'));
}
// Create data directory
console.log(chalk.blue('📂 Setting up data directory...'));
const os = require('os');
const dataDir = path.join(os.homedir(), '.focuscli');
if (!fs.existsSync(dataDir)) {
fs.mkdirSync(dataDir, { recursive: true });
console.log(chalk.green(`✅ Data directory created at ${dataDir}\n`));
} else {
console.log(chalk.green(`✅ Data directory exists at ${dataDir}\n`));
}
// Success message
console.log(chalk.bgGreen.black.bold(' 🎉 INSTALLATION COMPLETE! 🎉 '));
console.log();
console.log(chalk.cyan('🚀 Ready to boost your productivity!'));
console.log();
console.log(chalk.yellow('Quick Start:'));
console.log(chalk.white(' • ') + chalk.green('focus') + chalk.gray(' → Show welcome message'));
console.log(chalk.white(' • ') + chalk.green('focus add "My first task"') + chalk.gray(' → Add your first task'));
console.log(chalk.white(' • ') + chalk.green('focus start') + chalk.gray(' → Begin a focus session'));
console.log();
console.log(chalk.magenta('💡 Pro tip: Use "focus welcome" anytime for help!'));
console.log();
} catch (error) {
console.error(chalk.red('❌ Installation failed:'), error.message);
console.log();
console.log(chalk.yellow('Manual installation:'));
console.log(chalk.white('1. Run: npm install'));
console.log(chalk.white('2. Run: npm link (optional, for global access)'));
console.log(chalk.white('3. Test: node src/index.js'));
process.exit(1);
}