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

Function expandDirectories

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

expandDirectories replaces directory entries with their individual files recursively. It skips known junk directories and gitignored files.

(files []FileEntry, projectRoot string)

Source from the content-addressed store, hash-verified

167// expandDirectories replaces directory entries with their individual files recursively.
168// It skips known junk directories and gitignored files.
169func expandDirectories(files []FileEntry, projectRoot string) []FileEntry {
170 seen := make(map[string]bool)
171 for _, f := range files {
172 seen[f.Path] = true
173 }
174
175 var result []FileEntry
176 for _, f := range files {
177 fullPath := filepath.Join(projectRoot, f.Path)
178 info, err := os.Stat(fullPath)
179 if err != nil || !info.IsDir() {
180 result = append(result, f)
181 continue
182 }
183 expanded := walkDirectory(fullPath, projectRoot, f.Source, seen)
184 result = append(result, expanded...)
185 }
186
187 return filterGitIgnored(result, projectRoot)
188}
189
190// walkDirectory recursively collects files from a directory, skipping known junk directories.
191func walkDirectory(dir, projectRoot, source string, seen map[string]bool) []FileEntry {

Callers 1

ResolveFunction · 0.85

Calls 2

walkDirectoryFunction · 0.85
filterGitIgnoredFunction · 0.70

Tested by

no test coverage detected