MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / resolveCommandDirectoryEntry

Function resolveCommandDirectoryEntry

src/services/command/commands.ts:75–97  ·  view source on GitHub ↗

* Recursively resolve directory entries and collect command file paths

(
	entry: Dirent,
	dirPath: string,
	fileInfo: CommandFileInfo[],
	depth: number,
)

Source from the content-addressed store, hash-verified

73 * Recursively resolve directory entries and collect command file paths
74 */
75async function resolveCommandDirectoryEntry(
76 entry: Dirent,
77 dirPath: string,
78 fileInfo: CommandFileInfo[],
79 depth: number,
80): Promise<void> {
81 // Avoid cyclic symlinks
82 if (depth > MAX_DEPTH) {
83 return
84 }
85
86 const fullPath = path.resolve(entry.parentPath || dirPath, entry.name)
87 if (entry.isFile()) {
88 // Only include markdown files
89 if (isMarkdownFile(entry.name)) {
90 // Regular file - both original and resolved paths are the same
91 fileInfo.push({ originalPath: fullPath, resolvedPath: fullPath })
92 }
93 } else if (entry.isSymbolicLink()) {
94 // Await the resolution of the symbolic link
95 await resolveCommandSymLink(fullPath, fileInfo, depth + 1)
96 }
97}
98
99/**
100 * Try to resolve a symlinked command file

Callers 2

resolveCommandSymLinkFunction · 0.85
scanCommandDirectoryFunction · 0.85

Calls 2

isMarkdownFileFunction · 0.85
resolveCommandSymLinkFunction · 0.85

Tested by

no test coverage detected