MCPcopy Create free account
hub / github.com/EvoMap/evolver / readRecentWorkspaceEntries

Function readRecentWorkspaceEntries

src/adapters/scripts/evolver-session-start.js:299–313  ·  view source on GitHub ↗
(filePath, currentId, currentDir, n)

Source from the content-addressed store, hash-verified

297// and stop as soon as we have `n`. Parse count is bounded by where this
298// workspace's n-th-most-recent entry sits, not by total file size.
299function readRecentWorkspaceEntries(filePath, currentId, currentDir, n) {
300 let lines;
301 try {
302 lines = fs.readFileSync(filePath, 'utf8').trim().split('\n');
303 } catch { return []; }
304 const out = [];
305 for (let i = lines.length - 1; i >= 0 && out.length < n; i--) {
306 const line = lines[i];
307 if (!line) continue;
308 let entry;
309 try { entry = JSON.parse(line); } catch { continue; }
310 if (belongsToWorkspace(entry, currentId, currentDir)) out.push(entry);
311 }
312 return out.reverse(); // newest-collected-first -> chronological
313}
314
315// Does this memory-graph entry belong to the current workspace?
316//

Callers 1

runInjectionFunction · 0.85

Calls 2

belongsToWorkspaceFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected