MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / newestNumeric

Function newestNumeric

src/workspaces/adapters/codex.ts:342–355  ·  view source on GitHub ↗
(dir: string, n: number)

Source from the content-addressed store, hash-verified

340 * just-spawned session is in today's leaf, so the newest few suffice. */
341async function recentDatedLeaves(root: string, count: number): Promise<string[]> {
342 const newestNumeric = async (dir: string, n: number): Promise<string[]> => {
343 let names: string[];
344 try {
345 names = await readdir(dir);
346 } catch {
347 return [];
348 }
349 return names
350 .filter((x) => /^\d+$/.test(x))
351 .sort()
352 .reverse()
353 .slice(0, n)
354 .map((x) => join(dir, x));
355 };
356 const leaves: string[] = [];
357 for (const y of await newestNumeric(root, 1)) {
358 for (const m of await newestNumeric(y, 1)) {

Callers 1

recentDatedLeavesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected