MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / readHealth

Function readHealth

graph-ui/src/projects/projects-model.ts:143–156  ·  view source on GitHub ↗
(raw: unknown)

Source from the content-addressed store, hash-verified

141}
142
143export function readHealth(raw: unknown): ProjectHealth {
144 const record = isRecord(raw) ? raw : {};
145 const status = record['status'];
146 return {
147 status: status === 'healthy' || status === 'missing' || status === 'corrupt' ? status : 'unknown',
148 nodes: optionalNumber(record['nodes']),
149 edges: optionalNumber(record['edges']),
150 sizeBytes: optionalNumber(record['size_bytes']),
151 indexedAt: typeof record['indexed_at'] === 'string' && Number.isFinite(Date.parse(record['indexed_at'])) ? record['indexed_at'] : null,
152 watchRegistered: typeof record['watch_registered'] === 'boolean' ? record['watch_registered'] : null,
153 watcherRunning: typeof record['watcher_running'] === 'boolean' ? record['watcher_running'] : null,
154 reason: text(record['reason']),
155 };
156}
157
158/** Megabytes with one decimal, for a size the server gave in bytes. */
159export function megabytes(bytes: number): string {

Callers 5

projectHealthMethod · 0.90
healthyFunction · 0.90

Calls 3

optionalNumberFunction · 0.85
isRecordFunction · 0.70
textFunction · 0.70

Tested by 1

healthyFunction · 0.72