#!/usr/bin/env node /** * 飞书推送脚本 * 将昨日简报推送至飞书 */ const fs = require('fs'); const path = require('path'); const DAILY_DIR = path.join(__dirname, '../../daily'); function getYesterdayDate() { const d = new Date(); d.setDate(d.getDate() - 1); return d.toLocaleDateString('zh-CN', { year: 'numeric', month: '2-digit', day: '2-digit', timeZone: 'Asia/Shanghai' }).replace(/\//g, '-'); } async function main() { const yesterday = getYesterdayDate(); const reportPath = path.join(DAILY_DIR, `${yesterday}.md`); if (!fs.existsSync(reportPath)) { console.log(`❌ 未找到昨日简报: ${reportPath}`); return { success: false, error: 'Report not found' }; } const content = fs.readFileSync(reportPath, 'utf8'); console.log(`📋 昨日简报 (${yesterday}):\n`); console.log(content.slice(0, 500) + '...\n'); return { success: true, date: yesterday, content }; } if (require.main === module) { main().catch(console.error); } module.exports = { main };