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

Function resolveRuleDirectoryEntry

src/services/rules/rules.ts:218–239  ·  view source on GitHub ↗
(
	entry: Dirent,
	dirPath: string,
	fileInfo: RuleFileInfo[],
	depth: number,
	rulesDirectoryPath: string,
	originalDirPath = dirPath,
)

Source from the content-addressed store, hash-verified

216}
217
218async function resolveRuleDirectoryEntry(
219 entry: Dirent,
220 dirPath: string,
221 fileInfo: RuleFileInfo[],
222 depth: number,
223 rulesDirectoryPath: string,
224 originalDirPath = dirPath,
225): Promise<void> {
226 if (depth > MAX_DEPTH) {
227 return
228 }
229
230 const fullPath = path.resolve(entry.parentPath || dirPath, entry.name)
231 const originalPath = path.join(originalDirPath, path.relative(dirPath, fullPath))
232 if (entry.isFile()) {
233 if (await isRealPathInsideDirectory(fullPath, rulesDirectoryPath)) {
234 fileInfo.push({ originalPath, resolvedPath: fullPath, isSymlink: originalPath !== fullPath })
235 }
236 } else if (entry.isSymbolicLink()) {
237 await resolveRuleSymlink(fullPath, fileInfo, depth + 1, rulesDirectoryPath, originalPath)
238 }
239}
240
241async function resolveRuleSymlink(
242 symlinkPath: string,

Callers 2

scanRuleDirectoryFunction · 0.85
resolveRuleSymlinkFunction · 0.85

Calls 2

resolveRuleSymlinkFunction · 0.85

Tested by

no test coverage detected