UNPKG

gh-legacy

Version:

A powerful GitHub CLI tool for automatic repository ownership transfer to trusted beneficiaries after periods of inactivity

21 lines (18 loc) 660 B
// commands/heartbeat.js const fs = require('fs'); const path = require('path'); const CONFIG_PATH = path.join(__dirname, '../db.json'); exports.heartbeat = () => { if (!fs.existsSync(CONFIG_PATH)) { console.error('❌ No configuration found. Run "gh-legacy init" first.'); return; } try { const config = JSON.parse(fs.readFileSync(CONFIG_PATH)); config.lastHeartbeat = new Date().toISOString(); fs.writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2)); console.log('💓 Heartbeat recorded at:', new Date().toLocaleString()); } catch (error) { console.error('❌ Error recording heartbeat:', error.message); } };