MCPcopy Create free account
hub / github.com/driangle/taskmd / walkDirectory

Function walkDirectory

apps/cli/internal/taskcontext/resolve.go:191–216  ·  view source on GitHub ↗

walkDirectory recursively collects files from a directory, skipping known junk directories.

(dir, projectRoot, source string, seen map[string]bool)

Source from the content-addressed store, hash-verified

189
190// walkDirectory recursively collects files from a directory, skipping known junk directories.
191func walkDirectory(dir, projectRoot, source string, seen map[string]bool) []FileEntry {
192 var result []FileEntry
193 _ = filepath.WalkDir(dir, func(path string, d os.DirEntry, err error) error {
194 if err != nil {
195 return nil
196 }
197 if d.IsDir() {
198 if skipDirs[d.Name()] {
199 return filepath.SkipDir
200 }
201 return nil
202 }
203 rel, relErr := filepath.Rel(projectRoot, path)
204 if relErr != nil || seen[rel] {
205 return nil
206 }
207 seen[rel] = true
208 result = append(result, FileEntry{
209 Path: rel,
210 Source: source,
211 Exists: true,
212 })
213 return nil
214 })
215 return result
216}
217
218// filterGitIgnored removes gitignored files from the list using git check-ignore.
219// Falls back gracefully (returns input unchanged) if git is unavailable or the project is not a repo.

Callers 1

expandDirectoriesFunction · 0.85

Calls 1

NameMethod · 0.65

Tested by

no test coverage detected