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

Function readListProjects

graph-ui/src/provider/rpc-schemas.ts:375–407  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

373}
374
375export function readListProjects(value: unknown): ListProjectsResult {
376 const raw = record(value);
377 const projects: ProjectEntry[] = [];
378 for (const entry of tableRows(raw['projects'])) {
379 const name = toText(entry['name']);
380 if (name === undefined) {
381 continue;
382 }
383 projects.push({
384 name,
385 root_path: toText(entry['root_path']),
386 nodes: toOptionalNumber(entry['nodes']),
387 edges: toOptionalNumber(entry['edges']),
388 });
389 }
390 const result: ListProjectsResult = { projects };
391 for (const key of ['total', 'returned', 'offset', 'limit'] as const) {
392 const value = raw[key];
393 if (value !== undefined) {
394 if (typeof value !== 'number' || !Number.isSafeInteger(value) || value < 0) throw new Error(`Invalid project pagination: ${key}.`);
395 result[key] = value;
396 }
397 }
398 if (raw['has_more'] !== undefined) {
399 if (typeof raw['has_more'] !== 'boolean') throw new Error('Invalid project pagination: has_more.');
400 result.hasMore = raw['has_more'];
401 }
402 if (raw['next_offset'] !== undefined && raw['next_offset'] !== null) {
403 if (typeof raw['next_offset'] !== 'number' || !Number.isSafeInteger(raw['next_offset']) || raw['next_offset'] < 0) throw new Error('Invalid project pagination: next_offset.');
404 result.nextOffset = raw['next_offset'];
405 }
406 return result;
407}
408
409export function readIndexStatus(value: unknown): IndexStatusResult {
410 const raw = record(value);

Callers 1

listProjectsMethod · 0.90

Calls 5

tableRowsFunction · 0.85
toTextFunction · 0.85
recordFunction · 0.70
toOptionalNumberFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected