import { Command } from 'commander'; import { readFileSync } from 'fs'; import { fileURLToPath } from 'url'; import { login, logout, whoami } from './commands/auth.js'; import { listTasks, listChecklists, viewChecklist, addTask, completeTask, viewToday, selectWorkspace, viewHeatmap } from './commands/tasks.js'; import { launchInteractiveMode } from './commands/interactive.js'; import { showFetch } from './commands/info.js'; const pkg = JSON.parse(readFileSync(fileURLToPath(new URL('../package.json', import.meta.url)), 'utf8')); const program = new Command(); program .name('velowork') .description('VeloWork CLI - Manage your tasks and checklists directly from the terminal') .version(pkg.version || '1.0.3') .addHelpText('after', ` Logout: $ velowork logout Clear stored credentials and sign out Uninstall: $ npm uninstall -g velowork-cli `); program .command('login') .description('Authenticate with your VeloWork credentials') .action(login); program .command('logout') .description('Log out of VeloWork and clear cached sessions') .action(logout); program .command('whoami') .description('Check currently active session profile') .action(whoami); program .command('tasks') .description('List tasks in the active workspace') .action(listTasks); program .command('checklists') .description('List checklists in the active workspace') .action(listChecklists); program .command('checklist ') .description('View detailed checklist contents and tasks') .action((id) => viewChecklist(id)); program .command('add-task') .description('Select a checklist (or create a new one) to add a task to') .action(addTask); program .command('complete ') .description('Mark a task as completed using its ID prefix') .action((id) => completeTask(id)); program .command('today') .description('View tasks due today and daily progress statistics') .action(viewToday); program .command('workspace') .description('Select active workspace') .action(selectWorkspace); program .command('heatmap [year]') .description('View your task completion heatmap for a specific year') .action((year) => viewHeatmap(year)); program .command('neofetch') .alias('fetch') .description('Display system and Velowork CLI info in a cool ASCII art format') .action(showFetch); // If no arguments, enter interactive terminal mode if (process.argv.length <= 2) { launchInteractiveMode(); } else { program.parse(process.argv); }