MCPcopy Create free account
hub / github.com/Work-Fisher/code-claw / walkFiles

Function walkFiles

compatible-shell/src/tools.mjs:350–377  ·  view source on GitHub ↗
(rootDir, visitFile)

Source from the content-addressed store, hash-verified

348}
349
350async function walkFiles(rootDir, visitFile) {
351 const stack = [rootDir]
352
353 while (stack.length > 0) {
354 const current = stack.pop()
355 const entries = await fs.readdir(current, { withFileTypes: true })
356
357 for (const entry of entries) {
358 const fullPath = path.join(current, entry.name)
359
360 if (entry.isDirectory()) {
361 if (!SEARCH_SKIP_DIRS.has(entry.name)) {
362 stack.push(fullPath)
363 }
364 continue
365 }
366
367 if (!entry.isFile()) {
368 continue
369 }
370
371 const shouldContinue = await visitFile(fullPath)
372 if (shouldContinue === false) {
373 return
374 }
375 }
376 }
377}
378
379function resolveWorkspacePath(workspaceDir, requestedPath) {
380 const absoluteWorkspace = path.resolve(workspaceDir)

Callers 1

searchTextFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected