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

Function readFleetStats

scripts/telemetry-stats.js:62–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60// ── Fleet stats ───────────────────────────────────────────────────────────────
61
62function readFleetStats() {
63 const sessions = [];
64
65 if (!fs.existsSync(FLEET_DIR)) return { active_sessions: [], latest: null };
66
67 const files = fs.readdirSync(FLEET_DIR).filter(f => f.startsWith('session-') && f.endsWith('.md'));
68
69 for (const f of files) {
70 const content = fs.readFileSync(path.join(FLEET_DIR, f), 'utf8');
71 // Check for Status: active in frontmatter or body (case-insensitive)
72 if (/Status:\s*active/i.test(content)) {
73 sessions.push(f.replace(/\.md$/, ''));
74 }
75 }
76
77 const latest = sessions.length > 0 ? sessions[sessions.length - 1] : null;
78 return { active_sessions: sessions, latest };
79}
80
81// ── Hook install check ────────────────────────────────────────────────────────
82

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected