Add --telegram flag to status report, fix missing duplicate/closed counts

status.mjs --telegram sends the report to Telegram with proper bold formatting.
Console output strips markdown. Queue total now accounts for duplicates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 14:09:19 -08:00
parent cd454f8cc2
commit 199175f5f6

View File

@@ -118,9 +118,11 @@ function buildStatus() {
}, },
queue: { queue: {
total: queue.length, total: queue.length,
duplicate: byStatus['duplicate'] || 0,
new: byStatus['new'] || 0, new: byStatus['new'] || 0,
filtered: byStatus['filtered'] || 0, filtered: byStatus['filtered'] || 0,
applied: byStatus['applied'] || 0, applied: byStatus['applied'] || 0,
closed: byStatus['closed'] || 0,
failed: byStatus['failed'] || 0, failed: byStatus['failed'] || 0,
needs_answer: byStatus['needs_answer'] || 0, needs_answer: byStatus['needs_answer'] || 0,
skipped_external: byStatus['skipped_external_unsupported'] || 0, skipped_external: byStatus['skipped_external_unsupported'] || 0,
@@ -220,12 +222,14 @@ function formatReport(s) {
if (lastApplierDetail) lines.push(lastApplierDetail); if (lastApplierDetail) lines.push(lastApplierDetail);
// Queue summary — only show non-zero counts // Queue summary — only show non-zero counts
lines.push('', `📋 *Queue* — ${q.total} total`); const unique = q.total - (q.duplicate || 0);
lines.push('', `📋 *Queue* — ${unique} unique jobs (${q.duplicate || 0} dupes)`);
const queueLines = [ const queueLines = [
[q.new, 'Ready to apply'], [q.new, 'Ready to apply'],
[q.applied, 'Applied'], [q.applied, 'Applied'],
[q.filtered || 0, 'AI filtered'], [q.filtered || 0, 'AI filtered'],
[q.closed || 0, 'Closed'],
[q.needs_answer, 'Needs answer'], [q.needs_answer, 'Needs answer'],
[q.skipped_other || 0, 'Incomplete/stuck'], [q.skipped_other || 0, 'Incomplete/stuck'],
[q.skipped_no_apply, 'No apply button'], [q.skipped_no_apply, 'No apply button'],
@@ -252,10 +256,19 @@ function formatReport(s) {
return lines.join('\n'); return lines.join('\n');
} }
import { loadConfig } from './lib/queue.mjs';
import { sendTelegram } from './lib/notify.mjs';
const telegramMode = process.argv.includes('--telegram');
const status = buildStatus(); const status = buildStatus();
if (jsonMode) { if (jsonMode) {
console.log(JSON.stringify(status, null, 2)); console.log(JSON.stringify(status, null, 2));
} else { } else {
console.log(formatReport(status)); const report = formatReport(status);
console.log(report.replace(/\*/g, ''));
if (telegramMode) {
const settings = loadConfig(resolve(__dir, 'config/settings.json'));
await sendTelegram(settings, report);
}
} }