UNPKG

md-linear-sync

Version:

Sync Linear tickets to local markdown files with status-based folder organization

44 lines โ€ข 2 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.resetCommand = resetCommand; const fs_1 = __importDefault(require("fs")); const path_1 = __importDefault(require("path")); async function resetCommand() { console.log('๐Ÿงน Resetting all imported tickets...\n'); try { const linearDir = path_1.default.join(process.cwd(), 'linear-tickets'); if (fs_1.default.existsSync(linearDir)) { // Count files before deletion let totalFiles = 0; const statusFolders = fs_1.default.readdirSync(linearDir, { withFileTypes: true }) .filter(dirent => dirent.isDirectory()) .map(dirent => dirent.name); for (const folder of statusFolders) { const folderPath = path_1.default.join(linearDir, folder); const files = fs_1.default.readdirSync(folderPath) .filter(file => file.endsWith('.md') && file !== 'README.md'); totalFiles += files.length; } if (totalFiles === 0) { console.log('โ„น๏ธ No imported tickets found to reset'); return; } // Remove the entire linear directory fs_1.default.rmSync(linearDir, { recursive: true, force: true }); console.log(`โœ… Removed ${totalFiles} imported tickets`); console.log('๐Ÿ“ Deleted linear-tickets/ directory'); } else { console.log('โ„น๏ธ No linear-tickets/ directory found - nothing to reset'); } console.log('\n๐ŸŽ‰ Reset complete! You can now run import again.'); } catch (error) { console.error('\nโŒ Reset failed:', error instanceof Error ? error.message : 'Unknown error'); process.exit(1); } } //# sourceMappingURL=reset.js.map