(projectRoot, blocks)
| 231 | } |
| 232 | |
| 233 | function 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 | |
| 252 | function compileMemoryBlocks(projectRoot, options = {}) { |
| 253 | const blocks = buildBlocks(projectRoot, options); |
no test coverage detected