const FEISHU_NOTIFY_WEBHOOK_URL = process.env.FEISHU_NOTIFY_WEBHOOK_URL; export async function feishuNotify(message: string) { if (!FEISHU_NOTIFY_WEBHOOK_URL) { console.warn('Feishu notify webhook URL is not set.'); return; } try { const response = await fetch(FEISHU_NOTIFY_WEBHOOK_URL, { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ msg_type: 'text', content: { text: message, }, }), }); if (!response.ok) { console.error('Failed to send Feishu notification:', response.statusText); } } catch (error) { console.error('Error sending Feishu notification:', error); } } if (import.meta.main) { const args = process.argv.slice(2); if (args.length > 0) { const message = args.join(' \n'); feishuNotify(message); } else { console.warn('No message provided for Feishu notification.'); } }