MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / main

Function main

scripts/test-bot-sweep.ts:27–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27async function main() {
28 console.log('Running identifyBotSuspects…')
29 const report = await identifyBotSuspects({ logger })
30
31 const { subject, message } = formatSweepReport(report)
32 console.log('\n--- SUBJECT ---')
33 console.log(subject)
34 console.log('\n--- RULE-BASED BODY ---')
35 console.log(message)
36
37 console.log('\nRunning agent review (Claude Sonnet 4.6)…')
38 const agentReview = await reviewSuspects({ report, logger })
39 if (agentReview) {
40 console.log('\n--- AGENT REVIEW ---')
41 console.log(agentReview)
42 } else {
43 console.log('(agent review returned null — falling back to rule-only)')
44 }
45 console.log('\n--- END ---')
46
47 const fullMessage = agentReview
48 ? `=== AGENT REVIEW (Claude Sonnet 4.6) ===\n\n${agentReview}\n\n=== RAW RULE-BASED DATA ===\n\n${message}`
49 : message
50
51 console.log(`\nSending email to ${RECIPIENT}…`)
52 const result = await sendBasicEmail({
53 email: RECIPIENT,
54 data: { subject, message: fullMessage },
55 logger,
56 })
57
58 if (result.success) {
59 console.log(`✅ Email sent (loopsId=${result.loopsId ?? 'n/a'})`)
60 } else {
61 console.error(`❌ Email failed: ${result.error}`)
62 process.exit(1)
63 }
64}
65
66main()
67 .then(() => process.exit(0))

Callers 1

test-bot-sweep.tsFile · 0.70

Calls 4

identifyBotSuspectsFunction · 0.90
formatSweepReportFunction · 0.90
reviewSuspectsFunction · 0.90
sendBasicEmailFunction · 0.90

Tested by

no test coverage detected