UNPKG

emotionctl

Version:

A secure terminal-based journaling system designed as a safe space for developers going through heartbreak, breakups, or betrayal

201 lines 7.04 kB
#!/usr/bin/env node "use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); exports.main = main; const commander_1 = require("commander"); const JournalManager_1 = require("./services/JournalManager"); const AuthManager_1 = require("./services/AuthManager"); const CLIInterface_1 = require("./services/CLIInterface"); async function getChalk() { const chalk = await Promise.resolve().then(() => __importStar(require('chalk'))); return chalk.default || chalk; } async function main() { const authManager = new AuthManager_1.AuthManager(); const journalManager = new JournalManager_1.JournalManager(); const cli = new CLIInterface_1.CLIInterface(authManager, journalManager); commander_1.program .name('emotionctl') .description('A secure safe space for developers processing heartbreak, breakups, and betrayal') .version('1.0.0'); commander_1.program .command('init') .description('Create your secure safe space for emotional healing') .action(async () => { try { await cli.initializeJournal(); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error initializing journal:'), error); process.exit(1); } }); commander_1.program .command('write') .description('Process and express your emotions safely') .option('-t, --title <title>', 'Entry title') .action(async (options) => { try { await cli.writeEntry(options.title); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error writing entry:'), error); process.exit(1); } }); commander_1.program .command('read') .description('Reflect on your healing journey and emotional growth') .option('-d, --date <date>', 'Read entries from specific date (YYYY-MM-DD)') .option('-l, --list', 'List all entries') .option('-s, --search <term>', 'Search entries by term') .action(async (options) => { try { await cli.readEntries(options); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error reading entries:'), error); process.exit(1); } }); commander_1.program .command('edit') .description('Edit an existing journal entry') .option('-i, --id <id>', 'Entry ID to edit') .action(async (options) => { try { await cli.editEntry(options.id); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error editing entry:'), error); process.exit(1); } }); commander_1.program .command('delete') .description('Delete a journal entry') .option('-i, --id <id>', 'Entry ID to delete') .action(async (options) => { try { await cli.deleteEntry(options.id); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error deleting entry:'), error); process.exit(1); } }); commander_1.program .command('backup') .description('Create an encrypted backup of your journal') .option('-o, --output <path>', 'Output path for backup file') .action(async (options) => { try { await cli.createBackup(options.output); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error creating backup:'), error); process.exit(1); } }); commander_1.program .command('restore') .description('Restore journal from encrypted backup') .option('-i, --input <path>', 'Input path for backup file') .action(async (options) => { try { await cli.restoreBackup(options.input); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error restoring backup:'), error); process.exit(1); } }); commander_1.program .command('change-password') .description('Change the journal password') .action(async () => { try { await cli.changePassword(); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error changing password:'), error); process.exit(1); } }); commander_1.program .command('reset') .description('Reset the journal (WARNING: Deletes all data)') .action(async () => { try { await cli.resetJournal(); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error resetting journal:'), error); process.exit(1); } }); // Interactive mode when no command is provided if (process.argv.length === 2) { try { await cli.interactiveMode(); } catch (error) { const chalk = await getChalk(); console.error(chalk.red('Error in interactive mode:'), error); process.exit(1); } } else { commander_1.program.parse(); } } if (require.main === module) { main().catch(async (error) => { const chalk = await getChalk(); console.error(chalk.red('Unexpected error:'), error); process.exit(1); }); } //# sourceMappingURL=index.js.map