md-linear-sync
Version:
Sync Linear tickets to local markdown files with status-based folder organization
44 lines โข 2 kB
JavaScript
;
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