()
| 190 | } |
| 191 | |
| 192 | function main() { |
| 193 | const args = parseArgs(process.argv); |
| 194 | if (args.help) { |
| 195 | console.log('Usage: node scripts/recall-verify-report.js [--since <Nh|Nm|Nd|ISO>] [--json]'); |
| 196 | process.exit(0); |
| 197 | } |
| 198 | |
| 199 | let sinceMs = null; |
| 200 | if (args.since) { |
| 201 | const parsed = parseSince(args.since); |
| 202 | if (parsed === undefined) { |
| 203 | console.error('Error: --since must be ISO-8601 or a duration like 1h / 30m / 2d (got: ' + args.since + ')'); |
| 204 | process.exit(1); |
| 205 | } |
| 206 | sinceMs = parsed; |
| 207 | } |
| 208 | |
| 209 | const allEvents = tryReadMemoryGraphEvents(20000); |
| 210 | const filtered = allEvents.filter(function (ev) { |
| 211 | if (!ev || ev.kind !== 'recall_verify') return false; |
| 212 | if (sinceMs != null && Number.isFinite(ev.ts) && ev.ts < sinceMs) return false; |
| 213 | return true; |
| 214 | }); |
| 215 | |
| 216 | const result = aggregate(filtered); |
| 217 | |
| 218 | if (args.json) { |
| 219 | console.log(JSON.stringify({ |
| 220 | since: sinceMs ? new Date(sinceMs).toISOString() : null, |
| 221 | ...result, |
| 222 | }, null, 2)); |
| 223 | } else { |
| 224 | printMarkdown(result, sinceMs); |
| 225 | } |
| 226 | |
| 227 | process.exit(result.gate === 'GREEN' ? 0 : 2); |
| 228 | } |
| 229 | |
| 230 | if (require.main === module) { |
| 231 | main(); |
no test coverage detected