MCPcopy Create free account
hub / github.com/PatrickJS/awesome-cursorrules / listFiles

Function listFiles

scripts/check-repo-hygiene.mjs:170–188  ·  view source on GitHub ↗
(startDir)

Source from the content-addressed store, hash-verified

168}
169
170function listFiles(startDir) {
171 const results = [];
172 const ignored = new Set([".git", "node_modules"]);
173
174 function walk(dir) {
175 for (const entry of readdirSync(dir, { withFileTypes: true })) {
176 if (ignored.has(entry.name)) continue;
177 const fullPath = join(dir, entry.name);
178 if (entry.isDirectory()) {
179 walk(fullPath);
180 } else if (entry.isFile()) {
181 results.push(relativeToRoot(fullPath));
182 }
183 }
184 }
185
186 walk(startDir);
187 return results;
188}
189
190function relativeToRoot(filePath) {
191 return normalize(filePath).slice(normalize(root).length + 1);

Callers 1

Calls 1

walkFunction · 0.85

Tested by

no test coverage detected