phase-10.5: screener enhancements

This commit is contained in:
Kazuma
2026-06-11 19:18:19 -04:00
parent f0c794f0c0
commit bf2a85b5c4
51 changed files with 3745 additions and 36 deletions
+68
View File
@@ -0,0 +1,68 @@
/**
* Discord webhook smoke test — sends a FAKE digest to DISCORD_WEBHOOK_URL
* so you can verify the integration without waiting for a real signal change.
*
* Usage:
* npm run discord:test
*/
import 'dotenv/config';
import { DiscordNotifier } from '../server/domains/digest/DiscordNotifier';
import type { DigestReport } from '../server/domains/shared/types';
/* eslint-disable no-console */
if (!process.env.DISCORD_WEBHOOK_URL) {
console.error('DISCORD_WEBHOOK_URL is not set in .env');
console.error('Discord → channel → Settings → Integrations → Webhooks → New Webhook → Copy URL');
process.exit(1);
}
const fakeReport: DigestReport = {
date: new Date().toISOString().slice(0, 10),
snapshotCount: 3,
newTickers: [],
changes: [
{
ticker: 'TEST',
previousSignal: '✅ Strong Buy',
newSignal: '🔄 Neutral',
previousDate: 'yesterday',
scoreDelta: -7,
price: 123.45,
catalysts: [
{
headline: '🔧 This is a TEST message from market-screener — webhook works!',
catalyst: 'regulatory',
source: 'edgar',
url: 'https://example.com',
publishedAt: new Date().toISOString(),
},
],
},
],
maStories: [
{
headline: '🔧 TEST: SC 13D filing example (M&A section renders like this)',
catalyst: 'ma',
source: 'edgar',
url: 'https://example.com',
publishedAt: new Date().toISOString(),
},
],
};
const logger = {
log: (...args: unknown[]) => console.log(...args),
warn: (...args: unknown[]) => console.warn(...args),
write: (msg: string) => process.stdout.write(msg),
};
const ok = await new DiscordNotifier(logger).send(fakeReport);
if (ok) {
console.log('✓ Test digest posted — check your Discord channel.');
process.exit(0);
} else {
console.error('✗ Post failed. Check the webhook URL (it may have been deleted/regenerated).');
process.exit(1);
}
/* eslint-enable no-console */