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

Function writeIndex

core/memory/blocks.js:233–250  ·  view source on GitHub ↗
(projectRoot, blocks)

Source from the content-addressed store, hash-verified

231}
232
233function writeIndex(projectRoot, blocks) {
234 fs.mkdirSync(memoryRoot(projectRoot), { recursive: true });
235 const index = {
236 generated_at: new Date().toISOString(),
237 block_count: blocks.length,
238 types: BLOCK_TYPES,
239 blocks: blocks.map((entry) => ({
240 id: entry.id,
241 type: entry.type,
242 scope: entry.scope,
243 confidence: entry.confidence,
244 file: `blocks/${slug(entry.id)}.json`,
245 })),
246 };
247 const filePath = path.join(memoryRoot(projectRoot), 'index.json');
248 fs.writeFileSync(filePath, `${JSON.stringify(index, null, 2)}\n`, 'utf8');
249 return filePath;
250}
251
252function compileMemoryBlocks(projectRoot, options = {}) {
253 const blocks = buildBlocks(projectRoot, options);

Callers 1

compileMemoryBlocksFunction · 0.85

Calls 2

memoryRootFunction · 0.85
slugFunction · 0.70

Tested by

no test coverage detected