(
{
reverify,
getMemoryFiles,
logDebug,
cacheReadFileState,
}: ReplStartupMemoryDispatchDeps,
)
| 16 | } |
| 17 | |
| 18 | export async function dispatchReplStartupMemory( |
| 19 | { |
| 20 | reverify, |
| 21 | getMemoryFiles, |
| 22 | logDebug, |
| 23 | cacheReadFileState, |
| 24 | }: ReplStartupMemoryDispatchDeps, |
| 25 | ): Promise<void> { |
| 26 | void reverify() |
| 27 | |
| 28 | const memoryFiles = await getMemoryFiles() |
| 29 | if (memoryFiles.length > 0) { |
| 30 | const fileList = memoryFiles |
| 31 | .map( |
| 32 | file => |
| 33 | ` [${file.type}] ${file.path} (${file.content.length} chars)${ |
| 34 | file.parent ? ` (included by ${file.parent})` : '' |
| 35 | }`, |
| 36 | ) |
| 37 | .join('\n') |
| 38 | logDebug(`Loaded ${memoryFiles.length} NCODE.md/rules files:\n${fileList}`) |
| 39 | } else { |
| 40 | logDebug('No NCODE.md/rules files found') |
| 41 | } |
| 42 | |
| 43 | for (const file of memoryFiles) { |
| 44 | cacheReadFileState(file.path, { |
| 45 | content: file.contentDiffersFromDisk |
| 46 | ? file.rawContent ?? file.content |
| 47 | : file.content, |
| 48 | timestamp: Date.now(), |
| 49 | offset: undefined, |
| 50 | limit: undefined, |
| 51 | isPartialView: !!file.contentDiffersFromDisk, |
| 52 | }) |
| 53 | } |
| 54 | } |
no test coverage detected