MCPcopy
hub / github.com/Fission-AI/OpenSpec / walk

Function walk

test/cli-e2e/store-lifecycle.test.ts:65–77  ·  view source on GitHub ↗
(current: string)

Source from the content-addressed store, hash-verified

63 const snapshot = new Map<string, string>();
64
65 async function walk(current: string): Promise<void> {
66 const entries = await fs.readdir(current, { withFileTypes: true });
67 for (const entry of entries) {
68 const absolute = path.join(current, entry.name);
69 const relative = path.relative(root, absolute).split(path.sep).join('/');
70 if (entry.isDirectory()) {
71 snapshot.set(`${relative}/`, '');
72 await walk(absolute);
73 } else {
74 snapshot.set(relative, await fs.readFile(absolute, 'utf-8'));
75 }
76 }
77 }
78
79 await walk(root);
80 return snapshot;

Callers 2

snapshotDirectoryFunction · 0.70
listRelativeEntriesFunction · 0.70

Calls 2

readFileMethod · 0.80
hasMethod · 0.80

Tested by

no test coverage detected