MCPcopy Create free account
hub / github.com/SethGammon/Citadel / readRoutineQuota

Function readRoutineQuota

scripts/dashboard.js:605–624  ·  view source on GitHub ↗
(projectRoot, now = new Date())

Source from the content-addressed store, hash-verified

603// Reads .planning/telemetry/routine-runs.jsonl, one record per quota-consuming
604// run: {ts, kind}. Nothing in the harness writes this file yet; remote-run
605// logging populates it when a routine mechanism is actually used.
606function readRoutineQuota(projectRoot, now = new Date()) {
607 const filePath = path.join(projectRoot, '.planning', 'telemetry', 'routine-runs.jsonl');
608 const detail = readJsonlDetailed(filePath);
609 const windowStart = now.getTime() - 24 * 60 * 60 * 1000;
610
611 let runsLast24h = 0;
612 if (detail.exists) {
613 for (const entry of detail.entries) {
614 const ts = new Date(entry.ts || entry.timestamp || 0).getTime();
615 if (Number.isFinite(ts) && ts >= windowStart) runsLast24h++;
616 }
617 }
618
619 return {
620 sourceExists: detail.exists,
621 cap: ROUTINE_QUOTA_CAP,
622 runsLast24h,
623 warning: runsLast24h > ROUTINE_QUOTA_WARN_ABOVE,
624 };
625}
626
627function readQueueCounts(projectRoot) {

Callers 1

collectDashboardFunction · 0.85

Calls 1

readJsonlDetailedFunction · 0.85

Tested by

no test coverage detected